:root {
  --bg: #07071a;
  --bg2: #0e0e2a;
  --card: #12122e;
  --card-border: #2a2a5a;
  --text: #eef0ff;
  --muted: #9aa0c8;
  --neon: #ff2bd6;
  --cyan: #2bfff2;
  --lime: #b8ff2b;
  --amber: #ffc02b;
  --violet: #8b5cff;
  --danger: #ff4d6d;
  --radius: 18px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --font: "Space Grotesk", system-ui, sans-serif;
  --display: "Orbitron", "Space Grotesk", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  overflow-x: hidden;
}

.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(43, 255, 242, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(43, 255, 242, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; inset: -20% -10% auto; height: 60vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(255, 43, 214, 0.28), transparent 55%),
    radial-gradient(ellipse at 70% 30%, rgba(43, 255, 242, 0.22), transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(139, 92, 255, 0.18), transparent 55%);
  filter: blur(8px);
}

a { color: var(--cyan); text-underline-offset: 3px; }
a:hover { color: var(--lime); }

.hero {
  padding: 3.5rem 1.25rem 1.5rem;
  text-align: center;
}
.hero-inner { max-width: 760px; margin: 0 auto; }
.eyebrow {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 43, 214, 0.45);
  background: rgba(255, 43, 214, 0.12);
  color: var(--neon);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.logo {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2rem, 7vw, 3.6rem);
  letter-spacing: 0.02em;
  margin: 0 0 0.75rem;
  background: linear-gradient(105deg, var(--cyan), var(--neon) 45%, var(--amber));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 40px rgba(255, 43, 214, 0.25);
}
.logo span { opacity: 0.7; }
.tagline {
  margin: 0 auto 1.5rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  max-width: 34em;
}
.tagline em { color: var(--lime); font-style: normal; font-weight: 600; }

