/* ═══════════════════════════════════════════════════════════════════════════
   POLYGONARC — feuille de style (v0.4)
   Direction artistique reprise du prototype v0.3 : papier, encre, octogones.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --ink: #1a1a1a; --ink-2: #4a4a4a; --ink-3: #8a8a8a; --ink-4: #bcbcbc;
  --paper: #f5f1e8; --paper-2: #eae4d4; --paper-3: #ded6c1; --paper-4: #d2c9b1;
  --note: #b85d2e; --ok: #3f9a5b; --warn: #d4a427; --bad: #c94a4a;
  --red: #c94a4a; --red-l: #e6b0b0; --red-d: #7a1c1c;
  --blue: #3a6dc9; --blue-l: #b3c4e8; --blue-d: #1e3a8a;
  --green: #3f9a5b; --green-l: #b6d8be; --green-d: #1e5c2e;
  --yellow: #d4a427; --yellow-l: #ecdba3; --yellow-d: #78500f;
  --bonus: #3a8fd1; --malus: #d13a3a;
  --type: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --cell: 30px; --gap: 2px;
  --radius: 10px;
  --shadow: 2px 2px 0 var(--ink-4);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--paper-3); color: var(--ink); font-family: var(--type);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; }
input, select { font: inherit; }
.hidden { display: none !important; }

/* ── Cadre de l'application ─────────────────────────────────────────────── */
#app {
  position: relative; height: 100dvh; width: 100%; max-width: 1280px; margin: 0 auto;
  background: var(--paper); display: flex; flex-direction: column; overflow: hidden;
}
@media (min-width: 700px) { #app { border-left: 1.4px solid var(--ink); border-right: 1.4px solid var(--ink); } }

.scr { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--paper);
  transition: opacity .22s, transform .22s; overflow: hidden; }
