/* ==========================================================================
   Music Mala - Professional Yellow & White Design System + Night Theme
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #fcfbf7;
  --card-bg: #ffffff;
  --card-bg-subtle: #f8f7f2;
  --ink: #18181b;
  --ink-heading: #09090b;
  --muted: #52525b;
  --muted-light: #71717a;
  --line: #e4e4e7;
  --line-subtle: #f4f4f5;

  /* Primary Yellow Accent Palette */
  --accent: #f59e0b;
  --accent-bright: #fbbf24;
  --accent-hover: #d97706;
  --accent-text: #18181b;
  --accent-bg-subtle: #fef3c7;
  --accent-border: #fde68a;

  --green: #059669;
  --orange: #f59e0b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px -3px rgba(0, 0, 0, 0.06), 0 2px 6px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 14px 34px -4px rgba(0, 0, 0, 0.08), 0 4px 14px -2px rgba(0, 0, 0, 0.03);

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

/* --- NIGHT THEME (DARK MODE) --- */
html.dark,
body.dark {
  color-scheme: dark;
  --bg: #0f1115;
  --card-bg: #181a20;
  --card-bg-subtle: #1f222a;
  --ink: #f4f4f5;
  --ink-heading: #ffffff;
  --muted: #a1a1aa;
  --muted-light: #71717a;
  --line: #272a33;
  --line-subtle: #1e2129;

  --accent: #fbbf24;
  --accent-bright: #fde047;
  --accent-hover: #f59e0b;
  --accent-text: #0f1115;
  --accent-bg-subtle: rgba(245, 158, 11, 0.15);
  --accent-border: rgba(245, 158, 11, 0.35);

  --green: #34d399;
  --orange: #fbbf24;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px -3px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 14px 34px -4px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  transition: background-color 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  width: min(1120px, calc(100% - 48px));
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 12px;
  background: var(--card-bg);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  z-index: 999;
}
.skip-link:focus {
  left: 16px;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.nav {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--ink-heading);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.brand-light {
  font-weight: 400;
  color: var(--muted);
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin: 0 auto;
}

.desktop-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 0;
  position: relative;
  transition: color 0.18s ease;
}

.desktop-nav a:hover {
  color: var(--accent-hover);
}

.desktop-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.desktop-nav a:hover::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dark-mode-toggle {
  background: var(--card-bg-subtle);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 16px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.dark-mode-toggle:hover {
  background: var(--accent-bg-subtle);
  border-color: var(--accent-border);
  transform: scale(1.05);
}

/* Mobile hamburger button */
.mobile-menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}

.mobile-menu-btn .bar {
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.mobile-menu-btn.menu-active .bar-1 {
  transform: translateY(6px) rotate(45deg);
}
.mobile-menu-btn.menu-active .bar-2 {
  opacity: 0;
}
.mobile-menu-btn.menu-active .bar-3 {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Navigation Drawer */
.mobile-nav-drawer {
  display: none;
  background: var(--card-bg);
  border-bottom: 1px solid var(--line);
  padding: 16px 24px 24px;
}

.mobile-nav-drawer nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  background: var(--card-bg-subtle);
  border: 1px solid var(--line);
  transition: background-color 0.15s ease;
}

.mobile-nav-link:hover {
  background: var(--accent-bg-subtle);
  border-color: var(--accent-border);
  color: var(--accent-hover);
}

.mobile-nav-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}

.mobile-theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent-border);
  background: var(--accent-bg-subtle);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */
.button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font: 600 13px var(--sans);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.button-yellow,
.button-orange {
  background: var(--accent);
  color: var(--accent-text);
  border: 1px solid var(--accent-hover);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.button-yellow:hover,
.button-orange:hover {
  background: var(--accent-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.button-dark {
  background: var(--ink);
  color: var(--bg);
}

.button-dark:hover {
  background: var(--accent);
  color: var(--accent-text);
  transform: translateY(-1px);
}

.button-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.button-outline:hover {
  border-color: var(--accent);
  background: var(--accent-bg-subtle);
  color: var(--accent-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  min-height: 480px;
  align-items: center;
  padding: 56px 0 48px;
  gap: 36px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.hero h1,
.lesson-hero h1 {
  font: 700 clamp(42px, 5.5vw, 68px) / 1.05 var(--serif);
  letter-spacing: -2px;
  margin: 18px 0;
  color: var(--ink-heading);
}

.hero h1 em,
.section-head h2 em,
.circle-promo h2 em,
.lesson-hero h1 em,
.whats-next-header h2 em {
  color: var(--accent-hover);
  font-style: normal;
}

.hero-desc {
  color: var(--muted);
  max-width: 440px;
  line-height: 1.8;
  font-size: 16px;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-light);
  font-size: 12px;
  margin-top: 26px;
}

.tiny-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-bg-subtle);
  color: var(--accent-hover);
  font-size: 14px;
  border: 1px solid var(--accent-border);
}

/* Hero abstract artwork */
.hero-art {
  height: 360px;
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--card-bg-subtle);
  border: 1px solid var(--line);
}

.orbit {
  position: absolute;
  border: 1px dashed var(--line);
  border-radius: 50%;
}
.orbit-a { width: 190px; height: 190px; border-color: var(--accent-border); }
.orbit-b { width: 280px; height: 280px; }
.orbit-c { width: 360px; height: 360px; border-color: var(--line-subtle); }

.hero-art::before {
  content: '';
  position: absolute;
  background: var(--accent);
  width: 170px;
  height: 170px;
  border-radius: 50%;
  opacity: 0.18;
  filter: blur(24px);
}

.art-note {
  position: absolute;
  color: var(--accent-hover);
  font: 72px var(--serif);
  user-select: none;
}
.note-one { transform: translate(-42px, -30px) rotate(-10deg); color: var(--accent); }
.note-two { font-size: 46px; color: var(--green); transform: translate(62px, 42px) rotate(8deg); }
.note-three { font-size: 68px; color: var(--muted); transform: translate(14px, -86px); }

.art-caption {
  position: absolute;
  right: 6%;
  bottom: 22px;
  color: var(--muted);
  font: italic 14px var(--serif);
  line-height: 1.2;
}
.art-spark {
  position: absolute;
  left: 14%;
  top: 24%;
  font-size: 20px;
  color: var(--accent);
}

/* ==========================================================================
   Trust Strip
   ========================================================================== */
.trust-strip {
  border-block: 1px solid var(--line);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.strip-line {
  height: 1px;
  width: 32px;
  background: var(--line);
}

/* ==========================================================================
   Section Headings
   ========================================================================== */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 72px 0 28px;
  gap: 20px;
}

.section-head h2 {
  font: 700 clamp(28px, 4vw, 40px) / 1.15 var(--serif);
  letter-spacing: -1px;
  margin: 8px 0 0;
  color: var(--ink-heading);
}

.section-head > p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  text-align: right;
}

/* ==========================================================================
   Scale Explorer Card & Dialog Alignment
   ========================================================================== */
.explorer-card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px;
  transition: all 0.25s ease;
}

.explorer-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}

.control-group label {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.control-group select {
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font: 600 13px var(--sans);
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s ease;
  width: 100%;
}

.control-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg-subtle);
}

.tempo-group {
  min-width: 180px;
}

.tempo-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent-hover);
  background: var(--accent-bg-subtle);
  border: 1px solid var(--accent-border);
  padding: 2px 6px;
  border-radius: 4px;
}

.tempo-group input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
  height: 6px;
  margin-top: 14px;
}

.control-actions {
  display: flex;
  align-items: flex-end;
}

.control-actions .button {
  padding: 12px 24px;
  font-size: 14px;
  min-height: 44px;
}

.play-icon {
  font-size: 11px;
}

/* Scale Result Area */
.scale-result {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 40px;
  padding: 28px 0 8px;
}

.scale-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.scale-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.mood-pill {
  background: var(--accent-bg-subtle);
  color: var(--accent-hover);
  border: 1px solid var(--accent-border);
  border-radius: 99px;
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: capitalize;
}

/* Note Chips */
.note-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0;
  flex-wrap: wrap;
}

.note-chip {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--ink);
  font: 700 13px var(--sans);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s ease;
}

.note-chip:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.note-root {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-bg-subtle);
}

.note-arrow {
  color: var(--muted-light);
  font-size: 16px;
}

.formula {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: grid;
  gap: 6px;
}

.formula > span:first-child {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 700;
}

.formula strong {
  font: 600 18px var(--serif);
  color: var(--ink-heading);
}

.formula-key {
  font-size: 11px;
  color: var(--muted);
}

