/* ==========================================================================
   Maestro Academy design system — same look and feel as the Playtime site
   (MusicUtil.Web): warm charcoal surfaces, coral/clay accent, cream text.
   Palette mirrors the app's Resources/Styles/Colors.xaml exactly. Dark-only.
   ========================================================================== */

:root {
    /* Brand */
    --primary: #D97757;
    --primary-dark: #C4623F;
    --primary-soft: #3A2A22;
    --secondary: #C79A6E;
    --tertiary: #E0A458;
    --teal: #5FB0A4;
    --success: #7FA97F;
    --danger: #E06A5B;

    /* Surfaces */
    --bg: #1B1A18;
    --surface: #262624;
    --surface-elevated: #302F2C;
    --outline: #3C3A36;

    /* Text */
    --text: #F4F2EC;
    --text-muted: #A8A199;

    --radius: 16px;
    --radius-sm: 10px;
    --container: 1100px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--tertiary); }

[tabindex="-1"]:focus { outline: none; }

h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; }
p  { margin: 0 0 1em; }

.muted { color: var(--text-muted); }
.accent { color: var(--primary); }

/* --------------------------------------------------------------------------
   App chrome: sticky header + main + footer (Playtime site pattern)
   -------------------------------------------------------------------------- */

/* Donation banner (js/donate.js shows/snoozes it) */
.donate-banner[hidden] { display: none; }

.donate-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 8px 40px 8px 16px;
    position: relative;
    background: linear-gradient(90deg, #6a4a12, #8a5b16 50%, #6a4a12);
    color: #ffe9b8;
    font-size: .92em;
    border-bottom: 1px solid #a8770f;
}

.donate-cta {
    background: #ffd700;
    color: #17130f;
    font-weight: 800;
    border-radius: 999px;
    padding: 4px 14px;
    text-decoration: none;
    white-space: nowrap;
}

.donate-cta:hover { transform: scale(1.05); }

.donate-close {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #ffe9b8;
    font-size: 1.05em;
    cursor: pointer;
    padding: 4px 8px;
}

.donate-close:hover { color: #fff; }

/* Section banners: no confusion about Classroom vs Individual Pathways. */
.section-banner { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  border-radius: 12px; padding: 8px 14px; margin-bottom: 14px; font-size: .92em; }
.section-banner a { font-weight: 700; white-space: nowrap; }
.section-banner.pathways { background: rgba(95, 140, 217, .16); border: 1px solid rgba(95, 140, 217, .45); }
.section-banner.classroom { background: rgba(217, 119, 87, .16); border: 1px solid rgba(217, 119, 87, .45); }

.donate-page { max-width: 720px; margin: 0 auto; }
.donate-page .rush-panel { margin-top: 16px; text-align: left; }
.donate-lede { font-size: 1.05em; }
.donate-list { list-style: none; padding-left: 0; }
.donate-list li { margin: 10px 0; }
.donate-page .big-button { display: inline-block; margin-top: 18px; font-size: 1.1em; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(27, 26, 24, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--outline);
}

.nav-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: var(--container);
    margin: 0 auto;
    padding: 10px 24px;
    position: relative;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.15rem; white-space: nowrap; flex-shrink: 0; }
.brand:hover { color: var(--text); }
.brand img { width: 44px; height: 44px; }

/* Links sit right of the brand and, when they must wrap, wrap as tidy
   right-aligned rows instead of crowding into the logo. */
.nav-links { display: flex; gap: 6px 14px; margin-left: auto; align-items: center;
    flex-wrap: wrap; justify-content: flex-end; }
.nav-links a { color: var(--text-muted); font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links form { margin: 0; }
.logout-button {
    background: none; border: none; color: var(--text-muted); font: inherit;
    font-weight: 600; font-size: 0.95rem; cursor: pointer; padding: 0;
}
.logout-button:hover { color: var(--text); }

.nav-toggle { display: none; }
.nav-toggle-label { display: none; margin-left: auto; cursor: pointer; padding: 6px; }
.nav-toggle-label span {
    display: block; width: 24px; height: 2.5px; border-radius: 2px;
    background: var(--text); margin: 5px 0;
}

@media (max-width: 1120px) {
    .nav-toggle-label { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--outline);
        padding: 8px 0;
    }
    .nav-links a, .nav-links form { padding: 11px 26px; }
    .nav-toggle:checked ~ .nav-links { display: flex; }
}

