/* Banner SMK : course affichee sur la page d'accueil (JS dans static/js/banner/).
   Un seul fichier pour ne pas multiplier les feuilles bloquantes.

   Sections : cadre et logo, decor defilant, tuyaux, corps sur la piste, souffle
   de la bleue, Lakitu, classement final, tableau du grand prix, rideau, etat de
   la connexion, cartouche du kart suivi, neige, HUD de debug, classement
   lateral, course figee, orage, Bill Ball, ecran de demarrage, plein ecran.

   Le CSS decrit un aspect ; ce qui avance dans le temps est pose image par
   image par le rendu. */

/* ── Cadre, mise en page et logo ─────────────────────────────────────────────── */
.hero.smk-snes-banner {
    position: relative;
    /* 264 px de ciel + 144 px d'asphalte, dont 126 roulables. */
    height: 408px;
    overflow: visible;
    background-color: #f7ce8c;
    padding: 0 !important;
    border-bottom: 4px solid #000;
    margin-bottom: 60px;
}

/* Ecran compact (meme test que compactQuery, config.js) : la hauteur suit la
   largeur de l'ecran (47vw, plafonnee a 246 px) et fixe l'echelle de la scene. */
@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .hero.smk-snes-banner {
        height: min(246px, 47vw);
    }
}

.game-content-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;

    /* Piste roulable, en % de la scene : 30.882 % de 408 px = 126 px (3.6 px par
       unite de bodies.depthPx). Lue telle quelle par le JS. */
    --road-band-pct: 30.882;

    /* Asphalte visible, en % de la scene : la piste plus ~18 px de bitume. */
    --ground-pct: 35.294;
}

/* La scene garde les dimensions du PC et se reduit d'un bloc. Classe posee par
   applyStageScale() (layout.js) avec la variable, en compact comme en plein ecran. */
.hero.is-staged .game-content-wrapper {
    transform: scale(var(--stage-scale));
    transform-origin: 0 0;
    width: calc(100% / var(--stage-scale));
    height: calc(100% / var(--stage-scale));
}

.hero-body-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 200;
    pointer-events: none;
}

/* Le logo garde sa taille : l'echelle inverse annule la reduction du wrapper. */
.hero.is-staged .hero-body-content {
    width: calc(100% * var(--stage-scale));
    height: calc(100% * var(--stage-scale));
    transform-origin: 0 0;
    transform: scale(calc(1 / var(--stage-scale)));
}

.mk-logo-responsive {
    display: block;
    height: auto;
    width: auto;
    max-width: 450px;
    transform: translateY(10px);
    filter: drop-shadow(0 0 20px rgba(255,255,255,0.7));
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .mk-logo-responsive {
        max-width: 300px;
        transform: translateY(5px);
    }
}

/* ── Decor defilant : fond, soleil, sol, ligne ──────────────────────────────────
   Chaque calque est elargi d'un pas (LAYER_STEP, 480 px) et translate dans
   [-480, 0] : transform plutot que background-position, pour rester compose. */
.layer-scrolling-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% + 480px);
    /* Complement de l'asphalte. */
    height: calc(100% - var(--ground-pct) * 1%);
    z-index: 1; 
    background-image: url('../img/banners/index-banner-winter.png');
    background-size: 3840px 100%;
    background-repeat: repeat-x;
    image-rendering: pixelated;
    will-change: transform;
}

.hero.smk-snes-banner[data-season="spring"] .layer-scrolling-bg {
    background-image: url('../img/banners/index-banner-spring.png');
}

.hero.smk-snes-banner[data-season="summer"] .layer-scrolling-bg {
    background-image: url('../img/banners/summer/index-banner-summer.png');
}

.hero.smk-snes-banner[data-season="autumn"] .layer-scrolling-bg {
    background-image: url('../img/banners/autumn/index-banner-autumn.png');
}

/* Soleil (ete uniquement), aligne sur .layer-scrolling-bg. */
.layer-sun {
    position: absolute;
    top: 0%;
    left: 0;
    width: 100px;
    height: 88px;
    z-index: 2;
    display: none;
    will-change: transform;
}

/* Le disque est sur ::after pour que la lueur de ::before passe dessous. */
.hero.smk-snes-banner[data-season="summer"] .layer-sun {
    display: block;
}

/* Lueur animee par opacity et transform (pas de filter), phase calee sur
   l'horloge du serveur (--sun-phase). */
.hero.smk-snes-banner[data-season="summer"] .layer-sun::before {
    content: '';
    position: absolute;
    /* Boite de 300 % centree (une marge en % se resout sur la largeur). */
    inset: -100%;
    border-radius: 50%;
    pointer-events: none;
    /* Lueur encore franche au bord du disque (~24 % du rayon). */
    background: radial-gradient(circle,
        rgba(255, 248, 205, 0.95) 0%,
        rgba(255, 235, 150, 0.85) 14%,
        rgba(255, 225, 120, 0.62) 26%,
        rgba(255, 205, 80, 0.34) 40%,
        rgba(255, 190, 60, 0.14) 54%,
        rgba(255, 180, 50, 0.04) 66%,
        rgba(255, 180, 50, 0) 78%);
    will-change: transform, opacity;
    animation: sunGlow 2.4s ease-in-out infinite;
    animation-delay: var(--sun-phase, 0ms);
}

.hero.smk-snes-banner[data-season="summer"] .layer-sun::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('../img/banners/summer/sun-summer.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    image-rendering: pixelated;
    pointer-events: none;
}

@keyframes sunGlow {
    0%, 100% { opacity: 0.78; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.16); }
}

