/* ================================================================
   DIALED GG SOUND — Design System
   Theme: Neon Arcade (#0f0f1a bg, purple-blue-cyan gradient)
   Fonts: Outfit (display) + IBM Plex Mono (data/numbers)
================================================================ */

/* ── 1. CSS Variables ─────────────────────────────────────────── */
:root {
  /* Colors — Warm Arcade theme (inspired by dialed.gg) */
  --bg-page:      #2A2826;
  --bg-deep:      #0a0a0a;
  --bg-card:      #141414;
  --bg-elevated:  #1e1e1e;
  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.14);
  --border-game:  rgba(255,255,255,0.10);

  --orange:       #942ddc;
  --orange-glow:  rgba(148,45,220,0.30);
  --orange-dim:   rgba(148,45,220,0.12);
  --gold:         #5a3ceb;
  --gold-glow:    rgba(90,60,235,0.25);
  --accent-cyan:  #00dcc8;
  --accent-warm:  #e8734a;

  --text-primary:  #f2f0ed;
  --text-secondary:#a09a90;
  --text-muted:    #6b645a;

  /* Typography */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  /* Spacing / sizes */
  --header-h:     52px;
  --game-max-w:   480px;
  --game-max-h:   min(720px, calc(100dvh - var(--header-h) - 80px));
  --game-radius:  24px;
  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    24px;
  --radius-full:  9999px;

  /* Transitions */
  --ease-out:     cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:       0.13s;
  --t-mid:        0.28s;
  --t-slow:       0.45s;
}

/* Light mode overrides */
[data-theme="light"] {
  --bg-page:      #f0ede8;
  --bg-deep:      #ffffff;
  --bg-card:      #f7f5f2;
  --bg-elevated:  #eae7e2;
  --border:       rgba(0,0,0,0.08);
  --border-strong:rgba(0,0,0,0.15);
  --border-game:  rgba(0,0,0,0.12);
  --text-primary:  #1a1816;
  --text-secondary:#5a5550;
  --text-muted:    #9a9490;
  --orange-glow:  rgba(148,45,220,0.15);
  --orange-dim:   rgba(148,45,220,0.08);
  --gold-glow:    rgba(90,60,235,0.12);
}
[data-theme="light"] body {
  background: var(--bg-page);
  color: var(--text-primary);
}
[data-theme="light"] #site-header {
  background: rgba(240,237,232,0.88);
  border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] #header-nav button {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.10);
  color: var(--text-secondary);
}
[data-theme="light"] #game-area {
  background: #141414;
  border-color: rgba(255,255,255,0.10);
  box-shadow: 0 20px 60px -12px rgba(0,0,0,0.35),
              0 8px 24px -4px rgba(0,0,0,0.20);
}
[data-theme="light"] #game-area,
[data-theme="light"] #game-area * {
  --bg-deep:      #0a0a0a;
  --bg-card:      #141414;
  --bg-elevated:  #1e1e1e;
  --border:       rgba(255,255,255,0.07);
  --border-strong:rgba(255,255,255,0.14);
  --border-game:  rgba(255,255,255,0.10);
  --text-primary:  #f2f0ed;
  --text-secondary:#a09a90;
  --text-muted:    #6b645a;
}
[data-theme="light"] .blob { opacity: 0.35; }
[data-theme="light"] .deco-icon { color: #1a1816; }


/* ── 2. Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  min-height: 100%;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-display);
  overflow-x: hidden;
  position: relative;
}

/* ── Background Decoration Layer ─────────────────────────────── */
#bg-decor {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.7;
}
.blob-1 {
  width: 600px; height: 600px;
  top: -12%; right: -8%;
  background: radial-gradient(circle, rgba(148,45,220,0.40), transparent 70%);
  animation: drift1 18s ease-in-out infinite;
}
.blob-2 {
  width: 550px; height: 550px;
  bottom: -12%; left: -8%;
  background: radial-gradient(circle, rgba(0,180,200,0.30), transparent 70%);
  animation: drift2 22s ease-in-out infinite;
}
.blob-3 {
  width: 400px; height: 400px;
  top: 40%; left: 50%;
  background: radial-gradient(circle, rgba(232,115,74,0.25), transparent 70%);
  animation: drift3 25s ease-in-out infinite;
}
.deco-icon {
  position: absolute;
  font-size: 4rem;
  opacity: 0.08;
  color: #fff;
  animation: float-icon 20s ease-in-out infinite;
}
.deco-wave  { top: 15%; left: 8%;  font-size: 7rem; animation-duration: 16s; }
.deco-note  { top: 20%; right: 12%; font-size: 6rem; animation-delay: -4s; }
.deco-note2 { bottom: 25%; left: 12%; font-size: 4.5rem; animation-delay: -8s; }
.deco-freq  { bottom: 15%; right: 10%; font-size: 8rem; animation-delay: -12s; opacity: 0.05; }

