/* Base della pagina */
:root{color-scheme:light;box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px)}
html{scroll-padding-top:env(safe-area-inset-top,0px)}
body{margin:0;padding:0;font:14px -apple-system,BlinkMacSystemFont,sans-serif;background:#fff;color:#000}
img{max-width:100%}
[hidden]:not([hidden=until-found i]){display:none!important}

/* Layout: diorama HD-2D verticale (WebGL) + colonna del cronista; sotto 940px si impilano */
:root {
  --walnut: #1a1310;
  --ally: #4f94ec;
  --foe: #e5483a;
  --walnut-2: #241a15;
  --glass: rgba(26, 19, 16, .74);
  --line: #4a3a2b;
  --parchment: #eadbb7;
  --muted: #b4a385;
  --gold: #d6ad55;
  --stall: #e0644a;
  --danger: #e0644a;
  --balzana-w: #d6ad55;
  --balzana-k: #6e1420;
  --display: "Grenze Gotisch", "UnifrakturMaguntia", Georgia, serif;
  --body: "EB Garamond", Garamond, Georgia, serif;
  --pixel: "Silkscreen", "Courier New", monospace;
  color-scheme: dark;
}
html, body { min-height: 100%; }
body {
  background: var(--walnut); color: var(--parchment);
  font-family: var(--body); font-size: 17px; line-height: 1.45;
  margin: 0; padding-inline: 16px; padding-block: 0 32px;
}
.balzana { height: 8px; margin-inline: -16px; background: linear-gradient(180deg, var(--balzana-w) 50%, var(--balzana-k) 50%); }
h1, h2, h3 { font-family: var(--display); font-weight: 500; text-wrap: balance; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn { background: var(--gold); color: var(--walnut); border: 0; border-radius: 2px; padding: 8px 18px; font-weight: 600; letter-spacing: .02em; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--glass); color: var(--parchment); border: 1px solid var(--gold); }
/* spia del server online dentro il pulsante */
#online { display: inline-flex; align-items: center; gap: 8px; }
#online:disabled { opacity: 1; color: var(--muted); border-color: var(--line); }
.spia { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.spia.on { background: #5fd36a; box-shadow: 0 0 6px rgba(95,211,106,.8); }
.spia.off { background: var(--danger); box-shadow: 0 0 6px rgba(224,100,74,.7); }
.eyebrow { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.num { font-family: var(--pixel); font-variant-numeric: tabular-nums; }

header.top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; max-width: 1080px; margin: 16px auto 12px; }
header.top h1 { font-size: clamp(26px, 6vw, 40px); color: var(--gold); }
header.top p { margin: 0; color: var(--muted); font-style: italic; font-size: 15px; }
header.top h1.logo { margin: 0; line-height: 0; }
header.top h1.logo img { display: block; height: clamp(52px, 13vw, 80px); width: auto; max-width: 100%; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
/* Impostazioni audio nella schermata pre partita: un pulsante che apre musica ed effetti on/off */
.setaudio { position: relative; margin-left: auto; align-self: center; }
#audioSetBtn { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; border: 1px solid var(--gold); color: var(--gold); border-radius: 2px; }
#audioSetBtn[aria-expanded="true"] { background: color-mix(in srgb, var(--gold) 25%, transparent); }
#audioSetBtn svg, .audiopop svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.audiopop { position: absolute; right: 0; top: 46px; z-index: 20; display: grid; gap: 6px; min-width: 200px; padding: 8px;
  background: var(--walnut); border: 1px solid var(--gold); border-radius: 2px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.audiopop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; background: transparent; border: 1px solid var(--line);
  color: var(--parchment); border-radius: 2px; font-size: 15px; text-align: left; }
.audiopop button .st { margin-left: auto; font-family: var(--pixel); font-size: 11px; color: var(--gold); }
.audiopop button[aria-checked="false"] { color: var(--muted); }
.audiopop button[aria-checked="false"] .st { color: var(--muted); }

/* Setup */
#setup { max-width: 1080px; margin: 0 auto; display: grid; gap: 20px; }
#setup .intro { max-width: 68ch; margin: 0; }
.sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.side { border: 1px solid var(--line); background: var(--walnut-2); padding: 14px; display: grid; gap: 12px; min-width: 0; }
.side h2 { font-size: 24px; color: var(--gold); }
.states { display: grid; gap: 6px; }
.chip.state { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 2px 10px; padding: 7px 10px 7px 8px; text-align: left; }
.chip.state .sw { grid-row: span 2; }
.chip.state strong { font-family: var(--display); font-weight: 500; font-size: 18px; line-height: 1.1; }
.chip.state small { font-size: 14px; color: var(--muted); font-style: italic; line-height: 1.3; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 6px; background: transparent; border: 1px solid var(--line); border-radius: 2px; font-size: 15px; }
.chip[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, transparent); }
.chip:disabled { opacity: .3; cursor: default; }
.sw { display: inline-block; width: 18px; height: 22px; flex: none;
  background: linear-gradient(180deg, var(--e) 0 22%, transparent 22%), linear-gradient(90deg, var(--a) 50%, var(--b) 50%);
  clip-path: polygon(0 0, 100% 0, 100% 62%, 50% 100%, 0 62%); }
.sw.big { width: 54px; height: 66px; }
.wflag { width: 58px; height: 72px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.foe { display: grid; gap: 6px; }
.modesel { display: grid; gap: 8px; justify-items: center; text-align: center; }
#modeChips { justify-content: center; gap: 8px; }
.mpbox { justify-self: center; text-align: center; border: 1px solid var(--line); background: var(--walnut-2); padding: 10px 16px; max-width: 520px; display: grid; gap: 4px; }
.mpbox p { margin: 0; font-size: 14px; }
.timesel { display: grid; gap: 6px; justify-items: center; margin-top: 6px; }
#timeChips { justify-content: center; }
.chip.time svg { width: 16px; height: 16px; fill: var(--gold); }
.chip.mode { display: grid; justify-items: center; gap: 3px; min-width: 112px; padding: 10px 14px 9px; }
.chip.mode svg { width: 30px; height: 30px; fill: var(--gold); }
.chip.mode strong { font-family: var(--display); font-weight: 500; font-size: 21px; line-height: 1.05; }
.chip.mode small { font-size: 13px; color: var(--muted); }
.chip.mode[aria-pressed="true"] svg { filter: drop-shadow(0 0 6px rgba(214,173,85,.6)); }
@media (max-width: 480px) { .chip.mode { min-width: calc(50% - 4px); } }
.pl .reinf { display: inline-flex; align-items: center; gap: 2px; margin-inline: 4px; color: var(--gold); }
.pl .reinf svg { width: 11px; height: 11px; fill: currentColor; }
.actbar button > svg:first-child { flex: none; }
.modesel .desc { margin: 0; font-size: 15px; color: var(--muted); max-width: 62ch; }
.squad { display: grid; gap: 6px; }
.squad .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.squad .head .num { font-size: 13px; color: var(--muted); }
.squad .head .num.full { color: var(--gold); }
.squad .row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.squad .row .nm { font-size: 16px; }
.squad .row .nm small { display: block; font-size: 13px; color: var(--muted); font-style: italic; }
.squad .ctr { display: inline-flex; align-items: center; gap: 6px; }
.squad .ctr button { width: 30px; height: 30px; padding: 0; background: transparent; border: 1px solid var(--line); border-radius: 2px; font-size: 18px; line-height: 1; }
.squad .ctr button:disabled { opacity: .3; cursor: default; }
.squad .ctr b { min-width: 1.4em; text-align: center; font-family: var(--pixel); font-weight: 400; }
.mapsel { display: flex; gap: 16px; align-items: flex-start; }
.mapinfo { display: grid; gap: 8px; min-width: 0; }
.mapinfo .btn { justify-self: start; }
/* pannello del comandante a destra: chiuso resta fuori schermo, si vede solo la linguetta sul bordo */
.capside { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(380px, 88vw); transform: translateX(100%); transition: transform .32s cubic-bezier(.2,.8,.3,1); }
.capside.open { transform: none; box-shadow: -14px 0 40px rgba(0,0,0,.55); }
body.playing .capside { display: none; }
.cappanel { height: 100%; overflow-y: auto; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 16px; background: var(--walnut); border-left: 1px solid var(--gold); box-sizing: border-box; }
.captab { position: absolute; right: 100%; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 7px;
  background: var(--walnut); border: 1px solid var(--gold); border-right: 0; border-radius: 4px 0 0 4px; color: var(--gold); box-shadow: -4px 0 14px rgba(0,0,0,.4); }
.captab svg { width: 16px; height: 16px; fill: currentColor; }
.captab span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--display); font-size: 15px; letter-spacing: .04em; }
@media (prefers-reduced-motion: reduce) { .capside { transition: none; } }
.capside .capedit { flex-direction: column; }
.capview button svg { width: 16px; height: 16px; fill: currentColor; }
.capview { display: flex; align-items: center; gap: 10px; align-self: center; }
.capview button { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; background: transparent; border: 1px solid var(--gold); color: var(--gold); border-radius: 2px; font-size: 20px; line-height: 1; }
.capedit { display: flex; gap: 16px; align-items: flex-start; }
.capedit .capopts { display: grid; gap: 8px; min-width: 0; flex: 1; }
.capedit .capopts > div { display: grid; gap: 4px; }
#capPrev { width: 128px; height: 128px; flex: none; image-rendering: pixelated; border: 1px solid var(--line); background: #6f7a52; box-shadow: none; cursor: default; touch-action: auto; }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.35); flex: none; }
@media (max-width: 520px) { .capedit { flex-direction: column; } }
#mapPrev { width: 70px; height: 90px; flex: none; image-rendering: pixelated; border: 1px solid var(--line); background: #2a2018; box-shadow: none; cursor: default; touch-action: auto; }
.go { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
#start.loading { display: inline-grid; place-items: center; min-width: 9.5em; }
#start .spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
#start .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@keyframes spin { to { transform: rotate(360deg); } }
.go .vs { font-family: var(--display); font-size: 24px; }

/* Game */
/* Telefono e tablet: segnapunti, campo e informazioni in colonna. */
#game { display: grid; grid-template-columns: minmax(0, 760px); gap: 10px; justify-content: center; align-items: start; max-width: 1080px; margin: 0 auto; }
#game .brand { display: none; }
/* in partita niente titolo e sottotitolo del gioco */
body.playing header.top, #game .brand h2 { display: none !important; }
/* in partita niente balzana (le due strisce oro e rosso) in cima alla pagina */
body.playing > .balzana { display: none; }
/* in partita il campo arriva fino in fondo: niente margine sotto la pagina */
body.playing { padding-block-end: 0; }
/* Desktop: due colonne a tutto schermo, informazioni a sinistra (20%, almeno 260px) e campo a destra (il resto). */
/* su telefono e tablet il campo va da bordo a bordo: esce dal margine laterale della pagina */
@media (max-width: 1023px) { #game .stage { margin-inline: -16px; border-inline: 0; } }
@media (min-width: 1024px) {
  body.playing { overflow: hidden; }
  #game { position: fixed; inset: 0; z-index: 5; max-width: none; margin: 0; gap: 0; align-items: stretch; background: var(--walnut);
    grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "stage"; }
  #game .brand .balzana { margin-inline: -20px; }
  #game .brand h2 { font-size: 30px; color: var(--gold); padding-top: calc(4px + env(safe-area-inset-top, 0px)); }
  /* Segnapunti affiancato: le due compagnie fianco a fianco, giorno e fase sotto. */
  #game .turnbar { grid-area: bar; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
  #game .pl { padding: 8px; }
  #game .pl .big { font-size: 26px; }
  #game .pl strong { font-size: 17px; }
  #game .stage { grid-area: stage; height: 100%; border: 0; box-shadow: none; }
}
/* Segnapunti a ogni larghezza: le due compagnie fianco a fianco in riquadri speculari (stemmi ai lati esterni,
   numeri grandi verso il centro), giorno e fase sotto. */
.turnbar { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "pl pr"; align-items: stretch; gap: 6px 8px; }
/* il giocatore sempre a sinistra («Tu»), l'avversario a destra */
.pl.left { grid-area: pl; } .pl.right { grid-area: pr; }
/* Giorno, mosse e fase in sovrimpressione sul bordo alto del campo, a destra. */
/* In alto a destra: segnapunti e calendario affiancati, sotto le informazioni sul terreno */
.hud { position: absolute; top: 10px; right: 10px; z-index: 3; max-width: calc(100% - 64px); display: grid; justify-items: end; gap: 6px; pointer-events: none; }
.hud .hrow { display: flex; align-items: stretch; gap: 6px; }
/* segnapunti: lo stesso tabellone di prima (due riquadri speculari), solo spostato sul campo con il fondo sfocato */
#game .hudc .turnbar { width: min(400px, 30vw); padding: 6px; gap: 6px; border: 1px solid var(--line); border-radius: 2px; background: var(--glass); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: auto; }
#game .hudc .pl { background: var(--glass); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
#game .hudc .pl.on { background: color-mix(in srgb, var(--gold) 22%, var(--glass)); }
/* desktop: al centro in alto il tabellone, con le mosse del gruppo dal lato di chi gioca; sotto, su una riga, giorno e fase */
/* telefono: sotto il calendario, a destra, «Passa il turno» piccolo e alla sua sinistra il conto alla rovescia */
.passrow { display: flex; justify-content: flex-end; align-items: flex-start; gap: 6px; pointer-events: auto; margin-top: -2px; }
.passrow #passSlot:empty { display: none; }
.passrow #passSlot button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.passrow #passSlot button svg { width: 16px; height: 16px; fill: currentColor; }
.passrow #passSlot button.primary { background: color-mix(in srgb, var(--gold) 25%, transparent); box-shadow: 0 0 10px rgba(214,173,85,.55); }
.passrow .countdown { position: static; min-width: 40px; height: 32px; box-sizing: border-box; padding: 4px 8px; text-align: center; font-size: 20px; line-height: 22px;
  color: var(--danger); text-shadow: 0 0 10px rgba(224,100,74,.6); background: var(--glass); border: 1px solid var(--danger); border-radius: 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transform-origin: top center; animation: cdFlip .38s cubic-bezier(.2,.8,.3,1.2) both; }
.hudc { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.hudc .hcrow { display: flex; align-items: flex-start; gap: 6px; }
/* il calendario sta attaccato sotto il tabellone, largo uguale */
.hudc .tbcol { display: grid; }
.hudc .tbcol .meta .phase { border-top: 0; border-radius: 0 0 2px 2px; justify-items: center; }
#game .hudc .tbcol .turnbar { grid-area: auto; border-radius: 2px 2px 0 0; }
.hudc .sidemoves { box-sizing: border-box; }
.sidemoves { display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 22px; line-height: 1; color: var(--gold); background: var(--glass); border: 1px solid var(--line);
  border-radius: 2px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); text-shadow: 0 1px 2px #000; }
.sidemoves svg { width: 20px; height: 20px; fill: currentColor; }
/* desktop: il riquadro delle mosse si apre ruotando dal lato del tabellone; la barra del tempo è il suo bordo
   basso e negli ultimi secondi il conto alla rovescia scende sotto come una tendina */
.sidemoves { position: relative; overflow: hidden; }
.sidemoves .turntimer { left: 0; right: 0; bottom: 0; }
#movesL { transform-origin: right center; } #movesR { transform-origin: left center; }
.sidemoves.flip { animation: movesFlip .4s cubic-bezier(.2,.8,.3,1.15) both; }
@keyframes movesFlip { from { transform: perspective(300px) rotateY(var(--fy, 90deg)); opacity: 0; } to { transform: none; opacity: 1; } }
#movesL.flip { --fy: -90deg; }
.sidemoves:has(.countdown:not([hidden])) { overflow: visible; }
.sidemoves .countdown { position: absolute; left: -1px; right: -1px; top: 100%; padding: 4px 6px 5px; text-align: center; font-size: 22px; line-height: 1;
  color: var(--danger); text-shadow: 0 0 10px rgba(224,100,74,.6); background: var(--glass); border: 1px solid var(--danger); border-top: 0; border-radius: 0 0 2px 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transform-origin: top center; animation: cdFlip .38s cubic-bezier(.2,.8,.3,1.2) both; }
@media (prefers-reduced-motion: reduce) { .sidemoves.flip, .sidemoves .countdown { animation: none; } }
.hudc #metaRow2 { display: none !important; }
.hudc .roster { left: 0; right: 0; }
@media (min-width: 1024px) { #game .hud .hcard { width: min(280px, 22vw); } }
/* colonna delle informazioni a destra, a cascata: terreno, unità, previsione dello scontro, cronaca */
#game .hud .hcard { width: min(300px, calc(100vw - 80px)); max-width: none; padding: 6px 10px; display: grid; gap: 2px; font-size: 13px; background: var(--glass); border: 1px solid var(--line);
  border-radius: 2px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); text-shadow: 0 1px 2px #000; }
#game .hud .ucard2, #game .hud .logcard { max-height: 32vh; overflow-y: auto; pointer-events: auto; }
#game .hud .ucard2 .stats { font-size: 12px; } #game .hud .ucard2 h3 { font-size: 16px; } #game .hud .ucard2 .desc { font-size: 12px; margin: 0; }
#game .hud .logcard #log { max-height: none; font-size: 12px; }
.hud .tercard h3 { margin: 0; font-size: 16px; } .hud .tercard .desc { margin: 0; font-size: 12px; }
/* su telefono e tablet niente anteprima dello scontro */
@media (max-width: 1023px) { #game .hud .fccard { display: none !important; } }
.stage .meta { position: relative; pointer-events: none;
  color: var(--parchment); font-size: 12px; text-shadow: 0 1px 2px #000; }
/* calendario: un solo riquadro; sopra giorno, fase e ora; sotto a sinistra le mosse del gruppo e a destra i secondi
   rimasti; il tempo della mossa scorre come bordo inferiore, da sinistra verso destra */
.stage .meta .phase { position: relative; display: grid; gap: 4px; padding: 6px 10px 8px; background: var(--glass); border: 1px solid var(--line); border-radius: 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.stage .meta .mrow { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.stage .meta .mrow2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stage .meta .moves { display: inline-flex; align-items: center; gap: 6px; font-size: 20px; line-height: 1; color: var(--gold); }
/* ultimi 10 secondi: riquadro rosso che scende sotto la barra del tempo come una tendina che si ribalta */
.stage .meta { perspective: 400px; }
.stage .meta .countdown { position: absolute; right: 0; top: 100%; min-width: 46px; padding: 4px 10px 5px; text-align: center; font-size: 22px; line-height: 1;
  color: var(--danger); text-shadow: 0 0 10px rgba(224,100,74,.6); background: var(--glass); border: 1px solid var(--danger); border-top: 0; border-radius: 0 0 2px 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transform-origin: top center; animation: cdFlip .38s cubic-bezier(.2,.8,.3,1.2) both; }
@keyframes cdFlip { from { transform: rotateX(-90deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .stage .meta .countdown { animation: none; } }
.stage .meta .moves svg { width: 18px; height: 18px; fill: currentColor; }
.stage .meta .wicon { display: inline-grid; transition: transform .3s ease; }
/* Tabelloni cliccabili: tendina con gli uomini della compagnia */
.pl { cursor: pointer; }
.pl[aria-expanded="true"] { box-shadow: inset 0 0 0 1px var(--gold); }
.roster { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 8; max-height: min(60vh, 420px); overflow-y: auto; padding: 8px;
  background: var(--walnut); border: 1px solid var(--gold); border-radius: 2px; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.roster h4 { margin: 0 0 6px; font-family: var(--display); font-weight: 500; font-size: 17px; color: var(--gold); }
.roster ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.roster li { display: grid; grid-template-columns: auto minmax(0, 1fr) 72px auto; align-items: center; gap: 8px; padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.roster li:last-child { border-bottom: 0; }
.roster li .ticon { width: 20px; height: 20px; }
.roster li .rn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster li .rbar { height: 6px; background: rgba(0,0,0,.45); border: 1px solid var(--line); }
.roster li .rbar i { display: block; height: 100%; background: var(--ok, #7fb069); }
.roster li .rbar i.mid { background: var(--gold); } .roster li .rbar i.low { background: var(--danger); }
.roster li .rhp { font-size: 12px; min-width: 44px; text-align: right; color: var(--parchment); }
.roster li.dead { opacity: .5; } .roster li.dead .rn { text-decoration: line-through; }
.roster li.dead .rhp { color: var(--danger); }
.pl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "sw nm big"; align-items: center; gap: 6px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 2px; min-width: 0; text-align: left; transition: border-color .2s, background .2s; }
.pl > .sw { grid-area: sw; } .pl > .nm { grid-area: nm; } .pl > .big { grid-area: big; }
.pl.right { grid-template-areas: "big nm sw"; text-align: right; }
.pl .nm { display: grid; min-width: 0; }
.pl strong { font-family: var(--display); font-weight: 500; font-size: 20px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl .big { margin: 0; font-family: var(--pixel); font-size: 28px; line-height: 1; color: var(--parchment); text-shadow: 0 2px 0 rgba(0,0,0,.4); }
.pl.on .big { color: var(--gold); }
@media (max-width: 480px) { .pl .big { font-size: 22px; } }
.pl small { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; color: var(--muted); font-size: 13px; }
.pl.right small { flex-direction: row-reverse; }
.pl small svg { width: 14px; height: 14px; fill: currentColor; }
.pl small .num { font-size: 12px; color: var(--parchment); }
.pl.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, transparent); }
/* il tuo lato sempre blu, il nemico sempre rosso, come gli indicatori sotto le unità */
/* fili colorati verso il centro: il tabellone di sinistra a destra, quello di destra a sinistra */
.pl.ally { border-left: 4px solid var(--ally); }
.pl.foe { border-left: 4px solid var(--foe); }
.pl.left.ally, .pl.left.foe { border-left: 1px solid var(--line); border-right-width: 4px; border-right-style: solid; }
.pl.left.ally { border-right-color: var(--ally); } .pl.left.foe { border-right-color: var(--foe); }
/* di turno: tutto il bordo dorato, anche il lato sinistro del tabellone di sinistra (il filo colorato resta) */
.pl.left.on { border-left-color: var(--gold); }
.stage { position: relative; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 12px 44px rgba(0,0,0,.55); background: #2a1f22; }
canvas { display: block; width: 100%; touch-action: none; cursor: grab; }
canvas.dragging { cursor: grabbing; }
/* Comandi in alto a sinistra: opzioni, livelli, rotazione e centratura. */
.camctl { position: absolute; left: 10px; top: 74px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  transform: translateY(-46px); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .28s ease, opacity .2s, visibility 0s .28s; }
/* menu del campo chiuso di base: solo la freccia; toccandola scende la fila dei comandi */
.camctl.open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .28s ease, opacity .2s; }
/* pulsante del menu: ingranaggio con sotto, attaccata, una striscia sottile con la freccia (alto quanto il calendario) */
#menuBtn { position: absolute; left: 10px; top: 10px; z-index: 3; width: 40px; display: grid; grid-template-rows: 38px 18px; padding: 0; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px; }
#menuBtn > span { display: grid; place-items: center; }
#menuBtn .mchev { border-top: 1px solid var(--gold); }
#menuBtn svg { width: 18px; height: 18px; fill: currentColor; }
#menuBtn .mchev svg { width: 12px; height: 12px; transition: transform .28s ease; }
#menuBtn[aria-expanded="true"] .mchev svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .camctl, .camctl.open, #menuBtn svg { transition: none; } }
/* pulsanti del campo: fondo quasi pieno e sfocatura di ciò che sta dietro */
#menuBtn, .camctl button, .audiomenu button, .layerctl button { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.camctl button, .audiomenu button { width: 40px; height: 40px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px; font-size: 20px; line-height: 1; }
.camctl button:active, .audiomenu button:active { background: color-mix(in srgb, var(--gold) 25%, var(--walnut)); }
.camctl button[aria-expanded="true"] { background: color-mix(in srgb, var(--gold) 25%, var(--walnut)); }
.camctl svg, .audiomenu svg { width: 18px; height: 18px; fill: currentColor; }
.gearwrap { position: relative; }
/* le voci di una sezione si aprono in orizzontale, a destra del suo pulsante */
.audiomenu { position: absolute; top: 0; left: 46px; display: flex; flex-direction: row; gap: 6px; align-items: center; }
.audiomenu button.off { color: var(--muted); border-color: var(--line); }
.quitrow { display: flex; gap: 6px; margin-top: 4px; }
.camctl button.quit { border-color: var(--danger); color: var(--danger); }
.camctl button.quit.armed { background: var(--danger); color: var(--walnut); font-family: var(--pixel); font-size: 13px; }
.camctl button.quitno { font-family: var(--pixel); font-size: 13px; }
.audiomenu .vol { font-family: var(--pixel); font-size: 11px; color: var(--gold); background: var(--glass); border: 1px solid var(--line); padding: 1px 0; width: 40px; text-align: center; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* volume separato: le icone di effetti e musica restano nella riga; + si apre sopra e − sotto, quadrati come gli
   altri, e il livello è un numerino sull'angolo dell'icona */
.volgrp { position: relative; }
.volgrp > button:first-child { position: absolute; left: 0; bottom: calc(100% + 6px); }
.volgrp > button:nth-child(3) { position: absolute; left: 0; top: calc(100% + 6px); }
.volgrp .vol { position: absolute; right: -4px; bottom: -4px; width: auto; min-width: 14px; padding: 0 2px; font-size: 9px; line-height: 12px; pointer-events: none; }
.audiomenu { flex-wrap: nowrap; }
.audiomenu button:disabled { color: var(--muted); border-color: var(--line); }
.layerctl { position: relative; }
.layerctl button { width: 40px; height: 40px; display: grid; place-items: center; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px; }
.layerctl button svg { width: 18px; height: 18px; fill: currentColor; }
.layerctl button[aria-expanded="true"] { background: color-mix(in srgb, var(--gold) 25%, var(--walnut)); }
.layermenu { position: absolute; top: 0; left: 46px; display: flex; flex-direction: row; gap: 6px; }
/* su telefono le voci vanno a capo invece di uscire dal campo */
.audiomenu, .layermenu { flex-wrap: wrap; width: max-content; max-width: calc(100vw - 90px); }
.layermenu button[aria-pressed="false"] { color: var(--muted); border-color: var(--line); }
.layermenu button[aria-pressed="true"] { background: color-mix(in srgb, var(--gold) 22%, var(--walnut)); }
.hint { position: absolute; left: 12px; top: 60px; max-width: 60%; transition: opacity .6s; font-size: 13px; color: var(--muted); pointer-events: none; text-shadow: 0 1px 2px #000; }
/* Tempo della mossa: una linea lungo il bordo basso, il conto alla rovescia al centro del campo. */
.turntimer { position: absolute; left: -1px; right: -1px; bottom: -1px; height: 3px; pointer-events: none; background: rgba(0,0,0,.35); }
.turntimer span { position: absolute; inset: 0; background: var(--gold); transform-origin: right; transform: scaleX(var(--k, 1)); box-shadow: 0 0 8px rgba(214,173,85,.7); }
/* desktop: il conto alla rovescia grande al centro del campo e la barra del tempo lungo il bordo basso, come prima */
.stage > .countdown { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; min-width: 84px; padding: 6px 16px; text-align: center; pointer-events: none;
  font-size: 56px; line-height: 1.1; color: var(--danger); background: var(--glass); border: 1px solid var(--danger); text-shadow: 0 0 10px rgba(224,100,74,.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.stage > .turntimer { left: 0; right: 0; bottom: 0; height: 4px; z-index: 3; }
.stage > .turntimer span { transform-origin: left; }
.turntimer.warn span { background: var(--danger); box-shadow: 0 0 10px rgba(224,100,74,.8); }
.phasecard { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(.96); width: min(320px, calc(100% - 40px)); pointer-events: none;
  display: grid; justify-items: center; gap: 4px; padding: 16px 20px; text-align: center; background: var(--glass); border-block: 1px solid var(--gold);
  opacity: 0; transition: opacity .45s, transform .45s; }
.phasecard.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.phasecard .pc-icon svg { width: 34px; height: 34px; fill: var(--gold); filter: drop-shadow(0 0 8px rgba(214,173,85,.6)); }
.phasecard h2 { font-size: 32px; color: var(--gold); text-shadow: 0 0 14px rgba(214,173,85,.45); }
.phasecard p { margin: 0; font-size: 15px; color: var(--parchment); }
.phasecard .pc-stall { display: grid; gap: 2px; margin-top: 8px; padding: 8px 12px 6px; border: 1px solid var(--stall); background: color-mix(in srgb, var(--stall) 18%, transparent); }
.phasecard .pc-stall strong { font-family: var(--display); font-weight: 500; font-size: 21px; color: var(--stall); }
.phasecard .pc-stall span { font-size: 14px; color: var(--parchment); }
.phase .stallwarn { font-size: 12px; color: var(--stall); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .phasecard { transition: none; transform: translate(-50%, -50%); } }
/* In basso: barra delle azioni e, sopra, la scheda dell'unità che si apre dalla linguetta con la freccia */
.dock { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 4; width: max-content; max-width: calc(100% - 20px);
  display: flex; flex-direction: column; align-items: center; pointer-events: none; }
.dock > * { pointer-events: auto; }
/* solo «Passa il turno»: il pulsante da solo nell'angolo in basso a destra, senza riquadro */
.passcorner { position: absolute; right: 10px; bottom: 10px; z-index: 4; }
.passcorner button { width: 40px; height: 40px; display: grid; place-items: center; padding: 0; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.passcorner button svg { width: 18px; height: 18px; fill: currentColor; }
.passcorner button.primary { background: color-mix(in srgb, var(--gold) 25%, transparent); box-shadow: 0 0 10px rgba(214,173,85,.55); }
.cardtab { width: 56px; height: 20px; display: grid; place-items: center; padding: 0; background: var(--glass); border: 1px solid var(--gold); border-bottom: 0;
  color: var(--gold); border-radius: 2px 2px 0 0; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.cardtab svg { width: 14px; height: 14px; fill: currentColor; transition: transform .25s ease; }
.cardtab[aria-expanded="true"] svg { transform: rotate(180deg); }
.dock .ucard { width: min(440px, calc(100vw - 36px)); max-height: 46vh; overflow-y: auto; background: var(--glass); border-color: var(--gold); border-bottom: 0;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.actbar { position: relative; width: max-content; max-width: 100%; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px; padding: 8px 10px; background: var(--glass); border: 1px solid var(--gold); }
.actbar .who { display: flex; align-items: center; gap: 6px; padding-right: 4px; min-width: 0; }
.actbar .who strong { font-family: var(--display); font-weight: 500; font-size: 18px; white-space: nowrap; }
.actbar .who .hp { font-size: 12px; }
.actbar button { position: relative; flex: none; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; background: var(--glass); border: 1px solid var(--gold); color: var(--gold); border-radius: 2px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.actbar button.primary { background: color-mix(in srgb, var(--gold) 25%, transparent); box-shadow: 0 0 10px rgba(214,173,85,.55); }
.actbar button:disabled { color: var(--muted); border-color: var(--line); }
.actbar button svg { width: 18px; height: 18px; fill: currentColor; }
.actbar button .badge { position: absolute; right: -5px; bottom: -5px; min-width: 14px; padding: 0 2px; font-size: 9px; line-height: 12px; color: var(--gold); background: var(--walnut); border: 1px solid var(--gold); border-radius: 2px; pointer-events: none; }
.actbar .tip { font-size: 13px; color: var(--muted); font-style: italic; }
.phase { display: grid; justify-items: center; gap: 1px; }
.phase .ph { display: inline-flex; align-items: center; gap: 4px; }
.phase .ph svg { width: 14px; height: 14px; fill: currentColor; }
#banner { position: absolute; left: 50%; top: 12%; transform: translate(-50%, -8px); pointer-events: none;
  background: var(--glass); border-block: 1px solid var(--gold); padding: 8px 26px; font-family: var(--display); font-size: 26px; color: var(--gold);
  opacity: 0; transition: opacity .3s, transform .3s; white-space: nowrap; text-shadow: 0 0 12px rgba(214,173,85,.5); }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
.pop { position: absolute; pointer-events: none; font-family: var(--pixel); font-size: 22px; color: #ffe08a; transform: translate(-50%, -50%);
  text-shadow: 2px 0 #1a1008, -2px 0 #1a1008, 0 2px #1a1008, 0 -2px #1a1008, 0 0 10px rgba(255,190,90,.7); }
.pop.crit { font-size: 27px; }
/* Tiro dei dadi per l'iniziativa, in sovrimpressione al centro del campo */
.dicebox { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.92); opacity: 0; transition: opacity .3s, transform .3s; z-index: 6;
  background: var(--glass); border-block: 1px solid var(--gold); padding: 16px 26px 14px; display: grid; gap: 10px; justify-items: center; text-align: center; min-width: min(360px, calc(100vw - 32px)); }
.dicebox.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.dicebox p { margin: 0; font-size: 14px; color: var(--parchment); }
.dice-row { display: flex; align-items: center; gap: 18px; }
.dvs { font-family: var(--display); color: var(--muted); font-size: 18px; }
.dside { display: grid; justify-items: center; gap: 6px; transition: opacity .4s, filter .4s; }
.dside strong { font-family: var(--display); font-weight: 500; font-size: 18px; }
.dside.lose { opacity: .45; filter: grayscale(.6); }
.dbonus { font-style: normal; font-size: 13px; color: var(--gold); min-height: 1.2em; }
.die { width: 58px; height: 58px; background: #f1e6cf; border-radius: 9px; box-shadow: inset 0 -4px 0 #c9b48e, 0 4px 0 #3a2a1a, 0 6px 14px rgba(0,0,0,.5);
  display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 8px; gap: 2px; }
.die i { border-radius: 50%; background: #2a1c12; visibility: hidden; margin: 2px; }
.die i.on { visibility: visible; }
.die.roll { animation: dieTumble .32s linear infinite; }
.die.land { animation: dieLand .45s cubic-bezier(.3, 1.6, .5, 1); }
.dside.win .die { box-shadow: inset 0 -4px 0 #c9b48e, 0 4px 0 #3a2a1a, 0 0 0 3px var(--gold), 0 0 22px rgba(214,173,85,.8); }
@keyframes dieTumble { 0% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-14px) rotate(90deg); } 50% { transform: translateY(0) rotate(180deg); } 75% { transform: translateY(-8px) rotate(270deg); } 100% { transform: translateY(0) rotate(360deg); } }
@keyframes dieLand { from { transform: scale(1.35) rotate(-12deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .die.roll, .die.land { animation: none; } .dicebox { transition: none; } }
#actTip, #modeTip { position: fixed; z-index: 30; max-width: 280px; padding: 8px 11px; background: var(--walnut-2); color: var(--parchment); border: 1px solid var(--gold);
  font-size: 13px; line-height: 1.4; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.stage::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s;
  background: linear-gradient(180deg, rgba(60,72,92,.38), rgba(40,50,66,.22)); }
body.raining .stage::before { opacity: 1; }
/* variazione di una statistica: icona della statistica, verde se sale, rossa se scende */
.pop.pos { color: #8fe27a; text-shadow: 2px 0 #1a1008, -2px 0 #1a1008, 0 2px #1a1008, 0 -2px #1a1008, 0 0 10px rgba(120,230,100,.6); }
.pop.neg { color: #ff5f4e; text-shadow: 2px 0 #1a1008, -2px 0 #1a1008, 0 2px #1a1008, 0 -2px #1a1008, 0 0 10px rgba(255,80,60,.6); }
.pop { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pop svg { width: .85em; height: .85em; fill: currentColor; filter: drop-shadow(1px 1px 0 #1a1008) drop-shadow(-1px -1px 0 #1a1008); }
.credit { margin: 4px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.credit a { color: inherit; }

#glfail { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); }
aside { display: grid; gap: 12px; min-width: 0; }
.card { border: 1px solid var(--line); background: var(--walnut-2); padding: 12px 14px; display: grid; gap: 6px; }
.card h3 { font-size: 21px; }
.uhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.uhead h3 { min-width: 0; display: flex; align-items: center; gap: 7px; }
.ticon { display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border: 1px solid var(--gold); border-radius: 50%; background: color-mix(in srgb, var(--gold) 14%, transparent); }
.ticon svg { width: 14px; height: 14px; fill: var(--gold); }
.actbar .ticon { width: 22px; height: 22px; }
.hp { font-family: var(--pixel); font-size: 15px; white-space: nowrap; }
.hp small { font-family: var(--body); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.hp.ok { color: #9ad47a; } .hp.mid { color: #f0c050; } .hp.low { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.stats div { display: flex; align-items: center; justify-content: center; gap: 5px; border-top: 1px solid var(--line); padding-top: 6px; }
.stats svg { width: 15px; height: 15px; flex: none; fill: var(--gold); }
.stats b { font-family: var(--pixel); font-weight: 400; font-size: 15px; }
.desc { margin: 0; font-size: 15px; color: var(--muted); }
.fc { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; font-size: 15px; align-items: baseline; }
.fc .num { font-size: 14px; }
.fc .dmg { color: var(--danger); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions:not(:has(button:not([hidden]))) { display: none; }
.setinfo { display: grid; gap: 10px; }
details.card summary { cursor: pointer; font-family: var(--display); font-size: 19px; }
details ul { margin: 6px 0 0; padding-left: 18px; font-size: 15px; display: grid; gap: 4px; }
#log { list-style: none; margin: 0; padding: 0; max-height: 200px; overflow-y: auto; font-size: 14px; display: grid; gap: 4px; }
#log li { border-bottom: 1px dotted var(--line); padding-bottom: 3px; }
#log li.big { color: var(--gold); }

.overlay { position: fixed; inset: 0; background: rgba(12,9,7,.86); display: grid; place-items: center; padding: 16px; z-index: 10; }
.overlay .panel { background: var(--walnut-2); border: 1px solid var(--gold); padding: 28px 30px; max-width: 440px; width: 100%; text-align: center; display: grid; gap: 14px; justify-items: center; }
.overlay h2 { font-size: 34px; color: var(--gold); }
.overlay p { margin: 0; }
/* Fine partita: nessun riquadro, solo la scena con la scritta animata. Vittoria: velo caldo e lancio di fiori;
   sconfitta: lo schermo annerisce lentamente e la scritta affiora dal buio; pareggio e stallo: velo crepuscolare. */
.overlay.end { background: transparent; }
.overlay.end.win { animation: endWarm 1.4s ease-out forwards; }
.overlay.end.lose { animation: endBlack 3s cubic-bezier(.4, 0, .6, 1) forwards; }
.overlay.end.even { animation: endDusk 3s ease-out forwards; }
@keyframes endWarm { from { background: rgba(40,24,8,0); } to { background: radial-gradient(ellipse at 50% 45%, rgba(60,36,10,.25), rgba(14,9,5,.72)); } }
@keyframes endBlack { from { background-color: rgba(0,0,0,0); } to { background-color: rgba(0,0,0,.95); } }
@keyframes endDusk { from { background-color: rgba(18,14,24,0); } to { background-color: rgba(18,14,24,.8); } }
#petals { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.endbox { position: relative; display: grid; gap: 16px; justify-items: center; text-align: center; max-width: 560px; }
.endtitle { font-size: clamp(42px, 10vw, 88px); line-height: 1.05; letter-spacing: .02em; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .28em; }
.endtitle .w { display: inline-flex; white-space: nowrap; }
.endtitle .w span { display: inline-block; }
.end.win .endtitle { color: var(--gold); text-shadow: 0 3px 0 #5a3a12, 0 0 24px rgba(255,200,90,.6); }
.end.win .endtitle .w span { animation: letterDrop .75s cubic-bezier(.2, 1.6, .4, 1) both, shimmer 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms), calc(900ms + var(--i) * 90ms); }
.end.lose .endtitle { color: #a8382c; text-shadow: 0 2px 0 #1a0604, 0 0 30px rgba(160,30,20,.45); }
.end.lose .endtitle .w span { animation: letterRise 1.4s ease-out both; animation-delay: calc(.8s + var(--i) * 80ms); }
.end.even .endtitle { color: #c8bfd8; text-shadow: 0 2px 0 #2a2236; }
.end.even .endtitle .w span { animation: letterRise 1.6s ease-out both; animation-delay: calc(.6s + var(--i) * 90ms); }
@keyframes letterDrop { from { opacity: 0; transform: translateY(-80px) scale(1.6) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.45); } }
@keyframes letterRise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } to { opacity: 1; transform: none; filter: blur(0); } }
.endbox > :not(.endtitle) { animation: endFade 1s ease-out both; }
.end.win .endbox > :not(.endtitle) { animation-delay: 1.2s; }
.end.lose .endbox > :not(.endtitle) { animation-delay: 2s; color: #c9b8a8; }
.end.even .endbox > :not(.endtitle) { animation-delay: 1.8s; }
@keyframes endFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.endbox p { max-width: 46ch; color: #eadcc0; text-shadow: 0 1px 3px #000; }
@media (prefers-reduced-motion: reduce) {
  .overlay.end, .endtitle span, .endbox > * { animation: none !important; }
  .overlay.end.win { background: rgba(14,9,5,.72); } .overlay.end.lose { background: rgba(0,0,0,.95); } .overlay.end.even { background: rgba(18,14,24,.8); }
}

@media (max-width: 720px) { .sides { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) {
  .pl { padding: 5px 7px; } .pl strong { font-size: 17px; } .pl .sw { width: 14px; height: 18px; }
  #banner { font-size: 21px; padding: 6px 18px; }
}
@media (prefers-reduced-motion: reduce) { #banner, .pl { transition: none; } }