/* Premier plan (ete et automne), a la vitesse de la route. */
.layer-scrolling-fg {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% + 480px);
    height: calc(100% - var(--ground-pct) * 1%);
    z-index: 3;
    background-size: 3840px 100%;
    background-repeat: repeat-x;
    image-rendering: pixelated;
    will-change: transform;
}

.hero.smk-snes-banner[data-season="summer"] .layer-scrolling-fg {
    background-image: url('../img/banners/summer/index-banner-summer-foureground.png');
}

.hero.smk-snes-banner[data-season="autumn"] .layer-scrolling-fg {
    background-image: url('../img/banners/autumn/index-banner-autumn-foreground.png');
}

/* Second plan (automne) : arbres plus petits, aux trois quarts de la vitesse. */
.layer-scrolling-mid {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% + 480px);
    height: calc(100% - var(--ground-pct) * 1%);
    z-index: 2;
    display: none;
    background-size: 3840px 100%;
    background-repeat: repeat-x;
    image-rendering: pixelated;
    will-change: transform;
}

.hero.smk-snes-banner[data-season="autumn"] .layer-scrolling-mid {
    display: block;
    background-image: url('../img/banners/autumn/index-banner-autumn-midground.png');
}

/* L'asphalte contient la piste (ses 126 px du bas, --road-band-pct) et ~18 px
   de bitume au-dessus. */
.layer-ground {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: calc(var(--ground-pct) * 1%);
    z-index: 4;
    background-color: #333333;
}

.layer-ground::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    /* Un motif de plus que le cadre, pour couvrir toute phase de [-80, 0]. */
    width: calc(100% + 80px);
    height: 10px;
    background-image: repeating-linear-gradient(90deg, #cc0000 0px, #cc0000 40px, #ffffff 40px, #ffffff 80px);
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    /* Defilement pilote par la camera (--road-offset), identique pour tous les
       spectateurs. */
    transform: translate3d(var(--road-offset, 0px), 0, 0);
    will-change: transform;
}

.layer-finish-line {
    position: absolute;
    bottom: 0;
    left: 0;
    /* Couvre toute la route visible. */
    height: calc(var(--ground-pct) * 1%);
    width: 60px;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #000000 25%, transparent 25%, transparent 75%, #000000 75%, #000000),
        linear-gradient(45deg, #000000 25%, transparent 25%, transparent 75%, #000000 75%, #000000);
    background-position: 0 0, 15px 15px;
    background-size: 30px 30px;
    z-index: 6;
    box-shadow: -2px 0 5px rgba(0,0,0,0.3);
    will-change: transform;
}

/* ── Tuyaux ──────────────────────────────────────────────────────────────────────
   Ancre par sa base a sa profondeur, comme un kart. Taille envoyee par le
   serveur (--pipe-w / --pipe-h). */
.pipe {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 90;
    will-change: transform;
    width: calc(var(--pipe-w, 67.2) * 1px);
    height: calc(var(--pipe-h, 87.71) * 1px);
    margin-left: calc(var(--pipe-w, 67.2) * -0.5px);
}


/* Le dessin est dans l'enfant : le parent porte le defilement. */
.pipe-sprite {
    width: 100%;
    height: 100%;
    /* Origine au sol pour l'ecrasement. */
    transform-origin: 50% 100%;
    background-image: url('../img/decor/pipe-green.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    image-rendering: pixelated;
}

/* Variante de couleur, sans effet sur le jeu. */
.pipe-sprite.pipe-red {
    background-image: url('../img/decor/pipe-red.png');
}

.pipe.pipe-shaken .pipe-sprite {
    animation: pipeShake 320ms ease-out;
}

/* Sursaut d'un tuyau traverse par une etoile. */
@keyframes pipeShake {
    0%   { transform: translate3d(0, 0, 0)     scale(1, 1); }
    18%  { transform: translate3d(0, -9px, 0)  scale(0.94, 1.08); }
    45%  { transform: translate3d(0, 0, 0)     scale(1.06, 0.93); }
    70%  { transform: translate3d(0, -3px, 0)  scale(0.98, 1.03); }
    100% { transform: translate3d(0, 0, 0)     scale(1, 1); }
}

/* ── Corps sur la piste : boite, kart, objet tenu ───────────────────────────────
   Profondeur posee dans la translate3d de chaque image. */
.item-box {
    position: absolute;
    bottom: 0;
    background-image: url('../img/items/item-box/item-box.png');
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 100;
    will-change: transform;
}

/* Largeur de base du kart de reference, multipliee par --kart-length. */
.kart-container-moving {
    position: absolute;
    left: 0;
    bottom: 0;
    will-change: transform;
    width: calc(100px * var(--kart-length, 1));
}

/* Valeurs d'ecrasement partagees par le kart et l'objet tenu. */
.karts-layer {
    --flat-squash-x: 1.35;
    --flat-squash-y: 0.28;
    --kart-scale-ms: 220ms;
}

.kart-scaler {
    width: 100%;
    line-height: 0;
    transform: scale(var(--kart-scale, 1)) scale(var(--kart-flat-x, 1), var(--kart-flat-y, 1));
    transform-origin: bottom center;
    transition: transform var(--kart-scale-ms) ease-out;
}

/* Ecrase : second facteur d'echelle, un kart peut etre petit et aplati. */
.kart-scaler.is-flat {
    --kart-flat-x: var(--flat-squash-x);
    --kart-flat-y: var(--flat-squash-y);
}

/* L'objet tenu s'aplatit avec son kart (point d'appui pose en JS, voir
   squashHeldItem dans render.js). */
.held-item-hands img {
    transition: transform var(--kart-scale-ms) ease-out;
}

.held-item-flat img {
    transform: scale(var(--flat-squash-x), var(--flat-squash-y));
}

.kart-sprite {
    width: 100%;
    line-height: 0;
}

.kart-sprite.kart-mirrored {
    transform: scaleX(-1);
}

.kart-static-png {
    width: 100%;
    image-rendering: pixelated;
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4));
    /* Cahot calcule en JS (kartBounceY, render.js). */
}