img, svg { display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input { font-family: inherit; }

/* ── 3. Animations ────────────────────────────────────────────── */
@keyframes fadeIn   { from { opacity:0 } to { opacity:1 } }
@keyframes fadeOut  { from { opacity:1 } to { opacity:0 } }
@keyframes scaleIn  { from { transform:scale(0.88); opacity:0 } to { transform:scale(1); opacity:1 } }
@keyframes slideUp  { from { transform:translateY(16px); opacity:0 } to { transform:translateY(0); opacity:1 } }
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--orange-glow), 0 0 18px 2px var(--orange-glow); }
  50%       { box-shadow: 0 0 0 8px transparent, 0 0 28px 8px var(--orange-glow); }
}
@keyframes scoreTick {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-4px); }
  60%  { transform: translateY(1px); }
  100% { transform: translateY(0); }
}
@keyframes slideNumOut {
  0%   { transform: translateY(0); filter: blur(0); opacity: 1; }
  100% { transform: translateY(22%); filter: blur(4px); opacity: 0; }
}
@keyframes slideNumIn {
  0%   { transform: translateY(-22%); filter: blur(4px); opacity: 0; }
  100% { transform: translateY(0); filter: blur(0); opacity: 1; }
}
@keyframes numInFast {
  0%   { transform: translateY(-14%); filter: blur(2px); opacity: 0; }
  100% { transform: translateY(0); filter: blur(0); opacity: 1; }
}
@keyframes ringFlash {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; background: var(--orange); }
}
@keyframes staggerIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.num-out { animation: slideNumOut 0.12s ease-in forwards; display: inline-block; }
.num-in  { animation: slideNumIn 0.15s ease-out forwards; display: inline-block; }
.num-in-fast { animation: numInFast 0.08s ease-out forwards; display: inline-block; }

/* Background blob drift animations */
@keyframes drift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(40px, -60px) scale(1.1); }
  50%      { transform: translate(-30px, 30px) scale(0.95); }
  75%      { transform: translate(60px, 40px) scale(1.05); }
}
@keyframes drift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-50px, -40px) scale(1.08); }
  66%      { transform: translate(40px, -20px) scale(0.92); }
}
@keyframes drift3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  20%      { transform: translate(30px, 50px) scale(1.12); }
  40%      { transform: translate(-40px, -30px) scale(0.9); }
  60%      { transform: translate(50px, -50px) scale(1.05); }
  80%      { transform: translate(-20px, 40px) scale(0.95); }
}
@keyframes float-icon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-20px) rotate(5deg); }
}

/* ── 4. Header ────────────────────────────────────────────────── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(42,40,38,0.85);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#site-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}
#site-logo .logo-accent { color: var(--orange); }
#site-logo .logo-dot    { color: var(--gold); }
#header-nav { display: flex; gap: 8px; }
#header-nav button {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  transition: color var(--t-fast), border-color var(--t-fast), background var(--t-fast);
  font-weight: 600; font-size: 0.9rem;
}
#header-nav button:hover { color: var(--orange); border-color: var(--border-strong); }
#mute-toggle .icon-vol-off { display: none; }
#mute-toggle.muted .icon-vol-on  { display: none; }
#mute-toggle.muted .icon-vol-off { display: block; }

/* Theme toggle — dark mode shows moon, light mode shows sun */
#theme-toggle .icon-sun  { display: none; }
#theme-toggle .icon-moon { display: block; }
[data-theme="light"] #theme-toggle .icon-sun  { display: block; }
[data-theme="light"] #theme-toggle .icon-moon { display: none; }

