@font-face { font-family: "OpenDyslexic"; src: url("../vendor/opendyslexic-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "OpenDyslexic"; src: url("../vendor/opendyslexic-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --deep: #0e4a30; --leaf: #2f9e56; --leaf-d: #1f7a3d;
  --gold: #ffd24d; --gold-d: #e0a526;
  --card: #fff8e6; --ink: #3b2a14; --ink-2: #6b5535;
  --ok: #2fae5b; --bad: #e0364f;
  --font: "Baloo 2", "Fredoka", "Trebuchet MS", "Segoe UI", "Arial Rounded MT Bold", system-ui, sans-serif;
  --r: 18px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
}
body.dys { --font: "OpenDyslexic", "Comic Sans MS", system-ui, sans-serif; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--font); color: var(--ink); background: #0a2a22; font-size: 17px; line-height: 1.25; user-select: none; -webkit-user-select: none; }
body.dys .logo, body.dys .btn, body.dys .word { letter-spacing: .02em; }
button { font: inherit; color: inherit; cursor: pointer; }
h2 { margin: 18px 0 8px; font-size: 1.25rem; color: #fff8d6; text-shadow: 0 2px 0 rgba(0,0,0,.35); }

/* ---------- Fond de jungle ---------- */
#bg, #sparks { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#bg svg { width: 100%; height: 100%; display: block; animation: fadeIn .8s ease; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
#sparks span { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #fff7a8; box-shadow: 0 0 10px 4px rgba(255, 240, 130, .7); opacity: 0; animation: drift var(--t, 9s) ease-in-out infinite; animation-delay: var(--d, 0s); }
@keyframes drift { 0%, 100% { opacity: 0; transform: translate(0, 0) } 20% { opacity: .9 } 50% { transform: translate(var(--x, 30px), var(--y, -40px)); opacity: .7 } 80% { opacity: .9 } }
#bg::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, transparent 35%, rgba(0, 20, 10, .55) 100%); }

/* ---------- Écrans ---------- */
#app { position: fixed; inset: 0; z-index: 1; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; padding: var(--sat) var(--sar) var(--sab) var(--sal); }
.screen.active { display: flex; animation: fadeIn .35s ease; }
.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.panel { width: min(100%, 760px); margin: 0 auto; padding: 8px 16px 28px; }

/* ---------- Boutons ---------- */
.btn { border: 0; border-radius: 16px; padding: 12px 20px; font-weight: 800; font-size: 1.05rem; background: #fff3c8; color: var(--ink); box-shadow: 0 5px 0 #c9a64a, 0 8px 14px rgba(0, 0, 0, .3); transition: transform .08s, box-shadow .08s, filter .15s; touch-action: manipulation; min-height: 48px; }
.btn:hover { filter: brightness(1.05); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c9a64a, 0 3px 8px rgba(0, 0, 0, .3); }
.btn.primary { background: linear-gradient(#ffe36e, #ffc02e); color: #4a3000; box-shadow: 0 5px 0 #b97f0a, 0 8px 14px rgba(0, 0, 0, .3); }
.btn.primary:active { box-shadow: 0 1px 0 #b97f0a, 0 3px 8px rgba(0, 0, 0, .3); }
.btn.xl { font-size: 1.4rem; padding: 14px 30px; border-radius: 22px; }
.btn.small { padding: 8px 14px; font-size: .95rem; min-height: 42px; }
.btn[aria-pressed="false"].toggle-off, .btn.off { opacity: .7; }
.btn:disabled { filter: grayscale(.7) brightness(.9); pointer-events: none; opacity: .75; }
.btn:focus-visible, .icon-btn:focus-visible, .choice:focus-visible, .world-card:focus-visible, .xp:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 248, 214, .92); font-size: 1.25rem; font-weight: 800; box-shadow: 0 3px 0 #b8984a, 0 5px 10px rgba(0,0,0,.3); flex: none; }
.icon-btn[aria-pressed="false"] { opacity: .65; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hint { color: #fff6cf; text-shadow: 0 1px 2px rgba(0,0,0,.5); font-size: .95rem; margin: 10px 0 0; }

/* ---------- Accueil ---------- */
.home-inner { margin: auto; width: min(100%, 640px); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.logo { margin: 0; line-height: .95; font-weight: 900; text-transform: uppercase; display: flex; flex-direction: column; align-items: center; }
.logo-top, .logo-bottom { display: flex; gap: .02em; }
.logo-top { font-size: clamp(3.2rem, 15vw, 6.6rem); }
.logo-bottom { font-size: clamp(2.2rem, 10vw, 4.4rem); }
.logo span.l { display: inline-block; color: var(--c); -webkit-text-stroke: .06em #3a2208; paint-order: stroke fill; text-shadow: 0 .06em 0 #3a2208, 0 .12em .2em rgba(0,0,0,.5); animation: wob 3s ease-in-out infinite; animation-delay: var(--d); transform-origin: 50% 90%; }
.logo span.sp { width: .35em; }
@keyframes wob { 0%, 100% { transform: rotate(-4deg) translateY(0) } 50% { transform: rotate(4deg) translateY(-.06em) } }
.home-art { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: clamp(120px, 24vh, 190px); }
.home-art svg { height: 100%; width: auto; filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
.home-art .plant { height: 118%; animation: sway 3s ease-in-out infinite; transform-origin: 50% 100%; }
.home-art .plant .up { animation: upChomp .8s ease-in-out infinite alternate; }
.home-art .plant .down { animation: downChomp .8s ease-in-out infinite alternate; }
.home-art .explorer { animation: bob 1.6s ease-in-out infinite; }
.home-art .explorer:nth-child(2) { animation-delay: .3s; }
.home-art .explorer:nth-child(3) { animation-delay: .6s; }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-10px) } }
@keyframes sway { 0%, 100% { transform: rotate(-2deg) } 50% { transform: rotate(2deg) } }
.tagline { margin: 0; font-size: clamp(1rem, 3.6vw, 1.3rem); color: #fff6cf; text-shadow: 0 2px 4px rgba(0,0,0,.6); font-weight: 700; }
.home-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* ---------- Préparation ---------- */
.worlds { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.world-card { text-align: left; border: 4px solid transparent; border-radius: var(--r); padding: 12px 14px; background: rgba(255, 248, 230, .93); box-shadow: 0 5px 0 rgba(0,0,0,.25); display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; transition: transform .12s, border-color .12s; }
.world-card .we { grid-row: span 3; font-size: 2.6rem; }
.world-card b { font-size: 1.15rem; }
.world-card .wg { font-weight: 800; color: var(--leaf-d); font-size: 1.2rem; letter-spacing: .02em; }
.world-card small { color: var(--ink-2); line-height: 1.15; }
.world-card[aria-checked="true"] { border-color: var(--gold); transform: scale(1.02); background: #fffbe9; box-shadow: 0 0 0 3px rgba(255, 210, 77, .5), 0 5px 0 rgba(0,0,0,.25); }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; max-width: 90px; border: 3px solid transparent; border-radius: 14px; padding: 10px 0; font-weight: 900; font-size: 1.3rem; background: rgba(255, 248, 230, .93); box-shadow: 0 4px 0 rgba(0,0,0,.25); }
.seg button[aria-checked="true"] { border-color: var(--gold); background: #ffe27a; }
.player-rows { display: grid; gap: 10px; }
.prow { background: rgba(255, 248, 230, .93); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 8px; box-shadow: 0 4px 0 rgba(0,0,0,.22); }
.prow label { font-weight: 800; font-size: .95rem; color: var(--ink-2); }
.prow input { font: inherit; font-weight: 800; padding: 9px 12px; border-radius: 12px; border: 3px solid #d8c48c; background: #fff; width: 100%; color: var(--ink); user-select: text; -webkit-user-select: text; }
.prow input:focus { outline: none; border-color: var(--leaf); }
.xps { display: flex; gap: 6px; flex-wrap: wrap; }
.xp { width: 58px; height: 66px; border-radius: 14px; border: 3px solid #e6d7a6; background: #f6ecc4; padding: 2px 2px 0; position: relative; }
.xp svg { width: 100%; height: 100%; }
.xp[aria-checked="true"] { border-color: var(--leaf); background: #d9f2c9; box-shadow: 0 0 0 3px rgba(47, 158, 86, .35); }
.xp:disabled { opacity: .35; filter: grayscale(.8); }
.actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.actions .btn.primary { flex: 1 1 220px; }

/* ---------- Partie ---------- */
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 4px; }
.zone-title { flex: 1; text-align: center; font-weight: 900; font-size: clamp(1rem, 3.6vw, 1.4rem); color: #fff6c4; text-shadow: 0 2px 0 #3a2208, 0 0 12px rgba(0,0,0,.5); line-height: 1.05; }
.zone-title small { display: block; font-size: .72em; color: #cdf5b3; letter-spacing: .06em; }
.players { display: flex; gap: 8px; padding: 4px 10px; overflow-x: auto; justify-content: center; scrollbar-width: none; }
.players::-webkit-scrollbar { display: none; }
.pchip { flex: 0 1 auto; min-width: 118px; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; gap: 0 8px; align-items: center; padding: 5px 10px 5px 6px; border-radius: 16px; background: rgba(255, 248, 230, .88); border: 3px solid transparent; transition: transform .2s, border-color .2s, background .2s; position: relative; }
.pchip .av { grid-row: span 2; width: 40px; height: 48px; }
.pchip .av svg { width: 100%; height: 100%; }
.pchip .nm { font-weight: 900; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.pchip .hearts { display: flex; gap: 1px; align-items: center; min-height: 20px; }
.heart { width: 20px; height: 20px; display: block; }
.heart.breaking .half { transform-box: view-box; }
.heart.breaking .half.l { transform-origin: 6px 20px; animation: breakL 1s ease-in forwards; }
.heart.breaking .half.r { transform-origin: 18px 20px; animation: breakR 1s ease-in forwards; }
.heart.breaking { animation: shakeH .35s 2; }
@keyframes shakeH { 0%, 100% { transform: translateX(0) } 25% { transform: translateX(-2px) } 75% { transform: translateX(2px) } }
@keyframes breakL { 0%, 35% { transform: none; opacity: 1 } 100% { transform: translate(-5px, 16px) rotate(-38deg); opacity: 0 } }
@keyframes breakR { 0%, 35% { transform: none; opacity: 1 } 100% { transform: translate(5px, 16px) rotate(38deg); opacity: 0 } }
.heart.gain { animation: gainH .8s ease-out; }
@keyframes gainH { 0% { transform: scale(0) } 60% { transform: scale(1.5) } 100% { transform: scale(1) } }
.pchip .shield-badge { position: absolute; top: -8px; right: -6px; width: 26px; height: 30px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.pchip.current { border-color: var(--gold); background: #fffbe0; transform: translateY(-2px) scale(1.04); box-shadow: 0 0 0 3px rgba(255, 210, 77, .55); }
.pchip.dead { filter: grayscale(1); opacity: .5; }
.pchip .eaten { font-size: .8rem; font-weight: 800; color: var(--bad); }

.board-wrap { flex: 1; min-height: 0; padding: 4px 8px; display: flex; }
#board { width: 100%; height: 100%; display: block; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
.board-bg { fill: rgba(16, 70, 40, .55); stroke: rgba(255, 245, 190, .55); stroke-width: 3; }
.tile-num { font: 900 24px var(--font); fill: #5a4420; paint-order: stroke; stroke: #fff4d2; stroke-width: 3px; stroke-linejoin: round; }
.tile-num.small { font-size: 18px; }
.tile-label { font: 900 17px var(--font); fill: #fff6cf; paint-order: stroke; stroke: #3a2208; stroke-width: 5px; stroke-linejoin: round; letter-spacing: .05em; }
.bonus-glow, .end-glow { transform-box: fill-box; transform-origin: center; animation: glowPulse 2s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { transform: scale(.9); opacity: .7 } 50% { transform: scale(1.15); opacity: 1 } }
.tile-icon { overflow: visible; }

.pawn { transition: transform .36s cubic-bezier(.4, .1, .3, 1), opacity .6s; }
.pawn .hopper { transform-box: view-box; }
.pawn.hop .hopper { animation: hop .36s ease-out; }
@keyframes hop { 0% { transform: translateY(0) } 40% { transform: translateY(-24px) } 100% { transform: translateY(0) } }
.pawn .ring { fill: transparent; }
.pawn.active .ring { fill: rgba(255, 224, 102, .6); stroke: #fff3b0; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: ringPulse 1.1s ease-in-out infinite; }
@keyframes ringPulse { 0%, 100% { transform: scale(.85) } 50% { transform: scale(1.2) } }
.pawn .pawn-dome { opacity: 0; transform: translateY(-40px); transition: opacity .4s, transform .5s cubic-bezier(.3, 1.6, .5, 1); pointer-events: none; }
.pawn.shielded .pawn-dome { opacity: .95; transform: none; }
.pawn.dead { opacity: 0; pointer-events: none; }

.dock { display: flex; align-items: center; gap: 12px; padding: 6px 12px 10px; justify-content: center; flex-wrap: wrap; }
.dock-msg { flex: 1 1 200px; text-align: right; font-weight: 900; font-size: clamp(1rem, 3.4vw, 1.3rem); color: #fff6c4; text-shadow: 0 2px 0 #3a2208, 0 0 10px rgba(0,0,0,.5); min-height: 1.3em; }
.dock-msg b { color: var(--gold); }
.die-btn { display: flex; align-items: center; gap: 12px; padding: 8px 22px 8px 12px; font-size: 1.3rem; border-radius: 24px; }
.die-btn:disabled { opacity: .55; }
.die { width: 46px; height: 46px; border-radius: 11px; background: #fff; border: 3px solid #3a2a1a; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 5px; box-shadow: inset 0 -3px 0 #ddd; }
.die i { border-radius: 50%; background: transparent; margin: 1px; }
.die[data-face="1"] i:nth-child(5), .die[data-face="2"] i:nth-child(1), .die[data-face="2"] i:nth-child(9),
.die[data-face="3"] i:nth-child(1), .die[data-face="3"] i:nth-child(5), .die[data-face="3"] i:nth-child(9),
.die[data-face="4"] i:nth-child(1), .die[data-face="4"] i:nth-child(3), .die[data-face="4"] i:nth-child(7), .die[data-face="4"] i:nth-child(9),
.die[data-face="5"] i:nth-child(1), .die[data-face="5"] i:nth-child(3), .die[data-face="5"] i:nth-child(5), .die[data-face="5"] i:nth-child(7), .die[data-face="5"] i:nth-child(9),
.die[data-face="6"] i:nth-child(1), .die[data-face="6"] i:nth-child(3), .die[data-face="6"] i:nth-child(4), .die[data-face="6"] i:nth-child(6), .die[data-face="6"] i:nth-child(7), .die[data-face="6"] i:nth-child(9) { background: #2a1a10; }
.die.rolling { animation: shake .18s linear infinite; }
.die.landed { animation: land .5s ease-out; }
@keyframes shake { 0% { transform: rotate(-14deg) translateY(-3px) } 50% { transform: rotate(14deg) translateY(2px) } 100% { transform: rotate(-14deg) translateY(-3px) } }
@keyframes land { 0% { transform: scale(1.6) rotate(25deg) } 60% { transform: scale(.9) } 100% { transform: scale(1) } }

/* ---------- Carte d'épreuve ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: calc(var(--sat) + 10px) calc(var(--sar) + 10px) calc(var(--sab) + 10px) calc(var(--sal) + 10px); background: rgba(5, 25, 12, .55); backdrop-filter: blur(2px); animation: fadeIn .2s ease; }
.modal[hidden] { display: none; }
.card { width: min(100%, 620px); max-height: 100%; overflow-y: auto; background: var(--card); border-radius: 26px; border: 5px solid #8a6a2f; box-shadow: 0 0 0 4px #d9b25a, 0 18px 40px rgba(0,0,0,.55); padding: 16px 18px 18px; text-align: center; animation: pop .35s cubic-bezier(.3, 1.5, .5, 1); position: relative; }
@keyframes pop { from { transform: scale(.7) translateY(30px); opacity: 0 } to { transform: none; opacity: 1 } }
.card .who { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 900; color: var(--ink-2); font-size: 1rem; }
.card .who svg { width: 30px; height: 36px; }
.badge { display: inline-block; margin: 6px 0 4px; padding: 4px 14px; border-radius: 999px; background: var(--leaf); color: #fff; font-weight: 900; font-size: 1rem; letter-spacing: .02em; }
.badge.vf { background: #7a55c8; }
.q-emoji { font-size: clamp(3rem, 14vw, 4.6rem); line-height: 1.1; margin: 4px 0; min-height: 1.1em; }
.word { font-size: clamp(2.1rem, 9vw, 3.4rem); font-weight: 900; line-height: 1.2; margin: 2px 0 10px; text-align: center; overflow-wrap: anywhere; }
.word .slot { display: inline-block; min-width: 1.5em; padding: 0 .12em; margin: 0 .04em; border-bottom: .09em solid var(--ink); background: rgba(255, 210, 77, .4); border-radius: .2em .2em 0 0; color: transparent; animation: slotBlink 1.2s ease-in-out infinite; }
.word .slot.ok { color: var(--ok); background: rgba(47, 174, 91, .2); border-color: var(--ok); animation: none; }
.word .slot.ko { color: var(--bad); background: rgba(224, 54, 79, .15); border-color: var(--bad); animation: none; }
@keyframes slotBlink { 0%, 100% { background: rgba(255, 210, 77, .25) } 50% { background: rgba(255, 210, 77, .7) } }
.word.vf-word.ok-mark { color: var(--ok); }
.word.vf-word.ko-mark { color: var(--bad); text-decoration: line-through; text-decoration-thickness: .08em; }
.say { position: absolute; top: 10px; right: 12px; width: 46px; height: 46px; border-radius: 50%; border: 0; background: #e5f4d6; font-size: 1.4rem; box-shadow: 0 3px 0 #9ec27c; }
.say.speaking { animation: ringPulse .6s infinite; }
.choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin: 6px 0 4px; }
.choice { border: 0; border-radius: 18px; padding: 10px 6px 12px; font-weight: 900; font-size: clamp(1.8rem, 8vw, 2.6rem); background: #fff; color: #2a5a8a; box-shadow: 0 6px 0 #9fb8cf, 0 8px 12px rgba(0,0,0,.2); min-height: 66px; transition: transform .08s, background .15s; touch-action: manipulation; }
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 #9fb8cf; }
.choice.vf-true { background: #dff6e3; color: #1d7a3e; box-shadow: 0 6px 0 #8cc79b, 0 8px 12px rgba(0,0,0,.2); }
.choice.vf-false { background: #fde1e4; color: #b3233a; box-shadow: 0 6px 0 #e49aa6, 0 8px 12px rgba(0,0,0,.2); }
.choice.right { background: #c6f1d0 !important; color: #14672f !important; box-shadow: 0 0 0 5px var(--ok) !important; animation: tada .6s; }
.choice.wrong { background: #ffd0d6 !important; color: #a3162c !important; box-shadow: 0 0 0 5px var(--bad) !important; animation: shakeX .45s; }
.choices.done .choice:not(.right):not(.wrong) { opacity: .4; }
.choices.done .choice { pointer-events: none; }
@keyframes tada { 0% { transform: scale(1) } 40% { transform: scale(1.12) rotate(-3deg) } 70% { transform: scale(1.06) rotate(3deg) } 100% { transform: scale(1) } }
@keyframes shakeX { 0%, 100% { transform: translateX(0) } 20%, 60% { transform: translateX(-9px) } 40%, 80% { transform: translateX(9px) } }
.feedback { margin-top: 10px; padding: 10px 12px; border-radius: 16px; font-weight: 800; font-size: 1.05rem; animation: pop .3s ease-out; }
.feedback.good { background: #dff6e3; color: #14672f; }
.feedback.bad { background: #ffe3e7; color: #8f1a2e; }
.feedback .big { display: block; font-size: 1.4rem; font-weight: 900; }
.feedback .tip { display: block; margin-top: 4px; font-weight: 700; font-size: .95rem; opacity: .9; }
.feedback .fixed { display: inline-block; margin-top: 2px; padding: 0 .3em; background: #fff; border-radius: 8px; font-size: 1.2em; color: var(--ink); }
.card .next { margin-top: 12px; width: 100%; }
.card.shield-card .q-emoji { font-size: 4rem; }
.shield-msg { font-size: 1.2rem; font-weight: 800; margin: 6px 0 4px; }

/* ---------- Effets ---------- */
#fx { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.fx-dim { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(30, 0, 20, .3), rgba(30, 0, 10, .75)); animation: fadeIn .25s ease; }
.fx-dim.good { background: radial-gradient(ellipse at center, rgba(255, 245, 160, .22), rgba(10, 40, 30, .6)); }
.scene { position: absolute; left: 50%; top: 50%; width: min(86vw, 360px); height: min(70vh, 400px); transform: translate(-50%, -50%); }
.scene-plant { position: absolute; left: 50%; bottom: 0; width: 100%; transform: translate(-50%, 110%); animation: plantUp 2.4s ease forwards; }
.scene-plant .plant { width: 100%; display: block; overflow: visible; filter: drop-shadow(0 8px 10px rgba(0,0,0,.5)); }
@keyframes plantUp { 0% { transform: translate(-50%, 110%) } 22% { transform: translate(-50%, 0) } 85% { transform: translate(-50%, 0) } 100% { transform: translate(-50%, 115%) } }
.plant .up { animation: upChomp .24s ease-in-out 5 alternate; animation-delay: .6s; transform: translateY(-34px); }
.plant .down { animation: downChomp .24s ease-in-out 5 alternate; animation-delay: .6s; transform: translateY(26px); }
@keyframes upChomp { 0% { transform: translateY(-34px) } 100% { transform: translateY(2px) } }
@keyframes downChomp { 0% { transform: translateY(26px) } 100% { transform: translateY(-2px) } }
.scene-hero { position: absolute; left: 50%; bottom: 4%; width: 34%; transform: translateX(-50%); animation: heroEaten 2.4s ease-in forwards; }
.scene-hero svg { width: 100%; display: block; filter: drop-shadow(0 4px 4px rgba(0,0,0,.4)); }
@keyframes heroEaten { 0%, 30% { transform: translate(-50%, 0) scale(1) } 38% { transform: translate(-50%, -14px) scale(1) } 62% { transform: translate(-50%, -150%) scale(.55); opacity: 1 } 70%, 100% { transform: translate(-50%, -190%) scale(.1); opacity: 0 } }
.scene-text { position: absolute; left: 50%; top: -6%; transform: translateX(-50%) rotate(-5deg); font-size: clamp(2.2rem, 11vw, 3.6rem); font-weight: 900; color: #fff; -webkit-text-stroke: .06em #7a0a2a; paint-order: stroke fill; text-shadow: 0 .08em 0 #7a0a2a; animation: textPop 2.4s ease forwards; white-space: nowrap; }
@keyframes textPop { 0%, 25% { transform: translateX(-50%) scale(0) rotate(-5deg) } 40% { transform: translateX(-50%) scale(1.25) rotate(-5deg) } 55%, 90% { transform: translateX(-50%) scale(1) rotate(-5deg) } 100% { transform: translateX(-50%) scale(0) } }
.scene.good .scene-text { -webkit-text-stroke-color: #14672f; text-shadow: 0 .08em 0 #14672f; animation-name: textPop; animation-duration: 2.2s; top: 0; }
.scene.good .scene-text.gold { -webkit-text-stroke-color: #8a5a00; text-shadow: 0 .08em 0 #8a5a00; color: #fff3b0; }
.scene-bell { position: absolute; left: 50%; bottom: 0; width: 66%; transform: translateX(-50%); animation: bellDrop 2.2s cubic-bezier(.3, 1.3, .5, 1) forwards; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); }
.scene-bell svg { width: 100%; display: block; }
@keyframes bellDrop { 0% { transform: translate(-50%, -120%); opacity: 0 } 30% { transform: translate(-50%, 0); opacity: 1 } 40% { transform: translate(-50%, -7%) } 50%, 85% { transform: translate(-50%, 0); opacity: 1 } 100% { transform: translate(-50%, 0); opacity: 0 } }
.scene-bell::after { content: ""; position: absolute; inset: -10%; background: radial-gradient(circle, rgba(255,255,255,.5), transparent 65%); animation: glowPulse 1s ease-in-out infinite; }
.scene-flask { position: absolute; left: 50%; bottom: 8%; width: 46%; transform: translateX(-50%); animation: flaskUp 2.2s ease forwards; filter: drop-shadow(0 8px 10px rgba(0,0,0,.35)); }
.scene-flask svg { width: 100%; display: block; }
@keyframes flaskUp { 0% { transform: translate(-50%, 60%) scale(.3); opacity: 0 } 30% { transform: translate(-50%, -20%) scale(1.1); opacity: 1 } 45% { transform: translate(-50%, -14%) scale(1) rotate(-6deg) } 60% { transform: translate(-50%, -14%) rotate(6deg) } 75%, 88% { transform: translate(-50%, -14%) rotate(0) scale(1.1); opacity: 1 } 100% { transform: translate(-50%, -40%) scale(.2); opacity: 0 } }
.scene-hero.cheer { animation: cheer 2.2s ease-in-out forwards; left: 50%; bottom: 0; width: 38%; }
@keyframes cheer { 0%, 100% { transform: translate(-50%, 0) } 20%, 50%, 80% { transform: translate(-50%, -22px) } 35%, 65% { transform: translate(-50%, 0) } }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 26px; border-radius: 22px; font-weight: 900; font-size: clamp(1.4rem, 6vw, 2.2rem); color: #fff; text-align: center; background: linear-gradient(#e0364f, #a3162c); border: 4px solid #fff; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: bannerIn 1.7s ease forwards; white-space: nowrap; display: flex; align-items: center; gap: 12px; }
.banner svg { width: 1.6em; height: 1.6em; }
.banner.good { background: linear-gradient(#35c46a, #1d8c46); }
@keyframes bannerIn { 0% { transform: translate(-50%, -50%) scale(0) } 18% { transform: translate(-50%, -50%) scale(1.15) } 28%, 82% { transform: translate(-50%, -50%) scale(1) } 100% { transform: translate(-50%, -80%) scale(.8); opacity: 0 } }
.spark { position: absolute; left: var(--x); top: var(--y); font-size: var(--s, 1.6rem); animation: sparkFly var(--t, 1s) ease-out forwards; will-change: transform; }
@keyframes sparkFly { from { transform: translate(0, 0) scale(.3) rotate(0); opacity: 1 } to { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(var(--rot, 180deg)); opacity: 0 } }
.confetti { position: absolute; top: -20px; width: var(--w, 10px); height: var(--h, 14px); background: var(--c); left: var(--x); animation: fall var(--t, 3.5s) linear forwards; animation-delay: var(--d, 0s); opacity: .95; }
@keyframes fall { to { transform: translate(var(--dx, 0), 110vh) rotate(var(--rot, 720deg)); } }

/* ---------- Fin ---------- */
.end-hero { text-align: center; padding-top: 14px; }
.end-title { margin: 0; font-size: clamp(2rem, 9vw, 3.4rem); font-weight: 900; color: #fff3b0; -webkit-text-stroke: .05em #3a2208; paint-order: stroke fill; text-shadow: 0 .06em 0 #3a2208; line-height: 1; }
.end-hero .big-explorer { width: min(38vw, 160px); margin: 6px auto 0; display: block; animation: bob 1.4s ease-in-out infinite; }
.end-hero .chest { width: min(30vw, 120px); display: block; margin: -26px auto 0; position: relative; }
.end-sub { color: #fff6cf; font-weight: 800; text-shadow: 0 2px 3px rgba(0,0,0,.6); margin: 6px 0 10px; font-size: 1.1rem; }
.rank { display: grid; gap: 8px; margin: 10px 0; }
.rank-row { background: rgba(255, 248, 230, .94); border-radius: 16px; padding: 8px 12px; display: grid; grid-template-columns: 34px 44px 1fr; align-items: center; gap: 10px; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.rank-row .n { font-weight: 900; font-size: 1.4rem; text-align: center; }
.rank-row .av svg { width: 44px; height: 52px; }
.rank-row small { display: block; color: var(--ink-2); font-weight: 700; }
.rank-row .missed { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rank-row .missed span { background: #ffe3e7; color: #8f1a2e; padding: 1px 8px; border-radius: 999px; font-weight: 800; font-size: .88rem; }
.rank-row.win { background: #fff6bd; box-shadow: 0 0 0 3px var(--gold), 0 4px 0 rgba(0,0,0,.2); }

/* ---------- Boîtes de dialogue ---------- */
.dlg { border: 5px solid #8a6a2f; border-radius: 22px; background: var(--card); color: var(--ink); max-width: min(92vw, 520px); padding: 18px 20px; box-shadow: 0 0 0 4px #d9b25a, 0 20px 50px rgba(0,0,0,.55); user-select: text; }
.dlg::backdrop { background: rgba(5, 25, 12, .6); }
.dlg h2 { color: var(--ink); text-shadow: none; margin: 0 0 8px; }
.dlg .hint { color: var(--ink-2); text-shadow: none; }
.rules-list { padding-left: 1.2em; margin: 6px 0; display: grid; gap: 8px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

/* ---------- Adaptation ---------- */
@media (max-height: 560px) and (orientation: landscape) {
  .topbar { padding: 4px 10px 0; }
  .btn.xl { padding: 8px 22px; }
  .home-art { display: none; }
  .logo-top { font-size: 3rem; } .logo-bottom { font-size: 2rem; }
  .pchip { min-width: 100px; padding: 2px 8px 2px 4px; }
  .pchip .av { width: 32px; height: 38px; }
  .dock { padding: 2px 12px 6px; }
  .q-emoji { font-size: 2.4rem; min-height: 0; } .word { font-size: 2rem; margin-bottom: 4px; }
  .choice { min-height: 50px; font-size: 1.8rem; padding: 4px; }
  .card { padding: 8px 14px 10px; }
}
@media (min-width: 900px) { .pchip { min-width: 150px; } .pchip .nm { font-size: 1.05rem; } .heart { width: 24px; height: 24px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #sparks { display: none; }
}

.scene-hero.still { animation: none; transform: translateX(-50%); bottom: 3%; width: 34%; }
.scene-hero.cheer { z-index: 1; }
.q-emoji:empty { display: none; }
@media (max-width: 560px) {
  .players { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 4px 8px; }
  .pchip { flex: 1 1 calc(50% - 6px); max-width: 240px; min-width: 0; grid-template-columns: 34px 1fr; padding: 4px 6px 4px 4px; }
  .pchip .av { width: 34px; height: 40px; }
  .pchip .nm { max-width: none; font-size: .9rem; }
  .heart { width: 18px; height: 18px; }
}
.rank-row .n { font-size: 1.9rem; line-height: 1; }
