/**
 * Croque Burger Challenge – Graille Time
 * Polices : Lilita One (titres, chiffres) et Inter (textes, formulaires),
 * avec Whimsy TT en secours hors ligne.
 */
@font-face {
    font-family: "Whimsy TT";
    font-style: normal;
    font-weight: normal;
    src: local("Whimsy TT"), url("../fonts/whimsytt.ttf") format("truetype");
}

:root {
    /* couleurs de la marque (orange du logo Graille Time) */
    --ink       : #140D0A;
    --ink-2     : #1E1510;
    --ink-3     : #2A1E18;
    --board     : #1A110D;
    --orange    : #F2782F;
    --orange-2  : #E8692A;
    --orange-dk : #A9440F;
    --mustard   : #FFB627;
    --gold      : #FFD34D;
    --ketchup   : #E63B2E;
    --lettuce   : #6BBF3A;
    --cream     : #FFF4E0;
    --muted     : #C9B6A2;
    --line      : rgba(255, 244, 224, 0.10);
    --line-2    : rgba(255, 244, 224, 0.18);

    --display   : "Lilita One", "Whimsy TT", system-ui, sans-serif;
    --text      : "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --r-sm      : 10px;
    --r-md      : 14px;
    --r-lg      : 20px;
    --shadow    : 0 10px 30px rgba(0, 0, 0, 0.45);
    --tap       : 44px;
    /* croix directionnelle : suit la hauteur de l'écran (plus petite sur les petits téléphones) */
    --pad-h     : clamp(44px, 7.4vh, 64px);
    --pad-w     : clamp(62px, 20vw, 84px);

    color-scheme: dark;
    box-sizing: border-box;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--ink);
    overscroll-behavior: none;
}
body {
    font-family: var(--text);
    font-size: 16px;
    color: var(--cream);
    background:
        radial-gradient(120% 60% at 50% -10%, rgba(242, 120, 47, 0.28), transparent 60%),
        var(--ink);
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; }


/**
 * Boutons communs
 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    border: 0;
    border-radius: 999px;
    font-family: var(--display);
    font-size: 1.1rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    transition: transform 0.12s, box-shadow 0.12s, background-color 0.2s, opacity 0.2s;
}
.btn.primary {
    background: var(--orange);
    color: var(--ink);
    box-shadow: 0 5px 0 var(--orange-dk), 0 10px 24px rgba(242, 120, 47, 0.35);
}
.btn.primary:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--orange-dk); }
.btn.ghost {
    background: rgba(255, 244, 224, 0.06);
    color: var(--cream);
    border: 2px solid var(--line-2);
}
.btn.small { min-height: 40px; font-size: 0.95rem; padding: 0 16px; }
.btn.big   { width: 100%; min-height: 60px; font-size: 1.45rem; }
.btn.loading { opacity: 0.6; pointer-events: none; }
.btn:disabled { opacity: 0.6; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 5px 0 var(--orange-dk), 0 0 0 0 rgba(242, 120, 47, 0.45); }
    50%      { box-shadow: 0 5px 0 var(--orange-dk), 0 0 0 14px rgba(242, 120, 47, 0); }
}

.link {
    border: 0;
    background: none;
    padding: 10px 4px;
    color: var(--orange);
    font-weight: 700;
    font-size: 0.95rem;
}


/**
 * ÉCRANS (accueil, inscription, code, résultat) : plein écran, défilants
 */
.page {
    position: fixed;
    inset: 0;
    z-index: 20;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    background:
        radial-gradient(120% 45% at 50% 0%, rgba(242, 120, 47, 0.32), transparent 62%),
        var(--ink);
    -webkit-user-select: text;
    user-select: text;
    animation: fade 0.25s ease-out;
}
body.screen-open #app { visibility: hidden; }
body.booting .page .actions { opacity: 0.4; pointer-events: none; }

.wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 14px 16px 36px;
}
.wrap.narrow { max-width: 460px; padding-top: 10px; }
.wrap.center { text-align: center; }

.kicker {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--orange);
}
.page h1 {
    margin: 4px 0 8px;
    font-family: var(--display);
    font-weight: normal;
    font-size: clamp(2rem, 9vw, 2.7rem);
    line-height: 1.02;
}
.sub { margin: 0 0 18px; color: var(--muted); line-height: 1.45; }
.back-link {
    border: 0;
    background: none;
    color: var(--muted);
    font-weight: 700;
    padding: 10px 0;
    margin-bottom: 4px;
}