/* ── 5. Main Layout ───────────────────────────────────────────── */
#layout-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100dvh - var(--header-h));
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}
.ad-slot {
  flex-shrink: 0;
  background: transparent;
}
.ad-left, .ad-right {
  width: 160px;
  height: 600px;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
#game-area {
  flex: 1;
  max-width: var(--game-max-w);
  width: 100%;
  height: var(--game-max-h);
  position: relative;
  overflow: hidden;
  background: #111;
  border-radius: var(--game-radius);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow:
    0 20px 60px -12px rgba(0,0,0,0.6),
    0 8px 24px -4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.05);
}
.ad-bottom {
  width: 100%;
  max-width: 728px;
  height: 90px;
  margin: 8px auto;
}

/* ── 6. Screen Base ───────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) var(--ease-out);
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}
.round-indicator {
  position: absolute;
  top: 16px; left: 18px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ── 7. Intro Screen ──────────────────────────────────────────── */
#intro-screen {
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
  background: var(--bg-deep);
}
.intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#intro-canvas-back { filter: blur(18px); opacity: 0.35; }
#intro-canvas-front { opacity: 0.85; }

#intro-content {
  position: absolute;
  z-index: 2;
  left: 0; right: 0; top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 28px 28px 0;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
#intro-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(4.5rem, 20vw, 6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  margin-top: 4px;
}
#intro-sub {
  font-size: 1.05rem;
  color: #adadad;
  line-height: 1.4;
  font-weight: 400;
  letter-spacing: -0.02em;
  max-width: 360px;
  margin-top: auto;
  margin-bottom: 24px;
}
#intro-sub strong { color: var(--text-primary); }

/* Difficulty toggle */
#difficulty-row { display: flex; align-items: center; gap: 10px; }
.diff-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  transition: border-color var(--t-mid), background var(--t-mid);
  cursor: pointer;
}
.diff-btn:hover { border-color: var(--orange); }
.diff-knob-wrap {
  width: 32px; height: 18px;
  background: var(--orange-dim);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--t-mid);
  border: 1px solid var(--border-strong);
}
.diff-knob {
  width: 12px; height: 12px;
  background: var(--text-muted);
  border-radius: 50%;
  position: absolute;
  top: 2px; left: 2px;
  transition: transform var(--t-mid) var(--ease-spring), background var(--t-mid);
}
.diff-btn.hard .diff-knob-wrap { background: rgba(251,191,36,0.15); border-color: var(--gold); }
.diff-btn.hard .diff-knob { transform: translateX(14px); background: var(--gold); }
#diff-label-text {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
  min-width: 28px;
}

/* Mode buttons — circular icon style */
#mode-label {
  font-size: 1.15rem; font-weight: 500;
  letter-spacing: -0.02em; color: var(--text-primary);
  margin-bottom: 12px;
}
#mode-buttons {
  display: flex; gap: 16px; align-items: center;
  margin-bottom: 16px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px));
}
.mode-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
  transition: transform 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.mode-btn svg { width: 28px; height: 28px; }
.mode-btn:active { transform: scale(0.94); }
@media (hover: hover) { .mode-btn:hover { transform: scale(1.04); } }
#btn-solo { background: var(--text-primary); color: var(--bg-deep); }
.mode-btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.2) !important;
}
.mode-btn-outline:hover { border-color: var(--text-primary) !important; }

/* How it works — 3-step flow */
#how-it-works {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  margin-bottom: 8px;
}
.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.how-icon { font-size: 1.4rem; }
.how-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
  max-width: 80px;
}
.how-arrow {
  font-size: 1rem;
  color: var(--text-muted);
  opacity: 0.5;
  margin-top: -16px;
}


