:root {
  --bg: #0d1017;
  --bg2: #151a24;
  --bg3: #1d2430;
  --border: #2a3342;
  --text: #e7ecf5;
  --muted: #9aa8bf;      /* contrasto ≥ 4.5:1 su --bg */
  --accent: #00b3ff;
  --danger: #e2564a;
  --ok: #4fb477;
  --sea-1: #16304a;      /* centro dell'oceano */
  --sea-2: #0b1624;      /* bordi */
}

* { box-sizing: border-box; }

/* `display` dichiarato su una classe (.game usa grid) batte il display:none di
   default di [hidden]: senza questa riga le viste nascoste restano visibili. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }

/* ── Barra ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
}
.topbar h1 { margin: 0; font-size: 1.1rem; letter-spacing: .12em; text-transform: uppercase; }
.topbar h1 span { color: var(--muted); font-weight: 400; letter-spacing: .04em; text-transform: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .2em; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
}

/* ── Pulsanti a icona (chat, suono) ─────────────────────────────────── */
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
/* .btn.icon-btn e non .icon-btn: la regola .btn, più in basso nel foglio,
   rimetterebbe il padding 9px 14px e l'icona finirebbe fuori centro. */
.btn.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; line-height: 0; flex: 0 0 auto; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
a.icon-btn { color: var(--text); text-decoration: none; }
#btn-sound[aria-pressed="false"] { color: var(--muted); }
#btn-chat.has-unread { color: var(--accent); border-color: var(--accent); animation: chat-ping 1.6s ease-out 3; }
#btn-chat .ico-chat .dots { stroke-width: 3; }
@keyframes chat-ping { 0% { box-shadow: 0 0 0 0 rgba(0, 179, 255, .55); } 100% { box-shadow: 0 0 0 10px rgba(0, 179, 255, 0); } }
@media (prefers-reduced-motion: reduce) { #btn-chat.has-unread { animation: none; } }
.badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--bg2);
}

