/**
 * FantasyLap — Base UI (style 16-bits rétro, mobile-first)
 * Polices : Outfit — auto-hébergées
 *
 * Breakpoints standardisés :
 *   480px  — mobile large / small tablet
 *   768px  — tablet
 *   1024px — desktop
 */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;

    /* Largeur max standard des pages */
    --container-max: 1500px;
    --page-max: 1500px;
    --page-pad-x: 1rem;
    --page-pad-y: 1.25rem;
    --h2-size: clamp(0.85rem, 2.4vw, 1rem);
    --bg-dark: #080810;
    --bg-dark-mid: #0f0f1c;
    --bg-mid: #131326;
    --bg-card: #1c1c30;
    --bg-card-mid: #242440;
    --text: #eeeef5;
    --text-muted: #8888aa;
    --font-header: #667EEA;
    --accent: #667EEA;
    /* Profondeur du bouton primaire (indigo, assorti à l’accent) */
    --accent-dark: #4f46e5;
    /* Secondaire bleu — accents UI, surcharges, dégradés */
    --color-secondary: #60a5fa;
    --color-secondary-deep: #3b82f6;
    --color-secondary-muted: #93c5fd;
    --color-btn-secondary: #3db87a;
    --border: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.04);
    --color-gold: #f5c842;
    --color-gold-soft: #f5c842;
    --color-success: #3db87a;
    --color-danger: #ff4d4d;
    --color-error-soft: #ff8099;
    --color-success-soft: #7dd8a8;
    --font-title: 'Outfit Bold', sans-serif;
    --font-title-bold: 'Outfit Black', sans-serif;
    --font-body: 'Outfit Regular', sans-serif;
    --font-italic: 'Outfit Light Italic', sans-serif;
    --font-medium: 'Outfit Medium', sans-serif;
    --font-light: 'Outfit Light', sans-serif;
    --font-card: 'Outfit Bold', sans-serif;
    --font-card-bold: 'Outfit Black', sans-serif;
    --radius: 10px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.15);

    /* Surfaces dérivées (thème clair les surcharge) */
    --nav-scrolled-bg: rgba(8, 8, 16, 0.82);
    --backdrop-strong: rgba(0, 0, 0, 0.65);
    --drawer-shadow: -6px 0 32px rgba(0, 0, 0, 0.6);
    --accent-soft-20: rgba(102, 126, 234, 0.22);
    --gold-soft-10: rgba(245, 200, 66, 0.1);
    --accent-soft-15: rgba(102, 126, 234, 0.16);
    /* Surfaces légères (remplace les rgba blancs figés) */
    --surface-muted: rgba(255, 255, 255, 0.06);
    --surface-muted-mid: rgba(255, 255, 255, 0.1);
    --surface-hairline: rgba(255, 255, 255, 0.12);
    --surface-track: rgba(255, 255, 255, 0.07);
    /* Encart type « verre » sur dégradé */
    --surface-inset: rgba(0, 0, 0, 0.28);
    --surface-overlay: rgba(0, 0, 0, 0.2);
    --surface-overlay-strong: rgba(0, 0, 0, 0.38);
    --risk-bg-soft: rgba(255, 77, 77, 0.12);
    --risk-border-soft: rgba(255, 120, 120, 0.35);
    --risk-fill-mid: rgba(255, 120, 120, 0.22);
    --risk-bar-accent: rgba(255, 77, 77, 0.55);
    --elevated-bg: rgba(8, 8, 20, 0.92);
    --elevated-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --btn-text-on-accent: #fff;
    --btn-secondary-bg: var(--color-btn-secondary);
    --btn-secondary-border: var(--color-secondary);
    --hairline-dark: rgba(0, 0, 0, 0.4);
    --chart-grid: rgba(255, 255, 255, 0.07);
    --chart-axis: var(--text-muted);
    --meta-theme-color: #080810;
    --badge-text-on-gold: #080810;
    --chart-gold-area-top: rgba(245, 200, 66, 0.3);
    --chart-gold-area-bottom: rgba(245, 200, 66, 0.02);
}

