/* ======================================================================
   QUIZ ATM — tema retro gaming / arcade CRT
   ====================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap");

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0320;
  --bg2: #150a33;
  --panel: #1a0b3d;
  --neon-pink: #ff3cac;
  --neon-cyan: #2de2e6;
  --neon-green: #39ff14;
  --neon-yellow: #ffe600;
  --neon-purple: #b967ff;
  --text: #eafff6;
  --muted: #9a8ec9;
  --red: #ff3b5c;
  --green: #39ff14;
  --pixel: "Press Start 2P", monospace;
  --body-font: "VT323", "Courier New", monospace;
}

/* Fallback se i font non si caricano: niente rompe. */
body {
  font-family: var(--body-font);
  font-size: 20px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  background-image: radial-gradient(
      circle at 20% 10%,
      rgba(185, 103, 255, 0.18),
      transparent 40%
    ),
    radial-gradient(circle at 85% 20%, rgba(45, 226, 230, 0.15), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 60, 172, 0.15), transparent 45%);
}

/* Griglia "synthwave" sul fondo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: linear-gradient(
      rgba(185, 103, 255, 0.08) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(185, 103, 255, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center;
  transform: perspective(400px) rotateX(55deg);
  transform-origin: center bottom;
  opacity: 0.6;
}

/* Scanline CRT */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px,
    rgba(0, 0, 0, 0.18) 4px
  );
  mix-blend-mode: multiply;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

h1,
h2,
h3 {
  font-family: var(--pixel);
  line-height: 1.5;
  margin-bottom: 16px;
}

h1 {
  font-size: 20px;
}
h2 {
  font-size: 15px;
}
h3 {
  font-size: 12px;
}

/* ---- Header / logo del gioco ---- */
.game-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 10px 0;
}

.game-title {
  font-family: var(--pixel);
  font-size: clamp(26px, 8vw, 54px);
  line-height: 1.2;
  color: var(--neon-yellow);
  text-shadow: 3px 3px 0 var(--neon-pink), 6px 6px 0 var(--neon-cyan),
    0 0 18px rgba(255, 230, 0, 0.6);
  letter-spacing: 2px;
  animation: flicker 4s infinite;
}

.game-subtitle {
  font-family: var(--pixel);
  font-size: clamp(8px, 2.4vw, 12px);
  color: var(--neon-cyan);
  margin-top: 14px;
  text-shadow: 0 0 8px rgba(45, 226, 230, 0.7);
}

.game-subtitle small {
  display: block;
  color: var(--muted);
  margin-top: 8px;
  font-family: var(--body-font);
  font-size: 18px;
  letter-spacing: 1px;
}

.mascot {
  width: 96px;
  height: 96px;
  margin: 0 auto 6px;
  display: block;
  filter: drop-shadow(0 0 10px rgba(45, 226, 230, 0.8));
  animation: bob 2.2s ease-in-out infinite;
  image-rendering: pixelated;
}

.mascot-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  align-items: flex-end;
}

.mascot-small {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 6px rgba(255, 60, 172, 0.8));
}

@keyframes flicker {
  0%,
  19%,
  21%,
  23%,
  25%,
  54%,
  56%,
  100% {
    opacity: 1;
  }
  20%,
  24%,
  55% {
    opacity: 0.75;
  }
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* ---- Pannelli a blocchi (stile cartuccia/arcade) ---- */
.panel {
  background: var(--panel);
  border: 4px solid var(--neon-purple);
  border-radius: 0;
  padding: 24px;
  margin-bottom: 22px;
  box-shadow: 0 0 0 4px var(--bg2), 8px 8px 0 0 rgba(0, 0, 0, 0.5),
    0 0 26px rgba(185, 103, 255, 0.35) inset;
}

/* ---- Input ---- */
input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px;
  border: 4px solid var(--neon-cyan);
  background: #0a0225;
  color: var(--neon-green);
  font-family: var(--pixel);
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}

input::placeholder {
  color: var(--muted);
  font-family: var(--body-font);
  font-size: 18px;
}

input:focus {
  box-shadow: 0 0 14px var(--neon-cyan);
}

/* ---- Bottoni arcade ---- */
button {
  font-family: var(--pixel);
  font-size: 13px;
  background: var(--neon-pink);
  color: #130321;
  border: none;
  border-radius: 0;
  padding: 16px 20px;
  cursor: pointer;
  box-shadow: 0 6px 0 0 #a21a66, 0 0 16px rgba(255, 60, 172, 0.5);
  transition: transform 0.05s, box-shadow 0.05s, filter 0.15s;
  text-transform: uppercase;
}

