/* ==========================================================================
   Daily Race — facade "piste de nuit"
   ========================================================================== */

:root {
    --bg: #090e20;
    --ink: #f5f7ff;
    --ink-soft: #a5b1c9;
    --ink-mute: #8594b0;
    --accent: #d9ff43;
    --accent-ink: #172018;
    --accent-shadow: #8dad29;
    --panel-a: #18243d;
    --panel-b: #111a30;
    --field: #0d172c;
    --line: #ffffff17;
    --line-strong: #ffffff26;
    --danger: #ff7a6b;
    --gold: #ffd970;
    --green: #3ee07a;
    --ice: #8fd8ff;
    --display: 'Barlow Condensed', Impact, sans-serif;
    --tile-h: 105px;

    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 75% -10%, #23365e 0, transparent 45%),
        radial-gradient(ellipse at 0% 65%, #182646 0, transparent 40%),
        var(--bg);
}

button {
    font: inherit;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.shell {
    max-width: 1480px;
    margin: auto;
    padding: 22px 30px 45px;
}

/* ---------- Barre du haut ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px 20px;
    padding-bottom: 22px;
    border-bottom: 1px solid #ffffff1b;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brandmark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: var(--accent);
    color: #111c21;
    font-size: 24px;
    box-shadow: 0 0 30px #d9ff4330;
}

.brandname {
    font-family: var(--display);
    font-size: 30px;
    letter-spacing: .03em;
    font-weight: 900;
    line-height: 1;
}

.brandname span {
    color: var(--accent);
}

.brand small {
    display: block;
    color: #8f9bb7;
    font-size: 11px;
    letter-spacing: .18em;
    margin-top: 3px;
    font-weight: 800;
}

.topright {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pill {
    border: 1px solid var(--line-strong);
    background: #ffffff0a;
    color: #c2cbe0;
    border-radius: 30px;
    padding: 9px 14px;
    margin-right: 5px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.pill i {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ink-mute);
    margin-right: 6px;
}

/* Etat du stockage serveur (js/storage-ui.js) */
.sync-status--saved i {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.sync-status--pending i {
    background: var(--gold);
    animation: sync-blink 1s ease-in-out infinite;
}

.sync-status--error {
    border-color: #ff7a6b88;
    color: #ffd0ca;
}

.sync-status--error i {
    background: var(--danger);
    box-shadow: 0 0 8px var(--danger);
}

@keyframes sync-blink {
    50% { opacity: .3; }
}

.iconbtn {
    background: #ffffff0b;
    border: 1px solid #ffffff1e;
    border-radius: 12px;
    color: #dae2f4;
    width: 39px;
    height: 39px;
    font-size: 16px;
    transition: background .2s, border-color .2s, transform .2s;
}

a.iconbtn {
    display: inline-grid;
    place-items: center;
    text-decoration: none;
}

.iconbtn:hover {
    background: #d9ff4318;
    border-color: #d9ff4366;
    transform: translateY(-2px);
}

/* ---------- Titre ---------- */

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .19em;
}

.heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin: 30px 0 25px;
    gap: 15px;
}

.heading h1 {
    font-family: var(--display);
    font-size: clamp(42px, 5.2vw, 76px);
    line-height: .95;
    text-transform: uppercase;
    margin: 8px 0 0;
    letter-spacing: -.018em;
}

.heading h1 em {
    font-style: normal;
    color: var(--accent);
}

.heading .sub {
    color: var(--ink-soft);
    line-height: 1.5;
    margin: 8px 0 4px;
    max-width: 350px;
    text-align: right;
    font-size: 13px;
}

/* ---------- Boutons ---------- */

.primary {
    border: 0;
    border-radius: 11px;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 15px 26px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .05em;
    box-shadow: 0 7px 0 var(--accent-shadow), 0 15px 30px #d9ff4322;
    transition: transform .18s, box-shadow .18s;
}

.primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 0 var(--accent-shadow), 0 17px 35px #d9ff4340;
}

.primary:active:not(:disabled) {
    transform: translateY(5px);
    box-shadow: 0 2px 0 var(--accent-shadow);
}

.primary--small {
    padding: 10px 16px;
    font-size: 12px;
    box-shadow: 0 4px 0 var(--accent-shadow);
}

.primary--small:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 var(--accent-shadow);
}

.ghost-btn {
    border: 1px solid var(--line-strong);
    background: #ffffff0c;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 800;
    transition: background .2s, border-color .2s;
}

.ghost-btn:hover {
    background: #d9ff4318;
    border-color: #d9ff4366;
}

.ghost-btn--block {
    width: 100%;
    margin-top: 6px;
}

/* ---------- Mise en page ---------- */

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 312px;
    gap: 18px;
}

.left {
    display: grid;
    gap: 18px;
    align-content: start;
}

.aside {
    display: grid;
    gap: 18px;
    align-content: start;
}

.panel {
    background: linear-gradient(145deg, var(--panel-a), var(--panel-b) 70%);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: 0 18px 55px #03071260;
    overflow: hidden;
}

/* ---------- Choix du joueur (multijoueur) ---------- */

.claim-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 16px 20px;
    margin-bottom: 18px;
    border-color: #d9ff4344;
}

.claim-bar p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 13px;
}

.claim-bar__controls {
    display: flex;
    gap: 10px;
}

.claim-bar select {
    background: var(--field);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 9px 12px;
    font: inherit;
    font-size: 13px;
}

/* ---------- Piste ---------- */

.track {
    padding: 0 24px 25px;
}

.track-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 25px 0 18px;
}

.track-head h2,
.side-title h2 {
    font: 800 22px var(--display);
    text-transform: uppercase;
    letter-spacing: .035em;
    margin: 0;
}

.track-head h2 {
    font-size: 27px;
}

.track-head small {
    color: #8c9bb8;
    font-weight: 800;
}

.board-wrap {
    padding: 4px 3px 8px;
    overflow: hidden;
}

