/* ============================================================================
   SONAFLOW — Neon Rhythm Arcade Design System
   Deep Obsidian · Electric Cyan · Hot Magenta · Vivid Violet · Solar Gold
   ============================================================================ */

:root {
  --bg-deep: #060914;
  --bg-surface: rgba(14, 21, 42, 0.78);
  --bg-surface-strong: rgba(16, 24, 48, 0.94);
  --border-glass: rgba(148, 163, 184, 0.16);
  --border-bright: rgba(0, 245, 212, 0.38);

  --text-main: #f8fafc;
  --text-dim: #94a3b8;
  --text-muted: #64748b;

  --cyan: #00f5d4;
  --violet: #a855f7;
  --magenta: #ff2e93;
  --gold: #ffb703;
  --lime: #38ef7d;
  --danger: #fb7185;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --font-body: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Be Vietnam Pro", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient cosmic neon aurora behind everything */
.bg-ambient-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 14% 12%, rgba(0, 245, 212, 0.11), transparent 40%),
    radial-gradient(circle at 86% 18%, rgba(168, 85, 247, 0.13), transparent 44%),
    radial-gradient(circle at 50% 92%, rgba(255, 46, 147, 0.09), transparent 42%);
  transition: opacity 0.4s ease;
}

body.fever-active .bg-ambient-glow {
  background:
    radial-gradient(circle at 18% 15%, rgba(255, 183, 3, 0.2), transparent 42%),
    radial-gradient(circle at 82% 20%, rgba(255, 46, 147, 0.22), transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(0, 245, 212, 0.15), transparent 45%);
}

body.focus-mode.in-gameplay .topbar {
  display: none;
}

/* ============================================================================
   TOP NAVIGATION BAR
   ============================================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 22px;
  background: rgba(7, 10, 22, 0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-glass);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--cyan), var(--violet) 60%, var(--magenta));
  display: grid;
  place-items: center;
  box-shadow: 0 0 18px rgba(0, 245, 212, 0.42);
  position: relative;
}

.logo-wave {
  width: 20px;
  height: 18px;
  border-radius: 4px;
  background:
    linear-gradient(#060914, #060914) 0 50%/3px 9px no-repeat,
    linear-gradient(#060914, #060914) 5.5px 50%/3px 16px no-repeat,
    linear-gradient(#060914, #060914) 11px 50%/3px 12px no-repeat,
    linear-gradient(#060914, #060914) 16.5px 50%/3px 7px no-repeat;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sub {
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.72);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-glass);
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.nav-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  color: #060914;
  background: linear-gradient(135deg, var(--cyan), #38bdf8);
  box-shadow: 0 0 16px rgba(0, 245, 212, 0.35);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-chip {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 5px 10px;
  min-width: 118px;
}

.profile-chip-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  margin-bottom: 4px;
}

.lvl-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--cyan);
}

.lvl-title {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 138px;
}

.hdr-xp-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.hdr-xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  transition: width 0.35s ease;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.stat-pill.gold {
  color: var(--gold);
  border-color: rgba(255, 183, 3, 0.3);
}

/* Segmented VI / EN Bilingual Switcher */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-glass);
  gap: 2px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.16s ease;
  letter-spacing: 0.04em;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn.active {
  background: linear-gradient(135deg, var(--cyan), #38bdf8);
  color: #060914;
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.38);
}

.mic-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.16);
  color: #e9d5ff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.mic-pill:hover {
  background: rgba(168, 85, 247, 0.28);
  transform: translateY(-1px);
}

.mic-pill.mic-live {
  border-color: var(--cyan);
  background: rgba(0, 245, 212, 0.16);
  color: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 245, 212, 0.28);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulseDot 1.2s infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.5; }
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border-glass);
  background: rgba(15, 23, 42, 0.78);
  color: var(--text-main);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  transition: all 0.18s ease;
}

.icon-btn:hover {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(30, 41, 59, 0.9);
}

.icon-btn.is-on {
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 245, 212, 0.35);
}

/* ============================================================================
   MAIN CONTAINER & COMMON UI PRIMITIVES
   ============================================================================ */
.app-main {
  position: relative;
  z-index: 2;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 22px 44px;
}

