/* lyrictok — site styles
 *
 * Starting point lifted from tiktok.com's design language:
 *   - TikTok Sans variable font (300..900, opsz 12..36)
 *   - Near-black foreground (#161823), white surface, brand red (#FE2C55)
 *     and cyan (#25F4EE) accents
 *   - 14px base, 1.5 line-height, antialiased
 *   - Same-color links, 250ms transitions, underline on hover only
 *   - Modern CSS reset (Andy Bell-flavored) with reduced-motion + iOS fix
 *
 * Everything below is built from design tokens in :root so we can re-skin
 * later without touching component rules.
 */

@import url('https://fonts.googleapis.com/css2?family=TikTok+Sans:opsz,wght@12..36,300..900&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────── */

:root {
  /* Tell the browser our UI handles both schemes — picks correct
   * native form chrome (file pickers, scrollbars, focus rings). */
  color-scheme: light dark;

  /* Color — neutrals (light theme defaults) */
  --c-fg:        #161823;                 /* TikTok signature near-black */
  --c-fg-muted:  rgba(22, 24, 35, 0.65);
  --c-fg-subtle: rgba(22, 24, 35, 0.45);
  --c-bg:        #ffffff;
  --c-bg-2:      #f1f1f2;                 /* soft surface gray */
  --c-bg-3:      #f8f8f8;
  --c-line:      rgba(22, 24, 35, 0.08);
  --c-line-2:    rgba(22, 24, 35, 0.16);

  /* Brand colors stay constant across themes — both red + cyan are
   * designed to read on light + dark backgrounds. */
  --c-brand:     #fe2c55;                 /* TikTok red — primary CTA */
  --c-brand-2:   #25f4ee;                 /* TikTok cyan — accent */
  --c-brand-fg:  #ffffff;

  /* Typography */
  --ff-sans:  'TikTok Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI',
              Roboto, Helvetica, Arial, sans-serif;
  --ff-mono:  ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --fz-xs:    0.75rem;    /* 12 */
  --fz-sm:    0.875rem;   /* 14 — body */
  --fz-base:  1rem;       /* 16 */
  --fz-md:    1.125rem;   /* 18 */
  --fz-lg:    1.375rem;   /* 22 */
  --fz-xl:    1.75rem;    /* 28 */
  --fz-2xl:   2.25rem;    /* 36 */
  --fz-3xl:   3rem;       /* 48 */

  --lh-tight: 1.2;
  --lh-base:  1.5;
  --lh-loose: 1.7;

  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Spacing — 4px grid */
  --s-1:  0.25rem;   /*  4 */
  --s-2:  0.5rem;    /*  8 */
  --s-3:  0.75rem;   /* 12 */
  --s-4:  1rem;      /* 16 */
  --s-5:  1.25rem;   /* 20 */
  --s-6:  1.5rem;    /* 24 */
  --s-8:  2rem;      /* 32 */
  --s-10: 2.5rem;    /* 40 */
  --s-12: 3rem;      /* 48 */
  --s-16: 4rem;      /* 64 */
  --s-20: 5rem;      /* 80 */

  /* Radius */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   12px;
  --r-xl:   20px;
  --r-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast:   150ms;
  --t-base:   250ms;
  --t-slow:   400ms;

  /* Layout */
  --container: 720px;
  --container-wide: 1080px;

  /* ── Aliases for vendored components (sync-editor.css) ──
   * sync-editor.css reads these tokens directly; we map them to our
   * existing color/typography tokens so light/dark mode flips work
   * without modifying the vendored stylesheet. */
  --bg:           var(--c-bg);
  --surface:      var(--c-bg-2);
  --well:         var(--c-bg-3);
  --text:         var(--c-fg);
  --text-sub:     var(--c-fg-muted);
  --text-muted:   var(--c-fg-subtle);
  --border:       var(--c-line);
  --border-mid:   var(--c-line-2);
  --accent:       var(--c-brand);
  --accent-hover: #e91e48;
  --accent-dim:   rgba(254, 44, 85, 0.12);
  --warning:      #f5b800;
  /* Waveform stroke — 25% fg so the playhead/handles read on top.
   * Read by sync-editor.js via getComputedStyle. */
  --wf-color:     rgba(22, 24, 35, 0.25);
  --danger:       #e02020;
  --font:         var(--ff-sans);
  --font-mono:    var(--ff-mono);
  --font-serif:   'IBM Plex Serif', 'Georgia', serif;
}

/* Dark theme — token overrides only. All component rules read from
 * the same variable names; nothing else needs to change. */
@media (prefers-color-scheme: dark) {
  :root {
    --c-fg:        #f5f5f7;
    --c-fg-muted:  rgba(245, 245, 247, 0.70);
    --c-fg-subtle: rgba(245, 245, 247, 0.45);
    --c-bg:        #0d0d10;
    --c-bg-2:      #1a1a1f;
    --c-bg-3:      #16161a;
    --c-line:      rgba(245, 245, 247, 0.08);
    --c-line-2:    rgba(245, 245, 247, 0.18);
    --wf-color:    rgba(245, 245, 247, 0.25);
  }

  /* Slightly attenuate the inline-code background for dark — the
   * default light-mode rgba(0,0,0,0.06) goes invisible on a dark bg. */
  code {
    background: rgba(255, 255, 255, 0.08);
  }

  /* Lighter shadow on the dropzone icon so it doesn't disappear. */
  .dropzone__icon {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

/* ── Reset (modern, TikTok-flavored) ───────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

/* Honor the HTML `hidden` attribute. Required because author rules
 * like `display: flex` on a class would otherwise outrank the UA
 * stylesheet's `display: none` for [hidden]. !important here is the
 * idiomatic fix. */
[hidden] { display: none !important; }

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

body {
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: var(--ff-sans);
  font-size: var(--fz-sm);
  line-height: var(--lh-base);
  color: var(--c-fg);
  background: var(--c-bg);
}

/* iOS viewport fix */
@supports (-webkit-touch-callout: none) {
  body { min-height: -webkit-fill-available; }
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select { font: inherit; color: inherit; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Base typography ───────────────────────────────────────────────────── */

h1 { font-size: var(--fz-2xl); font-weight: var(--fw-bold);     line-height: var(--lh-tight); }
h2 { font-size: var(--fz-xl);  font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h3 { font-size: var(--fz-lg);  font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
h4 { font-size: var(--fz-md);  font-weight: var(--fw-semibold); }

p + p { margin-top: var(--s-3); }

small { font-size: var(--fz-xs); color: var(--c-fg-muted); }

strong, b { font-weight: var(--fw-semibold); }

code, pre, kbd, samp { font-family: var(--ff-mono); }

code {
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: var(--r-sm);
}

/* ── Links — TikTok pattern: same color, no underline, hover reveals ───── */

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--t-base) var(--ease-out),
              opacity var(--t-base) var(--ease-out);
}

a:hover { text-decoration: underline; }

a.brand { color: var(--c-brand); }
a.brand:hover { opacity: 0.85; text-decoration: none; }

/* ── Layout utilities ──────────────────────────────────────────────────── */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

.container-wide {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 var(--s-5);
}

.stack > * + * { margin-top: var(--s-4); }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-sm);
  background: var(--c-bg);
  color: var(--c-fg);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.btn:hover  { background: var(--c-bg-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--c-brand);
  border-color: var(--c-brand);
  color: var(--c-brand-fg);
}
.btn-primary:hover { background: #e91e48; border-color: #e91e48; }

.btn-pill { border-radius: var(--r-pill); }

/* ── Page-specific (landing) — refactored onto tokens ──────────────────── */

.logo {
  max-width: 280px;
  height: auto;
  margin-bottom: var(--s-6);
}

.lede {
  color: var(--c-fg-muted);
  font-size: var(--fz-md);
  margin-bottom: var(--s-8);
}

.placeholder {
  background: var(--c-bg-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--s-5) var(--s-6);
}

.placeholder strong {
  display: block;
  margin-bottom: var(--s-1);
}

/* ── Landing ───────────────────────────────────────────────────────── */
.landing {
  max-width: 640px;
  margin: var(--s-12) auto 0;
  text-align: center;
}
.landing__lede {
  font-size: var(--fz-3xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-4);
  text-wrap: balance;
}
.landing__sub {
  font-size: var(--fz-md);
  color: var(--c-fg-muted);
  margin: 0 0 var(--s-8);
  line-height: var(--lh-base);
}
.landing__cta {
  margin: 0 0 var(--s-6);
}
.landing__btn {
  display: inline-block;
  padding: var(--s-3) var(--s-6);
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border-radius: var(--r-md);
  text-decoration: none;
  font-weight: var(--fw-semibold);
  font-size: var(--fz-md);
}
.landing__btn:hover { filter: brightness(1.05); }
.landing__small {
  margin-top: var(--s-8);
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
}
.landing__small a { color: var(--c-fg-muted); }

/* ── Legal pages ───────────────────────────────────────────────────── */
.legal {
  max-width: 720px;
  margin: var(--s-12) auto;
  font-size: var(--fz-base);
  line-height: var(--lh-base);
  color: var(--c-fg);
}
.legal__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-2);
}
.legal__updated {
  margin: 0 0 var(--s-6);
  color: var(--c-fg-muted);
  font-size: var(--fz-sm);
}
.legal h2 {
  margin: var(--s-8) 0 var(--s-3);
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
}
.legal p, .legal ul {
  margin: 0 0 var(--s-4);
}
.legal ul {
  padding-left: var(--s-5);
}
.legal li {
  margin: var(--s-1) 0;
}
.legal a {
  color: var(--c-brand);
}
.legal code {
  background: var(--c-bg-2);
  padding: 0 4px;
  border-radius: 3px;
  font-family: var(--ff-mono);
  font-size: 0.9em;
}

/* ── Site footer ───────────────────────────────────────────────────── */
.site-footer {
  margin-top: var(--s-12);
  padding: var(--s-5) var(--s-6);
  border-top: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s-2);
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
}
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-5);
}
.site-footer__legal {
  font-size: var(--fz-xs);
  color: var(--c-fg-subtle);
}
.site-footer a {
  color: var(--c-fg-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--c-fg);
  text-decoration: underline;
}
/* Sign-out form looks like the other footer links — strip native
 * <button> chrome so it sits inline with the anchors. */
