@import url("mz-menu.css"); /* canonical top-menu (.mz-topbar/.mz-auth) */
@import url("cosmic-rail.css?v=r2"); /* canonical vertical rail (single source — do NOT redeclare .rail*) */
/* chord-styles.css — Chord Library: cosmic shell + sticky head + controls + mixer
   + 4 progression views + diagrams + see-also + loop modal. Tokens from cssVars(). */

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body, "Geist", system-ui, sans-serif);
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background-color .5s ease, color .3s ease;
}
.app { position: relative; min-height: 100dvh; }

/* ── Background ─────────────────────────────────────────────── */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bg-base { position: absolute; inset: 0;
  background: radial-gradient(120% 95% at 50% 10%, var(--bg3), transparent 56%),
    radial-gradient(110% 80% at 50% 118%, var(--bg2), transparent 62%), var(--bg);
  transition: background .5s ease; }
.bg-nebula { position: absolute; inset: -22%;
  background: radial-gradient(52% 58% at 22% 22%, color-mix(in srgb, var(--glow) 30%, transparent), transparent 76%),
    radial-gradient(56% 60% at 82% 78%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 78%),
    radial-gradient(48% 52% at 84% 16%, color-mix(in srgb, var(--accent2) 20%, transparent), transparent 78%);
  filter: blur(58px); opacity: .5; transition: opacity .5s ease; }
.app[data-motion="1"] .bg-nebula { animation: nebula-drift 38s ease-in-out infinite alternate; }
@keyframes nebula-drift { 0% { transform: translate3d(0,0,0) scale(1); } 100% { transform: translate3d(2.5%, -2%, 0) scale(1.08); } }
.is-light .bg-nebula { opacity: .4; }
.bg-stars { position: absolute; inset: 0; color: #fff; }
.bg-stars span { position: absolute; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 6px color-mix(in srgb, currentColor 70%, transparent); }
.app[data-motion="1"] .bg-stars.twinkle span { animation: twinkle linear infinite; }
@keyframes twinkle { 0%,100% { opacity: .2; } 50% { opacity: 1; } }
.is-light .bg-stars { color: var(--accent); opacity: .3; }
.bg-grain { position: absolute; inset: 0; mix-blend-mode: overlay; opacity: .5;
  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)' opacity='0.5'/%3E%3C/svg%3E"); }
.bg-vignette { position: absolute; inset: 0;
  background: radial-gradient(120% 100% at 50% 30%, transparent 55%, color-mix(in srgb, var(--bg) 92%, black) 100%);
  transition: background .5s ease; }

/* Vertical rail → css/cosmic-rail.css (single source, imported at top). */

/* ── Page shell (framed, rail gutter) — identical model to Vocal Remover / Beat ── */
.shell { position: relative; z-index: 1; width: min(100%, 1080px); margin: 0 auto; padding: 22px 24px 80px 92px; }

/* unified top nav — geometry matches VR's .topbar exactly (6/2/0 + 30px gap to hero) */
.mz-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 2px 0; margin: 0 0 30px; }
.mz-brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: var(--ink); }
.mz-brand-mark { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent2), var(--accent)); box-shadow: 0 16px 38px -14px color-mix(in srgb, var(--accent) 70%, transparent); }
.mz-brand-name { font-family: var(--font-body); font-weight: 600; font-size: 16.5px; letter-spacing: -.02em; }
.mz-brand-name em { font-family: var(--font-display); font-style: italic; font-weight: 400; color: var(--accent); }
.mz-nav { display: flex; align-items: center; gap: 8px; }
.mz-nav-link { color: var(--sub); text-decoration: none; font-family: var(--font-body); font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 10px; transition: color .18s ease, background .18s ease; }
.mz-nav-link:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.mz-theme-toggle { appearance: none; border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); background: color-mix(in srgb, var(--surface) 70%, transparent);
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer; color: var(--sub); display: grid; place-items: center; transition: .18s ease; }
.mz-theme-toggle:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.mz-hero { margin: 18px auto 36px !important; }

