/* NoteFusion Web — the night design, as on the phone app.
 *
 * Loaded after theme.css and app.css on /app and /app/sheet only (the marketing pages keep their own
 * look). It carries the mobile app's palette (mobile/src/design/theme.ts: `darkColors` / `night` for
 * Night, `colors` for Day), its type (Geist for the interface, JetBrains Mono for solfa) and its
 * shapes (12px buttons and fields, 20px cards), and the house press: a control under the finger
 * scales to 0.97 in 150ms and never bounces. Day is the default; Night is one switch away. Blue is
 * flat — no gradients, no glows — so the music, not the chrome, is what catches the eye. */

/* ── Tokens ──────────────────────────────────────────────────────────────── */
:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Day: the phone's light palette. */
  --color-brand-500: #2563EB;
  --color-brand-600: #1D4ED8;
  --color-brand-100: rgba(37, 99, 235, 0.10);
  --color-brand-050: rgba(37, 99, 235, 0.06);
  --color-ink-950: #0F172A;
  --color-ink-700: #334155;
  --color-ink-500: #5B6B82;  /* muted text: 4.5:1 and more on every light surface, #EEF3FB included */
  --color-ink-300: #94A3B8;
  --color-surface-canvas: #F4F7FC;
  --color-surface-base: #FFFFFF;
  --color-surface-subtle: #EEF3FB;
  --color-border-default: #E2E8F0;
  --color-border-strong: #CBD5E1;

  --blue: #2563EB;          /* the fill blue: buttons, selected chips */
  --blue-dark: #1D4ED8;     /* blue as text and icons on a surface */
  --blue-fill: #2563EB;     /* blue under white text: buttons, the selected chip */
  --blue-fill-hover: #1D4ED8;
  --input-line: #7B889D;    /* a field's edge: 3:1 and more against the page and the field, so the box is seen */
  --blue-soft: rgba(37, 99, 235, 0.10);
  --blue-tint: rgba(37, 99, 235, 0.07);
  --brand-gradient: linear-gradient(#2563EB, #2563EB);
  --glow: none;
  --premium: #F59E0B;
  --premium-ink: #3B2A00;
  --premium-soft: rgba(245, 158, 11, 0.12);
  --premium-line: rgba(245, 158, 11, 0.35);
  --mint: #16A34A;
  --amber: #D97706;
  --danger: #DC2626;
  --success: #16A34A;
  --danger-soft: rgba(220, 38, 38, 0.10);
  --success-soft: rgba(22, 163, 74, 0.10);
  --amber-soft: rgba(217, 119, 6, 0.12);
  --glass: rgba(255, 255, 255, 0.86);
  --scrim: rgba(15, 23, 42, 0.55);
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --ring: 0 0 0 4px rgba(37, 99, 235, 0.16);
  --press: 0.97;
}

/* Night: the phone's dark palette — near-black with a cool cast, one blue, honest signal colours. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-brand-500: #2F7BFF;
  --color-brand-600: #1B5FE0;
  --color-brand-100: rgba(47, 123, 255, 0.14);
  --color-brand-050: rgba(47, 123, 255, 0.08);
  --color-ink-950: #F3F6FB;
  --color-ink-700: #C9D1DF;
  --color-ink-500: #8B95AA;
  --color-ink-300: #7C879C;
  --color-surface-canvas: #07090E;
  --color-surface-base: #0E121A;
  --color-surface-subtle: #151A24;
  --color-border-default: rgba(255, 255, 255, 0.07);
  --color-border-strong: rgba(255, 255, 255, 0.12);

  --blue: #2F7BFF;
  --blue-dark: #9CC2FF;     /* "ice": blue as text on the dark canvas, where the fill weight goes muddy */
  --blue-deep: #1B5FE0;
  --blue-fill: #1B5FE0;     /* white on #2F7BFF is under 4.5:1; the deeper blue carries white text */
  --blue-fill-hover: #1650C4;
  --input-line: rgba(255, 255, 255, 0.38);
  --blue-soft: rgba(47, 123, 255, 0.14);
  --blue-tint: rgba(47, 123, 255, 0.10);
  --brand-gradient: linear-gradient(#2F7BFF, #2F7BFF);
  --glow: none;
  --premium: #F5B544;
  --premium-ink: #1F1600;
  --premium-soft: rgba(245, 181, 68, 0.12);
  --premium-line: rgba(245, 181, 68, 0.38);
  --mint: #3DDC97;
  --amber: #F5B544;
  --danger: #FF4D5E;
  --success: #3DDC97;
  --danger-soft: rgba(255, 77, 94, 0.12);
  --success-soft: rgba(61, 220, 151, 0.10);
  --amber-soft: rgba(245, 181, 68, 0.12);
  --glass: rgba(14, 18, 26, 0.82);
  --scrim: rgba(3, 5, 8, 0.80);
  --ring: 0 0 0 4px rgba(47, 123, 255, 0.30);
  --shadow-card: none;
  --shadow-card-hover: 0 14px 32px rgba(0, 0, 0, 0.45);
  --shadow-elevated: 0 24px 60px rgba(0, 0, 0, 0.60);
}