/* ── 8. Transition Screen (Ring Charge) ───────────────────────── */
#transition-screen { background: var(--bg-deep); }
#ring-wrap {
  position: relative;
  width: 180px; height: 180px;
  display: flex; align-items: center; justify-content: center;
}
#ring-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#ring-center {
  display: flex; flex-direction: column; align-items: center;
  z-index: 2;
}
#ring-round-label {
  font-family: var(--font-mono);
  font-size: 0.6rem; font-weight: 600;
  letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--text-muted);
}
#ring-round-num {
  font-family: var(--font-display);
  font-size: 4rem; font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

/* ── 9. Play Screen ───────────────────────────────────────────── */
#play-screen {
  touch-action: none;
  cursor: default;
  background: var(--bg-deep);
}
#play-screen.tuning { cursor: ns-resize; }
.play-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
#play-canvas-back { filter: blur(18px); opacity: 0.45; }
#play-canvas-front { opacity: 0.92; }

/* Timer block */
#timer-block {
  position: absolute;
  top: 12px; right: 18px;
  display: flex; align-items: baseline; gap: 1px;
  font-family: var(--font-mono);
  pointer-events: none;
}
#timer-int {
  font-size: clamp(5rem, 20vw, 6rem);
  font-weight: 500; color: var(--text-primary);
  line-height: 1;
  display: inline-block;
}
#timer-dec {
  font-size: clamp(2rem, 8vw, 2.8rem);
  font-weight: 400; color: var(--text-secondary);
  opacity: 0.52;
  display: inline-block;
}
#timer-unit {
  position: absolute; bottom: -14px; right: 0;
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted);
}

/* Hz display */
#hz-display {
  position: absolute; bottom: 28px; left: 22px;
  display: flex; align-items: baseline; gap: 4px;
  opacity: 0; z-index: 10;
  transition: opacity var(--t-mid);
}
#hz-display.visible { opacity: 1; }
#hz-num {
  font-family: var(--font-display);
  font-size: clamp(3.5rem, 14vw, 4.5rem);
  font-weight: 500; color: var(--orange);
  line-height: 1;
  letter-spacing: -0.03em;
}
#hz-unit {
  font-family: var(--font-mono);
  font-size: 1rem; color: var(--text-muted);
  align-self: flex-end; padding-bottom: 4px;
}

/* Drag hint */
#drag-hint {
  position: absolute; right: 22px; top: 50%;
  transform: translateY(-50%); z-index: 10;
  color: var(--text-muted); opacity: 0;
  transition: opacity var(--t-slow);
}
#drag-hint.visible { opacity: 0.5; }

/* Submit / Next circle button */
.circle-btn {
  position: absolute; bottom: 28px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-deep);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, opacity var(--t-mid);
  opacity: 0; pointer-events: none;
  z-index: 10;
  cursor: pointer;
}
.circle-btn.visible { opacity: 1; pointer-events: all; }
.circle-btn:hover { transform: scale(1.04); }
.circle-btn:active { transform: scale(0.96); }

/* ── 10. Result Screen ────────────────────────────────────────── */
#result-screen { background: var(--bg-deep); }
.result-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
#result-canvas-back { filter: blur(16px); opacity: 0.3; }

#result-score-block {
  position: absolute; right: 24px; top: 24px;
  font-family: var(--font-display); font-weight: 500;
  display: flex; align-items: baseline;
}
.score-int {
  font-size: clamp(5rem, 20vw, 6rem); line-height: 1;
  color: var(--text-primary);
  display: inline-block;
}
.score-dot { font-size: clamp(2rem, 8vw, 3rem); color: var(--text-muted); }
.score-dec {
  font-size: clamp(2rem, 8vw, 3rem);
  color: var(--text-secondary); opacity: 0.52;
  display: inline-block;
}
.score-denom { font-size: 1rem; color: var(--text-muted); margin-left: 4px; }

#result-feedback {
  position: absolute; right: 24px;
  top: calc(24px + clamp(5rem, 20vw, 6rem) + 6px);
  font-size: 1.1rem; font-weight: 400;
  color: var(--text-secondary);
  text-align: right; max-width: min(280px, 55vw);
  line-height: 1.3; letter-spacing: -0.02em;
}
#result-freqs {
  position: absolute; bottom: 28px; left: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.freq-row { display: flex; flex-direction: column; gap: 2px; }
