:root {
  --hue: 0deg;
  --glow: 28px;
  --glow-a: 0.9;
  --flash: 0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  background: #07001c;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* --- Party LED background -------------------------------------------------
   A single saturated gradient rotated through the hue wheel. Hue-rotate is
   continuous, so the colour fade never steps the way keyframed colour stops
   would. Brightness is punched by --flash on each detected beat. */
#bg {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 50% 45%, #ff2d95 0%, #7a00ff 52%, #12003a 100%);
  filter: hue-rotate(var(--hue)) brightness(calc(1 + var(--flash) * 0.85))
          saturate(calc(1 + var(--flash) * 0.5));
  will-change: filter;
}

/* Beat rings are drawn here rather than as DOM nodes — one canvas repaint
   beats creating and destroying elements sixty times a second. */
#fx {
  position: fixed; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  pointer-events: none;
}

#stage {
  position: relative; z-index: 2;
  height: 100%;
  display: flex; align-items: center; justify-content: center;
}

#logo {
  /* Pre-load fallback only; fitLogo() in app.js replaces this with a value
     computed from the real image dimensions. */
  width: 56vmin;
  height: auto;
  display: block;
  filter:
    drop-shadow(0 0 var(--glow) rgba(255,255,255,var(--glow-a)))
    drop-shadow(0 0 calc(var(--glow) * 2.4) rgba(255,255,255,calc(var(--glow-a) * 0.55)));
  will-change: transform, filter;
}

/* --- Start gate -----------------------------------------------------------
   Browsers refuse to start audio without a user gesture, so this is required,
   not decorative. */
#gate {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(7, 0, 28, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity .5s ease, visibility .5s;
}
#gate.hidden { opacity: 0; visibility: hidden; }

#start {
  font: 600 clamp(15px, 2.6vmin, 22px)/1 inherit;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #fff;
  padding: 1.1em 2.2em;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
#start:hover  { background: rgba(255,255,255,.2); box-shadow: 0 0 40px rgba(255,255,255,.45); }
#start:active { transform: scale(.96); }

#note {
  margin: 1.4em 0 0;
  text-align: center;
  color: rgba(255,255,255,.65);
  font-size: clamp(11px, 1.7vmin, 14px);
  letter-spacing: .05em;
}
.gate-inner { display: flex; flex-direction: column; align-items: center; }

/* --- HUD ------------------------------------------------------------------ */
#hud {
  position: fixed; z-index: 5;
  left: 50%; bottom: 3.2vmin; transform: translateX(-50%);
  display: flex; align-items: center; gap: .9em;
  padding: .6em 1.2em;
  border-radius: 999px;
  background: rgba(0,0,0,.32);
  color: rgba(255,255,255,.9);
  font-size: clamp(11px, 1.6vmin, 14px);
  letter-spacing: .06em;
  opacity: 0;
  transition: opacity .4s ease;
}
#hud.show { opacity: .85; }
#hud:hover { opacity: 1; }
#hud button {
  all: unset;
  cursor: pointer;
  width: 1.9em; height: 1.9em;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
}
#hud button:hover { background: rgba(255,255,255,.3); }
/* Volume. The filled portion is painted with a gradient whose stop is set
   from JS via --fill, which avoids needing a second element for the track. */
#vol {
  -webkit-appearance: none;
  appearance: none;
  width: clamp(90px, 16vmin, 150px);
  height: 4px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right,
              rgba(255,255,255,.95) var(--fill, 7%),
              rgba(255,255,255,.22) var(--fill, 7%));
}
#vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border: 0; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,.75);
  transition: transform .12s ease;
}
#vol:hover::-webkit-slider-thumb { transform: scale(1.25); }
#vol::-moz-range-thumb {
  width: 13px; height: 13px;
  border: 0; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255,255,255,.75);
}
#vol::-moz-range-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  #bg { filter: hue-rotate(var(--hue)); }
}
