:root {
  --bg: #120d24;
  --bg2: #1d1538;
  --panel: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f6f3ff;
  --muted: #b3a9d6;
  --accent: #ff3d8b;
  --accent2: #2de2c4;
  --gold: #ffc83d;
  --c0: #e5374f; /* rosso   ▲ */
  --c1: #2f6fe0; /* blu     ◆ */
  --c2: #e3a50a; /* giallo  ● */
  --c3: #2a9d3f; /* verde   ■ */
  --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 61, 139, 0.22), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(45, 226, 196, 0.16), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; cursor: pointer; border: 0; }
input, select { font: inherit; }

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

.btn {
  background: var(--accent); color: #fff; font-weight: 800; letter-spacing: 0.02em;
  padding: 0.9em 1.6em; border-radius: 999px; font-size: 1.1rem;
  box-shadow: 0 6px 0 #b0185a; transition: transform 0.08s, box-shadow 0.08s, opacity 0.2s;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b0185a; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:active { transform: none; }

.field { display: flex; flex-direction: column; gap: 0.4em; }
.field label { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.field input, .field select {
  background: var(--bg2); color: var(--text); border: 2px solid var(--line);
  border-radius: 12px; padding: 0.8em 1em; font-size: 1.1rem; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent2); }

.logo { font-weight: 900; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }

.badge-x {
  display: inline-block; background: var(--gold); color: #2b1d00; font-weight: 900;
  padding: 0.25em 0.7em; border-radius: 999px; letter-spacing: 0.04em;
  animation: pulse 1s ease-in-out infinite alternate;
}
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

.shape { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; }
.shape svg { width: 100%; height: 100%; fill: #fff; }

.opt0 { background: var(--c0); }
.opt1 { background: var(--c1); }
.opt2 { background: var(--c2); }
.opt3 { background: var(--c3); }

.timerbar { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.timerbar > div { height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent2), var(--accent)); transform-origin: left; }

.status-dot { position: fixed; right: 12px; bottom: 10px; font-size: 0.75rem; color: var(--muted); display: flex; align-items: center; gap: 6px; z-index: 50; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #2a9d3f; }
.status-dot.off::before { background: #e5374f; }
.status-dot:not(.off) { display: none; } /* visibile solo se si perde la connessione */
.status-dot.off { background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 999px; color: #fff; }

.sound-ctl { position: fixed; left: 12px; bottom: 10px; display: flex; gap: 6px; z-index: 60; }
.sound-ctl button { width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,0.08); color: var(--text); font-size: 18px; border: 1px solid var(--line); }
.sound-ctl button.off { opacity: 0.4; text-decoration: line-through; }
body[data-screen="answer"] .sound-ctl { display: none; }

.err { color: #ff8da3; min-height: 1.4em; font-weight: 600; }

.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--accent2); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------- marchio "UNA NOTTE DA GENI (o quasi)" ---------------- */
@font-face { font-family: "Anton"; src: url("/fonts/anton.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/fonts/caveat.woff2") format("woff2"); font-display: swap; }
.brand { display: inline-flex; flex-direction: column; align-items: center; line-height: 1; user-select: none; }
.brand .bm { text-align: center; font-family: "Anton", Impact, "Arial Narrow Bold", sans-serif; font-size: 3em; letter-spacing: 0.02em; text-transform: uppercase; color: var(--text); text-shadow: 0 0.06em 0 var(--accent), 0 0.12em 0.3em rgba(0,0,0,.45); }
.brand .bm em { font-style: normal; color: var(--gold); }
.brand .bs { font-family: "Caveat", "Comic Sans MS", cursive; font-size: 1.5em; color: var(--accent2); transform: rotate(-4deg); margin-top: 0.15em; align-self: flex-end; margin-right: 0.3em; }
.brand.sm .bm { font-size: 1.6em; white-space: nowrap; } .brand.sm .bs { font-size: 0.95em; }
.brand.xl .bm { font-size: 5.2em; } .brand.xl .bs { font-size: 2.4em; }
.quip { font-family: "Caveat", cursive; color: var(--accent2); font-size: 1.5em; transform: rotate(-2deg); }