/* L'ombre suit le miroir du parent. */
.kart-sprite.kart-mirrored .kart-static-png {
    filter: drop-shadow(-4px 4px 0px rgba(0,0,0,0.4));
}

/* steps(1, end) : palette par paliers, comme le jeu d'origine. */
.kart-container-moving.star-active .kart-static-png {
    animation: starRainbow 0.3s steps(1, end) infinite;
}

.kart-container-moving.kart-stopped .kart-static-png {
    animation-play-state: paused;
}

@keyframes starRainbow {
    0%   { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) hue-rotate(0deg) brightness(1.3); }
    25%  { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) hue-rotate(90deg) brightness(1.4); }
    50%  { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) hue-rotate(180deg) brightness(1.3); }
    75%  { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) hue-rotate(270deg) brightness(1.4); }
    100% { filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.4)) hue-rotate(360deg) brightness(1.3); }
}

/* ── Souffle de la carapace bleue ───────────────────────────────────────────────
   Duree egale a blastMs. L'enveloppe porte la position (inline), l'interieur
   l'animation. */
.blue-blast {
    /* Dôme assez haut pour couvrir un kart (100 px). */
    aspect-ratio: 1.5;
}

.blue-blast-wave {
    width: 100%;
    height: 100%;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
    background: radial-gradient(ellipse at 50% 100%,
        rgba(255, 255, 255, 1) 0%,
        rgba(198, 238, 255, 1) 30%,
        rgba(96, 172, 255, 0.98) 55%,
        rgba(28, 82, 232, 0.88) 78%,
        rgba(14, 38, 152, 0.5) 92%,
        rgba(10, 25, 120, 0) 100%);
    box-shadow: 0 0 55px rgba(120, 190, 255, 0.9), 0 0 110px rgba(40, 90, 230, 0.6);
    transform-origin: bottom center;
    animation: blueBlast 0.3s linear forwards;
    will-change: transform, opacity;
}

/* Départ à 0,3 et léger dépassement au sommet. */
@keyframes blueBlast {
    0%   { transform: scale(0.3);  opacity: 1; }
    55%  { transform: scale(1.05); opacity: 1; }
    80%  { transform: scale(0.98); opacity: 1; }
    100% { transform: scale(1.02); opacity: 0.2; }
}

/* ── Lakitu ─────────────────────────────────────────────────────────────────────
   Ancré sur la ligne de départ, en unités monde. */
.lakitu {
    position: absolute;
    left: 0;
    bottom: 0;
    z-index: 500;
    pointer-events: none;
    will-change: transform;
}

.lakitu img {
    height: 100%;
    width: auto;
    image-rendering: pixelated;
    filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.35));
}

/* Flottement au départ et au dernier tour ; période reprise par LAKITU_FLOAT_MS
   (scene.js). */
.lakitu.is-floating img {
    animation: lakituFloat 1.8s ease-in-out infinite;
}

@keyframes lakituFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-4%); }
}

@media (prefers-reduced-motion: reduce) {
    .lakitu.is-floating img { animation: none; }
}

/* ── Classement final ───────────────────────────────────────────────────────────
   Sous le rideau (z-index 700). */
.race-results {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translate(12px, -50%);
    z-index: 650;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border-radius: 10px;
    background-color: rgba(0, 0, 0, 0.72);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.race-results.is-visible {
    opacity: 1;
    transform: translate(0, -50%);
}

.race-result {
    display: flex;
    align-items: center;
    gap: 6px;
}

.race-result-rank {
    font-family: monospace;
    font-size: 12px;
    font-weight: bold;
    color: #ffcc00;
    text-shadow: 2px 2px 0 #cc0000;
    min-width: 12px;
    text-align: right;
}

/* Huit lignes dans la hauteur du bandeau : vignettes plus petites. */
.race-result img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    object-fit: cover;
    background-color: #333;
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .race-results {
        right: 8px;
        padding: 5px 7px;
        gap: 1px;
    }

    .race-result img {
        width: 20px;
        height: 20px;
        border-width: 1px;
    }

    .race-result-rank { font-size: 9px; }
}

/* ── Tableau des scores du grand prix ───────────────────────────────────────────
   Au centre de la scène entre deux courses. */
