/* ================================================================
   Musicalizer — Main Styles
   ================================================================ */

:root {
    --bg:           #0f1117;
    --bg-surface:   #181a24;
    --bg-card:      #1e2030;
    --bg-hover:     #262940;
    --border:       #2a2d3e;
    --border-light: #353853;
    --text:         #e0e0ee;
    --text-muted:   #8888a8;
    --text-dim:     #5e5e80;
    --accent:       #6c63ff;
    --accent-light: #857dff;
    --accent-glow:  rgba(108, 99, 255, 0.2);
    --accent-2:     #ff6b9d;
    --accent-3:     #4ecdc4;
    --success:      #4ecdc4;
    --warning:      #ffd166;
    --danger:       #ff6b6b;
    --radius:       8px;
    --radius-lg:    12px;
    --shadow:       0 4px 24px rgba(0,0,0,.3);
    --font:         'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:    'Fira Code', 'JetBrains Mono', monospace;
    --transition:   0.2s ease;
}

/* ── Light Theme ── */
html.light-theme {
    --bg:           #f5f5f8;
    --bg-surface:   #ffffff;
    --bg-card:      #eeeef2;
    --bg-hover:     #e2e2ea;
    --border:       #d0d0da;
    --border-light: #c0c0cc;
    --text:         #1a1a2e;
    --text-muted:   #555570;
    --text-dim:     #888898;
    --accent:       #5a4fd6;
    --accent-light: #6c63ff;
    --accent-glow:  rgba(90, 79, 214, 0.12);
    --accent-2:     #e85585;
    --accent-3:     #2eb8ad;
    --success:      #2eb8ad;
    --warning:      #e6a800;
    --danger:       #e05050;
    --shadow:       0 4px 24px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ── Header ──────────────────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0.75rem 2rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 200;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    -webkit-transform: translateZ(0);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

.header-brand h1 {
    font-size: 1.15rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    align-items: center;
}

/* ── Theme Switcher ── */
.nav-help-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.nav-help-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.theme-switcher {
    margin-left: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}

.theme-switcher:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Metronome Toggle Button (in header) ── */
.metronome-toggle-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    margin-left: 0.35rem;
}
.metronome-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--border-light);
}
.metronome-toggle-btn.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ── Floating Metronome Widget ── */
.metronome-widget {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 250;
    width: 260px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow), 0 8px 30px rgba(0,0,0,0.2);
    overflow: hidden;
}
.met-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}
.met-widget-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.met-widget-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.met-widget-close:hover { color: var(--text); }
.met-widget-body {
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.met-widget-bpm-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.met-widget-tap {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius);
}
.met-widget-bpm-input {
    width: 60px;
    padding: 0.3rem 0.4rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: center;
}
.met-widget-bpm-input:focus {
    outline: none;
    border-color: var(--accent);
}
.met-widget-bpm-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}
.met-widget-slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.met-widget-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.met-widget-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}
.met-widget-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.met-widget-play-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.met-widget-play-btn.playing {
    background: var(--danger);
    border-color: var(--danger);
}
.met-widget-timesig {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
    cursor: pointer;
}
.met-widget-timesig:focus {
    outline: none;
    border-color: var(--accent);
}
.met-widget-vol {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-dim);
    margin-left: auto;
}
.met-widget-vol input[type="range"] {
    width: 60px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.met-widget-vol input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}
.met-widget-vol input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    cursor: pointer;
}
.met-widget-beats {
    display: flex;
    gap: 0.4rem;
    justify-content: center;
}
.met-widget-beat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    transition: background 0.1s, box-shadow 0.1s;
}
.met-widget-beat-dot.active {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(108, 99, 255, 0.5);
}

/* ── Studio Master Volume ── */
.studio-master-vol {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.studio-master-vol label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-light);
    white-space: nowrap;
}
.studio-master-vol label svg {
    color: var(--accent);
    flex-shrink: 0;
}
.studio-master-vol input[type="range"] {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.studio-master-vol input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-surface);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(108, 99, 255, 0.4);
}
.studio-master-vol input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg-surface);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(108, 99, 255, 0.4);
}

/* ── Drag Handle for Studio Tracks ── */
.studio-track-drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-size: 1rem;
    color: var(--text-dim);
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
    opacity: 0.5;
    transition: opacity var(--transition), color var(--transition);
}
.studio-track-drag-handle:hover {
    opacity: 1;
    color: var(--text);
}
.studio-track.dragging {
    opacity: 0.4;
}
.studio-track.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* ── Language Switcher ── */
.lang-switcher {
    margin-left: 0.35rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
    letter-spacing: 0.04em;
}

.lang-switcher:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.lang-flag {
    font-size: 1.05rem;
    line-height: 1;
}

/* ── Dropdown Navigation ── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.nav-dropdown-toggle:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.nav-dropdown-toggle.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

.nav-chevron {
    transition: transform 0.2s;
}

.nav-dropdown.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    flex-direction: column;
    gap: 2px;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: flex;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-align: left;
    width: 100%;
}

.nav-btn:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.nav-btn.active {
    color: var(--accent-light);
    background: var(--accent-glow);
}

.header-actions {
    flex-shrink: 0;
}

.key-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.inline-key-selector {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

/* Key Button Group (replaces <select>) */
.key-btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    vertical-align: middle;
}

.key-btn-group .key-btn {
    padding: 0.2rem 0.45rem;
    min-width: 1.8rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.12s ease;
    line-height: 1.3;
}

.key-btn-group .key-btn:hover {
    color: var(--text);
    border-color: var(--accent);
    background: var(--bg-hover);
}

.key-btn-group .key-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.key-btn-group .key-btn.is-sharp {
    font-size: 0.68rem;
    padding: 0.2rem 0.3rem;
}

.key-selector select,
select {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
}

select:focus {
    border-color: var(--accent);
}

/* ── Main / Sections ─────────────────────────────────────────── */
.app-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   Landing Page
   ================================================================ */
