:root {
    --bg: #140e0c;
    --surface: rgb(43 29 26 / 72%);
    --surface-strong: rgb(30 21 19 / 92%);
    --surface-hover: rgb(64 44 39 / 85%);
    --border: rgb(255 255 255 / 10%);
    --text: #f5efe9;
    --text-muted: rgb(245 239 233 / 65%);
    --accent: #f0a35e;
    --online: #3fb950;
    --offline: #f85149;
    --warning: #e3b341;
    --radius: 14px;
    --topbar-height: 64px;
    --player-bar-height: 48px;
    --sidebar-width: 240px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: 'Outfit', system-ui, sans-serif;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
}

button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

h2 {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0 0 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.hidden {
    display: none !important;
}


/* FOND */

#background {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-size: cover;
    background-position: center;
}

#background::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgb(20 14 12 / 55%) 0%, rgb(20 14 12 / 85%) 60%, var(--bg) 100%);
}


/* MISE EN PAGE : barre latérale | (barre du haut + vue) */

.layout {
    display: flex;
    height: 100%;
}

.main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.view {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}


/* BARRE LATÉRALE */

.sidebar {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: var(--sidebar-width);
    padding: 0 12px 16px;
    overflow-y: auto;
    background: rgb(20 14 12 / 75%);
    backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
}

.sidebar .brand {
    flex-shrink: 0;
    height: var(--topbar-height);
    padding: 0 10px;
    color: inherit;
    text-decoration: none;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section {
    margin: 22px 10px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-item i {
    width: 24px;
    font-size: 1.25rem;
    text-align: center;
}

.nav-item img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.nav-label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item:not(.disabled):hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: rgb(240 163 94 / 16%);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item.disabled {
    cursor: default;
    opacity: 0.5;
}

.nav-item.disabled img {
    filter: grayscale(0.6);
}

.sidebar-backdrop {
    display: none;
}


/* BARRE DU HAUT */

.topbar {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 24px;
    background: rgb(20 14 12 / 60%);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-page {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    font-size: 1.15rem;
    font-weight: 500;
}

.topbar-page i {
    color: var(--accent);
    font-size: 1.3rem;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.topbar .menu-button {
    display: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
}

.brand i {
    color: var(--accent);
    font-size: 1.6rem;
}

.profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.profile:hover {
    background: var(--surface-hover);
}

.profile .avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-weight: 700;
}

.profile .name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile i {
    color: var(--text-muted);
}


/* CONTENU */

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px;
}

.content section + section {
    margin-top: 36px;
}

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.servers-summary {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.loading {
    color: var(--text-muted);
    padding: 20px 0;
}


/* PASTILLES */

.status-dot {
    display: inline-block;
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    margin-right: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
}

.status-dot.online,
.status-dot.offline,
.status-dot.warning {
    opacity: 1;
}

.status-dot.online {
    background: var(--online);
    box-shadow: 0 0 8px var(--online);
}

.status-dot.offline {
    background: var(--offline);
}

.status-dot.warning {
    background: var(--warning);
}

.pill {
    font-size: 0.75rem;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgb(255 255 255 / 10%);
    color: var(--text-muted);
}

.pill:empty {
    display: none;
}

.pill.online {
    background: rgb(63 185 80 / 18%);
    color: var(--online);
}

.pill.offline {
    background: rgb(248 81 73 / 18%);
    color: var(--offline);
}


/* ACCUEIL */

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.content > * {
    animation: rise 0.4s ease both;
}

.content > *:nth-child(2) { animation-delay: 0.05s; }
.content > *:nth-child(3) { animation-delay: 0.1s; }
.content > *:nth-child(4) { animation-delay: 0.15s; }
.content > *:nth-child(5) { animation-delay: 0.2s; }

.greeting {
    font-size: 1.9rem;
    font-weight: 700;
    margin-bottom: 18px;
}

.hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 260px;
    padding: 36px 40px;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

/* L'icône du jeu, très floutée, colore tout le bandeau */
.hero-art {
    position: absolute;
    inset: -40%;
    width: 180%;
    height: 180%;
    object-fit: cover;
    filter: blur(60px) saturate(1.5);
    opacity: 0.55;
    pointer-events: none;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgb(20 14 12 / 85%) 0%, rgb(20 14 12 / 40%) 60%, transparent 100%);
    pointer-events: none;
}

.hero-body {
    position: relative;
    z-index: 1;
    max-width: 520px;
}

.hero-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.hero-title {
    margin: 6px 0 8px;
    font-size: 2.6rem;
    line-height: 1.1;
}

.hero-desc {
    margin: 0 0 14px;
    font-size: 1.05rem;
    color: var(--text-muted);
}

.hero-meta {
    margin-bottom: 22px;
}

.hero-meta .status {
    margin-left: 6px;
}

.btn-play {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 26px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg);
    font-size: 1.05rem;
    font-weight: 700;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-play:hover,
.btn-play:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgb(240 163 94 / 40%);
    outline: none;
}

.btn-play i {
    font-size: 1.3rem;
}

.hero-icon {
    position: relative;
    z-index: 1;
    width: 180px;
    height: 180px;
    margin-left: auto;
    object-fit: contain;
    filter: drop-shadow(0 16px 30px rgb(0 0 0 / 50%));
    transform: rotate(-6deg);
}

.content > .hero + section {
    margin-top: 28px;
}


/* BIENTÔT */

.soon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.soon-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: rgb(43 29 26 / 45%);
    border: 1px dashed var(--border);
}