.glass-card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.45);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.card-head-tight {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.card-title-sm {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
}

.card-sub, .muted-sm {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.84rem;
  line-height: 1.45;
}

.muted-xs {
  color: var(--text-muted);
  font-size: 0.76rem;
}

.mono-tag {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--cyan);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #38bdf8);
  color: #04101a;
  box-shadow: 0 0 22px rgba(0, 245, 212, 0.34);
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 26px rgba(0, 245, 212, 0.48);
}

.btn-secondary {
  background: rgba(168, 85, 247, 0.18);
  border-color: rgba(168, 85, 247, 0.5);
  color: #f3e8ff;
}
.btn-secondary:hover {
  background: rgba(168, 85, 247, 0.3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: rgba(15, 23, 42, 0.65);
  border-color: var(--border-glass);
  color: var(--text-dim);
}
.btn-ghost:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}
.btn-ghost.active-toggle {
  border-color: rgba(0, 245, 212, 0.5);
  color: var(--cyan);
}

.btn-danger {
  background: rgba(251, 113, 133, 0.18);
  border-color: rgba(251, 113, 133, 0.5);
  color: #ffe4e6;
}
.btn-danger:hover { background: rgba(251, 113, 133, 0.3); }

.btn-lg { padding: 12px 20px; font-size: 0.94rem; }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-xs { padding: 5px 10px; font-size: 0.76rem; border-radius: 8px; }
.btn-full { width: 100%; }

.hidden { display: none !important; }

/* Badges & Pills */
.badge-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 99px;
  background: rgba(0, 245, 212, 0.14);
  border: 1px solid rgba(0, 245, 212, 0.35);
  color: var(--cyan);
}

.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
}
.pill-chip.cyan { color: var(--cyan); border-color: rgba(0, 245, 212, 0.4); }
.pill-chip.violet { color: #d8b4fe; border-color: rgba(168, 85, 247, 0.45); }
.pill-chip.magenta { color: #fda4af; border-color: rgba(255, 46, 147, 0.45); }
.pill-chip.gold { color: var(--gold); border-color: rgba(255, 183, 3, 0.45); }
.pill-chip.lime { color: var(--lime); border-color: rgba(56, 239, 125, 0.45); }

/* ============================================================================
   DASHBOARD & CAMPAIGN ROADMAP
   ============================================================================ */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 20px;
}

.hero-grid > *,
.stages-grid > *,
.studio-top-grid > *,
.interval-arena-grid > *,
.chord-arena-grid > *,
.guide-two-col > * {
  min-width: 0;
}

.hero-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(14, 22, 46, 0.9), rgba(20, 14, 44, 0.85));
  border-color: rgba(0, 245, 212, 0.22);
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cyan);
  background: rgba(0, 245, 212, 0.12);
  border: 1px solid rgba(0, 245, 212, 0.35);
  padding: 5px 11px;
  border-radius: 99px;
  margin-bottom: 12px;
}

.hero-title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 2.7vw, 2.25rem);
  font-weight: 800;
  line-height: 1.18;
}

.grad-text {
  background: linear-gradient(90deg, var(--cyan), #38bdf8 45%, var(--magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.58;
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.hero-quick-stats {
  display: flex;
  gap: 24px;
  padding-top: 14px;
  border-top: 1px solid var(--border-glass);
}

.qstat span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.qstat strong {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--text-main);
}

.radar-card {
  display: flex;
  flex-direction: column;
}

.radar-canvas-box {
  flex: 1;
  min-height: 220px;
  position: relative;
}

.radar-canvas-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Campaign Tiers */
.section-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
}

.section-sub {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.86rem;
}

.switch-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-glass);
  padding: 7px 12px;
  border-radius: 10px;
}

.tiers-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tier-block {
  background: rgba(11, 17, 34, 0.74);
  border: 1px solid var(--border-glass);
  border-left: 4px solid var(--tier-color, var(--cyan));
  border-radius: var(--radius-lg);
  padding: 18px;
}

.tier-block.is-locked {
  opacity: 0.62;
}

.tier-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tier-title {
  font-family: var(--font-display);
  font-size: 0.96rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--tier-color, var(--cyan));
}

.tier-sub {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.badge-unlocked {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--lime);
  background: rgba(56, 239, 125, 0.12);
  border: 1px solid rgba(56, 239, 125, 0.35);
  padding: 4px 10px;
  border-radius: 99px;
}