.board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(3, var(--tile-h));
    gap: 9px;
    position: relative;
    padding: 12px;
    border-radius: 21px;
    background:
        radial-gradient(circle at 80% 24%, #44673d42, transparent 38%),
        radial-gradient(circle at 18% 84%, #3788a42a, transparent 45%),
        #101d31;
    border: 1px solid #ffffff18;
}

.board::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: .26;
    background-image: radial-gradient(#b9dbfa 1px, transparent 1px);
    background-size: 18px 18px;
    pointer-events: none;
}

.board-road {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    overflow: visible;
    filter: drop-shadow(0 3px 3px #0008);
}

.board-road__edge {
    fill: none;
    stroke: #b5db6d;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.board-road__surface {
    fill: none;
    stroke: #192636;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.board-road__center {
    fill: none;
    stroke: #f7f3d1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 6 10;
    opacity: .72;
}

.tile {
    position: relative;
    min-width: 0;
    overflow: visible;
    border-radius: 14px;
    border: 2px solid #7d91a655;
    background: linear-gradient(145deg, #364963, #263752);
    box-shadow: inset 0 1px #ffffff24, 0 6px 0 #0b1527, 0 11px 12px #050a1580;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform .25s, box-shadow .25s;
}

.tile:nth-child(4n+2) {
    background: linear-gradient(145deg, #31536b, #253951);
}

.tile:nth-child(5n+4) {
    background: linear-gradient(145deg, #62513e, #3b3441);
}

.tile--busy {
    border-color: #d9ff439e;
    box-shadow: inset 0 1px #ffffff48, 0 6px 0 #45542c, 0 0 20px #d9ff4333;
}

.tile--start {
    background: linear-gradient(145deg, #3d5857, #263e4a);
}

.tile--finish {
    background: linear-gradient(145deg, #7b6530, #413b37);
    border-color: var(--gold);
}

.tile-number {
    position: absolute;
    z-index: 3;
    top: 8px;
    left: 9px;
    color: #d9e4f4aa;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .07em;
}

.tile--finish .tile-number {
    color: #ffe9a1;
}

.tile-terrain {
    position: relative;
    z-index: 3;
    font-size: 22px;
    background: #1e3042c9;
    border-radius: 9px;
    padding: 2px 5px;
    opacity: .88;
    transform: translateY(-1px);
    filter: drop-shadow(0 5px 4px #0008);
}

.tile--start .tile-terrain,
.tile--finish .tile-terrain {
    background: #28383ebc;
}

/* Cases speciales du jour : halo vert (bonus) ou rouge (malus). */
.tile--bonus {
    border-color: #3ee07aaa;
    box-shadow: inset 0 1px #ffffff30, 0 6px 0 #1d4a30, 0 0 18px #3ee07a40;
}

.tile--malus {
    border-color: #ff5d5daa;
    box-shadow: inset 0 1px #ffffff30, 0 6px 0 #5a1f26, 0 0 18px #ff5d5d40;
}

.tile-effect {
    opacity: 1;
    font-size: 24px;
    padding: 3px 6px;
    cursor: help;
    animation: tile-effect-float 2.6s ease-in-out infinite;
}

.tile-effect--bonus {
    background: #16392acc;
    box-shadow: 0 0 0 2px #3ee07a88, 0 0 14px #3ee07a66;
}

.tile-effect--malus {
    background: #3f1a22cc;
    box-shadow: 0 0 0 2px #ff5d5d88, 0 0 14px #ff5d5d66;
}

@keyframes tile-effect-float {
    50% { transform: translateY(-4px) scale(1.06); }
}

/* Redistribution des cases en fin de tour (js/render.js) */
.tile-effect--vanish {
    animation: tile-effect-vanish .45s ease-in var(--vanish-delay, 0ms) forwards;
}

@keyframes tile-effect-vanish {
    0% { transform: scale(1) rotate(0); opacity: 1; }
    35% { transform: scale(1.3) rotate(-12deg); opacity: 1; filter: brightness(1.6); }
    100% { transform: scale(0) rotate(160deg); opacity: 0; }
}

.tile--clearing {
    border-color: #7d91a655;
    box-shadow: inset 0 1px #ffffff24, 0 6px 0 #0b1527, 0 11px 12px #050a1580;
    transition: border-color .4s, box-shadow .4s;
}

.tile-effect--appear {
    animation:
        tile-effect-appear .55s cubic-bezier(.34, 1.8, .64, 1) var(--appear-delay, 0ms) backwards,
        tile-effect-float 2.6s ease-in-out calc(var(--appear-delay, 0ms) + .55s) infinite;
}

@keyframes tile-effect-appear {
    0% { transform: scale(0) rotate(-120deg); opacity: 0; }
    70% { transform: scale(1.25) rotate(8deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.tile--pilots-4 .tile-terrain,
.tile--pilots-5 .tile-terrain {
    opacity: .35;
}

.tile-pilots {
    position: absolute;
    z-index: 3;
    bottom: 3px;
    left: 4px;
    right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
}

/* Taille des pions selon le nombre de joueurs sur la case. */
.tile--pilots-1 { --ps: 46px; }
.tile--pilots-2 { --ps: 38px; }
.tile--pilots-3 { --ps: 31px; }
.tile--pilots-4 { --ps: 27px; }
.tile--pilots-5 { --ps: 24px; }

.tile--pilots-4 .tile-pilots,
.tile--pilots-5 .tile-pilots {
    gap: 0;
}

.tile--pilots-5 .pilot {
    margin: -2px -1px;
}

.pilot {
    position: relative;
    z-index: 4;
    display: grid;
    place-items: center;
    width: var(--ps, 31px);
    height: var(--ps, 31px);
    border: 2px solid var(--pilot);
    border-radius: calc(var(--ps, 31px) * .32);
    background: #101b2d;
    font-size: calc(var(--ps, 31px) * .6);
    box-shadow: 0 4px 8px #0009, 0 0 8px var(--pilot);
    transition: width .3s, height .3s, font-size .3s;
}

/* Etats visibles sur le pion */
.pilot__statuses {
    position: absolute;
    left: -7px;
    top: -9px;
    display: flex;
    gap: 1px;
    pointer-events: auto;
}

.pilot__status {
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #0b1320;
    border: 1px solid #ffffff55;
    font-size: 10px;
    line-height: 1;
    box-shadow: 0 2px 4px #000a;
}

.pilot--frozen {
    background: linear-gradient(160deg, #cfeeff, #6fb7ea);
    box-shadow: 0 4px 8px #0009, 0 0 12px #8fd8ff;
}

.pilot--frozen .pilot__face {
    filter: saturate(.4) brightness(1.1);
}

.pilot--puncture .pilot__face {
    filter: grayscale(.6);
}

.pilot--shield::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid #00c8ffbf;
    background: radial-gradient(circle, transparent 55%, #00c8ff33);
    animation: shield-bubble-pulse 2.2s ease-in-out infinite;
    pointer-events: none;
}

.pilot--vacation {
    opacity: .6;
}

.pilot__face {
    display: block;
    line-height: 1;
}

.pilot--active {
    z-index: 5;
    animation: pilot-pulse 1.5s ease-in-out infinite;
}

.pilot--success .pilot__face {
    animation: pilot-pop-success .6s ease;
}

.pilot--fail .pilot__face {
    animation: pilot-pop-fail .5s ease;
}

@keyframes pilot-pulse {
    50% { box-shadow: 0 0 0 5px #d9ff4330, 0 0 16px var(--pilot); }
}

@keyframes pilot-pop-success {
    40% { transform: scale(1.5) rotate(10deg); }
}

@keyframes pilot-pop-fail {
    20% { transform: translateX(-6px) rotate(-8deg); }
    40% { transform: translateX(6px) rotate(8deg); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.finish-deco {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: #c5d3e6;
    letter-spacing: .12em;
}

.finish-deco > span {
    font-size: 36px;
    filter: drop-shadow(0 7px 7px #0008);
}

.finish-deco b {
    font: 900 20px/.88 var(--display);
    margin-top: 4px;
}

.finish-deco small {
    font-size: 9px;
    color: #8197b6;
    margin-top: 8px;
    letter-spacing: 0;
}

/* ---------- Classement ---------- */

.score-section {
    margin: 15px 3px 0;
    border-top: 1px solid #ffffff20;
    padding-top: 18px;
}

.score-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 2px 12px;
}

.score-section__head h3 {
    font: 800 18px var(--display);
    letter-spacing: .07em;
    margin: 0;
}

.add-player-form {
    display: flex;
    gap: 6px;
}

.add-player-form input {
    width: 170px;
    background: var(--field);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    padding: 8px 11px;
    font: inherit;
    font-size: 12px;
}

.add-player-form input::placeholder {
    color: #6f7f9c;
}

.add-player-form button {
    border: 1px solid #d9ff4366;
    background: #d9ff4314;
    color: var(--accent);
    border-radius: 9px;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    white-space: nowrap;
}

.add-player-form button:hover {
    background: #d9ff432b;
}

.score-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.empty-hint {
    grid-column: 1 / -1;
    color: var(--ink-mute);
    font-size: 13px;
    padding: 18px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
}

.score-row {
    display: flex;
    align-items: center;
    gap: 9px;
    background: var(--field);
    border: 1px solid #ffffff18;
    border-radius: 11px;
    padding: 8px 10px;
    min-width: 0;
    box-shadow: inset 3px 0 var(--player-color);
    transition: border-color .3s, background .3s;
}

.score-row--first {
    border-color: #d9ff4377;
    background: #d9ff430c;
}

.score-row--turn {
    border-color: var(--accent);
    box-shadow: inset 3px 0 var(--player-color), 0 0 16px #d9ff4333;
}

.score-row--vacation {
    opacity: .6;
}

.score-row__rank {
    font: 900 18px var(--display);
    color: #8b9cb8;
    width: 21px;
    flex: none;
}

.score-row--first .score-row__rank {
    color: var(--accent);
}

.score-row__avatar-wrap {
    position: relative;
    flex: none;
}

.score-row__avatar {
    display: grid;
    place-items: center;
    width: 33px;
    height: 33px;
    border: 0;
    border-radius: 9px;
    background: var(--player-color);
    font-size: 20px;
    padding: 0;
    transition: transform .2s;
}

.score-row__avatar:hover {
    transform: scale(1.1) rotate(-6deg);
}

.score-row__name {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.score-row__bonuses {
    flex: none;
    font-family: inherit;
    background: transparent;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    color: #6f7f9c;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 2px 7px;
    white-space: nowrap;
    user-select: none;
    transition: transform .15s, border-color .15s;
}

.score-row__bonuses:hover {
    transform: scale(1.1);
    border-color: var(--gold);
}

.score-row__bonuses--active {
    position: relative;
    overflow: hidden;
    color: #2b2600;
    background: linear-gradient(135deg, #fff3c4, var(--gold));
    border-color: var(--gold);
    box-shadow: 0 0 8px #ffd23f66;
}

.score-row__bonuses--active::after {
    content: "";
    position: absolute;
    top: -120%;
    left: -40%;
    width: 35%;
    height: 340%;
    background: linear-gradient(120deg, #fff0 0%, #fffffff2 50%, #fff0 100%);
    transform: rotate(20deg);
    animation: medal-shine 3.2s ease-in-out infinite;
    animation-delay: var(--shine-delay, 0s);
}

@keyframes medal-shine {
    0% { left: -40%; }
    20%, 100% { left: 140%; }
}

.score-row__points {
    display: flex;
    align-items: baseline;
    gap: 3px;
    white-space: nowrap;
    color: #fff;
    flex: none;
}

.score-row__points b {
    font: 900 24px var(--display);
}

.score-row__points small {
    font-size: 11px;
    color: #8b9cb8;
}

.score-row--first .score-row__points b {
    color: var(--accent);
}

.score-row__tools {
    display: flex;
    gap: 3px;
    flex: none;
}

.row-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-mute);
    font-size: 13px;
    opacity: .45;
    filter: grayscale(1);
    transition: opacity .2s, background .2s, filter .2s;
}

.score-row:hover .row-btn,
.row-btn:focus-visible {
    opacity: .8;
}

.row-btn:hover {
    opacity: 1;
    filter: none;
    background: #ffffff12;
}

.row-btn--active {
    opacity: 1;
    filter: none;
    background: #d9ff431f;
    border-color: #d9ff4355;
}

.row-btn--remove:hover {
    color: var(--danger);
    background: #ff7a6b1f;
}

/* Indicateurs d'effet passif (bouclier, givre...) poses sur l'avatar */
.status-badge {
    position: absolute;
    pointer-events: none;
}

.status-badge--shield {
    inset: -5px;
    border-radius: 12px;
    border: 2px solid #00c8ffbf;
    background: radial-gradient(circle, #00c8ff2e, transparent 70%);
    animation: shield-bubble-pulse 2.2s ease-in-out infinite;
}

@keyframes shield-bubble-pulse {
    0%, 100% { transform: scale(1); opacity: .75; }
    50% { transform: scale(1.1); opacity: 1; }
}

.status-badge--frozen {
    inset: -2px;
    border-radius: 10px;
    background: linear-gradient(160deg, #ceeeffe6, #78c3ffa6);
    border: 2px solid #ffffffd9;
    box-shadow: 0 0 8px #96dcffb3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
}

.status-badge--frozen::after {
    content: "❄️";
}

.race-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-top: 1px solid #ffffff16;
    margin-top: 19px;
    padding-top: 16px;
    color: #9daccc;
    font-size: 11px;
}

.race-footer b {
    color: var(--accent);
}

/* ---------- Colonne droite ---------- */

.standings,
.feed {
    padding: 21px;
}

.draw-box {
    position: relative;
    overflow: hidden;
    margin: -21px -21px 23px;
    padding: 22px 20px 25px;
    background:
        radial-gradient(circle at 90% 0%, #dcff4628, transparent 46%),
        linear-gradient(135deg, #263e38, #182943);
    border-bottom: 1px solid #d9ff4338;
}

.draw-box__kicker {
    color: var(--accent);
    letter-spacing: .14em;
    font-size: 10px;
    font-weight: 900;
}

.draw-box__title {
    font: 900 25px/.95 var(--display);
    text-transform: uppercase;
    margin: 13px 0 18px;
}

.draw-box__button {
    width: 100%;
    font-size: 12px;
    padding: 15px 13px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 9px;
}

.draw-box__button span {
    font-size: 18px;
    line-height: .7;
}

.draw-box__note {
    margin: 0;
    color: #c4d2b8;
    font-size: 12px;
    line-height: 1.5;
}

/* ---------- Console du tour ---------- */

#draw-controls {
    position: relative;
    z-index: 1;
}

.draw-box--live {
    background:
        radial-gradient(circle at 90% 0%, #dcff4633, transparent 46%),
        linear-gradient(160deg, #2a4a3c, #182943 70%);
    border-bottom-color: #d9ff4366;
}

.draw-box--fail {
    background:
        radial-gradient(circle at 90% 0%, #ff7a6b30, transparent 46%),
        linear-gradient(160deg, #4a2a32, #182943 70%);
    border-bottom-color: #ff7a6b66;
}

.console {
    display: grid;
    gap: 12px;
    text-align: center;
    animation: console-in .3s ease;
}

@keyframes console-in {
    from { opacity: 0; transform: translateY(6px); }
}

.console .cap {
    color: var(--accent);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .16em;
    text-align: left;
}

.draw-box--fail .cap,
.draw-box--fail .console h2 span {
    color: var(--danger);
}

.console h2 {
    font: 900 32px/.95 var(--display);
    text-transform: uppercase;
    margin: 0;
    overflow-wrap: anywhere;
}

.draw-box--fail .console h2 {
    animation: result-shake .5s ease .1s;
}

.console h2 span {
    color: var(--accent);
}

.console p {
    margin: 0;
    color: #c9d6c4;
    font-size: 12px;
    line-height: 1.5;
}

.console .ghost-btn--block {
    margin-top: 0;
}

.console .resultbtn {
    margin-top: 4px;
}

.console-icon {
    font-size: 54px;
    line-height: 1.1;
    filter: drop-shadow(0 8px 6px #0008);
    animation: avatar-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}

.console-pilot {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: #0c152acc;
    border: 1px solid #ffffff1a;
    box-shadow: inset 3px 0 var(--player-color);
    text-align: left;
}

.console-pilot__avatar {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 10px;
    background: var(--player-color);
    font-size: 22px;
}

.console-pilot__name {
    flex: 1;
    min-width: 0;
}

.console-pilot__name small {
    display: block;
    color: var(--accent);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .14em;
}

.console-pilot__name b {
    display: block;
    font: 900 20px var(--display);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.console-pilot__bonuses {
    flex: none;
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--ink-mute);
}

.console .console-question {
    color: #fff;
    font-weight: 800;
    font-size: 15px;
}

.console .console-hint {
    color: #b8c6b0;
    font-size: 11px;
}

.console .target-picker {
    justify-content: center;
}

.console .yesno {
    margin-top: 0;
    gap: 9px;
}

.console .yesno__btn {
    padding: 14px 6px 12px;
}

.console .yesno__mark {
    width: 52px;
    height: 52px;
    font-size: 30px;
}

.console .dice-stage {
    margin: 4px 0 0;
    gap: 12px;
}

.console .die-svg {
    width: 96px;
    height: 96px;
}

.console .bonus-reveal,
.console .tile-reveal {
    margin: 0;
    max-width: none;
    padding: 14px;
}

.peek-list--console {
    margin: 0;
    text-align: left;
}

.bonus-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d9ff4355;
    border-radius: 12px;
    background: #0c152acc;
    color: var(--ink);
    font-size: 13px;
    text-align: left;
    transition: background .2s, border-color .2s, transform .2s;
}

.bonus-choice:hover {
    background: #d9ff431f;
    border-color: var(--accent);
    transform: translateY(-2px);
}

.bonus-choice small,
.peek-item small {
    display: block;
    color: var(--ink-mute);
    font-size: 11px;
    margin-top: 2px;
}

.peek-item--muted {
    opacity: .55;
}

.peek-item--selected {
    border-color: var(--accent);
    text-align: left;
}

/* Aides sur le plateau pendant le tour */
.tile--reach {
    border-color: var(--accent);
    animation: reach-glow 1.4s ease-in-out infinite;
}

@keyframes reach-glow {
    0%, 100% { box-shadow: inset 0 0 0 2px #d9ff4355, 0 6px 0 #45542c, 0 0 14px #d9ff4333; }
    50% { box-shadow: inset 0 0 0 2px #d9ff43aa, 0 6px 0 #45542c, 0 0 26px #d9ff4377; }
}

.tile-reach {
    position: absolute;
    z-index: 3;
    top: 6px;
    right: 7px;
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--accent);
    color: var(--accent-ink);
    font: 900 13px var(--display);
    letter-spacing: .03em;
}

.pilot--target {
    z-index: 6;
    cursor: pointer;
    animation: target-pulse 1s ease-in-out infinite;
}

.pilot--target::after {
    content: "🎯";
    position: absolute;
    top: -13px;
    right: -11px;
    font-size: 14px;
    filter: drop-shadow(0 2px 2px #000a);
}

.pilot--target:hover,
.pilot--target:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

@keyframes target-pulse {
    50% { box-shadow: 0 0 0 6px #ff5d8f66, 0 0 20px #ff5d8f; }
}

/* Combo : bannière qui grossit avec le nombre de cases enchaînées. */
.combo-banner {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 14px;
    background: linear-gradient(100deg, #ff5d8f, #ffab64 45%, #ffd970);
    color: #1b0f14;
    font: 900 calc(20px + var(--combo, 2) * 3px) / 1 var(--display);
    letter-spacing: .05em;
    text-transform: uppercase;
    box-shadow: 0 0 0 3px #ffd97055, 0 0 30px #ff8c6a88;
    animation: combo-pop .6s cubic-bezier(.34, 1.8, .64, 1), combo-glow 1.2s ease-in-out .6s infinite;
}

.combo-banner b {
    font-size: 1.5em;
}

@keyframes combo-pop {
    0% { transform: scale(.3) rotate(-8deg); opacity: 0; }
    60% { transform: scale(1.15) rotate(3deg); opacity: 1; }
}

@keyframes combo-glow {
    50% { box-shadow: 0 0 0 5px #ffd97088, 0 0 44px #ff8c6acc; transform: scale(1.03); }
}

.combo-steps {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: combo;
    text-align: left;
}

.combo-step {
    --tone: #3ee07a;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 11px;
    background: #0c152acc;
    border: 1px solid color-mix(in srgb, var(--tone) 50%, transparent);
    font-size: 12px;
    counter-increment: combo;
    animation: console-in .3s ease backwards;
}

.combo-step:nth-child(2) { animation-delay: .1s; }
.combo-step:nth-child(3) { animation-delay: .2s; }
.combo-step:nth-child(4) { animation-delay: .3s; }

.combo-step::before {
    content: counter(combo);
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    flex: none;
    border-radius: 50%;
    background: var(--tone);
    color: #0b1320;
    font: 900 12px var(--display);
}

.combo-step--malus {
    --tone: #ff5d5d;
}

.combo-step__icon {
    font-size: 20px;
    flex: none;
}

.combo-step b {
    display: block;
    color: var(--tone);
}

.combo-step small {
    display: block;
    color: #d6e0ee;
    font-size: 11px;
    margin-top: 1px;
}

.combo-steps--compact {
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
}

.combo-steps--compact .combo-step {
    padding: 5px 7px;
    font-size: 11px;
    gap: 6px;
}

.combo-steps--compact .combo-step__icon {
    font-size: 16px;
}

.bonus-recap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 12px;
    background: #16392a99;
    border: 1px solid #3ee07a66;
    text-align: left;
    font-size: 12px;
    line-height: 1.4;
}

.bonus-recap small {
    display: block;
    color: #3ee07a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .14em;
}

.bonus-recap--blocked {
    background: #0f2e3f99;
    border-color: #00c8ff66;
}

.bonus-recap--blocked small {
    color: #00c8ff;
}

.bonus-recap__icon {
    font-size: 22px;
    flex: none;
}

.bonus-recap--compact {
    padding: 6px 9px;
    font-size: 11px;
}

.side-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.side-title span {
    color: var(--accent);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.podium {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
    text-align: center;
    padding-top: 12px;
}

.podium > div {
    flex: 1;
    min-width: 0;
}

.podium .face {
    font-size: 26px;
    display: block;
    filter: drop-shadow(0 7px 4px #0008);
    margin-bottom: 8px;
}

.podium b {
    display: block;
    font-size: 11px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    margin-bottom: 8px;
}

.podium .step {
    display: grid;
    place-items: center;
    border-radius: 9px 9px 2px 2px;
    background: #ffffff11;
    font: 900 24px var(--display);
    height: 47px;
    color: #bfc6d5;
}

.podium > div:nth-child(2) .step {
    height: 70px;
    color: var(--accent);
    background: #d9ff431a;
}

.podium > div:nth-child(3) .step {
    height: 38px;
}

.podium .step small {
    display: block;
    font: 700 10px 'DM Sans', system-ui, sans-serif;
    color: var(--ink-mute);
    margin-top: -4px;
}

.podium--victory {
    margin: 18px auto 4px;
    max-width: 360px;
    color: #fff;
}

.podium--victory .face {
    font-size: 34px;
}

.podium--victory b {
    font-size: 13px;
}

.podium--victory > div:nth-child(2) .step {
    color: var(--gold);
    background: #ffd97026;
    box-shadow: 0 0 24px #ffd97033;
}

.podium__vacant {
    opacity: .35;
}

.podium__empty {
    margin: 0;
    color: var(--ink-mute);
    font-size: 12px;
}

.info-strip {
    background: #0c152a;
    border-radius: 12px;
    padding: 12px;
    margin-top: 17px;
    color: #aebad4;
    font-size: 11px;
    line-height: 1.5;
}

.info-strip strong {
    color: #fff;
}

.feed-list {
    list-style: none;
    margin: 0 -6px 0 0;
    padding: 0 6px 0 0;
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ffffff2a transparent;
}

.feed-empty {
    color: var(--ink-mute);
    font-size: 12px;
}

.event {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #ffffff14;
    align-items: start;
}

.event:first-child {
    padding-top: 0;
}

.event:last-child {
    border: 0;
    padding-bottom: 0;
}

.eventicon {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    background: #ffffff11;
    border-radius: 9px;
}

.event b {
    display: block;
    font-size: 11px;
    line-height: 1.45;
}

.event small {
    display: block;
    color: #7f8ea9;
    font-size: 10px;
    margin-top: 4px;
}

/* ---------- Modales ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 20px;
    background: #05091acf;
    backdrop-filter: blur(8px);
    animation: overlay-in .2s ease;
}

.overlay--top {
    z-index: 30;
}

/* Ecran bloquant du stockage : au-dessus de tout, y compris des dialogues. */
.overlay--blocking {
    z-index: 70;
}

.storage-sheet {
    text-align: center;
}

.storage-sheet__icon {
    display: block;
    font-size: 44px;
    margin-bottom: 6px;
}

.dialog-actions--center {
    justify-content: center;
}

.dialog-actions a {
    text-decoration: none;
}

.overlay__backdrop {
    position: absolute;
    inset: 0;
}

@keyframes overlay-in {
    from { opacity: 0; }
}

.sheet {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    padding: 24px;
    background: linear-gradient(145deg, var(--panel-a), var(--panel-b) 70%);
    border: 1px solid var(--line-strong);
    border-radius: 22px;
    box-shadow: 0 40px 100px #000b;
    animation: sheet-in .3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes sheet-in {
    from { transform: translateY(14px) scale(.96); opacity: 0; }
}

.sheet__title {
    font: 900 26px var(--display);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin: 0 0 16px;
}

.dialog-message {
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
    white-space: pre-wrap;
}

.field {
    width: 100%;
    background: var(--field);
    color: var(--ink);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    margin-bottom: 16px;
    resize: vertical;
}

.field:focus {
    border-color: #d9ff4399;
}

textarea.field {
    font-family: ui-monospace, monospace;
    font-size: 12px;
    word-break: break-all;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.settings-section {
    margin-bottom: 18px;
}

.settings-label {
    display: block;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
    margin: 0 0 8px;
}

.settings-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.settings-row {
    flex-wrap: wrap;
}

.settings-row .field {
    margin: 0;
    width: 90px;
}

.settings-mini-label {
    color: var(--ink-mute);
    font-size: 12px;
    font-weight: 800;
}

.settings-row .field + .settings-mini-label {
    margin-left: 4px;
}

.settings-hint--spaced {
    margin-bottom: 10px;
}

.tiles-grid {
    display: grid;
    grid-template-columns: auto auto 1fr auto 1fr;
    align-items: center;
    gap: 8px;
}

.tiles-grid .field {
    width: 100%;
    margin: 0;
}

.tiles-grid__kind {
    font-size: 13px;
    font-weight: 800;
    padding-right: 4px;
}

.tiles-apply {
    margin-top: 12px;
}

.sheet--wide {
    max-width: 620px;
}

.debug-list {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.debug-player {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: var(--field);
    border: 1px solid var(--line);
    box-shadow: inset 3px 0 var(--player-color);
}

.debug-player__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.debug-player__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--player-color);
    font-size: 19px;
}

.debug-player__head b {
    flex: 1;
    font-size: 14px;
}

.debug-player__score {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-mute);
    font-size: 12px;
    font-weight: 800;
}

.debug-player__score .field {
    width: 70px;
    margin: 0;
}

.debug-player__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.debug-player__row .field {
    width: auto;
    margin: 0;
    padding: 6px 8px;
    font-size: 12px;
}

.debug-label {
    min-width: 96px;
    color: var(--ink-mute);
    font-size: 11px;
    font-weight: 800;
}

.debug-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.debug-chip {
    border: 1px solid #ffd97066;
    background: #ffd9701a;
    color: var(--ink);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.debug-chip:hover {
    border-color: var(--danger);
    background: #ff7a6b26;
}

.debug-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.settings-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.settings-hint {
    margin: 0;
    color: var(--ink-mute);
    font-size: 12px;
    line-height: 1.4;
}

.bonus-weights {
    display: grid;
    gap: 6px;
}

.drop-section {
    margin: 14px 0 2px;
    font: 900 18px var(--display);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.drop-section:first-of-type {
    margin-top: 0;
}

.drop-section small {
    font: 500 11px 'DM Sans', system-ui, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-mute);
    margin-left: 6px;
}

.drop-warning {
    margin: 0 0 6px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #ffd9701a;
    border: 1px solid #ffd97055;
    color: #ffe9a1;
    font-size: 12px;
    line-height: 1.4;
}

.drop-row {
    --tone: var(--accent);
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto 44px;
    grid-template-areas:
        "icon label sources sources"
        "range range range value";
    align-items: center;
    gap: 6px 10px;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 9px 12px;
    transition: opacity .2s;
}

.drop-row--malus {
    --tone: #ff5d5d;
}

.drop-row--off {
    opacity: .5;
}

.drop-row__icon {
    grid-area: icon;
    font-size: 18px;
}

.drop-row__label {
    grid-area: label;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drop-row__sources {
    grid-area: sources;
    display: flex;
    gap: 10px;
}

.drop-check {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
}

.drop-check input {
    accent-color: var(--tone);
    width: 15px;
    height: 15px;
    margin: 0;
}

.drop-range {
    grid-area: range;
    width: 100%;
    margin: 0;
    accent-color: var(--tone);
    cursor: pointer;
}

.drop-value {
    grid-area: value;
    text-align: right;
    font: 900 18px var(--display);
    color: var(--tone);
}

.peek-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 7px;
}

.peek-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--field);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
}

.peek-item small {
    display: block;
    color: var(--ink-mute);
    font-size: 12px;
    margin-top: 2px;
}

.peek-item em {
    color: var(--ink-mute);
    font-size: 12px;
}

.peek-item__icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 10px;
    background: #ffffff11;
    font-size: 18px;
}

.peek-item--stacked {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.peek-section {
    margin-top: 8px;
    font: 900 18px var(--display);
    letter-spacing: .06em;
    text-transform: uppercase;
}

.peek-section:first-child {
    margin-top: 0;
}

.peek-section small {
    display: block;
    font: 500 12px 'DM Sans', system-ui, sans-serif;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink-mute);
    margin-top: 2px;
}

.peek-item--bonus .peek-item__icon {
    box-shadow: inset 0 0 0 1px #3ee07a66;
}

.peek-item--malus .peek-item__icon {
    box-shadow: inset 0 0 0 1px #ff5d5d66;
}

.peek-item__head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.target-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.target-btn {
    border: 1px solid #d9ff4366;
    background: #d9ff4314;
    color: var(--ink);
    border-radius: 9px;
    padding: 7px 11px;
    font-size: 12px;
    font-weight: 800;
    transition: background .2s, transform .2s;
}

.target-btn:hover {
    background: #d9ff4333;
    transform: translateY(-2px);
}

/* ---------- Modale du tour ---------- */

.reveal {
    position: relative;
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow: hidden auto;
    border: 1px solid #d9ff4366;
    background:
        repeating-conic-gradient(from 7deg at 50% 75px, #d9ff4307 0 12deg, transparent 12deg 26deg),
        radial-gradient(circle at 50% 20%, #304b47, #182744 55%, #11192c);
    border-radius: 28px;
    padding: 39px 27px 32px;
    text-align: center;
    box-shadow: 0 0 0 8px #d9ff430a, 0 40px 100px #000b;
    animation: sheet-in .35s cubic-bezier(.34, 1.56, .64, 1);
}

#turn-content {
    position: relative;
}

.reveal .cap {
    font-size: 11px;
    color: var(--accent);
    font-weight: 900;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.reveal-avatar {
    font-size: 88px;
    line-height: 1.1;
    display: block;
    margin: 18px 0 2px;
    filter: drop-shadow(0 13px 8px #0008);
    animation: avatar-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}

.substitute-name {
    color: var(--green);
    font-weight: 900;
}

.reveal-avatar--handover {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 72px;
}

.reveal-avatar--handover > span:first-child {
    filter: grayscale(.35);
    opacity: .85;
}

.reveal-avatar__arrow {
    font-size: 40px;
    color: var(--accent);
    animation: handover-arrow 1s ease-in-out infinite;
}

@keyframes handover-arrow {
    50% { transform: translateX(8px); }
}

.reveal-avatar--spin {
    animation: none;
}

@keyframes avatar-pop {
    from { transform: scale(.3) rotate(-20deg); opacity: 0; }
}

.reveal h2 {
    font: 900 52px/.92 var(--display);
    text-transform: uppercase;
    margin: 13px 0;
    color: #fff;
    overflow-wrap: anywhere;
}

.reveal h2 span {
    color: var(--accent);
}

.reveal p {
    color: #adbcd6;
    font-size: 13px;
    line-height: 1.5;
    margin: 0 0 4px;
}

.reveal--fail {
    border-color: #ff7a6b88;
    box-shadow: 0 0 0 8px #ff7a6b0f, 0 40px 100px #000b;
}

.reveal--fail h2 {
    animation: result-shake .5s ease .1s;
}

.reveal--fail h2 span,
.reveal--fail .cap {
    color: var(--danger);
}

@keyframes result-shake {
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.yesno {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}

.yesno__btn {
    --tone: var(--accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 18px 10px 16px;
    border: 1px solid #ffffff25;
    border-radius: 18px;
    background: #ffffff0c;
    color: #fff;
    transition: background .2s, border-color .2s, transform .2s;
}

.yesno__btn--yes {
    --tone: #3ee07a;
}

.yesno__btn--no {
    --tone: #ff5d5d;
}

.yesno__btn:hover {
    transform: translateY(-3px);
    border-color: var(--tone);
    background: color-mix(in srgb, var(--tone) 16%, transparent);
}

.yesno__mark {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: var(--tone);
    color: #0b1320;
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 6px 0 color-mix(in srgb, var(--tone) 60%, #000), 0 12px 26px color-mix(in srgb, var(--tone) 35%, transparent);
    transition: transform .2s;
}

.yesno__btn:hover .yesno__mark {
    transform: scale(1.08);
}

.yesno__btn b {
    font: 900 22px var(--display);
    letter-spacing: .06em;
}

.yesno__btn small {
    color: #a8b5cf;
    font-size: 11px;
}

/* De special a 4 faces : 1 a 3 cases ou boite cadeau */
.dice-stage {
    display: grid;
    justify-items: center;
    gap: 15px;
    margin: 20px 0 6px;
}

.dice-stage--result {
    margin: 18px 0 4px;
}

.dice-stage .primary {
    width: min(100%, 270px);
}

.dice-rule {
    color: #dbe9c0;
    font-weight: 800;
    font-size: 12px;
}

.die-svg {
    display: block;
    width: 112px;
    height: 112px;
    overflow: visible;
    filter: drop-shadow(0 9px 11px #0008);
    transform: perspective(500px) rotateX(7deg) rotateZ(-8deg);
    transform-origin: center;
}

.die-svg.is-rolling {
    animation: die-roll .14s ease-in-out infinite alternate;
    filter: drop-shadow(0 15px 13px #0009);
}

@keyframes die-roll {
    from { transform: perspective(500px) rotateX(-15deg) rotateZ(-24deg) translate(-5px, 2px); }
    to { transform: perspective(500px) rotateX(20deg) rotateZ(19deg) translate(5px, -7px); }
}

.dice-stage--result .die-svg {
    animation: die-land .5s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes die-land {
    from { transform: perspective(500px) rotateZ(-40deg) scale(.6); opacity: 0; }
}

.die-svg .special-face {
    display: none;
}

.die-svg[data-value="1"] .face-1,
.die-svg[data-value="2"] .face-2,
.die-svg[data-value="3"] .face-3,
.die-svg[data-value="4"] .face-4 {
    display: block;
}

.die-svg .die-number {
    font-family: Impact, 'Barlow Condensed', sans-serif;
    font-size: 43px;
    font-weight: 900;
    text-anchor: middle;
    dominant-baseline: middle;
    fill: #202e41;
    paint-order: stroke;
    stroke: #fff8;
    stroke-width: .8px;
}

.die-svg .road-mark {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.die-svg .road-mark path:first-child {
    stroke: #293c52;
    stroke-width: 6;
}

.die-svg .road-mark path:last-child {
    stroke: #e2ffad;
    stroke-width: 2;
    stroke-dasharray: 2 4;
}

.die-svg .gift-ribbon {
    fill: none;
    stroke: #d64d57;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.die-svg .gift-bow {
    fill: #ffcc55;
    stroke: #ad7531;
    stroke-width: 2;
    stroke-linejoin: round;
}

.resultbtn {
    margin-top: 20px;
}

.bonus-reveal {
    margin: 18px auto 0;
    max-width: 360px;
    padding: 18px;
    border-radius: 16px;
    background: #0c152acc;
    border: 1px solid #ffd97066;
    box-shadow: 0 0 24px #ffd9701f;
    animation: card-flip .6s cubic-bezier(.34, 1.56, .64, 1);
}

.bonus-reveal__icon {
    display: block;
    font-size: 40px;
}

.bonus-reveal strong {
    display: block;
    font: 900 24px var(--display);
    text-transform: uppercase;
    color: var(--gold);
    margin: 4px 0;
}

.bonus-reveal__note {
    color: var(--ink-mute);
    font-size: 11px;
    margin-top: 10px;
}

@keyframes card-flip {
    from { transform: perspective(600px) rotateY(90deg); opacity: 0; }
}

.tile-reveal {
    --tone: #3ee07a;
    margin: 18px auto 0;
    max-width: 360px;
    padding: 16px 18px 18px;
    border-radius: 16px;
    background: #0c152acc;
    border: 1px solid color-mix(in srgb, var(--tone) 55%, transparent);
    box-shadow: 0 0 24px color-mix(in srgb, var(--tone) 20%, transparent);
    animation: card-flip .6s cubic-bezier(.34, 1.56, .64, 1) .2s backwards;
}

.tile-reveal--malus {
    --tone: #ff5d5d;
}

.tile-reveal__kicker {
    display: block;
    color: var(--tone);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .16em;
}

.tile-reveal__icon {
    display: block;
    font-size: 40px;
    margin-top: 6px;
}

.tile-reveal strong {
    display: block;
    font: 900 24px var(--display);
    text-transform: uppercase;
    color: var(--tone);
    margin: 4px 0;
}

.tile-reveal p {
    color: #e4ebf7;
}

.target-picker--center {
    justify-content: center;
    margin-top: 12px;
}

.target-btn--big {
    padding: 11px 16px;
    font-size: 14px;
}

.peek-list--reveal {
    margin: 20px 0 0;
}

.confetti {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 2;
}

.confetti i {
    position: absolute;
    left: var(--x);
    top: -20px;
    width: 8px;
    height: 14px;
    background: var(--color);
    transform: rotate(var(--rot));
    animation: fall 1.7s ease-in forwards;
    animation-delay: var(--delay);
}

@keyframes fall {
    to { top: 105%; transform: rotate(650deg); }
}

/* Victoire */
.reveal--victory {
    border-color: var(--gold);
    box-shadow: 0 0 0 8px #ffd97014, 0 0 60px #ffd97055, 0 40px 100px #000b;
}

.reveal--victory .cap {
    color: var(--gold);
}

.victory__sunburst {
    position: absolute;
    left: 50%;
    top: 110px;
    width: 700px;
    height: 700px;
    margin: -350px 0 0 -350px;
    background: repeating-conic-gradient(#ffd97024 0deg 8deg, transparent 8deg 20deg);
    border-radius: 50%;
    animation: sunburst-spin 9s linear infinite;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(circle, #000 25%, transparent 60%);
    mask-image: radial-gradient(circle, #000 25%, transparent 60%);
}

.reveal--victory #turn-content {
    overflow: hidden;
    margin: -39px -27px -32px;
    padding: 39px 27px 32px;
}

.reveal--victory #turn-content > :not(.victory__sunburst) {
    position: relative;
}

@keyframes sunburst-spin {
    to { transform: rotate(360deg); }
}

.reveal-avatar--victory {
    animation: trophy-entrance .7s cubic-bezier(.34, 1.56, .64, 1), victory-bounce 1.3s ease-in-out .7s infinite;
}

@keyframes trophy-entrance {
    from { transform: scale(0) rotate(-200deg); opacity: 0; }
}

@keyframes victory-bounce {
    50% { transform: translateY(-12px) rotate(-5deg); }
}

/* ---------- Choix d'avatar ---------- */

.avatar-picker {
    position: fixed;
    z-index: 40;
    width: 280px;
    max-height: 230px;
    overflow-y: auto;
    padding: 10px;
    background: linear-gradient(145deg, var(--panel-a), var(--panel-b));
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    box-shadow: 0 20px 50px #000a;
}

.avatar-picker__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.avatar-picker__option {
    border: 1px solid transparent;
    background: transparent;
    border-radius: 8px;
    font-size: 20px;
    padding: 4px 0;
    transition: background .15s, transform .15s;
}

.avatar-picker__option:hover {
    background: #ffffff14;
    transform: scale(1.15);
}

.avatar-picker__option--selected {
    background: #d9ff4326;
    border-color: #d9ff4399;
}

/* ---------- Inventaire d'un joueur ---------- */

.inventory-popover {
    position: fixed;
    z-index: 40;
    width: 290px;
    padding: 12px;
    background: linear-gradient(145deg, var(--panel-a), var(--panel-b));
    border: 1px solid #ffd97055;
    border-radius: 16px;
    box-shadow: 0 20px 50px #000a;
    animation: sheet-in .25s cubic-bezier(.34, 1.56, .64, 1);
}

.inv-pop__head {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
}

.inv-pop__avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--player-color);
    font-size: 19px;
}

.inv-pop__head b {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font: 900 19px var(--display);
    text-transform: uppercase;
}

.inv-pop__head small {
    color: var(--gold);
    font-weight: 900;
}

.inv-pop__close {
    border: 0;
    background: none;
    color: var(--ink-mute);
    font-size: 20px;
    line-height: 1;
    padding: 0 2px;
}

.inv-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.inv-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 11px;
    background: var(--field);
    border: 1px solid #ffd97033;
    font-size: 12px;
}

.inv-item__icon {
    font-size: 20px;
    flex: none;
}

.inv-item b {
    display: block;
}

.inv-item small {
    display: block;
    color: var(--ink-mute);
    font-size: 11px;
    margin-top: 1px;
}

.inv-empty {
    color: var(--ink-mute);
    font-size: 12px;
    padding: 6px 2px;
}

.inv-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.inv-status {
    padding: 4px 8px;
    border-radius: 999px;
    background: #ffffff10;
    border: 1px solid var(--line-strong);
    font-size: 11px;
    font-weight: 700;
}

/* ---------- Effets plein ecran ---------- */

#flash-layer {
    position: fixed;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 90;
}

#flash-layer.flash-active {
    animation: flash-pulse .5s ease-out;
}

@keyframes flash-pulse {
    0% { opacity: .9; }
    100% { opacity: 0; }
}

.screen-shake {
    animation: screen-shake .5s ease;
}

@keyframes screen-shake {
    20% { transform: translate(-8px, 5px); }
    40% { transform: translate(8px, -5px); }
    60% { transform: translate(-6px, 7px); }
    80% { transform: translate(6px, -7px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    /* En colonne unique, le bouton de tirage passe au-dessus du plateau. */
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .left,
    .aside {
        display: contents;
    }

    .standings {
        order: -1;
    }

    /* Pendant un tour, la console flotte en bas d'ecran, plateau visible au-dessus. */
    .draw-box--live {
        position: fixed;
        z-index: 8;
        left: 8px;
        right: 8px;
        bottom: 8px;
        max-width: 520px;
        margin: 0 auto;
        max-height: 52vh;
        overflow-y: auto;
        padding: 14px;
        border: 1px solid #d9ff4366;
        border-radius: 20px;
        box-shadow: 0 -12px 40px #000c;
    }

    .draw-box--live.draw-box--fail {
        border-color: #ff7a6b88;
    }

    .draw-box--live .confetti {
        position: fixed;
    }

    .draw-box--live .console {
        gap: 9px;
    }

    .draw-box--live .console h2 {
        font-size: 26px;
    }

    .draw-box--live .die-svg {
        width: 68px;
        height: 68px;
    }

    .draw-box--live .dice-stage--result {
        margin: 0;
    }

    .draw-box--live .bonus-reveal,
    .draw-box--live .tile-reveal {
        padding: 10px;
    }

    .draw-box--live .bonus-reveal__icon,
    .draw-box--live .tile-reveal__icon {
        font-size: 26px;
    }

    .draw-box--live .bonus-reveal strong,
    .draw-box--live .tile-reveal strong {
        font-size: 19px;
    }
}

@media (max-width: 760px) {
    .score-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    :root {
        --tile-h: 78px;
    }

    .shell {
        padding: 14px;
    }

    .topbar {
        padding-bottom: 16px;
    }

    .topright .pill {
        display: none;
    }

    .iconbtn {
        width: 36px;
        height: 36px;
    }

    .heading {
        display: block;
        margin: 24px 0 19px;
    }

    .heading .sub {
        text-align: left;
    }

    .track {
        padding: 0 11px 18px;
    }

    .track-head {
        padding: 18px 6px;
    }

    .track-head h2 {
        font-size: 24px;
    }

    .board {
        gap: 5px;
        padding: 7px;
    }

    .tile {
        border-radius: 9px;
        box-shadow: 0 4px 0 #0b1527, 0 7px 8px #050a1566;
    }

    .tile-number {
        font-size: 8px;
        top: 5px;
        left: 4px;
    }

    .tile-terrain {
        font-size: 14px;
        padding: 1px 3px;
        border-radius: 5px;
        transform: translateY(-4px);
    }

    .tile-pilots {
        bottom: 2px;
        left: 1px;
        right: 1px;
        gap: 0;
    }

    .tile--pilots-1 { --ps: 32px; }
    .tile--pilots-2 { --ps: 27px; }
    .tile--pilots-3 { --ps: 23px; }
    .tile--pilots-4 { --ps: 20px; }
    .tile--pilots-5 { --ps: 18px; }

    .pilot__status {
        width: 14px;
        height: 14px;
        font-size: 8px;
    }

    .finish-deco > span {
        font-size: 27px;
    }

    .finish-deco b {
        font-size: 15px;
    }

    .finish-deco small {
        font-size: 8px;
    }

    .score-section {
        margin-top: 9px;
    }

    .drop-row {
        grid-template-columns: 26px minmax(0, 1fr) 44px;
        grid-template-areas:
            "icon label value"
            "range range range"
            "sources sources sources";
    }

    .score-section__head {
        align-items: stretch;
        flex-direction: column;
    }

    .add-player-form input {
        flex: 1;
        width: auto;
    }

    .score-row {
        padding: 7px 8px;
        gap: 7px;
    }

    .row-btn {
        opacity: .8;
    }

    .race-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 6px 0;
    }

    .reveal {
        padding: 32px 18px 26px;
    }

    .reveal-avatar {
        font-size: 70px;
    }

    .reveal h2 {
        font-size: 40px;
    }

    .yesno__mark {
        width: 54px;
        height: 54px;
        font-size: 30px;
    }

    .die-svg {
        width: 100px;
        height: 100px;
    }

    .reveal--victory #turn-content {
        margin: -32px -18px -26px;
        padding: 32px 18px 26px;
    }
}

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