.landing-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 0;
    position: relative;
    overflow: hidden;
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ── Animated Background ── */
.landing-anim {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

/* Floating music notes */
.landing-notes {
    position: absolute;
    inset: 0;
}

.ln {
    position: absolute;
    font-size: 1.6rem;
    color: var(--accent);
    opacity: 0;
    animation: note-float linear infinite;
}

.ln-1 { left:  5%; animation-duration: 8s;  animation-delay: 0s;   font-size: 2rem;   color: var(--accent); }
.ln-2 { left: 15%; animation-duration: 10s; animation-delay: 1.2s; font-size: 2.8rem; color: var(--accent-2); }
.ln-3 { left: 28%; animation-duration: 9s;  animation-delay: 3s;   font-size: 1.8rem; color: var(--accent-3); }
.ln-4 { left: 42%; animation-duration: 11s; animation-delay: 0.5s; font-size: 2.5rem; color: var(--accent); }
.ln-5 { left: 58%; animation-duration: 8.5s;animation-delay: 2s;   font-size: 2.2rem; color: var(--accent-2); }
.ln-6 { left: 70%; animation-duration: 10s; animation-delay: 4s;   font-size: 3rem;   color: var(--accent); }
.ln-7 { left: 82%; animation-duration: 9.5s;animation-delay: 1s;   font-size: 1.9rem; color: var(--accent-3); }
.ln-8 { left: 93%; animation-duration: 11s; animation-delay: 3.5s; font-size: 2.3rem; color: var(--accent-2); }

@keyframes note-float {
    0%   { transform: translateY(110vh) rotate(0deg) scale(0.5); opacity: 0; }
    10%  { opacity: 0.2; }
    50%  { opacity: 0.12; }
    90%  { opacity: 0.08; }
    100% { transform: translateY(-10vh) rotate(360deg) scale(1.2); opacity: 0; }
}

/* Waveform bars */
.landing-wave {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 100px;
    opacity: 0.18;
}

.landing-wave span {
    display: block;
    width: 6px;
    border-radius: 3px;
    background: var(--accent);
    animation: wave-bar ease-in-out infinite;
}

.landing-wave span:nth-child(1)  { height: 15px; animation-duration: 1.2s; animation-delay: 0.00s; }
.landing-wave span:nth-child(2)  { height: 25px; animation-duration: 1.0s; animation-delay: 0.10s; }
.landing-wave span:nth-child(3)  { height: 35px; animation-duration: 1.4s; animation-delay: 0.05s; }
.landing-wave span:nth-child(4)  { height: 20px; animation-duration: 1.1s; animation-delay: 0.15s; }
.landing-wave span:nth-child(5)  { height: 40px; animation-duration: 0.9s; animation-delay: 0.08s; background: var(--accent-2); }
.landing-wave span:nth-child(6)  { height: 30px; animation-duration: 1.3s; animation-delay: 0.12s; }
.landing-wave span:nth-child(7)  { height: 45px; animation-duration: 1.0s; animation-delay: 0.02s; }
.landing-wave span:nth-child(8)  { height: 20px; animation-duration: 1.2s; animation-delay: 0.18s; background: var(--accent-3); }
.landing-wave span:nth-child(9)  { height: 35px; animation-duration: 1.1s; animation-delay: 0.07s; }
.landing-wave span:nth-child(10) { height: 50px; animation-duration: 0.8s; animation-delay: 0.14s; }
.landing-wave span:nth-child(11) { height: 38px; animation-duration: 1.3s; animation-delay: 0.03s; background: var(--accent-2); }
.landing-wave span:nth-child(12) { height: 22px; animation-duration: 1.0s; animation-delay: 0.16s; }
.landing-wave span:nth-child(13) { height: 42px; animation-duration: 1.1s; animation-delay: 0.09s; }
.landing-wave span:nth-child(14) { height: 28px; animation-duration: 1.4s; animation-delay: 0.11s; }
.landing-wave span:nth-child(15) { height: 48px; animation-duration: 0.9s; animation-delay: 0.06s; }
.landing-wave span:nth-child(16) { height: 18px; animation-duration: 1.2s; animation-delay: 0.13s; background: var(--accent-3); }
.landing-wave span:nth-child(17) { height: 32px; animation-duration: 1.0s; animation-delay: 0.04s; }
.landing-wave span:nth-child(18) { height: 45px; animation-duration: 1.3s; animation-delay: 0.17s; }
.landing-wave span:nth-child(19) { height: 25px; animation-duration: 1.1s; animation-delay: 0.01s; }
.landing-wave span:nth-child(20) { height: 15px; animation-duration: 1.4s; animation-delay: 0.19s; }

@keyframes wave-bar {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1); }
}

/* ── Hero ── */
.landing-hero {
    text-align: center;
    position: relative;
    z-index: 1;
}

.landing-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 1rem;
    border-radius: 16px;
    filter: drop-shadow(0 0 24px rgba(108, 99, 255, 0.35));
    animation: logo-pulse 3s ease-in-out infinite, logo-entrance 0.8s ease-out both;
}

@keyframes logo-pulse {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(108, 99, 255, 0.3)); transform: scale(1); }
    50%      { filter: drop-shadow(0 0 35px rgba(108, 99, 255, 0.5)); transform: scale(1.04); }
}

@keyframes logo-entrance {
    from { opacity: 0; transform: scale(0.5) rotate(-15deg); }
    to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.landing-title {
    font-size: 3.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.6rem;
    animation: title-entrance 0.8s ease-out 0.2s both;
}

@keyframes title-entrance {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.landing-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
    animation: subtitle-entrance 0.8s ease-out 0.4s both;
}

@keyframes subtitle-entrance {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero Logo Image ── */
.landing-hero-img {
    margin-top: 2rem;
    position: relative;
    width: 100%;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    animation: hero-img-entrance 1s ease-out 0.6s both;
    transition: transform 0.4s ease, filter 0.4s ease;
}

.landing-hero-img:hover {
    transform: translateY(-4px) scale(1.03);
    filter: drop-shadow(0 12px 40px rgba(108, 99, 255, 0.35));
}

.hero-img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.3));
    transition: filter 0.4s ease;
    opacity: 0.15;
}

@keyframes hero-img-entrance {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── CTA Groups ── */
.landing-cta-groups {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    max-width: 800px;
    margin: 0 auto;
}

.landing-cta-group {
    animation: cta-slide-in 0.5s ease-out both;
}
.landing-cta-group:nth-child(1) { animation-delay: 0.1s; }
.landing-cta-group:nth-child(2) { animation-delay: 0.2s; }
.landing-cta-group:nth-child(3) { animation-delay: 0.3s; }
.landing-cta-group:nth-child(4) { animation-delay: 0.4s; }

@keyframes cta-slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.landing-cta-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
    padding-left: 0.2rem;
}

.landing-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.landing-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.2s ease;
}

.landing-cta:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(108, 99, 255, 0.15);
}

.landing-cta:active {
    transform: translateY(0);
}

.landing-cta-icon {
    font-size: 1.15rem;
    line-height: 1;
}

@media (max-width: 600px) {
    .landing-title { font-size: 1.8rem; }
    .landing-cta-row { gap: 0.4rem; }
    .landing-cta { padding: 0.5rem 0.8rem; font-size: 0.82rem; }
    .landing-logo { width: 80px; height: 80px; }
    .landing-hero-img { max-width: 100%; margin-top: 1.5rem; }
}

/* ── Header Brand Logo ── */
.logo-icon {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    transition: transform 0.3s ease, filter 0.3s ease;
    filter: drop-shadow(0 0 4px rgba(108, 99, 255, 0.25));
}