.scr.off { opacity: 0; pointer-events: none; transform: scale(.985); }
.scroll { overflow-y: auto; flex: 1; }
.page { width: 100%; max-width: 560px; margin: 0 auto; padding: 20px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.page.wide { max-width: 960px; }

/* ── Boutons ────────────────────────────────────────────────────────────── */
.btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  padding: 12px 14px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 700;
  letter-spacing: .04em; transition: transform .08s, background .12s, box-shadow .12s; text-align: left; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-fill { background: var(--ink); color: var(--paper); border: 1.4px solid var(--ink); box-shadow: var(--shadow); }
.btn-fill:hover:not([disabled]) { background: #333; }
.btn-line { background: var(--paper); border: 1.4px solid var(--ink); }
.btn-line:hover:not([disabled]) { background: var(--paper-2); }
.btn-ghost { background: transparent; border: 1px dashed var(--ink-3); color: var(--ink-2); font-weight: 600; }
.btn-ghost:hover { background: var(--paper-2); }
.btn.center { justify-content: center; }
.btn .sub { font-family: var(--mono); font-size: 10px; font-weight: 400; color: var(--ink-3); letter-spacing: .06em; }
.btn-fill .sub { color: var(--ink-4); }
.icon-btn { background: none; border: 1px solid transparent; border-radius: 7px; cursor: pointer; padding: 6px 8px;
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; color: var(--ink-2); }
.icon-btn:hover { border-color: var(--ink-4); background: var(--paper-2); }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

/* ── Titres, étiquettes ─────────────────────────────────────────────────── */
.back { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  letter-spacing: .08em; cursor: pointer; background: none; border: none; padding: 4px 0; align-self: flex-start; }
.h1 { font-weight: 900; font-size: 26px; letter-spacing: -.01em; }
.h2 { font-weight: 900; font-size: 17px; }
.lbl { font-family: var(--mono); font-size: 10px; color: var(--ink-2); letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }
.note { font-family: var(--hand); font-size: 18px; color: var(--note); line-height: 1.2; }
.muted { color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.card-box { border: 1.4px solid var(--ink); border-radius: var(--radius); background: var(--paper); padding: 12px; box-shadow: var(--shadow); }

/* ── Menu ───────────────────────────────────────────────────────────────── */
#menu .page { min-height: 100%; justify-content: center; }
.logo { text-align: center; margin: 10px 0 18px; }
.logo svg { display: block; margin: 0 auto 10px; }
.logo-title { font-weight: 900; font-size: 30px; letter-spacing: .04em; }
.logo-sub { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: .22em; text-transform: uppercase; margin-top: 2px; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.vtag { font-family: var(--mono); font-size: 10px; text-align: center; color: var(--ink-3); letter-spacing: .1em; margin-top: 8px; }

/* ── Configuration de partie ────────────────────────────────────────────── */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 5px; }
.seg button { padding: 10px 4px; border-radius: 8px; border: 1.2px solid var(--ink-3); background: var(--paper); cursor: pointer;
  font-weight: 800; font-size: 14px; transition: all .12s; }
.seg.sm button { font-size: 11px; font-weight: 600; padding: 7px 4px; }
.seg button.on { border: 1.6px solid var(--ink); background: var(--paper-2); box-shadow: var(--shadow); }
.seats { display: flex; flex-direction: column; gap: 6px; }
.seat { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; padding: 8px 10px;
  border: 1.2px solid var(--ink-3); border-radius: 9px; background: var(--paper); }
.seat .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.2px solid var(--ink); }
.seat input { width: 100%; border: none; border-bottom: 1px dashed var(--ink-3); background: transparent; padding: 3px 2px; font-weight: 700; font-size: 13px; }
.seat input:focus { outline: none; border-bottom-color: var(--ink); }
.seat-kind { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.seat-kind button { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--ink-4); background: var(--paper); cursor: pointer; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.seat-kind button.on { border-color: var(--ink); background: var(--ink); color: var(--paper); }
details.rules-box { border: 1px dashed var(--ink-3); border-radius: 9px; padding: 10px 12px; background: var(--paper); }
details.rules-box summary { cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--ink-4); }
.stepper-row:last-child { border-bottom: none; }
.stepper-row .t { font-weight: 700; font-size: 13px; }
.stepper-row .t small { display: block; font-family: var(--mono); font-weight: 400; font-size: 10px; color: var(--ink-3); margin-top: 2px; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 1.4px solid var(--ink); background: var(--paper-2); cursor: pointer; font-size: 16px; line-height: 1; }
.stepper .v { font-family: var(--mono); font-weight: 700; font-size: 14px; min-width: 38px; text-align: center; }

/* ── Écran de jeu ───────────────────────────────────────────────────────── */
#game { display: grid; grid-template-columns: 100%; grid-template-rows: auto auto minmax(0,1fr) auto;
  grid-template-areas: "top" "scores" "board" "actions"; }
.topbar { grid-area: top; } .scores { grid-area: scores; } .board-wrap { grid-area: board; } .actions { grid-area: actions; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; border-bottom: 1px dashed var(--ink-3); }
.turn-lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-lbl b { color: var(--ink); }
.topbar .tools { display: flex; gap: 2px; flex-shrink: 0; }

.scores { display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 5px; padding: 6px 8px; }
.pcard { border: 1.2px solid var(--ink-4); border-radius: 9px; padding: 6px 7px; background: var(--paper); min-width: 0; transition: border-color .2s, box-shadow .2s, transform .2s; position: relative; }
.pcard.act { border-color: var(--pc); box-shadow: 2px 2px 0 var(--pc); transform: translateY(-1px); }
.pcard .nm { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .nm .d { width: 9px; height: 9px; border-radius: 50%; background: var(--pc); border: 1px solid var(--ink); flex-shrink: 0; }
.pcard .nm .bot { font-family: var(--mono); font-size: 8px; font-weight: 400; color: var(--ink-3); }
.pcard .nm .off { width: 6px; height: 6px; border-radius: 50%; background: var(--bad); flex-shrink: 0; }
.bars { display: grid; gap: 3px; margin-top: 5px; }
.bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 5px; font-family: var(--mono); font-size: 9px; color: var(--ink-2); }
.bar .tr { height: 5px; border-radius: 3px; background: var(--paper-3); overflow: hidden; }
.bar .tr i { display: block; height: 100%; background: var(--pc); border-radius: 3px; transition: width .35s; }
.bar.k .tr i { background: var(--ink-2); }
.badges { display: flex; gap: 3px; margin-top: 4px; min-height: 14px; flex-wrap: wrap; }
.badge { font-family: var(--mono); font-size: 9px; padding: 0 4px; border-radius: 4px; border: 1px solid var(--ink-4); color: var(--ink-2); line-height: 13px; }

.board-wrap { position: relative; min-height: 0; margin: 2px 8px; border: 1.4px solid var(--ink); border-radius: var(--radius);
  background: var(--paper-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.board { display: grid; gap: var(--gap); grid-template-columns: repeat(var(--cols), var(--cell)); }
.cell { width: var(--cell); height: var(--cell); position: relative; display: flex; align-items: center; justify-content: center;
  clip-path: polygon(25% 0, 75% 0, 100% 25%, 100% 75%, 75% 100%, 25% 100%, 0 75%, 0 25%);
  background: var(--paper); transition: background-color .2s; }
.cell.v { background: #fbf8f1; }
.cell.o-red { background: var(--red); } .cell.o-blue { background: var(--blue); } .cell.o-green { background: var(--green); } .cell.o-yellow { background: var(--yellow); }
.cell.sp-red { background: var(--red-l); } .cell.sp-blue { background: var(--blue-l); } .cell.sp-green { background: var(--green-l); } .cell.sp-yellow { background: var(--yellow-l); }
.cell.x { background: #1c1c1e; }
.cell .ic { pointer-events: none; font-weight: 900; font-family: var(--mono); line-height: 1; font-size: calc(var(--cell) * .42); }
.cell.x .ic { color: #555; font-size: calc(var(--cell) * .3); }
.cell .crown { font-size: calc(var(--cell) * .42); }
.cell .tower { color: var(--paper); text-shadow: 0 0 2px rgba(0,0,0,.5); }
.cell.tz::after { content: ""; position: absolute; inset: 12%; border: 1.5px dashed var(--tzc, var(--ink-2)); border-radius: 30%; pointer-events: none; opacity: .85; }
.cell.mv, .cell.tg { cursor: pointer; }
.cell.mv { background: #c8dff5; animation: pulse .9s ease-in-out infinite; }
.cell.mv.o-red, .cell.mv.o-blue, .cell.mv.o-green, .cell.mv.o-yellow { filter: brightness(1.25) saturate(.8); }
.cell.tg { animation: pulse .9s ease-in-out infinite; }
.cell.tg.v, .cell.tg.x { background: #fef08a; }
.cell.tg::before { content: ""; position: absolute; inset: 10%; border: 2.5px solid #f2c200; border-radius: 30%; background: rgba(254,240,138,.18); pointer-events: none; }
.cell.mv:hover, .cell.tg:hover { animation: none; filter: brightness(.92); }
.cell.flash { animation: flash .6s ease-out; }
.cell.path::before { content: ""; position: absolute; width: 18%; height: 18%; border-radius: 50%; background: rgba(255,255,255,.7); }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .55 } }
@keyframes flash { 0% { filter: brightness(1.8) } 100% { filter: brightness(1) } }
.pawn { position: absolute; width: 58%; height: 58%; border-radius: 50%; background: var(--paper); border: 1.4px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(0,0,0,.3); display: flex; align-items: center; justify-content: center; pointer-events: none; z-index: 2; transition: transform .2s; }
.pawn i { width: 42%; height: 42%; border-radius: 50%; background: var(--pc); }
.pawn.me { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--pc); transform: scale(1.08); }
.pawn.stack { width: 44%; height: 44%; }
.pawn.stack.b { transform: translate(30%, 30%); }

/* Barre d'action */
.actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: stretch; padding: 8px; }
.tile { border: 1.4px solid var(--ink); border-radius: 9px; background: var(--paper); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 10px; min-width: 64px; cursor: default; user-select: none; }
.tile.go { cursor: pointer; border-color: var(--note); box-shadow: 2px 2px 0 var(--note); animation: pulse 1s ease-in-out infinite; }
.tile.go:hover { animation: none; background: var(--paper-2); }
.tile .t { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--ink-2); text-transform: uppercase; }
.die { width: 38px; height: 38px; border-radius: 7px; border: 1.6px solid var(--ink); background: var(--paper); display: grid;
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); place-items: center; padding: 5px; box-shadow: 2px 2px 0 var(--ink-4); }
.die i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.die .q { grid-column: 1 / -1; grid-row: 1 / -1; font-family: var(--mono); color: var(--ink-3); font-size: 14px; }
.die.spin { animation: spin .5s cubic-bezier(.3,.7,.4,1); }
@keyframes spin { from { transform: rotate(-200deg) scale(.7) } to { transform: rotate(0) scale(1) } }
.deck { position: relative; width: 30px; height: 38px; }
.deck span { position: absolute; width: 24px; height: 33px; border-radius: 4px; border: 1.4px solid var(--ink); background: var(--paper-3); }
.deck span:nth-child(1) { left: 6px; top: 5px; opacity: .5 } .deck span:nth-child(2) { left: 3px; top: 2px; opacity: .8 } .deck span:nth-child(3) { left: 0; top: 0; background: repeating-linear-gradient(45deg, var(--paper-3) 0 4px, var(--paper-2) 4px 8px); }
.deck b { position: absolute; right: -9px; top: -8px; background: var(--ink); color: var(--paper); border-radius: 10px; min-width: 20px; height: 18px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 9px; border: 1.5px solid var(--paper); }
.hint { border: 1.4px dashed var(--ink-3); border-radius: 9px; padding: 8px 10px; display: flex; flex-direction: column; justify-content: center; gap: 6px; min-width: 0; }
.hint .msg { font-weight: 800; font-size: 13px; line-height: 1.3; }
.hint .who { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--ink-3); text-transform: uppercase; }
.hint .btns { display: flex; gap: 6px; }
.hint .btns button { padding: 5px 10px; border-radius: 6px; border: 1.2px solid var(--ink); background: var(--paper); cursor: pointer; font-size: 11px; font-weight: 700; }
.ring { position: relative; width: 38px; height: 38px; }
.ring svg { transform: rotate(-90deg); }
.ring .n { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; font-weight: 700; }

/* Journal */
.journal { display: none; }
.journal ol { list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12px; line-height: 1.35; }
.journal li { padding: 3px 0 3px 8px; border-left: 3px solid var(--jc, var(--ink-4)); color: var(--ink-2); }
.journal li:first-child { color: var(--ink); font-weight: 600; }
.journal .lbl { margin-bottom: 8px; }
.journal-drawer { position: absolute; left: 8px; right: 8px; bottom: 76px; max-height: 45%; overflow-y: auto; z-index: 40; background: var(--paper);
  border: 1.4px solid var(--ink); border-radius: var(--radius); padding: 10px 12px; box-shadow: 3px 3px 0 var(--ink-4); }

/* Grand écran : colonne latérale */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  #game { grid-template-columns: minmax(0,1fr) 330px; grid-template-rows: auto minmax(0,1fr); grid-template-areas: "top top" "board side"; }
  .board-wrap { margin: 10px; }
  .side { grid-area: side; display: flex; flex-direction: column; gap: 10px; padding: 10px 10px 10px 0; min-height: 0; }
  .scores { grid-template-columns: 1fr 1fr; padding: 0; }
  .actions { padding: 0; grid-template-columns: auto auto auto; grid-template-areas: "die deck ring" "hint hint hint"; }
  .actions .t-die { grid-area: die; } .actions .t-deck { grid-area: deck; } .actions .t-ring { grid-area: ring; } .actions .hint { grid-area: hint; min-height: 74px; }
  .journal { display: block; flex: 1; min-height: 0; overflow-y: auto; border: 1.2px solid var(--ink-4); border-radius: var(--radius); padding: 10px 12px; background: var(--paper); }
  #journal-btn { display: none; }
  .journal-drawer { display: none !important; }
}
@media (max-width: 899px), (max-aspect-ratio: 5/4) { .side { display: contents; } }
@media (max-width: 480px) {
  .seat { grid-template-columns: 14px 1fr; }
  .seat-kind { grid-column: 1 / -1; justify-content: stretch; }
  .seat-kind button { flex: 1; }
}
@media (max-width: 420px) {
  .actions { gap: 6px; padding: 6px; }
  .tile { min-width: 52px; padding: 5px 6px; }
  .actions .t-ring:not(.show) { opacity: .45; }
  .pcard { padding: 5px; }
  .pcard .nm { font-size: 10px; }
}

/* ── Carte ──────────────────────────────────────────────────────────────── */
.modal { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; padding: 16px; }
.modal.off { display: none; }
.wash { position: absolute; inset: 0; background: rgba(245,241,232,.86); backdrop-filter: blur(2px); }
.pcardx { position: relative; width: min(240px, 70vw); aspect-ratio: 825 / 1125; border: 2.2px solid var(--ink); border-radius: 16px; padding: 9px;
  display: flex; flex-direction: column; gap: 6px; box-shadow: 5px 7px 0 rgba(0,0,0,.2); transform: rotate(-2deg); animation: cardpop .38s cubic-bezier(.34,1.56,.64,1); }
.pcardx.bonus { background: var(--bonus); } .pcardx.malus { background: var(--malus); }
@keyframes cardpop { from { transform: rotate(-2deg) scale(.7); opacity: 0 } to { transform: rotate(-2deg) scale(1); opacity: 1 } }
.pcardx .brand { background: var(--paper); border: 1.6px solid var(--ink); border-radius: 8px; padding: 4px 8px; display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px; font-weight: 900; letter-spacing: .08em; }
.pcardx .brand i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--ink); background: conic-gradient(var(--red) 0 25%, var(--blue) 25% 50%, var(--green) 50% 75%, var(--yellow) 75%); }
.pcardx .kind { text-align: center; font-weight: 900; font-size: 16px; letter-spacing: .14em; color: var(--paper); text-shadow: 1px 1px 0 rgba(0,0,0,.25); }
.pcardx .ill { border: 1.6px solid var(--ink); border-radius: 8px; background: var(--paper); aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-family: var(--mono); font-weight: 900; position: relative; overflow: hidden; }
.pcardx .ill::before, .pcardx .ill::after { content: ""; position: absolute; inset: 0; }
.pcardx .ill::before { background: linear-gradient(to bottom right, transparent calc(50% - .6px), var(--ink-4) 50%, transparent calc(50% + .6px)); }
.pcardx .ill::after { background: linear-gradient(to bottom left, transparent calc(50% - .6px), var(--ink-4) 50%, transparent calc(50% + .6px)); }
.pcardx .ill span { position: relative; z-index: 1; background: var(--paper); padding: 0 6px; }
.pcardx .body { border: 1.6px solid var(--ink); border-radius: 8px; background: var(--paper); padding: 8px; flex: 1; overflow: hidden; }
.pcardx .nm { text-align: center; font-size: 12px; font-weight: 900; letter-spacing: .04em; margin-bottom: 5px; text-transform: uppercase; }
.pcardx .ds { font-size: 11px; line-height: 1.45; color: var(--ink-2); }
.modal .acts { position: relative; display: flex; gap: 8px; }
.modal .acts button { padding: 11px 24px; border-radius: 999px; border: 1.6px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 800; font-size: 13px; letter-spacing: .05em; cursor: pointer; box-shadow: 2px 2px 0 var(--ink-4); }
.modal .who { position: relative; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--ink-2); text-transform: uppercase; }