.card {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--r-lg);
    background: var(--ink-2);
    border: 1px solid var(--line);
}
.card h2 {
    margin: 0 0 4px;
    font-family: var(--display);
    font-weight: normal;
    font-size: 1.45rem;
}
.card-sub { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; line-height: 1.4; }


/* ---------- Accueil ---------- */
.hero {
    position: relative;
    padding: 18px 16px 0;
    border-radius: 28px;
    background: radial-gradient(90% 70% at 50% 20%, #F4884A, var(--orange-2) 70%);
    box-shadow: var(--shadow);
    text-align: center;
    overflow: hidden;
}
.hero-logo { width: 42%; max-width: 180px; height: auto; display: block; margin: 0 auto; filter: brightness(0.08); }
.hero-burgers {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    margin: -2px 0 -12px;
}
.hero-burgers img { width: 30%; max-width: 130px; height: auto; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.4)); }
.hero-burgers img:nth-child(2) { width: 38%; max-width: 160px; margin: 0 -5%; position: relative; z-index: 1; }

#home .kicker { margin-top: 20px; }
.home-text {
    margin: 6px 0 18px;
    font-family: var(--display);
    font-size: clamp(1.35rem, 6vw, 1.7rem);
    line-height: 1.2;
    color: var(--gold);
}
.home-player {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    background: var(--ink-2);
    border: 1px solid var(--line);
}
.home-player img { width: 44px; height: 44px; border-radius: 50%; background: rgba(242, 120, 47, 0.18); }
.home-player strong { display: block; font-size: 1.05rem; }
.home-player small { color: var(--muted); line-height: 1.35; }
.actions { display: flex; flex-direction: column; gap: 12px; }
.rules-line { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 0.85rem; }
.closed {
    margin: 0 0 14px;
    padding: 14px;
    border-radius: var(--r-md);
    background: rgba(255, 182, 39, 0.12);
    border: 1px solid rgba(255, 182, 39, 0.5);
    font-weight: 700;
    text-align: center;
}
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 14px; }