.badge-locked {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold);
  background: rgba(255, 183, 3, 0.12);
  border: 1px solid rgba(255, 183, 3, 0.3);
  padding: 4px 10px;
  border-radius: 99px;
}

.stages-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.stage-card {
  text-align: left;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 15px;
  color: var(--text-main);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.stage-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--cyan));
  opacity: 0.85;
}

.stage-card:not(.disabled):hover {
  transform: translateY(-3px);
  border-color: var(--card-accent, var(--cyan));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45), 0 0 18px color-mix(in srgb, var(--card-accent, #00f5d4) 24%, transparent);
}

.stage-card.disabled {
  cursor: not-allowed;
}

.stage-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
}

.stage-mode-tag {
  font-weight: 700;
  color: var(--card-accent, var(--cyan));
}

.stage-diff {
  color: var(--text-muted);
  font-weight: 600;
}

.stage-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.04rem;
  font-weight: 700;
}

.stage-desc {
  margin: 0;
  font-size: 0.81rem;
  color: var(--text-dim);
  line-height: 1.4;
  flex: 1;
}

.stage-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.stage-stars {
  display: flex;
  gap: 2px;
  font-size: 1rem;
}

.star { color: rgba(148, 163, 184, 0.25); }
.star.lit { color: var(--gold); text-shadow: 0 0 10px rgba(255, 183, 3, 0.7); }

.stage-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================================
   ARCADE QUICK PLAY VIEW
   ============================================================================ */
.arcade-modes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.arcade-mode-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 3px solid var(--card-accent, var(--cyan));
}

.arcade-mode-icon { font-size: 1.9rem; }
.arcade-mode-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--card-accent, var(--cyan));
}
.arcade-mode-vn { font-weight: 700; font-size: 0.9rem; }
.arcade-mode-desc { margin: 0; font-size: 0.83rem; color: var(--text-dim); line-height: 1.45; }
.arcade-controls-note {
  font-size: 0.76rem;
  color: var(--text-muted);
  background: rgba(15, 23, 42, 0.7);
  padding: 7px 10px;
  border-radius: 8px;
}
.arcade-preset-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.arcade-launch-btn {
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  white-space: normal;
  text-align: left;
}

/* ============================================================================
   GAMEPLAY UNIFIED HUD & STAGE SHELL
   ============================================================================ */
.gameplay-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gameplay-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(10, 15, 32, 0.92);
  border: 1px solid var(--border-glass);
  border-radius: 15px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

body.fever-active .gameplay-hud {
  border-color: var(--gold);
  box-shadow: 0 0 28px rgba(255, 183, 3, 0.32);
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hud-stage-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.96rem;
}

.hud-status-text {
  font-size: 0.78rem;
  color: var(--cyan);
}

.hud-center {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hud-stat, .hud-combo-box {
  text-align: center;
}

.hud-lbl {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.hud-val {
  font-size: 1.25rem;
  font-weight: 800;
}

.hud-val.mono { font-family: var(--font-mono); }

.hud-combo-val {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(0, 245, 212, 0.5);
}

.hud-combo-box.pop {
  animation: comboPop 0.22s ease;
}

@keyframes comboPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.26); }
  100% { transform: scale(1); }
}

.hud-mult-val {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--violet);
}

.hud-mult-val.is-fever {
  color: var(--gold);
  text-shadow: 0 0 14px rgba(255, 183, 3, 0.8);
}

.hud-progress-track {
  position: relative;
  height: 10px;
  border-radius: 99px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-glass);
  overflow: hidden;
}

.hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mode-accent, var(--cyan)), var(--magenta));
  box-shadow: 0 0 14px var(--mode-accent, var(--cyan));
  transition: width 0.2s ease;
}

.hud-fever-banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #060914;
  background: linear-gradient(90deg, var(--gold), #ff2e93, var(--cyan), var(--gold));
  background-size: 200% 100%;
  animation: feverSlide 1.8s linear infinite;
}

@keyframes feverSlide {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.game-stage-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.canvas-stage-wrap {
  position: relative;
  width: 100%;
  height: 330px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #070a18;
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.65);
}

.rhythm-canvas-wrap { height: 290px; }

.game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.floating-cents-hud {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 99px;
  background: rgba(7, 10, 24, 0.85);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(8px);
}

.mini-cents-bar {
  position: relative;
  width: 96px;
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.22);
}

