/* =====================================================================
   NIGHTLINE D — V5.1 UI (thème jeu : couche « GAME UI » en fin de fichier)
   Mobile-first. Le menu est posé AU-DESSUS du showroom 3D (canvas plein écran).
   ===================================================================== */
:root {
    /* Palette V5.1 : noir, rouge, gris clair (aspect jeu, pas site web) */
    --bg: #050506;
    --panel: rgba(9, 9, 11, 0.9);
    --panel-solid: #0c0c0e;
    --card: rgba(255, 255, 255, 0.035);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --text: #ececef;
    --muted: #a3a4ab;
    --dim: #5f6067;
    --red: #e3132f;
    --red-2: #8f0a1d;
    --red-glow: rgba(227, 19, 47, .55);
    --gray: #cfd0d4;
    --gray-2: #2a2b30;
    --gold: #d9dade;      /* anciens accents (or, menthe, bleu) ramenés dans la palette */
    --mint: #f1f1f3;
    --blue: #8e9098;
    --radius: 2px;
    --cut: 14px;          /* coins biseautés */
    --font: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; color: inherit; }
b { font-weight: 700; }

#game-container {
    position: fixed;
    inset: 0;
    touch-action: none;
}
#game-container canvas { display: block; }

/* ---------- Boutons génériques ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 12px 18px;
    border: 0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition: transform .08s ease, filter .15s ease, background .15s ease;
}
.btn:active:not(:disabled) { transform: translateY(2px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn + .btn { margin-top: 10px; }
.btn-primary { background: linear-gradient(135deg, var(--red), var(--red-2)); color: #fff; box-shadow: 0 6px 20px -8px var(--red); }
.btn-ghost { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-light { background: #f3f3f8; color: #111; }
.btn-mint { background: linear-gradient(135deg, #37f0b2, #12b57f); color: #04140e; }
.btn-gold { background: linear-gradient(135deg, #ffd65a, #e2a90a); color: #1a1405; }

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(12,12,20,0.7);
    color: var(--text);
    font-size: 1.25rem;
    cursor: pointer;
    display: grid;
    place-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex: none;
}
.icon-btn:active { transform: scale(.95); }
.discord-btn { color: #aab4ff; text-decoration: none; }
.discord-btn:hover { color: #fff; background: #5865f2; border-color: #5865f2; }
.icon-btn-sm { width: 36px; height: 36px; font-size: 1rem; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: rgba(255,197,61,.15);
    color: var(--gold);
    border: 1px solid rgba(255,197,61,.35);
}
.badge-mint { background: rgba(46,230,166,.12); color: var(--mint); border-color: rgba(46,230,166,.35); }

.status-line { min-height: 1.2em; margin-top: 10px; font-size: .9rem; color: var(--muted); text-align: center; }
.status-line.is-error { color: var(--red); }
.bot-offer { display: grid; gap: 8px; justify-items: center; margin-top: 8px; padding: 10px; border-radius: 12px; border: 1px dashed var(--line-strong); font-size: .8rem; color: var(--muted); text-align: center; animation: miFade .3s ease-out; }
.bot-offer .btn { width: 100%; }
.status-line.is-ok { color: var(--mint); }

/* ---------- Segmented control ---------- */
.segmented {
    display: inline-flex;
    padding: 3px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--line);
    gap: 2px;
}
.segmented button {
    border: 0;
    background: transparent;
    color: var(--muted);
    padding: 7px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: .82rem;
    cursor: pointer;
    white-space: nowrap;
}
.segmented button.active { background: var(--red); color: #fff; }
.segmented button.donate-tab.active { background: var(--gold); color: #1a1405; }
.segmented-full { display: flex; width: 100%; margin-bottom: 16px; }
.segmented-full button { flex: 1; }
/* Paramètres : 4 onglets → passent sur 2 lignes quand la fenêtre est étroite (jamais de libellé coupé) */
.settings-tabs { display: grid; grid-template-columns: repeat(4, 1fr); }.settings-tabs button { padding-left: 4px; padding-right: 4px; font-size: .74rem; white-space: nowrap; }

/* =====================================================================
   MENU PRINCIPAL
   ===================================================================== */
#main-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(26vh, 1fr) auto auto;
    grid-template-areas: "top" "show" "hub" "legal";
    padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(6px + var(--safe-b)) calc(12px + var(--safe-l));
    pointer-events: none;
}
body:not(.in-menu) #main-menu { display: none; }

/* Vignette statique (plus d'animation plein écran coûteuse) */
#main-menu::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(255,45,70,.16), transparent 55%),
        linear-gradient(to bottom, rgba(7,7,13,.55), transparent 22%, transparent 55%, rgba(7,7,13,.8));
    pointer-events: none;
    z-index: -1;
}

.topbar {
    grid-area: top;
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    min-width: 0;
}
.brand { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-name {
    font-size: 1.45rem;
    font-weight: 700;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: .03em;
    white-space: nowrap;
    text-shadow: 0 2px 16px rgba(255,45,70,.4);
}
.brand-name b { color: var(--red); margin-left: 3px; }
.brand-ver {
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--red);
    color: #fff;
    letter-spacing: .08em;
}
.online-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    color: var(--mint);
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(46,230,166,.08);
    border: 1px solid rgba(46,230,166,.22);
    white-space: nowrap;
}
.online-pill i {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--mint);
    box-shadow: 0 0 8px var(--mint);
    animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .35; } }