.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column-reverse; gap: 8px; }
.rung {
    display: grid;
    grid-template-columns: 30px 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border-radius: var(--r-md);
    background: var(--ink-3);
    border: 1px solid var(--line);
}
.rung-num {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-family: var(--display);
    background: var(--lettuce);
    color: var(--ink);
}
.lvl-2 .rung-num { background: var(--mustard); }
.lvl-3 .rung-num { background: var(--orange); }
.lvl-4 .rung-num { background: var(--ketchup); color: var(--cream); }
.lvl-4 { border-color: rgba(230, 59, 46, 0.6); background: linear-gradient(90deg, rgba(230, 59, 46, 0.18), var(--ink-3)); }
.rung img { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
.rung-text { min-width: 0; }
.rung-text strong { display: block; font-family: var(--display); font-weight: normal; font-size: 1.15rem; line-height: 1.1; }
.rung-text small { color: var(--muted); font-size: 0.78rem; }
.rung-price { font-family: var(--display); color: var(--orange); font-size: 1.1rem; }

.prizes { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.prizes li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    background: var(--ink-3);
}
.prizes li.grand { background: linear-gradient(90deg, rgba(255, 211, 77, 0.25), var(--ink-3)); border: 1px solid rgba(255, 211, 77, 0.6); }
.prize-icon { font-size: 1.5rem; }
.prizes strong { display: block; }
.prizes small { color: var(--muted); font-size: 0.8rem; }
.prize-score { font-family: var(--display); color: var(--gold); white-space: nowrap; }

.points { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.points li {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    background: var(--ink-3);
    font-size: 0.84rem;
}
.points strong { font-family: var(--display); font-weight: normal; color: var(--orange); }
.combo-rules { margin: 10px 0 0; font-size: 0.85rem; color: var(--muted); }
.combo-rules strong { color: var(--gold); }

.lb { list-style: none; margin: 8px 0 0; padding: 0; }
.lb li {
    display: grid;
    grid-template-columns: 26px 28px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
}
.lb li:nth-child(odd) { background: rgba(255, 244, 224, 0.04); }
.lb-rank { font-family: var(--display); color: var(--muted); text-align: center; }
.lb li:first-child .lb-rank { color: var(--gold); }
.lb-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-level { color: var(--muted); font-size: 0.78rem; }
.lb strong { font-family: var(--display); font-weight: normal; color: var(--orange); }
.lb-empty { display: block !important; color: var(--muted); text-align: center; }


/* ---------- Formulaires ---------- */
.form { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.field { margin: 0 0 8px; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend {
    display: block;
    margin-bottom: 6px;
    padding: 0;
    font-weight: 700;
    font-size: 0.95rem;
}
.field legend small { color: var(--muted); font-weight: 600; }
.form input[type="text"], .form input[type="tel"], .form input[type="email"] {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border-radius: var(--r-md);
    border: 2px solid var(--line-2);
    background: var(--ink-2);
    font-size: 1.1rem;   /* 16px minimum : pas de zoom automatique sur iPhone */
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form input::placeholder { color: rgba(201, 182, 162, 0.5); }
.form input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(242, 120, 47, 0.2); }
.form input[aria-invalid="true"] { border-color: var(--ketchup); }
.error {
    margin: 5px 2px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: #FF7A6E;
    white-space: pre-line;
}
.error:empty { margin: 0; }
.big-error { font-size: 1rem; text-align: center; }

.avatars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.avatar {
    position: relative;
    display: grid;
    place-items: center;
    padding: 6px 0;
    border-radius: var(--r-md);
    border: 2px solid var(--line);
    background: var(--ink-2);
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}
.avatar input { position: absolute; opacity: 0; pointer-events: none; }
.avatar img { width: 44px; height: 44px; }
.avatar.checked { border-color: var(--orange); background: rgba(242, 120, 47, 0.2); }

.notice {
    margin: 4px 0 10px;
    padding: 12px 14px;
    border-radius: var(--r-md);
    background: rgba(230, 59, 46, 0.14);
    border: 1px solid rgba(230, 59, 46, 0.55);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
}
.notice p { margin: 0; }
.notice .btn { margin-top: 10px; }
.form .btn.big { margin-top: 6px; }
.privacy { margin: 14px 4px 0; font-size: 0.78rem; line-height: 1.45; color: var(--muted); text-align: center; }


/* ---------- Code d'accès ---------- */
.ticket { font-size: 3.4rem; margin-top: 8px; }
.code-form input[name="code"] {
    height: 74px;
    text-align: center;
    font-family: var(--display);
    font-size: 2.2rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.granted {
    margin-top: 16px;
    padding: 20px 16px;
    border-radius: var(--r-lg);
    background: rgba(107, 191, 58, 0.14);
    border: 2px solid var(--lettuce);
    animation: pop 0.5s ease-out both;
}
.granted-title { margin: 0; font-family: var(--display); font-size: 1.8rem; color: var(--lettuce); }
.granted p { margin: 6px 0 14px; font-size: 1.1rem; }


/* ---------- Résultat ---------- */
.result h1 { font-size: clamp(2rem, 9vw, 2.8rem); }
.result-sub { margin: 18px 0 0; font-size: 1.3rem; font-weight: 800; color: var(--muted); }
.result-player { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; }
.result-player img { width: 52px; height: 52px; border-radius: 50%; background: rgba(242, 120, 47, 0.2); border: 2px solid var(--orange); }
.result-score {
    display: flex;
    flex-direction: column;
    margin: 16px 0 0;
    padding: 18px 12px;
    border-radius: 24px;
    background: var(--ink-2);
    border: 1px solid var(--line);
}
.result-score span { font-size: 0.85rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.result-score strong { font-family: var(--display); font-weight: normal; font-size: clamp(3.6rem, 18vw, 5rem); line-height: 1; color: var(--orange); font-variant-numeric: tabular-nums; }
.result-score small { color: var(--muted); font-size: 0.9rem; }
.reward {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 14px;
    padding: 16px;
    border-radius: 22px;
    background: rgba(255, 182, 39, 0.16);
    border: 2px solid var(--mustard);
    animation: pop 0.6s 0.3s ease-out both;
}
.reward.grand { background: linear-gradient(135deg, rgba(255, 211, 77, 0.35), rgba(242, 120, 47, 0.25)); border-color: var(--gold); }
.reward span { font-weight: 800; letter-spacing: 0.08em; color: var(--gold); }
.reward strong { font-family: var(--display); font-weight: normal; font-size: 1.8rem; line-height: 1.1; }
.reward small { color: var(--cream); font-size: 0.95rem; }
.cashier {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--r-lg);
    border: 2px dashed var(--line-2);
}
.cashier p { margin: 0; }
.cashier p:first-child { font-weight: 800; font-size: 1.1rem; }
.ref { margin-top: 6px !important; font-family: var(--display); font-size: 1.9rem; letter-spacing: 0.06em; color: var(--cream); }
.ref-date { color: var(--muted); font-size: 0.85rem; }
.again { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.again p { margin: 0 0 4px; color: var(--muted); line-height: 1.45; }
.again p strong { color: var(--cream); }
.result.win h1 { color: var(--gold); }
.result.win .result-score { border-color: rgba(255, 211, 77, 0.6); }
.result.pending .result-score strong { opacity: 0.6; }
.result.pending .cashier p:first-child { display: none; }
.confetti { display: none; }
.result.win .confetti {
    display: block;
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, var(--gold) 0 3px, transparent 4px),
        radial-gradient(circle, var(--orange) 0 3px, transparent 4px),
        radial-gradient(circle, var(--lettuce) 0 3px, transparent 4px),
        radial-gradient(circle, var(--ketchup) 0 3px, transparent 4px);
    background-size: 90px 90px, 120px 120px, 150px 150px, 110px 110px;
    background-position: 0 0, 40px 60px, 80px 20px, 20px 90px;
    animation: confetti 6s linear infinite;
    opacity: 0.55;
}
@keyframes confetti { to { background-position: 0 900px, 40px 1260px, 80px 1520px, 20px 1190px; } }


/**
 * LE JEU : barre du haut / scores / plateau / croix directionnelle
 */
#app {
    position: fixed;
    inset: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    display: grid;
    /* the board takes all the space left: the bars are never squeezed */
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "hud" "stage" "dock";
    /* phones: the full width; tablets: wider as long as the board fits in the height */
    max-width: clamp(560px, (100vh - 290px) * 0.86 + 16px, 900px);
    margin: 0 auto;
}
@supports (height: 100dvh) {
    /* iPhone Safari: the visible height, without the toolbars */
    :root { --pad-h: clamp(44px, 7.4dvh, 64px); }
}

.topbar {
    grid-area: top;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px 4px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { height: 42px; width: auto; flex-shrink: 0; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5)); }
.who {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    padding: 3px 12px 3px 3px;
    border-radius: 999px;
    background: var(--ink-3);
    border: 1px solid var(--line);
}
.who img { width: 30px; height: 30px; border-radius: 50%; background: rgba(242, 120, 47, 0.18); flex-shrink: 0; }
.who span {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 30vw;
}

.tools { display: flex; gap: 6px; flex-shrink: 0; }
.tool {
    position: relative;
    display: grid;
    place-items: center;
    width: var(--tap);
    height: var(--tap);
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line-2);
    background: var(--ink-3);
    color: var(--cream);
    font-size: 1.1rem;
    touch-action: manipulation;
    transition: background-color 0.2s, color 0.2s;
}
.tool svg { width: 20px; height: 20px; grid-area: 1 / 1; }
.tool .slash { display: none; color: var(--ketchup); width: 24px; height: 24px; }
.tool.off { color: var(--muted); background: transparent; }
.tool.off .slash { display: block; }
.tool.off .wave { display: none; }
.tool:active { background: var(--orange); color: var(--ink); }
.tool.pause { background: var(--orange); color: var(--ink); border-color: transparent; }
.tool .i-play { display: none; }
body[data-state="paused"] .tool .i-play  { display: block; }
body[data-state="paused"] .tool .i-pause { display: none; }
body:not([data-state="ready"]):not([data-state="playing"]):not([data-state="paused"]) .tool.pause { display: none; }

/* scores : 3 ou 4 cases, les nombres restent sur une ligne et rétrécissent sur les petits écrans */
.hud {
    grid-area: hud;
    display: flex;
    margin: 4px 12px 0;
    border-radius: var(--r-md);
    background: var(--ink-2);
    border: 1px solid var(--line);
    overflow: hidden;
}
.stat {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    padding: 5px 6px 6px;
    line-height: 1.1;
    min-width: 0;
}
.stat + .stat { border-left: 1px solid var(--line); }
.stat span {
    max-width: 100%;
    font-size: clamp(0.58rem, 2.6vw, 0.68rem);
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stat strong {
    max-width: 100%;
    font-family: var(--display);
    font-weight: normal;
    font-size: clamp(1.05rem, 5.6vw, 1.4rem);
    color: var(--cream);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.stat:first-child, .stat:nth-child(2) { flex-grow: 1.5; }
.stat:first-child strong { color: var(--orange); }
.stat.level strong small { font-size: 0.68em; color: var(--muted); }
.stat.time.low strong { color: var(--ketchup); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

#stage {
    grid-area: stage;
    position: relative;
    overflow: hidden;
    touch-action: none;
    margin: 6px 8px;
    min-height: 0;
}

/* le plateau garde sa taille d'origine (360x420) et est mis à l'échelle en JS */
#container {
    position: absolute;
    top: 0;
    left: 0;
    width: 30em;
    height: 35em;
    font-size: 12px;
    line-height: 1.5em;
    transform-origin: 0 0;
    background:
        radial-gradient(80% 50% at 50% 45%, rgba(242, 120, 47, 0.10), transparent 70%),
        repeating-conic-gradient(rgba(255, 244, 224, 0.025) 0 25%, transparent 0 50%) 0 0 / 2em 2em,
        var(--board);
    border-radius: 1.2em;
    box-shadow: inset 0 0 0 0.25em rgba(242, 120, 47, 0.55), inset 0 0 2.5em rgba(242, 120, 47, 0.12);
    overflow: hidden;
}
.board,
.screen,
.game {
    position: absolute;
    top: 1em;
    left: 1em;
}

/* badge combo et bannière du niveau, par-dessus le plateau */
.combo {
    position: absolute;
    top: calc(var(--board-top, 0px) + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--ink);
    font-family: var(--display);
    font-size: 1.1rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 2;
}
.combo.pop { animation: combo 0.35s ease-out; }
@keyframes combo { 0% { transform: translateX(-50%) scale(0.6); } 70% { transform: translateX(-50%) scale(1.15); } 100% { transform: translateX(-50%) scale(1); } }

.banner {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: clamp(8px, 3vw, 12px);
    width: min(calc(var(--board-w, 100%) * 0.88), 340px);
    padding: 10px 14px 10px 8px;
    border-radius: 22px;
    background: rgba(20, 13, 10, 0.94);
    border: 2px solid var(--orange);
    box-shadow: var(--shadow);
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: banner-in 0.4s ease-out both;
}
.banner.out { animation: banner-out 0.4s ease-in both; }
.banner > div { min-width: 0; }
.banner img { width: clamp(56px, 20vw, 84px); height: clamp(56px, 20vw, 84px); object-fit: contain; flex-shrink: 0; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.5)); }
.banner small { display: block; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--orange); font-size: clamp(0.62rem, 2.8vw, 0.75rem); }
.banner strong { display: block; font-family: var(--display); font-weight: normal; font-size: clamp(1.2rem, 6vw, 1.6rem); line-height: 1.05; overflow-wrap: anywhere; }
.banner span { font-family: var(--display); color: var(--gold); font-size: clamp(0.95rem, 4.4vw, 1.15rem); }
@keyframes banner-in  { from { opacity: 0; transform: translate(-50%, -30%) scale(0.9); } }
@keyframes banner-out { to   { opacity: 0; transform: translate(-50%, -70%) scale(0.95); } }