html[data-theme="light"] {
    color-scheme: light;

    --bg-dark: #eceef6;
    --bg-dark-mid: #e3e6f2;
    --bg-mid: #f7f8fd;
    --bg-card: #ffffff;
    --bg-card-mid: #f0f3fb;
    --text: #0d0d1e;
    --text-muted: #525270;
    --accent: #667EEA;
    --font-header: #667EEA;
    --accent-dark: #4338ca;
    --color-secondary: #2563eb;
    --color-secondary-deep: #1d4ed8;
    --color-secondary-muted: #60a5fa;
    --color-btn-secondary: #3db87a;
    --border: rgba(110, 140, 179, 0.300);
    --border-subtle: rgba(13, 13, 30, 0.05);
    --color-gold: #f5c842;
    --color-gold-soft: #967410;
    --color-success: #1f8c52;
    --color-danger: #cc2020;
    --color-error-soft: #b01850;
    --color-success-soft: #1d6e40;
    --shadow: 0 4px 20px rgba(10, 10, 30, 0.08);
    --shadow-card: 0 1px 3px rgba(10, 10, 30, 0.06), 0 4px 12px rgba(10, 10, 30, 0.05);

    --nav-scrolled-bg: rgba(255, 255, 255, 0.88);
    --backdrop-strong: rgba(10, 10, 30, 0.4);
    --drawer-shadow: -6px 0 32px rgba(10, 10, 30, 0.15);
    --accent-soft-20: rgba(102, 126, 234, 0.12);
    --gold-soft-10: rgba(212, 160, 0, 0.15);
    --accent-soft-15: rgba(102, 126, 234, 0.1);
    --surface-muted: rgba(13, 13, 30, 0.055);
    --surface-muted-mid: rgba(13, 13, 30, 0.09);
    --surface-hairline: rgba(13, 13, 30, 0.12);
    --surface-track: rgba(13, 13, 30, 0.08);
    --surface-inset: rgba(13, 13, 30, 0.08);
    --surface-overlay: rgba(69, 140, 233, 0.07);
    --surface-overlay-strong: rgba(13, 13, 30, 0.14);
    --risk-bg-soft: rgba(204, 32, 32, 0.08);
    --risk-border-soft: rgba(204, 32, 32, 0.32);
    --risk-fill-mid: rgba(204, 32, 32, 0.18);
    --risk-bar-accent: rgba(204, 32, 32, 0.45);
    --elevated-bg: rgba(255, 255, 255, 0.97);
    --elevated-shadow: 0 2px 8px rgba(10, 10, 30, 0.08);
    --btn-text-on-accent: #fff;
    --btn-secondary-bg: var(--color-btn-secondary);
    --btn-secondary-border: var(--color-secondary);
    --hairline-dark: rgba(0, 0, 0, 0.18);
    --chart-grid: rgba(10, 10, 30, 0.09);
    --chart-axis: var(--text-muted);
    --meta-theme-color: #f7f8fd;
    --badge-text-on-gold: #0d0d1e;
    --chart-gold-area-top: rgba(212, 160, 0, 0.25);
    --chart-gold-area-bottom: rgba(212, 160, 0, 0.02);
}

html[data-theme="light"] img.nav-icon.nav-icon--img {
    filter: brightness(0) saturate(100%);
    opacity: 0.78;
}