.site-footer__signout {
  display: inline;
  margin: 0;
  padding: 0;
}
.site-footer__signout[hidden] { display: none !important; }
.site-footer__signout button {
  background: transparent;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--c-fg-muted);
}
.site-footer__signout button:hover {
  color: var(--c-fg);
  text-decoration: underline;
}
/* Hide footer on the editor (full-bleed view) */
body:has(.editor-shell) .site-footer { display: none; }

/* ── Account page ──────────────────────────────────────────────────── */
.account {
  max-width: 480px;
  margin: var(--s-12) auto 0;
}
.account__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s-6);
}
.account__info {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: var(--s-5);
  row-gap: var(--s-3);
  margin: 0 0 var(--s-6);
}
.account__info dt {
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-fg-muted);
  align-self: center;
}
.account__info dd {
  margin: 0;
  font-size: var(--fz-base);
}
.account__buy {
  margin-left: var(--s-3);
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border-radius: var(--r-pill);
  text-decoration: none;
  font-weight: var(--fw-semibold);
  vertical-align: middle;
}
.account__buy:hover { filter: brightness(1.05); }
.account__signout {
  margin: var(--s-6) 0 var(--s-6);
}
.account__signout-btn {
  background: var(--c-bg-2);
  color: var(--c-fg);
  border: 1px solid var(--c-line-2);
  padding: var(--s-2) var(--s-5);
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  font-weight: var(--fw-semibold);
}
.account__signout-btn:hover {
  background: var(--c-bg-3);
}
.account__delete {
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
  margin: var(--s-8) 0 0;
}
.account__delete a {
  color: var(--c-brand);
}

