:root {
  --bg1: #4361ee; --bg2: #7b2cbf; --ink: #22223b; --paper: #fffdf7; --muted: #6c6c8a;
  --yellow: #ffd166; --good: #2ec4b6; --bad: #ef476f; --warn: #ff9f1c;
  --c: #4361ee;
  --radius: 22px;
  --font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--ink); font-size: 18px; line-height: 1.35;
  background: linear-gradient(160deg, var(--bg1), var(--bg2)) fixed;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
body::before { /* motif de pois en fond */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .13;
  background-image: radial-gradient(#fff 3px, transparent 4px), radial-gradient(#fff 2px, transparent 3px);
  background-size: 64px 64px, 40px 40px; background-position: 0 0, 22px 30px;
}
#app { position: relative; max-width: 560px; margin: 0 auto; padding: 14px 14px 28px; min-height: 100dvh; }
h1, h2, h3 { margin: 0; line-height: 1.1; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:disabled { opacity: .45; cursor: default; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .85em; }
.pop { animation: pop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Boutons ---------- */
.btn {
  background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 1.05rem;
  padding: 14px 20px; border-radius: 18px; box-shadow: 0 5px 0 rgba(0,0,0,.22);
  transition: transform .08s, box-shadow .08s; min-height: 54px;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.btn.big { flex: 1.6; font-size: 1.2rem; }
.btn.ghost { background: rgba(255,255,255,.92); }
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.warn { background: var(--warn); }
.btn.tiny { min-height: 38px; padding: 8px 14px; font-size: .9rem; box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.actions { display: flex; gap: 12px; margin-top: 18px; }
.actions .btn { flex: 1; }
.actions.sticky { position: sticky; bottom: 0; padding: 12px 0 4px; background: linear-gradient(transparent, rgba(67,97,238,.0) 0, rgba(80,40,160,.55)); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.92); font-size: 1.1rem; font-weight: 900; box-shadow: 0 3px 0 rgba(0,0,0,.2); }

.card { background: var(--paper); border-radius: var(--radius); padding: 18px; margin-top: 14px; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.card h3 { margin-bottom: 10px; }
.card p { margin: 0 0 8px; }
.input {
  width: 100%; font: inherit; font-weight: 700; padding: 12px 14px; border-radius: 14px;
  border: 3px solid #e4e1f5; background: #fff; color: var(--ink); user-select: text; -webkit-user-select: text;
}
.input:focus { outline: none; border-color: var(--c); }

/* ---------- Accueil ---------- */
.home { text-align: center; color: #fff; }
.road { height: 56px; position: relative; overflow: hidden; margin: 6px -14px 0; }
.road::after { content: ""; position: absolute; left: 0; right: 0; bottom: 8px; border-top: 5px dashed rgba(255,255,255,.7); }
.car { position: absolute; bottom: 14px; font-size: 40px; animation: drive 6s linear infinite; }
@keyframes drive { from { left: -60px; } to { left: 105%; } }
.logo { font-size: clamp(2.2rem, 11vw, 3.2rem); text-shadow: 0 4px 0 rgba(0,0,0,.25); letter-spacing: .5px; margin-top: 6px; }
.sub { margin: 6px 0 18px; font-weight: 700; opacity: .95; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile {
  background: var(--c); color: #fff; border-radius: 26px; padding: 18px 8px 16px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  box-shadow: 0 7px 0 rgba(0,0,0,.25), inset 0 -8px 0 rgba(0,0,0,.1); transition: transform .1s;
  border: 4px solid rgba(255,255,255,.35);
}
.tile:active { transform: translateY(5px) scale(.98); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.tile .ico { font-size: 3.4rem; filter: drop-shadow(0 4px 0 rgba(0,0,0,.2)); }
.tile .nm { font-weight: 900; font-size: 1.1rem; line-height: 1.1; text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.tile:nth-child(odd) { transform: rotate(-1deg); } .tile:nth-child(even) { transform: rotate(1deg); }
.tile:nth-child(odd):active, .tile:nth-child(even):active { transform: translateY(5px) scale(.98); }

/* ---------- Intro / setup ---------- */
.hero { text-align: center; color: #fff; padding: 10px 0 4px; }
.hero .ico { font-size: 5rem; display: block; filter: drop-shadow(0 6px 0 rgba(0,0,0,.25)); animation: bob 2s ease-in-out infinite; }
.hero h2 { font-size: 2rem; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.hero.small .ico { font-size: 3rem; } .hero.small h2 { font-size: 1.5rem; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(4deg); } }
.rules { margin: 0; padding-left: 1.3em; } .rules li { margin: 8px 0; }
.rules li::marker { color: var(--c); font-weight: 900; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 6px 0 12px; }
.stepper button { width: 56px; height: 56px; border-radius: 50%; background: var(--c); color: #fff; font-size: 2rem; font-weight: 900; box-shadow: 0 4px 0 rgba(0,0,0,.25); line-height: 1; }
.stepper b { font-size: 2.6rem; min-width: 60px; text-align: center; }
.stepper.small { margin: 0; gap: 10px; } .stepper.small button { width: 42px; height: 42px; font-size: 1.5rem; } .stepper.small b { font-size: 1.3rem; min-width: 64px; }
.setRow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 700; padding: 6px 0; }
.names { display: grid; gap: 10px; }
.nameRow { display: flex; align-items: center; gap: 10px; }
.av { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c); font-size: 1.4rem; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.av.xl { width: 84px; height: 84px; font-size: 3rem; }

/* ---------- Jeu : commun ---------- */
.gamebar { display: flex; align-items: center; gap: 10px; color: #fff; }
.gtitle { flex: 1; font-weight: 900; font-size: 1.15rem; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.gm { background: rgba(0,0,0,.25); padding: 6px 12px; border-radius: 20px; font-size: .8rem; font-weight: 800; color: #fff; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#stage { margin-top: 12px; }
.roundtag { text-align: center; color: #fff; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.goal { text-align: center; color: #fff; font-weight: 900; margin-bottom: 8px; }
.big-card { text-align: center; padding: 26px 18px; }
.bigico { font-size: 5.5rem; line-height: 1; margin-bottom: 8px; }
.bigtext { font-size: 1.7rem; font-weight: 900; line-height: 1.15; }
.bigtext.xl { font-size: 2.2rem; color: var(--c); margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; padding: 3px 12px 3px 3px; border-radius: 30px; font-weight: 800; font-size: .85rem; border: 3px solid var(--c); }
.chip .av { width: 28px; height: 28px; font-size: 1rem; }
.chip.out { opacity: .35; text-decoration: line-through; filter: grayscale(1); }
.chip.cur { box-shadow: 0 0 0 4px var(--yellow); }
.legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; margin-top: 12px; }
.sc { background: #fff; border-radius: 16px; padding: 8px 4px; text-align: center; border-bottom: 5px solid var(--c); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.sc b { font-size: 1.2rem; } .sc small { font-weight: 700; font-size: .75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Trésor ---------- */
.pbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.pbtn { background: var(--c); color: #fff; border-radius: 20px; padding: 10px 8px 12px; display: grid; justify-items: center; gap: 2px; box-shadow: 0 5px 0 rgba(0,0,0,.25); font-weight: 900; transition: transform .08s; }
.pbtn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,.25); }
.pbtn .av { background: rgba(255,255,255,.3); } .pbtn .nm { font-size: 1rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pbtn .pts { font-size: .85rem; opacity: .95; }
.pbar { width: 80%; height: 8px; background: rgba(0,0,0,.25); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.pbar i { display: block; height: 100%; background: #fff; border-radius: 8px; transition: width .3s; }

/* ---------- Timer ---------- */
.timer { text-align: center; margin: 10px 0; }
.tnum { font-size: 4.6rem; font-weight: 900; color: #fff; line-height: 1; text-shadow: 0 5px 0 rgba(0,0,0,.25); }
.tnum.urgent { color: var(--yellow); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }
.tbar { height: 14px; background: rgba(0,0,0,.3); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.tbar i { display: block; height: 100%; background: var(--good); border-radius: 14px; transition: width .25s linear; }
.tbar i.urgent { background: var(--bad); }

/* ---------- Petit Bac ---------- */
.slot { background: #1d1d3a; border-radius: 28px; padding: 14px; margin: 6px 0 14px; box-shadow: 0 8px 0 rgba(0,0,0,.3), inset 0 0 0 5px var(--yellow); }
.reel { background: #fff; border-radius: 18px; height: 150px; display: flex; align-items: center; justify-content: center; font-size: 7.5rem; font-weight: 900; color: var(--c); box-shadow: inset 0 8px 14px rgba(0,0,0,.18), inset 0 -8px 14px rgba(0,0,0,.18); }
.reel.spinning { filter: blur(1.2px); }
.reel.landed { animation: pop .4s; color: var(--bad); }
.themes { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.themes li { background: #fff; border-left: 14px solid var(--c); border-radius: 14px; padding: 10px 14px; font-weight: 800; box-shadow: 0 3px 0 rgba(0,0,0,.15); }
.theme-card { text-align: center; }
.letterBadge { width: 86px; height: 86px; margin: 0 auto 4px; border-radius: 24px; background: var(--yellow); display: flex; align-items: center; justify-content: center; font-size: 3.4rem; font-weight: 900; box-shadow: 0 5px 0 rgba(0,0,0,.25); transform: rotate(-4deg); }
.inl { background: var(--yellow); padding: 0 10px; border-radius: 10px; }
.bac h3 { color: #fff; }
.gridwrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius); padding: 8px; box-shadow: 0 5px 0 rgba(0,0,0,.18); }
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 4px 2px; text-align: center; }
.grid thead .av { background: var(--c); width: 36px; height: 36px; font-size: 1.2rem; }
.grid .rl { text-align: left; font-size: .8rem; font-weight: 800; padding-right: 4px; line-height: 1.1; }
.cell { width: 40px; height: 40px; border-radius: 12px; background: #eceaf7; box-shadow: inset 0 -3px 0 rgba(0,0,0,.1); font-size: 1.4rem; line-height: 1; color: #fff; }
.cell.on { background: var(--c); } .cell.on::after { content: "✔"; }
.grid tfoot td { font-weight: 900; font-size: 1.2rem; border-top: 3px solid #e4e1f5; }
.rank { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.rank li { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 18px; padding: 8px 14px 8px 8px; border-left: 12px solid var(--c); font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.rank li .av { background: var(--c); } .rank .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.rank .plus { color: var(--good); font-size: 1rem; font-weight: 900; } .rank b { font-size: 1.15rem; min-width: 70px; text-align: right; }
.rank li.win { background: var(--yellow); }
.medal { font-size: 1.6rem; width: 30px; }

/* ---------- Élimination ---------- */
.promptbar { background: rgba(255,255,255,.95); border-radius: 16px; padding: 10px 14px; text-align: center; font-weight: 700; box-shadow: 0 4px 0 rgba(0,0,0,.2); }
.promptbar b { color: var(--c); font-size: 1.15em; }
.whoturn { text-align: center; color: #fff; margin: 12px 0 0; }
.whoturn .av { background: var(--c); border: 5px solid #fff; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.whoturn .nm { font-size: 2rem; font-weight: 900; text-shadow: 0 3px 0 rgba(0,0,0,.25); margin-top: 6px; }
.whoturn .muted { color: rgba(255,255,255,.85); }
.whoturn.out .av { filter: grayscale(1); } .whoturn .bigtext { margin-top: 6px; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.hintbox { text-align: center; margin-top: 8px; color: #fff; } #hintlist { background: rgba(255,255,255,.95); color: var(--ink); border-radius: 14px; padding: 10px; margin-top: 8px; font-weight: 700; font-size: .9rem; }
#hintlist[hidden] { display: none; }
.trophy { font-size: 5rem; text-align: center; animation: bob 1.5s ease-in-out infinite; }

/* ---------- Podium ---------- */
.podium { text-align: center; color: #fff; position: relative; padding-top: 10px; }
.podium h2 { font-size: 2rem; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.podium .rank { color: var(--ink); text-align: left; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti i { position: absolute; top: -40px; font-style: normal; font-size: 1.8rem; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(110vh) rotate(360deg); } }

@media (max-width: 360px) { body { font-size: 16px; } .reel { font-size: 6rem; height: 120px; } .cell { width: 34px; height: 34px; } }
@media (min-width: 700px) { #app { padding-top: 28px; } }
@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation: none !important; transition: none !important; } }
