/* Dieci Lune — un solo mondo visivo: mare notturno, isole luminose, luna lavanda. */
:root {
  color-scheme: dark;
  --sea: #0a1c36;
  --panel: rgba(12, 26, 52, 0.86);
  --panel-2: rgba(28, 48, 86, 0.9);
  --line: rgba(160, 200, 255, 0.18);
  --ink: #eef4ff;
  --muted: #a3b8d8;
  --gold: #ffcc4d;
  --lilac: #dcc8ff;
  --go: #45d987;
  --go-ink: #052414;
  --warn: #ff8a5c;
  --blood: #ff5d6c;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--sea); color: var(--ink);
  font: 400 15px/1.4 var(--body);
  -webkit-font-smoothing: antialiased; user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

#board { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.screen { position: fixed; inset: 0; display: flex; pointer-events: none; }
.screen > * { pointer-events: auto; }

/* ---------- schede (home, stanza) ---------- */
/* finché main.js non ha disegnato la home (account, partite da riprendere, amici) non si vede: niente salti.
   Se il JS non arriva, dopo 4 s compare comunque. */
.booting #home { opacity: 0; animation: boot-show 0.3s 4s forwards; }
#home { transition: opacity 0.25s ease; }
@keyframes boot-show { to { opacity: 1; } }
#home, #lobby { align-items: center; justify-content: center; padding: calc(16px + var(--sat)) max(16px, var(--sar)) calc(16px + var(--sab)) max(16px, var(--sal)); overflow-y: auto; pointer-events: auto; }
.card {
  width: min(100%, 400px); margin: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 26px;
  padding: 26px 22px 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px rgba(2, 8, 22, 0.55);
  display: flex; flex-direction: column; gap: 12px;
}
h1 { font: 800 clamp(46px, 14vw, 62px)/0.92 var(--display); letter-spacing: -0.035em; margin: 6px 0 0; text-wrap: balance; }
.tag { margin: 0 0 6px; color: var(--muted); font-size: 15.5px; max-width: 30ch; }
.moonrow { display: flex; gap: 7px; }
.moonrow i { width: 17px; height: 17px; border-radius: 50%; background: #f6f0ff; position: relative; overflow: hidden; box-shadow: 0 0 12px rgba(220, 200, 255, 0.45); }
.moonrow i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #16305a; transform: translateX(var(--ph, 0%)); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0.02em; }
input[type="text"] {
  width: 100%; height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: rgba(6, 16, 36, 0.6);
  padding: 0 14px; font-size: 17px; font-weight: 600; color: var(--ink); user-select: text; -webkit-user-select: text;
}
input[type="text"]::placeholder { color: #6f86ab; font-weight: 400; }
input[type="text"]:focus { outline: none; border-color: var(--lilac); }

.btn {
  height: 50px; padding: 0 18px; border-radius: 14px; font: 700 16px var(--body);
  background: rgba(150, 190, 255, 0.14); border: 1.5px solid var(--line); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.08s ease, filter 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(2px) scale(0.985); }
.btn.primary { background: #f3ecff; color: #1a1840; border-color: transparent; box-shadow: 0 4px 0 #a996dd; }
.btn.primary:active { box-shadow: 0 1px 0 #a996dd; }
.btn.go { background: var(--go); color: var(--go-ink); border-color: transparent; box-shadow: 0 4px 0 #1f8f55; }
.btn.go:active { box-shadow: 0 1px 0 #1f8f55; }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.link { color: var(--lilac); font-weight: 600; font-size: 14.5px; padding: 8px 4px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(220, 200, 255, 0.4); }
.icon { width: 42px; height: 42px; border-radius: 13px; background: rgba(150, 190, 255, 0.12); border: 1px solid var(--line); font-size: 20px; font-weight: 700; flex: none; display: grid; place-items: center; }
.join { display: flex; gap: 8px; }
.join input { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font: 800 20px var(--display); min-width: 0; }
.join .btn { flex: none; }
.home-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 2px; }
.eyebrow { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.hint { margin: 0; color: var(--muted); font-size: 13.5px; text-align: center; min-height: 1.3em; }

.lobby-top { display: flex; align-items: center; gap: 14px; }
.lobby-top > div { flex: 1; }
.code { font: 800 46px/1 var(--display); letter-spacing: 0.16em; user-select: text; -webkit-user-select: text; }
.netdot { width: 10px; height: 10px; border-radius: 50%; background: var(--go); box-shadow: 0 0 10px var(--go); }
.netdot.off { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.share { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.plist { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 10px; border-radius: 14px; background: rgba(150, 190, 255, 0.08); border: 1px solid transparent; }
.plist li.me { border-color: var(--line); background: rgba(150, 190, 255, 0.14); }
.plist .sw { width: 26px; height: 26px; border-radius: 9px; flex: none; border: 2px solid rgba(255, 255, 255, 0.85); }
.plist button.sw { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.plist .nm { flex: 1; min-width: 0; font-weight: 700; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .tagx { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.plist li.empty { color: var(--muted); font-size: 14px; border: 1px dashed var(--line); background: none; justify-content: center; }
.opts { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; color: var(--muted); }
.seg { display: inline-flex; background: rgba(6, 16, 36, 0.6); border-radius: 12px; padding: 3px; border: 1px solid var(--line); }
.seg button { height: 34px; min-width: 46px; padding: 0 11px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: #f3ecff; color: #1a1840; }
.seg button:disabled { opacity: 0.6; }

/* ---------- partita ---------- */
/* Una sola barra compatta in alto (luna, oro, chat, voce, Pronto, menu), i giocatori sotto,
   e il pannello della casella che sale dal bordo in basso solo quando serve: il resto è mappa. */
#game { flex-direction: column; justify-content: space-between; }
#top { padding: calc(8px + var(--sat)) max(10px, var(--sar)) 0 max(10px, var(--sal)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#top > * { pointer-events: auto; }
.hud { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-gap { flex: 1; min-width: 0; }
.hud-pill, .hud-ico {
  background: rgba(9, 20, 42, 0.64); border: 1px solid rgba(255, 255, 255, 0.13); color: var(--ink);
  box-shadow: 0 6px 16px rgba(3, 10, 25, 0.22); backdrop-filter: blur(12px) saturate(1.4); -webkit-backdrop-filter: blur(12px) saturate(1.4);
}
.hud-ico { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; transition: transform 0.08s ease; }
.hud-ico:active, .stat:active { transform: scale(0.95); }
.hud-ico svg { width: 18px; height: 18px; fill: none; stroke: #eef4ff; stroke-width: 2.2; stroke-linecap: round; }
.stat { height: 40px; border-radius: 20px; flex: none; display: flex; align-items: center; padding: 0 13px 0 10px; white-space: nowrap; transition: transform 0.08s ease; }
.st-moon { display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.st-moon b { font: 800 17px/1 var(--display); letter-spacing: -0.01em; }
.st-moon small { font: 700 12px/1 var(--body); color: var(--muted); margin-left: -4px; align-self: flex-end; padding-bottom: 2px; }
.mo { width: 15px; height: 15px; border-radius: 50%; flex: none; box-shadow: inset -5px 2px 0 0 #f3ecff; transform: rotate(-18deg); filter: drop-shadow(0 0 5px rgba(220, 200, 255, 0.55)); }
.mo.gold { box-shadow: inset -5px 2px 0 0 var(--gold); filter: drop-shadow(0 0 6px rgba(255, 204, 77, 0.8)); }
.mo.blood { box-shadow: inset -5px 2px 0 0 var(--blood); filter: drop-shadow(0 0 6px rgba(255, 93, 108, 0.85)); }
.mo.full { background: #fff; box-shadow: none; filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.9)); }
.st-gold { display: flex; align-items: center; gap: 5px; margin-left: 10px; padding-left: 10px; border-left: 1px solid rgba(255, 255, 255, 0.14); height: 22px; font-variant-numeric: tabular-nums; }
.st-gold:empty { display: none; }
.st-gold b { font: 800 16px/1 var(--display); }
.st-gold small { font: 700 11.5px/1 var(--body); color: #8fe8b2; }
.st-gold .msg { font: 700 12.5px var(--body); color: var(--muted); }
.coin { width: 15px; height: 15px; border-radius: 50%; background: var(--gold); box-shadow: inset 0 0 0 2.5px #d99a16; display: inline-block; flex: none; }
.gold-t { color: var(--gold); }

/* Passa turno: l'azione principale, grande al centro della barra in basso; il tempo scorre nella barretta sotto */
.ready {
  position: relative; flex: 1; min-width: 0; height: 54px; padding: 0 16px; border-radius: 17px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: linear-gradient(180deg, #62ec9f, #3ccd7b); color: var(--go-ink); font: 800 18px/1 var(--display); letter-spacing: -0.005em;
  box-shadow: 0 4px 0 #1f8f55, 0 10px 24px rgba(46, 210, 120, 0.3); transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.2s ease;
}
.ready:active { transform: translateY(2px); box-shadow: 0 1px 0 #1f8f55, 0 4px 12px rgba(46, 210, 120, 0.3); }
.ready:disabled { pointer-events: none; }
.rd-l { display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; }
.rd-l small { font: 700 11px/1 var(--body); opacity: 0.75; letter-spacing: 0; }
.rd-clock { font: 800 13px/1 var(--body); font-variant-numeric: tabular-nums; min-width: 28px; padding: 5px 7px; border-radius: 10px; background: rgba(3, 40, 20, 0.2); text-align: center; }
.rd-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(3, 40, 20, 0.5); transform-origin: left; transition: transform 0.25s linear; }
.ready.low .rd-clock { background: var(--blood); color: #fff; animation: tick 1s ease infinite; }
.ready.low .rd-bar { background: #d4283a; }
@keyframes tick { 50% { transform: scale(1.12); } }
.ready.waiting, .ready.busy { background: rgba(6, 16, 36, 0.6); color: var(--ink); box-shadow: inset 0 0 0 1.5px rgba(69, 217, 135, 0.7); }
.ready.waiting .rd-l b { font-size: 16.5px; }
.ready.waiting .rd-l b { color: #8df0b4; }
.ready.waiting .rd-clock, .ready.busy .rd-clock { background: rgba(255, 255, 255, 0.12); }
.ready.waiting .rd-bar { background: var(--go); opacity: 0.8; }
.ready.busy { box-shadow: inset 0 0 0 1.5px rgba(220, 200, 255, 0.45); font-size: 16px; color: var(--lilac); }
.ready.over { background: #f3ecff; color: #1a1840; box-shadow: 0 4px 0 #a996dd, 0 10px 24px rgba(169, 150, 221, 0.3); }

.hud-2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chips { flex: 1; min-width: 0; display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding: 1px 0 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px 0 4px; border-radius: 14px; background: rgba(9, 20, 42, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 12.5px; font-weight: 700; max-width: 140px; }
.chip.me { border-color: rgba(255, 255, 255, 0.6); }
.chip.out { opacity: 0.45; }
.chip .dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 11px; font-weight: 800; border: 1.5px solid rgba(255, 255, 255, 0.85); color: #08152b; }
.chip .dot.dark { color: #fff; }
.chip.rdy .dot { box-shadow: 0 0 0 2px rgba(69, 217, 135, 0.55); }
.chip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip.off .nm { text-decoration: line-through; text-decoration-color: var(--warn); }
.chip.moon-note { padding: 0 11px; max-width: none; gap: 6px; }
.chip.moon-note.gold { border-color: rgba(255, 204, 77, 0.8); color: var(--gold); }
.chip.moon-note.blood { border-color: rgba(255, 93, 108, 0.85); color: #ffb3ba; }
.chip.moon-note.full { border-color: rgba(255, 255, 255, 0.8); }

.banner { position: fixed; left: 0; right: 0; bottom: calc(var(--sheet-h, 0px) + 8vh); text-align: center; pointer-events: none; animation: banner 1.9s ease both; padding: 0 20px; }
.banner b { display: block; font: 800 clamp(34px, 10vw, 56px)/1 var(--display); letter-spacing: -0.03em; text-shadow: 0 4px 0 rgba(8, 16, 34, 0.6), 0 0 40px rgba(8, 16, 34, 0.9); }
.banner span { display: inline-block; margin-top: 8px; font-weight: 700; font-size: 16px; padding: 6px 14px; border-radius: 12px; background: rgba(8, 18, 38, 0.85); }
@keyframes banner { 0% { opacity: 0; transform: scale(0.8); } 14% { opacity: 1; transform: scale(1.04); } 22% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

#dock { display: flex; flex-direction: column; align-items: center; pointer-events: none; }
#dock > * { pointer-events: auto; width: min(100%, 560px); }

.sheet { padding: 12px 14px; border-radius: 22px 22px 0 0; background: rgba(13, 29, 58, 0.95); border: 1px solid rgba(255, 255, 255, 0.13); border-bottom: 0; backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 -14px 40px rgba(3, 10, 25, 0.32); display: flex; flex-direction: column; gap: 10px; animation: sheet-up 0.22s cubic-bezier(0.2, 0.9, 0.3, 1) both; }
.sheet::before { content: ""; flex: none; align-self: center; width: 36px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); margin: -2px 0 -1px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.sheet-head { display: flex; align-items: baseline; gap: 8px; }
.sheet-head strong { font: 800 17px var(--display); white-space: nowrap; }
.sheet-head span { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.sheet-head .x { width: 30px; height: 30px; border-radius: 10px; background: rgba(150, 190, 255, 0.14); font-size: 14px; flex: none; align-self: center; }
.sheet-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.stepper { display: flex; align-items: center; gap: 2px; background: rgba(6, 16, 36, 0.55); border-radius: 14px; padding: 3px; border: 1px solid var(--line); }
.stepper button { width: 42px; height: 42px; border-radius: 11px; background: rgba(150, 190, 255, 0.16); font: 800 22px var(--display); }
.stepper button:disabled { opacity: 0.3; }
.stepper .val { min-width: 74px; text-align: center; line-height: 1.05; padding: 0 4px; }
.stepper .val b { font: 800 20px var(--display); font-variant-numeric: tabular-nums; display: block; }
.stepper .val small { font-size: 11px; color: var(--muted); font-weight: 600; }
.act { flex: 1; min-width: 96px; min-height: 48px; padding: 4px 10px; border-radius: 14px; background: rgba(150, 190, 255, 0.14); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.act small { font-size: 11.5px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.act[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.act[aria-pressed="true"] small { color: #4b4770; }
.act:disabled { opacity: 0.4; }
.act.danger { flex: 0 0 auto; min-width: 0; color: #ffc2b0; }
.sheet .note { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.sheet .note.ok { color: #8df0b4; }
.sheet .note.bad { color: #ffb199; }

/* ---------- finestre ---------- */
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(4, 10, 24, 0.72); display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--sat)) 16px calc(16px + var(--sab)); animation: fade 0.18s ease both; }
@keyframes fade { from { opacity: 0; } }
.modal .box { width: min(100%, 440px); max-height: 100%; overflow-y: auto; background: #12264a; border: 1px solid var(--line); border-radius: 24px; padding: 22px 20px 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); }
.modal h2 { font: 800 28px/1.05 var(--display); margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
.modal p { margin: 0; color: var(--muted); }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.rules li { display: grid; grid-template-columns: 30px 1fr; gap: 10px; font-size: 14.5px; color: #d5e2f7; }
.rules li b { color: #fff; }
.rules .n { width: 30px; height: 30px; border-radius: 10px; background: rgba(220, 200, 255, 0.16); color: var(--lilac); display: grid; place-items: center; font: 800 15px var(--display); }
.rules .n.gold { background: rgba(255, 204, 77, 0.16); color: var(--gold); }
.rules .n.blood { background: rgba(255, 93, 108, 0.16); color: var(--blood); }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 14px; background: rgba(150, 190, 255, 0.08); font-weight: 700; }
.rank li:first-child { background: rgba(220, 200, 255, 0.2); font-size: 17px; }
.rank .pos { width: 22px; font: 800 16px var(--display); color: var(--muted); }
.rank .sw { width: 22px; height: 22px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, 0.85); flex: none; }
.rank .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank small { color: var(--muted); font-weight: 600; font-size: 12px; }
.rank .gl { color: var(--lilac); font: 800 18px var(--display); font-variant-numeric: tabular-nums; }
.modal .row { display: flex; gap: 8px; }
.modal .row .btn { flex: 1; }

.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--sheet-h, 0px) + 22px + var(--sab)); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { background: #f3ecff; color: #1a1840; font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); animation: toast 2.4s ease both; text-align: center; }
.toast.sticky { animation: rise 0.2s ease both; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8% { opacity: 1; transform: none; } 85% { opacity: 1; } 100% { opacity: 0; } }

@media (min-width: 760px) {
  #top { align-items: center; }
  #top > * { width: min(100%, 760px); }
  .chips { justify-content: center; }
  .hud-2 .soc-slot:not(:empty) { margin-left: auto; }
}
@media (max-width: 374px) {
  .hud { gap: 4px; }
  .hud-ico { width: 34px; height: 34px; }
  .stat { padding: 0 10px 0 8px; }
  .st-gold { margin-left: 8px; padding-left: 8px; }
  .bar { gap: 6px; }
  .bar-b { width: 62px; }
  .ready { font-size: 16.5px; padding: 0 10px; }
}
@media (max-height: 560px) {
  .card { padding: 16px 18px 14px; gap: 8px; }
  h1 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .banner, .sheet, .modal, .toast { animation-duration: 0.01s; }
}

.stepper.mini button { width: 36px; height: 36px; font-size: 19px; }
.stepper.mini .val { min-width: 66px; }
.stepper.mini .val b { font-size: 18px; }

.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.maps button { text-align: left; padding: 8px 10px; border-radius: 12px; background: rgba(6, 16, 36, 0.6); border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.maps button b { font: 800 14px var(--display); }
.maps button small { font-size: 11.5px; color: var(--muted); line-height: 1.25; }
.maps button[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.maps button[aria-pressed="true"] small { color: #4b4770; }
.maps button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.sendrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.sendrow .seg button { min-width: 52px; height: 38px; }
.sheet .act[data-act="mvset"], .sheet .act[data-act="mvall"] { flex: 0 0 auto; min-width: 58px; }

.sheet .act.quick { flex: 0 0 auto; min-width: 52px; }

/* truppe: tre tipi */
.units { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.unit { min-height: 46px; padding: 5px 6px; border-radius: 13px; background: rgba(6, 16, 36, 0.55); border: 1.5px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.unit b { font: 800 14px var(--display); white-space: nowrap; }
.unit b em { font-style: normal; color: #1f9d5b; background: #d9ffe6; border-radius: 7px; padding: 0 5px; margin-left: 2px; }
.unit small { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.unit[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.unit[aria-pressed="true"] small { color: #4b4770; }
.unit:disabled { opacity: 0.4; }
.sendrow { flex-wrap: wrap; }
.sendrow .seg button[data-stype] { min-width: 44px; }
.crown { color: var(--gold); font-size: 0.9em; }
.sheet .stepper.mini .val small { white-space: nowrap; }

/* pannello casella compatto: non deve mai coprire la mappa */
.sheet { padding: 8px max(14px, var(--sar)) calc(12px + var(--sab)) max(14px, var(--sal)); gap: 7px; max-height: min(340px, 52vh); overflow-y: auto; scrollbar-width: none; overscroll-behavior: contain; }
.sheet::-webkit-scrollbar { display: none; }
.sheet-head .x { width: 28px; height: 28px; }
.unit { min-height: 40px; padding: 3px 6px; flex-direction: row; gap: 6px; }
.sheet .act { min-height: 38px; }
.sheet .act small { font-size: 11px; }
.sheet .stepper.mini button { width: 32px; height: 32px; }
.sendrow { flex-wrap: nowrap; }
.sendrow .seg button { min-width: 40px; height: 32px; padding: 0 8px; }
.sendrow .seg button[data-stype] { min-width: 36px; }
.sheet .note { font-size: 12.5px; line-height: 1.3; }

/* ---------- sala d'attesa: scelta della mappa con anteprime (riga scorrevole) ---------- */
.opt .maps-n { font-size: 12px; font-weight: 600; color: var(--muted); opacity: 0.8; }
.maps.maprow { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  margin: 0 -4px; padding: 2px 4px 8px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.maps.maprow .mapcard { flex: 0 0 auto; width: 164px; padding: 7px 7px 9px; gap: 3px; scroll-snap-align: center; grid-column: auto; }
.maps.maprow .mapcard canvas { display: block; width: 148px; height: 100px; border-radius: 9px; margin-bottom: 4px; background: #16416f; }
.maps.maprow .mapcard small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; }
.maps.maprow .mapcard:disabled { opacity: 1; cursor: default; }
.maps.maprow .mapcard[aria-pressed="true"] { box-shadow: 0 0 0 2px #f3ecff, 0 6px 18px rgba(0, 0, 0, 0.35); }
.maps.maprow .mapcard[aria-pressed="true"] canvas { box-shadow: 0 0 0 1.5px rgba(26, 24, 64, 0.25); }

/* ---------- barra in basso: Città · Passa turno · Truppe ---------- */
/* Una striscia sola, ferma sul bordo: i pannelli (casella, città) salgono da dietro e le si appoggiano sopra. */
#dock { position: relative; }
.bar {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 8px;
  padding: 9px max(10px, var(--sar)) calc(9px + var(--sab)) max(10px, var(--sal));
  background: rgba(13, 29, 58, 0.95); border: 1px solid rgba(255, 255, 255, 0.13); border-bottom: 0; border-radius: 22px 22px 0 0;
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); box-shadow: 0 -10px 30px rgba(3, 10, 25, 0.28);
}
#dock.open .bar { border-radius: 0; box-shadow: none; border-top-color: rgba(255, 255, 255, 0.08); }
#dock.open .sheet { padding-bottom: 10px; box-shadow: 0 -14px 40px rgba(3, 10, 25, 0.32); }
.bar.solo .bar-b { display: none; }
.bar-b {
  position: relative; flex: none; width: 70px; height: 54px; border-radius: 17px;
  background: rgba(150, 190, 255, 0.1); border: 1px solid rgba(160, 200, 255, 0.16); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font: 700 12px/1 var(--body); transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
}
.bar-b:active { transform: scale(0.95); }
.bar-b:disabled { opacity: 0.38; pointer-events: none; }
.bar-b svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bar-b[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.bar-b .tr { display: flex; align-items: center; gap: 4px; }
.bar-b .tr b { font: 800 19px/1 var(--display); font-variant-numeric: tabular-nums; }
.bar-b .tr b:empty { display: none; }
#troops-l { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-n {
  position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--gold); color: #3a2600; font: 800 12px/20px var(--body); font-style: normal; text-align: center;
  box-shadow: 0 0 0 2px rgba(13, 29, 58, 0.95), 0 0 12px rgba(255, 204, 77, 0.5);
}
.bar-b[aria-pressed="true"] .bar-n { box-shadow: 0 0 0 2px #f3ecff; }

/* «Le tue città»: una riga per luogo, nome a sinistra (tocca per andarci), acquisti a destra */
.cities { max-height: min(430px, 60vh); }
.cities .sheet-head { align-items: center; }
.cities .cg { display: flex; align-items: center; gap: 5px; justify-content: flex-end; padding-right: 4px; }
.cities .cg b { font: 800 16px var(--display); color: var(--gold); }
.clist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.clist li { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 4px; border-radius: 16px; background: rgba(6, 16, 36, 0.5); border: 1px solid rgba(160, 200, 255, 0.1); }
.clist li.cap { border-color: rgba(255, 204, 77, 0.35); background: linear-gradient(90deg, rgba(255, 204, 77, 0.1), rgba(6, 16, 36, 0.5) 60%); }
.cn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; text-align: left; min-height: 48px; padding: 0 4px; border-radius: 12px; }
.cn:active { background: rgba(150, 190, 255, 0.1); }
.cn > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cn b { font: 800 15.5px/1.1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn small { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cn small em { font-style: normal; color: #8df0b4; }
.ci { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; font-size: 16px; background: rgba(150, 190, 255, 0.12); color: #cfe0ff; }
li.cap .ci { background: rgba(255, 204, 77, 0.18); color: var(--gold); font-size: 18px; }
.cbs { flex: none; display: flex; gap: 6px; }
.cb {
  min-width: 58px; min-height: 48px; padding: 4px 10px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: rgba(150, 190, 255, 0.12); border: 1.5px solid rgba(160, 200, 255, 0.16); line-height: 1.05; transition: transform 0.08s ease;
}
.cb:active { transform: scale(0.95); }
.cb b { font: 800 13.5px/1 var(--display); white-space: nowrap; }
.cb small { display: flex; align-items: center; gap: 3px; font: 700 11px/1 var(--body); color: var(--muted); white-space: nowrap; }
.cb small .coin { width: 12px; height: 12px; box-shadow: inset 0 0 0 2px #d99a16; }
.cb:not(.rec):not(:disabled) { background: rgba(255, 204, 77, 0.14); border-color: rgba(255, 204, 77, 0.55); }
.cb:not(.rec):not(:disabled) b { color: #ffe39a; }
.cb.on, .cb.on:not(:disabled) { background: #f3ecff; border-color: transparent; }
.cb.on b { color: #1a1840 !important; }
.cb.on small { color: #4b4770; }
.cb:disabled { opacity: 0.42; }
.cb.rec { min-width: 54px; }
@media (max-width: 374px) {
  .cb { padding: 4px 7px; min-width: 50px; }
  .cn small { font-size: 11px; }
}

/* ---------- pannello della casella: schede Muovi · Recluta · Costruisci e il compositore dell'armata ---------- */
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sheet, .modal .box { background: linear-gradient(180deg, rgba(24, 46, 88, 0.97), rgba(12, 27, 56, 0.97)); }
.sheet { box-shadow: 0 -14px 40px rgba(3, 10, 25, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.modal .box { box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.sheet-head { align-items: center; min-height: 32px; }
.sheet-head strong { font: 800 18.5px/1.1 var(--display); letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; }
.sheet-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-head .x { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: rgba(150, 190, 255, 0.14); color: #dfe9ff; }
.sheet-head .x .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.sheet-head .x.back { font: 800 22px/1 var(--display); padding-bottom: 3px; }

.act {
  background: linear-gradient(180deg, rgba(170, 205, 255, 0.2), rgba(150, 190, 255, 0.09)); border: 1px solid rgba(180, 210, 255, 0.2);
  box-shadow: 0 2px 0 rgba(2, 8, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.09); transition: transform 0.08s ease;
}
.act:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(2, 8, 22, 0.35); }
.act[aria-pressed="true"] { background: linear-gradient(180deg, #fbf8ff, #e6ddff); box-shadow: 0 2px 0 #a996dd; }
.btn { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 15px; background: rgba(4, 12, 30, 0.55); border: 1px solid rgba(160, 200, 255, 0.12); }
.tabs button { height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; gap: 6px; font: 700 14px var(--body); color: var(--muted); transition: background 0.15s ease, color 0.15s ease; }
.tabs button .ic { width: 17px; height: 17px; }
.tabs button i { font: 800 11px/18px var(--body); font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(150, 190, 255, 0.2); color: var(--ink); }
.tabs button i.g { background: #45d987; color: #052414; }
.tabs button.dim { opacity: 0.55; }
.tabs button[aria-selected="true"] { background: linear-gradient(180deg, #fbf8ff, #e6ddff); color: #1a1840; box-shadow: 0 2px 0 #a996dd; }
.tabs button[aria-selected="true"] i:not(.g) { background: #1a1840; color: #fff; }

/* tre gettoni, uno per tipo: tocca per includere o escludere tutto il tipo, − e + per contarli */
.army { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.uc { --c: 160, 190, 255; border-radius: 17px; background: rgba(4, 12, 30, 0.5); border: 1.5px solid rgba(160, 200, 255, 0.12); display: flex; flex-direction: column; transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease; min-width: 0; }
.uc.u0 { --c: 150, 185, 255; } .uc.u1 { --c: 140, 230, 110; } .uc.u2 { --c: 255, 200, 80; }
.uc.on { background: linear-gradient(180deg, rgba(var(--c), 0.24), rgba(var(--c), 0.08)); border-color: rgba(var(--c), 0.85); box-shadow: 0 0 18px rgba(var(--c), 0.15); }
.uc.none { opacity: 0.32; }
.uc:not(.on):not(.none) { opacity: 0.7; }
.uc-t { display: flex; align-items: center; gap: 7px; padding: 8px 7px 3px; text-align: left; min-width: 0; }
.uc-t .ic { width: 30px; height: 30px; padding: 6px; border-radius: 10px; background: rgba(var(--c), 0.2); color: rgb(var(--c)); stroke-width: 2.2; }
.uc.on .uc-t .ic { background: rgb(var(--c)); color: #0c1a33; }
.uc-t > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
.uc-t b { font: 800 14px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-t small { font: 600 10.5px var(--body); color: var(--muted); white-space: nowrap; }
.uc-s { display: flex; align-items: center; justify-content: space-between; gap: 2px; padding: 2px 5px 6px; }
.uc-s button { width: 30px; height: 30px; border-radius: 10px; background: rgba(255, 255, 255, 0.1); font: 800 18px/1 var(--display); color: #fff; }
.uc-s button:disabled { opacity: 0.25; }
.uc-s button:active { transform: scale(0.92); }
.uc-s span { font-variant-numeric: tabular-nums; white-space: nowrap; }
.uc-s span b { font: 800 19px var(--display); }
.uc-s span small { font: 700 11px var(--body); color: var(--muted); }

.seg button[aria-pressed="true"] { background: linear-gradient(180deg, #fbf8ff, #e6ddff); box-shadow: 0 1px 0 #a996dd; }

.orders { display: flex; flex-wrap: wrap; gap: 6px; }
.oc { display: inline-flex; align-items: center; border-radius: 13px; background: rgba(150, 190, 255, 0.14); border: 1.5px solid rgba(220, 230, 255, 0.35); animation: pop 0.25s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.oc.charge { border-color: rgba(255, 200, 80, 0.8); }
.oc.shot { border-color: rgba(140, 230, 110, 0.8); }
.oc button:first-child { height: 34px; padding: 0 4px 0 11px; display: flex; align-items: center; gap: 7px; font: 700 13.5px var(--body); }
.oc b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #f3ecff; color: #1a1840; font: 800 13px/22px var(--display); text-align: center; }
.oc button:last-child { width: 32px; height: 34px; display: grid; place-items: center; color: #ffc2b0; }
.oc button:last-child .ic { width: 14px; height: 14px; stroke-width: 2.6; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.sheet .note.tg-hint { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; color: #dbe6fb; }
.tg-hint span { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.lg { width: 18px; height: 18px; border-radius: 9px; display: inline-grid; place-items: center; font: 800 11px var(--body); font-style: normal; margin-left: 4px; }
.lg.win { background: #45d987; color: #052414; } .lg.lose { background: #ff7a6b; color: #3a0a06; } .lg.shot { background: #ffd27a; color: #3a2400; }

/* reclute e costruzioni */
.unit .ic { width: 18px; height: 18px; }
.unit.u0 .ic { color: #96b9ff; } .unit.u1 .ic { color: #8ce66e; } .unit.u2 .ic { color: #ffc850; }
.unit[aria-pressed="true"] .ic { color: #1a1840; }
.unit[aria-pressed="true"] { background: linear-gradient(180deg, #fbf8ff, #e6ddff); box-shadow: 0 2px 0 #a996dd; }
.bc {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 17px; text-align: left;
  background: linear-gradient(180deg, rgba(255, 204, 77, 0.2), rgba(255, 204, 77, 0.07)); border: 1.5px solid rgba(255, 204, 77, 0.6);
  box-shadow: 0 3px 0 rgba(2, 8, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1); transition: transform 0.08s ease;
}
.bc:active { transform: translateY(1px); }
.bc .ic { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: rgba(255, 204, 77, 0.22); color: var(--gold); }
.bc > span { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bc b { font: 800 16.5px var(--display); color: #ffe7a8; }
.bc small { font: 600 12.5px var(--body); color: var(--muted); }
.bc em { font-style: normal; display: flex; align-items: center; gap: 5px; font: 800 17px var(--display); padding: 6px 11px; border-radius: 12px; background: rgba(4, 12, 30, 0.45); }
.bc:disabled { opacity: 0.45; filter: saturate(0.5); }
.bc[aria-pressed="true"] { background: linear-gradient(180deg, #fbf8ff, #e6ddff); border-color: transparent; box-shadow: 0 3px 0 #a996dd; }
.bc[aria-pressed="true"] b { color: #1a1840; } .bc[aria-pressed="true"] small { color: #4b4770; } .bc[aria-pressed="true"] em { background: rgba(26, 24, 64, 0.1); color: #1a1840; }
.stepper .st-i { width: 18px; height: 18px; margin: 0 2px 0 6px; color: var(--muted); }
.sheet-row.steps { gap: 6px; }
.sheet { max-height: min(380px, 56vh); }
@media (max-width: 374px) {
  .uc-t small { display: none; }
  .uc-s button { width: 26px; height: 28px; }
  .tabs button span { font-size: 13px; }
}

/* ---------- il giro delle mosse: Prossima · Salta · Resta qui ---------- */
.ready.next { background: linear-gradient(180deg, #fbf8ff, #e2d8ff); color: #1a1840; box-shadow: 0 4px 0 #a996dd, 0 10px 24px rgba(169, 150, 221, 0.3); }
.ready.next .rd-l { flex-direction: row; gap: 9px; }
.ready .cnt { font: 800 14px/26px var(--display); font-style: normal; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: #1a1840; color: #fff; }
.ready.next .rd-clock { background: rgba(26, 24, 64, 0.1); }
.ready.next .rd-bar { background: rgba(26, 24, 64, 0.35); }
.ready.fresh { animation: fresh 1.2s cubic-bezier(0.3, 1.5, 0.5, 1) both; }
.ready.fresh::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.7) 50%, transparent 70%); background-size: 250% 100%; animation: shine 1s ease 0.1s both; pointer-events: none; }
@keyframes fresh { 0% { transform: scale(0.92); } 30% { transform: scale(1.05); box-shadow: 0 4px 0 #1f8f55, 0 0 0 8px rgba(69, 217, 135, 0.25), 0 10px 30px rgba(46, 210, 120, 0.6); } 100% { transform: none; } }
@keyframes shine { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.bar-b.pass { color: #8df0b4; border-color: rgba(69, 217, 135, 0.45); }

.prog { flex: none !important; display: inline-flex; align-items: baseline; gap: 1px; height: 26px; padding: 0 9px; border-radius: 13px; background: rgba(220, 200, 255, 0.16); color: var(--lilac) !important; font: 700 12px/26px var(--body) !important; }
.prog b { font: 800 14px var(--display); color: #fff; }

.nextrow { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.nextrow > .orders, .nextrow > .note { flex: 1; min-width: 0; }
.nextrow .note.tg-hint { justify-content: flex-start; align-items: center; gap: 4px 8px; }
.nxs { flex: none; display: flex; gap: 6px; }
.nx {
  height: 44px; padding: 0 14px; border-radius: 14px; display: inline-flex; align-items: center; gap: 6px; font: 800 14.5px var(--display);
  background: linear-gradient(180deg, rgba(170, 205, 255, 0.2), rgba(150, 190, 255, 0.09)); border: 1px solid rgba(180, 210, 255, 0.22);
  box-shadow: 0 2px 0 rgba(2, 8, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.09); transition: transform 0.08s ease; white-space: nowrap;
}
.nx:active { transform: translateY(1px) scale(0.98); }
.nx .ic { width: 16px; height: 16px; stroke-width: 2.6; margin-right: -4px; }
.nx small { font: 600 11px var(--body); color: var(--muted); }
.nx.skip { background: linear-gradient(180deg, #fbf8ff, #e2d8ff); color: #1a1840; border-color: transparent; box-shadow: 0 2px 0 #a996dd; }
.nx.go { background: linear-gradient(180deg, #62ec9f, #3ccd7b); color: var(--go-ink); border-color: transparent; box-shadow: 0 3px 0 #1f8f55; }
.nx i { font: 800 12px/20px var(--display); font-style: normal; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(5, 36, 20, 0.2); text-align: center; }
.nextrow .orders { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 3px 0; }
.nextrow .orders::-webkit-scrollbar { display: none; }
.oc { flex: none; }
.tabs button { height: 34px; }
.uc-t { padding: 6px 7px 2px; }
.uc-s { padding-bottom: 5px; }
.uc-t .ic { width: 28px; height: 28px; }

/* ---------- un solo pannello per muovere: tipi in alto, quante sotto ---------- */
.ptypes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ptypes .pt { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 8px; border-radius: 14px; background: rgba(6, 16, 36, 0.55); border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; color: var(--muted); }
.ptypes .pt .ic { width: 20px; height: 20px; flex: none; }
.ptypes .pt b { font: 800 16px var(--display); color: var(--ink); }
.ptypes .pt[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.ptypes .pt[aria-pressed="true"] b { color: #1a1840; }
.ptypes .pt.pt-first { border-color: #ffd36b; box-shadow: 0 0 0 1px #ffd36b inset; }
.ptypes .pt.pt-first[aria-pressed="true"] { background: #ffe9a8; }
.ptypes .pt:disabled { opacity: 0.35; }
.qty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.qty .seg.qs { flex: 1; justify-content: space-between; }
.qty .seg.qs button { flex: 1; min-width: 0; }
.sheet .note.foc { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note .lnk { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--lilac); text-decoration: underline; text-underline-offset: 3px; }
.oc.on { outline: 2px solid #f3ecff; outline-offset: 1px; border-radius: 12px; }
.march-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: rgba(150, 190, 255, 0.1); font-size: 13.5px; color: var(--muted); }
.march-row .ic { width: 18px; height: 18px; flex: none; }
.march-row b { color: var(--ink); }
.march-row button { margin-left: auto; height: 32px; padding: 0 12px; border-radius: 10px; background: rgba(255, 140, 110, 0.18); color: #ffc2b0; font-weight: 700; font-size: 13px; }
@media (max-width: 380px) { .ptypes .pt span { display: none; } }

/* schede dei tipi: icona, quante partono su quante, barra */
.ptypes .pt { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 5px; min-height: 0; padding: 8px 9px 7px; text-align: left; }
.ptypes .pt .pt-i { display: flex; }
.ptypes .pt .pt-i .ic { width: 24px; height: 24px; }
.ptypes .pt .pt-t { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; font-size: 13px; }
.ptypes .pt .pt-t b { font: 800 20px var(--display); }
.ptypes .pt .pt-t b small { font: 700 12px var(--body); color: var(--muted); }
.ptypes .pt[aria-pressed="true"] .pt-t b small { color: #4b4770; }
.ptypes .pt .pt-bar { height: 5px; border-radius: 3px; background: rgba(150, 190, 255, 0.18); overflow: hidden; }
.ptypes .pt .pt-bar i { display: block; height: 100%; border-radius: 3px; background: var(--go); }
.ptypes .pt.u1 .pt-bar i { background: #ffb81c; }
.ptypes .pt.u2 .pt-bar i { background: #a074ff; }
.ptypes .pt[aria-pressed="true"] .pt-bar { background: rgba(26, 24, 64, 0.15); }
.sheet .note.tiny { font-size: 12px; font-weight: 600; opacity: 0.85; }
@media (max-width: 380px) { .ptypes .pt span.pt-t > span { display: none; } }
/* comprare truppe: prezzo e verbo chiari */
.buyhead { display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 14px; }
.buy { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.buyc { position: relative; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto auto; column-gap: 7px; align-items: center; text-align: left; padding: 9px 9px 8px; border-radius: 14px; background: rgba(6, 16, 36, 0.55); border: 1.5px solid var(--line); }
.buyc .bi { grid-row: 1 / 3; display: flex; }
.buyc .bi .ic { width: 24px; height: 24px; }
.buyc b { font: 800 14px var(--display); }
.buyc small { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.buyc .price { grid-column: 1 / 3; margin-top: 7px; display: flex; align-items: center; justify-content: center; gap: 4px; height: 28px; border-radius: 9px; background: rgba(255, 204, 77, 0.16); color: var(--gold); font: 800 15px var(--display); }
.buyc .got { position: absolute; top: -7px; right: -5px; background: #45d987; color: #052414; font: 800 12px var(--display); border-radius: 9px; padding: 2px 7px; }
.buyc[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; }
.buyc[aria-pressed="true"] small { color: #4b4770; }
.buyc[aria-pressed="true"] .price { background: #ffcc4d; color: #3d2a00; }
.buyc:disabled { opacity: 0.4; }
.buyrow .act.main { flex: 1; background: var(--go); color: var(--go-ink); border-color: transparent; }
.buyrow .act.main:disabled { background: rgba(150, 190, 255, 0.14); color: var(--ink); }

/* oro: da dove arriva */
.ledger { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.ledger li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); font: 600 14px var(--body); }
.ledger li span { display: flex; flex-direction: column; text-align: left; }
.ledger li small { font: 600 12px var(--body); color: var(--muted); }
.ledger li b { font: 800 15px var(--display); color: #8fe8b2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger li.tot { background: rgba(143, 232, 178, 0.14); }
.ledger-h { margin: 8px 0 2px; font: 800 15px var(--display); text-align: left; }
#res { cursor: pointer; border-radius: 8px; }

/* ---------- schermo largo (computer, tablet in orizzontale): il pannello sta a destra, la mappa usa il resto ---------- */
@media (min-width: 1024px) and (min-aspect-ratio: 5/4) {
  #game { --dock-w: clamp(360px, 30vw, 440px); }
  #top { align-items: stretch; }
  #top > * { width: auto; }
  .hud-2 { padding-right: calc(var(--dock-w) + 22px); }
  /* chat e voce in alto a destra, in fila col menu */
  #top .hud-2 .soc-slot:not(:empty) { position: fixed; z-index: 6; top: calc(8px + var(--sat)); right: calc(max(10px, var(--sar)) + 46px); margin: 0; }
  .hud { max-width: none; }
  .chips { justify-content: flex-start; }
  #dock { position: fixed; z-index: 5; right: max(16px, var(--sar)); top: calc(66px + var(--sat)); bottom: calc(16px + var(--sab)); width: var(--dock-w);
    display: flex; flex-direction: column; justify-content: flex-end; }
  #dock > * { width: 100%; }
  #dock .sheet { max-height: none; flex: 0 1 auto; min-height: 0; border-radius: 22px 22px 0 0; animation-name: sheet-in; }
  #dock .sheet::before { display: none; }
  .bar { border-radius: 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.13); padding: 10px; }
  #dock.open .bar { border-radius: 0 0 22px 22px; }
  .banner { right: calc(var(--dock-w) + 32px); bottom: 14vh; }
  .toasts { right: calc(var(--dock-w) + 32px); bottom: calc(24px + var(--sab)); }
}
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } }

/* barra in basso: nel browser del telefono sta più in alto (la barra del browser copre il fondo);
   con l'app installata scende fino al bordo, lasciando solo il filo per la linea di sistema */
html.mob-browser .bar { padding-bottom: calc(22px + var(--sab)); }
html.mob-browser .sheet { padding-bottom: calc(24px + var(--sab)); }
html.installed .bar { padding-bottom: max(4px, calc(var(--sab) - 26px)); }
html.installed .sheet { padding-bottom: max(6px, calc(var(--sab) - 24px)); }

/* lingua */
.lang-sel { appearance: none; -webkit-appearance: none; height: 34px; padding: 0 28px 0 12px; border-radius: 999px; border: 1.5px solid var(--line); color: var(--ink); font: 600 14px var(--body); cursor: pointer;
  background: rgba(6, 16, 36, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b9c7e0' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center; }
.lang-sel:focus { outline: none; border-color: var(--lilac); }
.lang-sel option { color: #111; }
.home-foot { align-items: center; flex-wrap: wrap; }
.home-lang { height: 30px; font-size: 13px; }
.lang-row { margin: 2px 0; }

/* il selettore: un gettone per tipo di truppa sopra la casella scelta */
.picker { position: fixed; left: 0; top: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 5px; pointer-events: none; will-change: transform; }
.picker[hidden] { display: none; }
.pk-row { display: flex; gap: 6px; padding: 5px; border-radius: 18px; background: rgba(8, 20, 44, 0.82); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 8px 24px rgba(3, 10, 25, 0.4); pointer-events: auto; }
.pk-row.edit { border-color: #ffd36b; }
.tk { display: flex; align-items: center; gap: 4px; min-width: 52px; height: 46px; padding: 0 10px; border-radius: 13px; border: 1.5px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); color: var(--muted); font: 800 18px var(--display); touch-action: none; user-select: none; -webkit-user-select: none; cursor: ew-resize; transition: background 0.12s, transform 0.12s; }
.tk .ic { width: 22px; height: 22px; flex: none; }
.tk b { font: inherit; color: inherit; opacity: 0.75; }
.tk small { font: 700 12px var(--body); opacity: 0.7; margin-left: -2px; }
.tk[aria-pressed="true"] { background: #f3ecff; color: #1a1840; border-color: transparent; transform: translateY(-2px); }
.tk[aria-pressed="true"] b { opacity: 1; }
.tk.u5[aria-pressed="true"] { background: #ffe9a8; }
.tk:disabled { opacity: 0.3; }
.pk-warn { pointer-events: auto; padding: 6px 12px; border-radius: 12px; border: 0; background: #ffd36b; color: #2a2000; font: 700 13px var(--body); box-shadow: 0 6px 16px rgba(3, 10, 25, 0.35); }
.pk-tip { font: 600 11.5px var(--body); color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7); }
@media (max-width: 380px) { .tk { min-width: 46px; padding: 0 8px; font-size: 16px; } .tk .ic { width: 19px; height: 19px; } }