/* ── Site header (shared layout) ───────────────────────────────────── */

.site-header {
  padding: var(--s-4) var(--s-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}

.site-header .brand {
  display: inline-block;
}

.site-header .brand img {
  height: 36px;
  width: auto;
}

/* Auth indicator on the right — empty until /api/auth/me resolves. */
.site-header__auth {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
}
.site-header__signin,
.site-header__buy,
.site-header__email {
  color: var(--c-fg);
  text-decoration: none;
  font-weight: var(--fw-semibold);
}
.site-header__signin:hover,
.site-header__buy:hover,
.site-header__email:hover {
  text-decoration: underline;
}
.site-header__buy {
  padding: var(--s-1) var(--s-3);
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border-radius: var(--r-pill);
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.site-header__buy:hover {
  text-decoration: none;
  filter: brightness(1.05);
}
.site-header__credits {
  font-variant-numeric: tabular-nums;
}
.site-header__email {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Upload page ───────────────────────────────────────────────────── */

.upload {
  max-width: 560px;
  margin: var(--s-12) auto 0;
}

.upload__title {
  font-size: var(--fz-3xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin-bottom: var(--s-3);
  text-wrap: balance;
}

.upload__lede {
  font-size: var(--fz-md);
  color: var(--c-fg-muted);
  margin-bottom: var(--s-10);
}

.upload__form {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

/* Drop zone */

.dropzone {
  display: block;
  position: relative;
  padding: var(--s-12) var(--s-6);
  background: var(--c-bg-2);
  border: 2px dashed var(--c-line-2);
  border-radius: var(--r-xl);
  cursor: pointer;
  text-align: center;
  transition:
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
}

.dropzone:hover,
.dropzone:focus-visible {
  background: var(--c-bg-3);
  border-color: var(--c-fg-subtle);
  outline: none;
}

.dropzone.is-drag-over {
  background: rgba(254, 44, 85, 0.06);
  border-color: var(--c-brand);
  border-style: solid;
  transform: scale(1.01);
}

.dropzone.is-selected {
  border-style: solid;
  border-color: var(--c-fg-subtle);
  background: var(--c-bg);
  padding: var(--s-8) var(--s-6);
}

.dropzone__idle,
.dropzone__selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
}

.dropzone__icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--c-bg);
  color: var(--c-fg);
  font-size: var(--fz-xl);
  font-weight: var(--fw-bold);
  margin-bottom: var(--s-2);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.dropzone__icon--check {
  background: var(--c-brand);
  color: var(--c-brand-fg);
}

.dropzone__primary {
  font-size: var(--fz-lg);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
  margin: 0;
}

.dropzone__secondary {
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
  margin: 0;
}

.dropzone__link {
  color: var(--c-brand);
  font-weight: var(--fw-semibold);
}

.dropzone__hint {
  margin-top: var(--s-3);
  font-size: var(--fz-xs);
  color: var(--c-fg-subtle);
}

.dropzone__filename {
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
  margin: 0;
  word-break: break-all;
}

.dropzone__filesize {
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.dropzone__change {
  margin-top: var(--s-2);
  background: none;
  border: none;
  color: var(--c-brand);
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  text-decoration: underline;
}
.dropzone__change:hover { opacity: 0.85; }

/* Optional details — revealed only after the user picks a file
 * (.upload__form.is-ready toggles them via JS). No separator rule
 * between dropzone and these fields; the empty space is the divider. */

.upload__details,
.upload__submit {
  display: none;
}

.upload__form.is-ready .upload__details,
.upload__form.is-ready .upload__submit {
  display: flex;
}

.upload__details {
  flex-direction: column;
  gap: var(--s-5);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.field label {
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
}

.field__optional {
  color: var(--c-fg-subtle);
  font-weight: var(--fw-regular);
}

.field input[type="text"],
.field select,
.field textarea {
  font-family: inherit;
  font-size: var(--fz-sm);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-fg);
  transition: border-color var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(254, 44, 85, 0.15);
}

.field textarea {
  resize: vertical;
  min-height: 9em;
  line-height: var(--lh-base);
  font-family: var(--ff-sans);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: var(--s-4);
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
}

/* Submit */

.upload__submit {
  align-self: center;
  font-size: var(--fz-md);
  padding: var(--s-3) var(--s-8);
  margin-top: var(--s-2);
}

.upload__submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn__arrow {
  display: inline-block;
  margin-left: var(--s-1);
  transition: transform var(--t-fast) var(--ease-out);
}
.btn:hover .btn__arrow { transform: translateX(3px); }

/* In-dropzone upload progress */

.dropzone__upload {
  width: 100%;
  max-width: 280px;
  margin-top: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  /* Fade away ~1s after upload completes — gives "Ready" a moment to
   * register without leaving the bar visually competing with the rest
   * of the dropzone for the duration of the user's lyrics typing. */
  transition: opacity 600ms var(--ease-out) 1000ms;
}

.dropzone__upload-bar {
  height: 4px;
  background: var(--c-line);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.dropzone__upload-fill {
  height: 100%;
  width: 0%;
  background: var(--c-brand);
  border-radius: var(--r-pill);
  transition: width var(--t-base) var(--ease-out);
}

.dropzone__upload-status {
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
  font-variant-numeric: tabular-nums;
  text-align: center;
  margin: 0;
}

/* When upload completes the strip fades out (transition delayed by
 * ~1s on .dropzone__upload so "Ready" registers briefly first). */
.dropzone[data-upload-state="uploaded"] .dropzone__upload {
  opacity: 0;
  pointer-events: none;
}

/* Failed uploads stay visible — the user needs to see the message. */
.dropzone[data-upload-state="failed"] .dropzone__upload-fill {
  background: var(--c-fg-subtle);
}
.dropzone[data-upload-state="failed"] .dropzone__upload-status {
  color: var(--c-brand);
}

.upload__error {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.25);
  border-radius: var(--r-md);
  color: var(--c-fg);
  font-size: var(--fz-sm);
}

/* ── Status card (transcribe in progress) ──────────────────────────── */

.status-card {
  padding: var(--s-12) 0;
  text-align: center;
  max-width: 480px;
  margin: 0 auto;
}

.status-card__title {
  font-size: var(--fz-xl);
  margin-bottom: var(--s-8);
  text-wrap: balance;
}

.status-card__progress {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  align-items: stretch;
}

.progress-bar {
  height: 8px;
  background: var(--c-bg-2);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  width: 0%;
  background: var(--c-brand);
  border-radius: var(--r-pill);
  transition: width 600ms var(--ease-out);
}

.status-card__phase {
  font-size: var(--fz-md);
  color: var(--c-fg);
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  justify-content: center;
}

/* CSS-only spinner. Used inline with the status-card phase label so
 * the user sees motion even when the progress bar is between worker
 * updates. prefers-reduced-motion (already honored in the reset)
 * makes this a static ring instead of a spin — still useful as a
 * "working" indicator without the motion. */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  border: 2px solid var(--c-line-2);
  border-top-color: var(--c-brand);
  animation: spinner-spin 800ms linear infinite;
  flex-shrink: 0;
}

@keyframes spinner-spin {
  to { transform: rotate(360deg); }
}

.status-card__eta {
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
  margin: 0;
}

.status-card__error {
  margin-top: var(--s-6);
  padding: var(--s-4);
  background: rgba(254, 44, 85, 0.08);
  border: 1px solid rgba(254, 44, 85, 0.25);
  border-radius: var(--r-md);
  color: var(--c-fg);
  font-size: var(--fz-sm);
  text-align: left;
}

/* ── Error state ───────────────────────────────────────────────────── */

.error-state {
  text-align: center;
  padding: var(--s-12) 0;
}

/* ── Editor (M7) ───────────────────────────────────────────────────── */
/*
 * Layout:
 *   • Site header sits flush at the top (60px) — the editor lives below
 *   • Left rail (.editor-rail) is PINNED to the viewport edge, full
 *     height under the header. No max-width container; full bleed.
 *   • Stage (.editor-stage) fills the remaining width and stacks
 *     vertically: preview → controls → waveform → lyrics
 *   • The vendored sync-editor mounts into .editor-syncedit and
 *     provides controls + waveform + lyrics. CSS reorders its children
 *     so the controls row appears between the preview and the waveform.
 */

.editor-shell {
  position: fixed;
  inset: 0;        /* full viewport — site-header is hidden on editor */
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  background: var(--c-bg);
}

/* Reclaim the header strip — the rail carries the lyrictok lockup. */
body:has(.editor-shell) .site-header { display: none; }

/* When the editor is on-screen, the page doesn't scroll — the rail
 * scrolls inside its own region; the stage manages its own overflow.
 * Reset the centered .container styles so the editor can break free
 * of them. */
body:has(.editor-shell) { overflow: hidden; }
body:has(.editor-shell) main.container,
body:has(.editor-shell) .container { all: unset; display: contents; }

.editor-rail {
  height: 100%;
  padding: var(--s-5);
  background: var(--c-bg-2);
  border-right: 1px solid var(--c-line);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
}

.editor-rail__brand {
  display: inline-block;
  line-height: 0;     /* drop baseline padding under the SVG */
}
.editor-rail__brand img {
  height: 28px;
  width: auto;
}

/* ── Sidebar collapsible sections ──────────────────────────────────
 *
 * Native <details>/<summary> for free keyboard handling and persisted
 * open-state per section. Custom marker via ::before so the chevron
 * looks intentional and rotates on toggle. */

.rail-section {
  border-top: 1px solid var(--c-line);
  padding-top: var(--s-3);
}

.rail-section__summary {
  list-style: none;       /* hide default disclosure triangle */
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}
.rail-section__summary::-webkit-details-marker { display: none; }
.rail-section__summary::before {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent var(--c-fg-muted);
  transition: transform var(--t-fast) var(--ease-out);
}
.rail-section[open] > .rail-section__summary::before {
  transform: rotate(90deg);
}

.rail-section__body {
  padding-top: var(--s-4);
}

/* ── Song info form ───────────────────────────────────────────────── */
.songinfo {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.songinfo__field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.songinfo__label {
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.songinfo__input,
.songinfo__select {
  font-family: var(--ff-sans);
  font-size: var(--fz-sm);
  color: var(--c-fg);
  background: var(--c-bg);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-sm);
  padding: 6px 8px;
}
.songinfo__input:focus,
.songinfo__select:focus {
  outline: 2px solid var(--c-brand);
  outline-offset: 1px;
  border-color: transparent;
}

/* ── Font picker ──────────────────────────────────────────────────── */
/* Radio list grouped by category. Each label is rendered IN that font
 * so the picker doubles as a live specimen. Native radio is kept (no
 * custom indicator) — the rendered font name carries the visual
 * distinction; styling the radio chrome would be noise. */
.fonts {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.fonts__group {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.fonts__legend {
  font-family: var(--ff-sans);
  font-size: var(--fz-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 0 4px;
}
.fonts__option {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 4px 6px;
  border-radius: var(--r-sm);
  font-size: var(--fz-md);
  /* Inline style on each label sets font-family — that's the live
   * preview. Color stays default so each option reads as a label. */
  color: var(--c-fg);
}
.fonts__option:hover {
  background: var(--c-bg-3);
}
.fonts__option:has(input:checked) {
  background: rgba(254, 44, 85, 0.1);
  outline: 1px solid var(--c-brand);
}
.fonts__option input[type="radio"] {
  margin: 0;
  accent-color: var(--c-brand);
  flex-shrink: 0;
}

/* Case + Size dropdowns sit below the font radios, separated by a hair
 * line so they read as related-but-distinct controls. */
.font-extras {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-line);
}

/* ── Color pickers ────────────────────────────────────────────────── */
.color-pickers {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
/* Lay out the label and the swatch side-by-side: the row reads as
 * "Type [⬜]" rather than the stacked "label / input" the songinfo
 * fields use. Swatch sits flush right. */
.color-pickers__field {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.color-pickers__input {
  /* Strip the native chrome-around-swatch so it sits as a clean
   * rounded square. Browsers vary in what they expose — these rules
   * cover Chromium and Firefox. */
  -webkit-appearance: none;
  appearance: none;
  width: 36px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-sm);
  background: transparent;
}
.color-pickers__input::-webkit-color-swatch-wrapper { padding: 0; }
.color-pickers__input::-webkit-color-swatch        { border: 0; border-radius: 3px; }
.color-pickers__input::-moz-color-swatch           { border: 0; border-radius: 3px; }

/* Background section — same column-with-gap rhythm the songinfo
 * fields use, so the Style dropdown breathes from the Start swatch
 * row instead of stacking flush against it. */
.bg-section,
.viz-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Slim native range — reusing the seek-bar treatment so sidebar
 * sliders feel of a piece. */
.viz-opacity {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  border: none;
  height: 16px;
  width: 100%;
}
.viz-opacity::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--c-line-2);
  border: none;
}
.viz-opacity::-moz-range-track {
  height: 2px;
  background: var(--c-line-2);
  border: none;
}
.viz-opacity::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--c-fg);
  border: none;
}
.viz-opacity::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-fg);
  border: none;
}

/* ── Cover section ────────────────────────────────────────────────── */
.cover-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Native <input type="file"> chrome stays — leaving it browser-default
 * keeps the file-picker behavior (accessibility, keyboard) intact. */
.cover-section input[type="file"] {
  font-family: var(--ff-sans);
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
}

/* Thumbnail of the chosen image + a "Remove" button. */
.cover-preview {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--c-bg-3);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
}
.cover-preview img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.cover-preview__clear {
  margin-left: auto;
  font-family: var(--ff-sans);
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
  background: transparent;
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-sm);
  padding: 4px 8px;
}
.cover-preview__clear:hover {
  color: var(--c-brand);
  border-color: var(--c-brand);
}