/* ── Shared page footer — same recipe as vocal-styles.css .foot so every page matches ── */
.foot { margin-top: 64px; padding-top: 26px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot .copy { color: var(--sub); font-size: 13px; }

/* ── Card base ──────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%); }
.card-h { display: flex; align-items: center; gap: 10px; font-family: var(--font-body); font-weight: 600; font-size: 16px; color: var(--ink); }
.card-h .ic { width: 20px; height: 20px; color: var(--accent); display: grid; place-items: center; }
.card-h .ic svg { width: 20px; height: 20px; }

/* ── Sticky head ────────────────────────────────────────────── */
.cl-head { position: sticky; top: 8px; z-index: 40; padding: 22px 26px; margin-bottom: 18px; }
.cl-head.no-sticky { position: relative; top: auto; }
.cl-head-grid { display: grid; grid-template-columns: 1fr 360px; gap: 26px; align-items: start; }
.cl-title { margin: 0; font-family: var(--font-body); font-weight: 700; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -.02em;
  background: var(--cta); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cl-by { margin: 14px 0 0; display: flex; align-items: center; gap: 10px; color: var(--sub); font-size: 14px; }
.cl-artists { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid var(--accent-line); font-weight: 600; }
.cl-mainchords { margin: 12px 0 0; color: var(--sub); font-size: 14.5px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cl-mainchords b { color: var(--ink); font-weight: 600; }
.cl-actions { margin-top: 16px; display: flex; gap: 9px; }
.cl-icobtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface-2);
  color: var(--sub); display: grid; place-items: center; cursor: pointer; transition: .15s ease; }
.cl-icobtn:hover { color: var(--accent); border-color: var(--accent-line); transform: translateY(-1px); }
.cl-icobtn svg { width: 16px; height: 16px; }
.cl-icobtn.fav-on { color: #ef476f; border-color: color-mix(in srgb, #ef476f 55%, transparent); background: color-mix(in srgb, #ef476f 12%, transparent); }
.cl-icobtn.fav-on:hover { color: #ef476f; }

/* ── Share modal ────────────────────────────────────────────── */
.share-modal { max-width: 470px; }
.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.share-btn { display: flex; flex-direction: column; align-items: center; gap: 9px; padding: 15px 8px 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-decoration: none;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s ease; }
.share-btn:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.share-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
@media (max-width: 480px) { .share-grid { grid-template-columns: repeat(2, 1fr); } }

/* youtube */
.cl-yt { border-radius: 16px; overflow: hidden; border: 1px solid var(--line-strong); background: #0c0c12; aspect-ratio: 16/9; position: relative; }
.cl-yt iframe { width: 100%; height: 100%; border: 0; display: block; }
.cl-yt-card { position: absolute; inset: 0; display: grid; place-items: center; cursor: pointer; text-decoration: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent2) 40%, #0c0c12), color-mix(in srgb, var(--accent) 36%, #0c0c12)); }
.cl-yt-meta { position: absolute; top: 12px; left: 14px; right: 14px; color: #fff; }
.cl-yt-meta .ch { font-weight: 700; font-size: 13px; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.cl-yt-meta .sb { font-size: 11.5px; opacity: .85; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.cl-yt-play { width: 58px; height: 40px; border-radius: 11px; background: #f00; display: grid; place-items: center; box-shadow: 0 8px 24px -6px rgba(255,0,0,.6); }
.cl-yt-play::after { content: ""; border-left: 15px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 3px; }

/* scrubber */
.cl-scrub { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 16px; }
.cl-play { width: 56px; height: 56px; flex-shrink: 0; border: 0; border-radius: 50%; cursor: pointer; color: #fff; background: var(--cta);
  box-shadow: var(--cta-glow); display: grid; place-items: center; transition: filter .15s ease, transform .1s ease; }
.cl-play:hover { filter: brightness(1.08); } .cl-play:active { transform: scale(.96); }
.cl-play svg { width: 22px; height: 22px; }
.cl-time { font-variant-numeric: tabular-nums; color: var(--sub); font-size: 13.5px; min-width: 40px; }
.cl-track { flex: 1; height: 8px; border-radius: 999px; background: var(--track); cursor: pointer; position: relative; }
.cl-track-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--cta); }
.cl-track-knob { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%);
  box-shadow: 0 1px 5px rgba(0,0,0,.4); }

/* ── Controls grid ──────────────────────────────────────────── */
.cl-controls { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; margin-bottom: 18px; }
.ctl { padding: 14px 12px; text-align: center; border-radius: 16px; }
.ctl-lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sub); display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 11px; }
.ctl-lbl svg { width: 15px; height: 15px; }
.ctl-val { font-family: var(--font-display); font-style: var(--display-style); font-size: 22px; color: var(--ink); line-height: 1; }
.ctl-sub { font-size: 11px; color: var(--sub); margin-top: 6px; }
.ctl-stepper { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ctl-stepper button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 15px; line-height: 1; display: grid; place-items: center; transition: .14s; }
.ctl-stepper button:hover { border-color: var(--accent-line); color: var(--accent); }
.ctl input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 5px; border-radius: 999px; background: var(--track); outline: none; margin-top: 4px; }
.ctl input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2px solid color-mix(in srgb, var(--bg) 80%, #fff); cursor: pointer; }
.ctl-btn { width: 100%; }
.ctl.clickable { cursor: pointer; transition: border-color .15s ease, transform .1s ease; }
.ctl.clickable:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.ctl-toggle { position: relative; width: 40px; height: 22px; margin: 2px auto 0; border: 0; border-radius: 999px; background: var(--track); cursor: pointer; }
.ctl-toggle.on { background: var(--accent); }
.ctl-toggle i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.ctl-toggle.on i { transform: translateX(18px); }

/* ── Vocal remover mixer ────────────────────────────────────── */
.cl-section { padding: 20px 24px; margin-bottom: 18px; }
.cl-section-h { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mixer-controls { display: flex; align-items: center; gap: 10px; }
.mini-sel { appearance: none; height: 38px; padding: 0 30px 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 13px; font-weight: 500; background: var(--surface-2); color: var(--ink); cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='gray' d='M0 0h10L5 6z'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; }
.mini-sel option { color: #111; }
.btn-primary { appearance: none; border: 0; border-radius: 11px; padding: 10px 18px; font: inherit; font-weight: 600; font-size: 13.5px; color: #fff; background: var(--cta); box-shadow: var(--cta-glow); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: filter .15s, transform .1s; }
.btn-primary:hover { filter: brightness(1.08); } .btn-primary:active { transform: scale(.97); }
.btn-primary svg { width: 15px; height: 15px; }
.mixer-stems { margin-top: 18px; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stem { padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.stem-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stem-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.stem-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--stem-c); box-shadow: 0 0 10px var(--stem-c); }
.stem-mute { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--sub); cursor: pointer; display: grid; place-items: center; }
.stem-mute.muted { color: #ff6b81; border-color: #ff6b81; }
.stem-mute svg { width: 14px; height: 14px; }
.stem input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--track); outline: none; }
.stem input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--stem-c); border: 2px solid color-mix(in srgb, var(--bg) 80%, #fff); cursor: pointer; }
.mixer-hint { margin-top: 14px; color: var(--sub); font-size: 12.5px; text-align: center; }

/* ── Chord label (root + sub/sup) ───────────────────────────── */
.chd { font-family: var(--font-body); font-weight: 700; white-space: nowrap; letter-spacing: -.01em; }
.chd .acc { font-size: .66em; vertical-align: .15em; margin-left: -.02em; }
.chd .suf { font-size: .58em; font-weight: 600; margin-left: .04em; }
.chd .suf.up { vertical-align: .42em; } .chd .suf.dn { vertical-align: -.18em; }
.chd .slash { font-size: .6em; font-weight: 500; opacity: .8; }

/* ── Progression card + view switch ─────────────────────────── */
.prog { padding: 22px 24px 26px; margin-bottom: 18px; }
.prog-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.view-switch { display: inline-flex; padding: 4px; gap: 3px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); }
.view-tab { appearance: none; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--sub); padding: 8px 14px; border-radius: 9px; display: inline-flex; align-items: center; gap: 7px; transition: .15s ease; white-space: nowrap; }
.view-tab svg { width: 15px; height: 15px; }
.view-tab.on { color: #fff; background: var(--cta); box-shadow: var(--cta-glow); }
.view-tab:not(.on):hover { color: var(--ink); }
.prog-stage { min-height: 300px; display: flex; flex-direction: column; justify-content: center; }

/* counter pill */
.beat-counter { align-self: center; padding: 12px 26px; border-radius: 16px; font-family: var(--font-display); font-style: var(--display-style); font-size: 30px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #ff7a8a, #ff5577); box-shadow: 0 14px 34px -12px rgba(255,85,119,.6); margin-bottom: 28px; letter-spacing: .02em; }

/* Simple View */
.sv-row { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 20px; align-items: center; max-width: 720px; margin: 0 auto 30px; }
.sv-cell { text-align: center; }
.sv-chord { font-size: 34px; color: var(--sub); opacity: .8; }
.sv-cell.cur .sv-chord { font-size: 64px; color: var(--ink); }
.sv-beats { margin-top: 8px; font-variant-numeric: tabular-nums; color: var(--sub); font-size: 15px; }
.sv-cell.cur .sv-beats { font-size: 20px; color: var(--accent); font-weight: 700; }
.sv-cell.cur .sv-pill { display: inline-block; margin-top: 10px; padding: 7px 16px; border-radius: 12px; color: #fff; background: var(--cta); font-size: 17px; font-weight: 700; box-shadow: var(--cta-glow); }
.sv-arrow { color: var(--sub); opacity: .4; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 8px; }

/* progression table */
.prog-table { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: color-mix(in srgb,var(--ink) 22%, transparent) transparent; }
.prog-table::-webkit-scrollbar { height: 8px; } .prog-table::-webkit-scrollbar-thumb { background: color-mix(in srgb,var(--ink) 22%, transparent); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.prog-table table { border-collapse: collapse; width: max-content; min-width: 100%; }
.prog-table td { border-right: 1px solid var(--line); padding: 10px 12px; text-align: center; min-width: 52px; }
.prog-table tr.chords td { font-weight: 700; font-size: 15px; color: var(--ink); background: color-mix(in srgb, var(--ink) 4%, transparent); }
.prog-table tr.beats td { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--sub); border-top: 1px solid var(--line); }
.prog-table td.cur { background: var(--cta) !important; color: #fff !important; }
.prog-table tr.beats td.cur { color: #fff !important; }

/* Mono palette: --cta is grayscale (near-white in dark), so these white labels
   on the accent/cta background go invisible. --bg is the opposite luminance of
   the accent in Mono, readable in both appearances. data-palette is set on
   <html> by chord-app.jsx. Covers the selected chord/count cells (the reported
   case) plus every other white-on-cta control on this page. */
[data-palette="mono"] .prog-table td.cur,
[data-palette="mono"] .prog-table tr.beats td.cur,
[data-palette="mono"] .sv-cell.cur .sv-pill,
[data-palette="mono"] .view-tab.on,
[data-palette="mono"] .gv-cols .opt button.on,
[data-palette="mono"] .cr-stem-btn.on,
[data-palette="mono"] .cr-wall-btn.primary { color: var(--bg) !important; }

/* Simple View II — orbs */
/* minmax(0,1fr) sides, not 1fr: a long prev/next chord label would floor its
   track at min-content and push the whole row past the screen edges on phones */
.sv2 { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 30px; max-width: 760px; margin: 10px auto; min-height: 280px; }
.sv2-side { text-align: center; opacity: .7; }
.sv2-side .c { font-size: 30px; color: var(--sub); }
.sv2-side .b { margin-top: 8px; color: var(--sub); font-size: 15px; font-variant-numeric: tabular-nums; }
.sv2-center { position: relative; display: grid; place-items: center; }
.sv2-orb { width: 200px; height: 200px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 68%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 60px -10px color-mix(in srgb, var(--glow) 60%, transparent); }
.sv2-orb .c { font-size: 52px; color: var(--ink); }
.sv2-orb .q { margin-top: 6px; font-size: 11px; letter-spacing: .18em; color: var(--accent); font-weight: 700; }
.sv2-orb .b { margin-top: 4px; font-size: 18px; color: var(--accent2); font-weight: 700; font-variant-numeric: tabular-nums; }
.sv2-orb .tot { margin-top: 2px; font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.sv2-glow { position: absolute; width: 150px; height: 150px; border-radius: 50%; filter: blur(34px); opacity: .5; }
.sv2-glow.l { left: 4%; background: color-mix(in srgb, var(--accent2) 70%, transparent); }
.sv2-glow.r { right: 4%; background: color-mix(in srgb, var(--accent) 70%, transparent); }
/* Phones: shrink the orb + side chords so prev/orb/next all fit centered. */
@media (max-width: 760px) {
  .sv2 { gap: 12px; min-height: 230px; }
  .sv2-orb { width: 150px; height: 150px; }
  .sv2-orb .c { font-size: 36px; }
  .sv2-side .c { font-size: 21px; }
  .sv2-side .b { font-size: 13px; }
  .sv2-glow { width: 100px; height: 100px; }
}

/* Beat Timeline */
.bt-wrap { padding: 6px 2px; }
.bt-bar { display: flex; gap: 8px; overflow-x: auto; padding: 10px 8px 16px; scrollbar-width: thin; scrollbar-color: color-mix(in srgb,var(--ink) 22%, transparent) transparent; }
.bt-bar::-webkit-scrollbar { height: 8px; } .bt-bar::-webkit-scrollbar-thumb { background: color-mix(in srgb,var(--ink) 22%, transparent); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.bt-cell { flex: 0 0 76px; height: 100px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; position: relative; transition: border-color .12s; cursor: pointer; }
.bt-cell:hover:not(.cur) { border-color: var(--accent-line); }
/* CTA gradient on a fading overlay — the base background never swaps, so the
   highlight leaves a cell without the blank flash (same fix as Grid View) */
.bt-cell::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; background: var(--cta); opacity: 0; transition: opacity .08s ease; pointer-events: none; }
.bt-cell .lbl { position: relative; z-index: 1; }
/* hard bar line every 4 beats (measure start), centered in the gap */
.bt-cell.bar::after { content: ""; position: absolute; left: -5.5px; top: 2%; bottom: 2%; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 40%, transparent); pointer-events: none; }
.bt-cell.change { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); }
.bt-cell.change .lbl { font-size: 20px; font-weight: 700; color: var(--accent); }
.bt-cell.cur { border-color: transparent; box-shadow: 0 0 16px -3px color-mix(in srgb, var(--accent) 70%, transparent); }
.bt-cell.cur::before { opacity: 1; }
.bt-cell.cur .lbl { color: #fff; }
@media (max-width: 760px) { .bt-cell { flex-basis: 60px; height: 82px; } .bt-cell.change .lbl { font-size: 16px; } }
.bt-progress { height: 4px; border-radius: 999px; background: var(--track); overflow: hidden; margin: 8px 4px 0; }
.bt-progress i { display: block; height: 100%; background: var(--cta); border-radius: 999px; }

/* Grid View */
.gv-cols { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.gv-cols .lbl { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--sub); }
.gv-cols .opt { display: flex; gap: 6px; }
.gv-cols .opt button { width: 38px; height: 32px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: .14s; }
.gv-cols .opt button.on { background: var(--cta); color: #fff; border-color: transparent; box-shadow: var(--cta-glow); }
.gv-grid { display: grid; gap: 8px; max-height: 340px; overflow-y: auto; padding: 4px 7px; scrollbar-width: thin; scrollbar-color: color-mix(in srgb,var(--ink) 22%, transparent) transparent; }
.gv-grid::-webkit-scrollbar { width: 8px; } .gv-grid::-webkit-scrollbar-thumb { background: color-mix(in srgb,var(--ink) 22%, transparent); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }
.gv-cell { position: relative; min-width: 0; aspect-ratio: 1.25/1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; transition: border-color .12s; cursor: pointer; }
.gv-cell:hover:not(.cur) { border-color: var(--accent-line); }
/* the CTA gradient lives on a fading overlay: the cell's base background never
   changes, so the highlight leaves without the blank-flash a background swap caused */
.gv-cell::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; background: var(--cta); opacity: 0; transition: opacity .08s ease; pointer-events: none; }
.gv-cell .lbl { position: relative; z-index: 1; }
/* bar line every 4 beats (measure start), drawn in the column gap */
.gv-cell.bar::after { content: ""; position: absolute; left: -5.5px; top: 10%; bottom: 10%; width: 2px; border-radius: 1px; background: color-mix(in srgb, var(--ink) 26%, transparent); pointer-events: none; }
.gv-cell.change { border-color: var(--accent-line); background: color-mix(in srgb, var(--accent) 9%, var(--surface-2)); }
.gv-cell.change .lbl { font-size: 18px; font-weight: 700; color: var(--ink); }
.gv-cell.cur { border-color: transparent; box-shadow: 0 0 18px -3px color-mix(in srgb, var(--accent) 70%, transparent); }
.gv-cell.cur::before { opacity: 1; }
.gv-cell.cur .lbl { color: #fff; }

/* ── Diagrams ───────────────────────────────────────────────── */
.diag-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.diag-tabs { display: flex; gap: 18px; }
.diag-tab { appearance: none; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 15px; font-weight: 600; color: var(--sub); padding: 6px 0; border-bottom: 2px solid transparent; transition: .15s; }
.diag-tab.on { color: var(--accent); border-color: var(--accent); }
.inst-switch { display: inline-flex; padding: 4px; gap: 3px; border-radius: 11px; background: color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); }
.inst-tab { appearance: none; border: 0; background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; color: var(--sub); padding: 7px 15px; border-radius: 8px; transition: .15s; }
.inst-tab.on { color: #fff; background: var(--cta); }
.diag-row { margin-top: 12px; display: flex; align-items: center; gap: 10px; overflow-x: auto; padding: 18px 14px; scrollbar-width: none; -ms-overflow-style: none; }
.diag-row::-webkit-scrollbar { display: none; }
.diagram { flex: 0 0 auto; width: 116px; text-align: center; padding: 8px 2px 9px; border-radius: 14px; border: 2px solid transparent; cursor: pointer; transition: transform .22s ease, border-color .22s ease, background .22s ease, box-shadow .22s ease; }
.diagram:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.diagram.cur { transform: scale(1.14); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)); box-shadow: 0 8px 26px color-mix(in srgb, var(--accent) 35%, transparent); position: relative; z-index: 1; }
.diagram svg { color: color-mix(in srgb, var(--ink) 48%, transparent); }
.diagram.cur svg { color: color-mix(in srgb, var(--ink) 65%, transparent); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 45%, transparent)); }
.diagram .nm { margin-top: 6px; font-weight: 700; font-size: 15px; color: var(--ink); }
.diagram.cur .nm { color: var(--accent); }
/* Two-octave piano cards (Tweaks → Piano octaves): the keyboard doubles, so
   fewer cards fit per row — the strip scrolls the same on every viewport.
   Side padding keeps the keybed off the card border (border-box: 232 = 4
   border + 24 padding + 204 content ≈ the 205-unit two-octave svg). */
.diagram.oct2 { width: 232px; padding-left: 12px; padding-right: 12px; }
.diagram.oct2 svg { width: 100%; height: auto; }
/* Gentler zoom for the wide cards — 1.14 × 232px overflows a phone's strip. */
.diagram.oct2.cur { transform: scale(1.06); }
.diag-overview { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.ov-chip { padding: 8px 14px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; }
.ov-chip.cur { background: var(--cta); color: #fff; border-color: transparent; }
.diag-edit { margin-top: 18px; color: var(--sub); font-size: 14px; line-height: 1.6; }

/* ── See Also ───────────────────────────────────────────────── */
.see-also { padding: 26px 24px; margin-bottom: 10px; }
.see-also-h { text-align: center; margin-bottom: 20px; }
.sa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.sa-card { text-decoration: none; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); transition: transform .15s ease, border-color .15s ease; display: block; }
.sa-card:hover { transform: translateY(-3px); border-color: var(--accent-line); }
.sa-thumb { aspect-ratio: 16/9; position: relative; display: grid; place-items: center; }
.sa-thumb .play { width: 50px; height: 50px; border-radius: 50%; background: rgba(0,0,0,.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: grid; place-items: center; }
.sa-thumb .play::after { content: ""; border-left: 14px solid #fff; border-top: 9px solid transparent; border-bottom: 9px solid transparent; margin-left: 3px; }
.sa-body { padding: 14px 16px; }
.sa-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.sa-artist { margin-top: 3px; font-size: 13px; color: var(--sub); }

/* ── Loop modal ─────────────────────────────────────────────── */
.modal-scrim { position: fixed; inset: 0; z-index: 7000; background: rgba(6,4,16,.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; }
.modal { width: min(960px, 100%); max-height: 86dvh; display: flex; flex-direction: column; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-pop); overflow: hidden; }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; font-family: var(--font-display); font-style: var(--display-style); font-size: 24px; font-weight: 600; color: var(--ink); }
.modal-x { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-strong); background: transparent; color: var(--sub); cursor: pointer; display: grid; place-items: center; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; }
.modal-note { padding: 13px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)); border: 1px solid var(--accent-line); color: var(--ink); font-size: 13.5px; margin-bottom: 18px; line-height: 1.5; }
.loop-grid { display: grid; grid-template-columns: repeat(11, 1fr); gap: 10px; }
.loop-cell { aspect-ratio: 1/1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; transition: .12s; padding: 4px; }
.loop-cell:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.loop-cell .lc-chord { font-weight: 700; font-size: 14px; color: var(--ink); }
.loop-cell .lc-time { font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }
.loop-cell.start { border-color: #2bd383; background: color-mix(in srgb, #2bd383 18%, var(--surface-2)); box-shadow: 0 0 0 1.5px #2bd383; }
.loop-cell.end { border-color: #ffa53b; background: color-mix(in srgb, #ffa53b 18%, var(--surface-2)); box-shadow: 0 0 0 1.5px #ffa53b; }
.loop-cell.inrange { background: color-mix(in srgb, var(--accent) 13%, var(--surface-2)); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; }
.loop-status { color: var(--sub); font-size: 13px; }
.modal-actions { display: flex; gap: 10px; }
.btn-ghost { appearance: none; border: 1px solid var(--line-strong); background: transparent; color: var(--ink); border-radius: 11px; padding: 10px 16px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.btn-ghost:hover { border-color: var(--accent-line); }

/* toast */
.cl-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 8000; padding: 12px 20px; border-radius: 12px; background: var(--invert); color: var(--invert-ink); font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow-pop); animation: toast-in .3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* loop indicator on scrubber */
.cl-loopbadge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--accent); padding: 3px 9px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid var(--accent-line); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .cl-controls { grid-template-columns: repeat(4, 1fr); }
  .cl-head-grid { grid-template-columns: 1fr; }
  .cl-yt { max-width: 420px; }
  .loop-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-width: 760px) {
  /* rail mobile behaviour lives in cosmic-rail.css */
  .shell { width: 100%; padding: 16px 14px 50px; padding-left: 72px; }
  .mz-nav-link { display: none; }
  .cl-controls { grid-template-columns: repeat(2, 1fr); }
  .sa-grid { grid-template-columns: 1fr; }
  .sv-chord { font-size: 26px; } .sv-cell.cur .sv-chord { font-size: 46px; }
  .loop-grid { grid-template-columns: repeat(5, 1fr); }
  .cl-head { position: relative; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bg-nebula, .bg-stars span { animation: none !important; }
}


/* ── Seamless cross-page navigation ─────────────────────────────────────────
   Opt every cosmic page into the browser's cross-document View Transitions, so
   moving between tools cross-fades instead of flashing a full white reload. The
   rail, hero and cosmic background get stable transition names so the browser
   treats them as the SAME element across pages — they hold their place while
   only the tool body swaps, for an SPA-like feel with no rebuild flicker.
   (Scripts still load per tool, but the shared chrome is cached + never
   visibly reloads.) */
@view-transition { navigation: auto; }

.bg      { view-transition-name: mz-bg; }
/* .rail view-transition-name is set in cosmic-rail.css */
.mz-hero { view-transition-name: mz-hero; }

/* Rail + background are persistent chrome — snap instantly (no fade) so they
   look perfectly static while the page changes. */
::view-transition-group(mz-bg),
::view-transition-group(mz-rail) { animation-duration: 0s; }
::view-transition-old(mz-bg), ::view-transition-new(mz-bg),
::view-transition-old(mz-rail), ::view-transition-new(mz-rail) { animation: none; }

/* Tool body + hero cross-fade smoothly. */
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 0.34s;
  animation-timing-function: cubic-bezier(.4, 0, .2, 1);
}
::view-transition-group(mz-hero) { animation-duration: 0.34s; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*), ::view-transition-new(*) { animation-duration: 0.01s !important; }
}
