@font-face { font-family: 'Fell'; src: url(../fonts/IMFellEnglishSC-400.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/AlegreyaSans-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/AlegreyaSans-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/AlegreyaSans-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Alegreya Sans'; src: url(../fonts/AlegreyaSans-800.woff2) format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --mare-0: #050d16; --mare-1: #0a1a2a; --mare-2: #11304a; --mare-3: #1b4766;
  --carta: #f2e8d2; --carta-2: #d9c9a6; --carta-3: #a8977a;
  --oro: #e8b85a; --oro-chiaro: #f6d58d; --oro-scuro: #9c6c1c;
  --sangue: #e0503f; --verde-ok: #6fcf8e;
  --vetro: rgba(9, 22, 36, .78); --vetro-2: rgba(16, 36, 56, .92); --linea: rgba(242, 232, 210, .14); --linea-2: rgba(242, 232, 210, .28);
  --ombra: 0 10px 30px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .35);
  --r: 14px; --r-s: 10px;
  --display: 'Fell', 'Iowan Old Style', Georgia, serif;
  --ui: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --sicura-alto: env(safe-area-inset-top, 0px); --sicura-basso: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--mare-0); color: var(--carta); font-family: var(--ui); font-size: 17px; line-height: 1.45; overflow: hidden; overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