/* Horloge du jeu (synchronisée entre joueurs) */
.game-clock {
    --gc: var(--gold);
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px 6px; border-radius: 999px; overflow: hidden;
    font-size: .78rem; white-space: nowrap;
    background: rgba(255,255,255,.05); border: 1px solid var(--line-strong);
    transition: border-color .6s, background .6s;
}
.game-clock b { font-variant-numeric: tabular-nums; font-size: .92rem; letter-spacing: .03em; color: var(--gc); transition: color .6s; }
.game-clock .gc-ico { font-size: .9rem; line-height: 1; }
.game-clock .gc-phase { color: var(--muted); }
.gc-bar { position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; border-radius: 1px; background: rgba(255,255,255,.08); }
.gc-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 1px; background: var(--gc); transition: background .6s; }
.game-clock[data-phase="day"]     { --gc: #ffd24d; }
.game-clock[data-phase="sunset"]  { --gc: #ff7a45; border-color: rgba(255,122,69,.5); background: rgba(255,122,69,.1); }
.game-clock[data-phase="night"]   { --gc: #8fb4ff; border-color: rgba(120,150,255,.35); background: rgba(60,80,200,.1); }
.game-clock[data-phase="sunrise"] { --gc: #ff9fb0; border-color: rgba(255,159,176,.5); background: rgba(255,159,176,.1); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-status { display: flex; align-items: center; gap: 10px; min-width: 0; }

.profile-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 4px 4px;
    border-radius: 14px;
    background: rgba(12,12,20,0.75);
    border: 1px solid var(--line-strong);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    min-width: 0;
}
.profile-chip img { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex: none; background: #222; }
.profile-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.profile-name { font-weight: 700; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.profile-stats { display: flex; gap: 8px; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.stat-elo b { color: var(--gold); }
.stat-coins b { color: var(--mint); }
.chip-btn {
    width: 32px; height: 32px;
    border-radius: 10px;
    border: 0;
    background: rgba(255,255,255,.06);
    color: var(--muted);
    cursor: pointer;
    font-size: .95rem;
    flex: none;
}
.chip-btn:hover { color: var(--red); }

/* Zone showroom : transparente, capte les glisser pour tourner la voiture */
#showroom-zone {
    grid-area: show;
    position: relative;
    pointer-events: auto;
    touch-action: none;
    cursor: grab;
    min-height: 0;
}
#showroom-zone:active { cursor: grabbing; }
.showroom-caption {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}
.showroom-caption span { display: block; font-weight: 700; font-style: italic; letter-spacing: .06em; text-transform: uppercase; font-size: .9rem; text-shadow: 0 2px 10px #000; }
.showroom-caption small { color: var(--muted); font-size: .7rem; }

.hub {
    grid-area: hub;
    pointer-events: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 14px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 20px 60px -20px rgba(0,0,0,.8);
    animation: panelIn .35s ease-out;
    min-height: 0;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.legal {
    grid-area: legal;
    text-align: center;
    font-size: .7rem;
    color: var(--dim);
    padding-top: 6px;
    pointer-events: auto;
}
.legal a { color: var(--dim); text-decoration: none; margin: 0 6px; }
.legal a:hover { color: var(--red); }

/* ---------- Connexion ---------- */
.login-panel { text-align: center; padding: 20px 18px; }
.hero-title {
    margin: 0 0 6px;
    font-size: 2.1rem;
    line-height: .95;
    font-style: italic;
    text-transform: uppercase;
}
.hero-title span { color: var(--red); }
/* Texte lu par les moteurs de recherche et lecteurs d'écran, invisible à l'écran */
.sr-only, .hero-title .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; }
.hero-sub { margin: 0 0 18px; color: var(--muted); font-size: .92rem; }
.google-wrap { display: flex; justify-content: center; min-height: 44px; }
.or-sep { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--dim); font-size: .8rem; text-transform: uppercase; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login-note { font-size: .75rem; color: var(--dim); margin: 12px 0 0; }

/* ---------- Hub : navigation par écrans ---------- */
.hub-panel { display: flex; flex-direction: column; padding: 10px; }
.screen-head { display: flex; align-items: center; gap: 8px; margin: -2px 0 8px; flex: none; }
.screen-head h2 { margin: 0; font-size: 1.05rem; font-style: italic; text-transform: uppercase; letter-spacing: .04em; }
.screen-back {
    width: 36px; height: 36px; flex: none; border-radius: 10px; border: 1px solid var(--line);
    background: rgba(255,255,255,.04); color: var(--text); font-size: 1.5rem; line-height: 1; cursor: pointer;
    display: grid; place-items: center; padding: 0 0 3px;
}
.screen-back:hover { border-color: var(--line-strong); }
.screen-back:disabled { opacity: .35; cursor: default; }
.screen-in { animation: screenIn .22s ease-out; }
.screen-back-in { animation: screenBackIn .22s ease-out; }
@keyframes screenIn { from { opacity: .4; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes screenBackIn { from { opacity: .4; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* Accueil : un gros bouton JOUER + 3 tuiles */
.home { display: grid; gap: 10px; }
.home-play {
    display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 18px;
    border: 0; border-radius: 16px; cursor: pointer; text-align: left; color: #fff;
    background: linear-gradient(135deg, var(--red), var(--red-2));
    box-shadow: 0 12px 30px -12px rgba(255,45,70,.7);
    transition: transform .12s, filter .12s;
}
.home-play:hover { filter: brightness(1.08); }
.home-play:active { transform: scale(.98); }
.home-play-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.22); font-size: 1.15rem; padding-left: 3px; }
.home-play-txt { display: flex; flex-direction: column; min-width: 0; }
.home-play-txt b { font-size: 1.6rem; font-style: italic; text-transform: uppercase; letter-spacing: .05em; line-height: 1; }
.home-play-txt small { margin-top: 4px; font-size: .76rem; opacity: .85; }
.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.home-tile { position: relative; }
.tile-badge {
    position: absolute; top: 6px; right: 6px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--red); color: #fff; font-style: normal; font-size: .7rem; font-weight: 700; line-height: 20px;
    box-shadow: 0 0 0 2px var(--panel-solid);
}
@media (max-width: 400px) { .home-tile { font-size: .72rem; min-height: 68px; } .home-tile span { font-size: 1.3rem; } }

/* Missions du jour : entrée de l'accueil + écran */
.home-missions { position: relative; min-height: 58px; border-color: rgba(255,197,61,.35); background: linear-gradient(90deg, rgba(255,197,61,.10), rgba(255,255,255,.03)); }
.home-missions .mr-txt b { font-style: italic; text-transform: uppercase; letter-spacing: .03em; }
.home-missions .mr-txt small { color: var(--muted); font-size: .76rem; white-space: normal; overflow-wrap: anywhere; }
.home-missions { min-width: 0; max-width: 100%; }
.home-missions .mr-ico { background: rgba(255,197,61,.16); }
.home-missions .tile-badge { position: static; margin-left: auto; }
.home-missions.ready { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(255,197,61,.4), 0 8px 24px -10px rgba(255,197,61,.6); }
.home-missions.ready .mr-txt small { color: var(--gold); font-weight: 700; }
.ms-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.ms-head b { color: var(--text); font-variant-numeric: tabular-nums; }
#ms-total b { color: var(--gold); }
.ms-list { display: grid; gap: 10px; }
.ms-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: rgba(255,255,255,.04); --tc: var(--mint); }
.ms-card.tier-1 { --tc: #3d8bff; }
.ms-card.tier-2 { --tc: #c86bff; }
.ms-card.ready { border-color: var(--gold); background: rgba(255,197,61,.08); }
.ms-card.claimed { opacity: .55; }
.ms-top { display: flex; align-items: center; gap: 10px; }
.ms-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 1.25rem; }
.ms-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ms-txt small { color: var(--tc); font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.ms-txt b { font-size: .92rem; line-height: 1.25; }
.ms-reward { text-align: right; flex: none; display: flex; flex-direction: column; }
.ms-reward b { color: var(--gold); font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.ms-reward small { color: var(--muted); font-size: .66rem; }
.ms-bar { height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); margin: 10px 0 8px; overflow: hidden; }
.ms-bar i { display: block; height: 100%; border-radius: 4px; background: var(--tc); transition: width .4s; }
.ms-card.ready .ms-bar i { background: var(--gold); }
.ms-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ms-bottom .btn { padding: 7px 14px; font-size: .8rem; }
.ms-claim { animation: msPulse 1.6s ease-in-out infinite; }
@keyframes msPulse { 50% { box-shadow: 0 0 0 4px rgba(255,45,70,.25); } }
.ms-claimed { color: var(--mint); font-weight: 700; }
.ms-note { color: var(--muted); font-size: .76rem; line-height: 1.45; margin: 12px 2px 0; }

/* ---------- Amis ---------- */
.fr-code {
    display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px;
    background: linear-gradient(135deg, rgba(255,45,70,.12), rgba(255,255,255,.03)); border: 1px solid rgba(255,45,70,.35);
}
.fr-code > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-code small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.fr-code b { font-size: 1.2rem; letter-spacing: .06em; white-space: nowrap; font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text; }
.fr-code .btn { padding: 6px 9px; font-size: .72rem; min-height: 0; flex: none; }
.fr-add { display: flex; gap: 8px; margin-top: 10px; }
.fr-add input {
    flex: 1; min-width: 0; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-strong);
    background: rgba(255,255,255,.04); color: var(--text); font: inherit; font-size: .9rem; letter-spacing: .04em;
    text-transform: uppercase; user-select: text; -webkit-user-select: text;
}
.fr-add input::placeholder { text-transform: none; letter-spacing: 0; color: var(--dim); }
.fr-add input:focus { outline: none; border-color: rgba(255,45,70,.6); }
.fr-title { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fr-title i { font-style: normal; padding: 0 7px; border-radius: 8px; background: rgba(255,255,255,.08); color: var(--text); }
.fr-online { margin-left: auto; color: var(--mint); text-transform: none; letter-spacing: 0; font-weight: 600; }
.fr-row {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-bottom: 6px; border-radius: 12px;
    border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text); text-align: left; font: inherit;
}
button.fr-row { cursor: pointer; }
button.fr-row:hover { border-color: rgba(255,45,70,.45); }
.fr-muted { opacity: .75; }
.fr-av { width: 36px; height: 36px; flex: none; border-radius: 11px; object-fit: cover; background: #222; display: grid; place-items: center; font-weight: 700; color: var(--muted); }
.fr-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fr-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fr-name small { color: var(--muted); font-size: .74rem; display: flex; align-items: center; gap: 5px; }
.fr-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.fr-dot.menu { background: var(--mint); box-shadow: 0 0 6px var(--mint); }
.fr-dot.race { background: var(--gold); }
.fr-btns { display: flex; gap: 6px; flex: none; }
.fr-sm { padding: 6px 10px; font-size: .78rem; min-height: 0; }
.fr-empty { padding: 14px 10px; text-align: center; color: var(--muted); font-size: .84rem; line-height: 1.45; border: 1px dashed var(--line-strong); border-radius: 12px; }
.fr-blocked { margin-top: 12px; }
.fr-blocked summary { cursor: pointer; color: var(--muted); font-size: .8rem; margin-bottom: 6px; }
.fd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fd-head .fr-av { width: 52px; height: 52px; border-radius: 15px; font-size: 1.2rem; }
.fd-id { display: flex; flex-direction: column; min-width: 0; }
.fd-id b { font-size: 1.2rem; font-style: italic; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd-id small { color: var(--muted); font-size: .78rem; display: flex; align-items: center; gap: 5px; }
#fd-mode { margin: 8px 0 10px; }
.fd-track { margin-bottom: 10px; }
.fd-danger { display: flex; gap: 8px; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.fd-danger .btn { flex: 1; color: var(--muted); font-size: .8rem; }
.fd-danger .btn:hover { color: var(--red); }

/* ---------- Maps communautaires ---------- */
#cm-sort { margin-bottom: 10px; }
.cm-row { gap: 10px; }
.cm-rank { width: 22px; flex: none; text-align: center; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.cm-meta { display: flex; flex-direction: column; align-items: flex-end; flex: none; font-size: .8rem; font-weight: 700; }
.cm-meta small { color: var(--muted); font-weight: 400; font-size: .7rem; }
.cm-meta .liked { color: var(--red); }
.cm-create { margin-top: 10px; text-align: center; text-decoration: none; display: block; }
.cmap-preview { display: block; width: 100%; height: 150px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); margin-bottom: 10px; }
.cmap-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cmap-id { flex: 1; min-width: 0; }
.cmap-id h3 { display: none; } /* le titre est déjà dans l'en-tête de l'écran */
.cmap-id small { color: var(--muted); font-size: .9rem; }
.cmap-like {
    flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: var(--muted); font: inherit; font-weight: 700;
    transition: transform .12s, background .15s, color .15s, border-color .15s;
}
.cmap-like.on { color: #fff; background: rgba(255,45,70,.2); border-color: rgba(255,45,70,.7); }
.cmap-like:active { transform: scale(.94); }
#cmap-stats { margin-bottom: 10px; }
#cmap-play { margin-bottom: 4px; }
#cmap-lb { margin-top: 6px; }

/* Pseudo */
.username-card { text-align: center; max-width: 380px; }
.username-card h2 { margin: 6px 0 6px; font-size: 1.35rem; font-style: italic; text-transform: uppercase; }
.un-text { margin: 0 0 14px; color: var(--muted); font-size: .88rem; line-height: 1.45; }
.un-input {
    width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.05);
    color: var(--text); font: inherit; font-size: 1.15rem; font-weight: 700; text-align: center; user-select: text; -webkit-user-select: text;
}
.un-input:focus { outline: none; border-color: rgba(255,45,70,.65); }
.username-card .status-line { min-height: 18px; margin: 6px 0 10px; }
.un-note { margin: 12px 0 0; color: var(--dim); font-size: .74rem; }
.rename-btn { margin-top: 14px; }
.rename-note { margin: 6px 0 0; text-align: center; color: var(--muted); font-size: .76rem; }
.rename-btn + .rename-note + .logout-btn, .rename-btn[hidden] + .rename-note + .logout-btn { margin-top: 10px; }

/* Fenêtre de défi */
.challenge-card { text-align: center; max-width: 360px; }
.ch-kicker { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--red); }
.ch-who { display: flex; justify-content: center; margin: 12px 0 8px; }
.ch-who .fr-av { width: 64px; height: 64px; border-radius: 50%; font-size: 1.5rem; box-shadow: 0 0 0 3px rgba(255,45,70,.5); }
.challenge-card h2 { margin: 0 0 4px; font-size: 1.3rem; font-style: italic; text-transform: uppercase; }
.ch-info { margin: 0 0 12px; color: var(--muted); font-size: .9rem; line-height: 1.45; }
.ch-info small { color: var(--dim); font-size: .74rem; }
.ch-timer { height: 4px; border-radius: 2px; background: rgba(255,255,255,.08); overflow: hidden; margin-bottom: 14px; }
.ch-timer i { display: block; height: 100%; width: 100%; background: var(--red); transition: width 1s linear; }
.ch-actions { display: flex; gap: 8px; }
.ch-actions .btn { flex: 1; }
.home-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 74px;
    border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
    cursor: pointer; font-weight: 700; font-size: .8rem; transition: border-color .15s, background .15s;
}
.home-tile span { font-size: 1.45rem; line-height: 1; }
.home-tile:hover { border-color: rgba(255,45,70,.5); background: rgba(255,45,70,.08); }

/* Listes de sous-menus (Garage…) */
.menu-list { display: grid; gap: 8px; }
.menu-row {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 62px; padding: 10px 14px;
    border-radius: 14px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
    cursor: pointer; text-align: left; transition: border-color .15s, background .15s;
}
.menu-row:hover { border-color: rgba(255,45,70,.5); background: rgba(255,45,70,.06); }
.mr-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 1.25rem; }
.mr-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mr-txt b { font-size: 1rem; }
.mr-txt small { color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mr-go { color: var(--muted); font-size: 1.4rem; }
.logout-btn { margin-top: 14px; color: var(--muted); }
.logout-btn:hover { color: var(--red); }
button.profile-chip { font: inherit; color: inherit; cursor: pointer; text-align: left; padding-right: 10px; }
button.profile-chip:hover { border-color: rgba(255,45,70,.5); }
.tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    flex: none;
}
@media (max-width: 460px) {
    .tab { flex-direction: column; gap: 1px; min-height: 48px; font-size: .7rem; }
}

/* ---------- Profil ---------- */
.profile { display: grid; gap: 12px; }
.pf-head { display: flex; align-items: center; gap: 14px; }
.pf-level {
    --p: 0;
    flex: none; width: 64px; height: 64px; border-radius: 50%;
    display: grid; place-items: center; position: relative;
    background: conic-gradient(var(--red) calc(var(--p) * 1turn), rgba(255,255,255,.08) 0);
}
.pf-level::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #111119; }
.pf-level b { position: relative; font-size: 1.5rem; font-style: italic; line-height: 1; }
.pf-level small { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); font-size: .58rem; font-weight: 700; letter-spacing: .08em; padding: 1px 6px; border-radius: 6px; background: var(--red); color: #fff; }
.pf-id { min-width: 0; flex: 1; }
.pf-id h3 { margin: 0; font-size: 1.15rem; font-style: italic; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-id p { margin: 2px 0 6px; font-size: .75rem; color: var(--muted); }
.pf-xp { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.pf-xp i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), #ff7a45); border-radius: 3px; }
.pf-xp-label { margin-top: 3px; font-size: .7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pf-stat { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.04); border: 1px solid var(--line); min-width: 0; }
.pf-stat small { display: block; font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-stat b { display: block; margin-top: 2px; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.pf-stat em { font-style: normal; font-size: .72rem; color: var(--muted); margin-left: 4px; font-weight: 400; }
.pf-stat.accent b { color: var(--gold); }
.pf-title { margin: 4px 0 -2px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pf-records { display: grid; gap: 4px; }
.pf-records div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 9px; background: rgba(255,255,255,.03); font-size: .82rem; }
.pf-records b { color: var(--red); font-variant-numeric: tabular-nums; }
.pf-empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.pf-empty b { display: block; font-size: 2rem; margin-bottom: 6px; }
.tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 42px;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.03);
    color: var(--muted);
    font-weight: 700;
    font-size: .85rem;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.tab.active { background: rgba(255,45,70,.14); color: #fff; border-color: rgba(255,45,70,.55); }
.tab-ico { font-size: 1rem; }
.tab-panel {
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
    padding: 2px;
    scrollbar-width: none;
}

/* ---------- Sélecteur de circuit ---------- */
.track-picker { display: flex; align-items: stretch; gap: 6px; }
.nav-arrow {
    flex: none;
    width: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--muted);
}
.nav-arrow:hover { color: #fff; border-color: var(--line-strong); }
.track-card {
    flex: 1;
    min-width: 0;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(160deg, rgba(255,255,255,.05), rgba(255,255,255,.01));
    overflow: hidden;
    touch-action: pan-y;
}
#track-preview { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: radial-gradient(circle at 50% 40%, #151525, #0a0a12); }
#track-profile { display: block; width: 100%; height: 26px; background: rgba(0,0,0,.25); }
.track-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; }
.track-head h3 { margin: 0; font-size: 1.05rem; text-transform: uppercase; font-style: italic; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 4px 10px 10px; }
.track-stats div { display: flex; flex-direction: column; min-width: 0; }
.track-stats small { font-size: .6rem; color: var(--dim); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-stats b { font-size: .86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.track-dots { display: flex; justify-content: center; gap: 5px; margin: 8px 0 10px; flex-wrap: wrap; }
.track-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line-strong); transition: width .2s, background .2s; cursor: pointer; }
.track-dots i.active { width: 18px; background: var(--red); }

/* ---------- Modes de jeu ---------- */
.mode-grid { display: grid; gap: 8px; }
.mode-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
    text-align: left;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform .08s, border-color .15s, background .15s;
}
.mode-btn:active:not(:disabled) { transform: scale(.985); }
.mode-btn:disabled { opacity: .4; cursor: not-allowed; }
.mode-ico {
    flex: none;
    width: 38px; height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    background: rgba(255,255,255,.08);
}
.mode-txt { display: flex; flex-direction: column; min-width: 0; }
.mode-txt b { font-size: 1.02rem; text-transform: uppercase; letter-spacing: .03em; }
.mode-txt small { font-size: .75rem; color: var(--muted); }
.mode-solo { background: linear-gradient(135deg, rgba(255,45,70,.9), rgba(195,16,42,.9)); border-color: transparent; box-shadow: 0 8px 24px -10px var(--red); }
.mode-solo .mode-ico { background: rgba(0,0,0,.2); }
.mode-solo .mode-txt small { color: rgba(255,255,255,.8); }
.mode-duel .mode-ico { color: var(--blue); background: rgba(61,139,255,.14); }
.mode-duel:hover { border-color: rgba(61,139,255,.5); }
.mode-ranked .mode-ico { color: var(--gold); background: rgba(255,197,61,.14); }
.mode-ranked:hover { border-color: rgba(255,197,61,.5); }
.mode-more { margin-left: auto; font-size: 1.4rem; color: var(--muted); }
.mode-quick .mode-ico { color: var(--mint); background: rgba(46,230,166,.14); }
.mode-quick:hover { border-color: rgba(46,230,166,.5); }
.mode-community .mode-ico { color: #b44dff; background: rgba(180,77,255,.14); }
.mode-community:hover { border-color: rgba(180,77,255,.5); }
.mode-battle .mode-ico { color: #ff8a3d; background: rgba(255,138,61,.14); }
.mode-battle:hover { border-color: rgba(255,138,61,.5); }
.mode-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-pair .mode-btn { padding: 10px; gap: 9px; }
.mode-pair .mode-ico { width: 32px; height: 32px; font-size: 1rem; }
.mode-pair .mode-txt b { font-size: .92rem; }
.mode-pair .mode-txt small { font-size: .68rem; }
.mode-group-title { margin-top: 4px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; font-size: .8rem; }
.mode-group-title small { margin-left: 6px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.mode-rule { margin: -2px 0 0; font-size: .74rem; line-height: 1.35; color: var(--muted); }
.mode-rule b { color: var(--text); }
details.mode-rule summary { cursor: pointer; color: var(--muted); font-weight: 700; list-style: none; }
details.mode-rule summary::-webkit-details-marker { display: none; }
details.mode-rule summary::before { content: "ⓘ "; }
details.mode-rule[open] summary { margin-bottom: 4px; }
.menu-row-sm { min-height: 50px; padding: 6px 12px; }
.menu-row-sm .mr-ico { width: 34px; height: 34px; font-size: 1.05rem; }
.menu-row-sm .mr-txt b { font-style: italic; text-transform: uppercase; }
.menu-row-sm .mr-go { font-size: .78rem; font-weight: 700; color: var(--red); }
.mode-btn.is-queuing { border-color: var(--red); background: rgba(255,45,70,.12); }
.mode-btn.is-queuing .mode-ico { animation: spin 1s linear infinite; }

.admin-links { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.admin-links a {
    flex: 1;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    font-size: .8rem;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    border: 1px solid;
}
#editor-btn { color: var(--mint); border-color: rgba(46,230,166,.4); background: rgba(46,230,166,.06); }
#admin-panel-btn { color: var(--gold); border-color: rgba(255,197,61,.4); background: rgba(255,197,61,.06); }

/* ---------- Garage ---------- */
.car-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.car-tab {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 9px 11px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.03);
    cursor: pointer;
    text-align: left;
    transition: border-color .15s, background .15s;
}
.car-tab b { font-size: .95rem; font-style: italic; text-transform: uppercase; letter-spacing: .03em; }
.car-tab small { font-size: .68rem; color: var(--muted); }
.car-tab.selected { border-color: rgba(255,45,70,.7); background: rgba(255,45,70,.12); }
.car-tab .car-tag { position: absolute; top: 7px; right: 8px; font-size: .62rem; font-weight: 700; padding: 2px 6px; border-radius: 6px; }
/* Sélecteur de voiture ‹ NOM › */
.car-switch { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 8px; touch-action: pan-y; user-select: none; }
.car-switch .nav-arrow { height: 52px; }
.car-switch-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.car-switch-mid b { font-size: 1.5rem; font-style: italic; text-transform: uppercase; letter-spacing: .04em; line-height: 1; }
.car-switch-mid .car-tag { font-size: .66rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.car-tag.owned { background: rgba(255,255,255,.06); color: var(--muted); }
.car-dots { margin: 8px 0 12px; }
.car-dots i.locked:not(.active) { opacity: .45; }
.car-tag.equipped { background: var(--mint); color: #04140e; }
.car-tag.locked { background: rgba(255,255,255,.1); color: var(--muted); }
.car-tag.dev { background: rgba(61,139,255,.25); color: #9cc3ff; }
/* ---------- Garage : sous-onglets, inventaire, boutique ---------- */
.badge-mythic { background: rgba(255,45,70,.12); color: #ff5a6e; border-color: rgba(255,45,70,.4); }
.inv-head { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 0 8px; }
.inv-head b { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.inv-head small { color: var(--muted); font-size: .75rem; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; margin-bottom: 10px; }
.inv-item {
    position: relative; aspect-ratio: 1; border-radius: 11px; cursor: pointer;
    border: 2px solid var(--r); background: rgba(255,255,255,.03);
    display: grid; place-items: center; transition: transform .1s;
}
.inv-item i { width: 64%; height: 64%; border-radius: 50%; background: var(--c); box-shadow: inset 0 -6px 10px rgba(0,0,0,.35), 0 0 12px -4px var(--r); }
.inv-item.selected { box-shadow: 0 0 0 3px rgba(255,255,255,.85); }
.inv-item:active { transform: scale(.94); }
.inv-item.missing { border-color: rgba(255,255,255,.08); cursor: default; }
.inv-item.missing i { opacity: .35; box-shadow: none; }
.inv-item .q { position: absolute; font-weight: 700; color: var(--dim); }
.inv-item .check { position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: var(--mint); color: #04140e; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.inv-selected { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; font-size: .9rem; }
.inv-selected span { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.inv-item.rim i { width: 78%; height: 78%; background: center / cover no-repeat var(--img); image-rendering: pixelated; box-shadow: 0 0 12px -4px var(--r); }
.inv-item.rim.missing i { filter: grayscale(1) brightness(.5); }
.lt-rim { display: block; width: 70%; aspect-ratio: 1; margin: auto; border-radius: 50%; background: center / cover no-repeat var(--img); image-rendering: pixelated; }
.inv-empty { font-size: .78rem; color: var(--muted); padding: 12px; border-radius: 10px; border: 1px dashed var(--line-strong); text-align: center; }
.shop-balance { text-align: center; font-size: .8rem; color: var(--muted); margin-bottom: 10px; }
.shop-balance b { font-size: 1.3rem; color: var(--gold); font-variant-numeric: tabular-nums; margin: 0 4px; }
.shop-boxes { display: grid; gap: 10px; }
.dev-btn { margin: 8px 0; border-style: dashed; color: var(--gold); font-size: .8rem; }
.box-card { padding: 12px; border-radius: 14px; border: 1px solid var(--line-strong); background: linear-gradient(160deg, rgba(255,197,61,.08), rgba(255,255,255,.02)); }
.box-legende { background: linear-gradient(160deg, rgba(180,77,255,.16), rgba(255,45,70,.06)); border-color: rgba(180,77,255,.4); }
.box-top { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.box-ico { font-size: 1.8rem; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: rgba(0,0,0,.25); }
.box-top h4 { margin: 0; font-style: italic; text-transform: uppercase; }
.box-top small { color: var(--muted); font-size: .72rem; }
.odds { display: grid; gap: 3px; margin-bottom: 10px; }
.odd { display: grid; grid-template-columns: 10px 1fr auto; gap: 7px; align-items: center; font-size: .74rem; }
.odd i { width: 10px; height: 10px; border-radius: 3px; }
.odd b { font-variant-numeric: tabular-nums; }
.shop-note { font-size: .72rem; color: var(--muted); text-align: center; margin: 10px 0 0; line-height: 1.4; }

/* ---------- Passage de niveau ---------- */
.levelup-overlay {
    position: fixed; inset: 0; z-index: 380; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 50% 45%, rgba(60,10,20,.85), rgba(4,4,8,.94) 70%);
    animation: miFade .3s ease-out;
}
.lu-card { position: relative; text-align: center; }
.lu-card::before {
    content: ""; position: absolute; left: 50%; top: 46%; width: 460px; height: 460px; margin: -230px 0 0 -230px; z-index: -1; pointer-events: none;
    background: repeating-conic-gradient(rgba(255,45,70,.28) 0 7deg, transparent 7deg 22deg);
    -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 66%); mask-image: radial-gradient(circle, #000 18%, transparent 66%);
    animation: lootRays 14s linear infinite;
}
.lu-card small { color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: .2em; font-size: .85rem; animation: luIn .5s .1s both; }
.lu-level { position: relative; height: 150px; margin: 6px 0 4px; display: grid; place-items: center; }
.lu-level span, .lu-level b { position: absolute; font-style: italic; font-weight: 700; line-height: 1; }
.lu-level span { font-size: 5rem; color: var(--muted); animation: luOut .6s .5s forwards; }
.lu-level b { font-size: 8.5rem; color: #fff; text-shadow: 0 0 30px var(--red), 0 6px 0 rgba(0,0,0,.5); opacity: 0; animation: luPop .7s .9s cubic-bezier(.2,1.7,.4,1) forwards; }
.lu-card p { margin: 6px 0 18px; min-height: 1.2em; color: var(--text); font-weight: 700; animation: luIn .5s 1.3s both; }
.lu-card .btn { min-width: 160px; animation: luIn .5s 1.5s both; }
@keyframes luOut { to { transform: translateY(-70px) scale(.6); opacity: 0; } }
@keyframes luPop { from { transform: scale(2.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes luIn { from { transform: translateY(12px); opacity: 0; } }
.box-card.locked { opacity: .75; }
.box-lock { font-size: .75rem; color: var(--gold); font-weight: 700; margin: -4px 0 8px; }

/* ---------- Ouverture de caisse ---------- */
.loot-overlay {
    --rc: #9aa4b2;
    position: fixed; inset: 0; z-index: 360; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 50% 50%, rgba(30,20,40,.92), rgba(4,4,8,.97) 70%);
}
.loot-stage { width: min(760px, 100%); text-align: center; }
.loot-stage > small { color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; }
.loot-stage h2 { margin: 4px 0 18px; font-style: italic; text-transform: uppercase; font-size: clamp(1.4rem, 5vw, 2rem); }
.loot-reel-wrap {
    position: relative; height: 128px; overflow: hidden; border-radius: 14px;
    border: 1px solid var(--line-strong); background: rgba(0,0,0,.35);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.loot-reel { position: absolute; left: 0; top: 9px; display: flex; gap: 8px; will-change: transform; }
.loot-marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: var(--gold); box-shadow: 0 0 12px var(--gold); }
.loot-tile {
    flex: none; width: 110px; height: 110px; border-radius: 12px; display: grid; place-items: center; align-content: center; gap: 4px;
    background: linear-gradient(180deg, rgba(255,255,255,.04), color-mix(in srgb, var(--r) 28%, transparent));
    border: 1px solid color-mix(in srgb, var(--r) 60%, transparent); border-bottom: 4px solid var(--r);
}
.loot-tile .lt-paint { width: 56px; height: 56px; border-radius: 50%; background: var(--c); box-shadow: inset 0 -8px 14px rgba(0,0,0,.35); }
.loot-tile .lt-car { font-size: 2.2rem; line-height: 1; }
.loot-tile small { font-weight: 700; font-size: .8rem; }
.loot-tile.big { width: 150px; height: 150px; margin: 0 auto; }
.loot-tile.big .lt-paint { width: 84px; height: 84px; }
.loot-tile.big .lt-car { font-size: 3.4rem; }
.loot-result { margin-top: 18px; animation: lootPop .5s cubic-bezier(.2,1.6,.4,1); }
.loot-card { position: relative; }
.loot-name { margin-top: 12px; font-size: 1.4rem; font-weight: 700; font-style: italic; text-transform: uppercase; color: var(--rc); }
.loot-sub { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.loot-sub b { color: var(--gold); }
.loot-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.loot-actions .btn { min-width: 120px; }
.loot-skip { margin-top: 14px; padding: 6px 12px; background: none; border: 0; color: var(--muted); font: inherit; font-size: .8rem; cursor: pointer; }
.loot-skip:hover { color: #fff; }
.loot-overlay.reveal { animation: lootFlash .7s ease-out; }
.loot-overlay.reveal .loot-card::before {
    content: ""; position: absolute; left: 50%; top: 75px; width: 320px; height: 320px; margin: -160px 0 0 -160px; border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--rc) 55%, transparent), transparent 65%);
    animation: lootGlow 2.4s ease-in-out infinite alternate; pointer-events: none; z-index: -1;
}
.loot-overlay.r-legendaire .loot-card::after, .loot-overlay.r-mythique .loot-card::after {
    content: ""; position: absolute; left: 50%; top: 75px; width: 420px; height: 420px; margin: -210px 0 0 -210px; pointer-events: none; z-index: -1;
    background: repeating-conic-gradient(color-mix(in srgb, var(--rc) 35%, transparent) 0 8deg, transparent 8deg 24deg);
    -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 68%); mask-image: radial-gradient(circle, #000 20%, transparent 68%);
    animation: lootRays 12s linear infinite;
}
@keyframes lootPop { from { transform: scale(.6); opacity: 0; } }
@keyframes lootFlash { 0% { box-shadow: inset 0 0 0 100vmax color-mix(in srgb, var(--rc) 55%, transparent); } 100% { box-shadow: inset 0 0 0 100vmax transparent; } }
@keyframes lootGlow { from { transform: scale(.9); opacity: .7; } to { transform: scale(1.08); opacity: 1; } }
@keyframes lootRays { to { transform: rotate(360deg); } }

.livery-note { font-size: .8rem; color: var(--muted); text-align: center; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.03); margin-top: 12px; }
.current-car {
    display: flex; align-items: center; gap: 8px; width: 100%;
    margin-top: 10px; padding: 10px 12px;
    border-radius: 12px; border: 1px dashed var(--line-strong);
    background: transparent; cursor: pointer; font-size: .85rem;
}
.current-car .cc-label { color: var(--dim); text-transform: uppercase; font-size: .68rem; letter-spacing: .1em; }
.current-car b { font-style: italic; text-transform: uppercase; }
.current-car .cc-change { margin-left: auto; color: var(--red); font-weight: 700; font-size: .78rem; }
.car-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.car-head h3 { margin: 0; font-size: 1.1rem; font-style: italic; text-transform: uppercase; }
.car-head small { color: var(--muted); font-size: .75rem; }
.car-stats { display: grid; gap: 6px; margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: 76px 1fr 86px; align-items: center; gap: 10px; font-size: .78rem; }
.stat-row span { color: var(--muted); }
.stat-row b { text-align: right; font-variant-numeric: tabular-nums; }
.stat-row i { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); position: relative; overflow: hidden; }
.stat-row i::after { content: ""; position: absolute; inset: 0; width: calc(var(--v) * 100%); background: linear-gradient(90deg, var(--red), #ff7a45); border-radius: 3px; }
.section-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); margin-bottom: 8px; }
.skin-swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.skin-swatch {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 2px solid var(--line-strong);
    cursor: pointer;
    position: relative;
    padding: 0;
    background: var(--c);
    box-shadow: inset 0 -10px 18px rgba(0,0,0,.35), inset 0 6px 10px rgba(255,255,255,.25);
    transition: transform .1s, border-color .15s;
}
.skin-swatch:active { transform: scale(.94); }
.skin-swatch.selected { border-color: #fff; box-shadow: 0 0 0 3px rgba(255,45,70,.6), inset 0 -10px 18px rgba(0,0,0,.35); }
.skin-swatch .lock, .skin-swatch .check {
    position: absolute;
    right: -5px; top: -5px;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: .62rem;
    background: #1b1b28;
    border: 1px solid var(--line-strong);
}
.skin-swatch .check { background: var(--mint); color: #04140e; border: 0; font-weight: 700; }
.skin-name { text-align: center; margin: 10px 0; font-size: .9rem; color: var(--muted); }
.skin-name b { color: var(--text); }

/* ---------- Classement ---------- */
.rank-switch { display: flex; align-items: stretch; gap: 8px; margin-bottom: 8px; }
.rank-switch .nav-arrow { width: 40px; min-height: 48px; }
.rank-switch-mid {
    flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px 8px;
    border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.03);
}
.rank-switch-mid b { font-size: 1.05rem; font-style: italic; text-transform: uppercase; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-switch-mid small { color: var(--muted); font-size: .72rem; }
.ranking-hint { color: var(--dim); font-size: .74rem; }
.ranking-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ranking-head h3 { margin: 0; font-style: italic; text-transform: uppercase; font-size: 1rem; }
.leaderboard { display: grid; gap: 4px; }
.lb-row {
    display: grid;
    grid-template-columns: 34px 30px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid transparent;
}
.lb-row.me { border-color: rgba(255,45,70,.5); background: rgba(255,45,70,.08); }
.lb-rank { font-weight: 700; font-size: 1rem; color: var(--dim); text-align: center; }
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-row:nth-child(2) .lb-rank { color: #d6d9e0; }
.lb-row:nth-child(3) .lb-rank { color: #d08a4c; }
.lb-avatar { width: 28px; height: 28px; border-radius: 8px; background: #22222e; object-fit: cover; display: grid; place-items: center; font-size: .75rem; color: var(--muted); }
.lb-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-car { font-size: .62rem; font-weight: 700; color: var(--gold); border: 1px solid rgba(255,197,61,.4); border-radius: 5px; padding: 0 4px; margin-left: 4px; }
.lb-time { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--red); }
.lb-empty { text-align: center; padding: 22px 8px; color: var(--dim); }

/* =====================================================================
   MODALES
   ===================================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
    background: rgba(3,3,8,.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fadeIn .2s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal-card {
    width: min(400px, 100%);
    max-height: 100%;
    overflow-y: auto;
    touch-action: pan-y;
    background: var(--panel-solid);
    border: 1px solid var(--line-strong);
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 30px 80px -20px #000;
    animation: panelIn .28s ease-out;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-style: italic; text-transform: uppercase; font-size: 1.3rem; }
#settings-modal { z-index: 180; }

.settings-section { margin-bottom: 14px; }
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field select {
    width: 100%;
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: #181824;
    color: var(--text);
    font-family: inherit;
    font-size: .92rem;
    font-weight: 600;
    outline: none;
}
.field select:focus { border-color: var(--red); }
.field input[type=range] { width: 100%; accent-color: var(--red); height: 28px; }
.field-hint { font-style: normal; font-weight: 500; color: var(--dim); margin-left: 4px; }
.field-note { font-size: .72rem; color: var(--dim); margin: 4px 0 0; }
.set-group { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.set-group::after { content: ''; flex: 1; height: 1px; background: var(--line-strong); }
.settings-section > .set-group:first-child { margin-top: 4px; }
.settings-section .field-note { margin: -6px 0 12px; }
.ctrl-ref > summary { cursor: pointer; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 0; }
.donate-section { margin-top: 18px; padding-top: 4px; border-top: 1px solid var(--line-strong); }
.toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i {
    flex: none;
    width: 44px; height: 26px;
    border-radius: 13px;
    background: #2a2a38;
    position: relative;
    transition: background .2s;
}
.toggle i::after {
    content: "";
    position: absolute;
    top: 3px; left: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform .2s;
}
.toggle input:checked + i { background: var(--red); }
.toggle input:checked + i::after { transform: translateX(18px); }

/* Paramètres › À propos */
.about-section { text-align: center; }
.about-brand { font-size: 1.4rem; font-weight: 700; font-style: italic; text-transform: uppercase; letter-spacing: .03em; margin: 2px 0 10px; }
.about-brand b { color: var(--red); margin-left: 3px; }
.about-brand .brand-ver { font-style: normal; vertical-align: middle; margin-left: 6px; }
.about-section p { font-size: .88rem; color: var(--text); line-height: 1.55; margin: 0 0 10px; }
.about-section p strong { color: var(--gold); }
.about-section .field-note { color: var(--muted); }
.about-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 4px; font-size: .82rem; }
.about-links a { color: var(--muted); text-decoration: none; }
.about-links a:hover { color: var(--text); }
.donate-section { text-align: center; }
.donate-section h3 { margin: 0 0 6px; color: var(--gold); }
.donate-section p { font-size: .82rem; color: var(--muted); margin: 0 0 10px; }
.donate-widget iframe { width: 100%; height: 112px; border: 0; display: block; }
.donate-section .btn { margin-top: 8px; }

.pause-card { text-align: center; width: min(320px, 100%); }
.pause-card h2 { margin: 0 0 16px; font-size: 2rem; font-style: italic; text-transform: uppercase; }

.result-card { text-align: center; }
.result-kicker { font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.result-title { margin: 4px 0 6px; font-size: 2.4rem; font-style: italic; text-transform: uppercase; line-height: 1; }
.result-title.win { color: var(--gold); text-shadow: 0 0 30px rgba(255,197,61,.4); }
.result-title.lose { color: var(--red); }
.result-time { font-size: 2.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-badge { display: inline-block; margin: 6px 0 2px; padding: 4px 12px; border-radius: 999px; background: rgba(46,230,166,.15); color: var(--mint); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; animation: pop .4s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } }
.result-rows { margin: 14px 0 16px; display: grid; gap: 6px; }
.result-rows div { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,.04); font-size: .9rem; }
.result-rows span { color: var(--muted); }
.result-rows b { font-variant-numeric: tabular-nums; }
.result-rows .pos { color: var(--mint); }
.result-rows .neg { color: var(--red); }

/* ---------- Chargement ---------- */
/* Tout ce qui bouge n'utilise que transform / opacity : l'animation continue même quand le fil principal est bloqué par la génération de la piste */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 85%, #1a070b 0%, #0a0507 45%, var(--bg) 80%);
}
#loading-screen.show { display: flex; animation: ldIn .35s ease-out; }
@keyframes ldIn { from { opacity: 0; } to { opacity: 1; } }
.ld-glow { position: absolute; left: 50%; bottom: 22%; width: 120vmax; height: 40vmax; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(227,19,47,.28), transparent 70%); animation: ldPulse 2.6s ease-in-out infinite; }
@keyframes ldPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
/* route en perspective, bandes qui défilent vers le joueur */
.ld-road { position: absolute; left: 0; right: 0; bottom: 0; height: 58%; perspective: 520px; perspective-origin: 50% 0%; -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 55%); mask-image: linear-gradient(to bottom, transparent 0%, #000 55%); }
.ld-plane { position: absolute; left: 50%; top: 0; width: 38vmax; height: 200%; margin-left: -19vmax; transform-origin: 50% 0; transform: rotateX(74deg); background: linear-gradient(90deg, transparent 0, transparent 14%, rgba(255,255,255,.07) 14%, rgba(255,255,255,.07) 86%, transparent 86%); overflow: hidden; }
.ld-plane::before, .ld-plane::after { content: ""; position: absolute; top: 0; bottom: 0; width: 1.8%; background: linear-gradient(to bottom, transparent, var(--red) 30%); box-shadow: 0 0 18px 2px var(--red-glow); }
.ld-plane::before { left: 14%; }
.ld-plane::after { right: 14%; }
.ld-dashes { position: absolute; left: 49%; width: 2%; top: -120px; bottom: 0; background: repeating-linear-gradient(to bottom, #ffd24a 0 60px, transparent 60px 120px); animation: ldRoad .55s linear infinite; }
@keyframes ldRoad { from { transform: translateY(0); } to { transform: translateY(120px); } }
/* traînées de vitesse */
.ld-streaks i { position: absolute; top: -20%; width: 2px; height: 22%; background: linear-gradient(to bottom, transparent, rgba(255,255,255,.55), transparent); opacity: 0; animation: ldStreak 1.1s linear infinite; }
.ld-streaks i:nth-child(1) { left: 12%; animation-delay: .0s; }
.ld-streaks i:nth-child(2) { left: 27%; animation-delay: .45s; height: 30%; }
.ld-streaks i:nth-child(3) { left: 41%; animation-delay: .8s; }
.ld-streaks i:nth-child(4) { left: 63%; animation-delay: .2s; height: 26%; }
.ld-streaks i:nth-child(5) { left: 78%; animation-delay: .65s; }
.ld-streaks i:nth-child(6) { left: 90%; animation-delay: .95s; height: 18%; }
@keyframes ldStreak { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: .8; } 100% { transform: translateY(520%); opacity: 0; } }
.ld-center { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 0 24px; text-align: center; margin-top: -8vh; }
.ld-brand { font-weight: 700; font-style: italic; letter-spacing: .32em; font-size: .85rem; color: var(--muted); text-transform: uppercase; }
.ld-brand b { color: var(--red); margin-left: 2px; text-shadow: 0 0 14px var(--red-glow); }
.ld-map { font-weight: 700; font-style: italic; text-transform: uppercase; letter-spacing: .06em; font-size: clamp(1.9rem, 7vw, 3.6rem); line-height: 1.05; color: #fff; text-shadow: 0 4px 30px rgba(0,0,0,.8), 0 0 40px var(--red-glow); max-width: 90vw; animation: ldRise .5s ease-out both; }
.ld-map:empty { display: none; }
@keyframes ldRise { from { opacity: 0; transform: translateY(10px) skewX(-6deg); } to { opacity: 1; transform: none; } }
#loading-screen h2 { margin: 6px 0 0; font-style: italic; text-transform: uppercase; letter-spacing: .16em; font-size: .85rem; font-weight: 600; color: var(--muted); }
.ld-bar { position: relative; width: min(280px, 70vw); height: 4px; border-radius: 2px; background: rgba(255,255,255,.09); overflow: hidden; }
.ld-bar i { position: absolute; left: 0; top: 0; width: 45%; height: 100%; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--red) 60%, #ff6a7d); box-shadow: 0 0 12px var(--red-glow); animation: road .95s ease-in-out infinite; }
@keyframes road { from { transform: translateX(-100%); } to { transform: translateX(240%); } }
.ld-tip { margin: 10px 0 0; max-width: min(420px, 86vw); font-size: .8rem; line-height: 1.45; color: rgba(255,255,255,.55); min-height: 2.9em; }
.ld-tip b { color: var(--red); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: .68rem; display: block; margin-bottom: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ld-dashes, .ld-streaks i, .ld-glow { animation: none; } }
/* Mode expérimental (TEST) : liseré orange pour qu'on ne le confonde pas avec un mode stable */
.mode-exp { border-left: 3px solid #f5a524; }
.mode-exp .mode-ico { color: #f5a524; background: rgba(245,165,36,.14); }
.mode-group-title .tag-test { margin-left: 4px; }
/* Étiquette des réglages expérimentaux */
.tag-test { font-style: normal; margin-left: 6px; padding: 1px 6px; border-radius: 4px; border: 1px solid #f5a524; color: #f5a524; font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; white-space: nowrap; }

/* ---------- Toasts ---------- */
#toast-stack {
    position: fixed;
    top: calc(12px + var(--safe-t));
    left: 50%;
    transform: translateX(-50%);
    z-index: 400;
    display: grid;
    gap: 6px;
    pointer-events: none;
    width: min(92vw, 380px);
}
.toast {
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(16,16,26,.95);
    border: 1px solid var(--line-strong);
    font-size: .88rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 10px 30px -10px #000;
    animation: toastIn .25s ease-out;
}
.toast.error { border-color: rgba(255,45,70,.6); }
.toast.ok { border-color: rgba(46,230,166,.6); }
.toast.warn { border-color: rgba(255,197,61,.6); }
.toast.out { opacity: 0; transform: translateY(-6px); transition: opacity .3s, transform .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

/* =====================================================================
   HUD EN COURSE
   ===================================================================== */
.hud {
    position: fixed;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    display: none;
    padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
    text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
body.in-race .hud { display: block; }

.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.hud-card {
    background: rgba(8,8,14,.55);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 14px;
    padding: 8px 12px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.hud-row { display: flex; align-items: center; gap: 12px; }
.hud-pos { font-size: 2.2rem; font-weight: 700; font-style: italic; line-height: 1; color: var(--gold); }
.hud-pos sup { font-size: .9rem; }
.hud-pos.second { color: #c9ccd6; }
.hud-time { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.hud-delta { font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 1em; color: var(--muted); }
.hud-names { display: flex; gap: 8px; font-size: .72rem; color: var(--muted); margin-top: 2px; white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.hud-opp { color: var(--red); }

.hud-top-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hud-btn {
    pointer-events: auto;
    width: 46px; height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.25);
    background: rgba(8,8,14,.55);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.minimap {
    position: relative;
    width: 116px;
    height: 116px;
    border-radius: 14px;
    background: rgba(8,8,14,.5);
    border: 1px solid rgba(255,255,255,.1);
    overflow: hidden;
}
.minimap canvas { width: 100%; height: 100%; display: block; }
.mm-dot {
    position: absolute;
    left: 0; top: 0;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    border: 2px solid #fff;
    will-change: transform;
}
.mm-me { background: var(--red); box-shadow: 0 0 8px var(--red); z-index: 2; }
.mm-opp { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.hud-ping { font-size: .7rem; color: var(--mint); }
.hud-ping.warn { color: var(--gold); }
.hud-ping.bad { color: var(--red); }

.hud-alerts {
    position: absolute;
    top: 26%;
    left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.hud-alert {
    font-weight: 700;
    font-style: italic;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: 1.15rem;
    padding: 4px 14px;
    border-radius: 999px;
    opacity: 0;
    transform: scale(.9);
    transition: opacity .15s, transform .15s;
}
.hud-alert.on { opacity: 1; transform: scale(1); }
.alert-slip { color: #7ff3ff; background: rgba(0,200,255,.12); text-shadow: 0 0 12px #00d9ff; }
.alert-gutter { color: var(--gold); background: rgba(255,140,0,.14); text-shadow: 0 0 14px #ff7700; }
.alert-gutter.hint { font-size: .95rem; color: #fff; background: rgba(255,197,61,.18); border: 1px solid rgba(255,197,61,.5); animation: gutterPulse .6s ease-in-out infinite alternate; }
@keyframes gutterPulse { to { background: rgba(255,197,61,.32); } }

.hud-bottom {
    position: absolute;
    left: 0; right: 0;
    bottom: calc(14px + var(--safe-b));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.perfect-text {
    font-size: 1.5rem;
    font-weight: 700;
    font-style: italic;
    text-transform: uppercase;
    color: var(--mint);
    text-shadow: 0 0 16px var(--mint), 0 2px 0 #000;
    opacity: 0;
    transform: scale(.85);
    transition: opacity .15s, transform .15s;
}
.perfect-text.on { opacity: 1; transform: scale(1.05); }
.cluster { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(340px, 78vw); }
.drift-meter {
    position: relative;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(0,0,0,.5);
    border: 1px solid rgba(255,255,255,.2);
    overflow: hidden;
}
.drift-meter i {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #ffaa00, var(--mint));
    transform-origin: left center;
    transform: scaleX(0);
    will-change: transform;
}
.drift-meter span { display: none; }
.drift-meter.hot i { background: var(--mint); box-shadow: 0 0 12px var(--mint); }
/* La jauge d'angle (js/ui/driftui.js) et le flash « DRIFT PARFAIT » remplacent l'ancienne barre de drift du bas */
.drift-meter, .perfect-text { display: none; }
.gauge {
    width: 100%;
    background: rgba(8,8,14,.6);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px;
    padding: 8px 14px 8px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.rpm-track { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.rpm-track i {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #3d8bff 0%, var(--mint) 55%, var(--gold) 80%, var(--red) 95%);
    transform-origin: left center;
    transform: scaleX(0);
    will-change: transform;
}
.rpm-track .redline { position: absolute; top: 0; bottom: 0; left: 92%; width: 2px; background: var(--red); }
.gauge.limiter .rpm-track { box-shadow: 0 0 10px var(--red); }
.gauge-main { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 2px; }
.speed { display: flex; align-items: baseline; gap: 6px; }
.speed span { font-size: 2.5rem; font-weight: 700; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums; min-width: 2.2ch; text-align: right; }
.speed small { font-size: .78rem; color: var(--muted); }
.gear-box { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.gear-box small { font-size: .56rem; letter-spacing: .15em; color: var(--muted); }
.gear-box span { font-size: 2rem; font-weight: 700; color: var(--red); font-style: italic; }
.controls-hint {
    position: absolute;
    left: 0; right: 0;
    bottom: calc(150px + var(--safe-b));
    text-align: center;
    font-size: .8rem;
    color: rgba(255,255,255,.7);
    transition: opacity .6s;
}
.controls-hint.fade { opacity: 0; }

#countdown-ui {
    position: fixed;
    top: 34%;
    left: 50%;
    z-index: 60;
    transform: translate(-50%, -50%);
    font-size: clamp(5rem, 24vw, 10rem);
    font-weight: 700;
    font-style: italic;
    color: var(--gold);
    text-shadow: 0 6px 0 rgba(0,0,0,.5), 0 0 40px rgba(255,197,61,.5);
    pointer-events: none;
    display: none;
    white-space: nowrap;
}
#countdown-ui.show { display: block; }
#countdown-ui.tick { animation: countPop .45s cubic-bezier(.2,1.6,.4,1); }
#countdown-ui.go { color: var(--mint); text-shadow: 0 6px 0 rgba(0,0,0,.5), 0 0 50px rgba(46,230,166,.6); }
#countdown-ui.small { font-size: clamp(1.4rem, 6vw, 2.2rem); color: #fff; white-space: normal; width: min(92vw, 620px); text-align: center; line-height: 1.15; }
@keyframes countPop { from { transform: translate(-50%, -50%) scale(1.8); opacity: 0; } }

/* Rétroviseur intérieur (render/mirror.js) : ce cadre donne le contour ; l'image est dessinée dans le canvas principal à cet endroit.
   En haut au centre (sous la rangée du chrono sur petit écran) ; le bandeau du mode Battle se décale dessous quand il est affiché. */
:root { --mirror-w: clamp(170px, 34vw, 400px); --mirror-top: calc(var(--safe-t) + 10px); }
.mirror-ui {
    position: fixed; z-index: 21; top: var(--mirror-top); left: 50%; transform: translateX(-50%);
    width: var(--mirror-w); aspect-ratio: 4.2 / 1; box-sizing: border-box;
    border: 3px solid #0d0d12; border-radius: 6px; pointer-events: none;
    box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 6px 18px rgba(0,0,0,.55), inset 0 0 12px rgba(0,0,0,.6);
}
.mirror-ui[hidden], body:not(.in-race) .mirror-ui { display: none; }
body.mirror-on .battle-ui { top: calc(var(--mirror-top) + var(--mirror-w) / 4.2 + 14px); }
@media (max-width: 700px) {
    :root { --mirror-w: clamp(136px, 36vw, 240px); --mirror-top: calc(var(--safe-t) + 92px); }   /* sous le chrono, entre le chrono et la mini-carte */
}
/* Battle : bandeau manche / rôle / écart (50 m = victoire du meneur) */
.battle-ui {
    position: fixed; top: calc(var(--safe-t) + 10px); left: 50%; transform: translateX(-50%);
    z-index: 55; width: min(260px, 52vw); padding: 7px 10px 6px; border-radius: 12px;
    background: rgba(8,8,14,.72); border: 1px solid var(--line-strong); backdrop-filter: blur(6px);
    pointer-events: none; text-align: center;
}
.bt-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.bt-head b { color: var(--gold); font-size: .78rem; }
.battle-ui.chaser .bt-head b { color: #ff8a3d; }
.bt-bar { position: relative; height: 6px; margin: 6px 0 3px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.bt-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, var(--mint), var(--gold)); transition: width .15s linear; }
.bt-bar i.bad { background: var(--red); }
.bt-gap { font-weight: 700; font-variant-numeric: tabular-nums; font-size: .9rem; }
@media (max-width: 700px) { .battle-ui { top: calc(var(--safe-t) + 78px); } }

/* Adversaire trouvé */
.match-intro {
    position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 50% 45%, #1f0a12, #05060a 72%);   /* OPAQUE : le menu et l'écran de chargement ne doivent plus transparaître */
    animation: miFade .25s ease-out;
}
.mi-card { text-align: center; max-width: 420px; width: 100%; }
.mi-card small { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; }
.mi-card h2 { margin: 6px 0 18px; font-size: clamp(1.6rem, 7vw, 2.4rem); font-style: italic; text-transform: uppercase; }
.mi-vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.mi-vs b { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mi-vs b:first-child { text-align: right; }
.mi-vs b:last-child { text-align: left; color: var(--blue); }
.mi-vs span { font-weight: 700; font-style: italic; color: var(--gold); font-size: 1.4rem; }
.mi-card p { margin: 14px 0 22px; color: var(--muted); }
.mi-card p b { color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.mi-count { color: var(--muted); font-size: .9rem; }
.mi-count b { display: block; margin-top: 4px; font-size: 3.6rem; font-style: italic; color: var(--gold); line-height: 1; }
@keyframes miFade { from { opacity: 0; } }

#manga-speed-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 5;
    display: none;
}

/* Joystick fantôme tactile */
#touch-indicator {
    position: fixed;
    left: 0; top: 0;
    width: 110px; height: 110px;
    margin: -55px 0 0 -55px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.28);
    background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
    pointer-events: none;
    z-index: 15;
    opacity: 0;
    transition: opacity .15s;
}
#touch-indicator.on { opacity: 1; }
#touch-indicator i {
    position: absolute;
    left: 50%; top: 50%;
    width: 44px; height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    background: rgba(255,45,70,.75);
    box-shadow: 0 0 16px rgba(255,45,70,.6);
    will-change: transform;
}

/* =====================================================================
   RESPONSIVE
   ===================================================================== */

/* Téléphone portrait : le hub est une "bottom sheet" */
@media (max-width: 899px) and (orientation: portrait) {
    #main-menu { grid-template-rows: auto minmax(22vh, 1fr) minmax(0, auto) auto; }
    .hub { max-height: 66vh; }
    .hub-panel, .login-panel { max-height: 100%; }
    .hub-panel { border-radius: 20px 20px 16px 16px; }
    #track-preview { aspect-ratio: 2 / 1; }
}

/* Petits écrans : logo + profil + réglages sur la 1re ligne, joueurs en ligne + heure du jeu sur la 2e */
@media (max-width: 699px) {
    .topbar { flex-wrap: wrap; row-gap: 6px; }
    .topbar-status { order: 3; width: 100%; justify-content: space-between; }
    .topbar-right { margin-left: auto; }
    .brand-ver { padding: 2px 5px; }
    /* Barre du haut allégée : l'ELO est dans le Profil, les pastilles sont plus fines */
    .stat-elo { display: none; }
    .online-pill, .game-clock { font-size: .72rem; padding-top: 3px; padding-bottom: 4px; }
    .game-clock b { font-size: .84rem; }
}

@media (max-width: 380px) {
    .brand-name { font-size: 1.15rem; }
    .profile-name { max-width: 80px; }
    .track-stats b { font-size: .78rem; }
    .tab span:not(.tab-ico) { font-size: .78rem; }
}

/* Paysage bas (téléphone couché) et desktop : hub à gauche, showroom à droite */
@media (min-width: 900px), (orientation: landscape) and (max-height: 600px) {
    #main-menu {
        grid-template-columns: minmax(300px, 420px) 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas: "top top" "hub show" "legal show";
        column-gap: 16px;
    }
    .hub { max-height: 100%; }
    .hub-panel, .login-panel { max-height: 100%; }
    .hub-panel { flex: 1; }
    .legal { text-align: left; }
}
@media (min-width: 900px) {
    #main-menu { padding: calc(18px + var(--safe-t)) 28px 14px; row-gap: 14px; }
    .brand-name { font-size: 1.9rem; }
    .hub { padding-bottom: 0; }
    .showroom-caption { bottom: 18px; }
    .showroom-caption span { font-size: 1.3rem; }
    .panel { padding: 16px; }
    .hud-time { font-size: 1.9rem; }
    .minimap { width: 150px; height: 150px; }
    .cluster { width: 380px; }
    .speed span { font-size: 3rem; }
    #touch-indicator { display: none; }
}
@media (orientation: landscape) and (max-height: 600px) {
    #main-menu { padding-top: calc(6px + var(--safe-t)); row-gap: 6px; }
    .hub-panel { padding: 8px; }
    .tabs { margin-bottom: 6px; }
    .tab { min-height: 36px; }
    #track-preview { aspect-ratio: 21 / 9; }
    .mode-btn { min-height: 48px; padding: 6px 12px; }
    .mode-ico { width: 32px; height: 32px; }
    .hero-title { font-size: 1.6rem; }
    .login-panel { padding: 12px; overflow-y: auto; }
    .hero-sub { margin-bottom: 10px; }
    /* HUD compact */
    .minimap { width: 92px; height: 92px; }
    .cluster { width: min(300px, 44vw); }
    .speed span { font-size: 2rem; }
    .gear-box span { font-size: 1.6rem; }
    .hud-time { font-size: 1.3rem; }
    .controls-hint { bottom: calc(110px + var(--safe-b)); }
    .hud-alerts { top: 20%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* iPhone en PWA (écran d'accueil) : les calques plein écran descendent jusqu'en bas de l'écran,
   sous l'indicateur d'accueil (--app-h = vraie hauteur mesurée par js/viewport.js) */
@media (display-mode: standalone) {
    html, body { height: var(--app-h, 100vh); }
    #game-container, #main-menu, #manga-speed-canvas, #loading-screen, .hud, .modal,
    .levelup-overlay, .loot-overlay, .match-intro {
        top: 0; bottom: auto; height: var(--app-h, 100vh);
    }
}

/* =====================================================================
   V5.1 — GAME UI : interface de jeu (noir · rouge · gris clair)
   Formes biseautées, listes de menu façon console, accents rouges, plus de "cartes" de site web.
   Cette couche ne touche qu'à l'apparence (la mise en page responsive reste celle du dessus).
   ===================================================================== */
html, body { background: var(--bg); }
::selection { background: var(--red); color: #fff; }

/* Biseaux réutilisables */
.btn, .home-play, .mode-btn, .menu-row, .home-tile, .track-card, .panel, .modal-card, .current-car,
.fr-code, .ms-card, .box-card, .rank-switch-mid, .track-for, .toast, .gauge, .hud-card {
    border-radius: 0;
}
.panel, .modal-card {
    clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}

/* ---------- Boutons ---------- */
.btn { border-radius: 0; letter-spacing: .1em; font-style: italic; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.btn-primary { background: linear-gradient(180deg, #f0203b, var(--red) 45%, #b10d24); box-shadow: none; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn-ghost { background: rgba(255,255,255,.05); border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-ghost:hover { background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px var(--gray); }
.btn-light { background: var(--gray); color: #0b0b0d; }
.btn-gold, .btn-mint { background: var(--gray); color: #0b0b0d; }
.icon-btn { border-radius: 0; background: rgba(9,9,11,.8); border-color: var(--line-strong); clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.icon-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.discord-btn { color: var(--gray); }
.badge { border-radius: 0; background: rgba(255,255,255,.08); color: var(--gray); border-color: var(--line-strong); }
.badge-mint { background: var(--red); color: #fff; border-color: var(--red); }
.segmented { border-radius: 0; background: rgba(255,255,255,.04); }
.segmented button { border-radius: 0; text-transform: uppercase; letter-spacing: .06em; font-style: italic; }
.segmented button.active { background: var(--red); }
.segmented button.donate-tab.active { background: var(--gray); color: #0b0b0d; }
.status-line.is-ok { color: var(--gray); }
.status-line.is-error { color: #ff4a60; }

/* ---------- Menu : fond, barre du haut ---------- */
#main-menu::before {
    background:
        linear-gradient(to bottom, rgba(5,5,6,.85), transparent 18%, transparent 62%, rgba(5,5,6,.9)),
        radial-gradient(ellipse at 70% 110%, rgba(227,19,47,.18), transparent 55%);
}
.brand-name { font-size: 1.6rem; letter-spacing: .06em; text-shadow: 0 0 22px rgba(227,19,47,.35); }
.brand-name b { color: var(--red); }
.brand-ver { border-radius: 0; background: transparent; color: var(--red); box-shadow: inset 0 0 0 1px var(--red); clip-path: polygon(5px 0, 100% 0, calc(100% - 5px) 100%, 0 100%); padding: 2px 9px; }
.online-pill { border-radius: 0; color: var(--gray); background: rgba(9,9,11,.75); border-color: var(--line-strong); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); padding-left: 14px; padding-right: 14px; }
.online-pill i { background: var(--red); box-shadow: 0 0 8px var(--red); }
.game-clock { border-radius: 0; background: rgba(9,9,11,.75); clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%); padding-left: 14px; padding-right: 14px; }
.game-clock[data-phase] { --gc: var(--gray); border-color: var(--line-strong); background: rgba(9,9,11,.75); }
.profile-chip { border-radius: 0; background: rgba(9,9,11,.8); clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.profile-chip img { border-radius: 0; }
.stat-elo b { color: var(--red); }
.stat-coins b { color: var(--gray); }
button.profile-chip:hover { border-color: var(--red); }
.showroom-caption span { font-size: 1rem; letter-spacing: .14em; text-shadow: 0 2px 14px #000, 0 0 2px #000; }
.showroom-caption span::before { content: ""; display: inline-block; width: 18px; height: 3px; background: var(--red); margin-right: 10px; vertical-align: middle; transform: skewX(-30deg); }
.legal a:hover { color: var(--red); }

/* ---------- Panneau du hub ---------- */
.panel { background: var(--panel); border: 0; box-shadow: inset 0 0 0 1px var(--line); }
.hub-panel { position: relative; }
.hub-panel::before { content: ""; position: absolute; left: 0; top: 0; width: 64px; height: 3px; background: var(--red); }
.screen-head { padding-bottom: 8px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.screen-head h2 { font-size: 1.25rem; letter-spacing: .08em; }
.screen-head h2::after { content: ""; display: inline-block; width: 26px; height: 3px; margin-left: 10px; vertical-align: middle; background: var(--red); transform: skewX(-30deg); }
.screen-back { border-radius: 0; background: rgba(255,255,255,.06); border: 0; clip-path: polygon(8px 0, 100% 0, 100% 100%, 0 100%, 0 8px); }
.screen-back:hover:not(:disabled) { background: var(--red); color: #fff; }

/* Accueil : gros bouton JOUER en parallélogramme */
.home-play {
    position: relative; overflow: hidden; border-radius: 0; min-height: 84px; padding-left: 26px;
    background: linear-gradient(100deg, #f0203b, var(--red) 40%, #9c0b20);
    box-shadow: none;
    clip-path: polygon(16px 0, 100% 0, calc(100% - 16px) 100%, 0 100%);
}
.home-play::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.22) 45%, transparent 60%); transform: translateX(-100%); animation: sheen 4.5s ease-in-out infinite; pointer-events: none; }
@keyframes sheen { 0%, 60% { transform: translateX(-100%); } 85%, 100% { transform: translateX(100%); } }
.home-play-ico { border-radius: 0; background: rgba(0,0,0,.28); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.home-play-txt b { font-size: 1.9rem; letter-spacing: .1em; }

/* Lignes de menu et modes : liste façon console, barre rouge au survol */
.menu-row, .mode-btn, .home-tile {
    background: linear-gradient(90deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
    border: 0; box-shadow: inset 0 0 0 1px var(--line);
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
    transition: box-shadow .12s, background .12s, transform .12s;
}
.menu-row:hover, .mode-btn:hover:not(:disabled), .home-tile:hover {
    background: linear-gradient(90deg, rgba(227,19,47,.22), rgba(255,255,255,.03));
    box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.45);
    transform: translateX(3px);
}
.mr-ico, .mode-ico { border-radius: 0; background: rgba(255,255,255,.07); clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); }
.mr-txt b, .mode-txt b { text-transform: uppercase; letter-spacing: .05em; font-style: italic; }
.mr-go, .mode-more { color: var(--red); }
.mode-solo .mode-more, .mode-go .mode-more { color: #fff; }
.home-tile span { filter: grayscale(1) brightness(1.4); }
.home-tile b { text-transform: uppercase; letter-spacing: .06em; font-style: italic; }
.tile-badge { border-radius: 0; background: var(--red); box-shadow: none; clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
/* Couleurs des modes ramenées à la palette */
.mode-solo { background: linear-gradient(100deg, rgba(227,19,47,.92), rgba(143,10,29,.92)); box-shadow: none; }
.mode-solo:hover:not(:disabled) { background: linear-gradient(100deg, #f0203b, #a10c22); box-shadow: inset 4px 0 0 #fff; }
.mode-duel .mode-ico, .mode-ranked .mode-ico, .mode-quick .mode-ico, .mode-community .mode-ico, .mode-battle .mode-ico { color: var(--gray); background: rgba(255,255,255,.07); }
.mode-ranked .mode-ico { color: var(--red); }
.mode-duel:hover, .mode-ranked:hover, .mode-quick:hover, .mode-community:hover, .mode-battle:hover { border-color: transparent; }
.mode-btn.is-queuing { background: linear-gradient(90deg, rgba(227,19,47,.32), rgba(227,19,47,.08)); box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px var(--red); animation: queuePulse 1.4s ease-in-out infinite; }
@keyframes queuePulse { 50% { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px var(--red), 0 0 22px -4px var(--red-glow); } }
.mode-group-title { color: var(--gray); letter-spacing: .12em; font-style: italic; }
.mode-group-title::before { content: "// "; color: var(--red); }
.home-missions { background: linear-gradient(90deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); }
.home-missions .mr-ico { background: rgba(227,19,47,.18); }
.home-missions.ready { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.6); }
.home-missions.ready .mr-txt small { color: var(--red); }
#editor-btn, #admin-panel-btn { color: var(--gray); border-color: var(--line-strong); background: rgba(255,255,255,.04); border-radius: 0; }

/* Bouton de départ (écran circuit) */
.mode-go { margin-top: 10px; min-height: 64px; background: linear-gradient(100deg, #f0203b, var(--red) 45%, #9c0b20); box-shadow: none; clip-path: polygon(14px 0, 100% 0, calc(100% - 14px) 100%, 0 100%); padding-left: 24px; }
.mode-go .mode-ico { background: rgba(0,0,0,.25); }
.mode-go .mode-txt b { font-size: 1.2rem; letter-spacing: .1em; }
.mode-go .mode-txt small { color: rgba(255,255,255,.82); }
.mode-go:hover:not(:disabled) { background: linear-gradient(100deg, #ff2a45, #c10f29); box-shadow: none; }
.track-for {
    display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; margin-bottom: 10px;
    background: rgba(255,255,255,.04); box-shadow: inset 4px 0 0 var(--red);
}
.track-for span { font-size: 1.05rem; align-self: center; }
.track-for b { text-transform: uppercase; font-style: italic; letter-spacing: .08em; }
.track-for small { color: var(--muted); font-size: .8rem; }

/* Sélecteur de circuit */
.track-card { background: #0d0d10; border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px)); }
#track-preview { background: radial-gradient(circle at 50% 40%, #17171c, #08080a); }
.nav-arrow { border-radius: 0; background: rgba(255,255,255,.05); border-color: var(--line); }
.nav-arrow:hover { background: var(--red); border-color: var(--red); color: #fff; }
.track-dots i { border-radius: 0; transform: skewX(-25deg); }
.track-dots i.active { background: var(--red); }
.track-dots i.waiting:not(.active) { background: var(--gray); box-shadow: 0 0 8px rgba(255,255,255,.6); animation: blink 1.4s ease-in-out infinite; }
.track-stats small { color: var(--muted); }
.current-car { border-radius: 0; border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); background: rgba(255,255,255,.03); }
.current-car:hover { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.5); }

/* ---------- Antenne : joueurs en attente d'un adversaire ---------- */
.antenna {
    position: absolute; top: 6px; right: 16px; display: inline-flex; align-items: center; gap: 3px;
    color: var(--red); font-style: normal; pointer-events: none; z-index: 1;
}
.antenna svg { width: 24px; height: 24px; filter: drop-shadow(0 0 4px var(--red-glow)); fill: currentColor; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.antenna svg path { fill: none; }
.antenna .ant-w1 { animation: antWave 1.6s ease-out infinite; }
.antenna .ant-w2 { animation: antWave 1.6s .35s ease-out infinite; }
.antenna b { font-size: .7rem; font-weight: 700; color: #fff; background: var(--red); padding: 0 5px; line-height: 15px; clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%); }
.antenna b:empty { display: none; }
.home-play .antenna, .mode-solo .antenna, .mode-go .antenna { color: #fff; }
.home-play .antenna { top: 10px; right: 30px; }
.home-play .antenna svg { width: 24px; height: 24px; }
@keyframes antWave { 0% { opacity: .3; } 30% { opacity: 1; } 100% { opacity: .3; } }
.track-wait { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--red); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.track-wait svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
.track-wait svg circle { fill: currentColor; }
.track-wait .ant-w1 { animation: antWave 1.6s ease-out infinite; }
.track-wait .ant-w2 { animation: antWave 1.6s .35s ease-out infinite; }

/* ---------- Écrans divers ---------- */
.pf-level { background: conic-gradient(var(--red) calc(var(--p) * 1turn), rgba(255,255,255,.08) 0); }
.pf-level::before { background: #0c0c0e; }
.pf-level small { border-radius: 0; }
.pf-xp, .ms-bar, .ch-timer { border-radius: 0; }
.pf-xp i { background: linear-gradient(90deg, var(--red-2), var(--red)); border-radius: 0; }
.pf-stat, .pf-records div, .lb-row, .result-rows div, .fr-row, .inv-empty, .fr-empty { border-radius: 0; }
.pf-stat.accent b { color: var(--red); }
.lb-row.me { box-shadow: inset 4px 0 0 var(--red); border-color: transparent; background: rgba(227,19,47,.1); }
.lb-row:nth-child(1) .lb-rank { color: var(--red); }
.lb-row:nth-child(2) .lb-rank { color: var(--gray); }
.lb-row:nth-child(3) .lb-rank { color: #8b8c93; }
.lb-time { color: var(--gray); }
.lb-car { color: var(--gray); border-color: var(--line-strong); border-radius: 0; }
.lb-avatar, .fr-av { border-radius: 0; }
.fr-code { background: linear-gradient(90deg, rgba(227,19,47,.14), rgba(255,255,255,.03)); border: 0; box-shadow: inset 4px 0 0 var(--red); }
.fr-dot.menu { background: var(--gray); box-shadow: 0 0 6px var(--gray); }
.fr-dot.race { background: var(--red); }
.fr-online { color: var(--gray); }
.ms-card { border: 0; box-shadow: inset 0 0 0 1px var(--line); --tc: var(--gray); }
.ms-card.tier-1, .ms-card.tier-2 { --tc: var(--red); }
.ms-card.ready { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.5); background: rgba(227,19,47,.08); }
.ms-card.ready .ms-bar i { background: var(--red); }
.ms-reward b, #ms-total b { color: var(--gray); }
.ms-claimed { color: var(--gray); }
.box-card { border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.015)); }
.box-legende { background: linear-gradient(160deg, rgba(227,19,47,.18), rgba(255,255,255,.02)); box-shadow: inset 0 0 0 1px rgba(227,19,47,.45); }
.box-ico { border-radius: 0; }
.shop-balance b { color: var(--gray); }
.box-lock { color: var(--red); }
.inv-item { border-radius: 0; }
.car-tag, .car-switch-mid .car-tag { border-radius: 0; }
.car-tag.equipped { background: var(--red); color: #fff; }
.car-tag.dev { background: rgba(255,255,255,.12); color: var(--gray); }
.stat-row i { border-radius: 0; }
.stat-row i::after { background: linear-gradient(90deg, var(--red-2), var(--red)); border-radius: 0; }
.rank-switch-mid { background: rgba(255,255,255,.04); border-color: var(--line); }
.cmap-like { border-radius: 0; }
.cmap-like.on { background: rgba(227,19,47,.25); border-color: var(--red); }
.cmap-preview { border-radius: 0; }

/* Modales, réglages */
.modal { background: rgba(2,2,3,.78); }
.modal-card { background: var(--panel-solid); border: 0; box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 3px 0 var(--red); }
.modal-head h2, .pause-card h2, .result-title { letter-spacing: .08em; }
.field select { border-radius: 0; background: #131316; }
.toggle i { border-radius: 0; background: #26272b; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
.toggle i::after { border-radius: 0; background: var(--gray); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
.toggle input:checked + i::after { background: #fff; }
.about-section p strong, .donate-section h3 { color: var(--red); }
.result-title.win { color: var(--gray); text-shadow: 0 0 30px rgba(255,255,255,.25); }
.result-badge { border-radius: 0; background: var(--red); color: #fff; }
.result-rows .pos { color: var(--gray); }
.result-rows .neg { color: #ff4a60; }
.toast { background: rgba(9,9,11,.96); border: 0; box-shadow: inset 4px 0 0 var(--gray), 0 10px 30px -10px #000; }
.toast.error { box-shadow: inset 4px 0 0 var(--red), 0 10px 30px -10px #000; }
.toast.ok, .toast.warn { box-shadow: inset 4px 0 0 var(--gray), 0 10px 30px -10px #000; }
.ch-kicker, .mi-card small { color: var(--red); }
.mi-vs b:last-child { color: var(--red); }
.mi-vs span, .mi-count b { color: var(--gray); }
.lu-card small { color: var(--red); }
.loot-marker { background: var(--red); box-shadow: 0 0 12px var(--red); }
.loot-reel-wrap { border-radius: 0; }
.loot-tile { border-radius: 0; }

/* Chargement */

.loader-road { border-radius: 0; transform: skewX(-25deg); }
.loader-road i { border-radius: 0; }

/* HUD : accents de la palette */
.hud-card, .gauge, .minimap, .hud-btn { border-radius: 0; }
.hud-card { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%); }
.gauge { clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); padding-left: 22px; padding-right: 22px; }
.rpm-track { border-radius: 0; }
.rpm-track i { background: linear-gradient(90deg, #6e7078 0%, var(--gray) 60%, #ff5c70 85%, var(--red) 95%); }
.hud-pos { color: var(--gray); }
.hud-opp { color: var(--red); }
.mm-opp { background: var(--gray); box-shadow: 0 0 8px var(--gray); }
.hud-ping { color: var(--gray); }
#countdown-ui { color: var(--gray); text-shadow: 0 6px 0 rgba(0,0,0,.5), 0 0 40px rgba(227,19,47,.55); }
#countdown-ui.go { color: var(--red); text-shadow: 0 6px 0 rgba(0,0,0,.5), 0 0 50px rgba(227,19,47,.7); }
.bt-head b { color: var(--gray); }
.bt-bar i { background: linear-gradient(90deg, var(--gray), #fff); }

/* Bureau / paysage : le hub devient une colonne de jeu pleine hauteur collée au bord gauche */
@media (min-width: 900px) {
    .hub-panel {
        clip-path: polygon(0 0, 100% 0, 100% calc(100% - 22px), calc(100% - 22px) 100%, 0 100%);
        background: linear-gradient(90deg, rgba(5,5,6,.94), rgba(9,9,11,.86));
        box-shadow: inset -1px 0 0 rgba(227,19,47,.35), inset 0 0 0 1px var(--line);
    }
    .brand-name { font-size: 2.1rem; }
}

/* =====================================================================
   ÉCRAN DE LANCEMENT (fondu du logo, du nom, puis des crédits)
   ===================================================================== */
#splash {
    position: fixed; inset: 0; z-index: 1000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
    background: radial-gradient(ellipse at 50% 45%, #16070a, #050506 62%);
    cursor: pointer; text-align: center; padding: 24px;
    animation: spOut .8s ease-in 4.6s forwards;
}
#splash.sp-short { animation-delay: 1.7s; }
#splash.sp-out { animation: spOut .5s ease-in forwards !important; }
@keyframes spOut { to { opacity: 0; visibility: hidden; pointer-events: none; } }
.sp-stage { display: flex; flex-direction: column; align-items: center; }
.sp-logo { width: 132px; height: 132px; opacity: 0; animation: spLogo 1.1s cubic-bezier(.2,.9,.3,1) .2s forwards; filter: drop-shadow(0 0 28px rgba(227,19,47,.45)); }
@keyframes spLogo { from { opacity: 0; transform: scale(.82); filter: blur(8px) drop-shadow(0 0 0 transparent); } to { opacity: 1; transform: none; } }
.sp-title {
    margin-top: 18px; font-size: clamp(2.4rem, 9vw, 4.6rem); font-weight: 700; font-style: italic; text-transform: uppercase;
    letter-spacing: .08em; line-height: 1; color: #f1f1f3; text-shadow: 0 0 30px rgba(227,19,47,.4);
    opacity: 0; animation: spTitle .9s cubic-bezier(.2,.9,.3,1) .75s forwards;
}
.sp-title b { color: var(--red); margin-left: 6px; }
@keyframes spTitle { from { opacity: 0; letter-spacing: .5em; } to { opacity: 1; letter-spacing: .08em; } }
.sp-tag { margin-top: 10px; color: var(--muted); font-size: .9rem; font-weight: 700; letter-spacing: .5em; text-transform: uppercase; padding-left: .5em; opacity: 0; animation: spFade .7s ease-out 1.3s forwards; }
.sp-tag::before, .sp-tag::after { content: ""; display: inline-block; width: 26px; height: 2px; background: var(--red); vertical-align: middle; margin: 0 14px; transform: skewX(-30deg); }
.sp-credits { display: grid; gap: 10px; opacity: 0; animation: spFade .8s ease-out 2.1s forwards; }
.sp-line { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 4px 10px; }
.sp-line small { width: 100%; color: var(--dim); font-size: .68rem; letter-spacing: .3em; text-transform: uppercase; }
.sp-line b { font-size: 1.15rem; font-style: italic; letter-spacing: .06em; color: var(--text); }
.sp-line i { color: var(--red); font-style: normal; font-weight: 700; }
.sp-ai b { color: var(--gray); font-size: 1rem; }
.sp-ai em { font-style: normal; color: var(--muted); font-size: .8rem; letter-spacing: .1em; }
.sp-skip { position: absolute; bottom: calc(22px + var(--safe-b)); color: var(--dim); font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; opacity: 0; animation: spFade .6s ease-out 1.8s forwards; }
#splash.sp-short .sp-logo, #splash.sp-short .sp-title, #splash.sp-short .sp-tag, #splash.sp-short .sp-credits, #splash.sp-short .sp-skip { animation-duration: .4s; animation-delay: 0s; }
@keyframes spFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #splash { animation: spOut .3s ease-in 1.5s forwards !important; } }
/* =====================================================================
   V5.1 — DISPOSITION DU MENU (onglets permanents, panneau de hauteur fixe)
   Mobile portrait : barre du haut · voiture · panneau (hauteur FIXE, défile à l'intérieur) · onglets en bas
   Ordinateur / paysage : colonne gauche (onglets puis panneau) · voiture à droite
   La zone de la voiture ne change plus de taille d'un écran à l'autre (plus de saut de cadrage).
   ===================================================================== */
#main-menu {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    grid-template-areas: "top" "show" "hub" "nav" "legal";
    row-gap: 8px;
}
.main-nav { grid-area: nav; }
.hub { max-height: none; }
body.logged-in #main-menu { padding-bottom: 0; }
body.logged-in .hub { height: min(52vh, 540px); }
body.logged-in .legal { display: none; }
.hub-panel { height: 100%; max-height: none; display: flex; flex-direction: column; min-height: 0; }
.hub-panel > .tab-panel { flex: 1 1 auto; min-height: 0; }
.hub-panel > .status-line { flex: none; margin-top: 6px; }
.hub-panel > .status-line:empty { display: none; }
.hub-panel > .bot-offer { flex: none; }

/* En-tête d'écran : ‹ seulement dans un sous-écran, fil d'Ariane au-dessus du titre */
.screen-head { min-height: 40px; flex: none; }
.screen-titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.screen-titles small { color: var(--muted); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.screen-titles small:empty { display: none; }
.screen-titles h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Onglets principaux */
.main-nav {
    pointer-events: auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: #08080a; box-shadow: inset 0 1px 0 var(--line);
}
.main-nav button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 60px; padding: 6px 2px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
    font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-style: italic;
    transition: color .12s, background .12s;
}
.main-nav svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.main-nav button[data-tab="play"] svg path { fill: currentColor; }
.main-nav button::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px; background: var(--red); transform: scaleX(0); transition: transform .15s; }
.main-nav button.active { color: #fff; background: linear-gradient(180deg, rgba(227,19,47,.16), transparent 80%); }
.main-nav button.active::before { transform: scaleX(1); }
.main-nav button.active svg { color: var(--red); }
.main-nav button:hover:not(.active) { color: var(--text); }
.main-nav.locked button:not(.active) { opacity: .35; pointer-events: none; }
.main-nav .tile-badge { position: absolute; top: 6px; left: calc(50% + 8px); right: auto; }
.main-nav .antenna { top: 4px; right: auto; left: calc(50% + 8px); }
.main-nav .antenna svg { width: 18px; height: 18px; }
.main-nav .antenna svg path { fill: none !important; }

/* Le gros « Jouer » de l'ancien accueil est remplacé par les onglets : modes directement visibles */
#mode-main .home-missions { margin-bottom: 4px; }

/* ---------- Mobile portrait ---------- */
@media (max-width: 899px) and (orientation: portrait), (max-width: 599px) {
    body.logged-in .main-nav {
        margin: 0 calc(-12px - var(--safe-r)) 0 calc(-12px - var(--safe-l));
        padding: 0 var(--safe-r) var(--safe-b) var(--safe-l);
    }
    .hub-panel { border-radius: 0; padding: 10px 10px 8px; }
    .panel.hub-panel { clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%); }
    .showroom-caption { bottom: 2px; }
    .showroom-caption small { display: none; }
    /* Barre du haut sur une seule ligne : nom, pastilles compactes, profil, réglages */
    .topbar { flex-wrap: nowrap; }
    .topbar-status { order: 0; width: auto; gap: 6px; }
    .game-clock .gc-phase, .online-label, .discord-btn { display: none; }
    .profile-chip img { display: none; }
    .profile-name { max-width: 84px; }
    .brand-name { font-size: 1.25rem; }
    .brand-ver { display: none; }
    .icon-btn { width: 40px; height: 40px; }
    .mode-pair { gap: 6px; }
    .mode-pair .mode-ico { display: none; }
}
@media (max-width: 380px) {
    .main-nav button { font-size: .58rem; }
}
/* Téléphone en portrait : la ligne unique débordait (pseudo, joueurs en ligne et heure se chevauchaient). On remet DEUX lignes :
   logo + profil + réglages en haut, joueurs en ligne + heure du jeu (libellés complets) dessous. */
@media (max-width: 520px) and (orientation: portrait) {
    .topbar { flex-wrap: wrap; row-gap: 6px; }
    .topbar-status { order: 3; width: 100%; justify-content: space-between; gap: 8px; }
    .game-clock .gc-phase, .online-label { display: inline; }
    .topbar-right { margin-left: auto; }
    .profile-name { max-width: 110px; }
}

/* ---------- Ordinateur et paysage : colonne de gauche (onglets + panneau), voiture à droite ---------- */
@media (min-width: 900px), (orientation: landscape) and (max-height: 600px) {
    #main-menu {
        grid-template-columns: minmax(330px, 440px) 1fr;
        grid-template-rows: auto auto minmax(0, 1fr) auto;
        grid-template-areas: "top top" "nav show" "hub show" "legal show";
        row-gap: 10px;
    }
    body.logged-in .hub { height: auto; min-height: 0; }
    body.logged-in .legal { display: block; }
    .main-nav { background: rgba(9,9,11,.9); box-shadow: inset 0 0 0 1px var(--line); clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); }
    .main-nav button { min-height: 58px; }
    .main-nav button::before { top: auto; bottom: 0; }
    .main-nav button.active { background: linear-gradient(0deg, rgba(227,19,47,.2), transparent 85%); }
}
@media (orientation: landscape) and (max-height: 600px) {
    #main-menu { row-gap: 6px; grid-template-columns: minmax(300px, 46vw) 1fr; }
    .main-nav button { min-height: 42px; flex-direction: row; gap: 6px; font-size: .62rem; }
    .main-nav svg { width: 18px; height: 18px; }
    .main-nav .tile-badge, .main-nav .antenna { top: 2px; left: auto; right: 4px; }
    .topbar-status { order: 0; width: auto; }
    .topbar { flex-wrap: nowrap; }
    .screen-head { min-height: 34px; margin-bottom: 6px; padding-bottom: 6px; }
}
/* Bouton de départ toujours visible en bas de l'écran circuit (le contenu défile derrière) */
#track-go { position: sticky; bottom: 0; z-index: 3; }
#track-section { display: flex; flex-direction: column; }
#track-section > * { flex: none; }
#track-section > #track-go { margin-top: auto; }
#track-section .current-car { margin-bottom: 8px; }
@media (max-width: 899px) and (orientation: portrait) {
    #track-preview { aspect-ratio: 5 / 2; }
    #track-profile { height: 18px; }
    .track-for { margin-bottom: 8px; padding: 6px 10px; }
}
@media (orientation: landscape) and (max-height: 600px) {
    .main-nav button span { display: none; }
    .main-nav button.active span { display: inline; }
}
/* =====================================================================
   DÉFI DU JOUR + PROFIL PUBLIC
   ===================================================================== */
.daily-row {
    position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "kick side" "main side" "me side";
    align-items: center; gap: 2px 12px; width: 100%; padding: 10px 14px 10px 16px; border: 0; cursor: pointer; text-align: left; color: var(--text);
    background: linear-gradient(100deg, rgba(227,19,47,.28), rgba(227,19,47,.06) 60%, rgba(255,255,255,.03));
    box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.45);
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
    transition: background .12s, transform .12s;
}
.daily-row:hover { background: linear-gradient(100deg, rgba(227,19,47,.4), rgba(227,19,47,.1) 60%, rgba(255,255,255,.04)); transform: translateX(3px); }
.dr-kicker { grid-area: kick; font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.dr-kicker i { font-style: normal; color: var(--muted); letter-spacing: .04em; margin-left: 6px; font-variant-numeric: tabular-nums; }
.dr-kicker i::before { content: "⏱ "; }
.dr-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; }
.dr-main b { font-size: 1.15rem; font-style: italic; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-main small { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dr-side { grid-area: side; display: flex; flex-direction: column; align-items: flex-end; padding-left: 12px; border-left: 1px solid var(--line-strong); }
.dr-side small { font-size: .62rem; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; }
.dr-side b { font-size: 1.1rem; font-style: italic; white-space: nowrap; }
.dr-me { grid-area: me; font-size: .74rem; font-weight: 700; color: var(--gray); }
.daily-row.leading .dr-me { color: #fff; }
.daily-row.leading .dr-me::before { content: "▲ "; color: var(--red); }

.dl-hero { padding: 12px 14px; margin-bottom: 10px; background: linear-gradient(120deg, rgba(227,19,47,.22), rgba(255,255,255,.03)); box-shadow: inset 4px 0 0 var(--red); }
.dl-hero-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.dl-kicker { font-size: .66rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dl-hero-top b { font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--red); }
.dl-hero h3 { margin: 4px 0 6px; font-size: 1.5rem; font-style: italic; text-transform: uppercase; letter-spacing: .05em; line-height: 1.05; }
.dl-car { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: .8rem; }
.dl-car span { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; }
.dl-car b { font-style: italic; text-transform: uppercase; }
.dl-car small { color: var(--dim); font-size: .7rem; }
#dl-platform { margin-bottom: 10px; }
.dl-prizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.dl-prize { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); }
.dl-prize span { font-size: 1.2rem; line-height: 1; }
.dl-prize b { font-size: 1.15rem; font-style: italic; margin-top: 2px; font-variant-numeric: tabular-nums; }
.dl-prize small { color: var(--muted); font-size: .62rem; letter-spacing: .1em; }
.dl-prize.p1 { background: rgba(227,19,47,.16); box-shadow: inset 0 0 0 1px rgba(227,19,47,.5); }
.dl-me { font-size: .82rem; color: var(--muted); margin: 0 2px 10px; }
.dl-me b { color: var(--text); }
.dl-row-prize { margin-left: 6px; font-size: .68rem; font-weight: 700; color: var(--red); }
.dl-yesterday { margin-top: 12px; }
.dl-yesterday summary { cursor: pointer; color: var(--muted); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
#daily-section { display: flex; flex-direction: column; }
#daily-section > * { flex: none; }
#daily-section > #daily-go { position: sticky; bottom: 0; z-index: 3; margin-top: auto; }

/* Lignes de classement cliquables → profil du joueur */
.lb-row[data-player] { cursor: pointer; transition: background .12s, box-shadow .12s; }
.lb-row[data-player]:hover { background: rgba(255,255,255,.07); box-shadow: inset 3px 0 0 var(--gray); }
.lb-row.me[data-player]:hover { box-shadow: inset 4px 0 0 var(--red); }
#player-modal { z-index: 190; }
.player-card { width: min(460px, 100%); }
.player-card .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-pic { width: 26px; height: 26px; object-fit: cover; vertical-align: -5px; margin-right: 8px; }
/* =====================================================================
   MANETTE : élément sélectionné + aide des boutons (padnav.js)
   ===================================================================== */
body.pad-mode .pad-focus {
    box-shadow: inset 0 0 0 2px #fff, inset 6px 0 0 var(--red) !important;
    filter: brightness(1.18);
    animation: padPulse 1.2s ease-in-out infinite;
    outline: none;
}
body.pad-mode .main-nav .pad-focus { box-shadow: inset 0 0 0 2px #fff !important; }
body.pad-mode label.toggle.pad-focus, body.pad-mode .lb-row.pad-focus { padding-left: 10px; padding-right: 8px; }
body.pad-mode select.pad-focus, body.pad-mode input.pad-focus { border-color: #fff; }
@keyframes padPulse { 50% { filter: brightness(1.32); } }
body.pad-mode :focus { outline: none; }
#pad-hints {
    position: fixed; right: calc(14px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); z-index: 400;
    display: none; gap: 14px; padding: 6px 14px; pointer-events: none;
    background: rgba(5,5,6,.82); box-shadow: inset 0 0 0 1px var(--line-strong);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    font-size: .74rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; white-space: nowrap;
}
body.pad-mode #pad-hints { display: flex; }
body.in-race:not(.replaying) #pad-hints { display: none; }
#pad-hints span { display: inline-flex; align-items: center; gap: 6px; }
#pad-hints i {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 50%;
    font-style: normal; font-size: .68rem; color: #0b0b0d; background: var(--gray);
}
#pad-hints i.a { background: #fff; }
#pad-hints i.b { background: var(--red); color: #fff; }
#pad-hints i.sq { border-radius: 4px; }
@media (max-width: 899px) and (orientation: portrait) { #pad-hints { bottom: calc(70px + var(--safe-b)); left: 50%; right: auto; transform: translateX(-50%); } }body.replaying #pad-hints .ph-menu, body:not(.replaying) #pad-hints .ph-replay { display: none; }
body.replaying #pad-hints::before { content: "A pause · LB / RB vitesse"; color: var(--muted); }

/* Onglet « Défis » : 6 onglets dans la barre */
.main-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.main-nav button { font-size: .6rem; letter-spacing: .03em; }
.main-nav button[data-tab="challenges"] svg path:last-child { fill: currentColor; fill-opacity: .25; }
#challenges-section .mode-grid { gap: 10px; }
@media (max-width: 380px) { .main-nav button { font-size: .54rem; } .main-nav svg { width: 22px; height: 22px; } }
/* ---- V6 : boîte manuelle (boutons de passage mobile) et tableau des commandes ---- */
#shift-pad { display: none; position: fixed; right: calc(14px + env(safe-area-inset-right, 0px)); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 60; gap: 12px; }
body.in-race.show-shift #shift-pad, body.edit-pads #shift-pad { display: flex; }
#shift-pad button { width: 62px; height: 62px; border-radius: 14px; border: 2px solid rgba(255,255,255,.35); background: rgba(10,10,14,.55); color: #fff;
  font: 700 30px 'Chakra Petch', sans-serif; line-height: 1; touch-action: manipulation; -webkit-tap-highlight-color: transparent; backdrop-filter: blur(4px); }
#shift-pad button:active { background: rgba(255,45,70,.7); border-color: #ff2d46; }
#shift-pad button { touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
#shift-pad button.moving { background: rgba(255,45,70,.55); border-color: #fff; box-shadow: 0 0 0 5px rgba(255,45,70,.4), 0 0 24px rgba(255,45,70,.7); scale: 1.18; z-index: 2; }
/* Bouton de frein tactile (côté gauche, au pouce gauche) */
#brake-btn { display: none; position: fixed; left: calc(14px + env(safe-area-inset-left, 0px)); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  width: 84px; height: 84px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: rgba(10,10,14,.5); color: #fff;
  font: 700 .8rem 'Chakra Petch', sans-serif; letter-spacing: .08em; backdrop-filter: blur(4px);
  touch-action: none; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
body.in-race.show-brake #brake-btn, body.edit-pads #brake-btn { display: block; }
#brake-btn.moving { background: rgba(255,45,70,.55); border-color: #fff; box-shadow: 0 0 0 5px rgba(255,45,70,.4), 0 0 24px rgba(255,45,70,.7); scale: 1.12; }
/* Replay : aucun bouton tactile de conduite */
body.replaying:not(.edit-pads) #shift-pad, body.replaying:not(.edit-pads) #brake-btn { display: none !important; }
/* Mode déplacement des boutons */
body.edit-pads #shift-pad, body.edit-pads #brake-btn { z-index: 9000; outline: 2px dashed rgba(255,255,255,.6); outline-offset: 4px; }
/* Plein écran : bloque tout ce qui est derrière ; les boutons (z 9000) restent au-dessus */
#pads-edit-bar { position: fixed; inset: 0; z-index: 8900; background: rgba(0,0,0,.35); color: #fff; font-size: .85rem; touch-action: none; }
#pads-edit-bar span { position: absolute; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); padding: 8px 14px; border-radius: 12px; background: rgba(10,10,14,.85); border: 1px solid rgba(255,255,255,.25); max-width: 70vw; text-align: center; pointer-events: none; }
#pads-edit-done { position: absolute; right: calc(14px + env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); width: 54px; height: 54px; border-radius: 50%; border: 2px solid #fff; background: #1fa55a; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; }
#pads-edit-bar[hidden] { display: none; }
#brake-btn.held { background: rgba(255,45,70,.7); border-color: #ff2d46; box-shadow: 0 0 22px rgba(255,45,70,.6); }
.ctrl-ref { margin-top: 12px; }
.ctrl-ref h3 { margin: 0 0 6px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.ctrl-ref table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ctrl-ref th, .ctrl-ref td { padding: 5px 6px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.1); }
.ctrl-ref th { font-weight: 700; opacity: .65; font-size: 11px; text-transform: uppercase; }
.ctrl-ref td:first-child { opacity: .85; }

/* ---- Carrière (career.js) : même langage que les missions (noir / rouge / gris) ---- */
.home-career { position: relative; min-height: 58px; min-width: 0; max-width: 100%; background: linear-gradient(90deg, rgba(255,255,255,.07), rgba(255,255,255,.02)); }
.home-career .mr-ico { background: rgba(227,19,47,.18); }
.home-career .mr-txt b { font-style: italic; text-transform: uppercase; letter-spacing: .03em; }
.home-career .mr-txt small { color: var(--muted); font-size: .76rem; white-space: normal; overflow-wrap: anywhere; }
.home-career .tile-badge { position: static; margin-left: auto; }
.home-career.ready { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.6); }
.home-career.ready .mr-txt small { color: var(--red); font-weight: 700; }
.cr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cr-stars { display: flex; flex-direction: column; line-height: 1.15; }
.cr-stars span { font-size: 1.15rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cr-stars small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.cr-crates { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cr-crates small { color: var(--muted); font-size: .76rem; }
.cr-crate { white-space: nowrap; }
.cr-list { display: grid; gap: 10px; }
.cr-region { margin: 10px 0 0; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cr-region:first-child { margin-top: 0; }
.cr-card { border-radius: 14px; padding: 12px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 8px; }
.cr-card.perfect { box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px rgba(227,19,47,.4); }
.cr-card.locked { opacity: .55; }
.cr-top { display: flex; align-items: center; gap: 10px; }
.cr-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; font-size: 1.2rem; border-radius: 10px; background: rgba(255,255,255,.07); }
.cr-txt { min-width: 0; flex: 1; }
.cr-txt small { display: block; color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.cr-txt b { display: block; font-size: 1rem; }
.cr-stars-row { font-size: 1.05rem; letter-spacing: .1em; color: var(--red); white-space: nowrap; }
.cr-blurb { margin: 0; color: var(--muted); font-size: .8rem; }
.cr-meta { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; font-size: .74rem; }
.cr-tag { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.08); font-weight: 700; font-variant-numeric: tabular-nums; }
.cr-tag.crate { background: rgba(227,19,47,.16); color: #ffb3bd; }
.cr-tag.lvl { background: rgba(255,255,255,.14); text-transform: uppercase; letter-spacing: .06em; font-size: .68rem; }
.cr-tag.style { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.22); }
.cr-tag.rec { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.cr-tag.lvl-expert { background: rgba(227,19,47,.22); color: #ffb3bd; }
.cr-tag.lvl-legende { background: var(--red); color: #fff; }
.cr-goal { color: var(--muted); }

/* Garanties (pity) et secousse de l'ouverture légendaire / mythique */
.pity-box { display: grid; gap: 8px; margin-bottom: 14px; }
.pity-row { padding: 8px 10px; border-radius: 10px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); }
.pity-row.hot { box-shadow: inset 0 0 0 1px var(--pc), 0 0 14px -6px var(--pc); }
.pity-top { display: flex; justify-content: space-between; gap: 8px; font-size: .74rem; margin-bottom: 6px; }
.pity-top span { color: var(--muted); }
.pity-top b { font-variant-numeric: tabular-nums; }
.pity-bar { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.pity-bar i { position: absolute; inset: 0 auto 0 0; background: var(--pc); border-radius: 3px; transition: width .5s ease; }
.pity-bar s { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,.55); }
.pity-note { margin: 0; font-size: .7rem; color: var(--muted); }
.pity-tag { color: #ffd76a; }
.loot-overlay.shake .loot-stage { animation: lootShake .55s ease-out; }
@keyframes lootShake { 0%,100% { transform: none; } 15% { transform: translate(-7px, 4px) rotate(-.6deg); } 30% { transform: translate(6px, -5px) rotate(.5deg); } 45% { transform: translate(-5px, -3px); } 60% { transform: translate(4px, 4px); } 80% { transform: translate(-2px, 1px); } }
@media (prefers-reduced-motion: reduce) { .loot-overlay.shake .loot-stage { animation: none; } }
.bot-level { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .8rem; }
.bot-level select { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; }
.bot-level select option { background: #121216; color: var(--text); }

/* ---- Inventaire : caisses en attente, collection par rareté, ouverture groupée ---- */
.inv-crates { display: grid; gap: 8px; margin-bottom: 14px; }
.inv-empty { padding: 12px; border-radius: 12px; background: rgba(255,255,255,.04); color: var(--muted); font-size: .8rem; }
.crate-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.05); box-shadow: inset 4px 0 0 var(--red), inset 0 0 0 1px var(--line); }
.crate-ico { font-size: 1.4rem; }
.crate-txt { flex: 1; min-width: 90px; line-height: 1.2; }
.crate-txt b { display: block; }
.crate-txt small { color: var(--muted); font-variant-numeric: tabular-nums; }
.inv-rarity { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; margin-bottom: 14px; }
.rar-chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); font-size: .76rem; }
.rar-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); flex: none; }
.rar-chip span { flex: 1; min-width: 0; }
.rar-chip b { font-variant-numeric: tabular-nums; }
.loot-batch { position: fixed; inset: 0; z-index: 360; display: grid; place-items: center; padding: 16px; background: rgba(5,5,8,.88); backdrop-filter: blur(6px); }
.loot-batch[hidden] { display: none; }
.lb-stage { width: min(560px, 100%); max-height: 100%; overflow: auto; display: grid; gap: 12px; text-align: center; }
.lb-stage small { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: .72rem; }
.lb-stage h2 { margin: 0; font-style: italic; text-transform: uppercase; }
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 112px)); justify-content: center; gap: 8px; }
.lb-item { display: grid; gap: 4px; justify-items: center; padding: 8px 4px; border-radius: 12px; background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--rc); animation: lbIn .38s both cubic-bezier(.2,.8,.2,1); }
.lb-item.r-legendaire, .lb-item.r-mythique { box-shadow: inset 0 0 0 2px var(--rc), 0 0 22px -4px var(--rc); }
.lb-item.dup { opacity: .7; }
.lb-name { font-size: .7rem; line-height: 1.15; overflow-wrap: anywhere; }
.lb-item small { font-size: .64rem; letter-spacing: 0; text-transform: none; color: var(--muted); }
.lb-sum { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.lb-sum b { color: var(--text); }
@keyframes lbIn { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .lb-item { animation: none; } }

/* ---------- Garage › Échappement : cartographies de pétarades + banc d'essai ---------- */
.pop-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-bottom: 12px; }
.pop-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text); text-align: left; cursor: pointer; box-shadow: inset 4px 0 0 var(--r, #9aa4b2); font: inherit; }
.pop-card.selected { background: rgba(255,255,255,.1); border-color: var(--line-strong); }
.pop-card.missing { opacity: .5; cursor: default; }
.pop-card .pc-name { font-weight: 700; font-size: .9rem; line-height: 1.15; }
.pop-card .pc-rar { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--r, #9aa4b2); }
.pop-card .pc-eq { position: absolute; right: 10px; top: 8px; color: #3ddc84; font-weight: 800; }
.pop-detail { margin: 0 0 12px; font-size: .84rem; color: var(--muted); line-height: 1.4; }
.pop-detail b { color: var(--text); }
.pop-bench { display: grid; gap: 8px; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.035); border: 1px solid var(--line); margin-bottom: 12px; }
.pop-bench-top { display: flex; gap: 10px; flex-wrap: wrap; }
.pop-bench-top label { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.pop-bench select { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: .82rem; text-transform: none; letter-spacing: 0; }
.pop-canvas-wrap { position: relative; }
.pop-canvas { width: 100%; height: 150px; display: block; border-radius: 10px; background: rgba(0,0,0,.35); touch-action: none; }
.pop-hit { position: absolute; right: 10px; top: 8px; font-weight: 900; font-size: 1.1rem; letter-spacing: .08em; opacity: 0; pointer-events: none; text-shadow: 0 0 12px currentColor; }
.pop-hit.on { opacity: 1; transition: none; }
.pop-hit.fade { transition: opacity .35s ease-out; }
.pop-rev { position: relative; height: 18px; border-radius: 9px; background: rgba(255,255,255,.07); overflow: hidden; }
.pop-rev i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, #3a3a44, var(--red)); }
.pop-rev span { position: relative; display: block; text-align: center; font-size: .7rem; line-height: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pop-gas { display: flex; justify-content: center; align-items: center; user-select: none; -webkit-user-select: none; touch-action: none; padding: 16px 12px; }
.pop-gas.held { background: linear-gradient(135deg, var(--red), var(--red-2)); border-color: transparent; }
.pop-hint { color: var(--muted); font-size: .72rem; text-align: center; }

/* Garage : onglets Voiture / Inventaire / Caisses + sous-onglets de l'inventaire */
.g-tabs, .g-sub { margin-bottom: 12px; }
.g-tabs button { position: relative; }
.g-tabs .tile-badge { position: absolute; top: -6px; right: 6px; }
.g-sub button small { display: block; font-size: .66rem; opacity: .7; font-weight: 600; }

/* ---- Danger Zone : jauge de boost en ligne (features/dangerzone.js) ---- */
#dz-hud { position: absolute; right: 14px; top: 38%; z-index: 30; width: 150px; padding: 10px 12px; border-radius: 12px; background: rgba(8,8,10,.72); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(6px); pointer-events: auto; text-align: center; transition: border-color .2s, box-shadow .2s; }
#dz-hud[hidden] { display: none; }
#dz-hud .dz-title { font-size: .68rem; font-weight: 800; letter-spacing: .16em; color: #a3a4ab; margin-bottom: 6px; }
#dz-hud .dz-bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,.1); overflow: hidden; }
#dz-hud .dz-bar i { display: block; height: 100%; width: 0; border-radius: 6px; background: linear-gradient(90deg, #8e9098, #e3132f); transition: width .12s linear; }
#dz-hud .dz-btn { display: none; margin: 8px auto 0; width: 44px; height: 44px; border-radius: 50%; border: 2px solid #e3132f; background: rgba(227,19,47,.18); color: #fff; font: 800 1rem system-ui, sans-serif; cursor: pointer; }
#dz-hud .dz-note { margin-top: 6px; font-size: .68rem; color: #a3a4ab; min-height: 1em; }
#dz-hud.ready { border-color: rgba(227,19,47,.7); }
#dz-hud.ready .dz-title { color: #fff; }
#dz-hud.go { box-shadow: 0 0 18px rgba(227,19,47,.55); animation: dzPulse .8s ease-in-out infinite alternate; }
#dz-hud.go .dz-btn { display: block; }
#dz-hud.go .dz-note { color: #fff; font-weight: 700; }
#dz-hud.active { border-color: #fff; box-shadow: 0 0 22px rgba(255,255,255,.45); }
#dz-hud.active .dz-title { color: #fff; }
#dz-hud.active .dz-bar i { background: linear-gradient(90deg, #fff, #e3132f); transition: none; }
#dz-hud.flash { animation: dzShake .25s linear 2; }
@keyframes dzPulse { from { box-shadow: 0 0 8px rgba(227,19,47,.3); } to { box-shadow: 0 0 22px rgba(227,19,47,.8); } }
@keyframes dzShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (max-width: 700px) { #dz-hud { right: 8px; top: 30%; width: 128px; } }

/* ---- Replays : lecteur de fichiers .ndreplay (features/replayfiles.js) ---- */
.rf-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 16px; border: 2px dashed rgba(255,255,255,.22); border-radius: 14px; background: rgba(255,255,255,.04); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.rf-drop:hover, .rf-drop.over { border-color: var(--red); background: rgba(227,19,47,.1); }
.rf-drop .rf-ico { font-size: 2rem; }
.rf-drop small { color: var(--muted); }
.rf-info { margin-top: 14px; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); }
.rf-title { font-weight: 800; letter-spacing: .04em; margin-bottom: 8px; text-transform: uppercase; }
.rf-rows { display: grid; gap: 4px; margin-bottom: 12px; }
.rf-rows div { display: flex; justify-content: space-between; gap: 12px; }
.rf-rows span { color: var(--muted); }
.rf-err { color: #ff8a97; font-weight: 700; }

/* Barres de défilement masquées partout (le défilement reste actif : molette, tactile, clavier) */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }



/* Points de performance (PP, 1 à 10) : pastille à côté du nom de la voiture et première ligne des stats */
.pp-chip { display: inline-block; margin-left: 8px; padding: 1px 7px; font-size: .68rem; font-weight: 800; letter-spacing: .04em; vertical-align: middle; background: var(--red); color: #fff; font-variant-numeric: tabular-nums; }
.stat-row.pp { padding-bottom: 6px; margin-bottom: 2px; border-bottom: 1px solid rgba(255,255,255,.08); }
.stat-row.pp span { color: var(--red); font-weight: 800; }
.stat-row.pp b { font-weight: 800; }
.pp-diff { font-weight: 800; font-variant-numeric: tabular-nums; }
.pp-diff.up { color: #ff7a45; }
.pp-diff.down { color: var(--muted); }

/* Chrono de course : boîtes de largeur fixe par caractère (hud.js) : il ne « respire » plus quand les chiffres défilent */
.hud-time { white-space: nowrap; }
.hud-time .d { display: inline-block; width: 1ch; text-align: center; }
.hud-time .s { display: inline-block; width: .5ch; text-align: center; }

/* Pas de curseur pendant la course (hors pause, replay, fin de course) : le clic gauche / droit passe les rapports en boite manuelle (input.js) */
body.hide-cursor, body.hide-cursor * { cursor: none !important; }


/* =====================================================================
   V6 — PREMIUM : palette affinée (nuit bleutée, rouge cramoisi, titane, champagne),
   verre dépoli, transitions fluides, entrées en cascade. Couche finale : n'écrase que l'apparence.
   Animations = transform / opacity uniquement ; coupées si l'utilisateur demande moins de mouvement.
   ===================================================================== */
:root {
    --bg: #05060a;
    --panel: rgba(11, 13, 20, .80);
    --panel-solid: #0b0d14;
    --card: rgba(255, 255, 255, .04);
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .15);
    --text: #eef0f6;
    --muted: #9ea3b2;
    --dim: #5d6272;
    --red: #e8223c;
    --red-2: #8a0c22;
    --red-glow: rgba(232, 34, 60, .5);
    --gray: #d6dae4;           /* titane */
    --gray-2: #262a36;
    --gold: #d9bb7e;           /* champagne : accents rares / premium */
    --ease: cubic-bezier(.22, 1, .36, 1);
    --glass: blur(14px) saturate(1.25);
}
html, body { background: var(--bg); }   /* pas de fond « fixed » : il pèse sur la composition du canvas WebGL en course */

/* Verre dépoli sur les panneaux et la barre du haut */
.panel, .main-nav, .modal-card { -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.panel { background: linear-gradient(160deg, rgba(20,23,34,.82), rgba(9,10,16,.82)); box-shadow: inset 0 0 0 1px var(--line), inset 0 1px 0 rgba(255,255,255,.06), 0 24px 50px -28px #000; }
.modal-card { background: linear-gradient(165deg, #131622, #0a0c13); box-shadow: inset 0 0 0 1px var(--line-strong), inset 0 3px 0 var(--red), 0 30px 70px -20px #000; }
.modal { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); background: rgba(3,4,8,.7); }
.hub-panel::before { width: 84px; background: linear-gradient(90deg, var(--red), var(--gold)); box-shadow: 0 0 14px var(--red-glow); }
.screen-head h2::after { background: linear-gradient(90deg, var(--red), var(--gold)); }
.brand-name { text-shadow: 0 0 26px rgba(232,34,60,.4); }

/* Boutons : lueur douce, reflet qui passe, retour tactile net */
.btn, .home-play, .mode-btn, .menu-row, .home-tile, .icon-btn, .screen-back, .main-nav button, .segmented button, .nav-arrow, .current-car, .track-card {
    transition: transform .22s var(--ease), filter .22s, background .22s, box-shadow .22s, color .2s, opacity .2s;
    -webkit-tap-highlight-color: transparent;
}
.btn-primary, .mode-go { background: linear-gradient(180deg, #f23650, var(--red) 48%, #a30f27); box-shadow: 0 10px 26px -12px var(--red-glow), inset 0 1px 0 rgba(255,255,255,.25); position: relative; overflow: hidden; }
.btn-primary::after, .mode-go::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%); transform: translateX(-120%); transition: transform .7s var(--ease); pointer-events: none; }
.btn-primary:hover:not(:disabled)::after, .mode-go:hover:not(:disabled)::after { transform: translateX(120%); }
.btn:active:not(:disabled), .mode-btn:active:not(:disabled), .menu-row:active, .home-tile:active, .icon-btn:active { transform: scale(.97); filter: brightness(.95); }
.btn:disabled, .mode-btn:disabled { opacity: .45; filter: saturate(.6); }
.btn-gold, .btn-mint, .btn-light { background: linear-gradient(180deg, #eef0f6, #c3c8d6); color: #0b0c12; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Lignes / modes : verre, filet qui s'allume, glissement léger */
.menu-row, .mode-btn, .home-tile { background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(255,255,255,.018)); }
.menu-row:hover, .mode-btn:hover:not(:disabled), .home-tile:hover {
    background: linear-gradient(90deg, rgba(232,34,60,.22), rgba(255,255,255,.03));
    box-shadow: inset 3px 0 0 var(--red), inset 0 0 0 1px rgba(232,34,60,.4), 0 10px 24px -16px var(--red-glow);
    transform: translateX(4px);
}
.mode-solo { background: linear-gradient(100deg, #f23650, #8a0c22); }
.lb-row.me, .ms-card.ready, .home-missions.ready { background: linear-gradient(90deg, rgba(217,187,126,.12), rgba(232,34,60,.06)); }
.home-missions.ready { box-shadow: inset 3px 0 0 var(--gold), inset 0 0 0 1px rgba(217,187,126,.45); }
.home-missions.ready .mr-txt small { color: var(--gold); }

/* Onglets du bas / du haut : indicateur qui glisse en douceur */
.main-nav button { position: relative; }
.main-nav button svg { transition: transform .3s var(--ease), color .2s; }
.main-nav button.active svg { transform: translateY(-2px) scale(1.1); }
.main-nav button::before { background: linear-gradient(90deg, var(--red), var(--gold)); transition: transform .35s var(--ease); }

/* Entrées : écran qui glisse, éléments qui montent en cascade */
.screen-in { animation: v6In .38s var(--ease) both; }
.screen-back-in { animation: v6InBack .38s var(--ease) both; }
@keyframes v6In { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes v6InBack { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes v6Rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes v6Pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.screen-in > *, .screen-back-in > *, .mode-grid:not([hidden]) > * { animation: v6Rise .45s var(--ease) both; }
.screen-in > *:nth-child(1), .mode-grid:not([hidden]) > *:nth-child(1) { animation-delay: .02s; }
.screen-in > *:nth-child(2), .mode-grid:not([hidden]) > *:nth-child(2) { animation-delay: .06s; }
.screen-in > *:nth-child(3), .mode-grid:not([hidden]) > *:nth-child(3) { animation-delay: .10s; }
.screen-in > *:nth-child(4), .mode-grid:not([hidden]) > *:nth-child(4) { animation-delay: .14s; }
.screen-in > *:nth-child(5), .mode-grid:not([hidden]) > *:nth-child(5) { animation-delay: .18s; }
.screen-in > *:nth-child(6), .mode-grid:not([hidden]) > *:nth-child(6) { animation-delay: .22s; }
.screen-in > *:nth-child(n+7), .mode-grid:not([hidden]) > *:nth-child(n+7) { animation-delay: .26s; }
.modal:not([hidden]) { animation: v6Fade .25s ease both; }
.modal:not([hidden]) .modal-card { animation: v6Pop .42s var(--ease) both; }
@keyframes v6Fade { from { opacity: 0; } to { opacity: 1; } }
.toast { animation: v6Pop .4s var(--ease) both; box-shadow: inset 3px 0 0 var(--gold), 0 14px 34px -12px #000; }
.toast.error { box-shadow: inset 3px 0 0 var(--red), 0 14px 34px -12px #000; }
.toast.out { opacity: 0; transform: translateY(-8px) scale(.98); transition: opacity .3s, transform .3s; }

/* Barres et jauges : remplissage fluide */
.pf-xp i, .ms-bar i, .stat-row i::after, .bt-bar i, .rpm-track i { transition: width .6s var(--ease); }
.pf-xp i, .stat-row i::after { background: linear-gradient(90deg, var(--red-2), var(--red) 70%, #ff6a5a); }

/* Chiffres : alignés, pas de saut de largeur */
.stat-elo b, .stat-coins b, .lb-time, .ms-reward b, .hud-timer, .gauge { font-variant-numeric: tabular-nums; }

/* Défilement doux dans les panneaux */
.hub, .hub-panel, .modal-card, .settings-section { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; scroll-behavior: smooth; }

/* Écran de connexion / pastilles : discrets mais plus fins */
.online-pill, .game-clock, .profile-chip { -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); background: rgba(12,14,22,.7); }
.stat-coins b { color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
    .screen-in, .screen-back-in, .screen-in > *, .screen-back-in > *, .mode-grid > *, .modal:not([hidden]), .modal:not([hidden]) .modal-card, .toast { animation: none !important; }
    .btn::after, .mode-go::after { display: none; }
    * { scroll-behavior: auto !important; }
}

/* Correctif biseaux : un liseré en box-shadow est coupé par le clip-path (barre sur les côtés mais rien sur la diagonale).
   Sur les éléments biseautés on retire le liseré et on garde fond + barre de gauche, qui eux suivent la forme. */
.menu-row, .mode-btn, .home-tile, .current-car, .track-card, .btn-ghost, .icon-btn, .screen-back, .rank-switch-mid { box-shadow: none; }
.menu-row, .mode-btn, .home-tile { background: linear-gradient(90deg, rgba(255,255,255,.075), rgba(255,255,255,.025)); }
.menu-row:hover, .mode-btn:hover:not(:disabled), .home-tile:hover { box-shadow: inset 3px 0 0 var(--red); background: linear-gradient(90deg, rgba(232,34,60,.28), rgba(255,255,255,.04)); }
.mode-btn.is-queuing { box-shadow: inset 3px 0 0 var(--red); background: linear-gradient(90deg, rgba(232,34,60,.34), rgba(232,34,60,.08)); animation: none; }
.home-missions.ready { box-shadow: inset 3px 0 0 var(--gold); }
.current-car { background: rgba(255,255,255,.05); }
.current-car:hover { box-shadow: inset 3px 0 0 var(--red); background: rgba(232,34,60,.12); }
.track-card { background: #0e1018; }
.btn-ghost { background: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.15); }
.icon-btn { background: rgba(14,16,24,.85); }
.icon-btn:hover { background: var(--red); }
.mode-solo:hover:not(:disabled) { box-shadow: inset 4px 0 0 #fff; }

/* Sélection (manette / clavier) : le biseau coupait le contour et la barre rouge (triangle parasite).
   L'élément sélectionné redevient un rectangle net : contour blanc complet + barre rouge à gauche. */
body.pad-mode .pad-focus, .btn:focus-visible, .menu-row:focus-visible, .mode-btn:focus-visible, .home-tile:focus-visible,
.icon-btn:focus-visible, .screen-back:focus-visible, .current-car:focus-visible, .track-card:focus-visible { clip-path: none !important; border-radius: 3px; }
body.pad-mode .pad-focus { box-shadow: inset 0 0 0 2px #fff, inset 6px 0 0 var(--red) !important; }
body.pad-mode .main-nav .pad-focus { box-shadow: inset 0 0 0 2px #fff !important; }

/* Bouton « Lancer la course » : rectangle net (le parallélogramme crénelait et se faisait rogner par le panneau) */
.mode-go { clip-path: none; border-radius: 8px; padding-left: 18px; }
.mode-go:disabled { background: linear-gradient(180deg, #3a1a22, #2a1218); }

/* Recherche d'adversaire : plus de bouton qui tourne. L'icône est remplacée par un simple rond qui charge. */
.mode-btn.is-queuing .mode-ico { animation: none; font-size: 0; color: transparent; background: transparent; clip-path: none; position: relative; }
.mode-btn.is-queuing .mode-ico::after { content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.22); border-top-color: #fff; animation: spin .8s linear infinite; }
.mode-btn.is-queuing .mode-ico * { display: none; }

/* =====================================================================
   PARAMÈTRES : fenêtre à taille maximale et fixe (le contenu défile dedans), lignes « libellé | réglage », infos en bulle « i »
   ===================================================================== */
#settings-modal { padding: calc(8px + var(--safe-t)) 8px calc(8px + var(--safe-b)); }
.settings-card { width: min(720px, 100%); height: 100%; max-height: 780px; display: flex; flex-direction: column; overflow: hidden; padding: 18px 20px 16px; }
.settings-card .modal-head { flex: none; margin-bottom: 10px; }
.settings-card .modal-head h2 { font-size: 1.5rem; }
.settings-tabs { flex: none; margin-bottom: 6px; }
.settings-tabs button { font-size: .95rem; padding: 12px 4px; }
.settings-card .settings-section { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0; padding: 4px 6px 10px 2px; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.settings-card .settings-section[hidden] { display: none; }
#settings-close-btn { flex: none; margin-top: 10px; min-height: 52px; font-size: 1.05rem; }
.settings-card .set-group { font-size: .85rem; margin: 20px 0 8px; }
.settings-card .settings-section > .set-group:first-child { margin-top: 6px; }

/* Ligne de réglage : libellé à gauche, contrôle à droite */
.settings-card .field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 46%); align-items: center; gap: 12px; margin: 0; padding: 11px 0; border-top: 1px solid var(--line); }
.settings-card .set-group + .field { border-top: 0; }
.settings-card .field > span { margin: 0; font-size: 1.02rem; font-weight: 600; color: var(--text); line-height: 1.25; }
.settings-card .field select { padding: 12px 12px; font-size: 1rem; min-height: 46px; }
.settings-card .field input[type=range] { height: 34px; }
.settings-card .toggle { padding: 13px 0; font-size: 1.02rem; min-height: 54px; }
.settings-card .toggle i { width: 52px; height: 30px; }
.settings-card .toggle i::after { width: 24px; height: 24px; top: 3px; left: 3px; }
.settings-card .toggle input:checked + i::after { transform: translateX(22px); }
.settings-card .field-hint { color: var(--muted); font-size: .85rem; }
.settings-card .btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 6px; }
.settings-card .btn-row .btn { min-height: 48px; font-size: .9rem; }
.settings-card .ctrl-ref > summary { font-size: .9rem; padding: 12px 0; }
.settings-card .ctrl-ref table { font-size: .85rem; }
@media (max-width: 460px) {
    .settings-card { padding: 14px 12px 12px; }
    .settings-card .field { grid-template-columns: minmax(0, 1fr) minmax(130px, 44%); gap: 8px; }
    .settings-tabs button { font-size: .8rem; }
    .settings-card .btn-row { grid-template-columns: 1fr; }
}

/* Pastille « i » + info-bulle flottante */
.info { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 6px; vertical-align: 1px; border-radius: 50%; border: 1.5px solid var(--muted); color: var(--muted);
  font: 700 .72rem/1 'Chakra Petch', sans-serif; font-style: normal; cursor: help; user-select: none; -webkit-user-select: none; transition: color .15s, border-color .15s, background .15s; }
.info:hover, .info:focus-visible { color: #fff; border-color: var(--gold); background: rgba(217,187,126,.18); outline: none; }
#info-tip { position: fixed; z-index: 260; padding: 10px 12px; border-radius: 8px; background: #1a1d2b; border: 1px solid var(--line-strong); color: var(--text);
  font-size: .85rem; line-height: 1.4; font-weight: 500; letter-spacing: 0; text-transform: none; font-style: normal; box-shadow: 0 14px 34px -10px #000; pointer-events: none; animation: v6Pop .18s var(--ease) both; }
#info-tip[hidden] { display: none; }
@media (max-width: 460px) { .settings-tabs button { font-size: .72rem; padding: 12px 0; letter-spacing: 0; } }
.settings-card .field-hint { display: inline; margin-left: 4px; }

/* Barre de défilement des paramètres : réserve sa place (plus de contenu dessous), fine, et décalée du bord */
.settings-card .settings-section { scrollbar-gutter: stable; padding-right: 12px; margin-right: 2px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.settings-card .settings-section::-webkit-scrollbar { width: 6px; }
.settings-card .settings-section::-webkit-scrollbar-track { background: transparent; margin: 6px 0; }
.settings-card .settings-section::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); border-radius: 3px; }


/* =====================================================================
   Mobile portrait › choix du circuit : la voiture 3D s'efface, le panneau prend toute la hauteur, l'écran est compacté
   ===================================================================== */
@media (max-width: 899px) and (orientation: portrait) {
    body.screen-track #showroom-zone { visibility: hidden; height: 0; min-height: 0; overflow: hidden; pointer-events: none; }
    body.screen-track #main-menu { grid-template-rows: auto 0 minmax(0, 1fr) auto auto; }
    body.screen-track.logged-in .hub { height: auto; min-height: 0; }
    body.screen-track .hub-panel { background: rgba(8,9,14,.97); }
    body.screen-track .screen-head { min-height: 34px; margin-bottom: 6px; padding-bottom: 6px; }
    body.screen-track .screen-titles small { display: none; }
    body.screen-track .track-for { display: none; }
    body.screen-track #track-preview { aspect-ratio: 16 / 10; }
    body.screen-track #track-profile { height: 22px; }
    body.screen-track .track-head { padding: 8px 10px 0; }
    body.screen-track .track-stats { padding: 4px 10px 8px; gap: 4px; }
    body.screen-track .track-dots { margin: 8px 0 8px; }
    body.screen-track .current-car { min-height: 40px; padding: 6px 12px; margin-bottom: 8px; }
}
@media (max-width: 899px) and (orientation: portrait) {
    body.screen-track #track-preview { aspect-ratio: 4 / 3; }
    body.screen-track #main-menu::before { background: linear-gradient(180deg, #0a0c14, #05060a); opacity: 1; }
}


/* Carrière : régions en « dossiers » (sous-menus avec les étoiles de chaque région) */
.cr-reg { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 14px; color: var(--text); cursor: pointer; border: 0;
  background: linear-gradient(90deg, rgba(255,255,255,.075), rgba(255,255,255,.025)); clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%); font-family: inherit; }
.cr-reg:hover:not(:disabled) { box-shadow: inset 3px 0 0 var(--red); background: linear-gradient(90deg, rgba(232,34,60,.26), rgba(255,255,255,.04)); transform: translateX(3px); }
.cr-reg:disabled { opacity: .5; cursor: default; }
.cr-reg.here { box-shadow: inset 3px 0 0 var(--gold); }
.cr-reg.perfect .cr-reg-stars b { color: var(--gold); }
.cr-reg-ico { width: 44px; height: 44px; display: grid; place-items: center; font-size: 1.4rem; background: rgba(255,255,255,.07); }
.cr-reg-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.cr-reg-txt small { color: var(--gold); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; }
.cr-reg-txt b { font-size: 1.05rem; font-style: italic; text-transform: uppercase; letter-spacing: .04em; }
.cr-reg-txt em { font-style: normal; color: var(--muted); font-size: .78rem; }
.cr-reg-stars { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 84px; }
.cr-reg-stars b { font-size: 1rem; font-variant-numeric: tabular-nums; }
.cr-reg-bar { display: block; width: 84px; height: 5px; background: rgba(255,255,255,.1); overflow: hidden; }
.cr-reg-bar u { display: block; height: 100%; background: linear-gradient(90deg, var(--red-2), var(--red)); text-decoration: none; transition: width .5s var(--ease); }
.cr-reg.perfect .cr-reg-bar u { background: var(--gold); }
.cr-reg-go { color: var(--red); font-size: 1.4rem; }
.cr-region-stars { float: right; color: var(--gold); letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* Replay : jamais de joystick fantôme tactile */
body.replaying #touch-indicator { display: none !important; }


/* =====================================================================
   V6 — HUD EN COURSE PREMIUM : même langage que le menu (nuit bleutée, verre sombre, biseaux, filet rouge → champagne).
   Sans flou d'arrière-plan (le HUD est redessiné à chaque image par-dessus le rendu 3D : un flou coûte cher aux GPU modestes).
   Animations en transform / opacity seulement ; filets et barres suivent la forme (pas de liseré box-shadow sur les biseaux : le clip-path le coupe).
   ===================================================================== */
.hud { text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.hud-card, .gauge, .minimap, .hud-btn, .battle-ui { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Chrono / position */
.hud-card {
    background: linear-gradient(160deg, rgba(20,23,34,.84), rgba(8,9,14,.80));
    border: 0; box-shadow: inset 3px 0 0 var(--red);
    padding: 9px 18px 9px 16px;
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.hud-time { font-size: 1.75rem; letter-spacing: .035em; text-shadow: 0 0 18px rgba(232,34,60,.28), 0 1px 4px rgba(0,0,0,.9); }
.hud-pos { color: var(--gold); text-shadow: 0 0 16px rgba(217,187,126,.35), 0 1px 4px rgba(0,0,0,.9); }
.hud-pos.second { color: var(--gray); text-shadow: none; }
.hud-names { letter-spacing: .08em; text-transform: uppercase; font-size: .66rem; color: var(--muted); }
.hud-opp { color: #ff5266; }

/* Pause, mini-carte */
.hud-btn {
    border: 0; background: linear-gradient(160deg, rgba(20,23,34,.86), rgba(8,9,14,.82));
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transition: background .2s, transform .2s var(--ease);
}
.hud-btn:hover { background: var(--red); }
.hud-btn:active { transform: scale(.94); }
.minimap {
    border: 0; border-radius: 0;
    background: linear-gradient(160deg, rgba(20,23,34,.80), rgba(8,9,14,.78));
    clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}
.mm-me { background: var(--red); border-color: #fff; box-shadow: 0 0 10px var(--red-glow); }
.mm-opp { background: var(--gold); box-shadow: 0 0 10px rgba(217,187,126,.6); }
.hud-ping { letter-spacing: .06em; }

/* Alertes (aspiration, gutter run) */
.hud-alert { border-radius: 0; padding: 5px 24px; letter-spacing: .16em; clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); }
.alert-slip { color: #bff6ff; background: linear-gradient(90deg, rgba(0,200,255,.06), rgba(0,200,255,.22), rgba(0,200,255,.06)); text-shadow: 0 0 12px #00d9ff; }
.alert-gutter { color: var(--gold); background: linear-gradient(90deg, rgba(217,187,126,.06), rgba(217,187,126,.24), rgba(217,187,126,.06)); text-shadow: 0 0 14px rgba(217,187,126,.8); }
.alert-gutter.hint { border: 0; color: #fff; }

/* Compteur : vitesse, rapport, régime en segments */
.gauge {
    position: relative;
    background: linear-gradient(180deg, rgba(20,23,34,.86), rgba(8,9,14,.88));
    border: 0; box-shadow: none;
    clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
    padding: 11px 34px 9px;
}
.gauge::before { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 2px; background: linear-gradient(90deg, transparent, var(--red) 25%, var(--gold) 75%, transparent); }
.rpm-track {
    height: 7px; background: rgba(255,255,255,.07);
    -webkit-mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px); mask: repeating-linear-gradient(90deg, #000 0 6px, transparent 6px 8px);
}
.rpm-track i { background: linear-gradient(90deg, #7d8394 0%, var(--gray) 52%, var(--gold) 76%, #ff6a5a 90%, var(--red) 100%); }
.rpm-track .redline { background: #fff; opacity: .7; }
.speed span { font-size: 2.75rem; color: #fff; letter-spacing: .01em; text-shadow: 0 0 24px rgba(255,255,255,.14), 0 2px 6px rgba(0,0,0,.9); }
.speed small { letter-spacing: .16em; text-transform: uppercase; font-size: .66rem; }
.gear-box { padding: 3px 14px 4px 12px; background: linear-gradient(90deg, rgba(232,34,60,.22), rgba(232,34,60,.05)); box-shadow: inset 3px 0 0 var(--red); clip-path: polygon(0 0, 100% 0, calc(100% - 8px) 100%, 0 100%); }
.gear-box small { letter-spacing: .2em; color: var(--muted); }
.gear-box span { color: #fff; text-shadow: 0 0 16px var(--red-glow), 0 2px 6px rgba(0,0,0,.9); }

/* Battle, rétroviseur */
.battle-ui {
    border: 0; border-radius: 0; box-shadow: inset 0 3px 0 var(--red);
    background: linear-gradient(160deg, rgba(20,23,34,.86), rgba(8,9,14,.84));
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.bt-head { letter-spacing: .1em; }
.bt-head b { color: var(--gold); }
.bt-bar { border-radius: 0; height: 5px; }
.bt-bar i { background: linear-gradient(90deg, #8d93a3, #fff); }
.mirror-ui { border-color: #0b0d14; border-radius: 3px; box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 8px 22px rgba(0,0,0,.6), inset 0 0 14px rgba(0,0,0,.6); }

/* Compte à rebours : même famille de couleurs */
#countdown-ui { letter-spacing: .04em; text-shadow: 0 6px 0 rgba(0,0,0,.55), 0 0 44px rgba(232,34,60,.55); }
#countdown-ui.go { color: var(--red); text-shadow: 0 6px 0 rgba(0,0,0,.55), 0 0 56px rgba(232,34,60,.8); }

/* Entrée du HUD au départ de la course */
@keyframes hudInTop { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes hudInBottom { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
body.in-race .hud-top { animation: hudInTop .6s var(--ease) both; }
body.in-race .hud-bottom { animation: hudInBottom .6s .08s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { body.in-race .hud-top, body.in-race .hud-bottom { animation: none; } }