.freq-lbl {
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted);
}
.freq-val {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 500; color: var(--text-primary);
  letter-spacing: -0.03em; line-height: 1;
}
#freq-target { opacity: 0.45; }
#freq-yours .freq-val { color: var(--orange); }
.freq-unit {
  font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--text-muted); margin-left: 4px;
  display: inline;
}

/* ── 11. Total Screen ─────────────────────────────────────────── */
#total-screen { justify-content: flex-start; overflow: hidden; }
#total-close {
  position: absolute; top: 14px; right: 14px;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); z-index: 5;
  transition: color var(--t-fast), border-color var(--t-fast);
}
#total-close:hover { color: var(--orange); border-color: var(--border-strong); }

#total-scroll {
  width: 100%; height: 100%;
  overflow-y: auto; padding: 52px 22px 32px;
  display: flex; flex-direction: column; gap: 20px;
  -webkit-overflow-scrolling: touch;
}
#total-score-block {
  display: flex; align-items: baseline; flex-wrap: wrap;
  font-family: var(--font-mono); font-weight: 600;
  animation: scaleIn 0.5s var(--ease-spring) both;
}
#total-desc {
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5;
  border-left: 2px solid var(--orange); padding-left: 12px;
  animation: slideUp 0.4s 0.3s var(--ease-out) both;
}

#total-rounds-row {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.round-chip {
  display: flex; flex-direction: column; align-items: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px; gap: 2px;
  animation: staggerIn 0.35s var(--ease-out) both;
}
.round-chip-label {
  font-family: var(--font-mono); font-size: 0.58rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted);
}
.round-chip-score {
  font-family: var(--font-mono); font-size: 1.2rem;
  font-weight: 600; color: var(--orange);
}

/* Nickname input */
#nickname-block { display: flex; flex-direction: column; gap: 6px; }
#nickname-label {
  font-size: 0.75rem; color: var(--text-muted);
  letter-spacing: 0.04em;
}
#nickname-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary); font-size: 0.97rem;
  outline: none;
  transition: border-color var(--t-mid), box-shadow var(--t-mid);
}
#nickname-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-dim);
}
#nickname-input::placeholder { color: var(--text-muted); }

/* Nickname shake animation */
@keyframes nicknameShake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-6px); }
  30%      { transform: translateX(5px); }
  45%      { transform: translateX(-4px); }
  60%      { transform: translateX(3px); }
  75%      { transform: translateX(-2px); }
}
.nickname-shake { animation: nicknameShake 0.5s ease-out; }

/* Share button brand colors */
#share-whatsapp { color: #25D366; border-color: rgba(37,211,102,0.25); }
#share-whatsapp:hover { border-color: #25D366; }
#share-facebook { color: #1877F2; border-color: rgba(24,119,242,0.25); }
#share-facebook:hover { border-color: #1877F2; }
#share-telegram { color: #26A5E4; border-color: rgba(38,165,228,0.25); }
#share-telegram:hover { border-color: #26A5E4; }

/* Total action buttons */
#total-actions { display: flex; gap: 10px; }
.action-btn {
  flex: 1; padding: 13px 16px;
  border-radius: var(--radius-md);
  font-size: 0.92rem; font-weight: 600;
  transition: transform var(--t-fast) var(--ease-spring), box-shadow var(--t-mid), opacity var(--t-mid);
}
.action-btn:active { transform: scale(0.96); }
.primary-action {
  background: var(--orange); color: #1a0a00;
  box-shadow: 0 2px 16px 0 var(--orange-glow);
}
.secondary-action {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; gap: 6px; justify-content: center;
}
.secondary-action:hover { border-color: var(--orange); color: var(--orange); }
.action-btn:disabled, .action-btn[disabled] { opacity: 0.38; pointer-events: none; }

/* Social share row */
#share-row { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
  flex: 1; padding: 11px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.share-btn:hover { border-color: var(--orange); color: var(--orange); }
.share-btn:active { transform: scale(0.94); }
#share-reddit { color: #ff4500; border-color: rgba(255,69,0,0.25); }
#share-reddit:hover { border-color: #ff4500; }
#copy-feedback {
  font-size: 0.78rem; color: var(--gold); min-height: 18px;
  font-family: var(--font-mono);
  animation: fadeIn 0.2s;
}