/* Rotate / Shadow checkboxes — inline label, native checkbox. */
.cover-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fz-sm);
  color: var(--c-fg);
}
.cover-toggle input[type="checkbox"] {
  accent-color: var(--c-brand);
}

/* ── Render launch button + dialog ───────────────────────────────── */
/* Pinned to the viewport bottom of the rail. When the rail's other
 * sections push the natural document position below the viewport,
 * the button stays put so the primary CTA is always one click away.
 * margin-top:auto in flex-column flow shoves it past any short
 * content; sticky/bottom takes over when the content exceeds the
 * viewport. */
.render-launch {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: var(--s-3) var(--s-4);
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border: none;
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  font-size: var(--fz-base);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  box-shadow: 0 -8px 16px -8px var(--c-bg-2);
}
.render-launch:hover {
  background: var(--c-brand);
  filter: brightness(1.05);
}

.render-dialog {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
}
.render-dialog[hidden] { display: none; }
.render-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.render-dialog__panel {
  position: relative;
  background: var(--c-bg);
  color: var(--c-fg);
  border-radius: var(--r-lg);
  padding: var(--s-6);
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.render-dialog__close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: none;
  color: var(--c-fg-muted);
  font-size: 1.5rem;
  line-height: 1;
}
.render-dialog__title {
  margin: 0 0 var(--s-5);
  font-size: var(--fz-lg);
  font-weight: var(--fw-semibold);
}
.render-dialog__error {
  margin: var(--s-4) 0 0;
  padding: var(--s-3);
  background: rgba(254, 44, 85, 0.1);
  border: 1px solid var(--c-brand);
  border-radius: var(--r-sm);
  color: var(--c-brand);
  font-size: var(--fz-sm);
}