/* Keyboard Styling */
.keyboard-wrap {
  background: var(--card-bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px 12px;
}

.keyboard-label {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

.keyboard-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.keyboard {
  height: 130px;
  display: flex;
  position: relative;
  margin-top: 12px;
  padding: 0 2px;
  min-width: 580px;
}

.key {
  position: relative;
  cursor: pointer;
  border-radius: 0 0 5px 5px;
  transition: background-color 0.15s ease, transform 0.08s ease;
  user-select: none;
}

.white-key {
  flex: 1;
  min-width: 28px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-right: 0;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.white-key:last-child {
  border-right: 1px solid var(--line);
}

.white-key:hover {
  background: var(--accent-bg-subtle);
}

.black-key {
  z-index: 2;
  width: 22px;
  height: 64%;
  margin: 0 -11px;
  background: #18181b;
  border: 0;
  border-radius: 0 0 4px 4px;
  color: #a1a1aa;
  font-size: 8px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
}

html.dark .black-key {
  background: #0d0e12;
  color: #71717a;
  border: 1px solid #272a33;
}

.key-active.white-key {
  background: var(--accent-bg-subtle);
  color: var(--accent-hover);
  border-bottom: 4px solid var(--accent);
}

.key-active.black-key {
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.key-root.white-key {
  background: var(--accent-border);
  color: var(--ink-heading);
  font-weight: 800;
  border-bottom: 4px solid var(--accent-hover);
}

.key-root.black-key {
  background: var(--accent-hover);
  color: #fff;
  font-weight: 800;
}

.key-playing {
  transform: scaleY(0.97);
  filter: brightness(1.18);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.7);
}

.key-legend {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
  font-size: 10px;
  color: var(--muted);
  margin-top: 12px;
}

.key-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-active {
  background: var(--accent);
}

.legend-root {
  background: var(--accent-hover);
}

.legend-other {
  background: var(--line);
}
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-active {
  background: var(--accent);
}

.legend-other {
  border: 1px solid var(--muted);
}

/* ==========================================================================
   Foundation Lessons Grid
   ========================================================================== */
.learn-section .section-head {
  margin-top: 84px;
}

.text-link {
  font-size: 12px;
  color: var(--accent-hover);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.text-link:hover {
  text-decoration: underline;
}

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.lesson-card {
  min-height: 250px;
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.lesson-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-hover);
}

.lesson-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Authentic pastel palettes matching editorial cards */
.card-peach {
  background: #faede3;
  border-color: #ebdcd0;
}
.card-lilac {
  background: #edeaf7;
  border-color: #ded9ee;
}
.card-sage {
  background: #e5ece1;
  border-color: #d5ded2;
}
.card-butter {
  background: #fdf3db;
  border-color: #f0e2be;
}
.card-sky {
  background: #e7eff7;
  border-color: #d2e0ee;
}

/* Night theme pastel tints */
html.dark .card-peach,
body.dark .card-peach {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.22);
}
html.dark .card-lilac,
body.dark .card-lilac {
  background: rgba(167, 139, 250, 0.08);
  border-color: rgba(167, 139, 250, 0.22);
}
html.dark .card-sage,
body.dark .card-sage {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.22);
}
html.dark .card-butter,
body.dark .card-butter {
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.22);
}
html.dark .card-sky,
body.dark .card-sky {
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.22);
}

.lesson-icon {
  float: right;
  font-size: 20px;
  line-height: 1;
  color: var(--accent-hover);
}

.card-no {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--muted);
  font-weight: 700;
  display: block;
}

.lesson-card h3 {
  font: 700 22px var(--serif);
  margin: 22px 0 8px;
  color: var(--ink-heading);
  letter-spacing: -0.3px;
}

.lesson-card p {
  max-width: 260px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
  margin: 0 0 36px;
}

.card-arrow {
  position: absolute;
  bottom: 20px;
  left: 24px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-hover);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.lesson-card:hover .card-arrow {
  transform: translateX(4px);
  color: var(--ink-heading);
}