/* ── 12. Challenge Intro Screen ───────────────────────────────── */
#challenge-intro-screen { background: var(--bg-card); }
#ci-content {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  text-align: center; padding: 32px;
}
#ci-challenger {
  font-size: 1.6rem; font-weight: 700; color: var(--text-primary);
}
#ci-name { color: var(--orange); }
#ci-score { font-family: var(--font-mono); font-size: 1rem; color: var(--text-secondary); }
#ci-score strong { color: var(--gold); }
#ci-sub { font-size: 0.9rem; color: var(--text-muted); }
#ci-go-btn { margin-top: 8px; }

/* ── 13. Help Modal ───────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}
#help-modal {
  position: fixed; z-index: 201;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--game-max-w);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 24px 40px;
  animation: slideUp 0.32s var(--ease-out) both;
}
#help-modal h2 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 16px;
  color: var(--text-primary);
}
#help-modal ol {
  list-style: decimal; padding-left: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
#help-modal li { font-size: 0.93rem; color: var(--text-secondary); line-height: 1.5; }
#help-modal strong { color: var(--text-primary); }
#help-modal p { margin-top: 14px; font-size: 0.85rem; color: var(--text-muted); }
#help-close {
  position: absolute; top: 14px; right: 14px;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); background: var(--bg-card);
}

/* ── 14. SEO Content ──────────────────────────────────────────── */
#seo-content {
  max-width: 720px; margin: 0 auto;
  padding: 48px 20px 80px;
  display: flex; flex-direction: column; gap: 40px;
}

/* ── 15. Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .ad-left, .ad-right { display: none; }
  #game-area {
    max-width: 100%;
    border-radius: var(--game-radius);
  }
  #layout-wrapper { padding: 24px 16px; }
}

@media (max-width: 480px) {
  :root {
    --header-h: 48px;
    --game-max-h: calc(100dvh - var(--header-h) - 16px);
    --game-radius: 16px;
  }
  #layout-wrapper { padding: 8px; }
  #site-header { padding: 0 16px; }
  #site-logo { font-size: 0.92rem; }
  #header-nav button { width: 32px; height: 32px; font-size: 0.8rem; }
  .blob { opacity: 0.3; }
  .deco-icon { display: none; }

  /* Intro */
  #intro-content { padding: 20px 20px 0; }
  #intro-title { font-size: clamp(2.8rem, 16vw, 4rem); }
  #intro-sub { font-size: 0.95rem; margin-bottom: 18px; }
  #mode-label { font-size: 1rem; margin-bottom: 10px; }
  #mode-buttons { gap: 12px; margin-bottom: 12px; }
  .mode-btn { width: 54px; height: 54px; }
  .mode-btn svg { width: 24px; height: 24px; }
  .diff-btn { padding: 5px 10px 5px 6px; }
  #diff-label-text { font-size: 0.7rem; }
  #intro-footer { padding: 14px 0 calc(16px + env(safe-area-inset-bottom, 0px)); font-size: 0.6rem; }

  /* Play */
  #timer-block { top: 8px; right: 14px; }
  #timer-int { font-size: clamp(3.5rem, 16vw, 5rem); }
  #timer-dec { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  #hz-display { bottom: 20px; left: 16px; }
  #hz-num { font-size: clamp(2.5rem, 12vw, 3.5rem); }
  .circle-btn { width: 48px; height: 48px; bottom: 20px; right: 16px; }
  #drag-hint { right: 16px; }

  /* Result */
  #result-score-block { right: 16px; top: 16px; }
  .score-int { font-size: clamp(3.5rem, 16vw, 5rem); }
  #result-feedback { right: 16px; font-size: 0.95rem; max-width: min(240px, 50vw); }
  #result-freqs { bottom: 20px; left: 16px; }
  .freq-val { font-size: clamp(2rem, 10vw, 3rem); }

  /* Total */
  #total-scroll { padding: 42px 16px 24px; gap: 16px; }
  .round-chip { padding: 8px 10px; }
  .action-btn { padding: 11px 12px; font-size: 0.85rem; }
  #help-modal { padding: 20px 16px 32px; }
  .ad-bottom { height: 60px; }
}