body { font-family: var(--font-sans); background: var(--bg); }
h1, h2, h3 { letter-spacing: -0.025em; }
h1 { font-weight: 700; letter-spacing: -0.035em; }
::selection { background: rgba(47, 123, 255, 0.35); }

/* ── Press: one feel for every control (scale 0.97, 150ms, never on a disabled one) ── */
.btn, .nav-item, .tab, .lib-chip, .plan-opt, .source-tab, .verdict, .issue, .upload-kind label {
  transition-property: transform, background-color, border-color, color, box-shadow, opacity;
  transition-duration: 150ms;
  transition-timing-function: ease-out;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-reduced-motion: no-preference) {
  .btn:active:not(:disabled), .nav-item:active, .tab:active, .lib-chip:active, .plan-opt:active,
  .source-tab:active, .verdict:active:not(:disabled), .issue:active, .upload-kind label:active { transform: scale(var(--press)); }
}
.btn:active:not(:disabled) { transform: none; }
@media (prefers-reduced-motion: no-preference) { .btn:active:not(:disabled) { transform: scale(var(--press)); } }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { border-radius: 12px; min-height: 46px; padding: 10px 20px; font-weight: 600; }
.btn-sm { border-radius: 10px; min-height: 38px; padding: 6px 14px; }
/* An icon button is all icon: the .btn padding above would squeeze the icon to nothing. */
.btn-icon { border-radius: 10px; width: 40px; min-height: 40px; padding: 0; }
.btn-primary { background: var(--blue-fill); color: #fff; box-shadow: none; }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { transform: none; box-shadow: none; background: var(--blue-fill-hover); }
  .btn-ghost:hover:not(:disabled) { background: var(--wash); border-color: var(--line-strong); }
}
.btn-ghost { background: var(--wash); border-color: var(--line); color: var(--ink); }
:root[data-theme="dark"] .btn-ghost { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); }
.btn-pill { min-height: 48px; font-size: 1rem; }
.btn-white { background: #fff; color: #0A0D14; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25); }
:root:not([data-theme="dark"]) .btn-white { background: var(--ink); color: #fff; }
.btn-pro { background: linear-gradient(135deg, #FBD27A, var(--premium)); color: var(--premium-ink); box-shadow: none; }
@media (hover: hover) { .btn-pro:hover:not(:disabled) { box-shadow: none; transform: none; filter: brightness(0.97); } }
.btn-link { color: var(--blue-dark); }

/* ── Fields ──────────────────────────────────────────────────────────────── */
input[type=text], input[type=url], input[type=email], input[type=password], textarea, select {
  border-radius: 12px; min-height: 48px; background: var(--surface); border-color: var(--input-line);
}
:root[data-theme="dark"] :is(input[type=text], input[type=url], input[type=email], input[type=password], textarea, select) {
  background: rgba(255, 255, 255, 0.05); border-color: var(--input-line); color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: var(--ring); }

/* ── Surfaces ────────────────────────────────────────────────────────────── */
.card { border-radius: var(--radius); box-shadow: var(--shadow-card); }
.section { border-radius: 18px; background: var(--surface); }
:root[data-theme="dark"] .section { background: rgba(255, 255, 255, 0.025); }
.alert { border-radius: 16px; }
.chip { border-radius: 999px; background: var(--wash); color: var(--copy); font-weight: 500; }
:root[data-theme="dark"] .chip { background: rgba(255, 255, 255, 0.06); }
.pill-free { background: var(--blue-soft); color: var(--blue-dark); }
.pill-pro { background: none; color: var(--blue-dark); box-shadow: inset 0 0 0 1px var(--blue-soft); }

/* Tabs: a segmented control. */
.tabs { border-radius: 12px; padding: 4px; background: var(--wash); }
:root[data-theme="dark"] .tabs { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); }
.tab { border-radius: 9px; }
.tab[aria-selected=true] { background: var(--surface); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
:root[data-theme="dark"] .tab[aria-selected=true] { background: rgba(255, 255, 255, 0.10); box-shadow: none; color: var(--ink); }

/* ── Shell: a glass top bar and a quiet sidebar ─────────────────────────── */
.side { background: var(--surface); }
:root[data-theme="dark"] .side { background: rgba(10, 13, 19, 0.92); border-right-color: rgba(255, 255, 255, 0.06); }
.topbar { background: var(--glass); -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px); }
:root[data-theme="dark"] .topbar { border-bottom-color: rgba(255, 255, 255, 0.06); }
.nav-item { border-radius: 10px; }
.nav-item.on { background: var(--blue-soft); color: var(--blue-dark); }
.nav-new, .nav-new.on { background: var(--blue-fill); color: #fff; box-shadow: none; border-radius: 10px; }
@media (hover: hover) { .nav-new:hover { background: var(--blue-fill-hover); box-shadow: none; } }
:root[data-theme="dark"] .theme-switch, :root[data-theme="dark"] .theme-seg { background: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .theme-switch button.on, :root[data-theme="dark"] .theme-seg button.on { background: rgba(255, 255, 255, 0.12); box-shadow: none; }
:root[data-theme="dark"] .user-menu { box-shadow: var(--shadow-elevated); }
.brand { font-weight: 700; letter-spacing: -0.03em; }
.brand-mark, .home-mark, .auth-mark { background: var(--brand-gradient); }

/* ── Home: the greeting and the studio, as one calm card ─────────────────── */
.home { padding: clamp(8px, 4vh, 36px) 0 18px; }
.greeting { font-size: clamp(1.8rem, 3.6vw, 2.5rem); font-weight: 700; letter-spacing: -0.04em; }
.studio {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 24px;
  box-shadow: none; padding: 18px;
}
:root[data-theme="dark"] .studio { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.08); }
.studio::before { display: none; }

/* Where the music comes from: one choice at a time, so the page asks one thing. */
.source-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 12px; background: var(--wash); margin: 0 0 16px; }
:root[data-theme="dark"] .source-tabs { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.07); }
.source-tab { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 0.92rem; cursor: pointer; white-space: nowrap; }
.source-tab .ic { width: 18px; height: 18px; }
.source-tab[aria-selected=true] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12); }
:root[data-theme="dark"] .source-tab[aria-selected=true] { background: rgba(255, 255, 255, 0.10); box-shadow: none; }
@media (hover: hover) { .source-tab:not([aria-selected=true]):hover { color: var(--ink); } }
.source-panel[hidden] { display: none !important; }
.source-lead { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 2px 0 14px; }