.hero-actions {
  display: flex; flex-wrap: wrap; gap: 0.65rem; justify-content: center;
}
.btn {
  appearance: none; border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.7rem 1.15rem; border-radius: 999px;
  cursor: pointer; transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(43, 255, 242, 0.2);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(120deg, var(--violet), var(--neon));
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(255, 43, 214, 0.3);
}
.btn.primary[aria-pressed="true"] {
  background: linear-gradient(120deg, var(--cyan), var(--lime));
  color: #071018;
}
.btn.accent {
  border-color: rgba(184, 255, 43, 0.45);
  background: rgba(184, 255, 43, 0.1);
  color: var(--lime);
}
.btn.ghost {
  padding: 0.4rem 0.75rem; font-size: 0.8rem;
}
.audio-hint {
  margin: 0.9rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.toc {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(7, 7, 26, 0.82);
  border-bottom: 1px solid rgba(42, 42, 90, 0.7);
}
.toc-inner {
  display: flex; gap: 0.45rem; overflow-x: auto;
  padding: 0.65rem 1rem; max-width: 1200px; margin: 0 auto;
  scrollbar-width: thin;
}
.toc a {
  flex: 0 0 auto;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.toc a:hover, .toc a:focus-visible {
  color: var(--text);
  border-color: var(--card-border);
  background: rgba(255, 255, 255, 0.05);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 1.25rem;
  padding: 1.5rem 1.15rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.card {
  background: linear-gradient(165deg, rgba(30, 30, 70, 0.9), rgba(18, 18, 46, 0.95));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.25rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; inset: 0 0 auto; height: 3px;
  background: linear-gradient(90deg, var(--accent, var(--neon)), transparent 80%);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.card-cap {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.vol-pill {
  flex: 0 0 auto;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(43, 255, 242, 0.35);
  color: var(--cyan);
  min-width: 4.2rem;
  text-align: center;
}
.stage {
  flex: 1;
  position: relative;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px dashed rgba(154, 160, 200, 0.25);
  min-height: 180px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.stage canvas { display: block; width: 100%; height: 100%; }
.stage-ui {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0.75rem; gap: 0.5rem;
}
.hint {
  font-size: 0.78rem; color: var(--muted); text-align: center; margin: 0;
}
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.annoy {
  font-size: 0.75rem; color: var(--amber);
  letter-spacing: 0.04em;
}

/* Shared widget bits */
.pump-wrap, .crank-wrap, .phone-wrap, .binary-wrap, .pi-wrap, .chase-wrap, .roulette-wrap, .stack-wrap, .rocket-wrap, .scream-wrap {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.55rem; padding: 0.5rem;
}
.pump-balloon {
  width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6, var(--neon));
  border: 2px solid rgba(255, 255, 255, 0.35);
  transition: width 0.08s, height 0.08s;
  box-shadow: 0 0 24px rgba(255, 43, 214, 0.4);
}
.pump-handle {
  width: 28px; height: 70px; border-radius: 8px;
  background: linear-gradient(#ddd, #888);
  border: 2px solid #555;
  cursor: grab; position: relative;
  touch-action: none;
}
.pump-handle::after {
  content: ""; position: absolute; left: -10px; right: -10px; top: -6px; height: 14px;
  border-radius: 6px; background: #bbb; border: 2px solid #666;
}
.pump-handle:active { cursor: grabbing; }

.pi-input, .bin-input {
  width: min(100%, 280px);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: #0a0a1c;
  color: var(--lime);
  outline: none;
}
.pi-input:focus, .bin-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(43, 255, 242, 0.2); }
.pi-status, .bin-status { font-size: 0.8rem; color: var(--muted); min-height: 1.2em; }

.phone-slider {
  width: min(100%, 300px);
  accent-color: var(--neon);
}
.phone-readout {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 1.1rem;
  color: var(--amber);
  letter-spacing: 0.08em;
}

.chase-knob {
  position: absolute;
  width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, var(--cyan));
  border: 2px solid #fff;
  box-shadow: 0 0 18px rgba(43, 255, 242, 0.55);
  cursor: grab;
  left: 20%; top: 40%;
  touch-action: none;
  z-index: 2;
}
.chase-track {
  position: absolute; left: 8%; right: 8%; top: 50%; height: 8px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.crank {
  width: 120px; height: 120px; border-radius: 50%;
  border: 6px solid var(--violet);
  background: conic-gradient(from 0deg, #1a1a3a, #2a2a5a, #1a1a3a);
  position: relative;
  touch-action: none;
  cursor: grab;
  box-shadow: inset 0 0 20px #000, 0 0 20px rgba(139, 92, 255, 0.35);
}
.crank-arm {
  position: absolute; left: 50%; top: 50%;
  width: 50%; height: 10px;
  background: linear-gradient(90deg, var(--amber), #fff);
  transform-origin: left center;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 192, 43, 0.5);
}
.crank-knob {
  position: absolute; right: -12px; top: -7px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--lime); border: 2px solid #fff;
}

.roulette-wheel {
  width: 140px; height: 140px; border-radius: 50%;
  border: 4px solid #fff;
  background: conic-gradient(
    #ff2bd6 0 36deg, #2bfff2 36deg 72deg, #b8ff2b 72deg 108deg,
    #ffc02b 108deg 144deg, #8b5cff 144deg 180deg, #ff4d6d 180deg 216deg,
    #2bfff2 216deg 252deg, #ff2bd6 252deg 288deg, #b8ff2b 288deg 324deg, #ffc02b 324deg 360deg
  );
  position: relative;
  transition: transform 3.2s cubic-bezier(0.12, 0.75, 0.15, 1);
  box-shadow: 0 0 28px rgba(255, 43, 214, 0.35);
}
.roulette-pointer {
  width: 0; height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 16px solid var(--text);
  margin-bottom: -4px;
  z-index: 2;
}
.roulette-center {
  position: absolute; inset: 40%;
  border-radius: 50%; background: #0a0a1c; border: 2px solid #fff;
}

.stack-arena {
  width: 100%; height: 100%; position: relative;
}
.stack-bar {
  position: absolute; height: 18px; border-radius: 4px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 12px rgba(43, 255, 242, 0.4);
}
.stack-msg {
  position: absolute; inset: auto 0 8px; text-align: center;
  font-size: 0.8rem; color: var(--muted);
}

.rocket-gauge {
  width: min(90%, 260px); height: 16px; border-radius: 999px;
  background: #1a1a30; border: 1px solid var(--card-border); overflow: hidden;
}
.rocket-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--amber), var(--danger));
  transition: width 0.05s linear;
}
.rocket-ship {
  font-size: 2.4rem; transform: translateY(0);
  transition: transform 1.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.rocket-ship.launch { transform: translateY(-120px); }

.scream-meter {
  width: min(90%, 240px); height: 22px; border-radius: 999px;
  background: #1a1a30; overflow: hidden; border: 1px solid var(--card-border);
}
.scream-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--lime), var(--amber), var(--danger));
}
.mic-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); display: inline-block; margin-right: 6px;
}
.mic-dot.live { background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

.leaderboard {
  max-width: 720px; margin: 0 auto 2rem; padding: 0 1.15rem;
}
.leaderboard h2 {
  font-family: var(--display); font-size: 1.25rem; margin: 0 0 0.35rem;
}
.lb-sub { color: var(--muted); margin: 0 0 0.85rem; font-size: 0.9rem; }
.leaderboard ol {
  margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--card-border); border-radius: var(--radius);
  background: rgba(18, 18, 46, 0.8); overflow: hidden;
}
.leaderboard li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(42, 42, 90, 0.6);
  font-size: 0.95rem;
}
.leaderboard li:last-child { border-bottom: 0; }
.leaderboard .rank {
  font-family: var(--display); color: var(--amber); min-width: 1.6rem;
}
.leaderboard .score { color: var(--neon); font-weight: 700; }

.about {
  max-width: 720px; margin: 0 auto 2.5rem; padding: 0 1.15rem;
}
.about h2 { font-family: var(--display); font-size: 1.2rem; }
.about p { color: var(--muted); }
.about .fine { font-size: 0.85rem; }

.site-foot {
  text-align: center; padding: 1.5rem 1rem 2.5rem;
  color: var(--muted); font-size: 0.85rem; border-top: 1px solid rgba(42, 42, 90, 0.5);
}

@media (max-width: 520px) {
  .hero { padding-top: 2.25rem; }
  .card { min-height: 300px; }
  .stage { min-height: 160px; }
}