/* Extra small screens (height ≤ 600px) */
@media (max-height: 600px) {
  #intro-title { font-size: clamp(2.2rem, 14vw, 3.5rem); margin-top: 0; }
  #intro-sub { font-size: 0.88rem; margin-bottom: 12px; }
  #mode-label { font-size: 0.95rem; margin-bottom: 8px; }
  .mode-btn { width: 48px; height: 48px; }
  .mode-btn svg { width: 22px; height: 22px; }
  #intro-footer { padding: 10px 0 calc(12px + env(safe-area-inset-bottom, 0px)); }
  #ring-wrap { width: 140px; height: 140px; }
  #ring-round-num { font-size: 3rem; }
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  #game-area { padding-bottom: env(safe-area-inset-bottom); }
}



/* ── SEO Content Styles (Card-based) ─────────────────────────── */
#seo-content {
  max-width: 780px;
  margin: 60px auto 0;
  padding: 0 24px 40px;
  display: flex; flex-direction: column; gap: 28px;
}
.seo-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-warm);
  border-radius: 12px;
  padding: 28px 28px 24px;
  position: relative;
}
.seo-section:nth-child(2n) { border-left-color: var(--purple); }
.seo-section:nth-child(3n) { border-left-color: #22c55e; }
.seo-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.seo-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(232,115,74,0.12); color: var(--accent-warm);
  flex-shrink: 0; font-size: 1.1rem;
}
.seo-section:nth-child(2n) .seo-icon { background: rgba(148,45,220,0.12); color: var(--purple); }
.seo-section:nth-child(3n) .seo-icon { background: rgba(34,197,94,0.12); color: #22c55e; }
.seo-section h2 {
  font-family: var(--font-display);
  font-size: 1.18rem; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em; margin: 0;
}
.seo-section p, .seo-section li, .seo-section dd {
  font-size: 0.92rem; color: var(--text-secondary);
  line-height: 1.75; margin-bottom: 8px;
}
.seo-section strong { color: var(--text-primary); font-weight: 600; }
.seo-section ol, .seo-section ul {
  padding-left: 20px; display: flex; flex-direction: column; gap: 6px;
}
.seo-section dl { display: flex; flex-direction: column; gap: 16px; }
.seo-section dt {
  font-weight: 700; color: var(--orange); font-size: 0.95rem; margin-bottom: 4px;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.seo-section dt::before {
  content: '▸'; font-size: 0.8em; color: var(--text-muted);
  transition: transform 0.2s;
}
.seo-section dd { margin-left: 0; }
mark.kw {
  background: none; color: var(--accent-warm); font-weight: 600;
  border-bottom: 2px solid rgba(232,115,74,0.35);
  padding: 0 1px;
}
mark.kw-alt {
  background: none; color: var(--purple); font-weight: 600;
  border-bottom: 2px solid rgba(148,45,220,0.3);
  padding: 0 1px;
}

/* ── Footer ──────────────────────────────────────────────────── */
#site-footer {
  background: #141418;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 48px 32px 24px;
  margin-top: 40px;
}
.footer-inner {
  max-width: 780px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; flex-wrap: wrap;
}
.footer-logo {
  font-family: var(--font-display); font-size: 1.1rem;
  font-weight: 700; color: #f2f0ed;
  text-decoration: none; letter-spacing: -0.03em;
}
.footer-logo .logo-accent { color: var(--orange); }
.footer-logo .logo-dot { color: var(--text-muted); }
.footer-tagline {
  font-size: 0.82rem; color: rgba(255,255,255,0.45);
  margin-top: 6px;
}
.footer-nav {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.footer-nav a {
  font-size: 0.88rem; color: rgba(255,255,255,0.55);
  text-decoration: none; transition: color 0.2s;
}
.footer-nav a:hover { color: var(--orange); }
.footer-bottom {
  max-width: 780px; margin: 32px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  font-size: 0.75rem; color: rgba(255,255,255,0.3);
}