.race-gp {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 660;
    transform: translate(-50%, -46%);
    padding: 14px 20px;
    border-radius: 12px;
    background-color: rgba(0, 0, 0, 0.82);
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
    border: 2px solid rgba(255, 204, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.race-gp.is-visible {
    opacity: 1;
    transform: translate(-50%, -50%);
}

/* Classement final : distinct d'un point d'étape. */
.race-gp.is-final {
    border-color: #ffcc00;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55), 0 0 22px rgba(255, 204, 0, 0.35);
}

.race-gp-title {
    font-family: monospace;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    color: #ffcc00;
    text-shadow: 2px 2px 0 #cc0000;
    margin-bottom: 10px;
}

.race-gp-rows {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Colonnes : place, vignette, nom, points de la course, cumul (chiffres à largeur fixe). */
.race-gp-row {
    display: grid;
    grid-template-columns: 16px 26px 1fr 30px 28px;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 12px;
    color: #ffffff;
    /* Transition FLIP vers l'ordre general (transform posee puis relachee en JS). */
    transition: transform 0.9s ease;
}

.race-gp-rank {
    font-weight: bold;
    color: #ffcc00;
    text-align: right;
}

.race-gp-row img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    object-fit: cover;
    background-color: #333;
}

.race-gp-name {
    text-transform: capitalize;
    white-space: nowrap;
}

/* Points de la course, effaces une fois ajoutes au cumul (is-settled). */
.race-gp-gained {
    text-align: right;
    color: #7ee787;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.race-gp-row.is-settled .race-gp-gained {
    opacity: 0;
}

.race-gp-total {
    text-align: right;
    font-weight: bold;
    color: #ffcc00;
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .race-gp {
        padding: 9px 12px;
        border-width: 1px;
    }

    .race-gp-title {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .race-gp-rows { gap: 1px; }

    .race-gp-row {
        grid-template-columns: 12px 18px 1fr 24px 22px;
        gap: 5px;
        font-size: 9px;
    }

    .race-gp-row img {
        width: 18px;
        height: 18px;
        border-width: 1px;
    }
}

/* Rideau en damier : couvre la scene le temps qu'elle soit prete. Conteneur
   de decoupe pour ne pas recouvrir la navbar (la section deborde). */
.race-curtain-clip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 700;
    pointer-events: none;
}

.race-curtain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    background-image:
        linear-gradient(45deg, #000000 25%, transparent 25%, transparent 75%, #000000 75%, #000000),
        linear-gradient(45deg, #000000 25%, transparent 25%, transparent 75%, #000000 75%, #000000);
    background-position: 0 0, 30px 30px;
    background-size: 60px 60px;
    box-shadow: 0 6px 0 rgba(0, 0, 0, 0.35);
    /* Levé par défaut (état sans JS) ; -101% évite un liseré. */
    transform: translateY(-101%);
    transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
    will-change: transform;
}

/* Descente un peu plus lente que la remontée. */
.race-curtain.is-down {
    transform: translateY(0);
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.5, 1);
}

/* Placement sans transition (pose puis retire par index.html). Apres .is-down :
   meme specificite, l'ordre tranche. */
.race-curtain.is-instant {
    transition: none;
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .race-curtain {
        background-position: 0 0, 20px 20px;
        background-size: 40px 40px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .race-curtain { transition: none; }
}

/* Le classement est hors du cadre : il s'efface avec le rideau. */
#race-leaderboard {
    transition: opacity 0.35s ease;
}

#race-leaderboard.is-veiled {
    opacity: 0;
}

/* ── État de la connexion ───────────────────────────────────────────────────────
   Au-dessus du rideau. */
.race-status {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: monospace;
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
    pointer-events: none;
    opacity: 0.85;
}

/* Latence, en retrait ; :empty la retire du flex hors connexion. */
.race-status-ms {
    letter-spacing: 0;
    opacity: 0.55;
}

.race-status-ms:empty {
    display: none;
}

.race-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #f5c542;
    box-shadow: 0 0 6px rgba(245, 197, 66, 0.9);
}

.race-status.is-connecting .race-status-dot {
    animation: statusPulse 1.2s ease-in-out infinite;
}

.race-status.is-online .race-status-dot {
    background-color: #3fd35f;
    box-shadow: 0 0 6px rgba(63, 211, 95, 0.9);
}

.race-status.is-offline .race-status-dot {
    background-color: #e5534b;
    box-shadow: 0 0 6px rgba(229, 83, 75, 0.9);
}

/* ── Cartouche du kart suivi ────────────────────────────────────────────────────
   Coin oppose a .race-status ; affiche avec is-on quand la camera suit un kart. */
.race-focus-hud {
    position: absolute;
    bottom: 8px;
    left: 12px;
    z-index: 800;
    font-family: monospace;
    font-size: 11px;
    letter-spacing: 1px;
    color: #ffffff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.35);
    padding: 3px 8px;
    border-radius: 3px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.race-focus-hud.is-on {
    opacity: 0.9;
}

/* ── Place du kart suivi ────────────────────────────────────────────────────────
   Sous le rideau ; animations jouees en JS (position.js). */
.race-position {
    position: absolute;
    top: 6px;
    left: 10px;
    z-index: 640;
    width: 64px;
    height: 64px;
    pointer-events: none;
    visibility: hidden;
}

.race-position.is-on {
    visibility: visible;
}

.race-position img {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.45));
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .race-position {
        top: 4px;
        left: 6px;
        width: 42px;
        height: 42px;
    }
}

/* Releve de decision du kart suivi (mode debug), sous la banniere. */
.race-ai-hud {
    display: none;
    max-width: 640px;
    margin: 6px auto 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.55;
    color: #d8d8d8;
}

.race-ai-hud.is-on { display: block; }

.race-ai-hud .ai-row {
    display: flex;
    gap: 10px;
    white-space: nowrap;
}

/* Largeur fixe pour que les valeurs ne sautent pas. */
.race-ai-hud .ai-key {
    width: 92px;
    flex: none;
    color: #8a8a8a;
}