html[data-theme="light"] .nav-link:hover img.nav-icon.nav-icon--img,
html[data-theme="light"] .nav-link--active img.nav-icon.nav-icon--img {
    opacity: 0.95;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

/* Empêche tout scroll horizontal sur mobile (ne casse pas position:fixed sur iOS) */
@media (max-width: 1023px) {
    html {
        overflow-x: hidden;
    }

    /* Le nav-menu est remplacé par l'onglet Menu du sidebar sur mobile/tablette */
    .nav-menu {
        display: none !important;
    }

    /* Le hamburger n'existe plus dans le HTML, mais par sécurité */
    .nav-toggle {
        display: none !important;
    }
}

/* ---- Focus visible (navigation clavier / accessibilité) ---- */
:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
    border-radius: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: radial-gradient(ellipse at 50% -10%, var(--bg-card) 0%, var(--bg-dark) 70%);
    font-family: var(--font-body);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---- Navigation ---- */
/*
 * IMPORTANT : on n'applique PAS backdrop-filter directement sur .site-nav.
 * Depuis Chrome 124, backdrop-filter crée un containing block pour position:fixed,
 * ce qui piège le .nav-menu à l'intérieur de la nav (toujours visible à droite).
 * Le blur est géré via ::before pour ne pas briser position:fixed des enfants.
 */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background: transparent;
    border-bottom: 1px solid transparent;
    box-shadow: none;
    isolation: isolate;
    transition:
        background 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease;
}

/* Couche de blur derrière la nav (pseudo-élément = pas de containing block) */
.site-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
}

.site-nav.site-nav--scrolled {
    background: var(--nav-scrolled-bg);
    border-bottom-color: var(--border);
    box-shadow: var(--shadow);
}

.site-nav.site-nav--scrolled::before {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .site-nav,
    .site-nav::before {
        transition-duration: 0.05s;
    }
}

.site-nav-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 3.5rem;
    gap: 0.5rem;
}

/* ---- Logo ---- */
.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-title);
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.nav-brand-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.nav-brand:hover {
    color: var(--accent);
}

@media (max-width: 767px) {
    .nav-brand > span {
        display: none;
    }
}

/* ---- Backdrop (overlay derrière le drawer) ---- */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--backdrop-strong);
    z-index: 99;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: backdropFadeIn 0.2s ease forwards;
}

.nav-backdrop.is-active {
    display: block;
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (min-width: 1024px) {
    .nav-backdrop {
        display: none !important;
    }
}

/* Scroll lock quand le drawer est ouvert */
body.nav-open {
    overflow: hidden;
}

/* ---- Accessibilité ---- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Drapeaux pays (GP) : images, compatibles Chrome / Windows ---- */
.country-flag-img {
    display: inline-block;
    width: 1.35rem;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    vertical-align: -0.12em;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.14);
}

html[data-theme="dark"] .country-flag-img {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
}

/* ---- Zone droite : carte utilisateur (connecté) + boutons sidebar mobile ---- */
.nav-trailing {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
    flex-shrink: 0;
    min-width: 0;
}

.nav-user-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
    max-width: min(260px, 42vw);
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius);
    padding: 0.15rem 0.35rem 0.15rem 0.15rem;
    margin: -0.15rem -0.35rem -0.15rem -0.15rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-user-chip:hover {
    background: var(--surface-overlay);
    color: var(--color-secondary);
}

.nav-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.nav-user-avatar--placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-medium);
    font-size: 0.95rem;
    color: var(--text-muted);
    background: var(--surface-inset);
}

.nav-user-meta {
    display: flex;
    flex-direction: column;
    gap: 0;
    line-height: 1.2;
    min-width: 0;
}

