/* FODUS GAME · stile comune
   Notte profonda con un'aurora sfocata dietro, pannelli di vetro liquido sopra,
   luce al neon solo dove si gioca. */

@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-latin.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/fonts/SpaceGrotesk-latin-ext.woff2") format("woff2");
  font-weight: 300 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --night: #0b0a1f;
  --night-2: #16123d;
  --text: #f4f2ff;
  --muted: rgba(228, 224, 255, .62);
  --faint: rgba(228, 224, 255, .14);
  --cyan: #35e3ff;
  --magenta: #ff4fd8;
  --violet: #8a6bff;
  --amber: #ffc24a;
  --lime: #9dff6b;
  --bad: #ff4d6d;
  --game: var(--cyan);

  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05) 45%, rgba(255, 255, 255, .08));
  --glass-edge: rgba(255, 255, 255, .16);
  --glass-shine: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -1px 0 rgba(255, 255, 255, .07), inset 0 0 22px rgba(255, 255, 255, .04);
  --glass-drop: 0 14px 40px rgba(3, 2, 14, .45);
  --spring: cubic-bezier(.3, 1.5, .5, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--night); }
body {
  background: var(--night); color: var(--text);
  font: 400 16px/1.45 "Space Grotesk", -apple-system, system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

/* ---------- Aurora: la luce colorata che il vetro sfoca ---------- */
.aurora { position: fixed; inset: -20%; z-index: -1; pointer-events: none; overflow: hidden; }
.aurora::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, var(--night-2), var(--night) 70%);
}
.aurora i {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .62;
  animation: drift 38s ease-in-out infinite alternate;
}
.aurora i:nth-child(1) { width: 60vmax; height: 60vmax; left: -5%; top: 0; background: var(--violet); }
.aurora i:nth-child(2) { width: 45vmax; height: 45vmax; right: -5%; top: 25%; background: var(--magenta); opacity: .42; animation-duration: 46s; animation-delay: -12s; }
.aurora i:nth-child(3) { width: 50vmax; height: 50vmax; left: 15%; bottom: -10%; background: var(--cyan); opacity: .34; animation-duration: 52s; animation-delay: -24s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.12); }
  100% { transform: translate(-4vmax, 8vmax) scale(.92); }
}
.aurora.calm i { animation-play-state: paused; }

/* ---------- Marchio ---------- */
.wordmark {
  font-weight: 700; letter-spacing: .04em; font-size: 22px; line-height: 1;
  text-transform: uppercase; color: #fff; text-decoration: none; white-space: nowrap;
}
.wordmark span { color: var(--game); text-shadow: 0 0 14px color-mix(in srgb, var(--game) 70%, transparent); }

/* ---------- Vetro liquido ---------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shine), var(--glass-drop);
}
/* riflesso: una luce morbida in alto a sinistra, come su una lastra curva */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 15% -10%, rgba(255, 255, 255, .22), transparent 55%);
  mix-blend-mode: screen;
}

/* ---------- Pulsanti ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 26px; border-radius: 999px; border: 1px solid var(--glass-edge);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--glass-shine), 0 8px 24px rgba(3, 2, 14, .35);
  color: var(--text); font-weight: 600; font-size: 17px; letter-spacing: .01em;
  cursor: pointer; text-decoration: none;
  transition: transform .35s var(--spring), box-shadow .2s, background .2s;
}
.btn:active {
  transform: scale(.94); transition-duration: .08s;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .2);
}
/* azione principale: luce piena, con alone */
.btn.primary {
  background: var(--cyan); color: #04141c; border-color: rgba(255, 255, 255, .55); font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(0, 0, 0, .12),
              0 0 24px color-mix(in srgb, var(--cyan) 55%, transparent), 0 10px 28px rgba(3, 2, 14, .4);
}
.btn.primary:active { box-shadow: inset 0 3px 10px rgba(0, 0, 0, .25), 0 0 12px color-mix(in srgb, var(--cyan) 40%, transparent); }
.btn[disabled] { opacity: .4; pointer-events: none; }

.icon-btn {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--text);
  border: 1px solid var(--glass-edge); background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(170%); backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--glass-shine), 0 6px 18px rgba(3, 2, 14, .3);
  transition: transform .35s var(--spring);
}
.icon-btn:active { transform: scale(.88); transition-duration: .08s; }
.icon-btn svg { width: 22px; height: 22px; }

/* Etichetta trasparente col "tic" nativo di iPhone */
.haptic-layer {
  position: absolute; inset: 0; z-index: 5; margin: 0; padding: 0;
  background: transparent; border-radius: inherit; cursor: inherit;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.haptic-layer input {
  position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0;
  visibility: hidden; pointer-events: none;
}

/* ---------- Finestre ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
  background: rgba(6, 4, 20, .35);
  -webkit-backdrop-filter: blur(0px); backdrop-filter: blur(0px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s, backdrop-filter .35s, -webkit-backdrop-filter .35s;
}
.overlay.show {
  opacity: 1; pointer-events: auto;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.card {
  width: min(380px, 100%); border-radius: 32px; padding: 30px 24px 22px; text-align: center;
  transform: translateY(24px) scale(.94); opacity: 0;
  transition: transform .5s var(--spring), opacity .2s;
}
.overlay.show .card { transform: none; opacity: 1; }
.card h2 { margin: 0 0 8px; font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; }
.card p { margin: 0 0 6px; color: var(--muted); line-height: 1.5; }
.card .actions { display: grid; gap: 10px; margin-top: 22px; }

.toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-bottom)); z-index: 60;
  transform: translate(-50%, 16px) scale(.96); opacity: 0;
  transition: transform .4s var(--spring), opacity .2s;
  padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 15px;
  pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; text-align: left; font-weight: 500; }
.switch-row + .switch-row { border-top: 1px solid var(--faint); }
.switch-row input { accent-color: var(--cyan); transform: scale(1.1); }

@media (prefers-reduced-motion: reduce) {
  .aurora i { animation: none; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
