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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --green: #3fb950;
  --purple: #bc8cff;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  overflow-x: hidden;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--purple);
}

/* ── Nav ── */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(13, 17, 23, 0.8);
  border-bottom: 1px solid var(--border);
}

nav {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  color: var(--text);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--text);
}

/* ── Hero ── */

.hero {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 5rem 1rem 2rem;
  position: relative;
}

.hero h1 {
  font-size: clamp(1.6rem, 5vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 50%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 300;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}

/* ── Game ── */

.game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.game-hud {
  display: flex;
  gap: 2rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.hud-item span {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#game {
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  touch-action: none;
  max-width: 100%;
}

.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.85);
  border-radius: 6px;
  cursor: pointer;
  z-index: 10;
  transition: opacity 0.25s;
  margin-top: calc(0.7rem + 1.3em + 0.75rem);
}

.game-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.overlay-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text);
}

.overlay-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* ── EQ Bars (in overlay) ── */

.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 28px;
}

.eq-bars span {
  width: 3px;
  background: var(--accent);
  border-radius: 1.5px;
  animation: eq 1.2s ease-in-out infinite;
  opacity: 0.6;
}

.eq-bars span:nth-child(1) { height: 8px;  animation-delay: 0.0s; }
.eq-bars span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.eq-bars span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.eq-bars span:nth-child(4) { height: 12px; animation-delay: 0.3s; }
.eq-bars span:nth-child(5) { height: 28px; animation-delay: 0.15s; }
.eq-bars span:nth-child(6) { height: 20px; animation-delay: 0.25s; }
.eq-bars span:nth-child(7) { height: 14px; animation-delay: 0.35s; }
.eq-bars span:nth-child(8) { height: 26px; animation-delay: 0.05s; }
.eq-bars span:nth-child(9) { height: 10px; animation-delay: 0.2s; }

@keyframes eq {
  0%, 100% { transform: scaleY(0.3); }
  50%      { transform: scaleY(1); }
}

/* ── D-Pad Controls (mobile) ── */

.game-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: 0.25rem;
}

.ctrl-row {
  display: flex;
  gap: 4px;
}

.ctrl-btn {
  width: 52px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: background 0.1s, border-color 0.1s;
}

.ctrl-btn:active {
  background: var(--border);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Sections ── */

.section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 5rem 1.5rem;
}

.section h2 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── Cards ── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.card:hover {
  border-color: var(--text-muted);
}

.card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

/* ── Footer ── */

footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */

@media (max-width: 600px) {
  .nav-links {
    gap: 1rem;
  }

  .game-controls {
    display: flex;
  }

  .hero {
    padding-top: 4rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .game-controls {
    display: flex;
  }
}