.mini-staff {
  position: absolute;
  right: 14px;
  bottom: 24px;
  width: 90px;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0.65;
}
.mini-staff i { height: 1px; background: rgba(0, 0, 0, 0.12); }
html.dark .mini-staff i { background: rgba(255, 255, 255, 0.15); }
.mini-staff b { position: absolute; top: 2px; left: 22px; font: 34px var(--serif); color: #c86940; }

.step-art {
  position: absolute;
  bottom: 20px;
  right: 18px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  opacity: 0.7;
}
.step-art i { width: 10px; height: 12px; background: #9c95c8; border-radius: 2px; }
.step-art i:nth-child(2) { height: 24px; }
.step-art i:nth-child(3) { height: 16px; }
.step-art i:nth-child(4) { height: 32px; }
.step-art i:nth-child(5) { height: 22px; }
html.dark .step-art i { background: #a78bfa; }

.mood-art {
  position: absolute;
  right: 16px;
  bottom: 22px;
  display: flex;
  gap: 6px;
  align-items: center;
  color: #466752;
  font: italic 12px var(--serif);
  opacity: 0.85;
}
html.dark .mood-art { color: #34d399; }

/* Custom visual artwork for What's Next learning workflow cards */
.mini-circle-art {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 48px;
  height: 48px;
  border: 1.5px dashed rgba(200, 105, 64, 0.5);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform 0.4s ease;
}
.lesson-card:hover .mini-circle-art {
  transform: rotate(45deg);
}
.mini-circle-art::before {
  content: '5ths';
  font: 700 9px var(--sans);
  color: #c86940;
  letter-spacing: 0.5px;
}
html.dark .mini-circle-art { border-color: rgba(251, 191, 36, 0.4); }
html.dark .mini-circle-art::before { color: var(--accent); }

.mini-metro-art {
  position: absolute;
  right: 18px;
  bottom: 20px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  opacity: 0.75;
}
.mini-metro-art i {
  width: 4px;
  background: #8b82be;
  border-radius: 2px;
  transition: height 0.2s ease;
}
.mini-metro-art i:nth-child(1) { height: 12px; }
.mini-metro-art i:nth-child(2) { height: 24px; }
.mini-metro-art i:nth-child(3) { height: 32px; }
.mini-metro-art i:nth-child(4) { height: 18px; }
.mini-metro-art i:nth-child(5) { height: 8px; }
.lesson-card:hover .mini-metro-art i:nth-child(2) { height: 30px; }
.lesson-card:hover .mini-metro-art i:nth-child(3) { height: 16px; }
.lesson-card:hover .mini-metro-art i:nth-child(4) { height: 28px; }
html.dark .mini-metro-art i { background: #a78bfa; }

.mini-game-art {
  position: absolute;
  right: 16px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #466752;
  font-size: 11px;
  letter-spacing: 1px;
  opacity: 0.85;
}
html.dark .mini-game-art { color: #34d399; }

.mini-interval-art {
  position: absolute;
  right: 16px;
  bottom: 22px;
  display: flex;
  gap: 5px;
  align-items: center;
  color: #b47820;
  font: italic 12px var(--serif);
  opacity: 0.85;
}
html.dark .mini-interval-art { color: #fbbf24; }

/* ==========================================================================
   CHORD LAB & INSTRUMENT VIEWER (PIANO & GUITAR)
   ========================================================================== */
.chord-lab {
  margin: 68px 0 24px;
}

.chord-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 24px;
}

.chord-heading h2 {
  font: 700 clamp(28px, 3.5vw, 36px) / 1.15 var(--serif);
  letter-spacing: -1px;
  margin: 10px 0 6px;
  color: var(--ink-heading);
}

.chord-heading h2 em {
  color: var(--accent-hover);
  font-style: normal;
}

.chord-heading p {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

.chord-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.chord-instrument-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1px;
  font-weight: 700;
  text-transform: uppercase;
}

.chord-instrument-choice select {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  padding: 8px 24px 8px 10px;
  color: var(--ink-heading);
  font: 600 12px var(--sans);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.chord-instrument-choice select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chord-count {
  white-space: nowrap;
  border-radius: 99px;
  background: var(--accent-bg-subtle);
  border: 1px solid var(--accent-border);
  padding: 6px 12px;
  color: var(--accent-hover);
  font-size: 10px;
  font-weight: 700;
}

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

.chord-card {
  min-width: 0;
  text-align: left;
  padding: 18px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  cursor: pointer;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.chord-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
}

.chord-card.is-playing {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 2px var(--accent-bg-subtle);
}

.chord-degree {
  font-size: 8.5px;
  letter-spacing: 1.2px;
  color: var(--muted-light);
  font-weight: 700;
  text-transform: uppercase;
}

.chord-name {
  font: 700 24px / 1.1 var(--serif);
  margin: 8px 0 2px;
  color: var(--ink-heading);
}

.chord-quality {
  font-size: 10.5px;
  color: var(--muted);
}

/* Piano diagram display inside chord card */
.chord-diagram {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  height: 44px;
  margin: 14px 0 9px;
  border: 1px solid var(--line);
  border-radius: 0 0 4px 4px;
  overflow: hidden;
  background: var(--card-bg);
}

.shape-key {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: 3px;
  min-width: 0;
  border-right: 1px solid var(--line-subtle);
  font-size: 6.5px;
  color: var(--muted-light);
  background: var(--card-bg);
}

.shape-key:last-child {
  border-right: 0;
}

.shape-key.mini-black {
  background: #3f3f46;
  color: #a1a1aa;
  border-color: #52525b;
}

.shape-key.shape-active {
  background: #fef3c7;
  color: #92400e;
  font-weight: 700;
  box-shadow: inset 0 -3px var(--accent);
}

.shape-key.mini-black.shape-active {
  background: #b45309;
  color: #ffffff;
  box-shadow: inset 0 -3px var(--accent-bright);
}

.shape-key.shape-root {
  background: #fde68a;
  font-weight: 800;
}

html.dark .shape-key {
  background: #181a20;
  border-color: #272a33;
}

html.dark .shape-key.mini-black {
  background: #272a33;
  color: #71717a;
}

html.dark .shape-key.shape-active {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
}

html.dark .shape-key.mini-black.shape-active {
  background: rgba(245, 158, 11, 0.45);
  color: #ffffff;
}

/* Guitar diagram display inside chord card */
.chord-guitar {
  display: flex;
  flex-direction: column;
  margin: 11px 0 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line-subtle);
}

.guitar-diagram-title {
  font-size: 7px;
  letter-spacing: 0.6px;
  color: var(--muted-light);
  font-weight: 700;
  text-transform: uppercase;
}

.guitar-diagram-box {
  height: 60px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-top: 4px;
}

.guitar-string {
  height: 60px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.guitar-string::before {
  content: '';
  position: absolute;
  top: 13px;
  bottom: 10px;
  width: 1px;
  background: var(--line);
}

.guitar-string::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 44px;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 10px, var(--line) 10px, var(--line) 11px);
  pointer-events: none;
}

.guitar-string small {
  height: 12px;
  color: var(--accent-hover);
  font-size: 8px;
  line-height: 12px;
  font-weight: 700;
}

.guitar-string b {
  position: absolute;
  bottom: 0;
  color: var(--muted-light);
  font-size: 7px;
}

.guitar-string i.guitar-finger {
  position: absolute;
  z-index: 1;
  top: calc(13px + (var(--fret) - 0.5) * 8.5px);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent-hover);
  color: #ffffff;
  font: 700 7px/13px var(--sans);
  text-align: center;
  font-style: normal;
}

.guitar-tab {
  margin-top: 4px;
  color: var(--muted);
  font: 600 8.5px var(--sans);
  letter-spacing: 0.8px;
}

.guitar-tab small {
  color: var(--muted-light);
  font-weight: 400;
}

/* Visibility toggle based on selected instrument */
.chord-lab[data-instrument="piano"] .chord-guitar {
  display: none !important;
}

.chord-lab[data-instrument="guitar"] .chord-diagram {
  display: none !important;
}

.chord-notes {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.3px;
  margin-top: 2px;
}

.chord-play {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line-subtle);
  color: var(--accent-hover);
  font-size: 10px;
  font-weight: 700;
}

.chord-hint {
  min-height: 18px;
  margin: 14px 1px 0;
  color: var(--muted);
  font-size: 11.5px;
  font-style: italic;
}

@media (max-width: 768px) {
  .chord-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .chord-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .chord-card {
    padding: 14px 11px;
  }
}

/* ==========================================================================
   "WHAT'S NEXT" WORKFLOW CARDS
   ========================================================================== */
.whats-next-section {
  margin: 80px 0 60px;
}

.whats-next-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

@media (max-width: 1040px) {
  .whats-next-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (max-width: 640px) {
  .whats-next-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ==========================================================================
   Bottom Note & Footer
   ========================================================================== */
.bottom-note {
  border-top: 1px solid var(--line);
  padding: 28px 0 34px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.bottom-note > span {
  color: var(--accent);
  font-size: 22px;
}

.bottom-note p {
  font: italic 15px var(--serif);
  margin: 0 auto 0 0;
  color: var(--ink);
}

.bottom-note a {
  font-size: 12px;
  color: var(--accent-hover);
  font-weight: 700;
}

footer {
  border-top: 1px solid var(--line);
  background: var(--card-bg);
  padding: 36px 0 40px;
  transition: background-color 0.25s ease;
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  align-items: center;
  gap: 24px;
}

.footer-brand {
  font-size: 18px;
}
.footer-brand .brand-mark {
  width: 28px;
  height: 28px;
  font-size: 16px;
}

.footer-inner p,
.footer-inner small {
  font-size: 12px;
  color: var(--muted);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 22px;
  font-size: 12px;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--accent-hover);
}

/* ==========================================================================
   Lesson & Other Subpages
   ========================================================================== */
.lesson-hero {
  padding: 48px 0 28px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 24px;
}

.back-link:hover {
  color: var(--accent-hover);
}

.lesson-lede {
  color: var(--muted);
  line-height: 1.8;
  max-width: 640px;
  font-size: 16px;
}

.lesson-body {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 56px;
  padding: 24px 0 80px;
  align-items: flex-start;
}

.lesson-visual {
  height: 280px;
  border-radius: var(--radius-md);
  background: var(--card-bg-subtle);
  border: 1px solid var(--line);
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.visual-orbit {
  width: 180px;
  height: 180px;
  border: 1px dashed var(--line);
  border-radius: 50%;
  position: absolute;
}
.visual-orbit::after {
  content: '';
  position: absolute;
  inset: 40px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
}

.lesson-visual > span {
  font-size: 64px;
  color: var(--accent);
  z-index: 1;
}

.lesson-visual small {
  position: absolute;
  bottom: 20px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.lesson-body article {
  line-height: 1.9;
  color: var(--muted);
  font-size: 15px;
}

.lesson-body h2 {
  font: 700 28px var(--serif);
  color: var(--ink-heading);
  margin: 32px 0 12px;
}

.callout {
  background: var(--accent-bg-subtle);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 18px 20px;
  margin: 28px 0;
  color: var(--ink);
}

.callout b {
  color: var(--ink-heading);
  font-size: 14px;
}

.callout p {
  font-size: 13px;
  line-height: 1.7;
  margin: 6px 0 10px;
}

.callout a {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-hover);
}

/* ==========================================================================
   Mobile & Responsive Adaptations (Perfect on Phone)
   ========================================================================== */
@media (max-width: 900px) {
  .lesson-grid {
    grid-template-columns: 1fr;
  }
  .scale-result {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 768px) {
  .wrap {
    width: calc(100% - 32px);
  }

  .nav {
    height: 64px;
  }

  .desktop-nav {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-nav-drawer {
    display: block;
  }
  .mobile-nav-drawer[hidden] {
    display: none;
  }

  /* Hero on mobile */
  .hero {
    grid-template-columns: 1fr;
    padding: 36px 0 24px;
    gap: 24px;
  }

  .hero h1 {
    font-size: clamp(34px, 8.5vw, 48px);
    letter-spacing: -1.2px;
  }

  .hero-art {
    height: 240px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .button {
    width: 100%;
  }

  .trust-strip {
    font-size: 8px;
    letter-spacing: 0.8px;
    gap: 14px;
  }
  .strip-line {
    width: 16px;
  }

  .section-head {
    margin: 48px 0 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  .section-head > p {
    text-align: left;
  }

  /* Explorer on mobile */
  .explorer-card {
    padding: 20px 16px;
  }

  .explorer-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .control-group {
    width: 100%;
    min-width: unset;
  }

  .control-actions {
    width: 100%;
  }

  .control-actions .button {
    width: 100%;
  }

  .keyboard {
    height: 105px;
  }
  .white-key {
    padding-bottom: 6px;
    font-size: 9px;
  }

  /* What's Next on mobile */
  .whats-next-section {
    margin: 56px 0 40px;
  }

  .whats-next-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .bottom-note {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 20px;
    text-align: center;
  }
  .footer-brand {
    justify-content: center;
  }
  .footer-links {
    justify-content: center;
  }

  .lesson-body {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 16px 0 60px;
  }
}

/* ==========================================================================
   Interactive Lesson Mini-Games
   ========================================================================== */
.lesson-game-wrapper {
  margin: 32px 0 48px;
}

.mini-game-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.game-header {
  margin-bottom: 24px;
}

.game-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.game-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}

.game-subtitle {
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  max-width: 780px;
}

.game-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}

.button-large {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
}

/* --- Game 1: The Pitch Staircase --- */
.staircase-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.hud-stat {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

html.dark .hud-stat {
  background: rgba(255, 255, 255, 0.04);
}

.hud-stat span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.hud-stat b {
  font-size: 18px;
  color: var(--ink);
  font-weight: 700;
}

.staircase-stage {
  position: relative;
  height: 240px;
  background: linear-gradient(to top, rgba(245, 158, 11, 0.06), transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px 0;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.pip-character {
  position: absolute;
  width: 36px;
  height: 36px;
  transition: left 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), bottom 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pip-body {
  font-size: 26px;
  color: var(--ink);
  background: var(--accent);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  font-weight: bold;
}

.pip-character.bouncing .pip-body {
  animation: pipBounce 0.4s ease-out;
}

@keyframes pipBounce {
  0% { transform: scale(1, 1) translateY(0); }
  30% { transform: scale(1.25, 0.75) translateY(0); }
  50% { transform: scale(0.85, 1.15) translateY(-18px); }
  75% { transform: scale(1.05, 0.95) translateY(0); }
  100% { transform: scale(1, 1) translateY(0); }
}

.stairs-track {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: flex-end;
  gap: 8px;
}

.stair-step {
  flex: 1;
  height: calc(45px + var(--step-index) * 20px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.stair-step:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.stair-step.active {
  background: var(--accent-light, #fef3c7);
  border-color: var(--accent);
  box-shadow: 0 -4px 16px rgba(245, 158, 11, 0.25);
}

html.dark .stair-step.active {
  background: rgba(245, 158, 11, 0.18);
}

.stair-num {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
}

.stair-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}

.stair-sol {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.game-quest-panel {
  margin-top: 24px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

html.dark .game-quest-panel {
  background: rgba(255, 255, 255, 0.02);
}

.quest-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--line);
  color: var(--muted);
  text-transform: uppercase;
}

.quest-badge.active {
  background: #fef3c7;
  color: #b45309;
}

.quest-badge.success {
  background: #d1fae5;
  color: #065f46;
}

.quest-text {
  font-size: 14px;
  color: var(--ink);
  margin-top: 4px;
}

/* --- Game 2: Step Jumper --- */
.scale-recipe-tracker {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.tracker-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.recipe-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.recipe-chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.recipe-chip.current {
  border-color: var(--accent);
  background: #fef3c7;
  color: #92400e;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

html.dark .recipe-chip.current {
  background: rgba(245, 158, 11, 0.2);
  color: #fef3c7;
}

.recipe-chip.completed {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

html.dark .recipe-chip.completed {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

.jumper-stage {
  margin: 20px 0;
  overflow-x: auto;
  padding: 10px 4px;
}

.piano-strip {
  display: flex;
  height: 120px;
  min-width: 620px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 4px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.strip-key {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 8px;
  cursor: pointer;
  border-radius: 0 0 5px 5px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.strip-key.white {
  flex: 1;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-top: none;
  z-index: 1;
  color: #111827;
}

html.dark .strip-key.white {
  background: #27272a;
  border-color: #3f3f46;
  color: #fafafa;
}

.strip-key.black {
  width: 26px;
  height: 70px;
  margin-left: -13px;
  margin-right: -13px;
  background: #18181b;
  border: 1px solid #09090b;
  border-radius: 0 0 4px 4px;
  z-index: 2;
  color: #f4f4f5;
  padding-bottom: 4px;
}

.strip-key.active {
  background: #f59e0b !important;
  color: #000000 !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
  transform: translateY(2px);
}

.strip-key-label {
  font-size: 11px;
  font-weight: 700;
}

.natural-half-badge {
  position: absolute;
  top: 4px;
  font-size: 9px;
  font-weight: 800;
  background: #fee2e2;
  color: #b91c1c;
  padding: 1px 4px;
  border-radius: 3px;
}

.jump-callout-box {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  margin-bottom: 20px;
}

.highlight-tip {
  font-weight: 600;
  color: #b45309;
}

html.dark .highlight-tip {
  color: #fde68a;
}

.jumper-footer-stats {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.jumper-footer-stats b {
  color: var(--ink);
}

/* --- Game 3: The Mood Alchemist --- */
.mood-alchemist-game {
  transition: all 0.4s ease;
}

.mood-alchemist-game.mood-major {
  border-color: #fde68a;
}

.mood-alchemist-game.mood-minor {
  border-color: #a5b4fc;
}

.alchemist-portal {
  position: relative;
  height: 220px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  transition: background 0.5s ease;
}

.mood-major .alchemist-portal {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}

.mood-minor .alchemist-portal {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.portal-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.portal-sun {
  position: absolute;
  top: 16px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 32px #f59e0b;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.portal-moon {
  position: absolute;
  top: 16px;
  right: 24px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  box-shadow: inset -9px 3px 0 0 #c7d2fe;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.mood-major .portal-sun { opacity: 1; transform: scale(1); }
.mood-major .portal-moon { opacity: 0; transform: scale(0.5); }
.mood-minor .portal-sun { opacity: 0; transform: scale(0.5); }
.mood-minor .portal-moon { opacity: 1; transform: scale(1); }

.portal-mood-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.1em;
  z-index: 2;
  text-transform: uppercase;
  transition: color 0.4s ease;
}

.mood-major .portal-mood-title { color: #92400e; }
.mood-minor .portal-mood-title { color: #e0e7ff; }

.alchemist-root-picker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.root-picker-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.root-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.root-chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.root-chip:hover {
  border-color: var(--accent);
  color: var(--ink);
  transform: translateY(-1px);
}

.root-chip.active {
  background: var(--accent);
  color: #1c1917;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
}

html.dark .root-chip.active {
  color: #000000;
}

.alchemist-flasks {
  display: flex;
  justify-content: center;
  gap: 20px;
  z-index: 2;
}

.flask {
  border-radius: 14px;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  transition: all 0.3s ease;
}

/* Major state: Always sunny theme with deep dark, legible text in light AND night mode */
.mood-major .flask {
  background: #ffffff !important;
  border: 1px solid rgba(245, 158, 11, 0.4) !important;
  box-shadow: 0 4px 18px rgba(245, 158, 11, 0.2) !important;
}

.mood-major .flask .flask-label {
  color: #78350f !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.mood-major .flask .flask-note {
  color: #1c1917 !important;
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0;
}

.mood-major .flask .flask-role {
  color: #92400e !important;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
}

.mood-major .third-flask.pulse {
  border-color: #f59e0b !important;
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.5) !important;
}

/* Minor state: Always starry midnight theme with bright white & indigo text */
.mood-minor .flask {
  background: rgba(15, 23, 42, 0.88) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(129, 140, 248, 0.45) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45) !important;
}

.mood-minor .flask .flask-label {
  color: #a5b4fc !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.mood-minor .flask .flask-note {
  color: #ffffff !important;
  font-size: 26px;
  font-weight: 800;
  margin: 4px 0;
}

.mood-minor .flask .flask-role {
  color: #c7d2fe !important;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
}

.mood-minor .third-flask.pulse {
  border-color: #818cf8 !important;
  box-shadow: 0 0 24px rgba(129, 140, 248, 0.5) !important;
}

.alchemist-lever-container {
  margin: 24px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lever-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

.lever-switch {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  position: relative;
  max-width: 480px;
  user-select: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.lever-side {
  flex: 1;
  padding: 10px 18px;
  border-radius: 999px;
  background: transparent;
  border: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  z-index: 2;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: color 0.2s ease;
}

.lever-side.active {
  color: #1c1917 !important;
}

.mood-minor .lever-side.active {
  color: #ffffff !important;
}

.lever-handle {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--accent);
  border-radius: 999px;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), background 0.28s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 1;
}

.mood-minor .lever-handle {
  background: #818cf8;
}

.alchemist-scenario-box {
  margin-top: 18px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.scenario-prompt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}

.scenario-status {
  font-size: 13px;
  margin-top: 8px;
  color: var(--muted);
}

.scenario-status.success {
  color: #059669;
  font-weight: 600;
}

/* --- Game 4: Harmonic Tension String --- */
.string-canvas-wrap {
  position: relative;
  background: #111827;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
  margin-bottom: 20px;
}

#interval-string-canvas {
  width: 100%;
  height: 120px;
  display: block;
}

.string-fret-indicator {
  position: absolute;
  bottom: 8px;
  right: 14px;
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 8px;
  border-radius: 4px;
}

.interval-gauge-bar {
  margin-bottom: 24px;
}

.gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.gauge-track {
  height: 10px;
  background: #e5e7eb;
  border-radius: 999px;
  position: relative;
  overflow: visible;
}

html.dark .gauge-track {
  background: #374151;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(to right, #10b981 0%, #f59e0b 50%, #ef4444 100%);
  transition: width 0.2s ease;
}

.gauge-needle {
  position: absolute;
  top: -4px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 3px solid #111827;
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.gauge-status {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  margin-top: 8px;
}

.interval-slider-row {
  margin-bottom: 20px;
}

.slider-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

#interval-range {
  width: 100%;
  accent-color: var(--accent);
}

.semitone-dots {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}

.semi-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.semi-dot:hover, .semi-dot.active {
  background: var(--accent);
  color: #000000;
  border-color: var(--accent);
  transform: scale(1.15);
}

.interval-details-card {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.detail-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.detail-distance {
  font-size: 13px;
  color: var(--muted);
  margin: 2px 0 6px;
}

.detail-desc {
  font-size: 14px;
  color: var(--ink);
}

.interval-mission-box {
  margin-top: 18px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.02);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.mission-clue {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}

.mission-feedback {
  font-size: 13px;
  margin-top: 8px;
  color: var(--muted);
}

.mission-feedback.success {
  color: #059669;
  font-weight: 600;
}