.nav-user-name {
    font-family: var(--font-medium);
    font-size: 0.8125rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-user-email {
    font-size: 0.68rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 639px) {
    .nav-user-chip {
        max-width: min(200px, 52vw);
    }

    .nav-user-avatar,
    .nav-user-avatar--placeholder {
        width: 34px;
        height: 34px;
    }

    .nav-user-name {
        font-size: 0.78rem;
    }

    .nav-user-email {
        font-size: 0.62rem;
    }
}

/* Bouton Menu (desktop uniquement) — pas .nav-sidebar-btn (masqué ≥1024px dans sidebar.css) */
.nav-open-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.nav-open-menu-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-open-menu-btn .nav-open-menu-btn-icon,
.nav-open-menu-btn .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-open-menu-btn img.nav-icon.nav-icon--img {
    filter: brightness(0) invert(1);
    opacity: 0.88;
}

.nav-open-menu-btn:hover img.nav-icon.nav-icon--img {
    opacity: 1;
}

@media (min-width: 1024px) {
    .nav-open-menu-btn {
        display: flex;
    }
}

html[data-theme="light"] .nav-open-menu-btn img.nav-icon.nav-icon--img {
    filter: brightness(0) saturate(100%);
    opacity: 0.72;
}

html[data-theme="light"] .nav-open-menu-btn:hover img.nav-icon.nav-icon--img {
    opacity: 0.95;
}

/* ---- Actions droite : hamburger + boutons sidebar mobile ---- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

/* Mobile / tablette : thème à gauche du bouton menu (ordre DOM = menu puis thème) */
@media (max-width: 1023px) {
    .nav-actions {
        flex-direction: row-reverse;
        align-items: center;
    }
}

/* ---- Bouton hamburger ---- */
.nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 38px;
    height: 38px;
    padding: 8px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text);
    flex-shrink: 0;
}

.nav-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-toggle-bar {
    display: block;
    height: 3px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

@media (min-width: 1024px) {
    .nav-toggle {
        display: none;
    }
}

/* ---- Menu : drawer depuis la droite (mobile/tablette) ---- */
.nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100dvh;
    width: min(300px, 85vw);
    display: flex;
    flex-direction: column;
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--bg-mid);
    border-left: 2px solid var(--border);
    box-shadow: var(--drawer-shadow);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-menu.is-open {
    transform: translateX(0);
}

/* ---- En-tête du drawer ---- */
.nav-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem 0 1rem;
    height: 3.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.nav-menu-title {
    font-family: var(--font-title);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    flex-shrink: 0;
}