/* Carte vue par les autres joueurs (non bloquante) */
.peek { position: absolute; right: 12px; top: 64px; z-index: 50; transform: scale(.55); transform-origin: top right; pointer-events: none; animation: peek 2.4s ease forwards; }
@keyframes peek { 0% { opacity: 0 } 8% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 } }

/* ── Bandeau « À toi ! » ────────────────────────────────────────────────── */
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 70; pointer-events: none;
  padding: 12px 22px; border-radius: 14px; border: 2px solid var(--ink); background: var(--paper); box-shadow: 4px 4px 0 var(--pc, var(--ink-4));
  font-weight: 900; font-size: 20px; letter-spacing: .02em; animation: banner 1.3s ease forwards; white-space: nowrap; }
.banner small { display: block; font-family: var(--hand); font-weight: 500; font-size: 17px; color: var(--note); text-align: center; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.9) } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1) } 75% { opacity: 1 } 100% { opacity: 0; transform: translate(-50%, -58%) } }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
#toasts { position: absolute; top: 58px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 5px; align-items: center; pointer-events: none; width: max-content; max-width: 92%; }
.toast { color: var(--paper); background: var(--ink); font-weight: 700; font-family: var(--mono); font-size: 11px; padding: 7px 13px; border-radius: 16px;
  border: 1.4px solid var(--ink); box-shadow: 2px 2px 0 var(--ink-4); animation: toast 2.6s ease forwards; text-align: center; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px) } 8% { opacity: 1; transform: none } 85% { opacity: 1 } 100% { opacity: 0 } }

