:root {
  --felt: #0f5a3c;
  --felt-dark: #0b3d2a;
  --wood: #5a3418;
  --gold: #e3b341;
  --ink: #f4efe2;
  --muted: #b9c9bd;
  --red: #d64545;
  --green: #2f9e60;
  --card: rgba(0, 0, 0, .28);
  --die: #fbf7ec;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow-x: hidden; }
body {
  background: radial-gradient(ellipse at 50% 30%, #146b48 0%, var(--felt-dark) 75%) fixed, var(--felt-dark);
  color: var(--ink);
  font: 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
#app {
  max-width: 520px; margin: 0 auto; min-height: 100%;
  padding: max(10px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
button:disabled { opacity: .35; cursor: default; }
input { font: inherit; -webkit-user-select: text; user-select: text; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; margin: 0; }

/* ---------- Boutons ---------- */
.btn {
  display: block; width: 100%; padding: 14px 16px; border-radius: 14px;
  font-weight: 700; font-size: 1.05rem; background: rgba(255,255,255,.12);
  transition: transform .08s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(#f0c75a, #c9971f); color: #2b1a05; box-shadow: 0 4px 0 #8a6510; }
.btn.danger  { background: linear-gradient(#e85d5d, #b52f2f); box-shadow: 0 4px 0 #7a1c1c; font-size: 1.2rem; }
.btn.good    { background: linear-gradient(#3dbb76, #23804c); box-shadow: 0 4px 0 #145a33; font-size: 1.2rem; }
.btn.ghost   { background: transparent; border: 2px solid rgba(255,255,255,.25); }
.btn.big     { padding: 18px; font-size: 1.25rem; }
.btn .tag { font-size: .8rem; background: rgba(0,0,0,.2); padding: 2px 8px; border-radius: 99px; margin-left: 4px; }
.icon {
  width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.1);
  display: inline-grid; place-items: center; font-size: 1.1rem; flex: none;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chip {
  padding: 7px 11px; border-radius: 99px; background: rgba(255,255,255,.1);
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.chip.on { background: var(--gold); color: #2b1a05; }

/* ---------- Dés ---------- */
.die {
  --s: min(15vw, 62px);
  width: var(--s); height: var(--s); border-radius: 22%;
  background: linear-gradient(145deg, #fffdf6, #e8e0cc);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.12), 0 3px 6px rgba(0,0,0,.45);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; flex: none; padding: 0; line-height: 1;
  font-family: Georgia, "Times New Roman", serif; font-weight: 700;
}
.die .fv { font-size: calc(var(--s) * .5); }
/* 9 noir, 10 rouge, Valet bleu, Dame verte, Roi rouge, As noir */
.die.f0 { color: #1b1b1b; }
.die.f1 { color: #c0262d; }
.die.f2 { color: #1f4fbf; }
.die.f3 { color: #1d7a3a; }
.die.f4 { color: #c0262d; }
.die.f5 { color: #1b1b1b; }
.die .fig { width: 86%; height: 86%; display: block; }
.die .corner { position: absolute; top: 6%; left: 9%; font-size: calc(var(--s) * .2); line-height: 1; }
.die .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.die.rolled { animation: tumble .55s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes tumble {
  0% { transform: translateY(-40px) rotate(-200deg) scale(.6); opacity: 0; }
  60% { transform: translateY(4px) rotate(10deg) scale(1.05); opacity: 1; }
  100% { transform: none; }
}
.dice-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: min(15vw, 62px); align-items: center; }
.empty { color: var(--muted); font-style: italic; font-size: .9rem; }

/* sorts des dés pendant « je te crois » */
.dice-row.arrange { gap: 8px; padding-bottom: 26px; }
.die .badge {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font: 600 .66rem system-ui, sans-serif; white-space: nowrap; color: var(--ink);
  background: rgba(0,0,0,.35); padding: 2px 5px; border-radius: 6px;
}
.die.m-table { outline: 3px solid var(--gold); outline-offset: 2px; }
.die.m-cup { filter: brightness(.85); }
.die.m-reroll { opacity: .6; outline: 2px dashed #fff; outline-offset: 2px; }
.quick { display: flex; gap: 8px; justify-content: center; margin-top: 4px; }

/* ---------- Tapis & gobelet ---------- */
.felt {
  overflow: hidden;
  background: radial-gradient(ellipse at center, #17734d, #0d4c33);
  border: 6px solid var(--wood); border-radius: 22px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.5), 0 6px 16px rgba(0,0,0,.4);
  padding: 12px 10px; display: flex; flex-direction: column; gap: 12px;
}
.zl { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: center; margin-bottom: 6px; }
.cup-wrap { display: grid; place-items: center; }
.cup { width: 120px; position: relative; transform-origin: 50% 90%; }
.cup.ready { animation: wobble 1.6s ease-in-out infinite; }
.cup.shaking, .shaking { animation: shake .12s linear infinite; }
.cup-wrap.small .cup { width: 84px; }
.cup svg { display: block; width: 100%; filter: drop-shadow(0 6px 6px rgba(0,0,0,.5)); }
.cup .cnt {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%);
  background: var(--gold); color: #2b1a05; font-weight: 800; border-radius: 99px;
  width: 30px; height: 30px; display: grid; place-items: center;
}
@keyframes wobble { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-3deg) translateY(-2px); } }
@keyframes shake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(-6px, -4px) rotate(-8deg); }
  50% { transform: translate(5px, 3px) rotate(7deg); }
  75% { transform: translate(-4px, 2px) rotate(-5deg); }
}

/* ---------- Barre des joueurs ---------- */
.topbar { display: flex; gap: 8px; align-items: flex-start; }
.players { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.tools { display: flex; gap: 6px; }
.pl {
  background: var(--card); border-radius: 10px; padding: 5px 9px; min-width: 0;
  display: flex; flex-direction: column; gap: 3px; border: 2px solid transparent;
}
.pl .nm { font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.pl .lv { display: flex; gap: 3px; min-height: 10px; font-size: .7rem; }
.pl.cur { border-color: var(--gold); }
.pl.out { opacity: .4; }
.tok { width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe08a, #c9971f); box-shadow: 0 0 0 1px #7a5a10; }

/* ---------- Annonce ---------- */
.banner {
  background: var(--card); border-radius: 14px; padding: 10px 14px; text-align: center;
  border: 1px solid rgba(227,179,65,.4);
}
.banner small { display: block; color: var(--muted); }
.banner strong { font-family: Georgia, serif; font-size: 1.4rem; color: var(--gold); }
.banner.muted { color: var(--muted); font-style: italic; border-color: transparent; }
.claim-inline { color: var(--gold); font-weight: 700; }
.msg { color: var(--ink); text-align: center; margin: 0; }
.msg.top { font-size: .9rem; color: var(--muted); }
.hint { text-align: center; color: var(--muted); margin: 0 0 4px; }
.hint.big { font-size: 1.1rem; color: var(--ink); }
.hint.small { font-size: .8rem; margin: -4px 0 0; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
.hist { font-size: .85rem; color: var(--muted); }
.hist ol { margin: 6px 0 0; padding-left: 22px; }
.thinking { text-align: center; font-size: 1.1rem; }
.dots::after { content: ''; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* ---------- Choix de l'annonce ---------- */
.picker { display: flex; flex-direction: column; gap: 10px; background: var(--card); border-radius: 16px; padding: 12px; }
.mine { text-align: center; }
.mine b { color: var(--gold); }
.types { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.vals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-height: 32vh; overflow-y: auto; }
.vals.wide { grid-template-columns: repeat(2, 1fr); }
.val { padding: 10px 6px; border-radius: 10px; background: rgba(255,255,255,.1); font-weight: 600; font-size: .9rem; }
.val.true { box-shadow: inset 0 0 0 2px rgba(61,187,118,.6); }
.val.on { background: var(--gold); color: #2b1a05; }

/* ---------- Écrans ---------- */
.setup { display: flex; flex-direction: column; gap: 14px; }
.hero { text-align: center; padding: 16px 0 4px; }
.hero h1 { font-size: 2.4rem; color: var(--gold); text-shadow: 0 3px 0 rgba(0,0,0,.4); }
.hero p { color: var(--muted); margin: 4px 0 0; }
.hero-dice { display: flex; gap: 6px; justify-content: center; margin-bottom: 12px; }
.hero-dice .die { --s: 46px; }
.hero-dice .die:nth-child(odd) { transform: rotate(-8deg); }
.hero-dice .die:nth-child(even) { transform: rotate(6deg) translateY(4px); }
.card { background: var(--card); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card h2 { font-size: 1.2rem; }
.prow { display: flex; gap: 8px; align-items: center; }
.prow input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2);
  background: rgba(0,0,0,.25); color: var(--ink);
}
.kind { width: 44px; height: 44px; border-radius: 10px; background: rgba(255,255,255,.12); font-size: 1.3rem; flex: none; }
.lives { display: flex; justify-content: space-between; align-items: center; }
.stepper { display: flex; gap: 12px; align-items: center; }
.stepper b { font-size: 1.2rem; min-width: 1ch; text-align: center; }
.rules summary { font-weight: 700; cursor: pointer; }
.rules p { margin: 0; font-size: .92rem; color: #dfe8e1; }

.handoff, .end { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 18px; text-align: center; }
.handoff .phone { font-size: 4rem; animation: wobble 1.4s ease-in-out infinite; }
.handoff h2 { font-size: 1.4rem; }
.handoff h2 span { color: var(--gold); font-size: 2rem; }
.end .trophy { font-size: 5rem; }
.end h2 { font-size: 2rem; color: var(--gold); }

.reveal { overflow: hidden; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.reveal p { margin: 0; }
.shout { color: var(--red); font-size: 2.2rem; animation: pop .4s ease-out; }
@keyframes pop { from { transform: scale(1.5); opacity: 0; } }
.actual b { color: var(--gold); }
.verdict { padding: 14px; border-radius: 14px; font-size: 1.1rem; animation: pop .4s .8s ease-out both; }
.verdict.truth { background: rgba(47,158,96,.35); }
.verdict.lie { background: rgba(214,69,69,.35); }

@media (min-height: 760px) { #app { gap: 16px; } }

/* ---------- Mode à voix haute ---------- */
.banner .prev { display: block; font-weight: 600; color: var(--ink); }
.dice-row.peek { padding: 6px; border-radius: 14px; background: rgba(0,0,0,.25); box-shadow: inset 0 0 0 2px rgba(155,28,34,.6); }
.btn.danger.armed { animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.04); filter: brightness(1.2); } }
.bots summary { font-weight: 700; cursor: pointer; }
.setup > .hint { margin-top: -6px; }

/* Dés lancés sur la table : ils arrivent du bord, roulent, rebondissent et s'arrêtent */
.die.throw { animation: throw 1.1s cubic-bezier(.25,.6,.35,1) both; }
@keyframes throw {
  0%   { transform: translate(var(--dx), var(--dy)) rotate(var(--r0)) scale(.85); opacity: 0; }
  12%  { opacity: 1; }
  38%  { transform: translate(calc(var(--dx) * .25), var(--hop)) rotate(var(--r1)) scale(1.08); }
  60%  { transform: translate(calc(var(--dx) * -.06), 0) rotate(var(--r2)) scale(1); }
  70%  { transform: translate(calc(var(--dx) * -.03), calc(var(--hop) * .3)) rotate(calc(var(--r2) * -.4)); }
  78%  { transform: translate(0, 0) rotate(calc(var(--r2) * .2)); }
  100% { transform: none; }
}
.apptitle { flex: 1; align-self: center; font: 700 1.2rem Georgia, serif; color: var(--gold); }

/* Choix du style des dés */
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-opt { background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; border: 2px solid transparent; }
.style-opt.on { border-color: var(--gold); background: rgba(227,179,65,.15); }
.style-opt .mini { display: flex; gap: 4px; }
.style-opt .die { --s: 34px; }

/* Dernier lancer (table ou chapeau), utile au joueur suivant */
.lastroll { text-align: center; padding: 9px 12px; border-radius: 12px; background: var(--card); color: var(--muted); font-size: .95rem; }
.lastroll b { color: var(--ink); }
.lastroll.hat { box-shadow: inset 0 0 0 2px rgba(155,28,34,.7); }
.lastroll.table { box-shadow: inset 0 0 0 2px rgba(227,179,65,.6); }

/* ---------- Table de poker vue du dessus ---------- */
.ptable { position: relative; height: 200px; margin: 4px 0 2px; }
.ptable .oval {
  position: absolute; inset: 26px 12%; border-radius: 50%;
  background: radial-gradient(ellipse at center, #1a7a52, #0d4c33 75%);
  border: 8px solid var(--wood); box-shadow: inset 0 0 18px rgba(0,0,0,.6), 0 6px 14px rgba(0,0,0,.45);
}
.pot { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 96px; height: 70px; }
.pot-lbl { position: absolute; left: 50%; bottom: -16px; transform: translateX(-50%); white-space: nowrap; font-size: .72rem; font-weight: 700; color: #fff; background: rgba(0,0,0,.45); padding: 1px 8px; border-radius: 99px; }
.phase { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; }
.phase.decharge { color: var(--gold); font-weight: 700; }
.pile { position: absolute; inset: 0; }
.pile-tok { position: absolute; width: 22px; height: 22px; transform: translate(-50%, -50%); filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.tok-svg { width: 100%; height: 100%; display: block; }
.seat {
  position: absolute; transform: translate(-50%, -50%); min-width: 64px; max-width: 96px;
  background: #13261d; border: 2px solid rgba(255,255,255,.18); border-radius: 12px;
  padding: 3px 7px; text-align: center; box-shadow: 0 3px 8px rgba(0,0,0,.5); transition: transform .2s;
}
.seat .sname { display: block; font-size: .74rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .stoks { display: inline-flex; align-items: center; gap: 3px; font-size: .85rem; }
.seat .stoks .tok-svg { width: 16px; height: 16px; }
.seat.cur { border-color: var(--gold); background: #3a2f10; box-shadow: 0 0 14px rgba(227,179,65,.7); }
.seat.prev { border-color: rgba(255,255,255,.45); }
.seat.out { opacity: .55; }
.seat.out .stoks { color: #7fe0a6; font-size: .72rem; }
.seat.bump { transform: translate(-50%, -50%) scale(1.18); }
.fly-tok { position: fixed; width: 28px; height: 28px; z-index: 50; pointer-events: none; transition: transform .8s cubic-bezier(.3,.7,.3,1); filter: drop-shadow(0 4px 4px rgba(0,0,0,.5)); }
.gmsg { text-align: center; margin: 0; font-size: .88rem; color: var(--muted); }
.gmsg b { color: var(--ink); }
.turn { text-align: center; margin: 0; font-size: 1.05rem; }
.turn b { color: var(--gold); }
.btn.loser { display: flex; flex-direction: column; gap: 2px; background: linear-gradient(#e85d5d, #b52f2f); box-shadow: 0 4px 0 #7a1c1c; }
.btn.loser small, .btn.big small { font-weight: 500; font-size: .8rem; opacity: .85; }
.ask { margin: 6px 0 0; font-family: Georgia, serif; font-size: 1.4rem; }
.shout.gold { color: var(--gold); }
.tokens { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tok-prev { position: relative; width: 70px; height: 40px; display: block; }
.potinfo { text-align: center; margin: 4px 0 0; color: var(--muted); }
.potinfo b { color: var(--gold); }
.prow .num { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #2b1a05; font-weight: 800; display: grid; place-items: center; flex: none; }

/* Écran de jeu compact : tout doit tenir sur un téléphone sans défiler */
#app[data-screen="oral"] { gap: 8px; }
#app[data-screen="oral"] .ptable { height: 172px; margin: 0; }
#app[data-screen="oral"] .ptable .oval { inset: 22px 13%; }
#app[data-screen="oral"] .felt { padding: 8px 10px; gap: 6px; }
#app[data-screen="oral"] .zl { margin-bottom: 4px; }
#app[data-screen="oral"] .cup { width: 86px; }
#app[data-screen="oral"] .gmsg { font-size: .8rem; }
#app[data-screen="oral"] .lastroll { padding: 6px 10px; font-size: .85rem; }
#app[data-screen="oral"] .actions { gap: 8px; }
#app[data-screen="oral"] .actions .btn { padding: 12px 14px; }
#app[data-screen="oral"] .actions .btn.big { padding: 14px; font-size: 1.15rem; }

.pstrip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pchip { display: inline-flex; align-items: center; gap: 4px; background: #13261d; border: 2px solid rgba(255,255,255,.15); border-radius: 99px; padding: 3px 10px; font-size: .8rem; font-weight: 600; }
.pchip .tok-svg { width: 14px; height: 14px; }
.pchip.cur { border-color: var(--gold); background: #3a2f10; }
.pchip.out { opacity: .55; }
.pchip.potchip { background: transparent; }
.mine small { color: var(--muted); font-weight: 400; }
.pot { top: 40%; }
.pot-lbl { bottom: -8px; }
#app[data-screen="oral"] [data-act="oralPass"] { font-size: .92rem; padding-left: 8px; padding-right: 8px; }

/* Glisser un dé */
#app[data-screen="oral"] .die[data-act="oralTap"] { touch-action: none; }
.die.dragging { z-index: 40; position: relative; transition: none; box-shadow: 0 14px 22px rgba(0,0,0,.55); }

/* Choix du mode */
.style-opt.mode { padding: 12px 8px; }
.style-opt.mode .mode-ico { font-size: 1.8rem; line-height: 1; }
.style-opt.mode small { color: var(--muted); font-size: .78rem; line-height: 1.3; }

/* Roue de la fortune */
.wheel-screen { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center; }
.wheel-screen h2 { font-size: 1.8rem; color: var(--gold); }
.wheel-box { position: relative; width: min(84vw, 340px); aspect-ratio: 1; }
.wheel { width: 100%; height: 100%; transition: transform 4.8s cubic-bezier(.12,.6,.1,1); filter: drop-shadow(0 8px 16px rgba(0,0,0,.5)); }
.wheel-svg { width: 100%; height: 100%; display: block; }
.wheel-ptr { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); z-index: 2; width: 0; height: 0;
  border-left: 16px solid transparent; border-right: 16px solid transparent; border-top: 30px solid var(--gold); filter: drop-shadow(0 3px 3px rgba(0,0,0,.6)); }
.wheel-res { font-size: 1.5rem; margin: 0; animation: pop .4s ease-out; }
.wheel-res b { color: var(--gold); }

.ptable > .phase { top: 0; left: 0; transform: none; background: rgba(0,0,0,.3); padding: 2px 8px; border-radius: 99px; }
#app[data-screen="oral"] .dice-row.peek { gap: 5px; padding: 6px 4px; }
.btn.big small { display: block; }

/* Interrupteur d'option */
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 4px; background: none; text-align: left; font-weight: 600; }
.toggle i { flex: none; width: 50px; height: 30px; border-radius: 99px; background: rgba(255,255,255,.2); position: relative; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle.on i { background: var(--green); }
.toggle.on i::after { transform: translateX(20px); }
.icon.off { opacity: .4; }

/* ---------- Jeu en ligne ---------- */
.online-btn { background: linear-gradient(#2f7fd0, #1f5a99); box-shadow: 0 4px 0 #143d69; color: #fff; }
.txt { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); color: var(--ink); font-size: 1rem; }
.txt.key { text-transform: uppercase; letter-spacing: .2em; font-weight: 700; text-align: center; }
.keyrow { display: flex; gap: 8px; }
.keyrow .btn { width: auto; flex: none; }
.btn.sm { width: auto; padding: 8px 14px; font-size: .9rem; }
.errmsg { background: rgba(214,69,69,.3); border-radius: 12px; padding: 10px 14px; margin: 0; text-align: center; }
.roomlist { display: flex; flex-direction: column; gap: 8px; }
.roomrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px 12px; }
.roomrow small { display: block; color: var(--muted); font-size: .78rem; }
.online-wait, .waiting { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.online-wait { flex: 1; justify-content: center; }
.waiting p { margin: 0; }
.waiting .spinhat { width: 46px; }
.spinhat { width: 90px; animation: hatspin 2.4s ease-in-out infinite; transform-origin: 50% 80%; }
.spinhat svg { width: 100%; display: block; }
@keyframes hatspin { 0% { transform: rotateY(0) translateY(0); } 25% { transform: rotateY(180deg) translateY(-6px); } 50% { transform: rotateY(360deg) translateY(0); } 100% { transform: rotateY(360deg); } }
.ptable.lobby .lobby-hat { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.ptable.lobby .lobby-hat .spinhat { width: 64px; animation: hatroll 3s linear infinite; }
@keyframes hatroll { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.seat.offline { opacity: .45; filter: grayscale(1); }
.share { align-items: stretch; }
.bigkey { text-align: center; font-size: 1.1rem; }
.bigkey b { font-size: 1.8rem; letter-spacing: .25em; color: var(--gold); }
.invite { border: 2px solid var(--green); }
.chatbtn { position: relative; }
.badge-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 800; display: grid; place-items: center; }
.badge-n:empty { display: none; }
#chat { position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 360px); z-index: 60; background: #0d2b1f; border-left: 3px solid var(--wood);
  transform: translateX(105%); transition: transform .25s ease; display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); gap: 8px; box-shadow: -10px 0 30px rgba(0,0,0,.5); }
#chat.open { transform: none; }
#chatShade { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
#chatShade.open { opacity: 1; pointer-events: auto; }
.chat-head { display: flex; justify-content: space-between; align-items: center; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; -webkit-user-select: text; user-select: text; }
.msg { align-self: flex-start; max-width: 85%; background: rgba(255,255,255,.1); border-radius: 12px 12px 12px 4px; padding: 6px 10px; }
.msg.me { align-self: flex-end; background: rgba(227,179,65,.25); border-radius: 12px 12px 4px 12px; }
.msg small { display: block; color: var(--muted); font-size: .7rem; font-weight: 700; }
.msg span { word-wrap: break-word; }
.msg-sys { align-self: center; text-align: center; font-size: .78rem; color: var(--muted); background: rgba(0,0,0,.25); border-radius: 10px; padding: 4px 10px; }
.chat-quick { display: flex; gap: 6px; justify-content: space-between; }
.chat-quick button { flex: 1; font-size: 1.3rem; background: rgba(255,255,255,.08); border-radius: 10px; padding: 6px 0; }
.chat-input { display: flex; gap: 6px; }
.chat-input input { flex: 1; min-width: 0; padding: 10px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: var(--ink); font-size: 1rem; }
.apptitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Compte à rebours et spectateurs (en ligne) */
.infoline { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 0; }
.infoline:empty { display: none; }
.timer { background: rgba(0,0,0,.35); border-radius: 99px; padding: 3px 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.urgent { background: var(--red); animation: pulse .5s ease-in-out infinite alternate; }
.tag-spec, .spec-n { background: rgba(31,90,153,.6); border-radius: 99px; padding: 3px 10px; font-size: .85rem; font-weight: 600; }

/* ---------- Projectiles entre joueurs ---------- */
.seat, .pchip { cursor: pointer; }
#fxMenu { position: fixed; inset: 0; z-index: 70; display: none; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.45); padding: 16px; }
#fxMenu.open { display: flex; }
.fx-card { width: min(100%, 420px); background: #13261d; border: 2px solid var(--wood); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 12px; animation: slideup .22s ease-out;
  margin-bottom: env(safe-area-inset-bottom); }
.fx-head { text-align: center; font-size: 1.05rem; }
.fx-head b { color: var(--gold); }
.fx-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fx-grid button { background: rgba(255,255,255,.08); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.fx-grid button:active { transform: scale(.94); }
.fx-grid span { font-size: 2rem; line-height: 1.1; }
.fx-grid small { font-size: .75rem; color: var(--muted); font-weight: 600; }
.fx-card .btn.sm { align-self: center; }
.fx-proj { position: fixed; left: 0; top: 0; z-index: 80; font-size: 2.2rem; pointer-events: none; filter: drop-shadow(0 6px 6px rgba(0,0,0,.5)); }
.fx-hit { animation: fxhit .5s ease-out; }
@keyframes fxhit { 0%, 100% { transform: translate(-50%, -50%); } 20% { transform: translate(-50%, -50%) translate(-6px, 3px) rotate(-6deg) scale(1.12); } 45% { transform: translate(-50%, -50%) translate(5px, -2px) rotate(5deg); } 70% { transform: translate(-50%, -50%) translate(-3px, 1px); } }
.pchip.fx-hit { animation: fxhitchip .5s ease-out; }
@keyframes fxhitchip { 20% { transform: rotate(-8deg) scale(1.15); } 50% { transform: rotate(6deg); } }
.fx-burst { position: fixed; z-index: 81; width: 0; height: 0; pointer-events: none; }
.fx-burst .blob { position: absolute; left: -36px; top: -30px; width: 72px; height: 60px; background: var(--c); border-radius: 46% 54% 42% 58% / 52% 40% 60% 48%;
  opacity: .9; animation: blob 1.5s ease-out forwards; box-shadow: inset -6px -6px 0 rgba(0,0,0,.15); }
@keyframes blob { 0% { transform: scale(.2); } 15% { transform: scale(1.15); } 30% { transform: scale(1); opacity: .9; } 100% { transform: scale(1) translateY(10px); opacity: 0; } }
.fx-burst .drop { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c);
  animation: drop .7s ease-out forwards; }
@keyframes drop { to { transform: rotate(var(--a)) translateX(var(--d)) scale(.5); opacity: 0; } }
.fx-burst span { position: absolute; left: -12px; top: -12px; font-size: 1.5rem; animation: burst 1.2s ease-out forwards; }
@keyframes burst { 0% { transform: rotate(var(--a)) translateX(0) scale(.4); opacity: 1; } 100% { transform: rotate(var(--a)) translateX(var(--d)) scale(1.1); opacity: 0; } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } }

/* Annonce en touchant les dés (en ligne) */
.mini-dice { display: flex; gap: 4px; justify-content: center; margin-top: 6px; }
.mini-dice .die { --s: 30px; }
.compose .slots { display: flex; gap: 6px; justify-content: center; min-height: 50px; }
.compose .slots .die { --s: 48px; }
.compose .slot { width: 48px; height: 48px; border-radius: 22%; border: 2px dashed rgba(255,255,255,.25); }
.compose .cname { text-align: center; font-weight: 700; color: var(--gold); min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compose .cname.bad { color: #ff9a9a; }
.facebar { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; justify-items: center; background: rgba(0,0,0,.25); border-radius: 14px; padding: 8px 6px; }
.facebar .die { --s: min(13vw, 52px); }
.facebar .die:active:not(:disabled) { transform: scale(.9); }
.facebar .die:disabled { opacity: .35; }
.fx-card.sheet { gap: 10px; }

/* ---------- Chapeau cliquable ---------- */
.hatbtn { background: none; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0; margin: 0 auto; }
button.hatbtn .cup { cursor: pointer; }
button.hatbtn:active .cup { transform: scale(.94); }
.hat-hint { font-size: .78rem; color: var(--ink); background: rgba(0,0,0,.35); padding: 3px 10px; border-radius: 99px; animation: hint 2s ease-in-out infinite; }
.hat-hint.off { animation: none; color: var(--muted); }
@keyframes hint { 50% { opacity: .6; } }
.cup.dropping { animation: hatdrop .35s cubic-bezier(.3,1.6,.6,1); }
@keyframes hatdrop { from { transform: translateY(-40px) rotate(-10deg); opacity: .4; } }
.cup.peeking { animation: hatpeek .4s ease-out forwards; }
@keyframes hatpeek { to { transform: translateY(-14px) rotate(-14deg); } }
.peekzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.peekzone.lifting .dice-row { animation: reveal .35s ease-out; }
@keyframes reveal { from { transform: scale(.7) translateY(14px); opacity: 0; } }
.hat-close { display: inline-flex; align-items: center; gap: 6px; background: rgba(0,0,0,.4); border: 1px solid rgba(255,255,255,.2); border-radius: 99px; padding: 4px 12px 4px 6px; font-size: .82rem; font-weight: 700; }
.peekzone.lifting .hat-close .mini-hat { animation: hatlift .4s ease-out; }
@keyframes hatlift { from { transform: translateY(30px) scale(1.6); } }
.mini-hat { width: 26px; display: inline-block; }
.mini-hat svg { width: 100%; display: block; }

/* ---------- Écran de jeu en ligne compact ---------- */
.chip-info { background: rgba(0,0,0,.3); border-radius: 99px; padding: 3px 10px; font-size: .8rem; font-weight: 600; }
.chip-info.hat { box-shadow: inset 0 0 0 1.5px rgba(155,28,34,.8); }
.chip-info.table { box-shadow: inset 0 0 0 1.5px rgba(227,179,65,.7); }
.chip-info.me { background: var(--gold); color: #2b1a05; }
.banner.compact { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; padding: 6px 10px; }
.banner.compact small { display: inline; }
.banner.compact strong { font-size: 1.05rem; }
.banner.compact .mini-dice { margin-top: 0; }
.banner.compact .mini-dice .die { --s: 24px; }
.banner.compact.muted { font-size: .9rem; }
.gmsg.doing { font-size: .95rem; color: var(--ink); }
.row2.compact .btn { padding: 10px 8px; font-size: .95rem; }
#app[data-screen="oral"] .compose { padding: 8px; gap: 6px; }
#app[data-screen="oral"] .compose .slots .die, #app[data-screen="oral"] .compose .slot { --s: 40px; width: 40px; height: 40px; }
#app[data-screen="oral"] .compose .slots { min-height: 42px; }
#app[data-screen="oral"] .facebar { padding: 6px; gap: 4px; }
#app[data-screen="oral"] .facebar .die { --s: min(12vw, 46px); }

/* ---------- Écran de jeu compact (petits téléphones) ---------- */
/* Chapeau fermé : la table et le chapeau côte à côte sur une seule bande */
#app[data-screen="oral"] .felt.side { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; padding: 8px 10px; }
#app[data-screen="oral"] .felt.side .zone[data-zone="hat"] .zl { display: none; }
#app[data-screen="oral"] .felt.side .cup { width: 74px; }
#app[data-screen="oral"] .felt.side .dice-row { justify-content: flex-start; min-height: 0; gap: 5px; }
#app[data-screen="oral"] .felt.side .dice-row .die { --s: min(11vw, 46px); }
#app[data-screen="oral"] .felt.side .zl { text-align: left; font-size: .7rem; margin-bottom: 4px; }
#app[data-screen="oral"] .felt.side .empty { font-size: .8rem; }
#app[data-screen="oral"] .hat-hint { font-size: .7rem; padding: 2px 8px; }
#app[data-screen="oral"] .zl { font-size: .7rem; }
#app[data-screen="oral"] .hint.small { margin: 0; font-size: .74rem; }
#app[data-screen="oral"] .row2.compact .btn { padding: 9px 6px; font-size: .9rem; white-space: nowrap; }
#app[data-screen="oral"] .compose { gap: 5px; padding: 8px 8px 10px; }
#app[data-screen="oral"] .compose .cname { font-size: .9rem; min-height: 1.2em; }
#app[data-screen="oral"] .compose .slots .die, #app[data-screen="oral"] .compose .slot { --s: 36px; width: 36px; height: 36px; }
#app[data-screen="oral"] .compose .slots { min-height: 36px; gap: 5px; }
#app[data-screen="oral"] .compose .row2 .btn { padding: 9px; font-size: .95rem; }
#app[data-screen="oral"] .facebar .die { --s: min(12vw, 44px); }
#app[data-screen="oral"] .actions .btn.danger.big { padding: 12px; font-size: 1.1rem; }
#app[data-screen="oral"] .banner.compact { padding: 5px 10px; }
#app[data-screen="oral"] .topbar .icon { width: 34px; height: 34px; }
@media (max-height: 700px) {
  #app[data-screen="oral"] { gap: 6px; padding-top: max(6px, env(safe-area-inset-top)); }
  #app[data-screen="oral"] .apptitle { font-size: 1.05rem; }
}

/* Chapeau ouvert : tout tient en peu de place */
#app[data-screen="oral"] .felt:not(.side) { padding: 6px 8px; gap: 4px; }
#app[data-screen="oral"] .felt:not(.side) .zl { text-align: left; margin-bottom: 3px; }
#app[data-screen="oral"] .felt:not(.side) .dice-row { gap: 4px; min-height: 0; flex-wrap: nowrap; }
#app[data-screen="oral"] .felt:not(.side) .dice-row .die { --s: min(11.5vw, 46px); }
#app[data-screen="oral"] .felt:not(.side) .empty { font-size: .78rem; line-height: 1; }
#app[data-screen="oral"] .dice-row.peek { padding: 5px 4px; }
#app[data-screen="oral"] .peekzone { position: relative; }
#app[data-screen="oral"] .peekzone .hat-close { position: absolute; right: 0; top: -27px; font-size: .74rem; padding: 2px 10px 2px 4px; z-index: 2; }
#app[data-screen="oral"] .peekzone .mini-hat { width: 20px; }
.mine.small { font-size: .85rem; margin: 0; }
#app[data-screen="oral"] .infoline { gap: 5px; }
#app[data-screen="oral"] .infoline .timer, #app[data-screen="oral"] .chip-info { font-size: .78rem; padding: 2px 8px; }
#app[data-screen="oral"] .who { display: none; }
#app[data-screen="oral"] .peekzone .hat-close { top: -25px; }

/* ---------- Table vue du dessus animée ---------- */
.tbl-dice { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); display: flex; gap: 3px; z-index: 1; }
.tbl-dice .die { --s: 22px; box-shadow: 0 2px 3px rgba(0,0,0,.45); }
.tbl-dice .die .corner { display: none; }
.tbl-dice .die.pop { animation: tblpop .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes tblpop { from { transform: translateY(18px) scale(.3) rotate(-90deg); opacity: 0; } }
.tbl-hat { position: absolute; width: 40px; transform: translate(-50%, -60%); z-index: 3; pointer-events: none; filter: drop-shadow(0 4px 4px rgba(0,0,0,.55)); transform-origin: 50% 90%; }
.tbl-hat svg { width: 100%; display: block; }
.tbl-hat.open { animation: tblhatopen .4s ease-out forwards; }
@keyframes tblhatopen { to { transform: translate(-50%, -95%) rotate(-24deg); } }
.tbl-hat.shaking { animation: tblhatshake .12s linear infinite; }
@keyframes tblhatshake { 0% { transform: translate(-50%, -60%); } 25% { transform: translate(-58%, -66%) rotate(-10deg); } 50% { transform: translate(-44%, -56%) rotate(9deg); } 75% { transform: translate(-54%, -58%) rotate(-6deg); } }

/* La table occupe toute la place libre de l'écran (petite sur un iPhone SE, grande sur un Pro Max) */
#app[data-screen="oral"] { height: 100vh; height: 100dvh; min-height: 0; }
#app[data-screen="oral"] > * { flex-shrink: 0; }
#app[data-screen="oral"] > .ptable { flex: 1 1 172px; height: auto; min-height: 92px; max-height: min(380px, 80vw); }
#app[data-screen="oral"] .ptable.lobby { flex: none; }

.tbl-bubble { position: absolute; left: 50%; z-index: 4; display: flex; flex-wrap: nowrap; width: max-content; gap: 2px; background: #fffdf6; border-radius: 10px; padding: 3px 4px; box-shadow: 0 3px 8px rgba(0,0,0,.5); pointer-events: none; transform: translateX(-50%); }
.tbl-bubble.up { bottom: calc(100% + 7px); animation: bubbleup .35s ease-out; }
.tbl-bubble.down { top: calc(100% + 7px); animation: bubbledown .35s ease-out; }
.tbl-bubble::after { content: ''; position: absolute; left: 50%; width: 10px; height: 10px; background: #fffdf6; transform: translateX(-50%) rotate(45deg); }
.tbl-bubble.up::after { bottom: -5px; }
.tbl-bubble.down::after { top: -5px; }
.tbl-bubble .die { --s: 18px; box-shadow: none; border: 1px solid rgba(0,0,0,.15); }
.tbl-bubble .die .corner { display: none; }
@keyframes bubbleup { from { transform: translate(-50%, 10px) scale(.5); opacity: 0; } }
@keyframes bubbledown { from { transform: translate(-50%, -10px) scale(.5); opacity: 0; } }
.seat:has(.tbl-bubble) { z-index: 5; }

/* Petite table (écran chargé) : places sur une ligne, chapeau et dés plus petits */
#app[data-screen="oral"] > .ptable { container-type: size; }
@container (max-height: 150px) {
  .ptable .oval { inset: 12px 15%; border-width: 5px; }
  .seat { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 120px; padding: 1px 6px; border-radius: 99px; }
  .seat .sname { font-size: .68rem; max-width: 64px; }
  .seat .stoks { font-size: .72rem; gap: 2px; }
  .seat .stoks .tok-svg { width: 12px; height: 12px; }
  .pot { width: 60px; height: 40px; top: 50%; }
  .pile-tok { width: 15px; height: 15px; }
  .pot-lbl { font-size: .62rem; bottom: -6px; padding: 0 6px; }
  .ptable > .phase { font-size: .55rem; padding: 1px 6px; }
  .tbl-hat { width: 28px; }
  .tbl-dice { top: 12%; }
  .tbl-dice .die { --s: 16px; }
  .tbl-bubble .die { --s: 15px; }
}

/* Très petits écrans (iPhone SE…) : on resserre tout pour que l'annonce et « Chapeau ! » restent visibles */
@media (max-height: 620px) {
  #app[data-screen="oral"] { gap: 5px; }
  #app[data-screen="oral"] .hint.small { display: none; }
  #app[data-screen="oral"] .mine.small { font-size: .8rem; }
  #app[data-screen="oral"] .felt:not(.side) .zone[data-zone="table"]:has(.empty) { display: flex; align-items: baseline; gap: 8px; }
  #app[data-screen="oral"] .felt:not(.side) .zone[data-zone="table"]:has(.empty) .zl { margin: 0; }
  #app[data-screen="oral"] .felt:not(.side) .zone[data-zone="table"] .empty { white-space: nowrap; }
  #app[data-screen="oral"] .compose { padding: 6px 8px 8px; gap: 4px; }
  #app[data-screen="oral"] .compose .slots .die, #app[data-screen="oral"] .compose .slot { --s: 30px; width: 30px; height: 30px; }
  #app[data-screen="oral"] .compose .slots { min-height: 30px; }
  #app[data-screen="oral"] .facebar { padding: 4px; }
  #app[data-screen="oral"] .facebar .die { --s: min(11vw, 38px); }
  #app[data-screen="oral"] .compose .row2 .btn { padding: 7px; font-size: .9rem; }
  #app[data-screen="oral"] .row2.compact .btn { padding: 7px 6px; }
  #app[data-screen="oral"] .actions .btn.danger.big { padding: 9px; font-size: 1.05rem; }
  #app[data-screen="oral"] .actions .btn.danger.big small { display: none; }
  #app[data-screen="oral"] .banner.compact { padding: 3px 10px; }
}

/* Le mélange passe avant toutes les autres animations du chapeau (posé, soulevé…) */
#cup.shaking { animation: shake .12s linear infinite; }
#tblHat.shaking { animation: tblhatshake .12s linear infinite; }

/* Taille du texte choisie dans les options */
html[data-text="1"] { font-size: 112.5%; }
html[data-text="2"] { font-size: 125%; }
.textsize { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 6px 4px 10px; font-weight: 600; }
.seg { display: flex; background: rgba(0,0,0,.3); border-radius: 99px; padding: 3px; gap: 2px; }
.seg button { background: none; color: var(--ink); border-radius: 99px; padding: 6px 10px; font-weight: 700; }
.seg button.on { background: var(--gold); color: #2b1a05; }

/* Texte agrandi : on raccourcit les libellés et rien ne déborde sur les côtés */
html[data-text="1"] .lng, html[data-text="2"] .lng { display: none; }
@media (max-width: 400px) { .lng { display: none; } }
#app[data-screen="oral"] .row2 > .btn { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-text="2"] #app[data-screen="oral"] .facebar .die { --s: min(11vw, 40px); }

/* « À toi de jouer ! » en grand, puis l'annonce file vers son bandeau */
.turn-intro { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.55); animation: tifade .25s ease-out; }
.turn-intro.leaving { background: transparent; transition: background .5s; pointer-events: none; }
.ti-card { text-align: center; background: radial-gradient(ellipse at 50% 30%, #1d8358, #0d4c33 80%); border: 3px solid var(--gold); border-radius: 22px; padding: 18px 22px 20px; box-shadow: 0 14px 40px rgba(0,0,0,.6); max-width: 92vw; animation: tipop .45s cubic-bezier(.3,1.5,.5,1); }
.ti-title { font-family: Georgia, serif; font-size: 1.9rem; font-weight: 700; color: var(--gold); }
.ti-sub { margin-top: 8px; font-size: 1.1rem; color: var(--ink); }
.ti-claim { margin-top: 2px; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 700; color: #fff; }
.ti-dice { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.ti-dice .die { --s: min(15vw, 56px); }
@keyframes tifade { from { background: transparent; } }
@keyframes tipop { from { transform: scale(.4); opacity: 0; } }
.banner.landed { animation: landed .6s ease-out; }
@keyframes landed { 0% { box-shadow: 0 0 0 0 rgba(227,179,65,.9); transform: scale(1.06); } 100% { box-shadow: 0 0 0 14px rgba(227,179,65,0); transform: none; } }

/* Pendant qu'on glisse un dé, il peut sortir du tapis sans être caché */
.felt.dragout { overflow: visible; position: relative; z-index: 50; }
.die.dragging { z-index: 70; }

/* Historique des annonces de la manche */
.banner[data-act="onHistory"] { cursor: pointer; position: relative; }
.hist-badge { font-size: .72rem; font-weight: 700; color: var(--ink); background: rgba(255,255,255,.12); border-radius: 99px; padding: 1px 7px; }
.hist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow-y: auto; text-align: left; }
.hist li { background: rgba(255,255,255,.06); border-radius: 12px; padding: 7px 10px; }
.hist li.last { border: 2px solid var(--gold); }
.hist .h-top { display: flex; align-items: baseline; gap: 6px; font-size: .9rem; }
.hist .h-how { margin-left: auto; font-size: .78rem; color: var(--muted); }
.hist .h-claim { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-family: Georgia, serif; font-weight: 700; color: var(--gold); font-size: 1.05rem; margin-top: 2px; }
.hist .h-table { display: flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); margin-top: 3px; }
.hist .mini-dice { margin: 0; }
.hist .mini-dice .die { --s: 22px; }

/* ---------- Tutoriel ---------- */
.tuto-btn { background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.15); }
.tuto-btn.new { border-color: var(--gold); color: var(--gold); animation: tutoglow 2s ease-in-out infinite; }
@keyframes tutoglow { 50% { box-shadow: 0 0 16px rgba(227,179,65,.55); } }
.t-count { margin-left: auto; color: var(--muted); font-weight: 700; font-size: .9rem; }
.card.tuto { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.card.tuto h2 { margin: 0; text-align: center; font-family: Georgia, serif; color: var(--gold); font-size: 1.35rem; }
.card.tuto.in-right { animation: tutoin-r .3s ease-out; }
.card.tuto.in-left { animation: tutoin-l .3s ease-out; }
@keyframes tutoin-r { from { transform: translateX(40px); opacity: 0; } }
@keyframes tutoin-l { from { transform: translateX(-40px); opacity: 0; } }
.t-art { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.t-art .ptable { width: 100%; height: 190px; }
.t-dice { display: inline-flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.t-dice .die { --s: min(12vw, 44px); }
.t-dice.sm .die { --s: 22px; }
.t-dice.sm .die .corner, .t-art .ptable .die .corner { display: none; }
.t-hat { width: 90px; }
.t-hat.sm { width: 64px; }
.t-hat.lift { animation: tutolift 2.4s ease-in-out infinite; transform-origin: 30% 90%; }
@keyframes tutolift { 0%, 25%, 100% { transform: none; } 45%, 75% { transform: translate(18px, -16px) rotate(-22deg); } }
.t-hat svg { width: 100%; display: block; }
.t-felt { flex-direction: row; justify-content: space-between; align-items: center; background: radial-gradient(ellipse at center, #17734d, #0d4c33); border: 5px solid var(--wood); border-radius: 18px; padding: 8px 12px; }
.t-felt small { display: block; color: var(--muted); font-size: .72rem; margin-bottom: 4px; }
.t-combos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; width: 100%; counter-reset: c; }
.t-combos li { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 3px 10px; counter-increment: c; }
.t-combos li b::before { content: counter(c) ". "; color: var(--muted); }
.t-compose { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--gold); }
.t-facebar { background: rgba(0,0,0,.3); border-radius: 14px; padding: 6px; }
.t-facebar .die { --s: min(10vw, 38px); }
.t-toks { position: relative; width: 120px; height: 60px; }
.t-modes { flex-direction: row; justify-content: center; gap: 22px; font-size: 2.2rem; }
.t-modes span { display: flex; flex-direction: column; align-items: center; }
.t-modes small { font-size: .8rem; color: var(--muted); font-weight: 700; }
.t-body p { margin: 0 0 8px; line-height: 1.45; }
.t-row { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 8px; line-height: 1.4; }
.t-ico { flex: none; width: 1.6em; text-align: center; font-size: 1.15rem; }
.t-note { color: var(--muted); font-size: .88rem; font-style: italic; }
.t-go { text-align: center; font-weight: 700; color: var(--gold); margin-top: 6px !important; }
.t-dots { display: flex; justify-content: center; gap: 7px; }
.t-dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; background: rgba(255,255,255,.25); }
.t-dots button.on { background: var(--gold); transform: scale(1.3); }
.t-nav { margin-top: auto; }
/* Le tutoriel tient dans l'écran : la carte défile à l'intérieur, les boutons restent en bas */
#app[data-screen="tuto"] { height: 100vh; height: 100dvh; min-height: 0; gap: 8px; }
#app[data-screen="tuto"] > * { flex-shrink: 0; }
#app[data-screen="tuto"] > .card.tuto { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 14px; }
#app[data-screen="tuto"] .t-nav { margin-top: 0; }
#app[data-screen="tuto"] .t-nav .btn { white-space: nowrap; padding: 12px 8px; }
#app[data-screen="tuto"] .t-art .ptable { height: 170px; }