.nav-menu-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ---- Liens de navigation ---- */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-family: var(--font-medium);
    color: var(--text);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-icon {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    fill: currentColor;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

img.nav-icon.nav-icon--img {
    fill: none;
    object-fit: contain;
    filter: brightness(0) invert(1);
    opacity: 0.88;
}

.nav-link:hover img.nav-icon.nav-icon--img,
.nav-link--active img.nav-icon.nav-icon--img {
    opacity: 1;
}

.nav-link:hover {
    background: var(--surface-overlay);
    color: var(--color-secondary);
    text-decoration: none;
}

.nav-link--active {
    color: var(--text);
    background: var(--surface-inset);
}

/* ---- Chevron indicateur de dropdown ---- */
.nav-dropdown-trigger:not(.nav-notifs-trigger) .nav-icon:last-child {
    margin-left: auto;
    opacity: 0.55;
    transition: transform 0.2s ease, opacity 0.15s ease;
}

@media (min-width: 1024px) {
    .nav-dropdown-trigger .nav-icon:last-child {
        margin-left: 0.15em;
    }
}

.nav-dropdown.is-open .nav-dropdown-trigger .nav-icon:last-child {
    transform: rotate(180deg);
    opacity: 1;
}

/* ---- Dropdowns ---- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    font-family: var(--font-medium);
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: var(--radius);
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown-trigger:hover {
    background: var(--surface-overlay);
    color: var(--color-secondary);
}

.nav-dropdown-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0.25rem 0;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
}

.nav-dropdown.is-open .nav-dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.15s ease forwards;
}

@keyframes dropdownFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Dans le drawer : sous-items indentés */
.nav-dropdown .nav-dropdown-link {
    display: flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.6rem 1rem 0.6rem 2rem;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.15s ease;
    color: var(--text-muted);
}

.nav-dropdown .nav-dropdown-link:hover {
    background: var(--surface-overlay);
    color: var(--color-secondary);
}

/* ---- Tablette (768px – 1023px) : top bar un peu plus généreuse ---- */
@media (min-width: 768px) and (max-width: 1023px) {
    .site-nav-inner {
        gap: 0.75rem;
    }
}

/* ---- Desktop (≥1024px) : liens dans le rail sidebar (bouton Menu) ---- */
@media (min-width: 1024px) {
    .site-nav-inner {
        gap: 0.75rem;
    }

    /* Les entrées du menu principal sont dans le panneau sidebar (section Menu) */
    .nav-menu {
        display: none !important;
    }

    /* Boutons menu / thème masqués ailleurs */
    .nav-trailing .nav-actions {
        display: none;
    }
}

/* ---- Main ---- */
.main-content {
    flex: 1;
    width: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Fond gouttières — aurora indigo/bleu multicouche (thème sombre) */
    background:
        radial-gradient(ellipse 110% 38% at 50% 0%, rgba(102, 126, 234, 0.22) 0%, transparent 100%),
        radial-gradient(ellipse 55% 28% at 8% 65%, rgba(96, 165, 250, 0.08) 0%, transparent 100%),
        radial-gradient(ellipse 45% 22% at 92% 50%, rgba(102, 126, 234, 0.06) 0%, transparent 100%),
        var(--bg-dark);
}

/* Thème clair — tinte lavande très discrète, fond propre */
html[data-theme="light"] .main-content {
    background:
        radial-gradient(ellipse 110% 38% at 50% 0%, rgba(102, 126, 234, 0.07) 0%, transparent 100%),
        radial-gradient(ellipse 55% 28% at 8% 65%, rgba(59, 130, 246, 0.03) 0%, transparent 100%),
        var(--bg-dark);
}

@media (min-width: 768px) {
    .main-content {
        padding: 0;
    }
}

/* ---- Page layout (structure commune) — cadre central qui encadre le contenu ---- */
.main-content > :is([class^="page-"], .article-page, .error-page) {
    width: 100%;
    max-width: var(--page-max);
    margin-left: auto;
    margin-right: auto;
    padding: var(--page-pad-y) var(--page-pad-x) calc(var(--page-pad-y) * 2);
    flex: 1;
    min-height: 0;
    /* Cadre central sombre — léger glow en haut, fondu vers le fond */
    background:
        radial-gradient(ellipse 90% 45% at 50% 0%, var(--bg-card-mid) 0%, transparent 70%),
        var(--bg-dark);
}

/* Thème clair — cadre central blanc avec très légère profondeur */
html[data-theme="light"] .main-content > :is([class^="page-"], .article-page, .error-page) {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-mid) 100%);
}

@media (min-width: 768px) {
    .main-content > :is([class^="page-"], .article-page, .error-page) {
        padding: 1.5rem 2rem 3rem;
    }
}

/* ---- Footer (option B) ---- */
.site-footer {
    width: 100%;
    margin-top: auto;
    padding: 2rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(102, 126, 234, 0.08) 0%, transparent 70%),
        var(--bg-dark);
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    font-size: 0.9rem;
}

html[data-theme="light"] .site-footer {
    background:
        radial-gradient(ellipse 80% 50% at 50% 0%, rgba(102, 126, 234, 0.05) 0%, transparent 70%),
        var(--bg-dark);
}

.site-footer-inner {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
}

.site-footer-grid {
    display: grid;
    gap: 1.75rem 1.25rem;
    grid-template-columns: 1fr;
    margin-bottom: 1.75rem;
}

.site-footer-col--brand {
    text-align: center;
}

.site-footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text);
}

.site-footer-brand:hover {
    color: var(--accent);
}

.site-footer-brand-logo {
    height: 2rem;
    width: auto;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.site-footer-brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    text-align: left;
}

.site-footer-brand-name {
    font-family: var(--font-title);
    font-size: 1.15rem;
    letter-spacing: 0.02em;
}

.site-footer-tagline {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.site-footer-heading {
    margin: 0 0 0.65rem;
    font-family: var(--font-medium);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text);
}

.site-footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.site-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s ease;
}

.site-footer-links a:hover {
    color: var(--color-secondary);
}