/* ── Fin de partie ──────────────────────────────────────────────────────── */
#victory { z-index: 200; }
.vic-head { text-align: center; }
.vic-tag { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .16em; }
.vic-name { font-size: 38px; font-weight: 900; letter-spacing: -.02em; }
.vic-quote { font-family: var(--hand); font-size: 22px; color: var(--ink-2); }
table.rank { width: 100%; border-collapse: collapse; font-size: 12px; }
table.rank th { font-family: var(--mono); font-weight: 400; font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); text-align: right; padding: 4px 6px; }
table.rank th:first-child, table.rank th:nth-child(2) { text-align: left; }
table.rank td { padding: 8px 6px; border-top: 1px dashed var(--ink-4); text-align: right; font-family: var(--mono); }
table.rank td:first-child, table.rank td:nth-child(2) { text-align: left; font-family: var(--type); font-weight: 700; }
table.rank tr.w td { background: var(--paper-2); }
.chart svg { width: 100%; height: auto; display: block; }

/* ── Tutoriel / règles ──────────────────────────────────────────────────── */
.tuto-dots { display: flex; gap: 4px; }
.tuto-dots i { width: 22px; height: 4px; border-radius: 3px; background: var(--ink-4); }
.tuto-dots i.on { background: var(--ink); }
.tuto-text { font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.tuto-text b { color: var(--ink); }
.sandbox { background: var(--paper-2); border: 1.4px solid var(--ink); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.sandbox .board { --cell: 38px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.rcard { border: 1.4px solid var(--ink); border-radius: var(--radius); background: var(--paper); padding: 10px; display: grid; grid-template-columns: 46px 1fr; gap: 10px; box-shadow: var(--shadow); }
.rcard .ic { width: 46px; height: 46px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-weight: 900; font-size: 18px; color: var(--paper); border: 1.4px solid var(--ink); }
.rcard.bonus .ic { background: var(--bonus); } .rcard.malus .ic { background: var(--malus); }
.rcard .nm { font-weight: 800; font-size: 13px; }
.rcard .ty { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.rcard .ds { font-size: 12px; line-height: 1.45; color: var(--ink-2); margin-top: 3px; }
.rules-list { font-size: 14px; line-height: 1.65; color: var(--ink-2); padding-left: 18px; }
.rules-list b { color: var(--ink); }

/* ── En ligne ───────────────────────────────────────────────────────────── */
.code-big { font-family: var(--mono); font-size: 44px; font-weight: 700; letter-spacing: .2em; text-align: center; }
.link-row { display: flex; gap: 6px; align-items: center; }
.link-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; padding: 9px 10px; border: 1.2px solid var(--ink-3); border-radius: 8px; background: var(--paper); }
.text-in { width: 100%; font-size: 15px; padding: 11px 12px; border: 1.4px solid var(--ink); border-radius: 9px; background: var(--paper); }
.text-in.code { font-family: var(--mono); letter-spacing: .3em; text-transform: uppercase; text-align: center; font-size: 22px; }
.lobby-seat { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; padding: 10px 12px; border: 1.2px solid var(--ink-3); border-radius: 9px; background: var(--paper); }
.lobby-seat .dot { width: 14px; height: 14px; border-radius: 50%; border: 1.2px solid var(--ink); }
.lobby-seat .st { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.lobby-seat .st.on { color: var(--ok); }
.lobby-seat button { padding: 4px 8px; font-size: 10px; border-radius: 6px; border: 1px solid var(--ink-3); background: var(--paper); cursor: pointer; }
.warn-box { border: 1.4px dashed var(--note); border-radius: 9px; padding: 12px; color: var(--note); font-size: 13px; line-height: 1.5; background: #fbf1ea; }
.warn-box code { font-family: var(--mono); background: var(--paper-2); padding: 1px 4px; border-radius: 3px; color: var(--ink); }

/* ── Réglages ───────────────────────────────────────────────────────────── */
.switch { width: 44px; height: 26px; border-radius: 14px; border: 1.4px solid var(--ink); background: var(--paper-3); position: relative; cursor: pointer; flex-shrink: 0; }
.switch i { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: var(--paper); border: 1.2px solid var(--ink); transition: left .15s; }
.switch.on { background: var(--ink); } .switch.on i { left: 20px; }

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