.header-brand:hover .logo-icon {
    transform: rotate(-8deg) scale(1.1);
    filter: drop-shadow(0 0 8px rgba(108, 99, 255, 0.4));
}

/* ── Footer Brand Logo ── */
.footer-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
    filter: drop-shadow(0 0 3px rgba(108, 99, 255, 0.2));
}

.section-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0;
}

.section-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    max-width: 680px;
    width: 100%;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

.btn-danger {
    color: var(--danger);
    border-color: rgba(255,107,107,0.3);
}

.btn-danger:hover {
    background: rgba(255,107,107,0.1);
}

.btn-accent {
    color: var(--accent);
    border-color: rgba(99,179,237,0.3);
}

.btn-accent:hover {
    background: rgba(99,179,237,0.15);
}

/* ── Chord Palette ───────────────────────────────────────────── */
.chord-palette {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.chord-palette h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.current-key-label {
    color: var(--accent-light);
}

.chord-palette h4 {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
    margin: 1rem 0 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.palette-chords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chord-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0.9rem;
    min-width: 72px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    color: var(--text);
}

.chord-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108,99,255,0.15);
}

.chord-btn .chord-roman {
    font-size: 0.95rem;
    font-weight: 600;
}

.chord-btn .chord-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.chord-btn.minor .chord-roman { color: var(--accent-2); }
.chord-btn.diminished .chord-roman { color: var(--warning); }
.chord-btn.augmented .chord-roman { color: var(--danger); }
.chord-btn.dominant .chord-roman { color: var(--accent-3); }

/* ── Progression Timeline ────────────────────────────────────── */
.progression-timeline-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tempo-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.tempo-control input {
    width: 56px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.3rem;
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: center;
    outline: none;
}

.tempo-control input:focus {
    border-color: var(--accent);
}

.progression-timeline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 72px;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    transition: border-color var(--transition);
}

.progression-timeline:empty,
.timeline-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
    width: 100%;
    min-height: 56px;
}

.timeline-chord {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 0.6rem 0.85rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    position: relative;
    cursor: pointer;
    transition: all var(--transition);
}

.timeline-chord:hover {
    border-color: var(--accent);
}

.timeline-chord.playing {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 16px rgba(108,99,255,0.3);
    transform: scale(1.05);
}

.timeline-chord .tc-roman {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

.timeline-chord .tc-name {
    font-size: 1rem;
    font-weight: 600;
}

.timeline-chord .tc-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    border: none;
    font-size: 0.7rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.timeline-chord:hover .tc-remove {
    display: flex;
}

/* ── Drag & Drop ─────────────────────────────────────────────── */
.timeline-chord[draggable="true"] {
    cursor: grab;
}

.timeline-chord.dragging {
    opacity: 0.35;
    transform: scale(0.95);
}

.timeline-chord.drag-over-left {
    box-shadow: -3px 0 0 0 var(--accent);
}

.timeline-chord.drag-over-right {
    box-shadow: 3px 0 0 0 var(--accent);
}

.progression-timeline.drag-active {
    border-color: var(--accent);
}

/* ── Theory Panel ────────────────────────────────────────────── */
.theory-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.theory-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--accent-light);
}

.theory-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.theory-content strong {
    color: var(--text);
}

.theory-content em {
    color: var(--accent-3);
    font-style: normal;
    font-family: var(--font-mono);
    font-size: 0.85em;
}

.theory-content p {
    margin-bottom: 0.6rem;
}

.theory-content ul {
    list-style: none;
    padding: 0;
}

.theory-content li {
    padding: 0.2rem 0;
    padding-left: 1.2rem;
    position: relative;
}

.theory-content li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* ── Common Progressions ─────────────────────────────────────── */
.common-progressions {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.common-progressions h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.common-progressions .hint {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 400;
}

.common-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.6rem;
}

.common-prog-card {
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.common-prog-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.common-prog-card .cp-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.common-prog-card .cp-genre {
    font-size: 0.75rem;
    color: var(--accent-3);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.common-prog-card .cp-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ── Reference sections – teacher mascot ─────────────────────── */
#section-scales,
#section-reference,
#section-progression,
#section-circle,
#section-metronome {
    position: relative;
}

#section-scales::after,
#section-reference::after,
#section-progression::after,
#section-circle::after,
#section-metronome::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 200px;
    height: 200px;
    background: url('../images/teacherDark.png') no-repeat top right;
    background-size: contain;
    opacity: 0.06;
    pointer-events: none;
}

html.light-theme #section-scales::after,
html.light-theme #section-reference::after,
html.light-theme #section-progression::after,
html.light-theme #section-circle::after,
html.light-theme #section-metronome::after {
    background-image: url('../images/teacherWhite.png');
}

@media (max-width: 768px) {
    #section-scales::after,
    #section-reference::after,
    #section-progression::after,
    #section-circle::after,
    #section-metronome::after {
        display: none;
    }
}