.site-footer-bottom {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.site-footer-disclaimer,
.site-footer-copy {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
}

@media (min-width: 768px) {
    .site-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .site-footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-footer-col--brand {
        text-align: left;
    }
}

@media (min-width: 1024px) {
    .site-footer-grid {
        grid-template-columns: 1.15fr 1fr 0.95fr 0.95fr;
        align-items: start;
    }

    .site-footer-bottom {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .site-footer-copy {
        text-align: right;
    }
}

/* ---- Typography ---- */
h1, .h1, .notif-h1 {
    font-family: var(--font-title-bold);
    font-size: clamp(1.65rem, 5vw, 2rem);
    color: var(--text);
    margin-top: 0;
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
    position: relative;
}

/* Barre titre + filtres (saison, etc.) */
.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.15rem;
}

@media (max-width: 480px) {
    .page-title-row {
        flex-wrap: wrap;
        align-items: flex-start;
    }
}

/* Barre générique pour placer le sélecteur en haut à droite d'une page */
.page-season-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

/* Sélecteur de saison (pilule) */
.season-switcher {
    margin: 0;
}

.season-switcher-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: var(--elevated-bg);
    border: 1px solid var(--border);
    box-shadow: var(--elevated-shadow);
}

.season-switcher-label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-family: var(--font-medium);
}

.season-switcher-icon {
    width: 0.85rem;
    height: 0.85rem;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 1.4;
}

.season-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: none;
    background: transparent;
    color: var(--text);
    font-family: var(--font-medium);
    font-size: 0.85rem;
    padding-right: 1.3rem;
    cursor: pointer;
    position: relative;
}

.season-select {
    background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(-45deg, transparent 50%, var(--text-muted) 50%);
    background-position:
        calc(100% - 8px) 45%,
        calc(100% - 4px) 45%;
    background-size: 6px 6px;
    background-repeat: no-repeat;
}

.season-switcher-inner:has(.season-select:focus-visible) {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    .season-switcher-inner {
        max-width: 100%;
    }
}

h2, .h2 {
    font-family: var(--font-title);
    font-size: var(--h2-size);
    color: var(--text);
    margin-top: 0;
    margin-bottom: 0.35rem;
}

/* Forcer l'uniformité des h2 dans le contenu, même si une page surcharge */
.main-content h2 {
    font-size: var(--h2-size) !important;
}

p {
    margin-bottom: 0.75em;
}

.lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.9rem;
}

a {
    color: var(--accent);
}

a:hover {
    text-decoration: underline;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-family: var(--font-title);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--btn-text-on-accent);
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.1s ease, filter 0.15s ease;
}

.btn:active {
    transform: scale(0.98);
    filter: brightness(0.92);
}

.btn:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background: var(--btn-secondary-bg);
}

.btn-secondary:hover {
    background: var(--btn-secondary-bg);
}

.btn--disabled,
.btn--disabled:hover,
.btn--disabled:active {
    background: var(--border);
    border: none;
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
    filter: none;
    transform: none;
    opacity: 0.6;
}

/* ---- Cards (tiles) ---- */
.card-tile {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    box-shadow: var(--shadow-card);
}

.card-tile h3 {
    font-family: var(--font-title);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ---- Badges Sprint (uniforme sur tout le site) ---- */
:where(.gp-sprint-badge, .detail-sprint-badge, .race-tile-badge--sprint) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    line-height: 1;
    padding: 0.2rem 0.55rem;
    border-radius: 10px;
    background: var(--color-gold);
    color: var(--badge-text-on-gold);
    border: 1px solid var(--hairline-dark);
    font-family: var(--font-medium);
    font-weight: 800;
    letter-spacing: 0.05em;
}

/* ---- Toast container (position, aligné play-toasts) ---- */
.toast-container {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(5.2rem + env(safe-area-inset-bottom, 0px));
    width: 100%;
    display: grid;
    gap: 0.5rem;
    z-index: 10050;
    pointer-events: none;
}
