/* ============================================================================
 * assets/css/base.css — ComApo E-learning
 * Design system « Précision éditoriale » : le noir encre est la couleur
 * d'action, l'or ComApo (#E6D800) est une signature rare (fils de
 * progression, focus, célébrations). Netteté : radius modérés, bordures
 * 1px, ombres discrètes, pas de dégradés sur les surfaces interactives.
 * Typo : Bricolage Grotesque (titres) + Inter (interface et texte).
 * ========================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('/assets/fonts/Inter-Variable.woff2') format('woff2');
}
@font-face {
    font-family: 'Bricolage Grotesque';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('/assets/fonts/BricolageGrotesque-Variable.woff2') format('woff2');
}

:root {
    /* Échelle d'encres (froide-neutre) */
    --ink-900: #101012;
    --ink-700: #3A3A40;
    --ink-500: #6E6E76;
    --ink-400: #9C9CA3;
    --ink-200: #E4E4E8;
    --ink-100: #F1F1F3;
    --ink-50:  #FAFAFB;

    /* Or ComApo — quatre registres, usages stricts :
       --gold-bright : le jaune officiel du logo (#FFFC03) — réservé aux fonds sombres
       --gold        : signature sur surfaces claires (fils, progression), jamais en texte sur clair
       --gold-deep   : or lisible (liens, labels actifs) — contraste AA sur blanc
       --gold-tint   : fonds teintés (sélections, surlignages) */
    --gold-bright: #FFFC03;
    --gold:      #E6D800;
    --gold-deep: #8A7500;
    --gold-tint: #FBF8E2;

    /* Alias historiques (utilisés par learning.css / admin.css) */
    --brand:        var(--ink-900);
    --brand-soft:   var(--ink-700);
    --accent:       var(--gold);
    --accent-dark:  var(--gold-deep);
    --accent-soft:  var(--gold-tint);
    --accent-bg:    rgba(230, 216, 0, .22);
    --bg:           var(--ink-50);
    --bg-elev:      #ffffff;
    --border:       var(--ink-200);
    --border-soft:  var(--ink-100);
    --text:         var(--ink-900);
    --text-muted:   var(--ink-500);
    --danger:       #DC2626;
    --success:      #16A34A;

    /* Géométrie : nette, pas molle */
    --radius:       14px;
    --radius-sm:    10px;
    --radius-pill:  999px;
    --shadow-sm:    0 1px 2px rgba(16, 16, 18, .06), 0 1px 6px rgba(16, 16, 18, .04);
    --shadow-md:    0 8px 30px rgba(16, 16, 18, .10);
    --max-width:    1180px;

    --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
/* Garantie qu'un élément avec l'attribut [hidden] reste bien masqué même si
   un composant lui définit un display: … par ailleurs (sinon la règle du
   composant, plus spécifique, l'emporte sur le display:none par défaut du
   navigateur — piège classique). */