.soon-card img {
    width: 44px;
    height: 44px;
    filter: grayscale(0.6);
    opacity: 0.8;
}

.soon-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.soon-title {
    font-weight: 500;
}

.soon-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
}


/* RÉCEMMENT JOUÉS */

.recent-list {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 8px 14px 8px 8px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.recent-item:hover {
    background: var(--surface-hover);
}

.recent-item img {
    width: 32px;
    height: 32px;
}


/* GRILLE DES JEUX */

.games-grid {
    display: grid;
    /* auto-fit : les cartes s'étirent pour remplir la ligne au lieu de laisser un trou à droite */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.game-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    text-align: left;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.game-card:not(.disabled):hover,
.game-card:not(.disabled):focus-visible {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgb(0 0 0 / 40%);
    outline: none;
}

.game-card.disabled {
    cursor: default;
    opacity: 0.55;
}

.game-art {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    overflow: hidden;
}

/* L'icône floutée et agrandie sert de fond coloré à la carte */
.game-art-blur {
    position: absolute;
    width: 160%;
    height: 160%;
    object-fit: cover;
    filter: blur(28px) saturate(1.4);
    opacity: 0.6;
}

.game-icon {
    position: relative;
    width: 84px;
    height: 84px;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgb(0 0 0 / 45%));
    transition: transform 0.15s ease;
}

.game-card:not(.disabled):hover .game-icon {
    transform: scale(1.08);
}

.game-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding: 14px 16px 16px;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.game-desc {
    flex: 1;
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.game-meta,
.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.tag {
    font-size: 0.75rem;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgb(255 255 255 / 10%);
    color: var(--text-muted);
    white-space: nowrap;
}

.status {
    display: flex;
    align-items: center;
    margin-left: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.status.online {
    color: var(--online);
}

.status.offline {
    color: var(--offline);
}

.play {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg);
    font-size: 1.3rem;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.game-card:hover .play,
.game-card:focus-visible .play {
    opacity: 1;
    transform: scale(1);
}


/* JEU EN PLEIN ÉCRAN */

#player {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--player-bar-height);
    padding: 0 10px;
    background: var(--surface-strong);
    border-bottom: 1px solid var(--border);
}

.player-button {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: 1.1rem;
}

.player-button span {
    font-size: 0.95rem;
}

.player-button:hover {
    background: var(--surface-hover);
}

.player-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    font-weight: 500;
}

.player-title img {
    width: 26px;
    height: 26px;
}

.player-title span:not(.status-dot) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-actions {
    display: flex;
    gap: 4px;
}

#player-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: #000;
}


/* DASHBOARD
   Couleurs porteuses de sens uniquement : vert = en ligne, rouge = hors ligne, ambre = partiel.
   Cartes plus opaques que l'accueil pour rester lisibles sur n'importe quel fond. */