.race-ai-hud .ai-val { color: #ffffff; }
.race-ai-hud .ai-off { color: #5a5a5a; }
.race-ai-hud .ai-warn { color: #ffcf4d; }
.race-ai-hud .ai-hot { color: #ff6b6b; }

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .race-status-label { display: none; }
}


/* ── Neige (hiver) ─────────────────────────────────────────────────────────────── */
.snow-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    overflow: hidden;
    pointer-events: none;
}

.snowflake {
    position: absolute;
    background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0.8) 40%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    will-change: transform, opacity;
}

.snowflake.falling {
    animation: snowfall linear infinite;
}

.snowflake.landed {
    opacity: 0;
    animation: snowLanded linear forwards;
}

@keyframes snowLanded {
    0% {
        opacity: 0;
        transform: translateX(0);
    }
    5% {
        opacity: 0.7;
    }
    85% {
        opacity: 0.5;
        transform: translateX(calc(var(--drift-distance) * 0.9px));
    }
    100% {
        opacity: 0;
        transform: translateX(calc(var(--drift-distance) * 1px));
    }
}

@keyframes snowfall {
    0% {
        opacity: 0;
        transform: translate(0, -10px);
    }
    5% {
        opacity: 0.9;
    }
    95% {
        opacity: 0.8;
    }
    100% {
        opacity: 0;
        transform: translate(calc(var(--snow-drift) * 1px), calc(var(--snow-fall-height) * 1px));
    }
}


/* ── HUD de debug : carte, vision, emprises ─────────────────────────────────────
   Affiche seulement en mode debug, en lecture seule. Carte a l'echelle 1 : sa
   hauteur est ecrite par updateMapView(), sa largeur prend toute la page. */
#debug-hud {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 98%;
    height: 126px;
    background-color: rgba(0, 0, 0, 0.85);
    border: 2px solid #00ff00;
    z-index: 9999;
    font-family: monospace;
    overflow: hidden;
    box-shadow: 0 0 10px #00ff00;
    display: none;
}

/* Couche de vision, sans clic. */
#debug-vision {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

#debug-vision > div {
    position: absolute;
    pointer-events: none;
}

/* Champ du balayage. */
.dv-cone {
    background: rgba(0, 255, 136, 0.18);
    border-left: 2px solid rgba(0, 255, 136, 0.85);
    border-right: 2px solid rgba(0, 255, 136, 0.85);
    box-sizing: border-box;
}

.dv-note {
    left: 8px;
    top: 6px;
    color: #ffcf4d;
    font-family: monospace;
    font-size: 11px;
    white-space: nowrap;
}

/* Angle mort : trapeze projete par un corps solide depuis la camera. */
.dv-shadow {
    background: rgba(0, 0, 0, 0.62);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
}

/* Ligne de tir : portee du danger latent, bande d'alignement. */
.dv-press { background: rgba(255, 207, 77, 0.16); }

/* Objets : couche reecrite a chaque image, au-dessus de la vue et sous les karts. */
#debug-items {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Entre les tuyaux (5) et les karts (10). */
    z-index: 6;
}

/* Selecteur de classe (un id l'emporterait sur .dv-item-inert). */
.dv-item {
    position: absolute;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    background-color: rgba(120, 255, 160, 0.45);
    border: 1px solid #78ffa0;
}

