:root {
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.78);
  --glass: rgba(12, 18, 44, 0.28);
  --glass-edge: rgba(255, 255, 255, 0.22);
  --accent: #ffd27a;
  --veil: #ffffff;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1a2247;
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

#veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 0%, var(--veil) 85%);
  opacity: 0;
}

.hidden { display: none !important; }

/* HUD */
#hud {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(16px, env(safe-area-inset-left));
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

#score {
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  transition: transform 0.15s ease-out;
}

#score.bump { transform: scale(1.15); }

#best {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

#mute {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-edge);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  z-index: 5;
}

#mute svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#mute svg path:first-child { fill: currentColor; }
#mute .cross { display: none; }
#mute.off .cross { display: inline; }
#mute.off .wave { display: none; }

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  cursor: pointer;
}

.intro {
  text-align: center;
  text-shadow: 0 1px 18px rgba(10, 16, 40, 0.28);
  animation: rise 1.2s ease both;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 7vw, 46px);
  font-weight: 300;
  letter-spacing: 0.04em;
  line-height: 1;
}

.go {
  margin-top: 18px;
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
  animation: breathe 2.8s ease-in-out infinite;
}

.go .touch { display: none; }

@media (hover: none) {
  .go .mouse { display: none; }
  .go .touch { display: inline; }
}

.go:focus-visible, #mute:focus-visible { outline: 1px solid var(--ink-soft); outline-offset: 4px; }

@keyframes breathe {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* Di giorno il testo diventa scuro, per leggerlo sul cielo chiaro */
body.day {
  --ink: #18204a;
  --ink-soft: rgba(24, 32, 74, 0.62);
}

body.day .intro,
body.day #hud,
body.day #toast {
  text-shadow: 0 1px 16px rgba(255, 255, 255, 0.55);
}

body.day #mute {
  background: rgba(255, 255, 255, 0.4);
  border-color: rgba(24, 32, 74, 0.15);
}

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  top: 22%;
  transform: translate(-50%, 8px);
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 300;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .intro, .go { animation: none; }
  #score { transition: none; }
}