.dashboard-summary {
    display: flex;
    align-items: center;
    margin: -6px 0 18px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat,
.server-card {
    border-radius: var(--radius);
    background: var(--surface-strong);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.stat {
    --stat-color: var(--accent);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
}

.stat.online { --stat-color: var(--online); }
.stat.offline { --stat-color: var(--offline); }
.stat.warning { --stat-color: var(--warning); }

.stat-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.35rem;
    color: var(--stat-color);
    background: color-mix(in srgb, var(--stat-color) 16%, transparent);
}

.stat-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat.online .stat-value,
.stat.offline .stat-value,
.stat.warning .stat-value {
    color: var(--stat-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.server-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px 14px 19px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

/* Liseré de statut à gauche */
.server-card::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 3px;
    background: var(--border);
}

.server-card.online {
    border-color: rgb(63 185 80 / 28%);
}

.server-card.online::before {
    background: var(--online);
}

.server-card.offline::before {
    background: var(--offline);
}

.server-card img {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

.server-card.offline img {
    filter: grayscale(0.8);
    opacity: 0.6;
}

.server-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.server-title {
    font-weight: 500;
}

.server-detail {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.server-detail .pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.server-port {
    font-variant-numeric: tabular-nums;
}

.server-open {
    padding: 6px 16px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--bg);
    font-size: 0.85rem;
    font-weight: 700;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.server-open:hover,
.server-open:focus-visible {
    box-shadow: 0 6px 18px rgb(240 163 94 / 35%);
    outline: none;
}

/* Serveur hors ligne : le bouton reste utilisable mais ne se met plus en avant */
.server-card.offline .server-open {
    background: transparent;
    color: var(--text-muted);
    box-shadow: inset 0 0 0 1px var(--border);
}

.server-card.offline .server-open:hover,
.server-card.offline .server-open:focus-visible {
    color: var(--text);
    box-shadow: inset 0 0 0 1px var(--text-muted);
}


/* PARAMÈTRES */

#settings {
    position: fixed;
    inset: 0;
    z-index: 30;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 50%);
}

.settings-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100%);
    padding: 24px;
    overflow-y: auto;
    background: var(--surface-strong);
    backdrop-filter: blur(16px);
    border-left: 1px solid var(--border);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.settings-header h2 {
    margin: 0;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    font-size: 1.4rem;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 1.4rem;
}

.icon-button:hover {
    background: var(--surface-hover);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 28px;
}

.field > span {
    font-weight: 500;
}

.field small {
    color: var(--text-muted);
}

.field input {
    padding: 10px 14px;
    font: inherit;
    color: var(--text);
    background: rgb(0 0 0 / 30%);
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
}

.wallpaper-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.wallpaper {
    aspect-ratio: 16 / 10;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 2px solid transparent;
}

.wallpaper:hover {
    border-color: var(--border);
}

.wallpaper.active {
    border-color: var(--accent);
}


/* TABLETTE / MOBILE : la barre latérale devient un menu */

@media (max-width: 900px) {

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 25;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .menu-open .sidebar {
        transform: none;
    }

    .menu-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 24;
        background: rgb(0 0 0 / 50%);
    }

    .topbar .menu-button {
        display: flex;
        flex-shrink: 0;
    }

}


/* MOBILE */

@media (max-width: 640px) {

    .topbar {
        padding: 0 12px;
        gap: 6px;
    }

    .profile .name {
        display: none;
    }

    .profile {
        padding-right: 10px;
    }

    .content {
        padding: 20px 16px;
    }

    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .game-art {
        height: 110px;
    }

    .game-icon {
        width: 60px;
        height: 60px;
    }

    .game-info {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 12px;
    }

    .play {
        display: none;
    }

    .section-header {
        flex-direction: column;
        gap: 0;
    }

    .player-button span {
        display: none;
    }

    .greeting {
        font-size: 1.4rem;
    }

    .hero {
        min-height: 0;
        padding: 24px 20px;
    }

    .hero-title {
        font-size: 1.9rem;
    }

    .hero-desc {
        font-size: 0.95rem;
    }

    .hero-icon {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 72px;
        height: 72px;
    }

    .game-desc {
        display: none;
    }

    .soon-grid {
        grid-template-columns: 1fr;
    }

}