.mini-cents-center {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--cyan);
  transform: translateX(-50%);
}

.mini-cents-dot {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cyan);
  transform: translate(-50%, -50%);
  transition: left 0.06s linear;
  box-shadow: 0 0 10px currentColor;
}

/* Interval & Chord Split Arenas */
.interval-arena-grid, .chord-arena-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 14px;
}

.interval-radar-wrap, .chord-core-wrap {
  height: 270px;
}

.radar-prompt-pill {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border-radius: 99px;
  background: rgba(7, 10, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 0.84rem;
  font-weight: 600;
  white-space: nowrap;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.interval-staff-box {
  min-height: 138px;
  display: grid;
  place-items: center;
  background: rgba(7, 10, 22, 0.72);
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  margin-bottom: 10px;
  padding: 6px;
}

.staff-mystery {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
  padding: 16px;
}

.mnemonic-box {
  font-size: 0.82rem;
  line-height: 1.48;
  color: var(--text-dim);
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
}

/* Choices Grid (Intervals & Chord Ear) */
.choices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
}

.interval-choice-btn, .chord-choice-btn {
  position: relative;
  text-align: left;
  padding: 12px 14px;
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.interval-choice-btn:hover, .chord-choice-btn:hover {
  border-color: var(--choice-accent, var(--cyan));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.interval-choice-btn.is-correct, .chord-choice-btn.is-correct {
  border-color: var(--lime);
  background: rgba(56, 239, 125, 0.18);
  box-shadow: 0 0 20px rgba(56, 239, 125, 0.35);
}

.interval-choice-btn.is-wrong, .chord-choice-btn.is-wrong {
  border-color: var(--danger);
  background: rgba(251, 113, 133, 0.18);
}

.choice-hotkey {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 5px;
}

.choice-code {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--choice-accent, var(--cyan));
}
.choice-code small { font-size: 0.74rem; color: var(--text-muted); }
.choice-name { font-size: 0.82rem; font-weight: 700; }
.choice-sub { font-size: 0.73rem; color: var(--text-dim); }

/* Rhythm Hit Pad */
.rhythm-pad-bar {
  display: flex;
  justify-content: center;
}

.rhythm-hit-pad {
  width: 100%;
  max-width: 640px;
  padding: 20px 24px;
  border-radius: 16px;
  border: 2px solid rgba(56, 239, 125, 0.55);
  background: linear-gradient(180deg, rgba(56, 239, 125, 0.16), rgba(15, 23, 42, 0.92));
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: 0 0 24px rgba(56, 239, 125, 0.22);
  transition: transform 0.06s ease, box-shadow 0.08s ease;
}

.rhythm-hit-pad.is-pressed, .rhythm-hit-pad:active {
  transform: scale(0.975);
  background: linear-gradient(180deg, rgba(56, 239, 125, 0.36), rgba(0, 245, 212, 0.22));
  box-shadow: 0 0 36px rgba(56, 239, 125, 0.58);
}

.pad-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.pad-sub { font-size: 0.8rem; color: var(--text-dim); }

/* ============================================================================
   INTERACTIVE NEON PIANO WIDGET
   ============================================================================ */
.stage-bottom-piano {
  background: rgba(11, 16, 34, 0.86);
  border: 1px solid var(--border-glass);
  border-radius: 16px;
  padding: 12px 14px 14px;
}

.piano-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.neon-piano {
  position: relative;
  width: 100%;
  height: 138px;
  user-select: none;
  touch-action: none;
}

.piano-whites {
  display: flex;
  width: 100%;
  height: 100%;
  gap: 3px;
}

.piano-blacks {
  position: absolute;
  inset: 0 0 38% 0;
  pointer-events: none;
}

.piano-key {
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8px;
  gap: 2px;
  font-family: var(--font-body);
  transition: transform 0.05s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.white-key {
  flex: 1;
  background: linear-gradient(180deg, #e2e8f0, #f8fafc 75%, #cbd5e1);
  color: #0f172a;
  border-radius: 0 0 9px 9px;
  box-shadow: inset 0 -4px 0 rgba(15, 23, 42, 0.18);
}

.white-key:hover {
  background: linear-gradient(180deg, #ffffff, #e0f2fe);
}

.black-key {
  position: absolute;
  top: 0;
  height: 100%;
  pointer-events: auto;
  background: linear-gradient(180deg, #1e293b, #090d1b 85%);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-top: none;
  border-radius: 0 0 7px 7px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55);
  z-index: 5;
  padding-bottom: 6px;
}

.black-key:hover {
  background: linear-gradient(180deg, #334155, #0f172a);
}

.pk-kb {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 700;
  opacity: 0.55;
  margin-bottom: auto;
  margin-top: 6px;
}

.pk-name {
  font-size: 0.78rem;
  font-weight: 800;
}

.black-key .pk-name { font-size: 0.64rem; }

.pk-sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  opacity: 0.68;
}

.piano-key.is-active {
  transform: translateY(2px);
  background: linear-gradient(180deg, var(--cyan), #0ea5e9) !important;
  color: #04101a !important;
  box-shadow: 0 0 20px rgba(0, 245, 212, 0.7);
}

.piano-key.is-target {
  box-shadow: inset 0 0 0 3px var(--gold), 0 0 18px rgba(255, 183, 3, 0.6);
  background: linear-gradient(180deg, #fef08a, #fde047);
  color: #0f172a;
}

.piano-key.is-locked {
  background: linear-gradient(180deg, var(--gold), #f59e0b) !important;
  color: #060914 !important;
  box-shadow: 0 0 22px rgba(255, 183, 3, 0.75);
}

.piano-key.is-vocal {
  box-shadow: inset 0 0 0 3px var(--magenta), 0 0 22px rgba(255, 46, 147, 0.8);
}

.piano-key.flash-hit {
  background: var(--lime) !important;
  box-shadow: 0 0 26px var(--lime);
}

.piano-key.flash-miss {
  background: var(--danger) !important;
  box-shadow: 0 0 24px var(--danger);
}

/* ============================================================================
   VOCAL STUDIO VIEW
   ============================================================================ */
.studio-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.studio-top-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
}

.studio-side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.inline-alert {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(251, 113, 133, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.45);
  color: #ffe4e6;
  font-size: 0.82rem;
  margin-bottom: 12px;
}

.tuner-readout-bar {
  display: grid;
  grid-template-columns: 165px 1fr 165px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  background: rgba(7, 10, 24, 0.82);
  border: 1px solid var(--border-glass);
  margin-bottom: 14px;
}

.tuner-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.tuner-note-big {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--cyan);
}

.tuner-freq {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.cents-scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.cents-center-lbl { color: var(--cyan); font-weight: 700; }

.cents-track {
  position: relative;
  height: 12px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.16);
  margin-bottom: 8px;
}

.cents-zone-perfect {
  position: absolute;
  left: 36%;
  right: 36%;
  top: 0; bottom: 0;
  border-radius: 99px;
  background: rgba(0, 245, 212, 0.22);
  border: 1px solid rgba(0, 245, 212, 0.45);
}

.cents-needle {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 18px;
  border-radius: 5px;
  background: var(--cyan);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 14px currentColor;
  transition: left 0.06s linear;
}

.tuner-cents-text {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.tuner-metrics-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mini-metric {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.mini-metric strong {
  font-family: var(--font-mono);
  color: var(--text-main);
}

.pitch-ribbon-wrap {
  width: 100%;
  height: 270px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.studio-pitch-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.studio-staff-box {
  background: rgba(7, 10, 24, 0.76);
  border-radius: 12px;
  border: 1px solid var(--border-glass);
  margin: 10px 0;
}

.drone-bar { display: flex; justify-content: center; }

.range-presets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px 0;
}

.range-chip {
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  padding: 8px 6px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--font-body);
  font-size: 0.76rem;
  transition: all 0.16s ease;
}

.range-chip span {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
}

.range-chip.active, .range-chip:hover {
  border-color: var(--cyan);
  background: rgba(0, 245, 212, 0.14);
}

.calib-box { margin-bottom: 12px; }
.calib-status {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(0, 245, 212, 0.12);
  border: 1px solid rgba(0, 245, 212, 0.35);
  font-size: 0.8rem;
  line-height: 1.4;
}

.slider-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.piano-octave-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============================================================================
   INTERACTIVE THEORY GUIDE VIEW
   ============================================================================ */
.guide-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.guide-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.guide-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.guide-item {
  padding: 12px;
  border-radius: 12px;
  background: rgba(7, 10, 24, 0.62);
  border: 1px solid var(--border-glass);
}

.guide-item h4 {
  margin: 0 0 5px;
  font-size: 0.9rem;
  color: var(--cyan);
}

.guide-item p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.5;
}

.soundboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.sound-chip {
  text-align: left;
  padding: 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.16s ease;
}

.sound-chip:hover {
  border-color: var(--chip-accent, var(--cyan));
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.sound-chip:active {
  transform: scale(0.98);
}

.sc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sc-top strong { font-family: var(--font-display); font-size: 0.96rem; color: var(--cyan); }
.sc-top span { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
.sc-name { font-size: 0.82rem; font-weight: 700; margin-bottom: 4px; }
.sc-mnem { font-size: 0.75rem; color: var(--text-dim); line-height: 1.38; }

/* ============================================================================
   MODALS & TOASTS
   ============================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 6, 16, 0.78);
  backdrop-filter: blur(10px);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface-strong);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.briefing-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--card-accent, var(--cyan));
  margin-bottom: 6px;
}

.briefing-title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
}

.briefing-sub {
  margin: 0 0 16px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.tip-callout {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(0, 245, 212, 0.08);
  border: 1px solid rgba(0, 245, 212, 0.28);
  margin-bottom: 14px;
}

.tip-callout-title {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--cyan);
  margin-bottom: 6px;
}

.tip-callout p {
  margin: 0;
  font-size: 0.84rem;
  color: #e2e8f0;
  line-height: 1.5;
}

.briefing-controls-row {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

/* Result Modal */
.result-modal {
  text-align: center;
}

.result-rank-badge {
  width: 78px;
  height: 78px;
  margin: 0 auto 10px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.3rem;
  font-weight: 800;
  color: #060914;
  background: var(--rank-color, var(--cyan));
  box-shadow: 0 0 32px var(--rank-color, var(--cyan));
}

.result-headline {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.35rem;
}

.result-stars {
  font-size: 1.9rem;
  margin-bottom: 16px;
}

.res-star { color: rgba(148, 163, 184, 0.22); margin: 0 3px; }
.res-star.lit { color: var(--gold); text-shadow: 0 0 18px rgba(255, 183, 3, 0.85); }

.result-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.rmetric {
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(7, 10, 24, 0.72);
  border: 1px solid var(--border-glass);
}
.rmetric span { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 3px; }
.rmetric strong { font-family: var(--font-mono); font-size: 0.98rem; color: var(--text-main); }

.xp-reward-bar {
  text-align: left;
  margin-bottom: 14px;
}
.xp-reward-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--cyan);
  margin-bottom: 5px;
}
.xp-track {
  height: 8px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.coach-box {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.34);
  margin-bottom: 18px;
}
.coach-title { font-weight: 800; font-size: 0.84rem; color: #e9d5ff; margin-bottom: 4px; }
.coach-box p { margin: 0; font-size: 0.82rem; color: #e2e8f0; line-height: 1.48; }

/* Settings */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-glass);
}
.setting-row strong { font-size: 0.88rem; display: block; margin-bottom: 2px; }
.setting-row.danger-row { border-bottom: none; padding-bottom: 0; }
.select-input {
  background: #0b1024;
  color: #fff;
  border: 1px solid var(--border-glass);
  border-radius: 9px;
  padding: 7px 10px;
  font-family: var(--font-body);
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  padding: 11px 15px;
  border-radius: 12px;
  background: rgba(10, 15, 32, 0.95);
  border: 1px solid var(--border-glass);
  color: #f8fafc;
  font-size: 0.83rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast-ok { border-color: var(--cyan); color: var(--cyan); }
.toast-warn { border-color: var(--danger); color: #ffe4e6; }
.toast-fever { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 22px rgba(255, 183, 3, 0.4); }

/* ============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================ */
@media (max-width: 1360px) {
  .topbar { flex-wrap: wrap; }
}

@media (max-width: 900px) {
  .hero-grid, .studio-top-grid, .interval-arena-grid, .chord-arena-grid, .guide-two-col {
    grid-template-columns: 1fr;
  }
  .stages-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 680px) {
  .stages-grid { grid-template-columns: 1fr; }
  .tuner-readout-bar { grid-template-columns: 1fr; text-align: center; }
  .result-metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .gameplay-hud { flex-wrap: wrap; }
  .hud-center { width: 100%; justify-content: space-around; }
}
