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

/* Any ID/class `display` rule below outranks the UA `[hidden] { display: none }`
   and defeats the `hidden` attribute. Keep this reset so `element.hidden = true`
   reliably hides the element — otherwise `#fallback`/`#stage` stay visible even
   when their `hidden` attribute is set. */
[hidden] {
  display: none !important;
}

:root {
  --alley-ink: #04080b;
  --alley-fog: #0a1518;
  --alley-magenta: #ff2e88;
  --alley-cyan: #00e7ff;
  --alley-amber: #ffb347;
  --alley-text: #e6f1f3;
  --alley-text-dim: rgba(230, 241, 243, 0.55);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--alley-ink);
  color: var(--alley-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: none;
}

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

#stage:active {
  cursor: grabbing;
}

#fallback {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 46, 136, 0.15), transparent 60%),
    radial-gradient(circle at 70% 60%, rgba(0, 231, 255, 0.12), transparent 55%), var(--alley-ink);
}

.fallback-card {
  max-width: 32rem;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 21, 24, 0.7);
  backdrop-filter: blur(6px);
  border-radius: 8px;
}

.fallback-card h1 {
  font-size: 1.5rem;
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
  color: var(--alley-magenta);
  text-shadow: 0 0 18px rgba(255, 46, 136, 0.6);
}

.fallback-card p {
  line-height: 1.6;
  color: var(--alley-text-dim);
  font-size: 0.95rem;
}

.hud {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  padding: 0.9rem 1rem 0.75rem;
  background: rgba(4, 8, 11, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 0 18px rgba(0, 231, 255, 0.08);
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

.hud-title {
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: var(--alley-cyan);
  text-shadow: 0 0 10px rgba(0, 231, 255, 0.5);
  margin-bottom: 0.5rem;
  text-align: center;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hud-label {
  font-size: 0.75rem;
  color: var(--alley-amber);
  min-width: 5.5rem;
  text-shadow: 0 0 6px rgba(255, 179, 71, 0.4);
  letter-spacing: 0.1em;
}

#time-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--alley-amber) 0%,
    var(--alley-magenta) 50%,
    var(--alley-cyan) 100%
  );
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--alley-text);
  border: 2px solid var(--alley-ink);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.6),
    0 0 2px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

#time-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--alley-text);
  border: 2px solid var(--alley-ink);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.6),
    0 0 2px rgba(0, 0, 0, 0.8);
  cursor: pointer;
}

.hud-hint {
  margin-top: 0.5rem;
  font-size: 0.65rem;
  text-align: center;
  letter-spacing: 0.15em;
  color: var(--alley-text-dim);
}

@media (max-width: 480px) {
  .hud {
    width: 94vw;
    padding: 0.7rem 0.85rem 0.6rem;
  }
  .hud-label {
    min-width: 4.75rem;
    font-size: 0.7rem;
  }
  .hud-hint {
    font-size: 0.6rem;
  }
}
