:root { --bg: #0b0f1a; --fg: #e6edf7; --mut: #8a97ad; --acc: #7fd1ff; --gold: #e0b84a; --card: #141b2b; --line: #26324a; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #eef2f8; --fg: #14202f; --mut: #55637a; --acc: #1b6fb0; --gold: #9a7410; --card: #ffffff; --line: #c9d3e3; }
}
:root[data-theme="light"] { --bg: #eef2f8; --fg: #14202f; --mut: #55637a; --acc: #1b6fb0; --gold: #9a7410; --card: #ffffff; --line: #c9d3e3; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, sans-serif; min-height: 100vh; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px 10px 64px; } /* spazio per la barra del sito (tl) */
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }
.chip { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; cursor: pointer; }
.chip.on { border-color: var(--acc); color: var(--acc); }
.langs { display: flex; gap: 6px; }
.btn { background: var(--acc); color: #04101c; border: 0; border-radius: 8px; padding: 10px 14px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--acc); border: 1px solid var(--acc); }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: .4; cursor: default; }
.hidden { display: none !important; }

#game { position: relative; margin: 0 16px; height: clamp(240px, 62vh, calc(100dvh - 120px)); min-height: 220px; border-radius: 12px; overflow: hidden; background: #050813; border: 1px solid var(--line); }
#stage { width: 100%; height: 100%; display: block; }
#hud { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 8px; pointer-events: none; }
.stat { background: rgba(10,14,24,.75); color: #e6edf7; border-radius: 8px; padding: 4px 10px; font-size: 14px; }
.stat b { color: #e0b84a; }
#mission-line { color: #7fd1ff; }
#toasts { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: rgba(10,14,24,.85); color: #e6edf7; border-radius: 8px; padding: 6px 12px; font-size: 14px; }

.touch { position: absolute; left: 8px; right: 8px; bottom: 8px; display: none; justify-content: space-between; gap: 6px; }
.touch button { flex: 1; padding: 14px 0; border-radius: 10px; border: 1px solid #3a4a68; background: rgba(20,27,43,.7); color: #e6edf7; font-size: 14px; touch-action: none; }
@media (pointer: coarse) { .touch { display: flex; } }

.overlay { position: absolute; inset: 0; background: rgba(5,8,19,.8); display: flex; align-items: center; justify-content: center; padding: 12px; }
.st-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--card); padding-bottom: 6px; }
.panel { background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 12px; padding: 16px; width: min(460px, 100%); max-height: 100%; overflow: auto; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row small { color: var(--mut); display: block; }
.hint { color: var(--mut); font-size: 14px; }
.card { margin: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card ul { margin: 0; padding-left: 18px; }

/* Tocco lungo su telefono: niente selezione del testo, niente menu di copia o di salvataggio immagine */
#game, .touch button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }

/* Zoom: pulsanti a destra, sotto il radar */
.zoom { position: absolute; right: 10px; top: 150px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 36px; height: 36px; padding: 0; font-size: 20px; line-height: 1; touch-action: manipulation; background: rgba(20,27,43,.8); color: #e6edf7; border: 1px solid #3a4a68; }

/* Telefono: il gioco riempie tutto lo schermo sotto l'intestazione */
@media (max-width: 700px), (pointer: coarse) {
  body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
  #game { flex: 1; height: auto; min-height: 0; margin: 0 8px 8px; }
}
