/* QMM BakeTunes Studio Pro — dark luxury. A near-black violet field, gold as the lead voice,
   softer jewel accents blended rather than blocked, glass panels with gold hairlines, and
   sacred geometry + golden notes as quiet atmosphere. */
:root {
  --ink-0: #07060c;
  --ink-1: #0e0b16;
  --ink-2: #151122;
  --ink-3: #1f1930;
  --glass: rgba(20, 16, 32, 0.66);
  --glass-2: rgba(28, 22, 44, 0.72);
  --line: rgba(226, 182, 92, 0.16);
  --line-strong: rgba(226, 182, 92, 0.34);
  --text: #f6efe2;
  --text-dim: #c3b9cf;
  --text-mute: #877d96;

  --gold-1: #f7e7b4;
  --gold: #e2b65c;
  --gold-2: #c8923a;
  --gold-3: #8f6522;
  --c-gold: #e2b65c;
  --c-rose: #d9789b;
  --c-teal: #5fd3bf;
  --c-violet: #a98bf0;
  --c-amber: #e9965a;
  /* names the video editor still uses */
  --teal: var(--c-teal);
  --magenta: var(--c-rose);
  --violet: var(--c-violet);
  --tangerine: var(--c-amber);
  --ok: var(--c-teal);
  --warn: var(--c-amber);
  --bad: #e5636f;

  --grad-gold: linear-gradient(135deg, var(--gold-1) 0%, var(--gold) 42%, var(--gold-2) 78%, var(--gold-3) 100%);
  --grad-rose: linear-gradient(135deg, #f1b3c6 0%, #d9789b 45%, #a8507a 100%);
  --grad-teal: linear-gradient(135deg, #b9f1e6 0%, #5fd3bf 50%, #2f9c8c 100%);
  --grad-aurora: linear-gradient(120deg, rgba(217, 120, 155, 0.16), rgba(169, 139, 240, 0.12) 48%, rgba(95, 211, 191, 0.1));
  --hairline: 1px solid var(--line);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.85);
  --glow-gold: 0 0 0 1px rgba(226, 182, 92, 0.55), 0 0 32px rgba(226, 182, 92, 0.28);
  --glow-rose: 0 0 0 1px rgba(217, 120, 155, 0.5), 0 0 28px rgba(217, 120, 155, 0.26);
  --glow-teal: 0 0 0 1px rgba(95, 211, 191, 0.45), 0 0 26px rgba(95, 211, 191, 0.22);

  --font-display: "Cormorant Garamond", "Cormorant", Georgia, serif;
  --font-ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 12% -12%, rgba(169, 139, 240, 0.13), transparent 62%),
    radial-gradient(900px 640px at 100% 0%, rgba(217, 120, 155, 0.1), transparent 60%),
    radial-gradient(1000px 760px at 60% 115%, rgba(226, 182, 92, 0.09), transparent 62%),
    var(--ink-0);
  background-attachment: fixed;
  overflow-x: hidden;
}
body::after { /* fine grain, the difference between flat and expensive */
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, header, .toast-stack { position: relative; z-index: 1; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- atmosphere ---------- */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.backdrop .emblem { position: absolute; right: -14vmin; top: 8vh; width: 78vmin; height: 78vmin; opacity: 0.075; }
.note-field span {
  position: absolute; bottom: -40px; color: transparent; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text;
  opacity: 0; animation: float-note linear infinite; filter: drop-shadow(0 0 6px rgba(226, 182, 92, 0.25));
}
@keyframes float-note {
  0% { transform: translateY(0) rotate(-8deg); opacity: 0; }
  12% { opacity: 0.32; }
  80% { opacity: 0.22; }
  100% { transform: translateY(-110vh) rotate(10deg); opacity: 0; }
}
.emblem .turn { transform-origin: 0 0; animation: turn 90s linear infinite; }
.emblem .turn.slow { animation-duration: 160s; }
.emblem .turn.reverse { animation-direction: reverse; animation-duration: 120s; }
.emblem:not(.spin) .turn { animation: none; }
@keyframes turn { to { transform: rotate(360deg); } }
.freqline { height: 2px; background: linear-gradient(90deg, transparent, var(--gold-3) 15%, var(--gold-1) 50%, var(--gold-3) 85%, transparent); background-size: 200% 100%; animation: shimmer 9s linear infinite; opacity: 0.85; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .note-field, .emblem .turn, .freqline { animation: none !important; }
  .note-field { display: none; }
}

/* ---------- top bar ---------- */
/* The bar is sticky: whatever the page scrolls into view (keyboard focus, a jump) lands below it, not under it. */
html { scroll-padding-top: 96px; }
@media (max-width: 720px) { html { scroll-padding-top: 180px; } }
.topbar {
  display: flex; align-items: center; gap: 28px; padding: 14px 28px;
  background: linear-gradient(180deg, rgba(7, 6, 12, 0.92), rgba(7, 6, 12, 0.72));
  backdrop-filter: blur(14px); border-bottom: var(--hairline);
  position: sticky; top: 0; z-index: 20;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-mark { width: 42px; height: 42px; flex: none; display: block; }
.logo-word { display: grid; line-height: 1; }
.logo-word b { font-family: var(--font-display); font-weight: 700; font-size: 25px; letter-spacing: 0.08em; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo-word small { font-size: 9.5px; font-weight: 700; letter-spacing: 0.42em; color: var(--text-mute); margin-top: 3px; }
.tabs { display: flex; gap: 4px; }
.tabs a { text-decoration: none; padding: 9px 16px; border-radius: 999px; color: var(--text-dim); font-weight: 600; letter-spacing: 0.02em; border: 1px solid transparent; transition: color 0.15s, border-color 0.15s, background 0.15s; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--gold-1); border-color: var(--line-strong); background: linear-gradient(180deg, rgba(226, 182, 92, 0.14), rgba(226, 182, 92, 0.04)); }
.health { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--glass); border: var(--hairline); color: var(--text-dim); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--text-mute); }
.chip.ok::before { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.chip.warn::before { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.chip.bad::before { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.chip.plain::before { display: none; }
main { max-width: 1500px; margin: 0 auto; padding: 30px 28px 90px; outline: none; }
main:focus-visible { outline: none; } /* focused by the router for screen readers; a ring round the whole page is noise */

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px;
  border: 1px solid var(--line-strong); font-weight: 700; letter-spacing: 0.015em; cursor: pointer; text-decoration: none;
  background: var(--glass-2); color: var(--text); transition: transform 0.08s ease, box-shadow 0.25s, filter 0.2s, opacity 0.2s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; transform: none; filter: none; }
.btn.gold { background: var(--grad-gold); color: #1d1406; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn.gold:hover { box-shadow: var(--glow-gold), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn.hot { background: var(--grad-rose); color: #fff7f2; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn.hot:hover { box-shadow: var(--glow-rose), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn.teal { background: var(--grad-teal); color: #062420; border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.btn.teal:hover { box-shadow: var(--glow-teal); }
.btn.ghost { background: transparent; color: var(--text-dim); border-color: var(--line); }
.btn.ghost:hover { color: var(--gold-1); border-color: var(--line-strong); }
.btn.ghost.on { color: var(--gold-1); border-color: var(--gold); background: rgba(226, 182, 92, 0.1); }
.btn.danger { background: transparent; border-color: rgba(229, 99, 111, 0.45); color: #f0a0a8; }
.btn.danger:hover { background: rgba(229, 99, 111, 0.1); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn .cost { font-family: var(--font-mono); font-size: 11.5px; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, 0.2); }
.btn.rec.on { background: linear-gradient(135deg, #ff8f97, #e5636f 55%, #b03a48); color: #fff; border-color: transparent; box-shadow: 0 0 22px rgba(229, 99, 111, 0.5); }

label.field { display: grid; gap: 7px; font-weight: 600; font-size: 14px; color: var(--text-dim); }
.field.mini { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); gap: 5px; }
.field input, .field textarea, .field select, textarea.prompt, select {
  padding: 10px 12px; border-radius: 10px; background: rgba(10, 8, 18, 0.7); border: var(--hairline); color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input, .field textarea, textarea.prompt { width: 100%; }
.field input:focus, .field textarea:focus, textarea.prompt:focus, select:focus { border-color: var(--gold); box-shadow: var(--glow-gold); outline: none; }
.field textarea, textarea.prompt { resize: vertical; min-height: 110px; line-height: 1.5; }
.hint { font-size: 12.5px; color: var(--text-mute); font-weight: 500; }
.label-sm { font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-mute); }
input[type="range"] { width: 100%; accent-color: var(--gold); }

/* ---------- headings ---------- */
.display { font-family: var(--font-display); font-weight: 600; line-height: 0.98; margin: 0; letter-spacing: 0.005em; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.36em; text-transform: uppercase; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.section-title { display: flex; align-items: center; gap: 16px; margin: 46px 0 18px; }
.section-title h2 { font-family: var(--font-display); font-weight: 600; font-size: 30px; margin: 0; }
.section-title .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

/* ---------- library hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: center; padding: 44px 48px; border-radius: 26px;
  background: var(--grad-aurora), linear-gradient(180deg, rgba(20, 16, 32, 0.9), rgba(12, 10, 20, 0.9));
  border: var(--hairline); position: relative; overflow: hidden; box-shadow: var(--shadow);
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(48px, 6.4vw, 92px); font-weight: 600; }
.hero h1 .a { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero h1 .b { color: var(--text); font-style: italic; }
.hero h1 .c { background: linear-gradient(135deg, #f1b3c6, #d9789b 40%, #a98bf0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-dim); font-size: 17px; line-height: 1.65; max-width: 560px; }
.hero-art { display: grid; place-items: center; position: relative; }
.hero-art .emblem { width: min(420px, 100%); height: auto; filter: drop-shadow(0 0 30px rgba(226, 182, 92, 0.18)); }
.hero-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.hero-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: rgba(10, 8, 18, 0.55); border: var(--hairline); }
.hero-step b { font-family: var(--font-display); font-size: 26px; line-height: 0.9; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-step strong { display: block; margin-bottom: 2px; }
.hero-step span { color: var(--text-dim); font-size: 13px; line-height: 1.45; }
.hero-cta { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- bake cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.card { border-radius: var(--r-lg); overflow: hidden; background: var(--glass); border: var(--hairline); display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform 0.2s ease, box-shadow 0.3s, border-color 0.3s; --accent: var(--c-gold); }
.card:hover { transform: translateY(-4px); border-color: var(--line-strong); box-shadow: 0 0 0 1px rgba(226, 182, 92, 0.25), 0 30px 70px -30px rgba(0, 0, 0, 0.9); }
.card:nth-child(4n+2) { --accent: var(--c-rose); }
.card:nth-child(4n+3) { --accent: var(--c-teal); }
.card:nth-child(4n+4) { --accent: var(--c-violet); }
.card-art { position: relative; aspect-ratio: 16 / 9; background: radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%), var(--ink-2); overflow: hidden; cursor: pointer; }
.card-art img, .card-art video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-art .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 44px; color: rgba(246, 239, 226, 0.25); }
.card-art .badge { position: absolute; left: 12px; top: 12px; }
.card-body { padding: 16px 18px 18px; display: grid; gap: 8px; flex: 1; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0; text-transform: capitalize; }
.card-msg { color: var(--text-dim); font-size: 14px; line-height: 1.55; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.card-actions { display: flex; gap: 8px; margin-top: 8px; }
.card-actions .btn:first-child { flex: 1; }
.card-stripe { height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.8; }
.status { font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: rgba(7, 6, 12, 0.78); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
.status.planned { color: var(--gold-1); border-color: var(--line-strong); }
.status.uploaded { color: var(--c-teal); border-color: rgba(95, 211, 191, 0.5); }
.status.failed { color: #f0a0a8; border-color: rgba(229, 99, 111, 0.5); }
.status.busy { color: var(--c-rose); border-color: rgba(217, 120, 155, 0.55); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.empty { padding: 48px; border-radius: var(--r-lg); border: 1px dashed var(--line-strong); text-align: center; color: var(--text-dim); background: var(--glass); }

/* ---------- panels, new bake ---------- */
.panel { background: var(--glass); border: var(--hairline); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.panel h3 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.stack { display: grid; gap: 16px; }
.newbake { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: start; }
.drop { border: 1px dashed var(--line-strong); border-radius: var(--r-lg); padding: 34px 20px; text-align: center; cursor: pointer; background: radial-gradient(circle at 50% 0%, rgba(226, 182, 92, 0.08), transparent 70%); transition: background 0.2s, box-shadow 0.2s; }
.drop:hover, .drop.over { box-shadow: var(--glow-gold); background: radial-gradient(circle at 50% 0%, rgba(226, 182, 92, 0.16), transparent 70%); }
.drop .big { font-family: var(--font-display); font-size: 28px; font-weight: 600; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.drop .file { margin-top: 10px; font-family: var(--font-mono); color: var(--gold-1); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { padding: 7px 12px; border-radius: 999px; background: transparent; border: var(--hairline); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dim); }
.preset:hover { color: var(--text); border-color: var(--line-strong); }
.preset.on { color: var(--gold-1); border-color: var(--gold); background: rgba(226, 182, 92, 0.12); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(10, 8, 18, 0.7); border: var(--hairline); }
.seg button { padding: 7px 13px; border: 0; background: transparent; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--grad-gold); color: #1d1406; }
.how { display: grid; gap: 14px; padding-left: 20px; }
.how li { color: var(--text-dim); line-height: 1.6; }
.how li::marker { color: var(--gold); font-family: var(--font-display); }
.how strong { color: var(--text); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- editor (video) ---------- */
.editor-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.editor-head h1 { font-family: var(--font-display); font-weight: 600; font-size: 36px; margin: 0; text-transform: capitalize; }
.editor-head .spacer, .spacer { flex: 1; }
.editor { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 20px; }
.monitor { background: #000; border-radius: var(--r-lg); overflow: hidden; border: var(--hairline); position: relative; box-shadow: var(--shadow); }
.monitor video { width: 100%; aspect-ratio: 16 / 9; display: block; background: #000; }
.monitor .nofootage { aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--text-dim); background: var(--grad-aurora), var(--ink-1); }
.monitor .tag { position: absolute; top: 12px; left: 12px; }
.transport { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--glass-2); border-top: var(--hairline); flex-wrap: wrap; }
.timecode { font-family: var(--font-mono); font-size: 14px; color: var(--gold-1); min-width: 130px; }
.inspector { display: grid; gap: 14px; align-content: start; }
.inspector .panel { padding: 18px; }
.inspector .scene-panel { max-height: calc(100vh - 150px); overflow: auto; }
.scene-kicker { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.scene-kicker .num { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lyric-quote { font-family: var(--font-display); font-size: 21px; font-style: italic; line-height: 1.4; padding: 10px 14px; border-left: 2px solid var(--gold); background: linear-gradient(90deg, rgba(226, 182, 92, 0.08), transparent); margin: 6px 0 10px; }
.lyric-quote.none { border-color: var(--text-mute); color: var(--text-mute); background: transparent; }
.intent { color: var(--c-teal); font-weight: 600; line-height: 1.5; margin: 0 0 10px; }
.takes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.take { border-radius: 12px; overflow: hidden; border: var(--hairline); background: var(--ink-2); }
.take.on { border-color: var(--gold); box-shadow: var(--glow-gold); }
.take img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--ink-3); cursor: pointer; }
.take .take-bar { display: flex; align-items: center; justify-content: space-between; gap: 4px; padding: 6px 7px; font-size: 12px; font-weight: 700; }
.take .take-bar button { border: 0; background: transparent; cursor: pointer; color: var(--text-dim); padding: 2px 5px; border-radius: 6px; font-weight: 700; }
.take .take-bar button:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.take .take-bar button.del:hover { color: #f0a0a8; }
.knob { display: grid; gap: 6px; font-size: 11px; font-weight: 700; color: var(--text-mute); letter-spacing: 0.12em; text-transform: uppercase; }
.knob output { font-family: var(--font-mono); color: var(--gold-1); font-size: 12.5px; letter-spacing: 0; }
.songread dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.songread dt { color: var(--text-mute); font-weight: 700; }
.songread dd { margin: 0; color: var(--text-dim); line-height: 1.55; }
@media (min-width: 1100px) { .songread dl { grid-template-columns: max-content 1fr max-content 1fr; column-gap: 24px; } }
.editor + .timeline + .songread { margin-top: 20px; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: var(--hairline); color: var(--text-dim); }
.core { font-family: var(--font-display); font-size: 22px; line-height: 1.45; margin: 0 0 14px; max-width: 980px; }
details.panel summary { cursor: pointer; font-family: var(--font-display); font-size: 24px; font-weight: 600; list-style: none; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::after { content: " +"; color: var(--gold); }
details.panel[open] summary::after { content: " -"; }

/* ---------- timeline ---------- */
.timeline { margin-top: 20px; background: var(--glass); border: var(--hairline); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.tl-toolbar { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: var(--hairline); flex-wrap: wrap; }
.tl-toolbar .label { font-family: var(--font-display); font-size: 18px; font-weight: 600; }
.tl-toolbar .zoom { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--text-mute); font-size: 13px; }
.tl-toolbar .zoom input { width: 140px; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-mute); flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }
.tl-scroll { overflow-x: auto; position: relative; }
.tl-inner { position: relative; min-width: 100%; padding-bottom: 6px; }
.lane { position: relative; display: flex; }
.lane-label { position: sticky; left: 0; z-index: 6; width: 82px; flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); background: var(--ink-1); display: flex; align-items: center; padding-left: 12px; border-right: var(--hairline); }
.lane-body { position: relative; flex: 1; }
.lane.ruler .lane-body { height: 24px; border-bottom: var(--hairline); cursor: pointer; }
.tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid rgba(226, 182, 92, 0.14); font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); padding: 4px 0 0 4px; pointer-events: none; }
.lane.sections .lane-body { height: 26px; }
.sec { position: absolute; top: 4px; bottom: 4px; border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #120d1c; }
.sec.intro, .sec.outro { background: linear-gradient(135deg, #c9b6f7, var(--c-violet)); }
.sec.verse { background: linear-gradient(135deg, #a9ecdf, var(--c-teal)); }
.sec.pre-chorus { background: linear-gradient(135deg, #f4c19b, var(--c-amber)); }
.sec.chorus, .sec.hook { background: var(--grad-rose); color: #fff7f2; }
.sec.bridge { background: var(--grad-gold); }
.sec.other { background: var(--text-mute); }
.lane.clips .lane-body { height: 86px; }
.clip { position: absolute; top: 6px; bottom: 6px; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--ink-3); border: 1px solid var(--line); transition: border-color 0.12s, box-shadow 0.2s; }
.clip:hover { border-color: var(--line-strong); }
.clip.selected { border-color: var(--gold); box-shadow: var(--glow-gold); z-index: 2; }
.clip.missing { background: repeating-linear-gradient(135deg, rgba(226, 182, 92, 0.1) 0 10px, rgba(226, 182, 92, 0.03) 10px 20px); border-style: dashed; border-color: rgba(226, 182, 92, 0.4); }
.clip.still { background: repeating-linear-gradient(135deg, rgba(233, 150, 90, 0.16) 0 10px, rgba(233, 150, 90, 0.05) 10px 20px); }
.clip .film { position: absolute; inset: 0; background-size: auto 100%; background-repeat: repeat-x; opacity: 0.92; }
.clip .clip-label { position: absolute; left: 6px; bottom: 5px; right: 6px; font-size: 11px; font-weight: 700; text-shadow: 0 1px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clip .clip-num { position: absolute; left: 7px; top: 4px; font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--gold-1); text-shadow: 0 1px 4px #000; }
.clip.drop-target { border-color: var(--c-teal); box-shadow: var(--glow-teal); }
.clip.dragging { opacity: 0.5; }
.clip.resizing { border-color: var(--gold-1); transition: none; }
/* The cut line between two clips: drag it (the song stays put). */
.clip .cut-handle { position: absolute; top: 0; bottom: 0; right: -2px; width: 12px; cursor: col-resize; z-index: 3; border-right: 2px solid transparent; }
.clip .cut-handle:hover, .clip.resizing .cut-handle { border-right-color: var(--gold-1); background: linear-gradient(90deg, transparent, rgba(226, 182, 92, 0.25)); }
.clip .cut-handle .cut-time { position: absolute; top: -22px; right: -24px; padding: 2px 6px; border-radius: 6px; background: var(--ink-1); border: 1px solid var(--gold); color: var(--gold-1); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; z-index: 7; }
/* A transition into this scene. */
.clip .clip-fx { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); z-index: 2; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 7px; border-radius: 999px; background: rgba(10, 8, 18, 0.78); border: 1px solid var(--gold); color: var(--gold-1); white-space: nowrap; }
.take img[draggable="true"] { cursor: grab; }
.take img[draggable="true"]:active { cursor: grabbing; }
/* The live preview: two videos take turns, a veil for flashes and dips, a card where a scene has no clip. */
.preview { position: relative; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.preview video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #000; aspect-ratio: auto; }
.preview video.front { z-index: 1; }
.preview video.back { z-index: 2; opacity: 0; transform-origin: 50% 50%; }
.preview .veil { position: absolute; inset: 0; z-index: 3; opacity: 0; pointer-events: none; }
.preview .preview-card { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--text-dim); background: var(--grad-aurora), var(--ink-1); }
.preview .preview-card[hidden] { display: none; }
.preview .card-title { font-size: 26px; color: var(--gold); }
/* The transition picker in the inspector. */
.fx { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(10, 8, 18, 0.45); border: var(--hairline); }
.fx .fx-label { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-mute); }
.fx select { padding: 7px 9px; font-size: 13px; }
.fx .fx-knob { flex: 1; min-width: 160px; }
.lane.lyrics .lane-body { height: 34px; }
.lyr { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; background: rgba(226, 182, 92, 0.08); border-left: 2px solid var(--gold); font-size: 11px; color: var(--text-dim); padding: 3px 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lane.wave .lane-body { height: 58px; cursor: pointer; }
.lane.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold-1); box-shadow: 0 0 12px var(--gold); z-index: 5; pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top-color: var(--gold-1); }
.jobbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--r-md); background: var(--grad-aurora), var(--glass); border: var(--hairline); margin-bottom: 16px; }
.jobbar .spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(226, 182, 92, 0.2); border-top-color: var(--gold); animation: turn 0.9s linear infinite; flex: none; }
.errorbar { padding: 12px 16px; border-radius: var(--r-md); background: rgba(229, 99, 111, 0.08); border: 1px solid rgba(229, 99, 111, 0.4); color: #f3b5bb; margin-bottom: 16px; }

/* ---------- Beat Lab Pro ---------- */
.lab-head { display: grid; grid-template-columns: 1fr 230px 1.15fr; gap: 24px; align-items: center; padding: 22px 26px; border-radius: 24px; background: var(--grad-aurora), var(--glass); border: var(--hairline); box-shadow: var(--shadow); }
.lab-title { min-width: 0; }
.lab-title h2 { font-size: clamp(40px, 4.6vw, 64px); }
.lab-title .pro { font-style: italic; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sigil-wrap { aspect-ratio: 1; width: 100%; max-width: 230px; justify-self: center; position: relative; }
.sigil { width: 100%; height: 100%; display: block; }
.sigil-b { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.lcd { margin-top: 12px; font-family: var(--font-mono); font-size: 12.5px; color: var(--gold-1); padding: 9px 12px; border-radius: 10px; background: linear-gradient(180deg, #0b0910, #120e1b); border: var(--hairline); box-shadow: inset 0 0 18px rgba(226, 182, 92, 0.08); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transport-pro { display: grid; gap: 14px; }
.knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.knobs select { padding: 7px 9px; font-size: 13px; }
.packs .section-title { margin-top: 30px; }
.pack-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-color: var(--gold-3) transparent; }
.pack { text-align: left; display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--glass); border: var(--hairline); cursor: pointer; transition: border-color 0.2s, transform 0.12s, box-shadow 0.3s; position: relative; overflow: hidden; }
.pack::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: 0.5; }
.pack:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--glow-gold); }
.pack b { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--gold-1); }
.pack span { font-size: 12.5px; color: var(--text-dim); line-height: 1.4; }
.pack small { font-family: var(--font-mono); font-size: 11px; color: var(--text-mute); margin-top: 4px; }
/* A pack being heard from the shelf. */
.pack.playing { border-color: var(--gold); box-shadow: var(--glow-gold); }
.pack:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.pack .pack-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; min-height: 28px; }
.pack .now { display: none; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-1); }
.pack.playing .now { display: inline-flex; align-items: center; gap: 7px; }
.pack.playing .now::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold-1); box-shadow: 0 0 10px var(--gold); animation: packpulse 1s ease-in-out infinite; }
@keyframes packpulse { 50% { opacity: 0.3; } }
.pack .use { margin-left: auto; font-size: 11.5px; padding: 5px 9px; }
/* The BASS+ switch on the beat-pack shelf. */
.packs .section-title .bassplus { margin-left: 8px; white-space: nowrap; }
.packs .section-title .bassplus.on { border-color: var(--gold); color: var(--gold-1); box-shadow: var(--glow-gold); }
.packs .section-title .upnext { margin-left: 8px; white-space: nowrap; color: var(--gold-1); font-size: 0.82rem; letter-spacing: 0.04em; }
/* Your own beats (audioshelf.js): the upload button and their row above the packs. */
.packs .section-title .upload-beat { margin-left: 8px; white-space: nowrap; border-color: var(--line-strong); color: var(--gold-1); }
.packs .user-row { margin-bottom: 4px; }
.pack.user { border-color: rgba(226, 182, 92, 0.32); background: linear-gradient(160deg, rgba(226, 182, 92, 0.09), transparent 60%), var(--glass); }
.transport-pro .repeat { white-space: nowrap; }
.transport-pro .repeat.on { border-color: var(--gold); color: var(--gold-1); box-shadow: var(--glow-gold); }
/* The vocal booth (vocalbooth.js): mic, level, timing, Record - then the takes. */
.booth .section-title { margin-top: 30px; }
.booth-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px; border-radius: 16px; background: var(--glass); border: var(--hairline); }
.booth-row select { max-width: 280px; padding: 7px 9px; font-size: 13px; }
.booth-meter { position: relative; width: 140px; height: 10px; border-radius: 6px; background: #0b0910; border: var(--hairline); overflow: hidden; }
.booth-meter-bar { position: absolute; inset: 0 auto 0 0; width: 0%; background: linear-gradient(90deg, var(--gold-3), var(--gold-1)); transition: width 60ms linear; }
.booth-meter.hot .booth-meter-bar { background: linear-gradient(90deg, var(--gold-1), #e5636f); }
.booth-nudge { display: grid; gap: 4px; font-size: 12px; color: var(--text-dim); min-width: 160px; }
.booth-nudge output { color: var(--gold-1); font-family: var(--font-mono); }
.booth-rec { margin-left: auto; font-weight: 700; border-color: rgba(229, 99, 111, 0.55); color: #ffb3b9; }
.booth-rec.on { background: linear-gradient(135deg, #ff8f97, #e5636f 55%, #b03a48); color: #fff; border-color: transparent; box-shadow: 0 0 22px rgba(229, 99, 111, 0.5); animation: packpulse 1.2s ease-in-out infinite; }
/* armed: ready to go - solid, not pulsing (the pulse means it is recording) */
.booth-rec.armed { background: rgba(229, 99, 111, 0.18); color: #fff; border-color: #e5636f; box-shadow: 0 0 16px rgba(229, 99, 111, 0.3); }
.booth-cancel[hidden] { display: none; } /* .btn's display: inline-flex would beat [hidden] */
.booth-status { margin: 8px 2px 0; font-size: 12.5px; color: var(--gold-1); min-height: 1em; }
.booth-sync { white-space: nowrap; }
/* Next take (nexttake.js): what the next take will be, and its preset - set before recording. */
.next-take { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 8px; padding: 10px 16px; border-radius: 14px; background: var(--glass); border: var(--hairline); }
.next-role { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
.next-role select { padding: 6px 8px; font-size: 13px; letter-spacing: 0; text-transform: none; }
.next-which { font-size: 12px; color: var(--gold-1); }
.next-ctls { display: grid; grid-template-columns: repeat(3, minmax(90px, 140px)); gap: 4px 12px; }
.next-hint { font-size: 11.5px; color: var(--text-mute); }
/* The track view (tracks.js): n-Track-style lanes - the beat, then one per take - on one time line and playhead. */
.tracks { margin-top: 12px; display: grid; gap: 6px; --head-w: 360px; }
.tracks[hidden], .tracks .track[hidden], .tracks .booth-takes[hidden] { display: none; } /* display: grid would beat [hidden] */
.tracks-ruler, .track { display: grid; grid-template-columns: var(--head-w) minmax(0, 1fr); gap: 8px; }
.booth-takes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.track-head { display: grid; align-content: center; gap: 6px; padding: 8px 10px; border-radius: 12px; background: var(--glass); border: var(--hairline); min-width: 0; }
.track-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.track-title b { font-family: var(--font-display); color: var(--gold-1); font-size: 17px; font-variant-numeric: lining-nums; white-space: nowrap; }
.track-title .btn.sm { padding: 4px 9px; font-size: 12px; }
.track-sub { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-ctls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 10px; }
.track-beat .track-ctls { grid-template-columns: minmax(0, 1fr); }
.track-role { padding: 3px 6px; font-size: 12px; max-width: 100px; }
.track-solo[aria-pressed="true"] { border-color: var(--gold); color: var(--gold-1); box-shadow: var(--glow-gold); }
.booth-takes li.soloed .track-head { border-color: var(--line-strong); }
.track-act { display: flex; align-items: flex-end; }
.track-tighten[hidden] { display: none; }
.track-ctl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-mute); }
.track-ctl output { font-family: var(--font-mono); color: var(--gold-1); letter-spacing: 0; text-transform: none; }
.track-ctl input { grid-column: 1 / -1; margin: 2px 0 0; }
.track-lane { position: relative; min-height: 64px; border-radius: 12px; background: #0b0910; border: var(--hairline); overflow: hidden; cursor: pointer; }
.lane-wave { position: absolute; inset: 0; width: 100%; height: 100%; display: block; color: var(--c-rose); }
.track-beat .lane-wave { color: var(--gold); }
.track-live .lane-wave { color: #ff8f97; }
/* the stack, by colour: lead rose, doubles violet, ad-libs teal, harmonies amber */
.booth-takes li[data-role="double"] .lane-wave { color: var(--c-violet); }
.booth-takes li[data-role="adlib"] .lane-wave { color: var(--c-teal); }
.booth-takes li[data-role="harmony"] .lane-wave { color: var(--c-amber); }
.booth-takes li.muted .lane-wave { color: var(--text-mute); }
.booth-takes li.muted .track-head { opacity: 0.6; }
.lane-note { position: absolute; inset: 0; display: grid; place-items: center; padding: 0 12px; text-align: center; font-size: 12px; color: var(--text-mute); pointer-events: none; }
.lane-note:empty { display: none; }
.track-empty .track-lane { cursor: default; border-style: dashed; background: transparent; }
.track-live .track-title b { color: #ffb3b9; }
.track-live .track-title b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #e5636f; box-shadow: 0 0 10px #e5636f; vertical-align: 2px; animation: packpulse 1.2s ease-in-out infinite; }
.track-live.ready .track-title b::before { background: transparent; border: 2px solid #e5636f; box-shadow: none; animation: none; width: 6px; height: 6px; } /* armed: a hollow dot */
.ruler-lane { position: relative; height: 16px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); }
.ruler-lane span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ruler-lane span.first { transform: none; }
.ruler-lane span.last { transform: translateX(-100%); }
/* The playhead: one CSS variable on .tracks, read by every lane. */
.tracks.playing .track-lane::after, .tracks.playing .ruler-lane::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--ph, 0%); width: 2px; margin-left: -1px; background: var(--gold-1); box-shadow: 0 0 8px rgba(247, 231, 180, 0.6); pointer-events: none; }
.tracks.playing .track-empty .track-lane::after { display: none; }
@media (max-width: 720px) {
  .booth .section-title { flex-wrap: wrap; row-gap: 8px; }
  .booth .section-title .rule { display: none; }
  .booth .section-title .hint { flex-basis: 100%; }
  .booth-row select { max-width: 100%; flex: 1 1 100%; }
  .booth-rec { margin-left: 0; flex: 1 1 100%; }
  /* Phones: each track's controls on top, its lane full width under them - the ruler lines up with the lanes. */
  .tracks-ruler, .track { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ruler-head { display: none; }
  .track { padding-bottom: 6px; border-bottom: var(--hairline); }
  .track-lane { min-height: 56px; }
  .next-ctls { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
}
/* Phones: the shelf header wraps - title, Up next and BASS+ first, the hint on its own line under them. */
@media (max-width: 720px) {
  .packs .section-title { flex-wrap: wrap; row-gap: 8px; }
  .packs .section-title .rule { display: none; }
  .packs .section-title .hint { flex-basis: 100%; order: 3; }
  .packs .section-title .upnext, .packs .section-title .bassplus, .packs .section-title .upload-beat { margin-left: 0; }
}
.lab-main { display: grid; grid-template-columns: minmax(340px, 600px) 1fr; gap: 22px; align-items: start; margin-top: 22px; }

.mpc { border-radius: 24px; padding: 20px; background: linear-gradient(165deg, rgba(34, 27, 52, 0.95), rgba(14, 11, 22, 0.98)); border: var(--hairline); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow); }
.mpc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.mpc-head .pad-play { margin-left: auto; min-width: 72px; }
.mpc-brand { font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: 0.06em; color: var(--gold); }
.mpc-brand small { display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.28em; color: var(--text-mute); }
.pads { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.pad {
  aspect-ratio: 1; border-radius: 14px; border: 1px solid rgba(226, 182, 92, 0.12); cursor: pointer; position: relative;
  background: linear-gradient(180deg, #2a2240, #1a1428); box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 6px 14px -8px rgba(0, 0, 0, 0.8);
  color: var(--text-dim); font-weight: 700; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s; --pad: var(--c-gold); touch-action: manipulation;
}
.pad kbd { position: absolute; top: 7px; left: 9px; font-family: var(--font-mono); font-size: 10px; color: var(--text-mute); }
.pad .led { position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--pad); opacity: 0.35; }
.pad.hit { transform: translateY(2px); background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--pad) 85%, #fff 15%), color-mix(in srgb, var(--pad) 30%, #1a1428) 78%); color: #140e1e; box-shadow: 0 0 26px color-mix(in srgb, var(--pad) 60%, transparent), inset 0 -2px 0 rgba(0, 0, 0, 0.3); }
.pad.hit .led { opacity: 1; box-shadow: 0 0 10px var(--pad); }
.keys-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; flex-wrap: wrap; }
.keys-head select { padding: 6px 9px; font-size: 13px; }
/* Black keys are ~78% of a white key, whatever number of octaves fits (keyboard.js sets --whites). */
.piano { position: relative; height: 196px; --black-w: calc(100% / var(--whites, 15) * 0.78); user-select: none; touch-action: none; }
.piano-whites { display: flex; height: 100%; gap: 2px; }
.key { border: 0; cursor: pointer; padding: 0; touch-action: none; }
.key.white { flex: 1; border-radius: 0 0 9px 9px; background: linear-gradient(180deg, #f6efe2, #e3d7c3); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12); position: relative; }
.key.white.out { background: linear-gradient(180deg, #b9b0a3, #9d9487); }
.key.white.in::after { content: ""; position: absolute; bottom: 10px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--gold-2); }
/* The glow follows how hard the key was played (--vel 0.45..1). */
.key.white.down { background: var(--grad-gold); box-shadow: 0 0 calc(8px + 16px * var(--vel, 0.85)) rgba(226, 182, 92, calc(0.2 + 0.45 * var(--vel, 0.85))); }
.key .oct { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: 10px; color: #6c6155; }
.piano-blacks { position: absolute; inset: 0 0 auto 0; height: 63%; pointer-events: none; }
.key.black { position: absolute; top: 0; width: var(--black-w); height: 100%; border-radius: 0 0 6px 6px; background: linear-gradient(180deg, #2b2338, #0f0b16); box-shadow: inset 0 -3px 0 rgba(255, 255, 255, 0.06), 0 3px 6px rgba(0, 0, 0, 0.5); pointer-events: auto; }
.key.black.in { box-shadow: inset 0 -3px 0 var(--gold-3), 0 3px 6px rgba(0, 0, 0, 0.5); }
.key.black.out { background: linear-gradient(180deg, #423a4c, #2a2432); }
.key.black.down { background: var(--grad-gold); box-shadow: 0 0 calc(6px + 12px * var(--vel, 0.85)) rgba(226, 182, 92, calc(0.2 + 0.45 * var(--vel, 0.85))); }

.editor-pro { background: var(--glass); border: var(--hairline); border-radius: 24px; padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.pattern-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pattern-tabs button { display: inline-flex; align-items: baseline; gap: 7px; padding: 7px 12px; border-radius: 12px; border: var(--hairline); background: transparent; cursor: pointer; color: var(--text-dim); font-weight: 600; font-size: 13px; }
.pattern-tabs button b { font-family: var(--font-display); font-size: 18px; color: var(--pad, var(--gold)); }
.pattern-tabs button.on { border-color: var(--pad, var(--gold)); background: color-mix(in srgb, var(--pad, var(--gold)) 12%, transparent); color: var(--text); }
.pattern-tabs button.add { border-style: dashed; color: var(--text-mute); }
.pattern-tabs button.add:hover { color: var(--gold-1); border-color: var(--line-strong); }
.editor-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.editor-bar select { padding: 6px 9px; font-size: 13px; }
.pattern-name { width: 13ch; padding: 6px 9px; font-size: 13px; border-radius: 10px; background: rgba(10, 8, 18, 0.7); border: var(--hairline); color: var(--text); transition: border-color 0.15s, box-shadow 0.15s; }
.pattern-name:focus { border-color: var(--gold); box-shadow: var(--glow-gold); outline: none; }
.grid-scroll { overflow-x: auto; }
.beatgrid { display: grid; gap: 4px; min-width: 640px; }
.grid-row { display: grid; grid-template-columns: 104px repeat(16, minmax(24px, 1fr)); gap: 4px; align-items: center; }
.roll .grid-row { gap: 2px; }
.row-name { font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); display: flex; align-items: center; gap: 7px; cursor: pointer; border: 0; background: transparent; padding: 0; text-align: left; }
.row-name::before { content: ""; width: 8px; height: 8px; border-radius: 3px; background: var(--pad); flex: none; }
.row-name.note { cursor: default; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); text-transform: none; letter-spacing: 0; }
.row-name.note::before { display: none; }
.cell { height: 30px; border-radius: 6px; border: 0; cursor: pointer; background: rgba(255, 255, 255, 0.045); transition: background 0.08s, transform 0.06s; --pad: var(--c-gold); font-size: 13px; line-height: 1; color: #140e1e; font-weight: 800; padding: 0; }
.roll .cell { height: 20px; border-radius: 3px; }
.cell.beat { background: rgba(255, 255, 255, 0.08); }
.cell:hover { background: rgba(226, 182, 92, 0.14); }
.cell.v1 { background: color-mix(in srgb, var(--pad) 62%, #1a1428); }
.cell.v2 { background: var(--pad); box-shadow: 0 0 12px color-mix(in srgb, var(--pad) 45%, transparent); }
.cell.v5 { background: color-mix(in srgb, var(--pad) 28%, #1a1428); }
.cell.v3, .cell.v4 { background: repeating-linear-gradient(90deg, var(--pad) 0 5px, color-mix(in srgb, var(--pad) 45%, #1a1428) 5px 8px); }
.cell.note-head { background: var(--pad); box-shadow: 0 0 10px color-mix(in srgb, var(--pad) 40%, transparent); border-radius: 4px 0 0 4px; }
.cell.note-tail { background: color-mix(in srgb, var(--pad) 55%, #1a1428); border-radius: 0; }
.roll.chromatic .grid-row.sharp .cell:not(.note-head):not(.note-tail) { background: rgba(0, 0, 0, 0.22); }
.roll .grid-row.c { border-top: 1px solid rgba(226, 182, 92, 0.12); }
.cell.now { outline: 2px solid var(--gold-1); outline-offset: -2px; transform: scaleY(1.08); }
/* Watch the beat (watchmode.js): the steps the recorded beat plays in the sounding bar, ringed in the pad's colour */
.cell.heard { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--pad) 80%, #fff 20%); }
.cell.heard-2 { box-shadow: inset 0 0 0 3px var(--pad), 0 0 10px color-mix(in srgb, var(--pad) 50%, transparent); }
.cell.heard-5 { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pad) 75%, transparent); }
.cell.v0.heard { background: color-mix(in srgb, var(--pad) 20%, #1a1428); } /* an empty step the beat plays: tinted, so it never reads as the playhead */
.watch-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 12px; }
.watch-bar[hidden] { display: none; } /* display: flex would beat [hidden] */
.watch-line { font-size: 13px; color: var(--text-dim); }
.key.white[data-lit="bass"], .key.black[data-lit="bass"] { background: var(--c-amber); box-shadow: 0 0 16px color-mix(in srgb, var(--c-amber) 65%, transparent); }
.key.white[data-lit="lead"], .key.black[data-lit="lead"] { background: var(--c-teal); box-shadow: 0 0 16px color-mix(in srgb, var(--c-teal) 65%, transparent); }
.fill-tools, .roll-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0 6px; }
.roll-tools { margin: 0 0 10px; }
.roll-tools select { padding: 6px 9px; font-size: 13px; }
.btn.fill { border-color: var(--line-strong); color: var(--gold-1); }
.seg.len button, .seg.bar-tabs button, .seg.track-tabs button { padding: 6px 11px; font-size: 12.5px; }

.song-pro { margin-top: 8px; }
.arranger { display: flex; gap: 5px; overflow-x: auto; padding: 6px 2px 10px; min-height: 70px; }
.slot { position: relative; min-width: 46px; display: flex; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--pad) 45%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--pad) 20%, transparent), color-mix(in srgb, var(--pad) 6%, transparent)); transition: box-shadow 0.2s, transform 0.12s; }
.slot.current { border-color: var(--pad); }
.slot.playing { box-shadow: 0 0 0 1px var(--pad), 0 0 20px color-mix(in srgb, var(--pad) 50%, transparent); transform: translateY(-2px); }
.slot.dragging { opacity: 0.45; }
.slot.drop { box-shadow: var(--glow-teal); }
.slot-main { flex: 1; display: grid; gap: 1px; padding: 8px 8px; background: transparent; border: 0; cursor: grab; text-align: left; min-width: 0; color: var(--text); }
.slot-main b { font-family: var(--font-display); font-size: 20px; line-height: 1; color: var(--pad); }
.slot-main span { font-size: 10.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-x { position: absolute; top: 2px; right: 3px; border: 0; background: transparent; color: var(--text-mute); cursor: pointer; font-size: 13px; padding: 0 3px; opacity: 0; }
.slot:hover .slot-x, .slot-x:focus-visible { opacity: 1; }
.slot-x:hover { color: #f0a0a8; }
.add-slots { margin: 4px 0 18px; }
.add-slots .btn { border-color: color-mix(in srgb, var(--pad, var(--gold)) 50%, transparent); color: var(--pad, var(--gold-1)); }
.song-foot { display: grid; grid-template-columns: 1.2fr 1fr; gap: 22px; align-items: end; padding: 18px; border-radius: 20px; background: var(--glass); border: var(--hairline); }
.mixer { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-top: 10px; }
.fader { display: grid; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-mute); }
.fader output { font-family: var(--font-mono); color: var(--gold-1); letter-spacing: 0; }
.export { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.export-note { flex-basis: 100%; margin: 0; font-size: 12.5px; color: var(--text-mute); text-align: right; }

/* ---------- toasts & dialog ---------- */
/* Toasts are notices, never controls: clicks pass through to whatever is under them (a retry button, say). */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; max-width: 420px; pointer-events: none; }
.toast { padding: 13px 16px; border-radius: 12px; background: rgba(20, 16, 32, 0.94); border: var(--hairline); box-shadow: var(--shadow); font-weight: 600; animation: toast-in 0.25s ease; border-left: 2px solid var(--gold); line-height: 1.45; backdrop-filter: blur(10px); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
dialog.confirm { border: var(--hairline); border-radius: var(--r-lg); background: linear-gradient(180deg, #17122a, #0e0b16); color: var(--text); padding: 26px; max-width: 460px; width: calc(100% - 32px); box-shadow: var(--shadow), 0 0 0 1px rgba(226, 182, 92, 0.1); }
dialog.confirm::backdrop { background: rgba(4, 3, 8, 0.72); backdrop-filter: blur(5px); }
dialog.confirm h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 600; font-size: 26px; }
dialog.confirm p { color: var(--text-dim); line-height: 1.6; margin: 0 0 18px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .lab-head { grid-template-columns: 1fr 180px; }
  .transport-pro { grid-column: 1 / -1; }
  .lab-main { grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .editor, .newbake, .hero, .song-foot { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .hero-art .emblem { width: min(260px, 70%); }
  .export { justify-content: flex-start; }
  .export-note { text-align: left; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .health { margin-left: 0; justify-content: flex-start; }
  main { padding: 18px 16px 60px; }
  .hero { padding: 26px 22px; }
  .hero-steps { grid-template-columns: 1fr; }
  .lab-head { grid-template-columns: 1fr; padding: 18px; }
  .sigil-wrap { max-width: 200px; }
  .knobs { grid-template-columns: 1fr; }
  .mixer { grid-template-columns: repeat(2, 1fr); }
  .lane-label { width: 60px; font-size: 9.5px; padding-left: 6px; }
  .backdrop .emblem { right: -40vmin; opacity: 0.05; }
}

/* ---------- notebook ---------- */
.notebook { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; align-items: start; }
.note-pane { position: sticky; top: 18px; min-width: 0; display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--glass); border: var(--hairline); box-shadow: var(--shadow); max-height: calc(100vh - 40px); }
.note-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.note-pane input[type="search"] { width: 100%; padding: 10px 12px; border-radius: 10px; background: rgba(10, 8, 18, 0.7); border: var(--hairline); color: var(--text); }
.note-pane input[type="search"]:focus { border-color: var(--gold); box-shadow: var(--glow-gold); outline: none; }
.note-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start; overflow-y: auto; overflow-x: hidden; min-height: 120px; min-width: 0; padding-right: 2px; }
.note-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px; border: var(--hairline); background: rgba(10, 8, 18, 0.5); color: var(--text-dim); cursor: pointer; font: inherit; transition: border-color 0.15s, background 0.15s; }
.note-row:hover { border-color: var(--line-strong); }
.note-row.on { border-color: var(--gold); background: rgba(226, 182, 92, 0.08); color: var(--text); }
.note-row-top { display: flex; align-items: baseline; gap: 8px; }
.note-row-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text); }
.note-row-top time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-mute); white-space: nowrap; }
.note-row .pin { color: var(--gold); font-size: 10px; }
.note-excerpt { font-size: 13px; line-height: 1.45; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.note-meta .chip { font-size: 11px; padding: 3px 9px; }
.note-meta .chip.beat { color: var(--c-teal); border-color: rgba(95, 211, 191, 0.35); }
.note-meta .chip.bake { color: var(--c-rose); border-color: rgba(217, 120, 155, 0.35); }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--gold-2); }
.note-empty { padding: 10px 4px; line-height: 1.5; }
.note-editor { display: grid; gap: 14px; align-content: start; padding: 22px 24px 20px; border-radius: var(--r-lg); background: var(--glass); border: var(--hairline); box-shadow: var(--shadow); min-height: 70vh; }
.note-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.note-title { flex: 1; min-width: 240px; font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1.1; background: transparent; border: 0; border-bottom: 1px solid var(--line); padding: 4px 0 8px; color: var(--text); }
.note-title:focus { outline: none; border-bottom-color: var(--gold); }
.note-title::placeholder { color: var(--text-mute); font-style: italic; }
.note-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
.note-links .field { min-width: 180px; }
.note-links .field.grow { flex: 1; }
.note-links input, .note-links select { width: 100%; padding: 8px 10px; border-radius: 10px; background: rgba(10, 8, 18, 0.7); border: var(--hairline); color: var(--text); font-size: 13.5px; letter-spacing: 0; text-transform: none; }
.note-links input:focus, .note-links select:focus { border-color: var(--gold); box-shadow: var(--glow-gold); outline: none; }
.note-body { width: 100%; min-height: 48vh; resize: vertical; padding: 16px 18px; border-radius: 14px; background: rgba(10, 8, 18, 0.6); border: var(--hairline); color: var(--text); font: 16px/1.65 var(--font-ui); }
.note-body:focus { border-color: var(--gold); box-shadow: var(--glow-gold); outline: none; }
.note-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-blank { display: grid; gap: 14px; max-width: 560px; margin: 8vh auto; text-align: center; justify-items: center; }
.note-blank h2 { font-size: clamp(34px, 4vw, 52px); }
.note-blank p { color: var(--text-dim); line-height: 1.6; }
@media (max-width: 900px) {
  .notebook { grid-template-columns: 1fr; }
  .note-pane { position: static; max-height: none; }
  .note-list { max-height: 40vh; }
}

/* ---------- account screens (online only) ---------- */
.auth { display: grid; place-items: center; min-height: 64vh; padding: 24px 0; }
.auth-card { width: min(440px, 100%); display: grid; gap: 14px; padding: 32px 30px 26px; }
.auth-card h2 { font-size: clamp(32px, 4vw, 44px); }
.auth-lead { color: var(--text-dim); margin: -4px 0 4px; line-height: 1.5; }
.auth-form { display: grid; gap: 14px; }
.auth-form .field small { display: block; margin-top: 6px; }
.auth-form .btn { justify-self: start; }
.auth-status { min-height: 1.2em; margin: 0; color: var(--text-dim); }
.auth-links { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.auth-links a { color: var(--gold-1); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.notice { margin-bottom: 18px; line-height: 1.6; color: var(--text-dim); border-color: var(--line-strong); }
.notice strong { color: var(--gold-1); }

/* ---------- pricing (online: landing + library) ---------- */
.landing-pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.plan { --accent: var(--gold); position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 14px; padding: 30px 30px 26px; border-radius: 26px;
  background: var(--glass); border: var(--hairline); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.85); transition: border-color 0.3s, box-shadow 0.3s; }
.plan.beats { --accent: var(--c-rose); }
.plan.soon { --accent: var(--c-violet); }
.plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.plan-badge { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.plan::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0.8; }
.plan:hover { border-color: var(--line-strong); box-shadow: 0 0 0 1px rgba(226, 182, 92, 0.22), 0 30px 70px -30px rgba(0, 0, 0, 0.9); }
.plan h3 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 3vw, 40px); line-height: 1; margin: 0; }
.plan .tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.plan .tier { padding: 16px 16px 14px; border-radius: 16px; background: rgba(10, 8, 18, 0.6); border: var(--hairline); }
.plan .tier small { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 6px; }
.plan .price { font-family: var(--font-display); font-weight: 700; font-size: 40px; line-height: 1; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.plan .tier span { display: block; margin-top: 6px; font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.plan ul { list-style: none; display: grid; gap: 7px; margin: 0; padding: 0; color: var(--text-dim); font-size: 15px; line-height: 1.5; }
.plan li::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; transform: rotate(45deg); background: var(--accent); margin-right: 12px; vertical-align: 1px; }
.plan .btn { margin-top: auto; align-self: flex-start; }
.landing-fine { margin-top: 14px; font-size: 13px; color: var(--text-mute); line-height: 1.6; }
@media (max-width: 1080px) { .landing-pricing { grid-template-columns: 1fr; } }

/* ---------- the till (online): confirm-your-email bar, the buy panel under a storyboard ---------- */
.notice-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px 14px; margin: 0 auto 14px; max-width: 1400px; padding: 10px 18px; border-radius: var(--r-md); background: var(--grad-aurora), var(--glass); border: 1px solid var(--line-strong); color: var(--text-dim); font-size: 14px; }
.notice-bar[hidden] { display: none; }
.notice-bar strong { color: var(--gold-1); font-weight: 600; }
.sale { margin-bottom: 18px; border-color: var(--line-strong); background: var(--grad-aurora), var(--glass); }
.sale-head h3 { margin: 0 0 6px; }
.sale .offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.offer { display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; border-radius: 18px; background: rgba(10, 8, 18, 0.6); border: var(--hairline); }
.offer .price { font-family: var(--font-display); font-weight: 700; font-size: 42px; line-height: 1; background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.offer strong { color: var(--text); font-weight: 600; }
.offer select { width: 100%; }
.offer .btn { margin-top: auto; align-self: flex-start; }
.sale .fine { margin: 12px 0 0; font-size: 12px; }
.rights { display: flex; align-items: flex-start; gap: 10px; color: var(--text-dim); font-size: 14px; line-height: 1.5; cursor: pointer; }
.rights input { margin-top: 3px; accent-color: var(--gold); width: 16px; height: 16px; flex: none; }