::selection { background: var(--oro); color: #1d1406; }
:focus-visible { outline: 2.5px solid var(--oro-chiaro); outline-offset: 3px; border-radius: 8px; }
a { color: var(--oro-chiaro); text-underline-offset: 3px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: var(--carta-3) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: rgba(242,232,210,.25); border-radius: 8px; }

/* ---------- bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 46px; padding: .55em 1.1em; border-radius: 999px; border: 1px solid transparent; font-weight: 700; letter-spacing: .01em; text-decoration: none; transition: transform .15s cubic-bezier(.2,.8,.2,1), background-color .2s, box-shadow .2s, opacity .2s; user-select: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn span { display: flex; flex-direction: column; align-items: flex-start; text-align: left; line-height: 1.2; }
.btn small { font-weight: 500; font-size: .8em; opacity: .82; margin-top: 2px; }
.btn-primario { background: linear-gradient(180deg, #c8452f, #9a2b1d); color: #fff7ea; border-color: rgba(255, 200, 160, .35); box-shadow: 0 6px 18px rgba(150, 30, 10, .35), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primario:hover { background: linear-gradient(180deg, #d5513a, #a83322); }
.btn-oro { background: linear-gradient(180deg, var(--oro-chiaro), var(--oro)); color: #2a1a04; border-color: rgba(255, 240, 200, .6); box-shadow: 0 6px 18px rgba(160, 110, 20, .3), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-oro:hover { filter: brightness(1.06); }
.btn-vetro { background: rgba(242, 232, 210, .07); border-color: var(--linea-2); color: var(--carta); }
.btn-vetro:hover { background: rgba(242, 232, 210, .13); }
.btn.grande { min-height: 62px; font-size: 1.08rem; padding: .7em 1.3em; justify-content: flex-start; border-radius: 18px; }
.btn.grande svg { width: 28px; height: 28px; }
.btn.pieno { width: 100%; }
.btn-icona { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--linea-2); background: transparent; position: relative; }
.btn-icona.vetro { background: var(--vetro); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
.btn-icona:hover { border-color: var(--oro); }
.contatore { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--oro); color: #241604; font-size: 12px; line-height: 20px; font-weight: 800; }
.contatore.pieno { background: var(--sangue); color: #fff; animation: pulsa 1.2s infinite; }

/* ---------- schermi ---------- */
.schermo { position: fixed; inset: 0; display: none; }
.schermo.attivo { display: block; animation: entra .45s cubic-bezier(.16,1,.3,1); }
@keyframes entra { from { opacity: 0; transform: translateY(8px); } }

/* HOME */
#home { background: radial-gradient(120% 90% at 50% 10%, #12324d 0%, var(--mare-1) 55%, var(--mare-0) 100%); }
.home-mappa { position: absolute; inset: -6%; opacity: .55; animation: deriva 60s ease-in-out infinite alternate; }
.home-mappa svg { width: 100%; height: 100%; stroke: none; }
@keyframes deriva { from { transform: scale(1.08) translate(-2%, -1%); } to { transform: scale(1.18) translate(2%, 2%); } }
.home-velo { position: absolute; inset: 0; background: radial-gradient(70% 60% at 50% 45%, rgba(5,13,22,.35), rgba(5,13,22,.92) 75%), linear-gradient(180deg, rgba(5,13,22,.2), rgba(5,13,22,.85)); }
.home-contenuto { position: relative; height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: calc(28px + var(--sicura-alto)) 16px calc(16px + var(--sicura-basso)); }
.titolo { text-align: center; margin: clamp(10px, 6vh, 64px) 0 clamp(18px, 4vh, 36px); }
.titolo h1 { font-family: var(--display); font-weight: 400; font-size: clamp(3rem, 12vw, 5.6rem); line-height: .95; margin: 0; letter-spacing: .01em; color: var(--oro-chiaro); text-shadow: 0 2px 0 #5a3a0c, 0 6px 26px rgba(232, 184, 90, .35); animation: titolo 1.4s cubic-bezier(.16,1,.3,1) both; }
@keyframes titolo { from { opacity: 0; letter-spacing: .2em; filter: blur(6px); } }
.motto { font-family: var(--display); font-size: clamp(1.05rem, 3.6vw, 1.3rem); color: var(--carta-2); margin: .6em 0 0; }
.menu-principale { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
.menu-riga { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.menu-riga .btn { min-height: 48px; font-size: .95rem; padding: .5em .7em; }
.statistiche { text-align: center; color: var(--carta-3); font-size: .9rem; margin: 6px 0 0; min-height: 1em; }
.credit { margin-top: auto; padding-top: 22px; font-size: .85rem; color: var(--carta-3); text-align: center; }

/* PAGINE */
.pagina { background: linear-gradient(180deg, var(--mare-1), var(--mare-0)); overflow-y: auto; }
.pagina-testa { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: calc(12px + var(--sicura-alto)) 16px 12px; background: rgba(10, 26, 42, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
.pagina-testa h2 { font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: 0; color: var(--oro-chiaro); }
.pagina-corpo { max-width: 720px; margin: 0 auto; padding: 18px 16px calc(40px + var(--sicura-basso)); display: flex; flex-direction: column; gap: 20px; }
.gruppo { border: 0; padding: 0; margin: 0; }
.gruppo legend { font-family: var(--display); font-size: 1.3rem; color: var(--carta); margin-bottom: 10px; padding: 0; }
.gruppo legend small { font-family: var(--ui); font-size: .8rem; color: var(--carta-3); margin-left: .4em; }
.scelte { display: grid; gap: 10px; }
@media (min-width: 640px) { .scelte { grid-template-columns: repeat(3, 1fr); } }
.scelta { text-align: left; padding: 14px; border-radius: var(--r); border: 1px solid var(--linea-2); background: rgba(242,232,210,.04); display: flex; flex-direction: column; gap: 4px; transition: border-color .2s, background-color .2s; }
.scelta strong { font-family: var(--display); font-weight: 400; font-size: 1.2rem; color: var(--carta); }
.scelta span { font-size: .9rem; color: var(--carta-3); }
.scelta.attiva { border-color: var(--oro); background: rgba(232, 184, 90, .12); box-shadow: inset 0 0 0 1px var(--oro); }
.riga-opz { margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--carta-2); }
select, input { min-height: 44px; border-radius: var(--r-s); border: 1px solid var(--linea-2); background: rgba(5, 13, 22, .6); padding: 0 12px; color: var(--carta); }
select option { background: #0f2436; }
input::placeholder { color: rgba(242,232,210,.4); }
input:focus, select:focus { outline: none; border-color: var(--oro); box-shadow: 0 0 0 3px rgba(232,184,90,.25); }
.lista-giocatori { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lista-giocatori li { display: grid; grid-template-columns: 40px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border-radius: var(--r); background: rgba(242,232,210,.05); border: 1px solid var(--linea); }
.lista-giocatori li input { min-height: 40px; width: 100%; }
.lista-giocatori li select { min-height: 40px; }
.stemma { width: 36px; height: 40px; display: grid; place-items: center; border: 0; padding: 0; background: none; }
.stemma i { display: block; width: 32px; height: 36px; background: var(--c); clip-path: path('M16 0 L32 5 L32 17 C32 27 25 33 16 36 C7 33 0 27 0 17 L0 5 Z'); box-shadow: inset 0 -6px 0 rgba(0,0,0,.25); }
.lista-giocatori .rimuovi { width: 40px; height: 40px; }
.lista-giocatori.sala li { grid-template-columns: 40px 1fr auto; }
.lista-giocatori.sala .stato { font-size: .85rem; color: var(--carta-3); }
.lista-giocatori.sala .stato.on { color: var(--verde-ok); }
.riga-bottoni { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.riga-bottoni.centrata { justify-content: center; }
.nota { font-size: .88rem; color: var(--carta-3); margin: 8px 0 0; }
.campo { font-size: 1rem; }
.blocchi-online { display: grid; gap: 14px; }
@media (min-width: 760px) { .blocchi-online { grid-template-columns: 1fr 1fr; } .blocchi-online .blocco:nth-child(2) { grid-row: span 2; } }
.blocco { padding: 16px; border-radius: 18px; background: linear-gradient(180deg, rgba(242,232,210,.07), rgba(242,232,210,.03)); border: 1px solid var(--linea); display: flex; flex-direction: column; gap: 10px; }
.blocco h3 { margin: 0; display: flex; gap: 8px; align-items: center; font-family: var(--display); font-weight: 400; font-size: 1.35rem; color: var(--oro-chiaro); }
.blocco p { margin: 0; color: var(--carta-2); font-size: .95rem; }
.opz-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.riga-codice { display: flex; gap: 10px; }
.riga-codice input { flex: 1; min-width: 0; font-size: 1.3rem; letter-spacing: .3em; text-transform: uppercase; text-align: center; font-weight: 800; }
.codice-grande { text-align: center; padding: 18px; border-radius: 18px; border: 1px dashed var(--oro); background: rgba(232,184,90,.06); }
.codice-grande span { display: block; color: var(--carta-3); font-size: .9rem; }
.codice-grande strong { font-size: clamp(2.4rem, 11vw, 3.4rem); letter-spacing: .25em; color: var(--oro-chiaro); font-weight: 800; padding-left: .25em; }
.sala-info { text-align: center; margin: 0; color: var(--carta-2); }
.colori-scelta { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.colori-scelta button { width: 42px; height: 42px; border-radius: 50%; border: 3px solid transparent; background: var(--c); }
.colori-scelta button.mio { border-color: #fff; box-shadow: 0 0 0 3px var(--c); }
.colori-scelta button:disabled { opacity: .25; }

/* ---------- GIOCO ---------- */
#gioco { background: var(--mare-0); }
.mappa-box { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.mappa-box.trascina { cursor: grabbing; }
#mappa, #mappa-sfondo { width: 100%; height: 100%; display: block; stroke: none; stroke-width: 0; fill: none; }
.hud-alto { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: flex-start; gap: 8px; padding: calc(8px + var(--sicura-alto)) 10px 0; pointer-events: none; }
.hud-alto > * { pointer-events: auto; }
.giocatori-hud { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0 0 4px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.giocatori-hud::-webkit-scrollbar { display: none; }
.gh { flex: none; display: flex; align-items: center; gap: 7px; padding: 5px 10px 5px 6px; border-radius: 12px; background: var(--vetro); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--linea); transition: transform .3s cubic-bezier(.16,1,.3,1), border-color .3s, box-shadow .3s; }
.gh .stemma { width: 24px; height: 28px; } .gh .stemma i { width: 22px; height: 25px; clip-path: path('M11 0 L22 3.5 L22 12 C22 19 17 23 11 25 C5 23 0 19 0 12 L0 3.5 Z'); }
.gh .nm { font-weight: 700; font-size: .85rem; max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.1; }
.gh .num { font-size: .75rem; color: var(--carta-2); display: flex; gap: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.gh.turno { border-color: var(--c); box-shadow: 0 0 0 1.5px var(--c), 0 6px 18px rgba(0,0,0,.4); transform: translateY(2px); }
.gh.morto { opacity: .38; } .gh.morto .nm { text-decoration: line-through; }
.gh .off { width: 7px; height: 7px; border-radius: 50%; background: #888; } .gh .off.on { background: var(--verde-ok); }
.timer { display: flex; align-items: center; gap: 5px; padding: 0 12px; height: 40px; border-radius: 12px; background: var(--vetro); border: 1px solid var(--linea); font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.poco { color: #fff; background: rgba(200, 50, 40, .85); animation: pulsa 1s infinite; }
.hud-lato { position: absolute; right: 10px; top: calc(64px + var(--sicura-alto)); display: flex; flex-direction: column; gap: 10px; }
@keyframes pulsa { 50% { transform: scale(1.08); } }

.dock { position: absolute; left: 50%; bottom: calc(10px + var(--sicura-basso)); transform: translateX(-50%); width: min(640px, calc(100% - 20px)); padding: 10px 12px 12px; border-radius: 20px; background: var(--vetro-2); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--linea-2); box-shadow: var(--ombra); }
.dock::before { content: ''; position: absolute; left: 18px; right: 18px; top: 0; height: 2px; border-radius: 2px; background: var(--c, var(--oro)); opacity: .9; }
.fasi { list-style: none; margin: 0 0 6px; padding: 0; display: flex; gap: 4px; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: rgba(242,232,210,.4); }
.fasi li { flex: 1; text-align: center; padding: 3px 0; border-radius: 6px; }
.fasi li.attiva { color: #1d1406; background: var(--oro); }
.fasi li.fatta { color: var(--carta-2); }
.istruzione { margin: 2px 2px 8px; font-size: 1rem; min-height: 1.45em; text-wrap: balance; }
.istruzione b { color: var(--oro-chiaro); }
.comandi { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.comandi .btn { min-height: 44px; padding: .45em .95em; font-size: .95rem; }
.comandi .spazio { flex: 1; }
.segmenti { display: inline-flex; border-radius: 999px; border: 1px solid var(--linea-2); overflow: hidden; }
.segmenti button { min-width: 44px; min-height: 42px; border: 0; background: transparent; font-weight: 800; padding: 0 10px; }
.segmenti button.attiva { background: var(--oro); color: #241604; }
.cursore { display: flex; align-items: center; gap: 10px; width: 100%; }
.cursore input[type=range] { flex: 1; accent-color: var(--oro); min-height: 36px; padding: 0; background: none; border: 0; }
.cursore output { min-width: 3ch; text-align: center; font-size: 1.4rem; font-weight: 800; color: var(--oro-chiaro); font-variant-numeric: tabular-nums; }

/* battaglia (dadi) */
.battaglia { position: absolute; left: 50%; bottom: calc(132px + var(--sicura-basso)); transform: translateX(-50%); display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 18px; background: var(--vetro-2); border: 1px solid var(--linea-2); box-shadow: var(--ombra); animation: cala .35s cubic-bezier(.16,1,.3,1); pointer-events: none; max-width: calc(100% - 20px); }
@keyframes cala { from { opacity: 0; transform: translate(-50%, 14px) scale(.96); } }
.avviso { animation-name: cala2; } @keyframes cala2 { from { opacity: 0; transform: translate(-50%, -14px); } }
.battaglia .lato { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 110px; }
.battaglia .chi { font-size: .8rem; font-weight: 700; color: var(--carta-2); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.battaglia .vs svg { width: 26px; height: 26px; color: var(--oro); }
.battaglia .perdite { font-weight: 800; color: var(--sangue); min-height: 1.2em; font-size: .9rem; }
.dadi { display: flex; gap: 8px; perspective: 400px; }
.dado { width: 34px; height: 34px; position: relative; transform-style: preserve-3d; }
.dado .f { position: absolute; inset: 0; border-radius: 7px; background: var(--df, #f4ecdc); border: 1px solid rgba(0,0,0,.25); display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 4px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.18); backface-visibility: hidden; }
.dado .f i { width: 6px; height: 6px; border-radius: 50%; background: var(--dp, #1d1406); place-self: center; }
.dado .f1 { transform: translateZ(17px); } .dado .f6 { transform: rotateY(180deg) translateZ(17px); }
.dado .f2 { transform: rotateY(90deg) translateZ(17px); } .dado .f5 { transform: rotateY(-90deg) translateZ(17px); }
.dado .f3 { transform: rotateX(90deg) translateZ(17px); } .dado .f4 { transform: rotateX(-90deg) translateZ(17px); }
.dado.rotola { animation: rotola .75s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rotola { 0% { transform: translateY(-26px) rotateX(520deg) rotateY(380deg) rotateZ(90deg); } 70% { transform: translateY(3px) var(--fin); } 100% { transform: var(--fin); } }
.dado.vince .f { box-shadow: 0 0 0 2px var(--verde-ok), inset 0 -3px 0 rgba(0,0,0,.18); }
.dado.perde { opacity: .45; filter: grayscale(.6); transition: opacity .3s .1s, filter .3s .1s; }
.att .dado { --df: #f6e1d6; } .dif .dado { --df: #dfe8f3; }

.annuncio { position: absolute; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; font-family: var(--display); font-size: clamp(1.8rem, 7vw, 3rem); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.6), 0 0 30px var(--c, rgba(232,184,90,.6)); opacity: 0; }
.annuncio.mostra { animation: annuncio 1.6s cubic-bezier(.16,1,.3,1) both; }
.annuncio small { display: block; font-family: var(--ui); font-size: .45em; font-weight: 700; color: var(--carta); letter-spacing: .02em; }
@keyframes annuncio { 0% { opacity: 0; transform: scale(.92); filter: blur(6px); } 18% { opacity: 1; transform: none; filter: none; } 75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.chat-volo { position: absolute; left: 12px; bottom: calc(150px + var(--sicura-basso)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.chat-volo div { padding: 6px 12px; border-radius: 14px 14px 14px 4px; background: var(--vetro-2); border: 1px solid var(--c); font-size: .9rem; animation: chat 4.5s ease both; }
@keyframes chat { 0% { opacity: 0; transform: translateY(8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* SVG mappa */
.terr { cursor: pointer; transition: fill .6s ease, filter .3s; stroke: rgba(22, 14, 6, .55); stroke-width: 1.3; stroke-linejoin: round; }
.terr:hover { filter: brightness(1.12); }
.terr.sel { stroke: #fff; stroke-width: 3.5; filter: brightness(1.15) drop-shadow(0 0 10px rgba(255,255,255,.7)); }
.terr.bersaglio { stroke: #ffd36a; stroke-width: 3; stroke-dasharray: 9 6; animation: tratteggio 1s linear infinite; }
.terr.spento { filter: saturate(.45) brightness(.62); }
@keyframes tratteggio { to { stroke-dashoffset: -30; } }
.badge { pointer-events: none; transition: transform .25s; }
.badge .num { font: 800 16px var(--ui); fill: #fff; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: rgba(0,0,0,.35); stroke-width: 2px; }
.badge.pop { animation: pop .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes pop { 40% { transform: scale(1.45); } }
.nome-terr { font: 700 11.5px var(--ui); fill: #fffaf0; text-anchor: middle; paint-order: stroke; stroke: rgba(20, 12, 4, .85); stroke-width: 3px; pointer-events: none; letter-spacing: .01em; }
.mappa-lontana .nome-terr { opacity: 0; }
.nome-regno { font-family: var(--display); fill: rgba(242, 232, 210, .78); text-anchor: middle; letter-spacing: .18em; pointer-events: none; }
.bonus-regno { font: 800 15px var(--ui); fill: var(--oro-chiaro); text-anchor: middle; pointer-events: none; letter-spacing: .05em; }
.volante { font: 800 20px var(--ui); text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.7); stroke-width: 4px; pointer-events: none; }
.rotta { stroke: rgba(242, 232, 210, .45); stroke-width: 2; stroke-dasharray: 2 9; stroke-linecap: round; fill: none; animation: tratteggio 3s linear infinite; }
.onda { stroke: rgba(160, 205, 235, .16); stroke-width: 1.6; fill: none; stroke-linecap: round; animation: onda 7s ease-in-out infinite alternate; }
@keyframes onda { to { transform: translateX(14px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- foglio (pannello) ---------- */
.velo { position: fixed; inset: 0; background: rgba(2, 6, 12, .6); backdrop-filter: blur(3px); z-index: 20; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.foglio { position: fixed; z-index: 21; left: 50%; bottom: 0; transform: translateX(-50%); width: min(720px, 100%); max-height: min(88vh, 900px); display: flex; flex-direction: column; border-radius: 24px 24px 0 0; background: linear-gradient(180deg, #13304a, #0b1d2e); border: 1px solid var(--linea-2); border-bottom: 0; box-shadow: 0 -20px 60px rgba(0,0,0,.5); animation: sale .4s cubic-bezier(.16,1,.3,1); padding-bottom: var(--sicura-basso); }
@keyframes sale { from { transform: translate(-50%, 40px); opacity: 0; } }
@media (min-width: 760px) { .foglio { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-radius: 24px; border-bottom: 1px solid var(--linea-2); animation: compare .35s cubic-bezier(.16,1,.3,1); } @keyframes compare { from { opacity: 0; transform: translate(-50%, -46%); } } }
.foglio > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 10px 22px; border-bottom: 1px solid var(--linea); }
.foglio h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.6rem; color: var(--oro-chiaro); }
.foglio-corpo { overflow-y: auto; padding: 16px 22px 24px; }
.testo { max-width: 68ch; }
.testo h3 { font-family: var(--display); font-weight: 400; font-size: 1.3rem; color: var(--oro-chiaro); margin: 1.4em 0 .3em; }
.testo p, .testo li { color: var(--carta-2); }
.testo strong { color: var(--carta); }
.testo .lead { font-size: 1.05rem; color: var(--carta); }
.testo ul { padding-left: 1.1em; margin: .3em 0; } .testo li { margin: .25em 0; }
.funzioni { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 640px) { .funzioni { grid-template-columns: 1fr 1fr; } }
.funzioni li { display: flex; gap: 12px; align-items: flex-start; }
.funzioni li svg { width: 26px; height: 26px; color: var(--oro); margin-top: 2px; }
.funzioni strong { display: block; color: var(--carta); }
.funzioni span { color: var(--carta-3); font-size: .93rem; }
.menu-gioco { display: grid; gap: 10px; }
.menu-gioco .btn { justify-content: flex-start; }

/* carte Stendardo */
.mano { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 6px 0 14px; }
.carta { width: 104px; height: 150px; border-radius: 12px; padding: 8px; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; background: linear-gradient(160deg, #f8efdc, #e3d1ac); color: #3b2a12; box-shadow: 0 6px 16px rgba(0,0,0,.4), inset 0 0 0 2px #fff6, inset 0 0 0 5px rgba(120, 80, 30, .35); transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s; position: relative; }
.carta svg { width: 56px; height: 56px; stroke: none; }
.carta .tipo { font-family: var(--display); font-size: 1rem; }
.carta .ter { font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.1; min-height: 2.2em; display: flex; align-items: center; }
.carta.mia-terra .ter { color: #1d6b3a; }
.carta.t0 svg { color: #8c2f20; } .carta.t1 svg { color: #1f4f86; } .carta.t2 svg { color: #6b4a12; } .carta.t3 { background: linear-gradient(160deg, #fff6d6, #e8c46c); } .carta.t3 svg { color: #a8740e; }
.carta.scelta-c { transform: translateY(-10px) rotate(-1.5deg); box-shadow: 0 14px 26px rgba(0,0,0,.5), 0 0 0 3px var(--oro); }
.carta.nuova { animation: pesca .7s cubic-bezier(.16,1,.3,1); }
@keyframes pesca { from { transform: translateY(60px) rotate(10deg) scale(.8); opacity: 0; } }
.tabella-tris { width: 100%; border-collapse: collapse; font-size: .9rem; color: var(--carta-2); margin-top: 8px; }
.tabella-tris td { padding: 4px 0; border-bottom: 1px solid var(--linea); } .tabella-tris td:last-child { text-align: right; font-weight: 800; color: var(--oro-chiaro); font-variant-numeric: tabular-nums; }
.pergamena { padding: 26px 24px; border-radius: 6px; background: linear-gradient(180deg, #f5ead0, #e5d2a6); color: #3a2810; font-family: var(--display); font-size: 1.35rem; line-height: 1.35; text-align: center; box-shadow: inset 0 0 40px rgba(120, 80, 20, .35), 0 10px 26px rgba(0,0,0,.45); position: relative; }
.pergamena::before, .pergamena::after { content: ''; position: absolute; left: -8px; right: -8px; height: 14px; border-radius: 8px; background: linear-gradient(180deg, #c9ac74, #8c6a32); }
.pergamena::before { top: -7px; } .pergamena::after { bottom: -7px; }
.pergamena small { display: block; font-family: var(--ui); font-size: .8rem; margin-top: 12px; color: #6b5330; }
.regni-legenda { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.regni-legenda div { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(242,232,210,.05); font-size: .9rem; }
.regni-legenda b { color: var(--oro-chiaro); }
.chat-frasi { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-frasi .btn { min-height: 44px; font-size: .9rem; font-weight: 600; }

/* fine partita */
.fine-box { text-align: center; }
.fine-box .corona { width: 64px; height: 64px; color: var(--oro); margin: 0 auto 6px; display: block; animation: pop 1s cubic-bezier(.3,1.6,.5,1); }
.fine-box h3 { font-family: var(--display); font-weight: 400; font-size: 2rem; margin: 0; color: var(--oro-chiaro); }
.fine-box p { color: var(--carta-2); }
.classifica { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .92rem; font-variant-numeric: tabular-nums; }
.classifica th { font-weight: 700; color: var(--carta-3); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; padding: 6px 4px; text-align: right; }
.classifica th:first-child, .classifica td:first-child { text-align: left; }
.classifica td { padding: 8px 4px; border-top: 1px solid var(--linea); text-align: right; }
.classifica .chi-c { display: flex; align-items: center; gap: 8px; }
.classifica .chi-c i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.missioni-rivelate { text-align: left; font-size: .88rem; color: var(--carta-2); display: grid; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.rebattle { font-weight: 700; color: var(--oro-chiaro); }

/* tenda */
.tenda { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c, #333) 45%, #050d16), #050d16 75%); }
.tenda-box { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.tenda-ico { width: 72px; height: 72px; color: var(--c); }
.tenda h2 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; margin: 0; }
.tenda p { color: var(--carta-2); margin: 0 0 8px; }

.avviso { position: fixed; left: 50%; top: calc(14px + var(--sicura-alto)); transform: translateX(-50%); z-index: 40; padding: 10px 16px; border-radius: 12px; background: var(--vetro-2); border: 1px solid var(--linea-2); box-shadow: var(--ombra); font-weight: 600; max-width: calc(100% - 32px); animation: cala .3s cubic-bezier(.16,1,.3,1); }
.avviso.errore { border-color: var(--sangue); }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .dock { padding: 8px 10px 10px; border-radius: 18px; }
  .istruzione { font-size: .95rem; }
  .comandi .btn { padding: .4em .8em; font-size: .9rem; }
  .battaglia { gap: 8px; padding: 10px; } .battaglia .lato { min-width: 86px; }
  .dado { width: 28px; height: 28px; } .dado .f { padding: 3px; } .dado .f i { width: 5px; height: 5px; }
  .dado .f1 { transform: translateZ(14px); } .dado .f6 { transform: rotateY(180deg) translateZ(14px); } .dado .f2 { transform: rotateY(90deg) translateZ(14px); } .dado .f5 { transform: rotateY(-90deg) translateZ(14px); } .dado .f3 { transform: rotateX(90deg) translateZ(14px); } .dado .f4 { transform: rotateX(-90deg) translateZ(14px); }
  .lista-giocatori li { grid-template-columns: 36px 1fr auto; } .lista-giocatori li .liv { grid-column: 2; } .lista-giocatori li .rimuovi { grid-row: 1; grid-column: 3; }
  .opz-griglia { grid-template-columns: 1fr; }
  .carta { width: 92px; height: 134px; } .carta svg { width: 48px; height: 48px; }
  .hud-lato { top: calc(60px + var(--sicura-alto)); } .hud-lato .btn-icona { width: 42px; height: 42px; }
}