main.app-main {
    max-width: var(--container);
    margin: 0 auto;
    padding: 28px 24px 60px;
    min-height: calc(100vh - 210px);
}

.site-footer {
    border-top: 1px solid var(--outline);
    padding: 26px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.site-footer .container { max-width: var(--container); margin: 0 auto; padding: 0 24px;
    display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Components (Playtime design system)
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: 26px;
}

.pill {
    display: inline-block;
    background: var(--primary-soft);
    border: 1px solid var(--primary);
    color: var(--text);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.85rem;
    font-weight: 600;
}

button.primary, a.primary.button, .btn-primary {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    text-decoration: none;
}
button.primary:hover:not(:disabled), a.primary.button:hover { background: var(--primary-dark); color: #fff; }
button.primary:disabled { opacity: .45; cursor: default; }

a.button, .btn-ghost {
    display: inline-block;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--outline);
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
}
a.button:hover, .btn-ghost:hover { border-color: var(--primary); color: var(--text); }

/* Tiles (dashboard/link grids) — Playtime cards that lift on hover */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.tile {
    display: flex; flex-direction: column; gap: 4px;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: 22px;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}
a.tile:hover { border-color: var(--primary); transform: translateY(-2px); color: var(--text); }
.tile span { font-size: 30px; line-height: 1.2; }
.tile b { font-size: 1.05rem; }
.tile small { color: var(--text-muted); }
.tile-featured { border-color: var(--primary); background: linear-gradient(120deg, var(--primary-soft), var(--surface)); }
.tile-soon { opacity: .55; }

.join-code {
    font-size: 1.1em; letter-spacing: 2px; background: var(--primary-soft);
    border: 1px solid var(--primary); color: var(--text); padding: 1px 8px; border-radius: 8px;
}

/* --------------------------------------------------------------------------
   Forms & auth cards
   -------------------------------------------------------------------------- */

.auth-card {
    max-width: 440px;
    margin: 40px auto;
    background: var(--surface);
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    padding: 30px;
}
.auth-card label { display: block; margin: 14px 0 5px; font-weight: 700; font-size: 0.95rem; }

/* "Continue with …" social sign-in buttons + the or-divider. */
.oauth-row { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.oauth-btn { display: flex; align-items: center; justify-content: center; gap: 10px;
    text-align: center; padding: 11px 16px; border-radius: 10px;
    font-weight: 700; text-decoration: none; border: 1px solid var(--outline); }
/* Brand marks sit at text size; the Apple glyph inherits the button's color,
   the Google G keeps its own four fixed brand colors. */
.oauth-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.oauth-btn.apple { background: #000; color: #fff; border-color: #000; }
.oauth-btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.oauth-btn:hover { filter: brightness(1.08); }
.oauth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0 4px;
    color: var(--text-muted); font-size: 0.9rem; }
.oauth-divider::before, .oauth-divider::after { content: ""; flex: 1; height: 1px; background: var(--outline); }
.auth-card input, .auth-card select {
    width: 100%;
    background: var(--surface-elevated);
    border: 1px solid var(--outline);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 14px;
    font-size: 1rem;
    font-family: var(--font);
}
.auth-card input:focus, .auth-card select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
    border-color: var(--primary);
}
.auth-card .hint { color: var(--text-muted); font-size: .92em; }
.auth-card .error { color: var(--danger); }
/* Radio rows (onboarding's Student/Teacher choice): the dot sits beside its
   label instead of inheriting the full-width text-input treatment. */
.auth-card label.radio {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-weight: 500;
    white-space: nowrap; /* keep the checkbox and its label on one line */
    cursor: pointer;
}
/* Checkboxes and radios sit at their natural size beside the label, instead of
   inheriting the full-width, bordered text-input treatment above. */
.auth-card input[type="radio"],
.auth-card input[type="checkbox"] {
    width: auto;
    flex: 0 0 auto;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
}
.auth-card .alt { margin-top: 16px; font-size: .92em; color: var(--text-muted); }
.auth-card button.primary { margin-top: 16px; }

.error { color: var(--danger); }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.inline-form input, .inline-form select {
    background: var(--surface-elevated); border: 1px solid var(--outline);
    border-radius: var(--radius-sm); color: var(--text); padding: 10px 12px; font-family: var(--font);
}
.inline-form button.primary { margin-top: 0; }

/* --------------------------------------------------------------------------
   Accordion (collapsible section — native <details>, no JS)
   -------------------------------------------------------------------------- */

.acc {
    border: 1px solid var(--outline);
    border-radius: var(--radius);
    background: var(--surface);
    margin-top: 12px;
    overflow: hidden;
}
.acc > summary {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    user-select: none;
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after {
    content: "▾";
    margin-left: auto;
    color: var(--text-muted);
    transition: transform .15s ease;
}
.acc[open] > summary::after { transform: rotate(180deg); }
.acc > summary:hover { background: var(--surface-elevated); }
.acc > summary small { font-weight: 500; color: var(--text-muted); }
.acc-body { padding: 4px 18px 18px; border-top: 1px solid var(--outline); }

/* Form controls inside a panel — the title/brief fields were browser defaults. */
.acc-body > label { display: block; margin: 14px 0 5px; font-weight: 600; }
.acc-body > input[type="text"], .acc-body > input[type="email"],
.acc-body > input[type="password"], .acc-body > input:not([type]),
.acc-body > select, .acc-body > textarea {
    width: 100%; max-width: 480px; box-sizing: border-box;
    padding: 10px 12px;
    background: var(--surface-elevated); border: 1px solid var(--outline);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: var(--font); font-size: 1rem;
}
.acc-body > textarea { max-width: 100%; resize: vertical; }
.acc-body :focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.acc-body > input[type="range"] { display: block; width: 100%; max-width: 320px; accent-color: var(--primary); }
.acc-body .inline-form input[type="range"] { width: 160px; accent-color: var(--primary); }
.acc-body > button.primary { display: block; margin-top: 16px; }
.acc-body > .inline-form { margin-top: 16px; }
.acc-body .tier-row { margin-bottom: 4px; }

/* Nested: a question inside the review list — lighter, tighter. */
.acc.acc-sub { border-radius: var(--radius-sm); margin-top: 8px; background: var(--surface-elevated); }
.acc.acc-sub > summary { padding: 10px 14px; font-weight: 600; gap: 8px; }
.acc.acc-sub .acc-body { padding: 4px 14px 14px; }

/* Step heading: numbered rail above each stage of a workflow. */
.step-head { display: flex; align-items: baseline; gap: 10px; margin: 28px 0 0; }
.step-head .step-n {
    flex: 0 0 auto;
    width: 26px; height: 26px; line-height: 26px; text-align: center;
    border-radius: 50%; background: var(--primary-soft); border: 1px solid var(--primary);
    color: var(--text); font-size: .82rem; font-weight: 700;
}
.step-head h2 { margin: 0; }
.step-head .step-note { color: var(--text-muted); font-size: .9rem; }

/* --------------------------------------------------------------------------
   Landing (hero like the Playtime site)
   -------------------------------------------------------------------------- */

.landing { text-align: center; padding: 44px 0 20px;
    background:
        radial-gradient(1100px 480px at 15% -10%, rgba(217, 119, 87, 0.16), transparent 60%),
        radial-gradient(900px 420px at 95% 10%, rgba(95, 176, 164, 0.10), transparent 55%);
    border-radius: var(--radius); }
.landing .tagline { font-size: clamp(1.05rem, 2.4vw, 1.25rem); color: var(--primary); font-style: italic; font-weight: 600; }
.landing-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 18px 0 10px; }
.landing .tile-grid { text-align: left; padding: 0 12px 12px; }

/* --------------------------------------------------------------------------
   Blazor plumbing (error UI, validation)
   -------------------------------------------------------------------------- */

#blazor-error-ui {
    color-scheme: dark;
    background: var(--surface-elevated);
    border-top: 2px solid var(--danger);
    bottom: 0; left: 0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.4);
    box-sizing: border-box;
    display: none;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }

/* ===== Circle of Fifths explorer (/play/circle + deep dives) ===== */
.cof-wrap { max-width: 560px; margin: 0 auto; }
.cof-svg { width: 100%; height: auto; display: block; }
.cof-ring { fill: none; stroke: var(--outline); stroke-width: 1.5; }
.cof-node { cursor: pointer; }
.cof-node circle { fill: var(--surface); stroke: var(--outline); stroke-width: 1.5; transition: stroke .15s, fill .15s; }
.cof-node:hover circle { stroke: var(--primary); }
.cof-node.seen circle { stroke: var(--primary); stroke-opacity: .45; }
.cof-node.sel circle { fill: var(--primary); stroke: var(--primary); }
.cof-node text { fill: var(--text); font-size: 17px; font-weight: 700; text-anchor: middle; pointer-events: none; }
.cof-node.sel text { fill: #fff; }
.cof-minor { fill: var(--text-muted); font-size: 13px; text-anchor: middle; cursor: pointer; }
.cof-minor.sel { fill: var(--primary); font-weight: 700; }
.cof-count { fill: var(--text-muted); font-size: 11px; text-anchor: middle; }
.cof-center { fill: var(--primary); font-size: 34px; font-weight: 800; text-anchor: middle; }
.cof-card { margin-top: 12px; text-align: left; }
.cof-sig { margin: 6px 0 8px; }
.cof-notes { display: flex; flex-wrap: wrap; gap: 6px; }
.cof-note { border: 1px solid var(--outline); border-radius: 8px; padding: 3px 9px; font-weight: 700; font-size: .92rem; }
.cof-done { border-color: var(--primary); }
.cof-node-minor { cursor: pointer; }

/* ===== Interval Lab (/play/intervals + deep dives) ===== */
.ivl-wrap { max-width: 560px; margin: 0 auto; }
.ivl-svg { width: 100%; height: auto; display: block; }
.ivl-white { fill: #f5f2ea; stroke: #2a2825; stroke-width: 1.5; cursor: pointer; transition: fill .12s; }
.ivl-white:hover { fill: #ffe9d6; }
.ivl-black { fill: #22201d; stroke: #000; stroke-width: 1; cursor: pointer; transition: fill .12s; }
.ivl-black:hover { fill: #4a4034; }
.ivl-white.root, .ivl-black.root { fill: var(--primary); }
.ivl-white.target, .ivl-black.target { fill: var(--primary); fill-opacity: .75; }
.ivl-card { margin-top: 12px; text-align: left; }
.ivl-size { margin: 6px 0; }

/* ===== Piano Studio widgets (/play/piano* + deep dives) ===== */
.pk-wrap { max-width: 640px; }
.pk-svg text { pointer-events: none; user-select: none; }
.pk-label { font: 600 11px system-ui, sans-serif; fill: #2a2825; }
.pk-label.black { fill: #f5f2ea; font-size: 10px; }
.pk-toggles { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0; justify-content: center; }
.pk-toggles label { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; cursor: pointer; }
.pk-on { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 22%, transparent); }
.pk-quiz-btn { margin-top: 10px; }

/* ===== Fretboard (Guitar/Bass/Ukulele studios) ===== */
.fb-svg { width: 100%; height: auto; display: block; }
.fb-wood { fill: #3a2d22; stroke: #241c15; stroke-width: 1; }
.fb-nut { fill: #d8cfc0; }
.fb-fret { stroke: #8a8378; stroke-width: 2; }
.fb-string { stroke: #cfc39a; }
.fb-marker { fill: #57493c; }
.fb-cell { fill: transparent; cursor: pointer; }
.fb-cell:hover { fill: rgba(255, 233, 214, .18); }
.fb-dot { fill: var(--primary); pointer-events: none; }
.fb-dot.target { fill-opacity: .75; }
.fb-dot.ghost { fill-opacity: .35; }
.fb-label { font: 600 12px system-ui, sans-serif; fill: #f0e9dd; pointer-events: none; user-select: none; }
.fb-label.on-dot { fill: #fff; }

/* ===== Strum Lab ===== */
.strum-grid { display: flex; gap: 6px; justify-content: center; margin: 8px 0; }
.strum-slot { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.strum-btn { min-width: 44px; font-size: 18px; }
.cd-stage { text-align: center; margin: 8px 0; }

/* ===== Drum Studio: kit + beat lab ===== */
.kit-svg { max-width: 520px; margin: 0 auto; }
.kit-piece { cursor: pointer; }
.kit-drum { fill: #7a4a34; stroke: #2a2825; stroke-width: 2; }
.kit-drum.big { fill: #6a3e2c; }
.kit-cymbal { fill: #caa84e; stroke: #7a6320; stroke-width: 1.5; }
.kit-cymbal.open { fill: #d8bc6e; }
.kit-piece:hover .kit-drum, .kit-piece:hover .kit-cymbal { filter: brightness(1.25); }
.kit-piece.root .kit-drum, .kit-piece.root .kit-cymbal { stroke: var(--primary); stroke-width: 3.5; }
.kit-label { font: 600 12px system-ui, sans-serif; fill: #f0e9dd; pointer-events: none; user-select: none; }
.beat-grid { display: grid; grid-template-columns: 70px repeat(8, 1fr); gap: 5px; align-items: center; max-width: 560px; margin: 8px auto; }
.beat-lane-label { font-size: 13px; text-align: right; padding-right: 4px; }
.beat-count { text-align: center; opacity: .8; }
.beat-cell { min-width: 0; padding: 8px 0; font-size: 15px; }

/* ===== Vocal Studio ===== */
.wc-card { transition: border-color .15s, background .15s; }
.wc-card.wc-tune { border-color: var(--success); background: rgba(127, 169, 127, .14); }

/* ===== Chord diagram (songbook grid) ===== */
.cd-svg { width: 130px; height: auto; display: inline-block; }
.cd-name { font: 700 17px system-ui, sans-serif; fill: currentColor; }
.cd-pos, .cd-marker { font: 600 12px system-ui, sans-serif; fill: currentColor; }
.cd-nut { stroke: currentColor; stroke-width: 4; }
.cd-fret, .cd-string { stroke: currentColor; stroke-width: 1; opacity: .75; }
.cd-dot { fill: var(--primary); }

/* ===== Mode Mixer (/play/modes + deep dives) ===== */
.mode-wrap { max-width: 620px; margin: 0 auto; }
.mode-ladder { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mode-rung { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 8px;
             background: var(--surface); border: 1.5px solid var(--outline); border-radius: 12px;
             color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s; }
.mode-rung:hover { border-color: var(--primary); transform: translateY(-1px); }
.mode-rung.seen { border-color: var(--primary); opacity: .95; }
.mode-rung.sel { border-color: var(--primary); background: var(--primary-soft); }
.mode-rung small { color: var(--text-muted); font-size: .72rem; }
.mode-sun { font-size: 20px; }
.mode-card { margin-top: 12px; text-align: left; }
.mode-formula { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.mode-degree { border: 1px solid var(--outline); border-radius: 8px; padding: 3px 9px; font-weight: 700; font-size: .92rem; }
.mode-degree.altered { border-color: var(--primary); color: var(--primary); }

/* ===== Groove Builder (/play/groove + deep dives) ===== */
.grv-wrap { max-width: 620px; margin: 0 auto; }
.grv-palette { display: flex; flex-wrap: wrap; gap: 6px; }
.grv-key { display: flex; flex-direction: column; align-items: center; gap: 0; min-width: 58px; padding: 6px 8px;
           background: var(--surface); border: 1.5px solid var(--outline); border-radius: 10px;
           color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s; }
.grv-key:hover:not(:disabled) { border-color: var(--primary); transform: translateY(-1px); }
.grv-key:disabled { opacity: .35; cursor: default; }
.grv-key.rest { border-style: dashed; }
.grv-key small { color: var(--text-muted); font-size: .68rem; }
.grv-note { height: 26px; width: 20px; display: block; }
.grv-bar { display: flex; gap: 3px; margin: 12px 0; min-height: 64px;
           border: 2px solid var(--outline); border-radius: 10px; padding: 5px; }
.grv-block { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-basis: 0;
             background: var(--primary-soft); border: 1.5px solid var(--primary); border-radius: 8px; padding: 4px 2px; min-width: 24px; }
.grv-block.rest { background: var(--surface); border-color: var(--outline); border-style: dashed; color: var(--text-muted); }
.grv-block small { color: var(--text-muted); font-size: .72rem; font-weight: 700; }
.grv-space { display: flex; align-items: center; justify-content: center; flex-basis: 0;
             color: var(--text-muted); font-size: .78rem; border: 1.5px dashed var(--outline); border-radius: 8px; min-width: 24px; }
.grv-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.grv-tempo { padding: 5px 10px; background: var(--surface); border: 1.5px solid var(--outline); border-radius: 8px;
             color: var(--text); font-weight: 700; font-size: .82rem; cursor: pointer; }
.grv-tempo.sel { border-color: var(--primary); background: var(--primary-soft); }
.grv-card { margin-top: 12px; text-align: left; }

/* ===== Chord Stacker (/play/chords + deep dives) ===== */
.stk-wrap { max-width: 620px; margin: 0 auto; }
.stk-roots, .stk-qualities { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 8px; }
.stk-qualities small { color: var(--text-muted); font-weight: 700; margin-right: 2px; }
.stk-chip { padding: 5px 10px; background: var(--surface); border: 1.5px solid var(--outline); border-radius: 8px;
            color: var(--text); font-weight: 700; font-size: .85rem; cursor: pointer; transition: border-color .15s; }
.stk-chip:hover { border-color: var(--primary); }
.stk-chip.sel { border-color: var(--primary); background: var(--primary-soft); }
.stk-chip.seen:not(.sel) { border-color: var(--primary); opacity: .8; }
.stk-tower { display: flex; flex-direction: column; gap: 4px; max-width: 240px; margin: 12px auto; }
.stk-floor { position: relative; display: flex; align-items: baseline; justify-content: center; gap: 8px;
             background: var(--surface); border: 1.5px solid var(--outline); border-radius: 10px; padding: 8px 34px;
             transition: border-color .2s, background .2s; }
.stk-floor small { color: var(--text-muted); }
.stk-floor.up, .stk-floor.down, .stk-floor.new { border-color: var(--primary); background: var(--primary-soft); }
.stk-move { position: absolute; right: 12px; color: var(--primary); font-weight: 800; }
.stk-card { text-align: left; }

/* ---- FAQ ---- */
.faq-page { max-width: 820px; margin: 0 auto; text-align: left; }
.faq-lede { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 20px; }
.faq-quicklinks { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 8px; }
.faq-quicklinks a { padding: 8px 15px; border: 1.5px solid var(--outline); border-radius: 999px;
    background: var(--surface); color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem;
    transition: border-color .2s, color .2s; }
.faq-quicklinks a:hover { border-color: var(--primary); color: var(--primary); }
.faq-section { scroll-margin-top: 88px; margin-top: 34px; }
.faq-section > h2 { margin-bottom: 4px; }
.faq-panel { display: flex; flex-direction: column; padding-top: 4px; padding-bottom: 4px; }
.faq-item { padding: 16px 0; border-top: 1px solid var(--outline); scroll-margin-top: 88px; }
.faq-item:first-child { border-top: none; }
.faq-q { margin: 0 0 6px; font-size: 1.08rem; color: var(--text); }
.faq-a { color: var(--text-muted); line-height: 1.6; }
.faq-a a { color: var(--primary); }
.faq-foot { margin-top: 34px; color: var(--text-muted); }
.faq-foot a { color: var(--primary); }

/* ===== Account menu (header) ===== */
/* A <details> dropdown, so it works on click and keyboard with no script — the
   same no-JS bargain as the mobile nav checkbox. */
.acct { position: relative; }
.acct > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center;
                  gap: 7px; padding: 7px 12px; border: 1px solid var(--outline);
                  border-radius: 999px; background: var(--surface); color: var(--text);
                  font-size: .92rem; white-space: nowrap; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover { border-color: var(--primary); }
.acct[open] > summary { border-color: var(--primary); background: var(--surface-elevated); }
.acct-avatar { font-size: 1.05rem; line-height: 1; }
.acct-avatar.big { font-size: 1.9rem; }
.acct-who { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; }
.acct-caret { color: var(--text-muted); font-size: .7rem; }

.acct-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
              min-width: 268px; max-width: 320px; padding: 14px;
              border: 1px solid var(--outline); border-radius: var(--radius);
              background: var(--surface-elevated); box-shadow: 0 14px 34px rgba(0,0,0,.42); }
.acct-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.acct-head b { display: block; }
.acct-head small { color: var(--text-muted); }

.acct-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; }
.acct-facts dt { color: var(--text-muted); font-size: .82rem; }
.acct-facts dd { margin: 0; font-size: .9rem; overflow-wrap: anywhere; }
/* The account PAGE stacks every row — label above value, one column — matching
   the menu's shape at full width. A two-column table there left long values
   (an address, a class and its teacher) wrapping in a narrow strip beside a
   mostly-empty label column. */
.acct-facts.wide { grid-template-columns: 1fr; gap: 0; }
.acct-facts.wide dt { margin-top: 13px; }
.acct-facts.wide dt:first-of-type { margin-top: 0; }
.acct-facts.wide dd { margin-top: 1px; font-size: .95rem; }

/* In the MENU only some rows stack: the long ones. The rest read better as
   label-and-value pairs in a panel that narrow. */
.acct-facts dt.stack, .acct-facts dd.stack { grid-column: 1 / -1; }
.acct-facts dd.stack { margin-top: -3px; }
.acct-class { display: block; }
.acct-class small { display: block; color: var(--text-muted); }

.acct-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.acct-links { display: flex; flex-direction: column; gap: 2px;
              border-top: 1px solid var(--outline); padding-top: 8px; }
.acct-links a { padding: 5px 0; font-size: .92rem; }
.acct-signout { border-top: 1px solid var(--outline); margin-top: 8px; padding-top: 8px; }

.acct-page .acct-head { margin-bottom: 14px; }

/* On phones the nav stacks, so pin the panel to the column instead of floating
   it off the right edge of a narrow screen. */
@media (max-width: 1120px) {
    .acct-panel { position: static; min-width: 0; max-width: none; margin-top: 8px;
                  box-shadow: none; }
}

/* ===== Scale Lab (/play/scales + deep dives) ===== */
.scl-wrap { max-width: 760px; margin: 0 auto; }
.scl-roots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 18px; }

.scl-family { margin-top: 18px; }
.scl-family h3 { margin-bottom: 2px; }
.scl-family .hint-line { margin-top: 0; }
.scl-row { display: flex; flex-wrap: wrap; gap: 8px; }

.scl-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
            border: 1px solid var(--outline); border-radius: var(--radius-sm);
            background: var(--surface); color: var(--text); cursor: pointer;
            padding: 8px 14px; font: inherit; text-align: left; }
.scl-chip:hover { border-color: var(--primary); }
.scl-chip.seen { border-color: var(--teal); }
.scl-chip.sel { border-color: var(--primary); background: var(--surface-elevated); }
.scl-chip small { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.scl-handoff { display: block; }
.scl-card { margin-top: 18px; }
.scl-card h3 { margin-bottom: 4px; }

.scl-degrees { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.scl-degree { border: 1px solid var(--outline); border-radius: 999px; padding: 3px 11px;
              font-size: .9rem; font-weight: 700; }
.scl-degree.altered { border-color: var(--primary); color: var(--primary); }

.scl-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.scl-over { border-color: var(--teal); color: var(--teal); }

/* The instrument diagrams scroll rather than shrink: a squeezed neck stops being
   readable exactly where the shape is the lesson. */
.scl-instrument { overflow-x: auto; margin-bottom: 12px; }
.scl-instrument svg { display: block; }

/* PianoKeys and FretboardView both take a per-position class; "lit" is a scale
   tone and "root" is home. Same two words in both diagrams on purpose. */
.scl-wrap .ivl-white.lit, .scl-wrap .fb-dot.lit { fill: var(--teal); }
.scl-wrap .ivl-black.lit { fill: var(--teal); opacity: .85; }
.scl-wrap .ivl-white.root, .scl-wrap .ivl-black.root, .scl-wrap .fb-dot.root { fill: var(--primary); }

.scl-when { border-top: 1px solid var(--outline); padding-top: 12px; }
.scl-when p { margin: 6px 0; }
.scl-chords { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