.dv-item-banana { background-color: rgba(255, 225, 77, 0.45); border-color: #ffe14d; }

/* Objet traine : trait plein, fond vide (il encaisse sans frapper). */
.dv-item-held {
    background-color: rgba(120, 255, 160, 0.12);
    border: 2px solid #78ffa0;
}

/* Sans emprise (bleue, banane qui monte) : un simple point. */
.dv-item-inert {
    width: 7px;
    height: 7px;
    background-color: transparent;
    border: 1px dashed rgba(255, 255, 255, 0.65);
    transform: translate(-50%, -50%) rotate(45deg);
}

/* Faisceau du regard (SVG, pour les rayons obliques). */
.dv-rays {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.dv-ray {
    fill: none;
    vector-effect: non-scaling-stroke;
}

/* Ouverture du faisceau, au bout de la portee. */
.dv-ray-edge {
    stroke: rgba(0, 255, 136, 0.35);
    stroke-width: 1;
    stroke-dasharray: 3 4;
}

/* Rayons rasants qui bornent un angle mort. */
.dv-ray-graze {
    stroke: rgba(255, 255, 255, 0.45);
    stroke-width: 1;
}

/* Bras entre le kart et sa camera. */
.dv-eyelink {
    border-top: 1px dotted rgba(0, 255, 136, 0.55);
    background: none;
}

.dv-lane {
    left: 0;
    width: 100%;
    height: 0;
    border-top: 1px dashed rgba(255, 255, 255, 0.18);
}

/* Ce qui ferme un passage : mur dur ou obstacle franchissable a un cout. */
.dv-span {
    background: rgba(80, 160, 255, 0.28);
    border: 1px solid rgba(80, 160, 255, 0.55);
    box-sizing: border-box;
}

.dv-span.dv-hard {
    background: rgba(255, 70, 70, 0.30);
    border-color: rgba(255, 70, 70, 0.75);
}

/* Profondeurs retenues : menace, porteur evite, consigne du plan. */
.dv-threat, .dv-carrier, .dv-plan {
    left: 0;
    width: 100%;
    height: 0;
}

.dv-threat { border-top: 2px solid #ff4d4d; }
.dv-carrier { border-top: 2px dotted #ffcf4d; }
.dv-plan { border-top: 2px solid #4dff9e; }

/* Points d'interet de la vue. */
.dv-pin {
    width: 9px;
    height: 9px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    box-sizing: border-box;
    border: 2px solid #fff;
}

.dv-pin-pipe { border-color: #ff4d4d; }
.dv-pin-box { border-color: #ffe14d; }
.dv-pin-red { border-color: #ff7ad9; }

/* L'oeil : le kart suivi, tourne du cote qu'il balaie. */
.dv-eye {
    width: 0;
    height: 0;
    margin: -6px 0 0 -3px;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 9px solid #00ff88;
}

.dv-eye-back {
    margin-left: -6px;
    border-left: 0;
    border-right: 9px solid #ffcf4d;
}

.debug-camera-view {
    position: absolute;
    top: 0;
    height: 100%;
    border: 2px solid #ff0000;
    background-color: rgba(255, 0, 0, 0.2);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 3;
}

/* Corps dessine a son emprise (dimensions en style inline). */
.debug-entity {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    box-sizing: border-box;
    font-size: 11px;
    font-weight: bold;
    color: white;
    /* L'initiale se centre et deborde plutot que de deformer la marque. */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    white-space: nowrap;
    /* Au-dessus du calque de vision. */
    z-index: 2;
}

.debug-kart {
    background-color: rgba(64, 96, 255, 0.75);
    border: 1px solid #7f9bff;
    z-index: 10;
}

.debug-itembox {
    background-color: rgba(255, 221, 51, 0.35);
    border: 1px solid #ffdd33;
}

.debug-pipe {
    background-color: rgba(255, 77, 77, 0.7);
    border: 1px solid #ff8a8a;
    z-index: 5;
}

/* Ligne d'arrivee : bande sur toute la profondeur, posee par son bord gauche
   (transform: none annule le centrage commun). Translucide. */
.debug-finish {
    height: 100%;
    background-color: rgba(255, 255, 255, 0.35);
    border-left: 2px solid #ffffff;
    top: 0;
    transform: none;
}

/* Kart suivi, et corps masques a sa vue. */
.debug-kart.is-watched { box-shadow: 0 0 0 2px #00ff88; }

.debug-kart.is-masked {
    opacity: 0.3;
    outline: 1px dashed rgba(255, 255, 255, 0.5);
}


/* ── Classement lateral, pause et vote ──────────────────────────────────────────
   Hors du cadre du bandeau : il porte son propre voile. */
#race-leaderboard {
    position: absolute;
    top: 100%;
    margin-top: 8px;
    right: 15px;
    z-index: 600;
    width: 368px;
    height: 50px;
    pointer-events: none;
    display: flex;
}

.leaderboard-pp {
    position: absolute;
    top: 0;
    width: 40px; 
    height: 40px;
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.leaderboard-pp img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
    display: block;
    object-fit: cover;
    background-color: #333;
}

/* Vignettes cliquables : verrouillent la caméra sur un kart. */
.leaderboard-pp {
    pointer-events: auto;
    cursor: pointer;
}

/* Vue par défaut, à gauche des photos. */
.leaderboard-camera {
    left: -46px;
    background-color: #111111;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.leaderboard-camera svg {
    width: 22px;
    height: 22px;
    fill: #ffffff;
}

/* Pause puis vote à gauche de la caméra : boutons de 40 px tous les 46 px
   (-46, -92, -138). */
.leaderboard-pause {
    left: -92px;
    background-color: #111111;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.leaderboard-pause svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* Icône selon l'état : barres en course, triangle une fois figée. */
.leaderboard-pause .ico-play,
.leaderboard-pause.is-paused .ico-pause {
    display: none;
}

.leaderboard-pause.is-paused .ico-play {
    display: inline;
}

/* Course figée : bouton allumé en rouge (l'or marque la caméra active). */
.leaderboard-pause.is-paused {
    background-color: #6f1d1d;
    border-color: #ff7b72;
    box-shadow: 0 0 8px rgba(255, 123, 114, 0.8);
}

.leaderboard-pause.is-paused svg {
    fill: #ff7b72;
}

.leaderboard-vote {
    left: -138px;
    background-color: #111111;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Sans mode debug, pas de pause : le vote prend sa place. */
.leaderboard-camera + .leaderboard-vote {
    left: -92px;
}

.leaderboard-vote svg {
    width: 21px;
    height: 21px;
    fill: #ffffff;
}

.leaderboard-vote.is-voted {
    background-color: #1d6f3f;
    border-color: #7ee787;
    box-shadow: 0 0 8px rgba(126, 231, 135, 0.8);
}

.leaderboard-vote.is-voted svg {
    fill: #7ee787;
}

/* Décompte collé en bas à droite du bouton. Vide quand on est seul : « 0/1 »
   n'apprendrait rien à un spectateur unique. */
.leaderboard-vote-count {
    position: absolute;
    right: -4px;
    bottom: -3px;
    min-width: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background-color: #111111;
    border: 1px solid #ffffff;
    font-family: monospace;
    font-size: 9px;
    line-height: 13px;
    text-align: center;
    color: #ffffff;
}

.leaderboard-vote-count:empty {
    display: none;
}

.leaderboard-pp.is-focused img,
.leaderboard-camera.is-focused {
    border-color: #ffcc00;
    box-shadow: 0 0 6px rgba(255, 204, 0, 0.9);
}

/* Réalisation automatique en cours : icône en jaune, même caméra posée sur un kart. */
.leaderboard-camera.is-auto svg {
    fill: #ffcc00;
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .leaderboard-camera {
        left: -32px;
    }

    .leaderboard-camera svg {
        width: 15px;
        height: 15px;
    }

    /* Vignettes de 28 px : caméra -32/-4, pause -64/-36, vote -96/-68. */
    .leaderboard-pause {
        left: -64px;
    }

    .leaderboard-pause svg {
        width: 14px;
        height: 14px;
    }

    .leaderboard-vote {
        left: -96px;
    }

    .leaderboard-camera + .leaderboard-vote {
        left: -64px;
    }

    .leaderboard-vote svg {
        width: 15px;
        height: 15px;
    }

    .leaderboard-vote-count {
        right: -3px;
        bottom: -2px;
        min-width: 13px;
        font-size: 8px;
        line-height: 11px;
    }
}

.leaderboard-pp.overtaking {
    z-index: 10;
    transform: scale(1.2);
    transition: all 0.3s ease;
}

.leaderboard-pp.dropping {
    transform: scale(0.9);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.leaderboard-pp.pp-star-active img {
    animation: ppStarRainbow 0.4s linear infinite;
}

@keyframes ppStarRainbow {
    0%   { filter: hue-rotate(0deg) brightness(1.3); }
    25%  { filter: hue-rotate(90deg) brightness(1.4); }
    50%  { filter: hue-rotate(180deg) brightness(1.3); }
    75%  { filter: hue-rotate(270deg) brightness(1.4); }
    100% { filter: hue-rotate(360deg) brightness(1.3); }
}

.leaderboard-pp.hit {
    animation: ppHitSpin 0.6s ease-out;
}

@keyframes ppHitSpin {
    0% { transform: translate(0, 0) rotate(0deg); }
    10% { transform: translate(-3px, 0) rotate(-10deg); }
    20% { transform: translate(3px, 0) rotate(10deg); }
    30% { transform: translate(-3px, 0) rotate(-10deg); }
    40% { transform: translate(3px, 0) rotate(10deg); }
    50% { transform: translate(-2px, 0) rotate(180deg); }
    70% { transform: translate(1px, 0) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    #race-leaderboard {
        margin-top: 5px;
        right: 5px;
        width: 256px;
    }

    .leaderboard-pp {
        width: 28px;
        height: 28px;
    }
}

/* ── Course figée ───────────────────────────────────────────────────────────────
   Le rendu JS cesse de peindre ; ici on suspend les animations CSS de la scène
   et du classement (le bouton pause reste cliquable). */
.smk-snes-banner.is-paused .game-content-wrapper,
.smk-snes-banner.is-paused .game-content-wrapper *,
.smk-snes-banner.is-paused .game-content-wrapper *::before,
.smk-snes-banner.is-paused .game-content-wrapper *::after,
.smk-snes-banner.is-paused #race-leaderboard *,
.smk-snes-banner.is-paused #race-leaderboard *::before,
.smk-snes-banner.is-paused #race-leaderboard *::after {
    animation-play-state: paused !important;
}

/* ── Orage de l'éclair ──────────────────────────────────────────────────────────
   Opacité posée à chaque frame par renderStorm() d'après le snapshot. */
.storm-layer {
    position: absolute;
    inset: 0;
    /* Devant le logo (200), derrière les karts (365+). */
    z-index: 210;
    display: none;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Ciel très assombri, piste presque pas : effet de couverture nuageuse. */
.storm-dim {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
        rgba(10, 12, 34, 0.86) 0%,
        rgba(14, 18, 46, 0.78) 45%,
        rgba(20, 26, 58, 0.5) calc(100% - var(--ground-pct) * 1%),
        rgba(24, 30, 64, 0.18) 85%,
        rgba(24, 30, 64, 0.08) 100%);
}

.storm-bolts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%;
}

.storm-bolt {
    position: absolute;
    top: -4%;
    width: 60px;
    height: 100%;
    margin-left: -30px;
    opacity: 0;
    overflow: visible;
}


/* Halo jaune sous un cœur blanc ; non-scaling-stroke car le SVG est étiré. */
.storm-bolt-glow {
    fill: none;
    stroke: #ffd84d;
    stroke-width: 9;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 10px rgba(255, 226, 120, 0.95))
            drop-shadow(0 0 26px rgba(255, 196, 60, 0.7));
}

.storm-bolt-core {
    fill: none;
    stroke: #ffffff;
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

/* Trois traits en cascade. */
.storm-bolts.storm-firing .storm-bolt {
    animation: stormBolt 420ms ease-out both;
}

.storm-bolts.storm-firing .storm-bolt:nth-child(2) {
    animation-delay: 110ms;
}

.storm-bolts.storm-firing .storm-bolt:nth-child(3) {
    animation-delay: 210ms;
}

/* Déchirure vers le bas puis clignotement franc. */
@keyframes stormBolt {
    0%   { opacity: 0;    transform: scaleY(0.35); }
    6%   { opacity: 1;    transform: scaleY(1); }
    22%  { opacity: 0.15; }
    34%  { opacity: 1; }
    52%  { opacity: 0.2; }
    64%  { opacity: 0.95; }
    100% { opacity: 0;    transform: scaleY(1); }
}

/* Flash de la frappe, bref et jamais tout à fait blanc. */
.storm-flash {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 25%,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(214, 232, 255, 0.55) 40%,
        rgba(180, 210, 255, 0) 75%);
    opacity: 0;
}

.storm-flash.storm-firing {
    animation: stormFlash 620ms ease-out both;
}

@keyframes stormFlash {
    0%   { opacity: 0; }
    5%   { opacity: 1; }
    18%  { opacity: 0.1; }
    30%  { opacity: 0.75; }
    100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .storm-bolts.storm-firing .storm-bolt,
    .storm-flash.storm-firing {
        animation: none;
    }
    .storm-bolts.storm-firing .storm-bolt {
        opacity: 0.9;
    }
}

/* ── Bill Ball ──────────────────────────────────────────────────────────────────
   L'image du kart est remplacée par celle du bill pendant le vol. La taille se
   règle ici, pas dans le PNG :
   - max-width: none est indispensable (Bulma plafonne les img à 100 %) ;
   - margin-left = -(width - 100) / 2 garde le sprite centré sur la hitbox, et
     width doit rester cohérente avec bill.hitbox.x (N% <-> N/2) ;
   - translateY ne dépend pas de la largeur : l'image est ancrée par le bas. */

/* Ni toupie ni arc-en-ciel (le cahot est coupé en JS, voir kartBounceY). */
.kart-container-moving.kart-bill .kart-static-png {
    animation: none;
    max-width: none;
    width: 198%;
    margin-left: -49%;
    transform: translateY(-12px);
    filter: drop-shadow(0 0 12px rgba(255, 190, 90, 0.75))
            drop-shadow(0 0 26px rgba(255, 140, 40, 0.45))
            drop-shadow(4px 4px 0 rgba(0, 0, 0, 0.45));
}


/* ── Écran de démarrage ─────────────────────────────────────────────────────────
   Voile noir plein écran peint par le CSS dès la première image, puis badge
   MkReset ; la sortie est déclenchée en JS (race:ready, index.html). */
.boot-splash {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    opacity: 1;
    /* Fondu long en ease-in-out. */
    transition: opacity 1.2s ease-in-out;
}

/* Déjà vu dans cet onglet : classe posée dans le <head> (index.html). */
html.boot-seen .boot-splash {
    display: none;
}

/* Sortie : plus de clic intercepté dès le début du fondu. */
.boot-splash.is-gone {
    opacity: 0;
    pointer-events: none;
}

/* Badge dessiné en CSS (texte net, pas d'image à charger). */
.boot-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    height: 1.8em;
    padding: 0 0.85em;
    border: 0.17em solid #fff;
    border-radius: 999px;
    color: #fff;
    font-family: 'Arial Black', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: clamp(26px, 7vw, 46px);
    font-weight: 900;
    letter-spacing: 0.02em;
    line-height: 1;
    white-space: nowrap;

    /* S'allume une demi-seconde après le noir. */
    opacity: 0;
    animation: boot-logo-in 0.5s ease-out 0.5s forwards;
}

/* Décalage vertical du mot dans l'anneau (la police réserve la place des
   jambages). En em, il suit la taille du logo. */
.boot-logo-word {
    display: block;
    transform: translateY(0.06em);
}

@keyframes boot-logo-in {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1); }
}

/* Sans animation : le voile part vite mais cache toujours l'assemblage. */
@media (prefers-reduced-motion: reduce) {
    .boot-logo { animation: none; opacity: 1; }
    .boot-splash { transition: opacity 0.2s linear; }
}


/* ── Plein ecran ────────────────────────────────────────────────────────────────
   Classe commune a l'API Fullscreen et au repli (fullscreen.js). Le cadre prend
   l'ecran en noir ; le bandeau est en pleine largeur, a une hauteur plafonnee
   pour montrer au moins --fullscreen-min-units de piste (layout.js). */
.banner-frame.is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    background-color: #000;
    /* Longueur de piste minimale visible, en unites du monde. */
    --fullscreen-min-units: 1200;
}

.hero.smk-snes-banner.is-fullscreen {
    width: 100%;
    /* Largeur de la scene PC. */
    height: min(100%, calc(100vw * 404 / var(--fullscreen-min-units)));
    /* Bande du haut, posee par placeInFrame(). */
    margin: var(--frame-top, 0px) 0 0;
    border-bottom: 0;
}

html.banner-pseudo-fullscreen,
html.banner-pseudo-fullscreen body {
    overflow: hidden;
}

/* Classement dans la bande du bas s'il y a la place (has-board-room), sinon en
   haut a droite ; l'etat de la connexion descend alors en bas. */
.hero.is-fullscreen:not(.has-board-room) #race-leaderboard {
    top: 8px;
    margin-top: 0;
}

.hero.is-fullscreen:not(.has-board-room) .race-status {
    top: auto;
    bottom: 8px;
}

/* Bouton a gauche du vote (meme serie de decalages). */
.leaderboard-fullscreen {
    left: -184px;
    background-color: #111111;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

.leaderboard-camera + .leaderboard-vote + .leaderboard-fullscreen {
    left: -138px;
}

.leaderboard-fullscreen svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

.leaderboard-fullscreen .ico-exit,
.leaderboard-fullscreen.is-active .ico-enter {
    display: none;
}

.leaderboard-fullscreen.is-active .ico-exit {
    display: inline;
}

@media screen and (max-width: 768px), screen and (max-height: 500px) and (orientation: landscape) {
    .leaderboard-fullscreen {
        left: -128px;
    }

    .leaderboard-camera + .leaderboard-vote + .leaderboard-fullscreen {
        left: -96px;
    }

    .leaderboard-fullscreen svg {
        width: 15px;
        height: 15px;
    }
}

/* Bouton reserve au tactile. */
@media (hover: hover) and (pointer: fine) {
    .leaderboard-fullscreen {
        display: none;
    }
}

/* Plein ecran en portrait : voile sur tout le cadre. */
.race-rotate-hint {
    display: none;
}

@media (orientation: portrait) {
    .banner-frame.is-fullscreen .race-rotate-hint {
        position: absolute;
        inset: 0;
        z-index: 900;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 14px;
        background-color: #111111;
        color: #ffffff;
        text-align: center;
        font-weight: bold;
    }
}

.race-rotate-hint svg {
    width: 56px;
    height: 56px;
    fill: none;
    stroke: #ffffff;
    stroke-width: 1.6;
    stroke-linecap: round;
    animation: rotateHint 2s ease-in-out infinite;
}

.race-rotate-hint p {
    margin: 0;
    font-size: 16px;
}

.race-rotate-hint button {
    padding: 6px 14px;
    border: 2px solid #ffffff;
    border-radius: 16px;
    background: transparent;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

@keyframes rotateHint {
    0%, 25%   { transform: rotate(0deg); }
    55%, 100% { transform: rotate(-90deg); }
}

@media (prefers-reduced-motion: reduce) {
    .race-rotate-hint svg { animation: none; transform: rotate(-90deg); }
}