/* Croix directionnelle : seulement sur écran tactile */
.dock {
    grid-area: dock;
    padding: 2px 0 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}
.pad { display: none; }
.keys { margin: 0; text-align: center; color: var(--muted); font-size: 0.85rem; }
.pad {
    grid-template-columns: repeat(3, var(--pad-w));
    grid-template-rows: repeat(2, var(--pad-h));
    gap: clamp(6px, 1vh, 8px);
    justify-content: center;
}
.pad button {
    border: 1px solid var(--line-2);
    border-radius: 18px;
    background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
    color: var(--cream);
    font-size: 1.5rem;
    touch-action: none;
}
.pad button:active { background: var(--orange); color: var(--ink); transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); }
.pad .up    { grid-column: 2; grid-row: 1; }
.pad .left  { grid-column: 1; grid-row: 2; }
.pad .down  { grid-column: 2; grid-row: 2; }
.pad .right { grid-column: 3; grid-row: 2; }

@media (pointer: coarse), (hover: none) {
    .pad  { display: grid; }
    .keys { display: none; }
}

/* Petits téléphones (iPhone SE, Safari avec ses barres) */
@media (max-height: 700px) {
    .logo { height: 36px; }
    .tool { width: 40px; height: 40px; }
    .topbar { padding-top: 6px; }
    .hero-logo { width: 32%; }
    .hero-burgers img { width: 24%; }
    .hero-burgers img:nth-child(2) { width: 30%; }
}
@media (max-height: 600px) {
    .hud .stat { padding-block: 3px; }
    .stat span { font-size: 0.58rem; }
}
/* Écrans étroits (320 px) : le nom du joueur laisse la place aux boutons */
@media (max-width: 359px) {
    .topbar { padding-inline: 8px; }
    .logo { height: 32px; }
    .tool { width: 38px; height: 38px; }
    .hud { margin-inline: 8px; }
}