/* ── Scale Explorer ──────────────────────────────────────────── */
.scale-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.scale-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.scale-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.scale-display {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.scale-notes-display {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.scale-note {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.scale-note.root {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.scale-note .sn-name {
    font-size: 1rem;
    font-weight: 600;
}

.scale-note .sn-degree {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.scale-note .sn-interval {
    font-size: 0.68rem;
    color: var(--accent-3);
    font-family: var(--font-mono);
}

.scale-intervals {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.step-badge {
    padding: 0.15rem 0.5rem;
    background: var(--bg-hover);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.step-badge.whole { color: var(--accent-light); }
.step-badge.half { color: var(--warning); }

.scale-theory {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.scale-theory strong { color: var(--text); }
.scale-theory em { color: var(--accent-3); font-style: normal; font-family: var(--font-mono); font-size: 0.85em; }

.play-scale-btn {
    margin-top: 0.8rem;
}

/* Modes */
.modes-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
}

.modes-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--text-muted);
}

.modes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.mode-card {
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.mode-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.mode-card.current {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.mode-card .mc-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.mode-card .mc-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Circle of Fifths workspace ──────────────────────────────── */
.circle-workspace {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

.circle-info-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    position: sticky;
    top: 80px;
}

.circle-info-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--accent-light);
}

#circleInfoContent {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
}

#circleInfoContent strong { color: var(--text); }

.info-chords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    margin: 0.6rem 0;
}

.info-chord-item {
    padding: 0.3rem 0.5rem;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.info-chord-item:hover {
    background: var(--bg-hover);
    color: var(--accent-light);
}

.info-chord-item .icr {
    color: var(--text-dim);
    font-size: 0.72rem;
}

/* ── Chord Reference ─────────────────────────────────────────── */
.reference-workspace {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reference-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.reference-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.chord-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.5rem;
}

.chord-ref-card {
    padding: 0.7rem 0.9rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.chord-ref-card:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.chord-ref-card.active {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.chord-ref-card .crc-symbol {
    font-size: 1.05rem;
    font-weight: 600;
}

.chord-ref-card .crc-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.chord-ref-card .crc-cat {
    font-size: 0.65rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chord-detail-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.chord-detail-panel strong { color: var(--text); }
.chord-detail-panel em { color: var(--accent-3); font-style: normal; font-family: var(--font-mono); font-size: 0.85em; }

.chord-detail-notes {
    display: flex;
    gap: 0.5rem;
    margin: 0.6rem 0;
    flex-wrap: wrap;
}

.chord-detail-note {
    padding: 0.3rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.chord-detail-note.root-note {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ── Piano (shared container) ────────────────────────────────── */
.piano-container {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
}

/* ══════════════════════════════════════════════════════════════
   Learn Theory Section
   ══════════════════════════════════════════════════════════════ */

.learn-workspace {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Article Cards */
.theory-article {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition);
}

.theory-article:hover {
    border-color: var(--border-light);
}

.ta-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.ta-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.ta-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.ta-body {
    padding: 1.5rem;
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text-muted);
}

.ta-body > p { margin-bottom: 0.8rem; }
.ta-body strong { color: var(--text); }
.ta-body em {
    color: var(--accent-3);
    font-style: italic;
}

.ta-body h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 1.4rem 0 0.6rem;
}

.ta-body h4:first-child { margin-top: 0; }

.ta-body ul, .ta-body ol {
    padding-left: 1.4rem;
    margin-bottom: 0.8rem;
}

.ta-body li {
    margin-bottom: 0.35rem;
}

.ta-body li strong { color: var(--accent-light); }

/* Note strip (chromatic) */
.ta-note-strip {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 1rem;
}

.ta-note-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 36px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all var(--transition);
    cursor: pointer;
}

.ta-note-chip.white-note {
    background: var(--bg-card);
    color: var(--text);
}

.ta-note-chip.black-note {
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 0.72rem;
}

.ta-note-chip:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Interval table */
.ta-interval-table {
    display: grid;
    gap: 0.3rem;
    margin: 0.8rem 0;
    font-size: 0.82rem;
}

.ta-it-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 0.8fr 1.2fr;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    background: var(--bg-card);
    border-radius: 6px;
    align-items: center;
}

.ta-it-name { font-weight: 600; color: var(--text); }
.ta-it-semi { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-3); }
.ta-it-ex   { font-family: var(--font-mono); font-size: 0.78rem; }
.ta-it-feel { color: var(--text-dim); font-style: italic; font-size: 0.78rem; }

/* Highlight box */
.ta-highlight-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.1rem 1.3rem;
    margin: 1rem 0;
}

.ta-highlight-box.ta-minor {
    border-left-color: var(--accent-2);
}

.ta-highlight-box h4 {
    margin: 0 0 0.5rem !important;
    color: var(--accent-light);
}

.ta-highlight-box.ta-minor h4 {
    color: var(--accent-2);
}

.ta-highlight-box ul {
    margin-bottom: 0.5rem;
}

/* Pattern badge */
.ta-pattern {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-3);
    margin: 0.3rem 0 0.5rem;
    letter-spacing: 0.03em;
}

/* Scale list */
.ta-scale-list {
    list-style: none !important;
    padding-left: 0 !important;
}

.ta-scale-list li {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 0.4rem;
    border-left: 3px solid var(--border-light);
}

.ta-scale-list li strong {
    color: var(--accent-light);
}

/* Tips */
.ta-tip {
    padding: 0.6rem 0.9rem;
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-top: 1rem;
}

/* Mini piano for learn section */
.ta-mini-piano {
    margin: 0.8rem 0 0.4rem;
    padding: 0.6rem;
}

/* Chord examples */
.ta-chord-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.6rem;
    margin: 0.8rem 0 1rem;
}

.ta-chord-ex {
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    border-top: 3px solid var(--accent);
    text-align: center;
}

.ta-chord-ex.ta-chord-minor { border-top-color: var(--accent-2); }
.ta-chord-ex.ta-chord-dim { border-top-color: var(--warning); }

.ta-chord-ex-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.ta-chord-ex-notes {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-3);
    margin-bottom: 0.3rem;
}

.ta-chord-ex-formula {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-bottom: 0.3rem;
}

.ta-chord-ex-feel {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--text-muted);
}

/* Diatonic grid */
.ta-diatonic-grid {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 1rem;
}

.ta-diatonic-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.55rem 0.7rem;
    min-width: 64px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.ta-diatonic-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.ta-diatonic-item .tdi-roman {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent-light);
}

.ta-diatonic-item .tdi-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.ta-diatonic-item .tdi-quality {
    font-size: 0.62rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ta-diatonic-item.minor .tdi-roman { color: var(--accent-2); }
.ta-diatonic-item.dim .tdi-roman { color: var(--warning); }

/* Progression showcase */
.ta-prog-showcase {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin: 0.6rem 0 1.2rem;
}

.ta-prog-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
}

.ta-prog-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.ta-prog-numerals {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.15rem;
    font-family: var(--font-mono);
}

.ta-prog-key {
    font-size: 0.82rem;
    color: var(--accent-3);
    font-family: var(--font-mono);
    margin-bottom: 0.2rem;
}