.render-tiers {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.render-tier {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    'name  price'
    'detail price';
  align-items: center;
  gap: 0 var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--c-bg-2);
  color: var(--c-fg);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  text-align: left;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.render-tier:hover {
  background: var(--c-bg-3);
  border-color: var(--c-brand);
}
.render-tier:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.render-tier strong {
  grid-area: name;
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
}
.render-tier__detail {
  grid-area: detail;
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
}
.render-tier__price {
  grid-area: price;
  font-size: var(--fz-sm);
  font-weight: var(--fw-semibold);
  color: var(--c-brand);
}

/* ── Sign-in page ────────────────────────────────────────────────── */
.signin {
  max-width: 420px;
  margin: var(--s-12) auto 0;
}
.signin__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  margin: 0 0 var(--s-3);
}
.signin__lede {
  margin: 0 0 var(--s-6);
  color: var(--c-fg-muted);
  font-size: var(--fz-base);
  line-height: var(--lh-base);
}
.signin__form {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.signin__field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.signin__label {
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-fg-muted);
}
.signin__form input[type="email"] {
  font-family: var(--ff-sans);
  font-size: var(--fz-base);
  padding: var(--s-3);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-fg);
}
.signin__form input[type="email"]:focus {
  outline: 2px solid var(--c-brand);
  border-color: transparent;
}
.signin__submit {
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border: none;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  font-size: var(--fz-base);
  font-weight: var(--fw-semibold);
}
.signin__submit:disabled { opacity: 0.5; }