/* Téléphone à l'horizontale : plateau à gauche, le reste à droite */
@media (orientation: landscape) and (max-height: 560px) {
    :root { --pad-h: clamp(40px, 13vh, 58px); --pad-w: clamp(56px, 8vw, 74px); }
    #app {
        max-width: none;
        grid-template-rows: auto auto minmax(0, 1fr);
        grid-template-columns: minmax(0, 1fr) minmax(250px, 300px);
        grid-template-areas: "stage top" "stage hud" "stage dock";
    }
    #stage { margin: 8px; }
    .dock { justify-content: flex-end; }
    .who { padding-right: 3px; }
    .who span { display: none; }
    .pad { padding-bottom: 6px; }
    .stat strong { font-size: 1.1rem; }
}


/**
 * La carte (feuille du bas sur téléphone, fenêtre sur ordinateur)
 */
.sheet {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    animation: fade 0.2s ease-out;
}
.sheet-panel {
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    background: var(--ink-2);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    animation: up 0.25s ease-out;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: normal; font-size: 1.8rem; color: var(--orange); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px; }
.carte-cat {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: var(--r-lg);
    background: var(--ink-3);
    border: 1px solid var(--line);
}
.carte-cat h3 { margin: 0 0 8px; font-family: var(--display); font-weight: normal; font-size: 1.3rem; }
.carte-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.carte-items figure {
    margin: 0;
    padding: 8px 6px 10px;
    border-radius: var(--r-md);
    background: radial-gradient(70% 55% at 50% 30%, rgba(255, 244, 224, 0.12), transparent 70%);
    text-align: center;
}
.carte-items img { width: 100%; max-width: 110px; height: auto; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45)); }
.carte-items figcaption { display: flex; flex-direction: column; gap: 2px; }
.carte-items strong { font-family: var(--display); font-weight: normal; font-size: 1.05rem; }
.carte-price { font-family: var(--display); color: var(--orange); }
.carte-items small { color: var(--muted); font-size: 0.74rem; line-height: 1.3; }
@media (min-width: 700px) and (min-height: 600px) {
    .sheet { align-items: center; }
    .sheet-panel { border-radius: 24px; max-height: 80vh; }
    .carte-items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}


/**
 * Message court
 */
.toast {
    position: fixed;
    z-index: 40;
    left: 50%;
    top: calc(12px + env(safe-area-inset-top, 0px));
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--cream);
    color: var(--ink);
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: var(--shadow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    animation: drop 0.3s ease-out;
}

@keyframes fade { from { opacity: 0; } }
@keyframes up   { from { transform: translateY(30px); opacity: 0; } }
@keyframes drop { from { transform: translate(-50%, -20px); opacity: 0; } }
@keyframes pop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.06); opacity: 1; }
    100% { transform: scale(1); }
}

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