.studio .drop {
  min-height: 200px; border: 1.5px dashed var(--line-strong); border-radius: 20px; background: var(--wash); color: var(--ink);
}
:root[data-theme="dark"] .studio .drop { border-color: rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.025); }
.studio .drop:hover, .studio .drop.is-over { border-color: var(--blue); background: var(--blue-tint); }
.studio .drop-ic { color: var(--blue-dark); }
.studio .drop-hint { color: var(--muted); }
.btn.btn-light { background: var(--blue-fill); color: #fff; box-shadow: none; }
@media (hover: hover) { .btn.btn-light:hover:not(:disabled) { background: var(--blue-fill-hover); transform: none; } }

/* What is in the recording: wraps instead of running off the card. */
.studio .studio-kind { display: flex; flex-wrap: wrap; gap: 6px; background: none; padding: 0; margin: 14px 0 0; justify-content: center; }
.studio .studio-kind label { flex: 0 1 auto; border-radius: 999px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
:root[data-theme="dark"] .studio .studio-kind label { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); }
.studio .studio-kind label:has(input:checked) { background: var(--blue-soft); border-color: var(--blue); color: var(--blue-dark); box-shadow: none; }
.studio .studio-kind label:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.studio-opt { color: var(--copy); }
.studio-opt input[type=checkbox] { accent-color: var(--blue); }
.studio-opt select { color: var(--ink); border-color: var(--input-line); background-color: var(--wash); }
.studio-opt select option { color: initial; background: initial; }
.studio-credits, .studio-status { color: var(--muted); }

/* Record: one round button, flat blue, a hairline ring around it, the microphone sized to fill it. */
.studio-rec-stage { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 0 8px; }
.studio-rec {
  position: relative; width: 84px; height: 84px; min-height: 84px; padding: 0; margin: 0 0 14px; border-radius: 50%;
  background: var(--blue-fill); color: #fff; border: 0; box-shadow: none;
}
.studio-rec::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 1px solid var(--line-strong); pointer-events: none; }
@media (hover: hover) { .studio-rec:hover:not(:disabled) { background: var(--blue-fill-hover); } }
.studio-rec .ic { width: 30px; height: 30px; stroke-width: 1.8; }
.studio-rec-label { font-weight: 600; color: var(--ink); }
.studio-rec-hint { font-size: 0.85rem; color: var(--muted); }
@media (prefers-reduced-motion: no-preference) { .studio-rec:active { transform: scale(0.94); } }
.studio .btn-rec, .studio .btn-rec .ic { color: #fff; }

/* Link: one field, the button inside the same row. */
.studio-link .input-wrap input { background: var(--wash); border-color: var(--input-line); color: var(--ink); padding-left: 104px; border-radius: 999px; min-height: 54px; }
:root[data-theme="dark"] .studio-link .input-wrap input { background: rgba(255, 255, 255, 0.05); border-color: var(--input-line); }
.studio-link .input-wrap input::placeholder { color: var(--muted); }
.studio-link .input-wrap input:focus { border-color: var(--blue); box-shadow: var(--ring); background: var(--wash); }
:root[data-theme="dark"] .studio-link .input-wrap input:focus { background: rgba(255, 255, 255, 0.07); }
.provider-marks { color: var(--muted); left: 18px; }
.btn.btn-glass { background: var(--wash); color: var(--ink); border-color: var(--line); }
.studio .link-section {
  --ls-bg: var(--wash); --ls-line: var(--line-strong); --ls-ink: var(--ink); --ls-muted: var(--muted);
  --ls-track: var(--line-strong); --ls-fill: var(--blue); --ls-handle: #fff; --ls-handle-ring: var(--blue); --ls-focus: var(--blue-soft);
}
.studio .link-section .btn-ghost { background: var(--wash); color: var(--ink); border-color: var(--line); }

/* ── Progress ────────────────────────────────────────────────────────────── */
.stage { border-radius: 14px; }
:root[data-theme="dark"] .stage { background: rgba(255, 255, 255, 0.03); }
.stage.on { background: var(--blue-soft); color: var(--blue-dark); }
.bar > div { background: var(--brand-gradient); }
.bar-pct { color: var(--blue-dark); font-family: var(--font-mono); }

/* ── Result ──────────────────────────────────────────────────────────────── */
.result-card { padding: 22px; }
.song .title { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.03em; }
.sheet-wrap { border-radius: 18px; border-color: var(--line); }
.solfa { font-family: var(--font-mono); font-weight: 500; background: var(--blue-tint); border-color: var(--line); border-radius: 18px; }
:root[data-theme="dark"] .solfa .doh { color: var(--blue-dark); }
table.hymn, .chord-chip em, .sing-live, .mark { font-family: var(--font-mono); }
.cell i, .chord-grid .ch strong, .sing-live small, .mark small { font-family: var(--font-sans); }
:root[data-theme="dark"] table.hymn td { border-left-color: rgba(255, 255, 255, 0.55); }
:root[data-theme="dark"] table.hymn td:last-child { border-right-color: rgba(255, 255, 255, 0.55); }
.player .group { border-radius: 999px; padding: 5px 14px; }
:root[data-theme="dark"] .player .group { background: rgba(255, 255, 255, 0.05); }
.player input[type=number], .player select { border-radius: 999px; min-height: 32px; background-color: var(--surface); }

/* The rest of a song a free account has not heard: a faded strip of stave under a lock. */
.unlock { position: relative; margin: 16px 0 0; border-radius: 22px; padding: 20px; border: 1px solid var(--premium-line); background: linear-gradient(160deg, var(--premium-soft), transparent 70%), var(--surface); overflow: hidden; }
:root[data-theme="dark"] .unlock { background: linear-gradient(160deg, rgba(245, 181, 68, 0.10), rgba(255, 255, 255, 0.02) 70%); }
.unlock-rest { position: relative; height: 74px; margin: -4px -4px 14px; border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(180deg, var(--line-strong) 0 1.5px, transparent 1.5px 11px) 0 14px / 100% 46px no-repeat; }
.unlock-rest::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 34px, var(--faint) 34px 44px, transparent 44px 70px) 0 22px / 100% 26px no-repeat; opacity: 0.35; filter: blur(3px); }
.unlock-rest::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--surface) 92%); }
:root[data-theme="dark"] .unlock-rest::after { background: linear-gradient(90deg, transparent, #0F131B 92%); }
.unlock-lock { position: absolute; z-index: 1; left: 50%; top: 50%; translate: -50% -50%; display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--premium-line); color: var(--ink); font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.unlock-lock .ic { width: 15px; height: 15px; color: var(--premium); }
.unlock h2 { font-size: 1.2rem; margin: 0 0 4px; }
.unlock h2 .ic { color: var(--premium); }
.unlock-lead { color: var(--muted); margin: 0 0 14px; max-width: 62ch; }
.unlock .pay-perks { margin-bottom: 14px; }
.unlock .pay-perks .ic { color: var(--premium); }

/* How did it come out? One tap, then (only if it was off) what was off. */
.verdict-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 14px 0 0; padding: 14px 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); }
:root[data-theme="dark"] .verdict-card { background: rgba(255, 255, 255, 0.03); }
.verdict-q { font-weight: 600; color: var(--ink); margin: 0; flex: 1 1 220px; }
.verdicts { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.verdict { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--wash); color: var(--ink); font: inherit; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
:root[data-theme="dark"] .verdict { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.12); }
.verdict[aria-pressed=true][data-verdict="5"] { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.verdict[aria-pressed=true][data-verdict="3"] { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.verdict[aria-pressed=true][data-verdict="1"] { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.verdict-more { flex: 1 1 100%; display: grid; gap: 10px; }
.verdict-more[hidden] { display: none; }
.issues { display: flex; flex-wrap: wrap; gap: 6px; }
.issue { min-height: 34px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.issue[aria-pressed=true] { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); }
.verdict-more textarea { min-height: 0; border-radius: 14px; }
.verdict-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.verdict-thanks { flex: 1 1 100%; margin: 0; color: var(--muted); font-size: 0.9rem; }

/* Plans: the picker on the night canvas. */
.plan-opt { border-radius: 18px; background: var(--surface); }
:root[data-theme="dark"] .plan-opt { background: rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.10); }
.plan-opt.on { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 3px var(--blue-tint); }
.plan-opt-price { font-weight: 700; }
.btn-pay { min-height: 54px; }
.upgrade-note { border-radius: 18px; }
:root[data-theme="dark"] .upgrade-note { background: var(--premium-soft); border-color: var(--premium-line); }
.pay-badge, .membership-head .crown, .pro-welcome-mark { background: linear-gradient(135deg, #FBD27A, var(--premium)); color: var(--premium-ink); }

/* ── Library ─────────────────────────────────────────────────────────────── */
.lib-item { border-radius: 18px; }
:root[data-theme="dark"] .lib-item { background: rgba(255, 255, 255, 0.03); }
.lib-key { border-radius: 14px; background: var(--blue-soft); color: var(--blue-dark); font-family: var(--font-mono); }
.lib-chip { border-radius: 999px; }
.lib-chip.on { background: var(--blue-fill); border-color: var(--blue-fill); }
@media (hover: hover) { .lib-item:hover { transform: none; border-color: rgba(47, 123, 255, 0.45); } }

/* ── Sign in: the night auth screen ──────────────────────────────────────── */
:root[data-theme="dark"] .try-row:hover { background: rgba(255, 255, 255, 0.03); }
:root[data-theme="dark"] .auth-aside { background: linear-gradient(160deg, #10244F 0%, #0B1838 55%, #070F24 100%); }

/* ── Dialogs ─────────────────────────────────────────────────────────────── */
.onb, .modal { background: var(--scrim); }
.onb-card, .modal-card { border-radius: 28px; overscroll-behavior: contain; }
:root[data-theme="dark"] .onb-card, :root[data-theme="dark"] .modal-card { background: #0E121A; border: 1px solid rgba(255, 255, 255, 0.08); }
:root[data-theme="dark"] .skel { background: rgba(255, 255, 255, 0.06); }
:root[data-theme="dark"] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); }

/* The recorder dialog (recorder.css) in the same type and shape. */
.nf-rec-card, .nf-rec-heading, .nf-rec .nf-rec-btn { font-family: var(--font-sans); }
.nf-rec .nf-rec-btn { border-radius: 999px; }
:root[data-theme="dark"] .nf-rec-card { background: #0E121A; border: 1px solid rgba(255, 255, 255, 0.08); }

/* Tap targets: the menu button and the account photo in the top bar are at least 44px square. */
.topbar .drawer-toggle { width: 44px; min-height: 44px; }
.avatar-btn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 640px) {
  .studio { padding: 14px; border-radius: 22px; }
  .source-tab { font-size: 0.85rem; gap: 6px; padding: 8px 6px; }
  .verdict-card { padding: 12px 14px; }
  .unlock { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn, .nav-item, .tab, .lib-chip, .plan-opt, .source-tab, .verdict, .issue { transition-property: background-color, border-color, color, opacity; }
}

/* ══ The Transcribe screen, one screen at a time ═══════════════════════════
 * While a transcription runs and once its sheet is back, the greeting and the studio fold away
 * (body.is-focus): the work is the page. The sheet scrolls inside its own frame, the tools sit in one
 * row and open one at a time in a pop-up, so nothing below the music asks to be scrolled through. */
body.is-focus #home, body.is-focus #studio { display: none; }

/* ── Entrances: rise, once, then stay put ── */
@keyframes nf-rise { from { opacity: 0; transform: translateY(12px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes nf-fade { from { opacity: 0; } to { opacity: 1; } }
.rise { animation: nf-fade 300ms ease-out both; }
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: nf-rise 300ms ease-out both; }
  .rise > * { animation: nf-rise 300ms ease-out both; }
  .rise > :nth-child(2) { animation-delay: 60ms; }
  .rise > :nth-child(3) { animation-delay: 120ms; }
  .rise > :nth-child(4) { animation-delay: 180ms; }
  .rise > :nth-child(n+5) { animation-delay: 220ms; }
}

/* ── Progress: the engine at work ── */
#progress { text-align: center; padding: 28px 22px 22px; max-width: 640px; margin-left: auto; margin-right: auto; }
:root[data-theme="dark"] #progress { background: radial-gradient(420px 220px at 50% 0, rgba(47, 123, 255, 0.16), transparent 70%), rgba(255, 255, 255, 0.03); border-color: rgba(255, 255, 255, 0.08); }
.p-visual { position: relative; height: 150px; margin: 0 auto 6px; width: min(340px, 100%); }
.p-orb { position: absolute; left: 50%; top: 8px; translate: -50% 0; width: 78px; height: 78px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--blue-soft); box-shadow: 0 0 0 10px var(--blue-tint), 0 0 50px rgba(47, 123, 255, 0.45); }
.p-mark { width: 40px; height: 40px; }
.p-eq { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.p-eq i { display: block; width: 7px; height: 100%; border-radius: 999px; background: var(--brand-gradient); transform-origin: 50% 100%; transform: scaleY(0.35); opacity: 0.9; }
.p-eq i:nth-child(odd) { opacity: 0.6; }
.p-notes { position: absolute; inset: 0; pointer-events: none; }
.p-notes b { position: absolute; bottom: 30px; font-family: var(--font-mono); font-weight: 600; font-size: 0.95rem; color: var(--blue-dark); opacity: 0; }
.p-notes b:nth-child(1) { left: 12%; } .p-notes b:nth-child(2) { left: 25%; } .p-notes b:nth-child(3) { left: 38%; }
.p-notes b:nth-child(4) { left: 62%; } .p-notes b:nth-child(5) { left: 75%; } .p-notes b:nth-child(6) { left: 86%; } .p-notes b:nth-child(7) { left: 50%; }
@keyframes nf-eq { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
@keyframes nf-float { 0% { opacity: 0; transform: translateY(0) scale(0.9); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-70px) scale(1.1); } }
@keyframes nf-breathe { 0%, 100% { box-shadow: 0 0 0 10px var(--blue-tint), 0 0 40px rgba(47, 123, 255, 0.35); } 50% { box-shadow: 0 0 0 16px var(--blue-tint), 0 0 64px rgba(47, 123, 255, 0.55); } }
@keyframes nf-shimmer { from { background-position: -200px 0, 0 0; } to { background-position: 400px 0, 0 0; } }
@media (prefers-reduced-motion: no-preference) {
  #progress .p-eq i { animation: nf-eq 1.1s ease-in-out infinite; }
  #progress .p-eq i:nth-child(2n) { animation-duration: 0.9s; }
  #progress .p-eq i:nth-child(3n) { animation-duration: 1.3s; }
  #progress .p-eq i:nth-child(1) { animation-delay: -0.2s; } #progress .p-eq i:nth-child(2) { animation-delay: -0.5s; }
  #progress .p-eq i:nth-child(3) { animation-delay: -0.1s; } #progress .p-eq i:nth-child(4) { animation-delay: -0.7s; }
  #progress .p-eq i:nth-child(5) { animation-delay: -0.3s; } #progress .p-eq i:nth-child(6) { animation-delay: -0.9s; }
  #progress .p-eq i:nth-child(7) { animation-delay: -0.4s; } #progress .p-eq i:nth-child(8) { animation-delay: -0.6s; }
  #progress .p-eq i:nth-child(9) { animation-delay: -0.15s; } #progress .p-eq i:nth-child(10) { animation-delay: -0.8s; }
  #progress .p-notes b { animation: nf-float 3.5s ease-out infinite; }
  #progress .p-notes b:nth-child(2) { animation-delay: 0.5s; } #progress .p-notes b:nth-child(3) { animation-delay: 1s; }
  #progress .p-notes b:nth-child(4) { animation-delay: 1.5s; } #progress .p-notes b:nth-child(5) { animation-delay: 2s; }
  #progress .p-notes b:nth-child(6) { animation-delay: 2.5s; } #progress .p-notes b:nth-child(7) { animation-delay: 3s; }
  #progress .p-orb { animation: nf-breathe 2.4s ease-in-out infinite; }
  #progress .bar > div { background-image: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent), linear-gradient(180deg, #3A84FF, #2F7BFF);
    background-size: 200px 100%, 100% 100%; background-repeat: no-repeat; animation: nf-shimmer 1.4s linear infinite; }
}
/* Reduced motion: still bars at varied heights, no floating notes. */
@media (prefers-reduced-motion: reduce) {
  .p-eq i:nth-child(3n) { transform: scaleY(0.8); } .p-eq i:nth-child(3n+1) { transform: scaleY(0.5); }
}
.p-song { justify-content: center; text-align: left; margin: 6px 0 4px; }
.p-song .title { font-size: 1.1rem; }
.p-big { font-family: var(--font-mono); font-weight: 600; font-size: 2.6rem; letter-spacing: -0.04em; color: var(--ink); line-height: 1.1; margin: 8px 0 10px; font-variant-numeric: tabular-nums; }
#progress .bar { height: 8px; }
#progress .bar > div { transition: width 600ms cubic-bezier(0.2, 0, 0, 1); }
.p-status { margin: 12px 0 0; color: var(--ink); font-weight: 600; min-height: 1.4em; }
#progress .stages { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 14px 0 0; }
#progress .stage { flex: none; padding: 6px 12px 6px 8px; font-size: 0.8rem; gap: 7px; border-radius: 999px; }
#progress .stage .dot { width: 18px; height: 18px; font-size: 0.6rem; border-width: 1.5px; }
.p-note { margin: 14px 0 0; }

/* ── Result: header, the framed sheet, one row of actions ── */
#result { padding: 18px 20px 20px; }
.result-top { display: flex; justify-content: flex-start; margin: -4px 0 10px; }
.r-new .ic { width: 16px; height: 16px; }
.result-head { align-items: center; margin-bottom: 12px; }
.result-views { display: flex; align-items: center; gap: 8px; }
.result-views .tabs { margin: 0; }
.song img { border-radius: 14px; }

/* The music in a frame: tall enough to read, never taller than the screen allows. */
.sheet-stage { position: relative; }
.sheet-stage #r-staff .sheet-wrap, .sheet-stage #r-solfa, .sheet-stage #r-parts {
  max-height: clamp(240px, calc(100vh - 360px), 560px); max-height: clamp(240px, calc(100dvh - 360px), 560px);
  overflow: auto; overscroll-behavior: contain;
}
.sheet-stage #r-solfa { border-radius: 18px; }
.sheet-stage-close { display: none; }
/* Full screen: the frame lifts over everything, with its own way out. */
.sheet-stage.is-full {
  position: fixed; inset: 0; z-index: 70; background: var(--bg); padding: 56px 16px 16px; overflow: auto; overscroll-behavior: contain;
}
.sheet-stage.is-full .sheet-stage-close { display: inline-flex; position: fixed; top: 12px; right: 16px; z-index: 71; }
.sheet-stage.is-full #r-staff .sheet-wrap, .sheet-stage.is-full #r-solfa, .sheet-stage.is-full #r-parts { max-height: none; overflow: visible; }
body.sheet-full { overflow: hidden; }
@media (prefers-reduced-motion: no-preference) { .sheet-stage.is-full { animation: nf-rise 250ms ease-out both; } }

.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; align-items: center; }
.result-actions #play { min-width: 112px; }
.act { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--wash); color: var(--ink); font: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer;
  transition-property: transform, background-color, border-color, color; transition-duration: 150ms; transition-timing-function: ease-out; -webkit-tap-highlight-color: transparent; }
:root[data-theme="dark"] .act { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.10); }
.act .ic { width: 17px; height: 17px; color: var(--blue-dark); }
@media (hover: hover) { .act:hover { border-color: var(--blue); } }
@media (prefers-reduced-motion: no-preference) { .act:active { transform: scale(0.97); } }
.act .act-lock { display: none; width: 13px; height: 13px; color: var(--premium); }
body:not(.is-pro):not(.guest) .act-pro .act-lock { display: inline-block; }
body:not(.is-pro):not(.guest) .act-pro { border-color: var(--premium-line); }
.act[hidden] { display: none; }
@media (max-width: 640px) {
  /* A phone gets a row that scrolls sideways, not three wrapped rows. */
  .result-actions { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; margin-left: -14px; margin-right: -14px; padding: 2px 14px 4px; }
  .result-actions::-webkit-scrollbar { display: none; }
  .result-actions > * { flex: none; }
  .result-head { gap: 10px; }
  .result-views { width: 100%; }
  .result-views .tabs { flex: 1; }
}
.guest-cta { margin-top: 14px; }

/* ── The tool pop-up: a bottom sheet on a phone, a dialog on a desk ── */
.tool-dock { display: none !important; }
.tool-card { width: min(620px, 100%); padding: 26px 22px 22px; }
.tool-body > .section { border: 0; padding: 0; background: none !important; }
.tool-body > .section > h2 { font-size: 1.2rem; padding-right: 44px; }
.tool-card.is-locked .tool-body { filter: blur(5px); opacity: 0.55; pointer-events: none; user-select: none; }
.tool-lock { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 24px;
  background: linear-gradient(180deg, transparent, var(--surface) 70%); border-radius: inherit; }
:root[data-theme="dark"] .tool-lock { background: linear-gradient(180deg, rgba(14, 18, 26, 0.2), #0E121A 72%); }
.tool-lock strong { font-size: 1.15rem; color: var(--ink); letter-spacing: -0.02em; }
.tool-lock span:not(.pay-badge) { color: var(--muted); max-width: 40ch; }
.tool-lock .btn { margin-top: 6px; }
.tool-card.is-locked { min-height: 300px; }
@media (max-width: 640px) {
  .tool-modal { align-items: flex-end; padding: 0; }
  .tool-card { width: 100%; border-radius: 26px 26px 0 0; max-height: 86vh; max-height: 86dvh; padding: 22px 16px calc(18px + env(safe-area-inset-bottom)); }
  .tool-card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 999px; background: var(--line-strong); margin: -8px auto 14px; }
}
@keyframes nf-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .tool-modal:not(.hidden) .tool-card { animation: nf-rise 260ms ease-out both; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 640px) {
  .tool-modal:not(.hidden) .tool-card { animation: nf-sheet-up 300ms cubic-bezier(0.2, 0, 0, 1) both; }
}

/* ── Pro, seen through frosted glass ── */
.pro-previews { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 4px 0 14px; }
.pro-tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; padding: 12px; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--premium-line); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer;
  transition-property: transform, border-color; transition-duration: 150ms; transition-timing-function: ease-out; -webkit-tap-highlight-color: transparent; }
:root[data-theme="dark"] .pro-tile { background: rgba(255, 255, 255, 0.03); }
@media (hover: hover) { .pro-tile:hover { border-color: var(--premium); } }
@media (prefers-reduced-motion: no-preference) { .pro-tile:active { transform: scale(0.97); } }
.pro-tile strong { font-size: 0.92rem; letter-spacing: -0.01em; }
.pro-tile small { color: var(--muted); font-size: 0.78rem; line-height: 1.35; }
.pro-glass { display: block; width: 100%; height: 74px; margin-bottom: 8px; border-radius: 12px; overflow: hidden; background: var(--wash);
  filter: blur(3.5px); user-select: none; }
:root[data-theme="dark"] .pro-glass { background: rgba(255, 255, 255, 0.04); }
.pro-lock { position: absolute; top: 18px; right: 18px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: linear-gradient(135deg, #FBD27A, var(--premium)); color: var(--premium-ink); box-shadow: 0 4px 14px rgba(245, 181, 68, 0.35); }
.pro-lock .ic { width: 12px; height: 12px; }
.pro-satb { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 10px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink); white-space: nowrap; }
.pro-satb em { font-style: normal; color: var(--blue-dark); font-weight: 700; margin-right: 6px; }
.pro-marks { display: flex; flex-wrap: wrap; align-content: center; gap: 4px; padding: 8px; }
.pro-marks i { font-style: normal; font-family: var(--font-mono); font-weight: 700; font-size: 0.75rem; padding: 3px 7px; border-radius: 7px; border: 1.5px solid; }
.pro-marks .hit { color: var(--success); } .pro-marks .near { color: var(--amber); } .pro-marks .wrong { color: var(--danger); }
.pro-pdf { position: relative; padding: 10px 14px; }
.pro-pdf i { display: block; height: 5px; margin: 6px 0; border-radius: 3px; background: var(--line-strong); }
.pro-pdf i:nth-child(2) { width: 80%; } .pro-pdf i:nth-child(4) { width: 65%; }
.pro-pdf b { position: absolute; right: 12px; bottom: 8px; font-size: 0.7rem; color: #fff; background: var(--danger); padding: 2px 6px; border-radius: 4px; }
.pro-long { display: block; padding: 12px 10px;
  background: repeating-linear-gradient(180deg, var(--line-strong) 0 1.5px, transparent 1.5px 8px) 10px 12px / calc(100% - 20px) 34px no-repeat, var(--wash); }
.pro-long i { display: inline-block; width: 9px; height: 7px; margin: 18px 10px 0 6px; border-radius: 50%; background: var(--ink); }
.pro-plus { margin: 2px 0 8px; color: var(--ink); }
@media (max-width: 420px) { .pro-tile { padding: 10px; } .pro-tile small { display: none; } .pro-glass { height: 56px; } .pro-lock { top: 14px; right: 14px; padding: 3px 8px; } }

/* Downloads in the pop-up: a free account sees the Pro formats locked, the solfa text free. */
.dl-pro-note { margin-bottom: 12px; }
body.is-pro .dl-pro-note { display: none; }
.downloads { margin-top: 0; }

/* Fit the result to a phone's first screen: the expand button keeps its size, the credit takes one
   line, and the frame leaves room for the row of actions under it. */
.result-views > .btn-icon { flex: none; }
.chip-preview { background: var(--premium-soft); color: var(--premium); }
:root:not([data-theme="dark"]) .chip-preview { color: #92400E; }
@media (max-width: 640px) {
  /* Stacked, the header stretches to the card: centred items would size to their text, and the
     one-line credit would then push the whole page sideways. */
  .result-head { align-items: stretch; }
  .result-head .song { min-width: 0; width: 100%; }
  #r-credit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sheet-stage #r-staff .sheet-wrap, .sheet-stage #r-solfa, .sheet-stage #r-parts {
    max-height: clamp(220px, calc(100vh - 430px), 520px); max-height: clamp(220px, calc(100dvh - 430px), 520px);
  }
  .result-top { margin-bottom: 6px; }
  .song .title { font-size: 1.15rem; }
}

/* A free account's one four-part harmony: no lock on that action until it is used. */
body.has-free-harmony .act[data-tool="harmony"] .act-lock { display: none; }
body.has-free-harmony .act[data-tool="harmony"] { border-color: var(--line); }