/* Google button — brand neutral so it doesn't compete with the
 * primary email-link CTA below it. Renders the official 4-color
 * logomark inline. */
.signin__google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-5);
  background: var(--c-bg);
  color: var(--c-fg);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  font-family: var(--ff-sans);
  font-size: var(--fz-base);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: background var(--t-fast);
}
.signin__google:hover { background: var(--c-bg-2); }
.signin__google svg { flex-shrink: 0; }

.signin__divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-5) 0;
  color: var(--c-fg-muted);
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.signin__divider::before,
.signin__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--c-line);
}
.signin__msg {
  margin: var(--s-4) 0 0;
  padding: var(--s-3);
  border-radius: var(--r-sm);
  font-size: var(--fz-sm);
}
.signin__msg--ok {
  background: rgba(37, 244, 238, 0.1);
  border: 1px solid var(--c-brand-2);
  color: var(--c-fg);
}
.signin__msg--err {
  background: rgba(254, 44, 85, 0.1);
  border: 1px solid var(--c-brand);
  color: var(--c-brand);
}

/* ── Buy credits ─────────────────────────────────────────────────── */
.buy {
  max-width: 540px;
  margin: var(--s-12) auto 0;
}
.buy__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s-4);
}
.buy__lede {
  margin: 0 0 var(--s-6);
  color: var(--c-fg-muted);
  font-size: var(--fz-base);
  line-height: var(--lh-base);
}
.buy__packs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.buy-pack {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--c-bg-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
}
.buy-pack__head {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.buy-pack__credits {
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
}
.buy-pack__per {
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
}
.buy-pack__price {
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
}
.buy-pack__btn {
  background: var(--c-brand);
  color: var(--c-brand-fg);
  border: none;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  font-family: var(--ff-sans);
  font-weight: var(--fw-semibold);
}
.buy-pack__btn:disabled { opacity: 0.5; }
.buy__error {
  margin-top: var(--s-4);
  padding: var(--s-3);
  background: rgba(254, 44, 85, 0.1);
  border: 1px solid var(--c-brand);
  border-radius: var(--r-sm);
  color: var(--c-brand);
  font-size: var(--fz-sm);
}

.buy-result {
  max-width: 480px;
  margin: var(--s-12) auto 0;
  text-align: center;
}
.buy-result__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s-3);
}
.buy-result__lede {
  margin: 0 0 var(--s-4);
  color: var(--c-fg-muted);
}
.buy-result__cta {
  margin-top: var(--s-6);
  font-size: var(--fz-base);
}

