:root {
        --color_bandeau: royalblue;
        --color_bandeau_text: white;
        --color_hover: crimson;
        --color_hover_text: white;
        --color_data: black;
        --color_submit: white;
        }
/* ==========================================================================
   Design system — tokens fixes (indépendants du thème par plateforme)
   ========================================================================== */
:root {
    --paper: #F7F7F4;
    --ink: #1B1B18;
    --ink-soft: #6E6C64;
    --surface: #ffffff;
    --line: #E4E2D9;
    --shadow-sm: 0 1px 2px rgba(27, 27, 24, 0.06);
    --shadow-md: 0 6px 20px rgba(27, 27, 24, 0.10);
    --radius: 10px;
    /* Polices système uniquement : aucune dépendance externe (pas de Google
       Fonts). Chaque pile retombe sur les polices déjà installées sur
       l'appareil du visiteur (Windows, macOS, Linux, Android, iOS). */
    --font-display: -apple-system, 'Segoe UI Semibold', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-body: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Mono', 'Consolas', 'Roboto Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
    outline: 2px solid var(--color_hover);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Barre supérieure + formulaire de recherche
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 14px clamp(16px, 4vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.home-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
    white-space: nowrap;
}

.home-link:hover,
.home-link:focus-visible {
    background: var(--surface);
    color: var(--color_bandeau);
}

.brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    background: var(--color_bandeau);
    display: inline-block;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Pastille segmentée Console / Titre, pilotée en CSS pur (fonctionne sans JS) */
.toggle {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
    position: relative;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.toggle label {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
    transition: background .15s ease, color .15s ease;
}

.toggle input:checked + label {
    background: var(--color_bandeau);
    color: var(--color_bandeau_text);
}

.toggle input:focus-visible + label {
    outline: 2px solid var(--color_hover);
    outline-offset: 2px;
}

.search-fields { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

#fields2 { display: none; }
/* :has() cible .search-form dès qu'il CONTIENT #option2 coché, peu importe
   la profondeur d'imbrication (contrairement à ~ qui exige des frères
   directs) : #option2 est dans .toggle, lui-même frère de .search-fields. */
.search-form:has(#option2:checked) #fields1 { display: none; }
.search-form:has(#option2:checked) #fields2 { display: flex; }

.search-form select,
.search-form input[type=text] {
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    font-family: var(--font-body);
    font-size: 13px;
    background: var(--surface);
    color: var(--ink);
    min-width: 200px;
    cursor: pointer;
}

.search-form input[type=text] { cursor: text; }

.search-form button {
    height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 8px;
    background: var(--color_bandeau);
    color: var(--color_bandeau_text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.search-form button:hover,
.search-form button:active {
    background: var(--color_hover);
    color: var(--color_hover_text);
}

/* ==========================================================================
   Bandeau plateforme
   ========================================================================== */
.platform-banner {
    margin: 20px clamp(16px, 4vw, 40px) 0;
    background: var(--color_bandeau);
    color: var(--color_bandeau_text);
    border-radius: var(--radius);
    padding: 18px 24px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.platform-banner h1 {
    font-family: var(--font-display);
    font-size: clamp(20px, 3vw, 28px);
    margin: 0;
    font-weight: 700;
}

.platform-banner .count {
    font-family: var(--font-mono);
    font-size: 13px;
    opacity: .9;
}

/* ==========================================================================
   Mise en page générale
   ========================================================================== */
.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    padding: 20px clamp(16px, 4vw, 40px) 60px;
    align-items: start;
}

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .side-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
}

@media (max-width: 560px) {
    .side-panel { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Grille de jeux ("cartouches")
   ========================================================================== */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 16px;
}

.game-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .18s ease;
    position: relative;
}

@media (hover: hover) {
    .game-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-md);
    }
}

.game-card .spine { height: 5px; background: var(--color_bandeau); }

.game-card .cover {
    aspect-ratio: 3 / 4;
    background: linear-gradient(160deg, var(--color_bandeau), var(--color_hover));
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6px;
}

.game-card .cover img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    /* "contain" conserve le ratio d'origine de l'image et l'adapte en
       largeur OU en hauteur selon ce qui la contraint en premier, sans
       jamais l'étirer ni la recadrer (contrairement à "cover" utilisé
       précédemment, qui rognait l'image pour remplir tout le cadre). */
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.game-card .cover img.ribbon {
    position: absolute;
    top: 8px;
    right: 0;
    width: 30px;
    height: 30px;
    max-width: 30px;
    max-height: 30px;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.game-card .cover img.finished-badge {
    position: absolute;
    bottom: 8px;
    right: 0;
    width: 15px;
    height: 15px;
    max-width: 15px;
    max-height: 15px;
    object-fit: contain;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.5));
}

.game-card .body { padding: 10px 12px 12px; }

.game-card .title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    margin: 0 0 6px;
    color: var(--color_data);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.game-card .platform-tag {
    font-size: 11px;
    color: var(--ink-soft);
    margin: -4px 0 6px;
}

.game-card .meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-soft);
    gap: 6px;
}

.game-card .badges { display: flex; gap: 4px; align-items: center; }

.badge {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: var(--paper);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.badge img { width: 100%; height: 100%; object-fit: contain; }

.game-card .infos-line {
    padding: 0 12px 10px;
    font-size: 11px;
    color: var(--ink-soft);
}

.games-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-soft);
    font-size: 14px;
}

/* ==========================================================================
   Panneaux latéraux (console / accessoires)
   ========================================================================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.panel h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--color_bandeau);
    color: var(--color_bandeau_text);
    padding: 10px 14px;
}

.panel .content {
    padding: 14px;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.panel .content:last-child { border-bottom: none; }

.panel .thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: linear-gradient(160deg, var(--color_bandeau), var(--color_hover));
    flex-shrink: 0;
    overflow: hidden;
}

.panel .thumb img { width: 100%; height: 100%; object-fit: contain; }

.panel .info { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.panel .info strong { color: var(--color_data); display: block; font-size: 13.5px; margin-bottom: 2px; }
.panel .info .mono { font-family: var(--font-mono); font-size: 11px; }
.panel .info .icon-row { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.panel .info .icon-row img { height: 14px; }

.panel .empty {
    padding: 18px 14px;
    font-size: 12.5px;
    color: var(--ink-soft);
    text-align: center;
}