/* ── Chat ──────────────────────────────────────────────────────────── */
.drawer-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(4, 7, 12, .5); }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 41;
  width: min(360px, 100vw); display: flex; flex-direction: column;
  background: var(--bg2); border-right: 1px solid var(--border);
  box-shadow: 12px 0 40px rgba(0, 0, 0, .45);
  animation: drawer-in .18s ease-out;
}
@keyframes drawer-in { from { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-size: 1rem; letter-spacing: .08em; text-transform: uppercase; }
.chat-list { flex: 1 1 auto; overflow-y: auto; list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-empty { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 30px; }
.chat-msg { max-width: 85%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; }
.chat-head { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); margin-bottom: 3px; }
.chat-msg.mine .chat-head { justify-content: flex-end; }
.chat-head .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.chat-who { font-weight: 700; color: var(--text); }
.chat-text {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px 12px 12px 4px;
  padding: 7px 11px; font-size: .92rem; overflow-wrap: anywhere; white-space: pre-wrap;
}
.chat-msg.mine .chat-text { background: rgba(0, 179, 255, .14); border-color: rgba(0, 179, 255, .45); border-radius: 12px 12px 4px 12px; }
.chat-form { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.chat-form .btn { flex: 0 0 auto; }
.drawer .error { margin: 0 14px 10px; }

/* ── Lingua ────────────────────────────────────────────────────────── */
.lang { position: relative; }
.lang-btn { display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
.lang-code { font-size: .78rem; letter-spacing: .06em; }
.flag { width: 22px; height: 15px; border-radius: 2px; flex: 0 0 auto; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 180px;
  list-style: none; margin: 0; padding: 6px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.lang-menu li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.lang-menu li:hover, .lang-menu li:focus { background: var(--bg3); outline: none; }
.lang-menu li[aria-selected="true"] { color: var(--accent); font-weight: 600; }

/* ── Elementi comuni ───────────────────────────────────────────────── */
.btn {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 14px; font: inherit; font-weight: 600;
  background: var(--bg3); color: var(--text); cursor: pointer;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #00131d; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 6px 10px; font-size: .85rem; }

input[type=text], input[type=number] {
  width: 100%; padding: 9px 11px; font: inherit;
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
}
label { display: block; font-size: .82rem; color: var(--muted); margin: 10px 0 4px; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--danger); font-weight: 600; }
.pill {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 999px;
  padding: 1px 8px; font-size: .78rem; color: var(--muted);
}

/* ── Ingresso e sala d'attesa ──────────────────────────────────────── */
.panel-center { max-width: 640px; margin: 0 auto; padding: 28px 16px 60px; }
.panel-center h2 { margin: 0 0 6px; font-size: 1.5rem; }
.btn-block { width: 100%; margin-top: 14px; }

/* Pagina iniziale: un pannello con due tab. Stessi colori del resto
   dell'interfaccia (fondo --bg2, accento azzurro): niente toni carta qui, sono
   delle carte da gioco. */
.home-panel {
  margin-top: 22px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--border); }
.tabs [role="tab"] {
  font: inherit; font-weight: 700; letter-spacing: .03em; padding: 13px 10px;
  background: transparent; color: var(--muted); border: 0; border-bottom: 3px solid transparent;
  cursor: pointer; margin-bottom: -1px;
}
.tabs [role="tab"]:hover { color: var(--text); background: var(--bg3); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); background: var(--bg3); }
.tabs [role="tab"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tab-pane { padding: 16px 18px 20px; }
.tab-pane > label:first-child, .field-row label { margin-top: 0; }
.tab-pane .small { margin: 10px 0 0; }
.field-row { display: grid; grid-template-columns: 9em 1fr; gap: 10px; }
.field-code input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-transform: uppercase; }
.field-code input::placeholder { text-transform: none; letter-spacing: normal; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }

.my-games-title { margin: 22px 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.my-games { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.my-game {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; text-decoration: none; color: var(--text);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 9px;
}
.my-game:hover, .my-game:focus-visible { border-color: var(--accent); outline: none; }
.my-game .code { padding: 2px 7px; font-size: .8rem; }
.my-game-players { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.pill-turn { background: var(--accent); border-color: var(--accent); color: #00131d; font-weight: 700; }
.pill-done { opacity: .7; }
.my-game-row { display: flex; gap: 6px; align-items: stretch; }
.my-game-row .my-game { flex: 1 1 auto; min-width: 0; }
.btn.my-game-act { width: 40px; height: auto; min-height: 38px; color: var(--muted); }
.btn.my-game-act.danger:hover { color: var(--danger); border-color: var(--danger); }
.notice { background: var(--bg2); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin-top: 16px; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { border-color: var(--danger); }
.confirm-dialog { max-width: 420px; border-top: 4px solid var(--danger); }
.confirm-dialog h2 { font-size: 1.15rem; }
.link-row { display: flex; gap: 8px; margin: 14px 0; }
.link-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }

.players { list-style: none; margin: 14px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px;
}
.players .dot { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 14px; }
.players .who { font-weight: 600; }
.players .stat { margin-left: auto; color: var(--muted); font-size: .85rem; }
.players li.dead { opacity: .5; text-decoration: line-through; }
.players li.now { border-color: var(--accent); }

/* ── Partita ───────────────────────────────────────────────────────── */
.game {
  display: grid; gap: 16px; padding: 16px; align-items: start;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas: "board control" "board side";
  grid-template-rows: auto 1fr;
}
.control { grid-area: control; display: flex; flex-direction: column; gap: 12px; }
.board { grid-area: board; background: var(--bg2); border: 1px solid var(--border); border-radius: 12px; padding: 10px; }
.side { grid-area: side; }
.map-scroll { border-radius: 8px; overflow: hidden; }
#map { width: 100%; height: auto; display: block; touch-action: manipulation; }
.hint { margin: 8px 4px 2px; min-height: 1.4em; color: var(--muted); font-size: .88rem; }

.side { display: flex; flex-direction: column; gap: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; counter-reset: step; }
.steps li {
  flex: 1 1 0; counter-increment: step; font-size: .78rem; color: var(--muted);
  border-top: 3px solid var(--border); padding-top: 5px;
}
.steps li::before { content: counter(step) ". "; font-weight: 700; }
.steps li.done { border-top-color: var(--ok); }
.steps li.now { border-top-color: var(--accent); color: var(--text); font-weight: 600; }

.turn-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px 14px;
}
.turn-box h3 { margin: 0 0 2px; font-size: 1rem; }
.turn-box .phase { color: var(--muted); font-size: .88rem; }
.turn-box.waiting { border-left-color: var(--muted); }
.turn-box.ended { border-left-color: var(--ok); }
.turn-box .btn { display: inline-block; margin-top: 8px; text-decoration: none; }

.actions {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.actions:empty { display: none; }
.actions .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions .row .btn { flex: 1 1 auto; }
.actions .label { font-size: .85rem; color: var(--muted); }
.actions input.num { max-width: 88px; }

.block {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.block > summary { cursor: pointer; font-weight: 600; }
.log { margin: 10px 0 0; padding-left: 18px; max-height: 240px; overflow-y: auto; font-size: .86rem; color: var(--muted); }
.log li { margin-bottom: 4px; }
.log li:first-child { color: var(--text); }
.log-objective { display: block; margin-top: 2px; color: var(--muted); font-style: italic; }

/* ── Carte da gioco (.tcard: "card" è già delle schede della pagina) ─────────────────────────────────────────────────────────── */
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-top: 10px; }
.tcard {
  --card-face: #f3ead6; --card-ink: #2b2418; --cont: #8a8aaa;
  position: relative; display: flex; flex-direction: column; align-items: stretch;
  aspect-ratio: 5 / 7; padding: 6px; gap: 4px;
  background: var(--card-face); color: var(--card-ink);
  border: 2px solid #c9b88f; border-radius: 9px; cursor: pointer; font: inherit;
  box-shadow: 0 2px 0 rgba(0,0,0,.35); transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tcard:hover { transform: translateY(-2px); }
.tcard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tcard.selected { border-color: var(--accent); transform: translateY(-5px); box-shadow: 0 6px 14px rgba(0, 179, 255, .35); }
.tcard-name {
  font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
  text-align: center; line-height: 1.15; min-height: 2.3em; display: grid; place-items: center;
  border-bottom: 1px solid rgba(43, 36, 24, .2); padding-bottom: 3px;
}
.tcard-art {
  position: relative; flex: 1 1 0; min-height: 0; border-radius: 5px;
  background: repeating-linear-gradient(135deg, rgba(43,36,24,.04) 0 4px, transparent 4px 8px);
}
.tcard-art:not(.jolly-art) svg { position: absolute; inset: 3px; width: calc(100% - 6px); height: calc(100% - 6px); }   /* fuori dal flusso: la sagoma non deve allungare la carta */
.tcard-art path { fill: var(--cont); stroke: var(--card-ink); stroke-width: .6; vector-effect: non-scaling-stroke; }
.tcard-sym {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-size: .66rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.tcard-icon { width: 18px; height: 18px; fill: currentColor; flex: 0 0 auto; }
.tcard-icon .eye { fill: var(--card-face); }
.tcard-owned {
  position: absolute; top: -7px; right: -7px; background: var(--ok); color: #04210f;
  font-size: .7rem; font-weight: 800; border-radius: 999px; padding: 1px 6px; border: 2px solid var(--bg2);
}
.tcard.jolly { --card-face: #1f2638; --card-ink: #f3d27a; border-color: #b8963e; }
.jolly-art { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: none; }
.jolly-art .tcard-icon { width: 24px; height: 24px; }
.cards-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.hint strong { color: var(--text); }

.last-roll { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.last-roll-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: .85rem; margin-bottom: 4px; }
.last-roll-head span { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); width: 100%; }

/* ── Dadi ──────────────────────────────────────────────────────────── */
.roll { display: grid; width: fit-content; gap: 5px; margin: 4px 0 8px; }   /* blocco: il suggerimento va sotto, non accanto */
.roll-row { display: flex; align-items: center; gap: 6px; }
.roll-lab { width: 5.5em; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.roll-sum { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.die { width: 38px; height: 38px; flex: 0 0 auto; transition: opacity .2s; }
.die rect { stroke-width: 1.5; }
.die.atk rect { fill: var(--danger); stroke: #8e2a22; }
.die.atk circle { fill: #fff; }
.die.def rect { fill: #eef3fb; stroke: var(--accent); }
.die.def circle { fill: #0b0e14; }
/* Il perdente diventa grigio ma resta leggibile: si deve poter vedere cosa
   aveva tirato. Il vincente resta colorato e un po' più marcato. */
.die.lost rect { fill: #3a4254; stroke: #55607a; }
.die.lost circle { fill: #aab6cc; }
.die.won rect { stroke-width: 2.4; }

/* Lancio: solo sul tiro appena fatto (classe .anim), un dado dopo l'altro */
.roll.anim .die { animation: dice-roll .55s cubic-bezier(.2, .8, .3, 1.2) both; }
.roll.anim .die:nth-of-type(2) { animation-delay: .07s; }
.roll.anim .die:nth-of-type(3) { animation-delay: .14s; }
.roll.anim .roll-row.def .die { animation-delay: .2s; }
.roll.anim .roll-row.def .die:nth-of-type(2) { animation-delay: .27s; }
@keyframes dice-roll {
  0%   { transform: translateY(-14px) rotate(-200deg) scale(.6); opacity: 0; }
  70%  { transform: translateY(2px) rotate(10deg) scale(1.05); opacity: 1; }
  100% { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .roll.anim .die { animation: none; } }

/* ── Mappa ─────────────────────────────────────────────────────────── */
.sea-1 { stop-color: var(--sea-1); }
.sea-2 { stop-color: var(--sea-2); }
.graticule line { stroke: #ffffff; stroke-opacity: .05; stroke-width: .6; }

/* Territori: colore del proprietario, un filo scuro fra l'uno e l'altro */
.terr { stroke: #0b0e14; stroke-width: .7; stroke-linejoin: round; transition: opacity .15s, filter .15s; }
.terr.clickable { cursor: pointer; }
.terr.clickable:hover { filter: brightness(1.2); }
.terr.dim { opacity: .35; }
.terr.from { stroke: #ffffff; stroke-width: 2; filter: brightness(1.15); }
.terr.target-atk  { stroke: var(--danger); stroke-width: 1.8; animation: pulse 1.2s ease-in-out infinite; }
.terr.target-move { stroke: var(--accent); stroke-width: 1.8; animation: pulse 1.2s ease-in-out infinite; }
.terr.to { stroke: #ffffff; stroke-width: 2.4; animation: none; }
@keyframes pulse { 50% { stroke-opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .terr.target-atk, .terr.target-move { animation: none; } }

.cont-outline { fill: none; stroke-width: 1.3; stroke-opacity: .75; pointer-events: none; }
.cont-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  paint-order: stroke; stroke: var(--sea-2); stroke-width: 3px; pointer-events: none;
}
.sea-line line { stroke: #d6e2f5; stroke-opacity: .55; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }

.arrow { fill: none; stroke-width: 2.5; pointer-events: none; }
.arrow.atk  { stroke: var(--danger); }
.arrow.move { stroke: var(--accent); }
.head-atk  { fill: var(--danger); }
.head-move { fill: var(--accent); }

/* Nodi: il numero di armate. Sopra le forme, con un bordo scuro che li
   stacca dal territorio dello stesso colore. */
.node { cursor: default; }
.node.clickable { cursor: pointer; }
.node circle { stroke: #0b0e14; stroke-width: 1.5; }
.node.from circle, .node.to circle { stroke: #ffffff; stroke-width: 2.5; }
.node.target-atk circle  { stroke: var(--danger); stroke-width: 2.5; }
.node.target-move circle { stroke: var(--accent); stroke-width: 2.5; }
.node.dim { opacity: .45; }
.node text { pointer-events: none; }
.node .count { font-size: 11px; font-weight: 700; }
.node .name {
  font-size: 7.5px; font-weight: 600; fill: #eef3fb;
  paint-order: stroke; stroke: #0b0e14; stroke-width: 2.2px; stroke-linejoin: round;
}
.node:focus-visible { outline: none; }
.node:focus-visible circle { stroke: var(--accent); stroke-width: 3; }

/* ── Regole ────────────────────────────────────────────────────────── */
dialog {
  max-width: 640px; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px; padding: 22px;
}
dialog::backdrop { background: rgba(4, 7, 12, .7); }
dialog h2 { margin-top: 0; }
dialog h3 { margin-bottom: 4px; font-size: .95rem; color: var(--accent); }

/* ── Vittoria ───────────────────────────────────────────────────────── */
.win-dialog { --winner: var(--accent); max-width: 440px; text-align: center; border-top: 4px solid var(--winner); }
.win-trophy { width: 56px; height: 56px; fill: none; stroke: var(--winner); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin: 4px auto 6px; display: block; }
.win-dialog h2 { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.4rem; margin: 0 0 4px; }
.win-dialog h2 .dot { width: 16px; height: 16px; border-radius: 50%; flex: 0 0 16px; }
.win-reason { color: var(--muted); margin: 0 0 16px; }
.win-objective { background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; text-align: left; }
.win-objective-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.win-objective p { margin: 0; font-weight: 600; }
.win-actions { display: flex; gap: 8px; justify-content: center; margin-top: 18px; }
.win-actions .btn { text-decoration: none; }
@media (prefers-reduced-motion: no-preference) {
  .win-dialog[open] { animation: win-pop .35s cubic-bezier(.2, .8, .3, 1.2); }
  @keyframes win-pop { from { transform: scale(.85); opacity: 0; } }
}

.foot { padding: 18px 16px 40px; text-align: center; color: var(--muted); font-size: .85rem; }
.foot p { margin: 4px 0; }
.foot-privacy { font-size: .8rem; }
.privacy-dialog { max-width: 680px; }
.privacy-dialog ul { padding-left: 20px; margin: 6px 0 10px; }
.privacy-dialog li { margin-bottom: 4px; }
.privacy-dialog p { margin: 6px 0 10px; }
.privacy-dialog .muted { font-size: .85rem; }

@media (max-width: 900px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "control" "board" "side"; grid-template-rows: none; padding: 12px; }
}

/* Su telefono la mappa intera sarebbe larga come il palmo: i territori
   europei diventerebbero impossibili da toccare. Si tiene una larghezza minima
   e si scorre di lato. */
@media (max-width: 700px) {
  .map-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  #map { min-width: 760px; }
}

/* Barra su telefono: home, chat, titolo, link, suono e lingua devono stare in
   una riga. Il codice partita è già nel link, e il sottotitolo è decorativo. */
@media (max-width: 560px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar h1 span, #game-code { display: none; }
  .topbar-right { gap: 6px; }
  .lang-code { display: none; }
  #btn-share { padding: 8px 10px; font-size: .82rem; }
}
