/* NXT STUDIO - audio workstation (transport deck, track headers, arrangement, panels, step
   sequencer, keys), the project launcher and the landing page. Loaded only on this product's pages.
   Owned by the product team - tokens only (--c-*, --s-*, --r-*, --t-*). The transport deck is a
   dark hardware strip in both themes (like the CLIPS monitor); everything else follows the theme.
   Track tones are grey steps; track names, numbers and kind glyphs carry identity. */

@layer product {
  .p-studio { --st-night: #0A0A0A; --st-night2: #141414; --st-line: #2A2A2A; --st-ink: #EDEDED; --st-dim: #9C9C9C; --st-lcd: #050505; }
  .st-night { background: var(--st-night); color: var(--st-ink);
    --c-text: var(--st-ink); --c-muted: var(--st-dim); --c-border: var(--st-line); --c-border-strong: #474747; --c-bg: #0F0F0F; --c-surface: var(--st-night2); --c-surface2: #050505; --c-link: #E0E0E0;
    --c-focus: #FFFFFF; --c-focus-inner: #000000; --c-primary: #FFFFFF; --c-on-primary: #000000; --c-primary-hover: #D6D6D6; --c-primary-soft: #262626; --c-accent: #FFFFFF; --p: #FFFFFF; --pa: #FFFFFF; --pon: #000000; --p-soft: #262626; color-scheme: dark; }
  .st-night .btn-secondary { --b-bg: transparent; --b-fg: #EDEDED; --b-bd: #474747; --b-hover: rgb(255 255 255 / 0.06); }

  /* ================= Workstation ================= */
  .studio { display: grid; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--layout-header)); min-height: 620px; background: var(--c-surface2); }
  .st-bar { display: flex; gap: var(--s-2); align-items: center; min-height: 52px; padding: 6px var(--s-3); background: var(--c-surface); border-bottom: 1px solid var(--c-border); min-width: 0; }
  .st-back { display: inline-flex; gap: 4px; align-items: center; min-height: 36px; padding: 0 var(--s-2) 0 4px; border-radius: var(--r-sm); color: var(--c-text); font-weight: 600; font-size: var(--t-small); text-decoration: none; flex: none; }
  .st-back:hover { background: var(--c-surface2); text-decoration: none; }
  .st-title { display: grid; min-width: 0; }
  .studio-name { min-width: 0; max-width: 22rem; font: 600 var(--t-body)/1.2 var(--font-sans); border: 1px solid transparent; border-radius: var(--r-xs); padding: 2px 6px; background: transparent; color: var(--c-text); }
  .studio-name:hover, .studio-name:focus { border-color: var(--c-border); }
  .st-title-meta { padding-left: 7px; font: 500 var(--t-caption)/1.3 var(--font-mono); color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .studio-status { display: inline-flex; gap: 6px; align-items: center; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--t-caption); }
  .studio-status::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c-text); }
  .studio[data-save='dirty'] .studio-status::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c-text); }
  .studio[data-save='busy'] .studio-status::before { animation: st-blink 1s var(--ease-in-out) infinite; }
  .studio[data-save='error'] .studio-status::before { border-radius: 1px; }
  @keyframes st-blink { 50% { opacity: .25; } }
  .studio-spacer { flex: 1; }
  .st-group { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--c-border); border-radius: var(--r-sm); background: var(--c-bg); flex: none; }
  .st-ibtn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border: 0; border-radius: 4px; background: transparent; color: var(--c-text); cursor: pointer; }
  .st-ibtn:hover { background: var(--c-surface2); }

  /* Transport deck */
  .st-transport { background: var(--st-night); color: var(--st-ink); border-bottom: 1px solid #000; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05);
    --c-text: var(--st-ink); --c-muted: var(--st-dim); --c-border: var(--st-line); --c-border-strong: #474747; --c-bg: #111111; --c-surface: var(--st-night2); --c-surface2: #050505;
    --c-focus: #FFFFFF; --c-focus-inner: #000000; --c-primary: #FFFFFF; --c-on-primary: #000000; color-scheme: dark; }
  .studio-transport { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; padding: 8px var(--s-3); }
  .st-tgroup { display: inline-flex; gap: 4px; align-items: center; }
  .st-deck { padding: 3px; border-radius: var(--r-md); background: #000; box-shadow: inset 0 0 0 1px var(--st-line); }
  .st-tbtn { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--st-ink); font: 600 var(--t-small)/1 var(--font-sans); cursor: pointer; transition: background-color var(--d-fast), border-color var(--d-fast); }
  .st-tbtn:hover { background: rgb(255 255 255 / 0.08); }
  .st-tbtn:focus-visible, .st-ibtn:focus-visible, .st-back:focus-visible, .studio-tab:focus-visible, .studio-toggle:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; box-shadow: 0 0 0 4px var(--c-focus-inner); }
  .st-play { width: 46px; height: 36px; background: #F2F2F2; color: #0A0A0A; }
  .st-play:hover { background: #FFFFFF; }
  .studio.is-playing .st-play { background: #FFFFFF; box-shadow: 0 0 0 3px rgb(255 255 255 / 0.15); }
  .st-rec .i { color: #D9D9D9; }
  .st-rec[aria-pressed='true'] { background: #FFFFFF; color: #000; border-color: #FFFFFF; }
  .st-rec[aria-pressed='true'] .i { color: #000; animation: st-blink 1s steps(2) infinite; }
  .st-toggle { border-color: var(--st-line); }
  .st-toggle[aria-pressed='true'] { background: #F2F2F2; color: #0A0A0A; border-color: #F2F2F2; }
  .st-lcd { display: inline-grid; grid-template-columns: auto auto; grid-auto-flow: column; grid-template-rows: auto auto; column-gap: var(--s-4); align-items: end; padding: 4px var(--s-4); min-width: 15rem; border-radius: var(--r-sm); background: var(--st-lcd); box-shadow: inset 0 0 0 1px var(--st-line), inset 0 6px 16px rgb(0 0 0 / 0.6); }
  .st-lcd-k { font: 600 0.5625rem/1 var(--font-mono); letter-spacing: .14em; color: #8F8F8F; }
  .st-lcd-bars, .st-lcd-time { font: 600 1.125rem/1.15 var(--font-mono); font-variant-numeric: tabular-nums; color: #F5F5F5; letter-spacing: .02em; white-space: nowrap; }
  .st-lcd-time { color: #BDBDBD; }
  .st-tlabel { font: 600 var(--t-overline)/1 var(--font-mono); letter-spacing: var(--tr-overline); color: var(--st-dim); }
  .studio-bpm, .st-sig, .st-snap { min-height: 36px; padding: 4px 8px; border: 1px solid var(--st-line); border-radius: var(--r-sm); background: #000; color: var(--st-ink); font: 600 var(--t-small)/1 var(--font-mono); }
  .studio-bpm { width: 5.25rem; }
  .st-import { border-color: var(--st-line); }

  /* Notice */
  .st-notice { background: var(--c-surface); border-bottom: 1px solid var(--c-border); }
  .st-notice > summary { display: flex; gap: var(--s-2); align-items: center; min-height: 32px; padding: 4px var(--s-4); cursor: pointer; color: var(--c-muted); list-style: none; }
  .st-notice > summary::-webkit-details-marker { display: none; }
  .st-notice > summary::after { content: 'Details'; margin-left: auto; font-weight: 600; color: var(--c-text); text-decoration: underline; text-underline-offset: 3px; }
  .st-notice[open] > summary::after { content: 'Hide'; }
  .st-notice [data-notice] { padding: 0 var(--s-4) var(--s-3); max-width: 100ch; }
  .st-notice [data-notice] p { margin: 0 0 var(--s-1); }
  .st-missing { display: inline-flex; padding: 1px 8px; border: 1px dashed var(--c-border-strong); border-radius: var(--r-xs); color: var(--c-text); font-weight: 600; }
  .st-missing[hidden] { display: none; }

  /* Arrangement */
  .studio-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 0; }
  .studio-arrange { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--c-bg); }
  .studio-ruler-row { display: flex; min-width: 0; border-bottom: 1px solid var(--c-border); background: var(--c-surface); }
  .studio-corner { display: flex; align-items: center; width: 212px; flex: none; padding: 0 var(--s-3); border-right: 1px solid var(--c-border); font: 600 var(--t-overline)/1 var(--font-mono); letter-spacing: var(--tr-overline); text-transform: uppercase; color: var(--c-muted); }
  .studio-ruler { display: block; cursor: pointer; touch-action: none; }
  .studio-tracks { display: flex; min-width: 0; min-height: 0; align-items: flex-start; overflow-y: auto; }
  .studio-heads { width: 212px; flex: none; border-right: 1px solid var(--c-border); background: var(--c-surface); }
  .studio-head { display: grid; gap: 4px; align-content: center; padding: 4px var(--s-2) 4px 14px; border-bottom: 1px solid var(--c-border); box-sizing: border-box; position: relative; cursor: default; }
  .studio-head.is-selected { background: var(--c-surface2); box-shadow: inset -2px 0 0 var(--c-text); }
  .st-head-top { display: flex; gap: 6px; align-items: center; min-width: 0; }
  .st-head-n { flex: none; min-width: 1.4em; font: 600 var(--t-caption)/1 var(--font-mono); color: var(--c-muted); }
  .studio-head-row { display: flex; gap: 4px; align-items: center; }
  .st-head-kind { display: inline-flex; gap: 4px; align-items: center; margin-left: auto; font: 500 var(--t-caption)/1 var(--font-mono); color: var(--c-muted); white-space: nowrap; }
  .studio-track-name { width: 100%; min-width: 0; font-size: var(--t-small); font-weight: 600; border: 1px solid transparent; background: transparent; color: var(--c-text); padding: 1px 4px; border-radius: 4px; }
  .studio-track-name:focus { border-color: var(--c-border-strong); }
  .studio-chip { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; }
  .studio-c0 { background: #404040; } .studio-c1 { background: #595959; } .studio-c2 { background: #737373; } .studio-c3 { background: #8C8C8C; }
  .studio-c4 { background: #4D4D4D; } .studio-c5 { background: #666666; } .studio-c6 { background: #808080; } .studio-c7 { background: #999999; }
  .studio-toggle { min-width: 26px; height: 24px; padding: 0 6px; font: 700 var(--t-caption)/1 var(--font-mono); border: 1px solid var(--c-border-strong); border-radius: 4px; background: var(--c-bg); color: var(--c-text); cursor: pointer; }
  .studio-toggle[aria-pressed="true"] { background: var(--c-text); color: var(--c-bg); border-color: var(--c-text); }
  .studio-toggle.is-rec[aria-pressed="true"] { background: repeating-linear-gradient(45deg, var(--c-text) 0 3px, var(--c-bg) 3px 6px); color: var(--c-text); }
  .studio-toggle.is-rec[aria-pressed="true"]::first-letter { background: var(--c-bg); }
  .studio-meter { width: 100%; height: 6px; }
  .studio-meter::-webkit-meter-bar { background: var(--c-surface2); border: 0; border-radius: 1px; height: 6px; }
  .studio-meter::-webkit-meter-optimum-value, .studio-meter::-webkit-meter-suboptimum-value { background: var(--c-text); }
  .studio-meter::-webkit-meter-even-less-good-value { background: repeating-linear-gradient(90deg, var(--c-text) 0 3px, transparent 3px 5px); }
  .studio-add { display: grid; gap: var(--s-1); padding: var(--s-2); }
  .studio-add .btn { justify-content: flex-start; }
  .studio-lanes { display: block; flex: 1; min-width: 0; touch-action: none; outline-offset: -2px; }

  /* Panels */
  .studio-side { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--c-surface); border-left: 1px solid var(--c-border); }
  .studio-tabs { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; margin: var(--s-2); border-radius: var(--r-md); background: var(--c-surface2); }
  .studio-tab { flex: 1 0 auto; min-height: 30px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--c-muted); font: 600 var(--t-small)/1 var(--font-sans); cursor: pointer; }
  .studio-tab:hover { color: var(--c-text); }
  .studio-tab[aria-selected="true"] { background: var(--c-surface); color: var(--c-text); box-shadow: var(--e-1); }
  .studio-panels { min-height: 0; overflow: hidden; display: grid; }
  .studio-panel { display: grid; align-content: start; gap: var(--s-3); padding: var(--s-2) var(--s-4) var(--s-5); overflow-y: auto; min-height: 0; }
  .studio-panel .h-xs, .studio-side .h-xs { font: var(--fw-overline) var(--t-overline)/1.2 var(--font-mono); letter-spacing: var(--tr-overline); text-transform: uppercase; color: var(--c-muted); margin: 0; }
  .studio-field { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s-2); align-items: center; font-size: var(--t-small); }
  .studio-field > label, .studio-field > span:first-child { grid-column: 1 / -1; color: var(--c-muted); font-size: var(--t-caption); font-weight: 600; }
  .studio-field input[type="range"] { width: 100%; accent-color: var(--c-text); }
  .studio-field output { font: 600 var(--t-caption)/1 var(--font-mono); font-variant-numeric: tabular-nums; min-width: 7ch; text-align: right; }
  .studio-field select, .studio-field input[type="number"], .studio-field input[type="text"] { grid-column: 1 / -1; min-height: 32px; padding: 4px 8px; border: 1px solid var(--c-border-strong); border-radius: var(--r-sm); background: var(--c-bg); color: var(--c-text); font: inherit; }
  .studio-check { display: flex; gap: var(--s-2); align-items: center; font-size: var(--t-small); }
  .studio-check input { accent-color: var(--c-text); }
  .studio-section { display: grid; gap: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--c-border); }
  .studio-fx { display: grid; gap: var(--s-2); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: var(--s-2) var(--s-3) var(--s-3); background: var(--c-bg); }
  .studio-fx legend { font: 600 var(--t-overline)/1 var(--font-mono); letter-spacing: var(--tr-overline); text-transform: uppercase; padding: 0 6px; }
  .studio-strip { display: grid; gap: var(--s-1); padding: var(--s-2) 0; border-bottom: 1px solid var(--c-border); }
  .studio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .studio-list li { margin: 0; }
  .studio-loop { display: flex; gap: var(--s-2); align-items: center; padding: 6px var(--s-2); border-radius: var(--r-sm); font-size: var(--t-small); }
  .studio-loop:hover { background: var(--c-surface2); }
  .studio-loop > span { flex: 1; }

  /* Bottom editors: step sequencer, keys, piano roll */
  .studio-bottom { padding: var(--s-3) var(--s-4); background: var(--c-surface); border-top: 1px solid var(--c-border); overflow-x: auto; max-height: 38vh; overflow-y: auto; }
  .studio-bottom:empty { display: none; }
  .studio-steps { display: grid; gap: 3px; min-width: 560px; }
  .studio-steps-row { display: grid; grid-template-columns: 6rem repeat(16, minmax(22px, 1fr)); gap: 3px; align-items: center; }
  .studio-steps-row > :nth-child(4n + 2) { margin-left: 4px; }
  .studio-steps-label { font: 600 var(--t-caption)/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); }
  .studio-step { height: 26px; border: 1px solid var(--c-border-strong); border-radius: 3px; background: var(--c-bg); cursor: pointer; }
  .studio-step.is-beat { background: var(--c-surface2); }
  .studio-step.is-on { background: var(--c-text); border-color: var(--c-text); }
  .studio-step.is-soft { background: repeating-linear-gradient(45deg, var(--c-text) 0 2px, transparent 2px 5px); border-color: var(--c-text); }
  .studio-step:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 1px; }
  .studio-keys { display: flex; gap: 1px; height: 90px; align-items: stretch; }
  .studio-key { width: 28px; border: 1px solid #BDBDBD; border-radius: 0 0 4px 4px; background: #FFFFFF; color: #595959; font-size: 10px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4px; cursor: pointer; touch-action: none; }
  .studio-key.is-black { background: #1A1A1A; color: #F2F2F2; height: 60%; width: 22px; margin: 0 -11px; position: relative; z-index: 1; border-color: #000; }
  .studio-key:active { background: #8C8C8C; }
  .studio-roll-wrap { overflow: auto; max-height: 320px; border: 1px solid var(--c-border); border-radius: var(--r-sm); }
  .studio-roll { display: block; touch-action: none; }

  .studio-settings { background: var(--c-surface); border-top: 1px solid var(--c-border); }
  .studio-settings > summary { display: flex; gap: var(--s-2); align-items: center; min-height: 36px; padding: 0 var(--s-4); cursor: pointer; color: var(--c-muted); font-weight: 600; }
  .st-settings { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: start; padding: var(--s-2) var(--s-4) var(--s-4); }
  .st-settings form { margin: 0; }
  .st-rename { display: grid; gap: var(--s-2); justify-items: start; }
  .st-settings-col { display: grid; gap: var(--s-2); justify-items: start; }
  .st-settings-col p { margin: 0; }

  @media (max-width: 1100px) { .studio-body { grid-template-columns: minmax(0, 1fr) 300px; } .studio-corner, .studio-heads { width: 176px; } .st-title-meta { display: none; } .st-head-kind > span { display: none; } }
  @media (max-width: 900px) {
    .studio { height: auto; min-height: 0; grid-template-rows: none; display: flex; flex-direction: column; }
    .st-bar { flex-wrap: wrap; row-gap: 6px; }
    .st-back-label, .st-hide-sm { display: none; }
    .st-title { flex: 1 1 140px; } .studio-name { max-width: none; width: 100%; }
    .studio-status { order: 10; flex-basis: 100%; }
    .studio-transport { gap: 6px; padding: 6px var(--s-2); }
    .st-lcd { min-width: 0; padding: 4px var(--s-3); }
    .st-tbtn-label { display: none; }
    .studio-body { grid-template-columns: minmax(0, 1fr); }
    .studio-side { border-left: 0; border-top: 1px solid var(--c-border); }
    .studio-corner, .studio-heads { width: 140px; }
    .st-head-kind { display: none; }
    .studio-tracks { max-height: 56vh; }
    .studio-panel { max-height: none; }
    .studio-bottom { max-height: none; }
  }

  /* ================= Launcher ================= */
  .st-home { display: grid; gap: var(--s-6); grid-template-columns: minmax(0, 1fr); }
  .st-home > * { min-width: 0; }
  @media (min-width: 1200px) {
    .st-home { grid-template-columns: minmax(0, 1fr) 320px; grid-template-areas: 'session rail' 'library rail' 'onb rail'; grid-template-rows: auto auto 1fr; align-items: start; }
    .st-session { grid-area: session; } .st-library { grid-area: library; } .st-home > .onboarding { grid-area: onb; } .st-rail { grid-area: rail; }
    .st-home.is-empty { grid-template-areas: 'session rail' 'onb rail'; }
  }
  .st-h { font: 600 var(--t-h4)/1.3 var(--font-sans); letter-spacing: -0.01em; margin: 0; display: flex; gap: var(--s-2); align-items: center; }
  .st-count { font: 600 var(--t-caption)/1 var(--font-mono); padding: 3px 7px; border-radius: var(--r-xs); background: var(--c-surface2); color: var(--c-muted); }
  .st-panel { display: grid; gap: var(--s-4); align-content: start; padding: var(--s-5); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); min-width: 0; }
  .st-panel-head { display: flex; gap: var(--s-3); align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .st-panel-head a { display: inline-flex; gap: 4px; align-items: center; }
  .st-rail { display: grid; gap: var(--s-5); align-content: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  @media (min-width: 1200px) { .st-rail { grid-template-columns: minmax(0, 1fr); } }

  /* The session card: last project as a mini arrangement on the deck */
  .st-session { display: grid; border-radius: var(--r-xl); overflow: hidden; border: 1px solid #000; box-shadow: var(--e-2); }
  .st-session-deck { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: center; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--st-line); }
  .st-session-deck .eyebrow { margin: 0; color: var(--st-dim); }
  .st-session-name { margin: 2px 0 0; font: var(--fw-h2) clamp(1.5rem, 1.1rem + 1.2vw, 2.125rem)/1.05 var(--font-display); letter-spacing: -0.03em; overflow-wrap: anywhere; color: #FFFFFF; }
  .st-session-id { flex: 1 1 260px; min-width: 0; }
  .st-session-lcd { display: flex; flex-wrap: wrap; max-width: 100%; gap: 1px; border-radius: var(--r-sm); overflow: hidden; background: var(--st-line); box-shadow: inset 0 0 0 1px var(--st-line); }
  .st-session-lcd div { flex: 1 0 auto; display: grid; gap: 4px; padding: 8px 14px; background: var(--st-lcd); }
  @media (max-width: 640px) { .st-session-lcd div { padding: 8px 10px; } .st-session-deck, .st-session-map, .st-session-foot { padding-inline: var(--s-4); } }
  .st-session-lcd dt { font: 600 0.5625rem/1 var(--font-mono); letter-spacing: .14em; color: #8F8F8F; text-transform: uppercase; }
  .st-session-lcd dd { margin: 0; font: 600 1rem/1 var(--font-mono); font-variant-numeric: tabular-nums; color: #F5F5F5; }
  .st-session dl { margin: 0; }
  .st-session-map { padding: var(--s-4) var(--s-5); background: #070707; }
  .st-session-foot { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); border-top: 1px solid var(--st-line); }
  .st-session-foot p { margin: 0; color: var(--st-dim); font-size: var(--t-small); }
  .st-session-foot .row { gap: var(--s-2); } .st-session-foot form { margin: 0; }

  /* Arrangement map (server-drawn SVG from the saved project) */
  .st-map { display: grid; gap: 3px; }
  .st-map-row { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-3); align-items: center; }
  .st-map-name { display: flex; gap: 6px; align-items: center; min-width: 0; font-size: var(--t-caption); font-weight: 600; color: #D9D9D9; }
  .st-map-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .st-map-n { flex: none; font: 600 0.625rem/1 var(--font-mono); color: #7A7A7A; min-width: 1.4em; }
  .st-map svg { display: block; width: 100%; height: 28px; }
  .st-map .lane { fill: #121212; }
  .st-map .rg { fill: #3A3A3A; stroke: #5C5C5C; stroke-width: 1; vector-effect: non-scaling-stroke; }
  .st-map .rg-pattern { fill: #2A2A2A; }
  .st-map .rg-midi { fill: #262626; }
  .st-map .rg-audio.is-local { fill: #2E2E2E; stroke-dasharray: 3 3; }
  .st-map .hit, .st-map .wv, .st-map .note { fill: #E6E6E6; }
  .st-map .loopwave { fill: none; stroke: #CFCFCF; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
  .st-map .loopband { fill: rgb(255 255 255 / 0.06); }
  .st-map .bar { stroke: #FFFFFF; stroke-opacity: .07; stroke-width: 1; vector-effect: non-scaling-stroke; }
  .st-map-ruler { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: var(--s-3); margin-bottom: 4px; font: 500 0.625rem/1 var(--font-mono); color: #6E6E6E; }
  .st-map-ruler > span:last-child { display: flex; justify-content: space-between; }

  /* Project rows (the library) */
  .st-library { display: grid; gap: var(--s-4); }
  .st-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .st-row { margin: 0; }
  .st-row-link { display: grid; grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); color: var(--c-text); text-decoration: none; transition: border-color var(--d-fast), box-shadow var(--d-base) var(--ease-out), transform var(--d-base) var(--ease-out); }
  .st-row-link:hover { text-decoration: none; border-color: var(--c-border-strong); box-shadow: var(--e-2); transform: translateY(-1px); }
  .st-row-link:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
  .st-row-id { display: grid; gap: 2px; min-width: 0; }
  .st-row-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .st-row-meta > span + span::before { content: '·'; margin-right: var(--s-2); }
  .st-row-meta { display: flex; gap: 4px var(--s-2); flex-wrap: wrap; font: 500 var(--t-caption)/1.3 var(--font-mono); color: var(--c-muted); }
  .st-row-strip { display: block; min-width: 0; padding: 4px; border-radius: var(--r-sm); background: #0A0A0A; }
  .st-row-strip svg { display: block; width: 100%; height: 40px; }
  .st-row-strip .lane { fill: #141414; }
  .st-row-strip .rg { fill: #4A4A4A; } .st-row-strip .rg-audio.is-local { fill: #3A3A3A; } .st-row-strip .rg-pattern, .st-row-strip .rg-midi { fill: #333333; }
  .st-row-strip .hit, .st-row-strip .wv, .st-row-strip .note { fill: #E0E0E0; }
  .st-row-strip .loopwave { fill: none; stroke: #CFCFCF; stroke-width: 1; vector-effect: non-scaling-stroke; }
  .st-row-strip .loopband, .st-row-strip .bar { display: none; }
  .st-row-side { display: grid; gap: 4px; justify-items: end; font-size: var(--t-caption); color: var(--c-muted); white-space: nowrap; }
  @media (max-width: 760px) { .st-row-link { grid-template-columns: minmax(0, 1fr); gap: var(--s-2); } .st-row-side { justify-items: start; grid-auto-flow: column; justify-content: start; gap: var(--s-3); } .st-map-row, .st-map-ruler { grid-template-columns: 5.5rem minmax(0, 1fr); gap: var(--s-2); } }

  .st-plan-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
  .st-plan-facts li { display: flex; gap: var(--s-2); align-items: center; margin: 0; }
  .st-empty-copy { margin: 0; max-width: 62ch; color: var(--st-dim); }
  .st-session .btn-secondary { --b-bg: transparent; --b-fg: #EDEDED; --b-bd: #474747; --b-hover: rgb(255 255 255 / 0.06); }

  /* Templates (new session) */
  .st-tpl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .st-tpl-list li, .st-tpl-list form { margin: 0; }
  .st-tpl-btn { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 2px var(--s-3); align-items: center; width: 100%; padding: var(--s-2) var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-bg); color: var(--c-text); font: inherit; text-align: left; cursor: pointer; transition: border-color var(--d-fast), transform var(--d-fast) var(--ease-out); }
  .st-tpl-btn:hover { border-color: var(--c-text); transform: translateY(-1px); }
  .st-tpl-btn:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 2px; }
  .st-tpl-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
  .st-tpl-glyph { grid-row: 1 / 3; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--st-night); color: #EDEDED; }
  .st-tpl-name { font-weight: 600; font-size: var(--t-small); }
  .st-tpl-desc { font-size: var(--t-caption); color: var(--c-muted); line-height: 1.35; }

  .st-newpage { display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
  .st-new-card { display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; background: var(--c-surface); scroll-margin-top: calc(var(--layout-header) + var(--s-4)); }
  .st-new-card:target { border-color: var(--c-text); box-shadow: 0 0 0 1px var(--c-text); }
  .st-new-card form { margin: 0; display: contents; }
  .st-new-art { padding: var(--s-4); background: var(--st-night); border-bottom: 1px solid #000; }
  .st-new-body { display: grid; gap: var(--s-2); align-content: start; padding: var(--s-4) var(--s-5); }
  .st-new-body h2 { margin: 0; font: 600 var(--t-h3)/1.2 var(--font-sans); }
  .st-new-body p { margin: 0; }
  .st-new-tracks { list-style: none; margin: var(--s-2) 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
  .st-new-tracks li { margin: 0; padding: 2px 8px; border: 1px solid var(--c-border); border-radius: var(--r-xs); font: 500 var(--t-caption)/1.4 var(--font-mono); color: var(--c-muted); }
  .st-new-foot { padding: 0 var(--s-5) var(--s-5); }

  /* Library page */
  .st-lib { display: grid; gap: var(--s-5); }
  .st-lib-note { display: flex; gap: var(--s-3); align-items: flex-start; margin: 0; padding: var(--s-3) var(--s-4); border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); font-size: var(--t-small); color: var(--c-muted); max-width: 84ch; }
  .st-lib-note .i { flex: none; margin-top: 2px; color: var(--c-text); }
  .st-files { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
  .st-file { margin: 0; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-3); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
  .st-file-glyph { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm); background: var(--st-night); color: #EDEDED; }
  .st-file-glyph svg { width: 32px; height: 20px; }
  .st-file-glyph rect { fill: #EDEDED; }
  .st-file-body { display: grid; gap: 2px; min-width: 0; }
  .st-file-body strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-small); }
  .st-file-body a { overflow-wrap: anywhere; }
  .st-file-side { display: grid; justify-items: end; gap: 2px; font-size: var(--t-caption); color: var(--c-muted); }
  @media (max-width: 640px) { .st-file { grid-template-columns: 44px minmax(0, 1fr); } .st-file-side { grid-column: 2; justify-items: start; } }

  /* ================= Landing ================= */
  .lp-st-hero { position: relative; overflow: hidden; padding: clamp(56px, 8vw, 112px) 0; background: radial-gradient(55% 60% at 75% 45%, rgb(255 255 255 / 0.08), transparent 70%), #050505; color: #F2F2F2; }
  .lp-st-rings { position: absolute; right: -10%; top: 50%; width: min(1100px, 120vw); transform: translateY(-50%); pointer-events: none; }
  .lp-st-rings circle { fill: none; stroke: #FFFFFF; stroke-opacity: .06; stroke-width: 1; transform-origin: 400px 400px; animation: lp-st-pulse 4s var(--ease-out) infinite; }
  .lp-st-rings .r1 { animation-delay: .4s; } .lp-st-rings .r2 { animation-delay: .8s; } .lp-st-rings .r3 { animation-delay: 1.2s; } .lp-st-rings .r4 { animation-delay: 1.6s; }
  @keyframes lp-st-pulse { 0%, 100% { stroke-opacity: .04; } 20% { stroke-opacity: .16; } }
  .lp-st-grid { position: relative; display: grid; gap: clamp(32px, 5vw, 64px); grid-template-columns: minmax(0, 1fr); align-items: center; }
  @media (min-width: 1100px) { .lp-st-grid { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.3fr); } }
  .lp-st-copy { display: grid; gap: var(--s-5); min-width: 0; }
  .lp-st-copy p, .lp-st-copy h1 { margin: 0; }
  .lp-st-id { display: flex; gap: var(--s-3); align-items: center; }
  .lp-st-name { font: 700 1.125rem/1 var(--font-display); } .lp-st-name span { font-weight: 500; }
  .lp-st-copy .h-display { font-size: clamp(2.6rem, 1.5rem + 4.2vw, 5.25rem); line-height: .96; letter-spacing: -0.045em; }
  .lp-st-copy .h-display span { color: #8C8C8C; }
  .lp-st-specs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 0; border: 1px solid #262626; border-radius: var(--r-md); overflow: hidden; background: #262626; }
  .lp-st-specs div { display: grid; gap: 4px; padding: 10px 14px; background: #0A0A0A; }
  .lp-st-specs dt { font: 600 0.625rem/1 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: #7A7A7A; }
  .lp-st-specs dd { margin: 0; font-weight: 600; font-size: var(--t-small); color: #F2F2F2; }
  .lp-st-preview { min-width: 0; }
  .lp-st-preview .preview { background: #0A0A0A; border-color: #262626; box-shadow: 0 40px 120px -30px rgb(255 255 255 / 0.12), var(--e-4); }
  .lp-st-ws { display: grid; background: #070707; color: #E6E6E6; }
  .lp-st-deck { display: flex; flex-wrap: wrap; gap: 8px var(--s-3); align-items: center; padding: 10px var(--s-3); border-bottom: 1px solid #1F1F1F; background: #0A0A0A; }
  .lp-st-btns { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-md); background: #000; box-shadow: inset 0 0 0 1px #262626; }
  .lp-st-btns i { display: inline-grid; place-items: center; width: 32px; height: 30px; border-radius: var(--r-sm); color: #D9D9D9; }
  .lp-st-btns .is-play { width: 40px; background: #F2F2F2; color: #0A0A0A; }
  .lp-st-lcd, .lp-st-tempo { display: inline-grid; grid-auto-flow: column; grid-template-rows: auto auto; column-gap: var(--s-3); padding: 4px var(--s-3); border-radius: var(--r-sm); background: #000; box-shadow: inset 0 0 0 1px #262626; }
  .lp-st-tempo { grid-template-rows: auto auto; }
  .lp-st-deck .k { font: 600 0.5rem/1 var(--font-mono); letter-spacing: .14em; color: #6E6E6E; }
  .lp-st-deck .v { font: 600 0.9375rem/1.2 var(--font-mono); color: #F5F5F5; } .lp-st-deck .v.t { color: #BDBDBD; }
  .lp-st-tempo .v + .v { grid-row: 2; }
  .lp-st-chip { padding: 6px 10px; border-radius: var(--r-sm); border: 1px solid #333; font: 600 var(--t-caption)/1 var(--font-sans); color: #BDBDBD; }
  .lp-st-chip.is-on { background: #F2F2F2; border-color: #F2F2F2; color: #0A0A0A; }
  .lp-st-arr { position: relative; padding: var(--s-3) var(--s-4); border-bottom: 1px solid #1F1F1F; overflow: hidden; }
  .lp-st-head { position: absolute; top: 8px; bottom: 8px; left: calc(8.5rem + var(--s-3) + var(--s-4)); width: 2px; background: #FFFFFF; box-shadow: 0 0 10px rgb(255 255 255 / .5); animation: lp-st-head 8s linear infinite; }
  @keyframes lp-st-head { from { transform: translateX(0); } to { transform: translateX(min(560px, 52vw)); } }
  .lp-st-lower { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s-4); padding: var(--s-3) var(--s-4) var(--s-4); }
  .lp-st-h { margin: 0 0 var(--s-2); font: 600 var(--t-overline)/1 var(--font-mono); letter-spacing: var(--tr-overline); text-transform: uppercase; color: #7A7A7A; }
  .lp-st-seq { position: relative; display: grid; gap: 3px; }
  .lp-st-row { display: grid; grid-template-columns: 3.25rem repeat(16, minmax(0, 1fr)); align-items: center; }
  .lp-st-lbl { font: 600 0.625rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: #8C8C8C; }
  .lp-st-pad { position: relative; display: block; padding: 0 1.5px; cursor: pointer; }
  .lp-st-pad input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
  .lp-st-pad i { display: block; height: 18px; border-radius: 2px; background: #161616; box-shadow: inset 0 0 0 1px #2E2E2E; transition: background-color var(--d-fast); }
  .lp-st-pad.is-beat i { background: #1E1E1E; }
  .lp-st-pad input:checked + .sr-only + i { background: #EDEDED; box-shadow: none; }
  .lp-st-pad input:focus-visible + .sr-only + i { outline: 2px solid #FFFFFF; outline-offset: 1px; }
  .lp-st-pad:hover i { box-shadow: inset 0 0 0 1px #8C8C8C; }
  .lp-st-sweep { position: absolute; top: -3px; bottom: -3px; left: 3.25rem; width: calc((100% - 3.25rem) / 16); border-radius: 3px; background: rgb(255 255 255 / 0.14); pointer-events: none; animation: lp-st-sweep 2.6s steps(16, end) infinite; }
  @keyframes lp-st-sweep { from { transform: translateX(0); } to { transform: translateX(1600%); } }
  .lp-st-mix { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
  .lp-st-mix li { display: grid; grid-template-columns: 6px minmax(0, 1fr); grid-template-rows: 92px auto auto; column-gap: 4px; row-gap: 4px; margin: 0; padding: 6px 4px; border-radius: var(--r-sm); background: #0F0F0F; box-shadow: inset 0 0 0 1px #1F1F1F; }
  .lp-st-mix li.is-master { background: #161616; }
  .lp-st-meter { position: relative; display: block; border-radius: 1px; background: #1A1A1A; overflow: hidden; }
  .lp-st-meter i { position: absolute; left: 0; right: 0; bottom: 0; background: repeating-linear-gradient(0deg, #E6E6E6 0 2px, transparent 2px 3px); animation: lp-st-meter 1.3s var(--ease-in-out) infinite alternate; transform-origin: bottom; }
  .lp-st-mix li:nth-child(2) .lp-st-meter i { animation-duration: 1.1s; } .lp-st-mix li:nth-child(3) .lp-st-meter i { animation-duration: 1.7s; } .lp-st-mix li:nth-child(4) .lp-st-meter i { animation-duration: .9s; }
  @keyframes lp-st-meter { from { transform: scaleY(.7); } to { transform: scaleY(1); } }
  .lp-st-meter .lv-0 { height: 0%; } .lp-st-meter .lv-10 { height: 10%; } .lp-st-meter .lv-20 { height: 20%; } .lp-st-meter .lv-30 { height: 30%; } .lp-st-meter .lv-40 { height: 40%; } .lp-st-meter .lv-50 { height: 50%; } .lp-st-meter .lv-60 { height: 60%; } .lp-st-meter .lv-70 { height: 70%; } .lp-st-meter .lv-80 { height: 80%; } .lp-st-meter .lv-90 { height: 90%; } .lp-st-meter .lv-100 { height: 100%; } 
  .lp-st-fader { position: relative; display: block; margin: 0 auto; width: 4px; border-radius: 2px; background: #262626; }
  .lp-st-fader i { position: absolute; left: 50%; width: 22px; height: 10px; margin-left: -11px; border-radius: 2px; background: #D9D9D9; box-shadow: 0 2px 0 #000, inset 0 -2px 0 #8C8C8C; }
  .lp-st-fader .at-0 { bottom: 8%; } .lp-st-fader .at-1 { bottom: 24%; } .lp-st-fader .at-2 { bottom: 40%; } .lp-st-fader .at-3 { bottom: 56%; } .lp-st-fader .at-4 { bottom: 72%; } .lp-st-fader .at-5 { bottom: 88%; } 
  .lp-st-db, .lp-st-ch { grid-column: 1 / -1; text-align: center; font-size: 0.625rem; }
  .lp-st-db { font-family: var(--font-mono); color: #8C8C8C; }
  .lp-st-ch { font-weight: 600; color: #D9D9D9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .lp-st-ws .st-map-row { grid-template-columns: 7rem minmax(0, 1fr); }
  .lp-st-ws .st-map-ruler { grid-template-columns: 7rem minmax(0, 1fr); }
  @media (max-width: 720px) {
    .lp-st-lower { grid-template-columns: minmax(0, 1fr); }
    .lp-st-ws .st-map-row, .lp-st-ws .st-map-ruler { grid-template-columns: 4.5rem minmax(0, 1fr); gap: var(--s-2); }
    .lp-st-head { display: none; }
    .lp-st-tempo, .lp-st-chip { display: none; }
  }

  .lp-st-flow { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
  .lp-st-flow li { position: relative; display: grid; gap: var(--s-2); align-content: start; margin: 0; padding: var(--s-5); border: 1px solid var(--c-border); border-radius: var(--r-lg); background: var(--c-surface); }
  .lp-st-flow .num { position: absolute; right: var(--s-4); top: var(--s-4); font: 600 var(--t-caption)/1 var(--font-mono); color: var(--c-muted); }
  .lp-st-flow h3, .lp-st-flow p { margin: 0; }
  .lp-st-flow li::after { content: ''; position: absolute; left: var(--s-5); right: var(--s-5); bottom: 0; height: 3px; background: repeating-linear-gradient(90deg, var(--c-text) 0 2px, transparent 2px 6px); opacity: .5; }
  .lp-st-tpls { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-5); grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
  .lp-st-tpls li { display: grid; gap: var(--s-2); align-content: start; margin: 0; }
  .lp-st-tpls p { margin: 0; }
  .lp-st-tpl-art { padding: var(--s-4); border-radius: var(--r-lg); background: var(--st-night); border: 1px solid #000; min-height: 150px; }
  .lp-st-tpl-name { display: flex; gap: var(--s-2); align-items: center; font-weight: 600; }
  .lp-st-tpl-glyph { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--c-text); color: var(--c-bg); }
  .lp-st-local { display: grid; gap: var(--s-6); grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
  .lp-st-local .section-lede { margin: 0; }
  .lp-st-ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
  .lp-st-ticks li { display: flex; gap: var(--s-3); align-items: flex-start; margin: 0; padding: var(--s-3) var(--s-4); border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
  .lp-st-ticks .i { flex: none; margin-top: 2px; }

  @media (prefers-reduced-motion: reduce) { .lp-st-rings circle, .lp-st-head, .lp-st-sweep, .lp-st-meter i { animation: none; } .lp-st-sweep { display: none; } }
}