[hidden] { display: none !important; }
/* Honeypot anti-bot : invisible pour les humains, présent dans le DOM pour les bots. */
.hp-wrap {
    position: absolute !important;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
html, body { height: 100%; }
/* Sticky footer : le pied de page reste collé en bas même quand la page
   est plus courte que la fenêtre (dézoom, grands écrans, pages vides). */
body {
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}
body > main { flex: 1 0 auto; width: 100%; }
.site-footer { margin-top: auto; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ─── Échelle typographique ─────────────────────────────────────────────
   Titres en Bricolage Grotesque : c'est elle qui donne la personnalité.
   12 / 13 / 14 / 16 / 18 / 22 / 28 / 36 — les sections spécifiques
   (hero, certificat…) définissent leur taille dans cette échelle. */
h1, h2 { font-family: var(--font-display); letter-spacing: -0.015em; line-height: 1.15; }
h3, h4 { letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 30px; font-weight: 700; margin: 0 0 22px; }
h2 { font-size: 21px; font-weight: 600; margin: 32px 0 14px; }
h3 { font-size: 16px; font-weight: 650; margin: 0 0 8px; }

/* Kicker unique (petites capitales au-dessus des titres) */
.kicker {
    display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: .07em;
    text-transform: uppercase; color: var(--ink-500);
}

/* ─── Icônes SVG (remplacent les emojis comme icônes fonctionnelles) ──── */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 24px; }
.page-pad { padding-top: 40px; padding-bottom: 64px; }
.text-muted { color: var(--text-muted); }

/* ─── Nav ─────────────────────────────────────────────────────────────
   Deux registres : sombre « marketing » pour les visiteurs, app bar
   claire pour l'espace connecté (.site-nav--app). */
.site-nav {
    background: var(--ink-900);
    color: #fff;
    position: relative;
}
.site-nav__inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 64px;
}
.site-nav__toggle-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.site-nav__toggle {
    display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 10px; margin: -10px;
}
.site-nav__toggle span { width: 22px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
.site-nav__toggle-checkbox:checked ~ .site-nav__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-nav__toggle-checkbox:checked ~ .site-nav__toggle span:nth-child(2) { opacity: 0; }
.site-nav__toggle-checkbox:checked ~ .site-nav__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.site-nav__toggle-checkbox:focus-visible ~ .site-nav__toggle { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.site-nav__logo { display: flex; align-items: center; gap: 12px; color: #fff; }
.site-nav__logo img { height: 28px; width: auto; display: block; }
.site-nav__logo span {
    font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255, 255, 255, .55); padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .18);
}
.site-nav__links { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.site-nav__links > a:not(.site-nav__cta):not(.nav-game) {
    color: rgba(255, 255, 255, .78); padding: 7px 12px; border-radius: 8px;
    font-weight: 500; transition: color .15s, background .15s;
}
.site-nav__links > a:not(.site-nav__cta):not(.nav-game):hover { color: #fff; }
.site-nav__cta {
    background: var(--gold-bright); color: var(--ink-900); font-weight: 650;
    padding: 9px 18px; margin-left: 10px; border-radius: var(--radius-sm); font-size: 13.5px;
    transition: filter .15s;
}
.site-nav__cta:hover { filter: brightness(1.06); }

/* App bar claire (connecté) */
.site-nav--app { background: var(--bg-elev); color: var(--text); border-bottom: 1px solid var(--border-soft); }
.site-nav--app .site-nav__logo { color: var(--text); }
.site-nav--app .site-nav__logo span { color: var(--ink-400); border-left-color: var(--ink-200); }
.site-nav--app .site-nav__toggle span { background: var(--ink-900); }
.site-nav--app .site-nav__links > a:not(.site-nav__cta):not(.nav-game) { color: var(--ink-500); font-weight: 550; }
.site-nav--app .site-nav__links > a:not(.site-nav__cta):not(.nav-game):hover { color: var(--ink-900); background: var(--ink-100); }
/* Page active : fil d'or sous le lien — la signature */
.site-nav--app .site-nav__links > a.is-active {
    color: var(--ink-900); position: relative;
}
.site-nav--app .site-nav__links > a.is-active::after {
    content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
    border-radius: 2px; background: var(--gold);
}

/* Chips gamification (visibles connecté, sur app bar claire) */
.nav-game { display: flex; align-items: center; gap: 6px; margin: 0 6px; }
.nav-game__chip {
    display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 650;
    padding: 4px 10px; border-radius: var(--radius-pill); white-space: nowrap;
}
.nav-game__chip--level { background: var(--ink-900); color: var(--gold-bright); }
.nav-game__chip--streak { background: var(--ink-100); color: var(--ink-700); }

/* Menu avatar (desktop) */
.nav-user { position: relative; margin-left: 8px; }
.nav-user summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px;
    border-radius: var(--radius-pill);
}
.nav-user summary::-webkit-details-marker { display: none; }
.nav-user summary:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.nav-user__avatar {
    width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
    background: var(--ink-900); color: var(--gold-bright); font-size: 14px; font-weight: 700;
    border: 1px solid var(--ink-900); transition: box-shadow .15s;
}
.nav-user[open] .nav-user__avatar, .nav-user summary:hover .nav-user__avatar { box-shadow: 0 0 0 3px var(--ink-100); }
.nav-user__menu {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 50; width: 240px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md); padding: 6px; animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.nav-user__head { padding: 10px 12px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; }
.nav-user__name { display: block; font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user__mail { display: block; font-size: 12.5px; color: var(--ink-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-user__stats { display: flex; gap: 6px; padding: 2px 12px 10px; border-bottom: 1px solid var(--border-soft); margin-bottom: 6px; font-size: 12px; color: var(--ink-500); }
.nav-user__menu a {
    display: block; padding: 8px 12px; border-radius: 7px; font-size: 14px; color: var(--ink-700);
    transition: background .12s, color .12s;
}
.nav-user__menu a:hover { background: var(--ink-100); color: var(--ink-900); }
/* Fond cliquable pour refermer le menu */
.nav-user__backdrop { position: fixed; inset: 0; z-index: 40; cursor: default; }

.nav-only-mobile { display: none !important; }

/* ─── Boutons ─────────────────────────────────────────────────────────
   Rectangles arrondis, nets. Primaire = encre. L'or ne vit que dans le
   focus ring et le bouton accent (encre + texte or, la signature). */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit; font-size: 14.5px; font-weight: 600;
    padding: 11px 22px; border-radius: var(--radius-sm); border: none; cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.is-loading, .btn:disabled { opacity: .65; cursor: progress; pointer-events: none; }
.btn-primary { background: var(--ink-900); color: #fff; }
.btn-primary:hover { background: var(--ink-700); }
.btn-accent { background: var(--ink-900); color: var(--gold-bright); }
.btn-accent:hover { background: var(--ink-700); }
.btn-outline { background: var(--bg-elev); color: var(--ink-900); border: 1px solid var(--ink-200); }
.btn-outline:hover { border-color: var(--ink-900); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover { color: var(--ink-900); background: var(--ink-100); }
.btn-danger { background: #FEF2F2; color: var(--danger); }
.btn-danger:hover { background: #FEE2E2; }

/* ─── Modale de confirmation (remplace le confirm() natif) ─────────────── */
.ui-dialog-overlay {
    position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px;
    background: rgba(16, 16, 18, .45); opacity: 0; transition: opacity .18s ease;
}
.ui-dialog-overlay.is-open { opacity: 1; }
.ui-dialog {
    width: 100%; max-width: 400px; padding: 26px 28px;
    background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-md); border-top: 3px solid var(--gold);
    transform: translateY(10px) scale(.98); transition: transform .18s ease;
}
.ui-dialog-overlay.is-open .ui-dialog { transform: none; }
.ui-dialog__title { margin: 0 0 8px; font-size: 18px; font-family: var(--font-display); font-weight: 700; }
.ui-dialog__message { margin: 0 0 22px; color: var(--text-muted); font-size: 14px; line-height: 1.6; }
.ui-dialog__actions { display: flex; justify-content: flex-end; gap: 10px; }
/* Dans la modale, l'action destructrice est pleine — pas d'ambiguïté. */
.ui-dialog .btn-danger { background: var(--danger); color: #fff; }
.ui-dialog .btn-danger:hover { background: #B91C1C; }
@media (prefers-reduced-motion: reduce) {
    .ui-dialog-overlay, .ui-dialog { transition: none; }
}
.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

/* ─── Formulaires ────────────────────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--ink-700); }
.field input, .field textarea, .field select {
    width: 100%; padding: 10px 13px; border: 1px solid var(--ink-200);
    border-radius: var(--radius-sm); font-family: inherit; font-size: 16px; background: var(--bg-elev);
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
    outline: none; border-color: var(--ink-900);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.field-hint { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
input[type="radio"], input[type="checkbox"] { accent-color: var(--ink-900); }

/* Deux champs côte à côte (prénom / nom, téléphone / date de naissance…) */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* Indicateur de robustesse du mot de passe (critères en direct) */
.pw-checklist { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.pw-checklist li {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-400);
    transition: color .15s;
}
.pw-checklist li::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-200); transition: background .15s;
}
.pw-checklist li.is-ok { color: var(--success); }
.pw-checklist li.is-ok::before { background: var(--success); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 20px; border: 1px solid transparent; }
.alert-error   { background: #FEF2F2; color: var(--danger); border-color: #FECACA; }
.alert-success { background: #F0FDF4; color: var(--success); border-color: #BBF7D0; }
.alert-info    { background: var(--gold-tint); color: var(--gold-deep); border-color: #EDE4A8; }

/* ─── Cartes génériques ──────────────────────────────────────────────── */
.card {
    background: var(--bg-elev); border-radius: var(--radius);
    border: 1px solid var(--border); box-shadow: none;
}

/* ─── Auth (connexion / inscription) ─────────────────────────────────── */
.auth-page {
    min-height: calc(100dvh - 64px); display: grid; place-items: center; padding: 48px 24px;
}
.auth-card { width: min(420px, 100%); padding: 40px 36px 36px; border-top: 3px solid var(--gold); box-shadow: var(--shadow-sm); }
.auth-card--wide { width: min(520px, 100%); }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; }
.auth-card p.sub { color: var(--text-muted); margin: 0 0 26px; font-size: 14px; }
.auth-switch { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-muted); }
.auth-switch a { color: var(--gold-deep); font-weight: 650; }

@media (max-width: 560px) {
    .auth-page { padding: 24px 16px; align-items: start; padding-top: 28px; }
    .auth-card, .auth-card--wide { padding: 28px 20px 24px; }
    .auth-card h1 { font-size: 22px; }
}

/* ─── Footer : vrai pied de page structuré, nuit encre ───────────────── */
.site-footer { background: var(--ink-900); color: rgba(255, 255, 255, .62); margin-top: 48px; }
.site-footer__grid {
    display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px;
    padding-top: 52px; padding-bottom: 44px;
}
.site-footer__brand p { margin: 16px 0 0; font-size: 13.5px; line-height: 1.65; max-width: 300px; }
.site-footer__logo { display: inline-flex; align-items: center; gap: 12px; }
.site-footer__logo img { height: 26px; width: auto; }
.site-footer__logo span {
    font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255, 255, 255, .5); padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .18);
}
.site-footer__col h3 {
    margin: 4px 0 14px; font-size: 12px; font-weight: 600; letter-spacing: .07em;
    text-transform: uppercase; color: rgba(255, 255, 255, .45); font-family: inherit;
}
.site-footer__col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.site-footer__col a { color: rgba(255, 255, 255, .78); font-size: 14px; transition: color .15s; }
.site-footer__col a:hover { color: var(--gold-bright); }
.site-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .1); }
.site-footer__bottom-inner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding-top: 18px; padding-bottom: 18px; font-size: 12.5px; color: rgba(255, 255, 255, .45);
}

@media (max-width: 720px) {
    .site-footer__grid { grid-template-columns: 1fr; gap: 30px; padding-top: 40px; padding-bottom: 34px; }
    .site-footer__bottom-inner { justify-content: center; text-align: center; }
}

/* ─── Coquille applicative (espace connecté) ─────────────────────────────
   Une fois connecté, le site bascule en mode « application » : sidebar
   sombre fixe à gauche, contenu à droite, footer discret. */
.app-shell { display: flex; flex: 1 0 auto; align-items: stretch; }
.app-sidebar {
    flex: none; width: 250px;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 28px;
    background: var(--ink-900); padding: 26px 16px 20px;
}
.app-sidebar__logo { display: inline-flex; align-items: center; gap: 12px; padding: 0 12px; flex: none; }
.app-sidebar__logo img { height: 26px; width: auto; }
.app-sidebar__logo span {
    font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255, 255, 255, .5); padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .18);
}
.app-sidebar__nav { display: flex; flex-direction: column; gap: 3px; }
.app-sidebar__nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    border-radius: 9px; font-size: 14px; font-weight: 600;
    color: rgba(255, 255, 255, .68); transition: background .13s, color .13s;
}
.app-sidebar__nav a .icon { width: 17px; height: 17px; flex: none; opacity: .8; }
.app-sidebar__nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-sidebar__nav a.is-active { background: rgba(255, 255, 255, .1); color: #fff; }
.app-sidebar__nav a.is-active .icon { color: var(--gold-bright); opacity: 1; }
.app-sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; }
.app-sidebar__game {
    display: flex; flex-direction: column; gap: 10px; padding: 12px;
    border-radius: 10px; background: rgba(255, 255, 255, .06); transition: background .13s;
}
.app-sidebar__game:hover { background: rgba(255, 255, 255, .1); }
.app-sidebar__chips { display: flex; align-items: center; gap: 8px; }
.app-sidebar__chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 700; color: var(--gold-bright);
}
.app-sidebar__chip--streak { color: #FF9D5C; }
.app-sidebar__chip .icon { width: 13px; height: 13px; }
.app-sidebar__xpbar {
    display: block; height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .14); overflow: hidden;
}
.app-sidebar__xpbar span { display: block; height: 100%; border-radius: 999px; background: var(--gold-bright); }
.app-sidebar__user { display: flex; align-items: center; gap: 4px; }
.app-sidebar__user-link {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px;
    padding: 8px 10px; border-radius: 10px; transition: background .13s;
}
.app-sidebar__user-link:hover { background: rgba(255, 255, 255, .07); }
.app-sidebar__user-link.is-active { background: rgba(255, 255, 255, .1); }
/* Variante non cliquable (admin : pas de page profil) */
.app-sidebar__user-link--static { cursor: default; }
.app-sidebar__user-link--static:hover { background: transparent; }
/* Lien « Voir le site » : carte bordée discrète au-dessus du bloc profil */
.app-sidebar__site {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px;
    border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px;
    font-size: 13.5px; font-weight: 600; color: rgba(255, 255, 255, .72);
    transition: border-color .13s, color .13s, background .13s;
}
.app-sidebar__site:hover { border-color: rgba(255, 255, 255, .35); color: #fff; background: rgba(255, 255, 255, .05); }
.app-sidebar__site .icon { width: 15px; height: 15px; flex: none; opacity: .8; }
.app-sidebar__avatar {
    flex: none; width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center; font-size: 14px; font-weight: 700;
    background: var(--gold-bright); color: var(--ink-900);
}
.app-sidebar__id { min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.app-sidebar__id strong { font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-sidebar__id small { font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.app-sidebar__user-link:hover .app-sidebar__id small { color: rgba(255, 255, 255, .75); }
.app-sidebar__user-link.is-active .app-sidebar__id small { color: var(--gold-bright); }
.app-sidebar__logout {
    flex: none; width: 34px; height: 34px; display: grid; place-items: center;
    border-radius: 9px; color: rgba(255, 255, 255, .5); transition: background .13s, color .13s;
}
.app-sidebar__logout:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.app-sidebar__logout .icon { width: 16px; height: 16px; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-content { flex: 1 0 auto; }
.app-footer {
    margin-top: auto; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding: 16px 32px;
    border-top: 1px solid var(--border-soft); font-size: 12.5px; color: var(--text-muted);
}
.app-footer__links { display: flex; gap: 18px; }
.app-footer__links a:hover { color: var(--text); }
.app-topbar { display: none; }
.app-sidebar-backdrop { display: none; }
.app-nav-checkbox { display: none !important; }

@media (max-width: 920px) {
    body:has(.app-nav-checkbox:checked) { overflow: hidden; }
    .app-sidebar {
        position: fixed; left: 0; top: 0; bottom: 0; z-index: 120;
        height: 100dvh; max-height: 100dvh;
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        transform: translateX(-102%); transition: transform .22s ease;
        box-shadow: var(--shadow-md);
    }
    .app-nav-checkbox:checked ~ .app-sidebar { transform: none; }
    .app-sidebar-backdrop {
        position: fixed; inset: 0; z-index: 110; background: rgba(16, 16, 18, .45);
        opacity: 0; pointer-events: none; transition: opacity .2s ease;
    }
    .app-nav-checkbox:checked ~ .app-sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .app-sidebar-backdrop { display: block; }
    .app-topbar {
        display: flex; align-items: center; gap: 16px;
        position: sticky; top: 0; z-index: 60;
        background: var(--ink-900);
        padding: 14px max(18px, env(safe-area-inset-right)) 14px max(18px, env(safe-area-inset-left));
        padding-top: max(14px, env(safe-area-inset-top));
    }
    .app-topbar__logo { display: inline-flex; align-items: center; gap: 10px; }
    .app-topbar__logo img { height: 22px; width: auto; }
    .app-topbar__logo span {
        font-size: 10px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
        color: rgba(255, 255, 255, .5); padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, .18);
    }
    .app-topbar__burger { display: flex; flex-direction: column; gap: 4.5px; cursor: pointer; padding: 4px 2px; }
    .app-topbar__burger span { width: 20px; height: 2px; border-radius: 2px; background: #fff; transition: transform .18s, opacity .18s; }
    .app-nav-checkbox:checked ~ .app-main .app-topbar__burger span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
    .app-nav-checkbox:checked ~ .app-main .app-topbar__burger span:nth-child(2) { opacity: 0; }
    .app-nav-checkbox:checked ~ .app-main .app-topbar__burger span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
    .app-footer {
        padding: 14px max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    }
}
@media (max-width: 400px) {
    .app-topbar__logo span,
    .site-nav__logo span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .app-sidebar, .app-sidebar-backdrop { transition: none; }
}

/* ─── Nav mobile ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .site-nav__toggle { display: flex; z-index: 2; }
    .site-nav__links {
        position: absolute; top: 64px; left: 0; right: 0; z-index: 30;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: var(--ink-900); padding: 8px 24px 20px;
        display: none; box-shadow: var(--shadow-md);
    }
    .site-nav--app .site-nav__links { background: var(--bg-elev); border-bottom: 1px solid var(--border); }
    .site-nav__toggle-checkbox:checked ~ .site-nav__links { display: flex; }
    .site-nav__links > a { width: 100%; padding: 12px 0 !important; border-radius: 0 !important; border-bottom: 1px solid rgba(255, 255, 255, .08); }
    .site-nav--app .site-nav__links > a { border-bottom-color: var(--border-soft); }
    .site-nav--app .site-nav__links > a.is-active::after { display: none; }
    .site-nav__links a.site-nav__cta { width: auto; align-self: flex-start; margin: 10px 0 4px; border-bottom: none; padding: 9px 18px !important; border-radius: var(--radius-sm) !important; }
    .nav-game { width: 100%; padding: 10px 0; border-bottom: 1px solid var(--border-soft); margin: 0; }
    .nav-user { display: none; }
    .nav-only-mobile { display: block !important; }
}

/* ─── Accessibilité ──────────────────────────────────────────────────── */
.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink-900); color: var(--gold-bright);
    padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 650; font-size: 14px; transition: top .15s;
}
.skip-link:focus { top: 12px; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
.btn:focus-visible, .story__nav-btn:focus-visible {
    outline: 2px solid var(--gold-deep); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important; animation-iteration-count: 1 !important;
        transition-duration: .001ms !important; scroll-behavior: auto !important;
    }
}