/* ── Render status page ──────────────────────────────────────────── */
.render-status {
  max-width: 640px;
  margin: var(--s-12) auto 0;
}
.render-status__title {
  font-size: var(--fz-2xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--s-6);
}
.render-status__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.render-card {
  background: var(--c-bg-2);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
}
.render-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--s-3);
}
.render-card__aspect {
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
  margin: 0;
}
.render-card__aspect small {
  margin-left: var(--s-2);
  font-size: var(--fz-xs);
  font-weight: var(--fw-regular);
  color: var(--c-fg-muted);
}
.render-card__status {
  font-size: var(--fz-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-fg-muted);
}
.render-card__phase {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-3) 0 0;
  font-size: var(--fz-sm);
  color: var(--c-fg-muted);
}
.render-card__download {
  display: inline-block;
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-4);
  background: var(--c-brand);
  color: var(--c-brand-fg);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-weight: var(--fw-semibold);
}
.render-card__error {
  margin: var(--s-3) 0 0;
  font-size: var(--fz-sm);
  color: var(--c-brand);
}
.render-status__meta {
  margin-top: var(--s-6);
  font-size: var(--fz-sm);
}

.editor-stage {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--c-bg);
}

/* ── Preview pane ────────────────────────────────────────────────── */
/*
 * Shell is a fixed-height row (45vh) so square/vertical aspects have a
 * concrete parent height to size against. Inside, the .editor-preview
 * box's pixel size is computed in JS (sizePreview() in editor.js) so
 * we don't depend on CSS aspect-ratio's edge cases when one dimension
 * is undefined. JS sets width + height directly per aspect.
 */

.editor-preview-shell {
  flex: 0 0 45vh;
  padding: var(--s-4) var(--s-5);
  background: var(--c-bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.editor-preview {
  position: relative;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  /* width + height are JS-set; these are sane defaults until JS runs */
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.editor-preview__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.editor-preview__watermark {
  position: absolute;
  inset: 0;
  background-image: url('/images/watermark.png');
  background-size: cover;
  background-position: center;
  opacity: 0.15;
  pointer-events: none;
}

/* ── sync-editor mount + reorder ─────────────────────────────────── */
/*
 * sync-editor.css gives .sync-editor-panel a flex column with
 * children in this order: waveform, controls, lyrics. The user's
 * spec puts controls *between* preview and waveform — so we
 * reorder using flex `order:` without modifying the vendored CSS.
 */

.editor-syncedit {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* sync-editor's .sync-editor-layout sets its own height via 70vh —
   * override so it fills our flex slot instead. */
}
.editor-syncedit .sync-editor-layout {
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.editor-syncedit .sync-editor-panel {
  display: flex;
  flex-direction: column;
}
.editor-syncedit .sync-editor-controls { order: 1; }
.editor-syncedit .sync-editor-waveform { order: 2; }
.editor-syncedit .sync-editor-lyrics   { order: 3; }

/* ── Seek bar: 2px hairline track, no border ──────────────────────── */
/* Native <input type=range> chrome is opinionated; we have to opt out
 * with -webkit-appearance:none and restyle the track + thumb per
 * vendor pseudo-element. Any one missing pseudo-element falls back to
 * default chrome — easy to lose track of, hence one rule per. */
.editor-syncedit .sync-editor-seek {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  outline: none;
  border: none;
  height: 12px;          /* hit-target; the visible track is 2px */
}
.editor-syncedit .sync-editor-seek::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--c-line-2);
  border: none;
  border-radius: 0;
}
.editor-syncedit .sync-editor-seek::-moz-range-track {
  height: 2px;
  background: var(--c-line-2);
  border: none;
  border-radius: 0;
}
.editor-syncedit .sync-editor-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4px;      /* center the 10px thumb on the 2px track */
  border-radius: 50%;
  background: var(--c-fg);
  border: none;
}
.editor-syncedit .sync-editor-seek::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-fg);
  border: none;
}