button:hover {
  filter: brightness(1.1);
}

button:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 0 #a21a66, 0 0 10px rgba(255, 60, 172, 0.5);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: 0 6px 0 0 #444;
  filter: grayscale(0.5);
}

button.secondary {
  background: var(--neon-cyan);
  box-shadow: 0 6px 0 0 #137a7c, 0 0 16px rgba(45, 226, 230, 0.5);
}
button.secondary:active {
  box-shadow: 0 1px 0 0 #137a7c;
}

button.ghost {
  background: transparent;
  color: var(--neon-cyan);
  border: 3px solid var(--neon-cyan);
  box-shadow: 0 0 10px rgba(45, 226, 230, 0.4);
}
button.ghost:active {
  transform: translateY(2px);
}

.hidden {
  display: none !important;
}

/* ---- Opzioni risposta ---- */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 22px;
}

.option-btn {
  padding: 24px;
  font-size: 13px;
  text-align: left;
  min-height: 92px;
  color: #0a0225;
  line-height: 1.5;
}

.option-btn.o0 {
  background: var(--neon-pink);
  box-shadow: 0 6px 0 0 #a21a66;
}
.option-btn.o1 {
  background: var(--neon-cyan);
  box-shadow: 0 6px 0 0 #137a7c;
}
.option-btn.o2 {
  background: var(--neon-yellow);
  box-shadow: 0 6px 0 0 #9a8a00;
}
.option-btn.o3 {
  background: var(--neon-green);
  box-shadow: 0 6px 0 0 #1f8a0b;
}

/* ---- Status ---- */
.status {
  padding: 12px 14px;
  border: 3px solid var(--neon-purple);
  background: #0a0225;
  margin-bottom: 14px;
  font-size: 18px;
  color: var(--text);
}

.status.error {
  border-color: var(--red);
  color: var(--red);
}

.status.ok {
  border-color: var(--neon-green);
  color: var(--neon-green);
}

/* ---- Punteggio ---- */
.score-big {
  font-family: var(--pixel);
  font-size: 40px;
  color: var(--neon-green);
  text-shadow: 0 0 14px rgba(57, 255, 20, 0.7);
  margin-top: 6px;
}

/* ---- Tabelle ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-family: var(--body-font);
  font-size: 19px;
}

th,
td {
  padding: 10px;
  text-align: left;
  border-bottom: 2px solid var(--neon-purple);
}

th {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--neon-cyan);
  text-transform: uppercase;
}

code {
  font-family: var(--pixel);
  color: var(--neon-yellow);
  background: #0a0225;
  padding: 2px 6px;
  border: 2px solid var(--neon-yellow);
}

/* ---- Tag esito ---- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--pixel);
  font-size: 9px;
  border: 2px solid;
  text-transform: uppercase;
}

.tag.correct {
  color: var(--neon-green);
  border-color: var(--neon-green);
}
.tag.wrong {
  color: var(--red);
  border-color: var(--red);
}
.tag.none {
  color: var(--muted);
  border-color: var(--muted);
}

/* ---- Controlli admin ---- */
.admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.q-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.q-nav button {
  padding: 14px 18px;
  font-size: 14px;
  background: var(--neon-purple);
  box-shadow: 0 6px 0 0 #5e2b8f;
}

.q-nav button.active {
  background: var(--neon-green);
  color: #0a0225;
  box-shadow: 0 6px 0 0 #1f8a0b, 0 0 18px var(--neon-green);
}

/* ---- Classifica ---- */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #0a0225;
  border: 3px solid var(--neon-purple);
  font-size: 22px;
}

.leaderboard .row:first-child {
  border-color: var(--neon-yellow);
  box-shadow: 0 0 18px rgba(255, 230, 0, 0.4);
}

.leaderboard .row .rank {
  font-family: var(--pixel);
  font-size: 14px;
  color: var(--neon-yellow);
  margin-right: 12px;
}

.muted {
  color: var(--muted);
  font-size: 18px;
}

.badge-open {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--neon-green);
  text-shadow: 0 0 10px var(--neon-green);
}
.badge-closed {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--muted);
}

/* ---- Blink "insert coin" ---- */
.blink {
  animation: blink 1s steps(2, start) infinite;
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--neon-yellow);
}

@keyframes blink {
  to {
    visibility: hidden;
  }
}

/* Riduci il tilt della griglia su mobile per leggibilità */
@media (max-width: 600px) {
  .options {
    grid-template-columns: 1fr;
  }
  body {
    font-size: 18px;
  }
}