.ta-prog-genre {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    background: var(--accent-glow);
    color: var(--accent-light);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.ta-prog-item p {
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.ta-prog-songs {
    font-size: 0.78rem !important;
    color: var(--text-dim);
    font-style: italic;
}

/* Circle of Fifths uses */
.ta-cof-uses {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.6rem;
    margin: 0.8rem 0;
}

.ta-cof-use {
    padding: 0.9rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.ta-cof-use h5 {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.ta-cof-use p {
    font-size: 0.82rem;
    margin: 0;
}

/* Circle diagram in learn section */
.ta-circle-diagram-wrapper {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* Flow list */
.ta-flow-list {
    counter-reset: flow;
    list-style: none !important;
    padding-left: 0 !important;
}

.ta-flow-list li {
    counter-increment: flow;
    padding: 0.6rem 0.8rem 0.6rem 2.4rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 0.4rem;
    position: relative;
}

.ta-flow-list li::before {
    content: counter(flow);
    position: absolute;
    left: 0.8rem;
    top: 0.65rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cheat sheet grid */
.ta-cheat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.ta-cheat-item {
    padding: 0.5rem 0.75rem;
    background: var(--bg-hover);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.ta-cheat-label {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.ta-cheat-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-3);
}

/* ══════════════════════════════════════════════════════════════
   Music Production Section
   ══════════════════════════════════════════════════════════════ */

/* Sub-navigation tabs */
.prod-subnav,
.theory-subnav {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 0.4rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.prod-tab,
.theory-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.prod-tab:hover,
.theory-tab:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.prod-tab.active,
.theory-tab.active {
    color: #fff;
    background: var(--accent);
}

/* Panels */
.prod-panel,
.learn-tab-panel {
    display: none;
}

.prod-panel.active,
.learn-tab-panel.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Article base */
.prod-article {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Hero banner */
.prod-hero {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1.2rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.prod-hero-icon {
    font-size: 2.4rem;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: var(--radius);
}

.prod-hero h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.prod-hero p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.prod-hero strong { color: var(--text); }

/* Cards */
.prod-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.4rem;
}

.prod-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text);
}

.prod-card p {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.prod-card strong { color: var(--text); }
.prod-card em { color: var(--accent-3); font-style: italic; }

/* Grid layouts */
.prod-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .prod-grid-2 { grid-template-columns: 1fr; }
}

/* Lists */
.prod-list {
    padding-left: 1.2rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.prod-list li {
    margin-bottom: 0.35rem;
}

.prod-list li strong { color: var(--accent-light); }

.prod-steps {
    padding-left: 1.4rem;
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-muted);
    counter-reset: steps;
}

.prod-steps li {
    margin-bottom: 0.5rem;
}

.prod-steps li strong { color: var(--text); }

/* Tips */
.prod-tip {
    padding: 0.7rem 1rem;
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid rgba(78, 205, 196, 0.2);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.prod-tip strong { color: var(--text); }
.prod-tip em { color: var(--accent-3); font-style: italic; }

/* Keyboard shortcuts */
.prod-shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.prod-shortcut {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
    font-size: 0.84rem;
}

.prod-shortcut:nth-child(odd) { background: var(--bg-card); }

.prod-shortcut kbd {
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-light);
    min-width: 60px;
    text-align: center;
    white-space: nowrap;
}

.prod-shortcut span { color: var(--text-muted); }

/* Interface diagram */
.prod-diagram-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.prod-diagram-box {
    flex: 1;
    padding: 0.7rem;
    border-radius: var(--radius);
    border: 1px dashed var(--border-light);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}

.prod-diagram-box span {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-dim);
    margin-top: 0.2rem;
}

.pd-browser { border-color: var(--accent); background: rgba(108,99,255,0.06); }
.pd-main { border-color: var(--accent-3); background: rgba(78,205,196,0.06); flex: 2; }
.pd-detail { border-color: var(--accent-2); background: rgba(255,107,157,0.06); }

.prod-diagram-bar {
    padding: 0.4rem;
    background: var(--bg-card);
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
    color: var(--text-dim);
}

/* Track types */
.prod-track-types {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.prod-track-type {
    display: flex;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    align-items: flex-start;
}

.ptt-icon {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ptt-midi { background: rgba(108,99,255,0.15); }
.ptt-audio { background: rgba(78,205,196,0.15); }
.ptt-return { background: rgba(255,209,102,0.15); }

.prod-track-type strong {
    display: block;
    font-size: 0.9rem;
    color: var(--text);
    margin-bottom: 0.15rem;
}

.prod-track-type p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Session view grid mock */
.prod-session-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 3px;
    margin: 0.6rem 0;
    font-size: 0.8rem;
}

.psg-header {
    padding: 0.4rem 0.6rem;
    background: var(--bg-hover);
    font-weight: 600;
    text-align: center;
    color: var(--text);
    border-radius: 4px 4px 0 0;
}

.psg-header.psg-scene { font-size: 0.72rem; color: var(--text-dim); }

.psg-clip {
    padding: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-align: center;
    color: var(--accent-3);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.psg-clip.psg-empty {
    background: var(--bg);
    color: transparent;
}

.psg-scene-btn {
    padding: 0.5rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Song structure visual */
.prod-structure-visual {
    margin: 0.5rem 0;
}

.psv-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.psv-blocks {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.psv-block {
    padding: 0.5rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #fff;
    min-width: 60px;
    flex: 1;
}

.psv-block span {
    display: block;
    font-size: 0.62rem;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 0.1rem;
}

.psv-intro   { background: #5e5e80; }
.psv-verse   { background: #6c63ff; }
.psv-chorus  { background: #ff6b9d; }
.psv-bridge  { background: #4ecdc4; }
.psv-outro   { background: #5e5e80; }
.psv-build   { background: #ffd166; color: #333; }
.psv-drop    { background: #ff6b6b; }
.psv-break   { background: #4ecdc4; }

/* Instruments grid */
.prod-instruments-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 768px) {
    .prod-instruments-grid { grid-template-columns: 1fr; }
}

.prod-inst-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.pic-header {
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.pic-synth   { background: rgba(108,99,255,0.12); color: var(--accent-light); border-bottom: 2px solid var(--accent); }
.pic-sampler { background: rgba(78,205,196,0.12); color: var(--accent-3); border-bottom: 2px solid var(--accent-3); }
.pic-drums   { background: rgba(255,107,157,0.12); color: var(--accent-2); border-bottom: 2px solid var(--accent-2); }
.pic-keys    { background: rgba(255,209,102,0.12); color: var(--warning); border-bottom: 2px solid var(--warning); }

.pic-body {
    padding: 0.9rem 1rem;
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.pic-body p { margin-bottom: 0.4rem; }
.pic-body strong { color: var(--text); }

.pic-type {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-dim);
    font-weight: 600;
    margin-bottom: 0.3rem !important;
}

/* Signal chain */
.pic-chain {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.pic-step {
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 500;
}

/* ADSR visual */
.prod-adsr {
    display: flex;
    gap: 0.5rem;
    margin: 0.6rem 0;
}

.adsr-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    font-size: 0.78rem;
}

.adsr-bar {
    width: 100%;
    border-radius: 4px;
}

.adsr-a { height: 48px; background: linear-gradient(to top, transparent, var(--accent)); }
.adsr-d { height: 36px; background: linear-gradient(to bottom, var(--accent), var(--accent-3)); }
.adsr-s { height: 28px; background: var(--accent-3); }
.adsr-r { height: 28px; background: linear-gradient(to bottom, var(--accent-3), transparent); }

.adsr-stage strong { color: var(--text); font-size: 0.78rem; }
.adsr-stage span { color: var(--text-dim); font-size: 0.68rem; line-height: 1.3; }

/* Beat grid */
.prod-beat-grid {
    display: grid;
    grid-template-columns: 56px repeat(16, 1fr);
    gap: 2px;
    margin: 0.5rem 0;
    font-size: 0.72rem;
}

.pbg-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: var(--text-muted);
    padding-right: 0.4rem;
    justify-content: flex-end;
    font-size: 0.7rem;
}

.pbg-cell {
    height: 28px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0.8rem;
    transition: all var(--transition);
}

.pbg-cell.pbg-on {
    color: #fff;
    font-weight: 700;
}

.pbg-on.pbg-kick { background: var(--accent); border-color: var(--accent); }
.pbg-on.pbg-snare { background: var(--accent-2); border-color: var(--accent-2); }
.pbg-on:not(.pbg-kick):not(.pbg-snare) { background: var(--accent-3); border-color: var(--accent-3); }

.pbg-beat {
    text-align: center;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding-top: 0.15rem;
}

.pbg-label.pbg-beats { visibility: hidden; }

/* Effects grid */
.prod-effects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.prod-fx-card {
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.pfx-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    font-family: var(--font-mono);
}

.pfx-type {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--accent-3);
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.prod-fx-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.prod-fx-card em { color: var(--accent-3); font-style: normal; font-family: var(--font-mono); font-size: 0.78rem; }
.prod-fx-card strong { color: var(--text); }

/* Workflow steps */
.prod-workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.prod-wf-step {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    align-items: flex-start;
}

.wfs-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.wfs-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.wfs-body p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.wfs-body strong { color: var(--text); }
.wfs-body kbd {
    background: var(--bg-hover);
    border: 1px solid var(--border-light);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    color: var(--accent-light);
}

/* Frequency spectrum bands */
.prod-freq-spectrum {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.freq-band {
    display: grid;
    grid-template-columns: 120px 160px 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    border-left: 4px solid var(--border);
    background: var(--bg-surface);
    align-items: center;
    font-size: 0.84rem;
}

.freq-range {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-light);
    font-weight: 600;
}

.freq-name {
    font-weight: 700;
    color: var(--text);
}

.freq-desc {
    color: var(--text-muted);
    line-height: 1.5;
}

.freq-sub { border-left-color: #e74c3c; }
.freq-bass { border-left-color: #e67e22; }
.freq-lowmid { border-left-color: #f1c40f; }
.freq-mid { border-left-color: #2ecc71; }
.freq-himid { border-left-color: #3498db; }
.freq-pres { border-left-color: #9b59b6; }
.freq-air { border-left-color: #1abc9c; }

/* Filter cards */
.prod-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.prod-filter-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.pfl-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--accent-light);
    margin-bottom: 0.15rem;
}

.pfl-aka {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

.prod-filter-card p {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

.prod-filter-card strong { color: var(--text); }

/* Signal chain */
.pic-chain {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.5rem 0;
}

.pic-step {
    background: var(--accent);
    color: #fff;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 600;
}

/* Recipe grid */
.prod-recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.prod-recipe {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.8rem 1rem;
}

.pr-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.pr-steps {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.65;
}

/* Mistakes */
.prod-mistakes {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.3rem 0.6rem;
    font-size: 0.84rem;
    align-items: center;
}

.pm-dont {
    color: var(--danger);
    font-weight: 700;
    font-size: 1rem;
}

.pm-do {
    color: var(--success);
    font-weight: 700;
    font-size: 1rem;
}

.prod-mistake {
    color: var(--text-muted);
    padding: 0.25rem 0;
}

/* ── Song Analysis Cards ── */
.sa-song-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.sa-song-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.sa-song-card h4 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.sa-song-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 0.5rem;
}

.sa-genre-tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    margin-bottom: 0.4rem;
}

.sa-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    padding: 0.1rem 0;
}

.sa-detail strong {
    color: var(--text);
}

/* ── Genre Cards ── */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.75rem;
}

.genre-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    transition: border-color 0.2s;
}

.genre-card:hover {
    border-color: var(--accent);
}

.genre-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.genre-icon {
    font-size: 1.3rem;
}

.genre-header h4 {
    font-size: 1rem;
    color: var(--text);
    margin: 0;
}

.genre-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gd-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.5rem;
    font-size: 0.8rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--border);
}

.gd-row:last-child {
    border-bottom: none;
}

.gd-label {
    font-weight: 600;
    color: var(--accent-light);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gd-value {
    color: var(--text-muted);
    line-height: 1.5;
}

/* ── History Timeline ── */
.history-timeline {
    position: relative;
    padding-left: 2rem;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--accent-3), var(--accent-2));
    border-radius: 1px;
}

.ht-era {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.ht-era-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    position: relative;
    left: -2rem;
}

.ht-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg);
    box-shadow: 0 0 0 2px var(--accent);
    position: absolute;
    left: -2rem;
    top: 0.3rem;
    margin-left: 1px;
}

.ht-year {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-light);
    white-space: nowrap;
    position: absolute;
    left: -2rem;
    top: 1.5rem;
    transform: translateX(-50%);
    margin-left: 9px;
}

.ht-era-content {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-left: 1rem;
}

.ht-era-content h4 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.4rem;
}

.ht-era-content p {
    font-size: 0.84rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 0.5rem;
}

.ht-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.ht-tag {
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.ht-keypoint {
    font-size: 0.82rem;
    color: var(--accent-3);
    padding: 0.5rem 0.7rem;
    background: rgba(78, 205, 196, 0.08);
    border-left: 3px solid var(--accent-3);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: 0.5rem;
}

.ht-keypoint strong {
    color: var(--text);
}

/* ── Educational content wrapper ── */
.edu-content {
    max-width: 900px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .app-header {
        flex-wrap: nowrap;
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    .header-brand h1 {
        font-size: 0.95rem;
    }
    .header-nav {
        gap: 0.15rem;
        flex: 1;
        justify-content: flex-end;
    }
    .header-nav > .nav-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    .nav-dropdown-toggle {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    .nav-help-btn svg {
        width: 16px;
        height: 16px;
    }
    .theme-switcher {
        font-size: 0.8rem;
    }
    .lang-switcher {
        font-size: 0.7rem;
        gap: 0.15rem;
    }
    .nav-dropdown-menu {
        position: fixed;
        left: 1rem;
        right: 1rem;
        min-width: unset;
    }
    .circle-workspace {
        grid-template-columns: 1fr;
    }
    .app-main {
        padding: 1.5rem 1rem 3rem;
    }
    .freq-band {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

@media (max-width: 600px) {
    html { font-size: 14px; }
    .common-list {
        grid-template-columns: 1fr;
    }
    .chord-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}

/* ================================================================
   Add Track Modal
   ================================================================ */
.atm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: atmFadeIn 0.2s ease;
}
@keyframes atmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.atm-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: atmSlideUp 0.25s ease;
}
@keyframes atmSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.atm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
}
.atm-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}
.atm-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.atm-close:hover {
    color: var(--text);
    background: var(--bg-hover);
}
.atm-start-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.atm-start-bar input {
    width: 60px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}
.atm-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}
.atm-category {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: all var(--transition);
}
.atm-category:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}
.atm-icon {
    margin-bottom: 0.6rem;
    color: var(--accent-light);
}
.atm-icon svg {
    width: 48px;
    height: 48px;
}
.atm-category h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.atm-category p {
    margin: 0 0 0.8rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}
.atm-create-btn {
    display: block;
    width: 100%;
    padding: 0.55rem 0.7rem;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: #fff;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
.atm-create-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ================================================================
   Studio Controls Bar
   ================================================================ */
.studio-controls-bar {
    position: sticky;
    top: 0;
    z-index: 150;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 1rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
}
.scb-back-btn,
.scb-save-btn,
.scb-play-btn,
.scb-play-ch-btn,
.scb-rec-btn,
.scb-stop-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
}
.scb-back-btn:hover { border-color: var(--accent); color: var(--accent-light); }
.scb-save-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.scb-save-btn:hover { background: var(--accent-light); border-color: var(--accent-light); box-shadow: 0 0 8px var(--accent-glow); }
.scb-play-btn { background: #16a34a; border-color: #16a34a; color: #fff; }
.scb-play-btn:hover { background: #22c55e; border-color: #22c55e; }
.scb-play-ch-btn { background: #0d9488; border-color: #0d9488; color: #fff; }
.scb-play-ch-btn:hover { background: #14b8a6; border-color: #14b8a6; }
.scb-stop-btn { background: #525252; border-color: #525252; color: #fff; }
.scb-stop-btn:hover { background: #6b6b6b; border-color: #6b6b6b; }
.scb-rec-btn { background: var(--bg); border-color: var(--border); color: #dc2626; }
.scb-rec-btn:hover { background: #dc2626; border-color: #dc2626; color: #fff; }
.scb-rec-btn.recording { background: #dc2626; border-color: #dc2626; color: #fff; animation: scb-rec-pulse 1s ease-in-out infinite; }
.scb-rec-btn.counting-in { background: #f59e0b; border-color: #f59e0b; color: #fff; animation: scb-rec-pulse 0.5s ease-in-out infinite; }
@keyframes scb-rec-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.scb-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--danger);
}
.scb-clear-btn:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.scb-spacer { flex: 1; }

.scb-divider {
    width: 1px;
    height: 1.4rem;
    background: var(--border);
    margin: 0 0.15rem;
}

.scb-control {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}
.scb-control input[type="number"] {
    width: 52px;
    padding: 0.25rem 0.35rem;
    font-size: 0.78rem;
    font-family: var(--font);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-align: center;
}
.scb-control select {
    padding: 0.25rem 0.35rem;
    font-size: 0.78rem;
    font-family: var(--font);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
}
.scb-control input:disabled,
.scb-control select:disabled {
    opacity: 0.85;
    cursor: default;
    background: var(--bg-surface);
}
.scb-vol {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}
.scb-vol input[type="range"] {
    width: 70px;
    accent-color: var(--accent);
}
.scb-bpm-display {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    font-family: var(--font-mono);
    white-space: nowrap;
}
.scb-readonly {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.2rem 0.4rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: inline-block;
    min-width: 2rem;
    text-align: center;
}

/* ================================================================
   Open Instrument / Close Instrument buttons
   ================================================================ */
.open-instrument-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    font-family: var(--font);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-light);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.open-instrument-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.open-instrument-btn svg { flex-shrink: 0; }

.close-instrument-bar {
    display: flex;
    justify-content: flex-end;
    padding: 0.4rem 0.5rem;
}

.close-instrument-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    margin-left: auto;
}
.close-instrument-btn:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

/* Keep old mode-tabs for backwards compat but they're no longer used in grid sections */
.mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border);
}
.mode-tab {
    padding: 0.5rem 1.2rem;
    font-family: var(--font);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
}
.mode-tab:hover {
    color: var(--text);
}
.mode-tab.active {
    color: var(--accent-light);
    border-bottom-color: var(--accent);
}

/* ================================================================
   Split Instrument View (grid + instrument visible together)
   ================================================================ */
.section.split-instrument {
    display: block !important;
    border-top: 2px solid var(--accent);
    margin-top: 0;
    padding-top: 0.5rem;
}
.section.split-instrument > .section-header {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
}
.section.split-instrument > .section-header h2 {
    font-size: 0.85rem;
    margin: 0;
}
/* Hide the open-instrument btn inside the split instrument section */
.section.split-instrument .open-instrument-btn {
    display: none;
}

/* Guitar diagrams in chord grid */
.cg-guitar-diagrams {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

/* ================================================================
   Collapsible Preset Panels
   ================================================================ */
.preset-collapse {
    margin-top: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
}
.preset-collapse summary {
    padding: 0.5rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    list-style: none;
}
.preset-collapse summary::before {
    content: '▸ ';
}
.preset-collapse[open] summary::before {
    content: '▾ ';
}
.preset-collapse > :not(summary) {
    padding: 0.5rem 0.75rem;
}

/* Snap label in controls bar */
.scb-snap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}
.scb-snap input[type="checkbox"] {
    accent-color: var(--accent);
}

/* Snap-disabled rows: dim out-of-scale when snap is on */
.snap-disabled {
    opacity: 0.25;
    pointer-events: none;
}

/* Grid is always editable */
.studio-snap-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    margin-left: 0.5rem;
}
.studio-snap-label input[type="checkbox"] {
    accent-color: var(--accent);
}

/* ── Note Duration / Cell Spanning (synth & bass grids) ── */
.note-start {
    position: relative;
}
.note-hold {
    position: relative;
}

/* ── Step Count Selector — REMOVED, replaced by expand button ── */

/* ── Grid Expand Button ── */
.grid-expand-wrap {
    position: relative;
}
.grid-expand-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 48px;
    background: var(--accent);
    border: 2px solid var(--accent-light);
    border-left: none;
    border-radius: 0 var(--radius) var(--radius) 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 15;
    transition: all var(--transition);
    opacity: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.25);
    pointer-events: auto;
}
.grid-expand-btn:hover {
    opacity: 1;
    width: 34px;
    background: var(--accent-light);
}
.grid-expand-btn svg { pointer-events: none; }
.grid-expand-btn .expand-label {
    position: absolute;
    right: 36px;
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.15rem 0.4rem;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
}
.grid-expand-btn:hover .expand-label {
    opacity: 1;
}

/* ── Grid Minimap ── */
.grid-minimap {
    height: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    display: none; /* shown by JS when steps > 16 */
}
.grid-minimap.visible {
    display: block;
}
.grid-minimap-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: stretch;
}
.grid-minimap-cell {
    flex: 1;
    border-right: 1px solid var(--border);
    transition: background 0.1s;
}
.grid-minimap-cell.has-notes {
    background: var(--accent);
    opacity: 0.6;
}
.grid-minimap-cell:nth-child(4n+1) {
    border-left: 1px solid rgba(255,255,255,0.08);
}
.grid-minimap-viewport {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid var(--accent-light);
    border-radius: 2px;
    pointer-events: none;
    transition: left 0.1s ease;
}
.grid-minimap-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--danger);
    z-index: 2;
    pointer-events: none;
    transition: left 0.05s linear;
}

.note-start.note-held {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}
.note-hold {
    border-radius: 0;
    border-left: none !important;
    opacity: 0.85;
}
.note-hold + .synth-cell:not(.note-hold),
.note-hold + .bass-cell:not(.note-hold) {
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
}
.note-resize-handle {
    position: absolute;
    right: -2px;
    top: 0;
    bottom: 0;
    width: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0 3px 3px 0;
    cursor: ew-resize;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.12s;
    pointer-events: auto;
    user-select: none;
    line-height: 1;
}
.note-start:hover .note-resize-handle,
.note-hold:hover .note-resize-handle,
.note-resize-handle:hover,
.note-resize-handle.dragging {
    opacity: 1;
}
.note-resize-handle:active,
.note-resize-handle.dragging {
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
}

/* ══════════════════════════════════════════════════════════════
   Vertical Minimap — shows note density per row on the left
   ══════════════════════════════════════════════════════════════ */
.grid-vminimap {
    width: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    position: relative;
    cursor: pointer;
    overflow: hidden;
    display: none; /* shown by JS */
    flex-shrink: 0;
}
.grid-vminimap.visible {
    display: block;
}
.grid-vminimap-fill {
    position: absolute;
    top: 0; left: 0; right: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.grid-vminimap-cell {
    flex: 1;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.grid-vminimap-cell.has-notes {
    background: var(--accent);
    opacity: 0.6;
}
.grid-vminimap-cell:nth-child(12n+1) {
    border-top: 1px solid rgba(255,255,255,0.08);
}
.grid-vminimap-viewport {
    position: absolute;
    left: 0; right: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid var(--accent-light);
    border-radius: 2px;
    pointer-events: none;
    transition: top 0.1s ease;
}

/* ══════════════════════════════════════════════════════════════
   Vertical Expand Arrows — octave up/down on hover
   ══════════════════════════════════════════════════════════════ */
.grid-vexpand-zone {
    position: absolute;
    left: 70px; right: 0;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 14;
    pointer-events: none;
}
.grid-vexpand-zone.top { top: 20px; }
.grid-vexpand-zone.bottom { bottom: 0; }
.grid-vexpand-btn {
    pointer-events: auto;
    width: 36px;
    height: 28px;
    background: var(--accent);
    border: 2px solid var(--accent-light);
    border-radius: var(--radius);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    transition: opacity 0.2s, transform 0.2s, background 0.2s;
}
.grid-vexpand-btn:hover {
    opacity: 1;
    transform: scale(1.1);
    background: var(--accent-light);
}
.grid-vexpand-btn svg { pointer-events: none; }

/* ══════════════════════════════════════════════════════════════
   Loop Region Markers — draggable start/end lines on the grid
   ══════════════════════════════════════════════════════════════ */
.grid-loop-overlay {
    position: absolute;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 12;
    display: none;
    /* Width, height, and left set by JS to match grid content */
}
.grid-loop-overlay.active {
    display: block;
}
.grid-loop-region {
    position: absolute;
    top: 0; bottom: 0;
    background: rgba(99, 102, 241, 0.06);
    border-left: 2px solid var(--accent);
    border-right: 2px solid var(--accent);
    pointer-events: none;
}
.grid-loop-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 12px;
    cursor: ew-resize;
    pointer-events: auto;
    z-index: 13;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2px;
}
.grid-loop-handle.start {
    left: -6px;
    border-radius: 4px 0 0 4px;
}
.grid-loop-handle.end {
    right: -6px;
    border-radius: 0 4px 4px 0;
}
.grid-loop-handle-bar {
    width: 4px;
    height: 18px;
    background: var(--accent);
    border-radius: 2px;
    opacity: 0.6;
    transition: opacity 0.15s, background 0.15s;
}
.grid-loop-handle:hover .grid-loop-handle-bar {
    opacity: 1;
    background: var(--accent-light);
    width: 6px;
}
.loop-btn.active {
    background: var(--accent) !important;
    border-color: var(--accent-light) !important;
    color: #fff !important;
}

/* ================================================================
   Help Page
   ================================================================ */
.help-content {
    max-width: 780px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 0 0 40px;
}

.help-block h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.help-block p {
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--text-dim);
}

.help-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.help-block li {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-dim);
    padding-left: 18px;
    position: relative;
}

.help-block li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--accent, #7c6fe0);
    font-weight: 700;
}

.help-block strong {
    color: var(--text);
}

.help-block code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ================================================================
   Footer
   ================================================================ */
.app-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-surface);
    padding: 2rem 2rem 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    text-align: center;
    margin-top: 3rem;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
    margin: 0.3rem 0;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: var(--radius);
    background: var(--accent-glow);
    transition: background var(--transition), color var(--transition);
}

.footer-link:hover {
    background: var(--accent);
    color: #fff;
}

.footer-link svg {
    flex-shrink: 0;
}

.footer-copy {
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 0.3rem;
}

/* (Audio Visualizer styles moved to legacy/visualizer/visualizer.css) */

/* ================================================================
   Mobile Bottom Navigation — disabled (using header nav instead)
   ================================================================ */
.mobile-bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    /* Larger touch targets for grid cells on mobile */
    .beat-cell,
    .synth-cell,
    .bass-cell {
        min-height: 28px;
        min-width: 28px;
    }

    /* Make buttons easier to tap */
    .btn,
    .tp-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Studio controls bar — compact layout on mobile */
    .studio-controls-bar {
        gap: 0.35rem;
        padding: 0.35rem 0.5rem;
        flex-wrap: wrap;
    }
    .studio-controls-bar .scb-divider {
        display: none;
    }
    .studio-controls-bar .scb-control {
        font-size: 0.65rem;
    }
    .studio-controls-bar .scb-control input[type="number"],
    .studio-controls-bar .scb-control select {
        font-size: 0.7rem;
        padding: 0.2rem 0.25rem;
        width: 46px;
    }
    .studio-controls-bar .scb-vol input[type="range"] {
        width: 50px;
    }
    .scb-back-btn span,
    .scb-save-btn span,
    .scb-play-btn span,
    .scb-play-ch-btn span,
    .scb-rec-btn span,
    .scb-stop-btn span {
        display: none;
    }
    .scb-back-btn,
    .scb-save-btn,
    .scb-play-btn,
    .scb-play-ch-btn,
    .scb-rec-btn,
    .scb-stop-btn {
        padding: 0.35rem;
        min-width: 34px;
        min-height: 34px;
        justify-content: center;
    }

    /* Mode tabs smaller on mobile */
    .mode-tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}