/* ── Lyric list typography ────────────────────────────────────────── */
/* Lines in the brand sans (TikTok Sans). Word chips stay monospaced
 * since their job is showing precise timestamps and the proportional
 * font would jiggle under highlighting. */
.editor-syncedit .sync-editor-line-text {
  font-family: var(--ff-sans);
}
.editor-syncedit .sync-editor-song-title {
  font-family: var(--ff-sans);
}

/* Highlighted word: invert against the page (white on black, or black
 * on white) — maximally legible, theme-correct, and never collides
 * with the brand red. */
.editor-syncedit .sync-editor-word.highlighted {
  background: var(--c-fg);
  border-color: var(--c-fg);
  color: var(--c-bg);
}

/* Loading state visible until sync-editor finishes booting */
.editor-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  background: var(--c-bg);
  color: var(--c-fg-muted);
  font-size: var(--fz-sm);
  z-index: 10;
}
.editor-loading[hidden] { display: none; }

.editor-stage { position: relative; }     /* anchor for .editor-loading */

/* ── Aspect picker ────────────────────────────────────────────────── */

.aspect-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-2);
}

.aspect-picker__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-2);
  border: 1px solid var(--c-line-2);
  border-radius: var(--r-md);
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: inherit;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}

.aspect-picker__btn:hover {
  background: var(--c-bg-3);
}

.aspect-picker__btn[aria-pressed="true"] {
  border-color: var(--c-brand);
  background: rgba(254, 44, 85, 0.06);
}

.aspect-picker__icon {
  display: block;
  background: var(--c-fg-subtle);
  border-radius: 2px;
  flex-shrink: 0;
}

.aspect-picker__btn[aria-pressed="true"] .aspect-picker__icon {
  background: var(--c-brand);
}

.aspect-picker__icon[data-shape="square"]     { width: 22px; height: 22px; }
.aspect-picker__icon[data-shape="vertical"]   { width: 14px; height: 22px; }
.aspect-picker__icon[data-shape="horizontal"] { width: 26px; height: 16px; }

.aspect-picker__label {
  font-size: var(--fz-xs);
  text-align: center;
  line-height: 1.2;
}

.aspect-picker__label small {
  display: block;
  color: var(--c-fg-subtle);
  font-size: 0.85em;
  margin-top: 2px;
}

/* Generic control container (used for groups in left panel) */

.control {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

.control__label {
  font-size: var(--fz-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control__hint {
  font-size: var(--fz-xs);
  color: var(--c-fg-subtle);
  font-style: italic;
  margin: 0;
}

.control--placeholder {
  margin-top: auto;
  padding-top: var(--s-4);
  border-top: 1px dashed var(--c-line);
}

/* Stack the panes on narrow viewports */
@media (max-width: 720px) {
  .editor {
    grid-template-columns: 1fr;
    height: auto;
  }
  .editor__options { order: 2; }
  .editor__main { order: 1; }
}

/* ── Editor placeholder (M7-pending) ──────────────────────────────── */

.editor-placeholder {
  max-width: 640px;
  margin: var(--s-10) auto 0;
}

.editor-placeholder h1 {
  font-size: var(--fz-2xl);
  margin-bottom: var(--s-6);
}

.editor-placeholder__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--s-4);
  padding: var(--s-5) var(--s-6);
  background: var(--c-bg-2);
  border-radius: var(--r-lg);
  margin-bottom: var(--s-8);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}

.stat__label {
  font-size: var(--fz-xs);
  color: var(--c-fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat__value {
  font-size: var(--fz-md);
  font-weight: var(--fw-semibold);
  color: var(--c-fg);
}

.stat__value--ok {
  color: var(--c-brand);
}

.editor-placeholder__notice h2 {
  font-size: var(--fz-lg);
  margin-bottom: var(--s-3);
}

.editor-placeholder__notice p {
  color: var(--c-fg-muted);
  line-height: var(--lh-loose);
}

.editor-placeholder__notice ul {
  margin: var(--s-4) 0;
  padding-left: var(--s-5);
  color: var(--c-fg-muted);
  line-height: var(--lh-loose);
}
