/* HTC 3 product shell — UI Product Design Pass 0.2 (on the UI Foundation 0.1 control language).
   Neutral graphite chrome; colour is information (part roles, section directions) or state (play, selection, focus).
   Structure comes from type, alignment, hairlines and negative space — surfaces only where something is an
   instrument (the intent console, the arrangement, the mixer, maps). No glow, no decorative gradients, no ornamental
   motion; every animated element reflects real state. Tokens: app/tokens.css.
   Order: base → primitives → controls → shell → Create → Studio → Library → Export → shared components → responsive. */
* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); color: var(--text); font: var(--t-m)/1.5 var(--sans); -webkit-font-smoothing: antialiased; background: var(--bg); }
a { color: var(--cyan); text-underline-offset: 2px; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: var(--radius-s); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
::selection { background: var(--cyan-wash-2); }
/* ================= primitives ================= */
h1 { font: 600 var(--t-3xl)/1.1 var(--display); margin: 0; letter-spacing: -.02em; }
h2 { font: 600 var(--t-xs)/1.3 var(--sans); margin: 0 0 var(--s-3); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
h3 { font: 600 var(--t-l)/1.25 var(--display); margin: 0; letter-spacing: -.01em; }
h4 { font: 600 var(--t-2xs)/1.3 var(--sans); margin: 0 0 var(--s-2); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.eyebrow { font: 600 var(--t-2xs)/1.3 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.lede { color: var(--muted); max-width: 66ch; margin: 6px 0 0; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: var(--t-s); } .mono { font-family: var(--mono); }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: var(--gap); }
.stack > * { min-width: 0; } /* wide content (mixer, maps) scrolls inside its surface, never widens the page */
/* surface: flat, one level above the app; only for instruments and grouped work */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--s-4); min-width: 0; }
/* buttons: primary (one per context) · default · ghost (quiet) · on (engaged state) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: var(--control); padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background var(--fast), border-color var(--fast), color var(--fast); }
.btn:hover { background: var(--panel-3); border-color: #3a444b; } .btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--cyan); color: var(--cyan-ink); border-color: var(--cyan); } .btn.primary:hover { background: #62ddd4; border-color: #62ddd4; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); } .btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.small { min-height: var(--control-s); padding: 0 10px; font-size: 12.5px; }
.btn.large { min-height: var(--control-l); padding: 0 22px; font-size: 15px; }
.btn.on { border-color: var(--cyan-dim); color: var(--cyan); background: var(--cyan-wash); }
.btn.warn { border-color: #6b4d24; color: var(--amber); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); display: grid; place-items: center; cursor: pointer; color: var(--text); transition: background var(--fast), border-color var(--fast); }
.icon-btn:hover { background: var(--panel-3); }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; } .icon-btn.on { background: var(--cyan); border-color: var(--cyan); color: var(--cyan-ink); }
.linkish { border: 0; background: none; color: var(--cyan); cursor: pointer; padding: 0; font: inherit; text-align: left; } .linkish:hover { text-decoration: underline; }
/* fields: label in small caps above a quiet inset control */
.field { min-width: 0; display: grid; gap: 6px; align-content: start; font: 600 var(--t-2xs)/1.3 var(--sans); color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
label.field select, label.field input { min-width: 0; width: 100%; }
select, input[type="number"], input[type="search"], input[type="text"] { font-family: var(--sans); background: var(--inset); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 10px; min-height: var(--control); color: var(--text); text-transform: none; letter-spacing: 0; font-weight: 450; font-size: 13.5px; transition: border-color var(--fast); }
select:hover, input:hover { border-color: #3a444b; }
select:focus, input:focus { outline: none; border-color: var(--cyan-dim); box-shadow: var(--ring); }
input::placeholder { color: var(--faint); }
.field-hint { font: 400 12px var(--sans); letter-spacing: 0; text-transform: none; color: var(--faint); align-self: center; }
/* readouts: musical facts as label + value (mono), the product's way of stating what something IS */
.readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: var(--s-3) var(--s-4); margin: 0; }
.ro { min-width: 0; }
.ro dt { font: 600 var(--t-2xs)/1.3 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ro dd { margin: 3px 0 0; font: 500 14.5px/1.3 var(--sans); font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ro dd small { font-size: 11.5px; font-weight: 400; color: var(--muted); }
/* chips: facts HTC read back (not buttons) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 4px 2px 10px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid transparent; font-size: 13px; color: var(--text); }
.chip b { font: 600 9.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.chip button { border: 0; background: transparent; color: var(--faint); cursor: pointer; width: 22px; height: 22px; border-radius: var(--radius-s); } .chip button:hover { color: var(--rose); background: rgba(240, 120, 146, .1); }
.chip.unread { border: 1px dashed var(--line-2); color: var(--muted); background: transparent; padding-right: 10px; } .chip.unread b { color: var(--amber); }
.chip.conflict { border-color: #5e4523; padding-right: 10px; } .chip.conflict b { color: var(--amber); }
.chip.src-control b { color: var(--violet); } .chip.src-control { padding-right: 10px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-s); padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--line-2); background: transparent; color: var(--text-2); cursor: pointer; font: 500 12.5px var(--sans); letter-spacing: 0; text-transform: none; transition: background var(--fast), color var(--fast), border-color var(--fast); }
.toggle:hover { color: var(--text); border-color: #3a444b; }
.toggle[aria-pressed="true"] { color: var(--text); background: color-mix(in srgb, var(--violet) 18%, transparent); border-color: color-mix(in srgb, var(--violet) 70%, transparent); }
.toggle:disabled { opacity: .4; cursor: not-allowed; }
.notice { font-size: var(--t-s); color: var(--text-2); border-left: 2px solid var(--amber); padding: 6px 12px; background: rgba(240, 176, 78, .05); border-radius: 0 var(--radius) var(--radius) 0; margin: 0; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty h1 { font-size: var(--t-xl); margin-bottom: 6px; color: var(--text); }
.busy { position: relative; } .busy::after { content: ''; position: absolute; inset: 0; background: rgba(12, 14, 16, .6); border-radius: inherit; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 0; font-size: 13px; }
.kv-i { min-width: 0; } .kv-i.wide { grid-column: 1 / -1; }
.kv dt { color: var(--muted); font-size: 11.5px; } .kv dd { margin: 2px 0 0; color: var(--text); overflow-wrap: anywhere; }
.fold > summary { cursor: pointer; font: 600 var(--t-xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); list-style: none; margin-bottom: 12px; } .fold > summary::after { content: " \25BE"; color: var(--faint); } .fold:not([open]) > summary { margin: 0; } .fold:not([open]) > summary::after { content: " \25B8"; }
#toast { position: fixed; left: 24px; bottom: 24px; transform: translateY(8px); background: var(--panel-3); border: 1px solid var(--line-2); padding: 9px 16px; border-radius: var(--radius); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity var(--med) var(--ease), transform var(--med) var(--ease); z-index: 50; max-width: calc(100vw - 32px); box-shadow: var(--elev-2); }
#toast.show { opacity: 1; transform: none; } #toast.error { border-color: var(--rose); color: var(--rose); }
/* ================= controls (app/components/controls.js, tabs.js) ================= */
/* segmented: few mutually exclusive choices */
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 2px; gap: 2px; border-radius: var(--radius); background: var(--inset); border: 1px solid var(--line); }
.seg > button, .seg > a { min-height: var(--control-s); padding: 0 12px; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--muted); font: 600 12.5px var(--sans); letter-spacing: 0; text-transform: none; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.seg > button:hover, .seg > a:hover { color: var(--text); }
.seg > [aria-selected="true"], .seg > [aria-pressed="true"], .seg > .on { background: var(--panel-3); color: var(--text); }
.seg > button:disabled { opacity: .4; cursor: not-allowed; }
.seg.small > button { min-height: 24px; padding: 0 9px; font-size: 12px; }
.field-seg { justify-items: start; }
/* knob: value arc + pointer; vertical drag, Shift fine, double-click reset */
.knob { --k: var(--cyan); display: inline-grid; justify-items: center; gap: 2px; width: 62px; padding: 4px 2px; border-radius: var(--radius); cursor: ns-resize; user-select: none; touch-action: none; outline: none; }
.knob:focus-visible { box-shadow: var(--ring); }
.knob-face { display: block; line-height: 0; }
.knob-svg { width: 42px; height: 42px; overflow: visible; }
.knob-track { fill: none; stroke: var(--line-2); stroke-width: 3; stroke-linecap: round; }
.knob-fill { fill: none; stroke: var(--k); stroke-width: 3; stroke-linecap: round; }
.knob-cap { fill: var(--panel-3); stroke: var(--line-2); stroke-width: 1; }
.knob-pointer { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.knob-auto { fill: var(--faint); }
.knob-centre { stroke: var(--faint); stroke-width: 1.4; } /* bipolar knobs (pan): arc grows from the centre mark */
.knob-label { font: 600 9.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.knob-value { font: 500 11.5px var(--mono); color: var(--text); min-height: 15px; letter-spacing: 0; text-transform: none; }
.knob.is-auto .knob-value { color: var(--faint); }
.knob:hover .knob-cap, .knob.dragging .knob-cap { stroke: var(--k); }
.knob-s { width: 50px; } .knob-s .knob-svg { width: 32px; height: 32px; } .knob-s .knob-label { font-size: 9px; } .knob-s .knob-value { font-size: 10.5px; }
.knob-row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
/* fader: vertical level control; fill + cap show the value */
.fader { --k: var(--cyan); --f: 0; --fader-h: 132px; display: grid; justify-items: center; gap: 6px; width: 100%; cursor: ns-resize; user-select: none; touch-action: none; outline: none; border-radius: var(--radius); padding: 4px 0; }
.fader:focus-visible { box-shadow: var(--ring); }
.fader-track { position: relative; width: 4px; height: var(--fader-h); border-radius: 2px; background: var(--inset); box-shadow: inset 0 0 0 1px var(--line-2); }
.fader-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--f) * 100%); border-radius: 2px; background: color-mix(in srgb, var(--k) 78%, transparent); }
.fader-cap { position: absolute; left: 50%; bottom: calc(var(--f) * 100%); width: 28px; height: 14px; transform: translate(-50%, 50%); border-radius: 3px; background: var(--panel-3); border: 1px solid #3d474e; box-shadow: 0 2px 5px rgba(0, 0, 0, .4); }
.fader-cap::after { content: ''; position: absolute; left: 5px; right: 5px; top: 50%; height: 1.5px; margin-top: -.75px; background: var(--k); }
.fader:hover .fader-cap, .fader.dragging .fader-cap { border-color: var(--k); }
.fader-value { font: 500 11px var(--mono); color: var(--text-2); }
/* tabs: underline indicator */
.tabs-panel { padding-top: 0; }
.tabbar { display: flex; gap: var(--s-5); border-bottom: 1px solid var(--line); margin: 0 calc(-1 * var(--s-4)) var(--s-4); padding: 0 var(--s-4); overflow-x: auto; scrollbar-width: none; }
.tabbar button { position: relative; border: 0; background: none; color: var(--muted); padding: 13px 0 12px; font: 600 var(--t-xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
.tabbar button:hover { color: var(--text); }
.tabbar button[aria-selected="true"] { color: var(--text); } .tabbar button[aria-selected="true"]::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--cyan); }
/* ================= shell ================= */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s-6); height: var(--appbar); padding: 0 var(--s-5); background: rgba(12, 14, 16, .94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); }
.brand-mark { width: 22px; height: 18px; fill: var(--text-2); } .brand-mark .hi { fill: var(--cyan); }
.brand-word { font: 700 15px var(--display); letter-spacing: .14em; } .brand-ver { font: 500 12px var(--mono); color: var(--muted); margin-left: -4px; }
.tabs { display: flex; gap: 4px; align-self: stretch; }
.tabs a { position: relative; display: flex; align-items: center; text-decoration: none; color: var(--muted); padding: 0 12px; font: 600 13.5px var(--sans); transition: color var(--fast); }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); } .tabs a[aria-current="page"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--cyan); }
/* current project identity (read-only; set by main.js from the open project) */
.app-project { display: flex; align-items: baseline; gap: 10px; min-width: 0; padding-left: var(--s-5); border-left: 1px solid var(--line); color: var(--text-2); text-decoration: none; font-size: 13px; }
.app-project b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 24ch; }
.app-project small { font: 11px var(--mono); color: var(--muted); white-space: nowrap; }
.app-project:hover b { color: var(--cyan); }
.deck { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.deck-play { width: 38px; height: 38px; }
.lcd { font-family: var(--mono); background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 12px; min-width: 176px; display: flex; flex-direction: column; line-height: 1.2; }
.lcd span { color: var(--text); font-size: 15px; font-weight: 500; letter-spacing: .06em; } .lcd small { color: var(--muted); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 230px; }
.meter { display: grid; grid-template-columns: 4px 4px auto; grid-template-rows: auto auto; gap: 2px 6px; align-items: end; height: 32px; }
.meter i { grid-row: 1 / span 2; width: 4px; height: 32px; border-radius: 1px; background: linear-gradient(to top, var(--teal) 0 70%, var(--amber) 70% 88%, var(--rose) 88%); clip-path: inset(calc(100% - var(--level, 0%)) 0 0 0); position: relative; }
.meter i::before { content: ''; position: absolute; inset: 0; background: var(--line); z-index: -1; }
.meter b, .meter em { font: 500 10px var(--mono); color: var(--muted); font-style: normal; white-space: nowrap; } .meter em.active { color: var(--amber); }
.bottombar { display: none; }
main { max-width: 1400px; margin: 0 auto; padding: var(--s-6) var(--s-6) 96px; outline: none; animation: view-in var(--med) var(--ease); }
@keyframes view-in { from { opacity: 0; } to { opacity: 1; } }
/* view header (application, not a landing page) */
.view-head { display: flex; align-items: end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); flex-wrap: wrap; }
/* ================= Create: 01 Idea · 02 Understood as | 03 Intent · 04 Generate console ; 05 Two musical worlds ================= */
.create { display: grid; grid-template-columns: minmax(0, 1fr) 392px; grid-template-areas: "idea console" "ideas ideas"; gap: var(--s-7) var(--s-7); align-items: start; }
.create-idea { grid-area: idea; display: grid; gap: var(--s-6); min-width: 0; padding-top: var(--s-2); }
.console { grid-area: console; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.console .step { padding: var(--s-5); }
.step { min-width: 0; }
.step-head { display: flex; align-items: baseline; gap: var(--s-4); margin-bottom: var(--s-3); }
.step-head h2 { margin: 0; }
.step-body { display: grid; gap: var(--s-3); min-width: 0; }
.prompt { width: 100%; min-height: calc(1.25em + 18px); field-sizing: content; resize: none; background: transparent; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; padding: 2px 0 16px; font: 400 var(--t-3xl)/1.25 var(--display); letter-spacing: -.015em; color: var(--text); transition: border-color var(--fast); }
.prompt::placeholder { color: var(--faint); }
.prompt:focus { outline: none; border-bottom-color: var(--cyan); }
.reading .chip.result { flex: 1 0 100%; background: transparent; padding: var(--s-3) 0 0; margin-top: var(--s-2); border-top: 1px solid var(--line); border-radius: 0; font: 500 var(--t-xl)/1.3 var(--display); letter-spacing: -.01em; align-items: baseline; gap: 12px; }
.reading .chip.result b { font-size: 10px; letter-spacing: .16em; color: var(--cyan); }
.cond-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-4); }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.field-wide { grid-column: 1 / -1; }
.more { border-top: 1px solid var(--line-soft); margin-top: var(--s-2); padding-top: var(--s-3); }
.more > summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: baseline; font: 600 13px var(--sans); color: var(--text-2); }
.more > summary::-webkit-details-marker { display: none; }
.more > summary > span:first-child::before { content: "\25B8"; display: inline-block; margin-right: 8px; color: var(--faint); transition: transform var(--fast); }
.more[open] > summary > span:first-child::before { transform: rotate(90deg); }
.more-count { font: 400 12px var(--sans); color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; } .more-count.set { color: var(--cyan); }
.more[open] > .controls { margin-top: var(--s-4); }
/* generate: the one primary action of the page, in the reading flow right after what HTC understood */
.action-bar { display: grid; grid-template-columns: auto minmax(200px, 300px) minmax(0, 1fr); gap: var(--s-4); align-items: end; padding-top: var(--s-4); border-top: 1px solid var(--line); }
.action-bar #generate { min-width: 200px; }
.action-bar .model-note { display: none; }
.action-bar .gen-meta { display: grid; gap: 2px; font-size: 12px; align-self: center; }
.create-model { display: grid; }
/* 05 two musical worlds */
.ideas { grid-area: ideas; display: grid; gap: var(--s-3); min-width: 0; }
.ideas > .step-head { margin-bottom: 0; }
.worlds-note { font-size: 12px; color: var(--muted); }
.differs-key::before, .ro.differs dt::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); margin-right: 6px; vertical-align: 1px; }
.differs-key { color: var(--text-2); }
.worlds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); min-width: 0; }
.world { display: grid; gap: var(--s-4); align-content: start; min-width: 0; padding: var(--s-5); transition: background var(--fast); }
.world + .world { border-left: 1px solid var(--line); }
.world:has(.preview.playing) { background: var(--panel-2); }
.world-head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: var(--s-4); align-items: center; }
.world-head .cover { border: 0; }
.world-actions { display: flex; align-items: center; gap: 4px; }
.world-id h3 { font-size: var(--t-2xl); line-height: 1.1; }
.world-genre { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.world .pv-plot { height: 128px; }
.world .readouts { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); padding-top: var(--s-1); }
.world .ro:not(.differs) dd { color: var(--text-2); }
.world-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-top: var(--s-3); border-top: 1px solid var(--line-soft); }
.why { flex: 1 0 100%; font-size: var(--t-s); color: var(--muted); } .why summary { cursor: pointer; color: var(--text-2); font-weight: 600; width: max-content; } .why ul { padding-left: 18px; margin: 8px 0 0; } .why li { margin: 3px 0; }
.worlds-empty { background: transparent; border: 1px dashed var(--line-2); }
.world-ghost { padding: var(--s-5); min-height: 168px; display: grid; align-content: start; gap: 6px; }
.world-ghost + .world-ghost { border-left: 1px dashed var(--line-2); }
.world-ghost p:last-child { margin: 0; color: var(--muted); max-width: 42ch; font-size: 13.5px; }
/* ================= Studio: identity · arrangement + lower work area | inspector rail ================= */
.studio-head { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: var(--s-5); align-items: center; margin-bottom: var(--s-5); padding-bottom: var(--s-5); border-bottom: 1px solid var(--line); }
.studio-head .cover { border: 0; }
.studio-id { min-width: 0; }
.studio-id h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-model { gap: 10px; margin-top: 8px; font-size: 12.5px; }
.studio-facts { grid-template-columns: none; grid-auto-flow: column; gap: var(--s-6); }
.studio-facts .ro dd { font-size: var(--t-l); }
.head-actions { justify-content: end; gap: 2px; }
.lineage { margin: 0; color: var(--muted); }
.versioning { align-items: end; margin-top: var(--s-4); gap: var(--s-2); }
.versioning .model-field { min-width: 240px; }
.studio-main { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail); align-items: start; }
.studio-work { display: grid; gap: var(--s-5); min-width: 0; padding-right: var(--s-5); }
.studio-lower { min-width: 0; }
.studio-lower .tabs-panel { background: none; border: 0; border-radius: 0; padding: 0; }
.studio-lower .tabbar { margin: 0 0 var(--s-4); padding: 0; }
.inspector { position: sticky; top: calc(var(--appbar) + 16px); max-height: calc(100vh - var(--appbar) - 32px); overflow: auto; border-left: 1px solid var(--line); padding: 2px 0 var(--s-4) var(--s-5); min-width: 0; scrollbar-width: thin; }
/* timeline: waveform and map share one time axis (label column + proportional section columns, no column gaps) */
.timeline { --srm-label: 156px; display: grid; gap: var(--s-3); min-width: 0; padding-bottom: var(--s-5); border-bottom: 1px solid var(--line); }
.tl-toolbar { gap: var(--s-2) var(--s-3); }
.tl-toolbar .tl-label { font: 600 var(--t-2xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.tl-note { flex: 1 1 260px; color: var(--muted); }
.warn-text { color: var(--amber) !important; } .audition-note { color: var(--violet); }
.tl-wave { margin-left: var(--srm-label); min-width: 0; }
.tl-wave .wp-wave { height: 72px; }
.timeline.no-render .tl-wave .wp-wave { height: 20px; }
.render-box:empty { display: none; }
/* section × role grid: a form lane on top, one lane per part */
.srm { position: relative; display: grid; row-gap: 2px; column-gap: 0; min-width: 0; }
.srm-corner { align-self: end; display: grid; padding: 0 12px 6px 2px; }
.srm-corner b { font: 600 var(--t-2xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.srm-corner small { font: 11px var(--mono); color: var(--faint); }
.srm-sec { container-type: inline-size; min-width: 0; min-height: 44px; overflow: hidden; border: 0; border-right: 2px solid var(--bg); border-radius: var(--radius-s) var(--radius-s) 0 0; background: color-mix(in srgb, var(--c) 72%, var(--panel)); color: #f4f7f8; text-align: left; padding: 6px 8px; cursor: pointer; transition: background var(--fast); }
.srm-sec:hover, .srm-sec.col { background: var(--c); }
.srm-sec b { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srm-sec small { display: block; font: 500 10px var(--mono); opacity: .78; white-space: nowrap; overflow: hidden; }
@container (max-width: 64px) { .srm-sec > b { font-size: 10.5px; text-overflow: clip; } .srm-sec > small { display: none; } }
.srm-sec.sel { box-shadow: inset 0 0 0 2px var(--text); } .srm-sec.looping { box-shadow: inset 0 -4px 0 var(--amber); } .srm-sec.sel.looping { box-shadow: inset 0 0 0 2px var(--text), inset 0 -5px 0 var(--amber); }
.srm-role { display: grid; align-content: center; gap: 1px; min-width: 0; min-height: 46px; text-align: left; padding: 3px 10px 3px 12px; margin-right: 8px; border: 0; border-left: 3px solid var(--c); border-radius: 0 var(--radius-s) var(--radius-s) 0; background: transparent; color: var(--text); cursor: pointer; transition: background var(--fast); }
.srm-role:hover, .srm-role.row-on { background: var(--panel-2); }
.srm-role b { font-size: 13px; font-weight: 600; }
.srm-role small { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srm-role.sel { background: var(--panel-3); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent); }
.srm-role.sounding b { color: var(--c); }
.srm-cell { min-width: 0; min-height: 46px; border: 0; border-right: 2px solid var(--bg); padding: 0; cursor: pointer; background: color-mix(in srgb, var(--c) calc(8% + var(--i) * 58%), var(--panel-2)); transition: filter var(--fast); }
.srm-cell:hover { filter: brightness(1.18); }
.srm-cell.empty { background: var(--bg-2); }
.srm-cell.muted { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, var(--panel)) 0 3px, var(--bg-2) 3px 7px); }
.srm-cell.pruned { box-shadow: inset 0 -3px 0 var(--violet); }
.srm-cell.col, .srm-cell.row-on { filter: brightness(1.12); }
.srm-cell.sel { box-shadow: inset 0 0 0 2px var(--text); filter: none; }
.srm-cell:focus-visible, .srm-sec:focus-visible, .srm-role:focus-visible { outline: 2px solid var(--cyan); outline-offset: -2px; }
.srm-playhead { position: absolute; top: 0; bottom: 0; width: 2px; left: calc(var(--srm-label) + (100% - var(--srm-label)) * var(--f, 0)); background: var(--text); pointer-events: none; }
/* context inspector (rail) */
.insp { display: grid; gap: var(--s-5); }
.insp-head .eyebrow { color: var(--c, var(--muted)); }
.insp-head h3 { font-size: var(--t-xl); line-height: 1.2; }
.insp-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.insp.empty { padding: var(--s-5) 0; }
.insp-actions { display: grid; gap: var(--s-2); }
.insp-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.insp-tag { flex: 0 0 52px; font: 600 var(--t-2xs) var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.insp-off { margin: 4px 0 0; padding-left: 16px; font-size: 12px; color: var(--muted); display: grid; gap: 3px; }
.insp-off b { color: var(--text-2); font-weight: 600; }
.insp-group { border-top: 1px solid var(--line-soft); padding-top: var(--s-4); display: grid; gap: var(--s-2); }
.insp-group h4 { margin: 0; }
.insp-harmony { margin: 0; }
.seq { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.seq span { font: 400 13px var(--sans); color: var(--text); }
.seq i { font-style: normal; color: var(--faint); font-size: 11px; }
.insp-deep { border-top: 1px solid var(--line-soft); padding-top: var(--s-3); }
.insp-deep > summary { cursor: pointer; font: 600 var(--t-2xs) var(--sans); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.insp-deep h4 { margin: var(--s-4) 0 6px; }
.insp-deep ul, .insp-deep ol { margin: 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 3px; }
.insp-chain li.bypassed { opacity: .6; }
.insp-samples { margin: 0; padding-left: 16px; }
.insp-roles { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-btn { border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); color: var(--text); background: color-mix(in srgb, var(--c) 10%, transparent); border-radius: var(--radius); padding: 0 10px; cursor: pointer; font-size: 12.5px; min-height: 28px; }
.chip-btn:hover { background: color-mix(in srgb, var(--c) 20%, transparent); }
/* mixer console: one strip per part — name (selects the part), pan, sends, fader, saved mute */
.mixer { display: flex; overflow-x: auto; max-width: 100%; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); scrollbar-width: thin; }
.strip-ch { --c: var(--role-other); flex: 1 0 100px; max-width: 180px; display: grid; justify-items: center; align-content: start; gap: 8px; padding: 12px 4px 14px; border-right: 1px solid var(--line-soft); box-shadow: inset 0 2px 0 var(--c); transition: background var(--fast); }
.strip-ch.sel { background: var(--panel-2); box-shadow: inset 0 3px 0 var(--c); }
.strip-ch .fader { --fader-h: 144px; }
.strip-ch .knob-value { font-size: 11px; } .strip-ch .knob-label { font-size: 9.5px; }
.strip-ch.is-muted .knob, .strip-ch.is-muted .fader { opacity: .5; }
.strip-name { max-width: 92px; min-height: 26px; padding: 0 8px; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--text); font: 600 12.5px var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.strip-name:hover { background: var(--panel-3); } .strip-name[aria-pressed="true"] { color: var(--c); }
.strip-mute { min-width: 32px; min-height: 24px; padding: 0 6px; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--inset); color: var(--muted); font: 700 11px var(--mono); cursor: pointer; }
.strip-mute[aria-pressed="true"] { background: var(--amber); color: #2a1a00; border-color: var(--amber); }
.mixer-note { margin: var(--s-3) 0 0; }
/* phone focus view (one section, parts as a list) + inspector bottom sheet */
.sf { display: grid; gap: var(--s-2); min-width: 0; }
.sf-chips { display: flex; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-bottom: 2px; }
.sf-chips::-webkit-scrollbar { display: none; }
.sf-chip { flex: 0 0 auto; min-height: var(--touch); padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2); background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; box-shadow: inset 0 -3px 0 var(--c); }
.sf-chip.on { color: var(--text); background: var(--panel-2); border-color: var(--c); font-weight: 600; }
.sf-head { display: grid; grid-template-columns: var(--touch) 1fr var(--touch); gap: 6px; align-items: stretch; }
.sf-head .btn { min-height: var(--touch); justify-content: center; font-size: 18px; padding: 0; }
.sf-title { display: grid; text-align: left; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); padding: 6px 12px; cursor: pointer; }
.sf-title small { color: var(--muted); font-size: 11.5px; }
.sf-parts { display: grid; gap: 2px; }
.sf-part { display: grid; grid-template-columns: minmax(0, 1fr) 72px 64px; gap: 12px; align-items: center; min-height: 52px; padding: 6px 12px; border: 0; border-left: 3px solid var(--c); border-radius: 0 var(--radius) var(--radius) 0; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.sf-name { display: grid; min-width: 0; }
.sf-name small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sf-bar { height: 4px; border-radius: 2px; background: var(--inset); overflow: hidden; }
.sf-bar i { display: block; height: 100%; width: calc(var(--i) * 100%); background: var(--c); }
.sf-part.empty { opacity: .5; }
.sf-part.muted .sf-bar i { background: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); }
.sf-part.sel { background: var(--panel-3); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 60%, transparent); }
.sf-part.sounding b { color: var(--c); }
.sf-count { text-align: right; color: var(--text-2); white-space: nowrap; } .sf-count small { font-size: 10px; color: var(--faint); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; max-height: 72vh; overflow: auto; background: var(--panel); border-top: 1px solid var(--line-2); border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 10px 16px calc(84px + env(safe-area-inset-bottom)); box-shadow: var(--elev-2); animation: sheet-in var(--med) var(--ease); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-bar { display: flex; justify-content: space-between; align-items: center; position: sticky; top: -10px; background: var(--panel); padding: 4px 0 8px; z-index: 1; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); }
.timeline.phone { --srm-label: 0px; }
.timeline.phone .tl-wave { margin-left: 0; }
.timeline.phone .wp-jump { display: none; } /* phone: tap/drag the timeline to seek; keys still step ±5/10 s */
/* phone lower area: quiet disclosure rows instead of boxed panels */
.studio-folds { display: grid; margin-top: var(--s-4); border-top: 1px solid var(--line); }
.studio-folds > .panel { background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: var(--s-4) 0; }
.studio-folds .fold > summary { min-height: 24px; display: flex; align-items: center; }
/* ================= Library: a browsing list — identity · audition · facts · actions per generation ================= */
.lib-tabs { display: flex; }
.filters { display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: end; padding-bottom: var(--s-4); margin-bottom: 0; border-bottom: 1px solid var(--line); }
.filters .toggle { min-height: var(--control); }
.filter-q { flex: 1 1 260px; }
.lib-count { margin-left: auto; align-self: end; padding-bottom: 8px; font: 12px var(--mono); color: var(--muted); }
.gens-head { padding: var(--s-3) 0 var(--s-2); border-bottom: 1px solid var(--line-soft); }
.gens { display: grid; }
.gen { --depth: 0; display: grid; grid-template-columns: calc(280px - var(--depth) * 28px) minmax(0, 1fr) 260px auto; grid-template-areas: "id preview facts actions" "id meta meta actions" "more more more more" "ver ver ver ver"; gap: 4px var(--s-5); align-items: center; padding: var(--s-3) var(--s-3) var(--s-3) calc(var(--s-3) + var(--depth) * 28px); border-bottom: 1px solid var(--line-soft); transition: background var(--fast); min-width: 0; }
.gen:hover, .gen:has(.preview.playing) { background: var(--panel); }
.gen.derived .gen-id { border-left: 2px solid var(--line-2); padding-left: var(--s-3); }
.gen-id { grid-area: id; display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: var(--s-3); align-items: center; min-width: 0; align-self: center; }
.gen-cover { padding: 0; cursor: pointer; border: 0; }
.gcard-id { min-width: 0; }
.gcard-id h3 { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard-genre { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }
.gen-prompt { margin: 2px 0 0; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen .preview { grid-area: preview; display: grid; grid-template-columns: 36px auto minmax(0, 1fr); grid-template-areas: "play plot plot" "play time where"; gap: 2px var(--s-3); align-items: center; min-width: 0; }
.gen .pv-bar { display: contents; }
.gen .pv-play { grid-area: play; }
.gen .pv-plot { grid-area: plot; height: 40px; }
.gen .pv-time { grid-area: time; font-size: 11px; } .gen .pv-where { grid-area: where; font-size: 11px; }
.gen-facts { grid-area: facts; grid-template-columns: 40px minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s-4); }
.gcard-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--muted); min-width: 0; }
.gen-rev { font: 11px var(--mono); color: var(--faint); }
.gcard-actions { grid-area: actions; display: flex; align-items: center; justify-content: end; gap: 4px; }
/* one strong action on screen at a time: Open lights up on the row being looked at, listened to or navigated */
.gen .btn.primary { background: var(--panel-2); border-color: var(--line-2); color: var(--text); }
.gen:hover .btn.primary, .gen:focus-within .btn.primary, .gen:has(.preview.playing) .btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--cyan-ink); }
.gcard-more { grid-area: more; }
.gcard-more > summary { cursor: pointer; font-size: 12px; color: var(--faint); list-style: none; width: max-content; }
.gcard-more > summary::-webkit-details-marker { display: none; }
.gcard-more > summary::before { content: "\25B8  "; } .gcard-more[open] > summary::before { content: "\25BE  "; }
.gcard-more > summary:hover { color: var(--text-2); }
.gcard-more-body { display: flex; flex-wrap: wrap; gap: var(--s-3) var(--s-5); align-items: end; padding: var(--s-3) 0 var(--s-1); }
.gcard-more-body p { margin: 0; flex-basis: 100%; }
.gcard-more .try { gap: 4px; flex-wrap: nowrap; } .gcard-more .try select { min-height: var(--control-s); font-size: 12.5px; }
.gen-tags { min-width: 220px; } .gen-tags input { min-height: var(--control-s); font-size: 12.5px; }
.gen-versions { grid-area: ver; min-width: 0; }
.gen-versions .history { max-height: 220px; margin-top: 4px; }
.star { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; border: 0; background: transparent; color: var(--faint); font-size: 15px; cursor: pointer; transition: color var(--fast), background var(--fast); }
.star:hover { color: var(--text-2); background: var(--panel-2); } .star.on { color: var(--amber); }
.lib-foot { margin: var(--s-4) 0 0; }
/* sounds */
.snapshot-meta { display: grid; gap: var(--s-2); margin-bottom: var(--s-4); }
.sounds { display: grid; }
.sound { display: grid; grid-template-columns: 34px minmax(0, 1.4fr) 130px 190px 150px minmax(80px, 1fr); gap: 12px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.sound:hover { background: var(--panel); }
.sound .tag { font: 11px var(--mono); color: var(--muted); } .sound.used { box-shadow: inset 2px 0 0 var(--cyan-dim); }
.play-sm { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; color: var(--text); display: grid; place-items: center; padding: 0; }
.play-sm svg { width: 11px; height: 11px; fill: currentColor; } .play-sm:hover { background: var(--panel-3); }
.preview-dock { margin: var(--s-3) 0; display: grid; gap: 6px; } .sound.previewing { background: var(--cyan-wash); }
/* ================= Export ================= */
.report { font: 12.5px/1.55 var(--mono); white-space: pre-wrap; background: var(--inset); color: var(--text-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-height: 64px; }
.export-preview:empty { display: none; } .export-preview { display: grid; gap: 6px; }
.export-layout { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: var(--s-6); align-items: start; }
.export-options { display: grid; gap: var(--s-4); padding: var(--s-5); }
.export-controls { display: grid; gap: var(--s-4); }
.export-options > .btn.primary { min-height: var(--control-l); font-size: 14.5px; }
.export-more { gap: 4px; }
.export-output > h2 { margin: 0; }
/* ================= shared components ================= */
.cover { width: 100%; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel-3); border: 1px solid var(--line); } .cover svg { display: block; width: 100%; height: 100%; }
.history { list-style: none; margin: 0; padding: 0; display: grid; max-height: 360px; overflow: auto; }
.history li { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center; padding: 5px 8px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.history li.current { background: var(--cyan-wash); } .history .rev { font: 600 11px var(--mono); color: var(--muted); } .history li.current .rev { color: var(--cyan); }
.ab { display: grid; gap: 8px; margin-top: 10px; } .ab .btn.on { background: var(--violet); color: #120a2a; border-color: var(--violet); }
/* WaveformPlayer (app/components/waveform-player.js) */
.wplayer { flex: 1 1 100%; display: grid; gap: 6px; min-width: 0; }
.wp-controls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.wp-play { font-size: 12px; } .wp-play.on { color: var(--cyan-ink); }
.wp-jump { min-width: 36px; padding: 0 6px; }
.wp-time { color: var(--text-2); margin-left: 6px; font-size: 12.5px; } .wp-section { color: var(--muted); font-size: 12.5px; }
.wp-wave { width: 100%; height: 64px; display: block; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; touch-action: none; }
.wp-wave:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.wplayer.compact .wp-wave { height: 44px; }
.wp-sections { display: flex; gap: 2px; min-width: 0; }
.wp-sections button { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px var(--sans); color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 5px 4px; cursor: pointer; }
.wp-sections button.on { color: var(--text); background: var(--panel-3); border-color: var(--line-2); }
/* LongOperation (app/components/long-operation.js) */
.longop { display: grid; gap: 6px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: var(--radius); }
.longop[data-state="error"] { border-color: var(--rose); } .longop[data-state="success"] { border-color: var(--cyan-dim); } .longop[data-state="cancelled"] { border-color: var(--amber); }
.lo-head { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; } .lo-phase { color: var(--text); } .lo-meta { color: var(--muted); margin-left: auto; }
.lo-bar { height: 3px; background: var(--inset); border-radius: 2px; overflow: hidden; position: relative; }
.lo-bar i { display: block; height: 100%; background: var(--cyan); width: 0; transition: width .2s linear; }
.lo-bar.indeterminate i { width: 30%; position: absolute; animation: lo-slide 1.4s ease-in-out infinite; background: var(--cyan-dim); }
@keyframes lo-slide { from { left: -30%; } to { left: 100%; } }
.lo-note:empty, .lo-outputs:empty { display: none; } .lo-outputs { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
/* Music Model picker / badge */
.model-badge { display: inline-flex; align-items: baseline; gap: 2px; padding: 1px 7px; border-radius: var(--radius-s); background: var(--panel-2); font: 500 11px var(--sans); color: var(--muted); white-space: nowrap; }
.model-badge b { color: var(--text-2); font-weight: 600; }
.model-badge[data-status="candidate"] { color: color-mix(in srgb, var(--status-candidate) 85%, var(--muted)); }
.model-badge[data-status="historical"] { color: var(--status-historical); }
.model-field select { font-weight: 600; }
.model-note { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; line-height: 1.35; }
/* Sonic Map (semantic timeline from the score; not audio) + preview player */
.sonic-map { margin: 0; display: grid; gap: var(--s-2); min-width: 0; }
.sm-plot { height: 64px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sm-plot svg { display: block; width: 100%; height: 100%; }
.sm-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 11px; color: var(--muted); }
.sm-legend b { color: var(--text-2); font-weight: 600; } .sm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sm-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }
.sm-key.perc { background: var(--role-drums); } .sm-key.held { background: var(--role-chords); opacity: .7; } .sm-key.lead { background: var(--role-lead); } .sm-key.bass { background: var(--role-bass); } .sm-key.form { background: var(--dir-develop); width: 14px; height: 5px; }
.preview { margin: 0; }
.pv-bar { display: flex; align-items: center; gap: 12px; min-height: var(--control); }
.pv-play { width: 36px; height: 36px; flex: 0 0 auto; padding: 0; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); cursor: pointer; display: grid; place-items: center; transition: background var(--fast), border-color var(--fast); }
.pv-play svg { width: 14px; height: 14px; fill: currentColor; }
.pv-play:hover { background: var(--panel-3); border-color: #3d474e; } .preview.playing .pv-play { background: var(--cyan); color: var(--cyan-ink); border-color: var(--cyan); }
.pv-time { color: var(--text-2); font-size: 12.5px; } .preview:not(.loaded) .pv-time { color: var(--muted); }
.pv-where { color: var(--text-2); font-size: 12.5px; }
.pv-plot { position: relative; height: 72px; cursor: pointer; touch-action: none; }
.pv-plot:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.pv-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; }
.pv-head.scrub { background: var(--amber); }
/* ================= responsive: desktop = overview + control; phone = context + progressive focus ================= */
@media (max-width: 1240px) {
  .create { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--s-6); }
  .gen { grid-template-columns: calc(250px - var(--depth) * 28px) minmax(0, 1fr) auto; grid-template-areas: "id preview actions" "id facts actions" "id meta meta" "more more more" "ver ver ver"; }
  .gen-facts { justify-self: start; }
}
@media (max-width: 1100px) {
  .app-project { display: none; }
  .create { grid-template-columns: minmax(0, 1fr); grid-template-areas: "idea" "console" "ideas"; }
  .cond-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .controls { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  :root { --rail: 300px; }
  .studio-head { grid-template-columns: 56px minmax(0, 1fr) auto; } .studio-facts { grid-column: 2 / -1; grid-row: 2; justify-content: start; }
}
@media (max-width: 900px) {
  .worlds, .worlds-empty { grid-template-columns: 1fr; } .world + .world, .world-ghost + .world-ghost { border-left: 0; border-top: 1px solid var(--line); }
  .cond-row, .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-layout { grid-template-columns: minmax(0, 1fr); }
  .action-bar { grid-template-columns: auto minmax(0, 1fr); } .action-bar .gen-meta { grid-column: 1 / -1; }
  .sound { grid-template-columns: 34px 1fr 80px; } .sound .hide-m { display: none; }
  .studio-main { grid-template-columns: 1fr; } .studio-work { padding-right: 0; }
  .inspector { position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); padding: var(--s-5) 0 0; margin-top: var(--s-5); }
  .timeline { --srm-label: 110px; }
  .srm-role small { display: none; }
  .gen { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id actions" "preview preview" "facts facts" "meta meta" "more more" "ver ver"; }
}
@media (max-width: 640px) {
  :root { --appbar: 52px; }
  .topbar { padding: 0 12px; gap: 12px; } .tabs { display: none; } .lcd { min-width: 0; flex: 1 1 auto; } .deck { flex: 1 1 auto; justify-content: end; } .lcd small { max-width: 150px; } .meter b, .meter em { display: none; } .meter { grid-template-columns: 4px 4px; }
  main { padding: 16px 16px 96px; }
  h1 { font-size: var(--t-2xl); }
  .view-head .lede { display: none; }
  .bottombar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); background: rgba(12, 14, 16, .97); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .bottombar a { display: grid; justify-items: center; gap: 2px; padding: 6px 4px; font: 600 11px var(--sans); color: var(--muted); text-decoration: none; }
  .bottombar a svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottombar a[aria-current="page"] { color: var(--text); } .bottombar a[aria-current="page"] svg { stroke: var(--cyan); }
  #toast { left: 16px; right: 16px; bottom: 76px; }
  .create { gap: var(--s-5); } .create-idea { gap: var(--s-5); padding-top: 0; }
  .prompt { font-size: var(--t-xl); }
  .console .step { padding: var(--s-4); }
  .reading .chip.result { font-size: var(--t-l); }
  .cond-row, .controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
  .more-count { display: none; }
  .action-bar { grid-template-columns: minmax(0, 1fr); } .action-bar #generate { width: 100%; }
  .world { padding: var(--s-4); } .world-head { grid-template-columns: 48px minmax(0, 1fr); } .world-head .world-actions { grid-column: 1 / -1; } .world-actions .btn { flex: 1; }
  .world-id h3 { font-size: var(--t-xl); } .world .pv-plot { height: 96px; }
  .studio-head { grid-template-columns: 48px minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-4); margin-bottom: var(--s-4); }
  .studio-id h1 { font-size: var(--t-xl); white-space: normal; }
  .studio-facts { grid-column: 1 / -1; grid-row: auto; display: flex; flex-wrap: wrap; gap: 2px var(--s-4); } .studio-facts .ro dt { display: none; } .studio-facts .ro dd { font-size: 14px; margin: 0; }
  .gen .btn.primary { background: var(--cyan); border-color: var(--cyan); color: var(--cyan-ink); }
  .head-actions { grid-column: 1 / -1; justify-content: start; }
  .btn, .tl-toolbar .seg > button, .strip-mute, .strip-name { min-height: var(--touch); }
  .btn.small { min-height: var(--touch); }
  .toggle, .filters .toggle, .chip-btn { min-height: var(--touch); }
  .sheet .linkish, .gen .linkish { display: inline-flex; align-items: center; min-height: var(--touch); }
  .versioning .model-field { min-width: 0; flex: 1 1 100%; }
  .wplayer .wp-sections button, .wplayer .btn.wp-jump { min-height: 36px; } .wp-wave { height: 72px; }
  .filters { gap: var(--s-2); } .filters > label.field { flex: 1 1 45%; } .filter-q { flex-basis: 100% !important; }
  .gen { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "preview" "facts" "meta" "actions" "more" "ver"; padding: var(--s-4) 0 var(--s-4) calc(var(--depth) * 16px); }
  .gcard-actions { justify-content: start; flex-wrap: wrap; }
  .star { width: var(--touch); height: var(--touch); }
  .gen-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---- Create sets and Intent 0.3.0 reading (Next Evolution, C-80) */
.reading-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 0 100%; }
.reading-label { font: 600 var(--t-2xs)/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); min-width: 92px; }
.reading-group.assumed .reading-label { color: var(--violet); } .reading-group.unresolved .reading-label { color: var(--amber); }
.chip.assumed { background: transparent; border: 1px solid color-mix(in srgb, var(--violet) 35%, transparent); color: var(--text-2); padding-right: 10px; } .chip.assumed b { color: var(--violet); }
.worlds-set .world:nth-child(odd) { border-left: 0; } .worlds-set > :nth-child(n+3) { border-top: 1px solid var(--line); }
.worlds-set .world-ghost:nth-child(odd) { border-left: 0; }
.extreme-head { margin-top: var(--s-5); } .extreme-head h2 { color: var(--rose); }
.worlds-extreme { border-color: color-mix(in srgb, var(--rose) 30%, var(--line)); }
.world.extreme .eyebrow { color: var(--rose); }
.world-summary { margin: 0; color: var(--text-2); font-size: 13.5px; max-width: 60ch; }
.axes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; margin: 0; font-size: 12px; }
.axes div { min-width: 0; } .axes dt { font: 600 9.5px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); } .axes dd { margin: 1px 0 0; color: var(--text-2); overflow-wrap: anywhere; }
.parts-line { margin: 0; }
.set-head { padding: var(--s-3) var(--s-2) var(--s-2); margin-top: var(--s-3); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.set-head b { color: var(--cyan); font-weight: 600; letter-spacing: .04em; }
.set-head .set-archive { margin-left: var(--s-2); vertical-align: middle; }
.set-badge { border: 1px solid var(--cyan-dim); color: var(--cyan); border-radius: 99px; padding: 0 8px; font-size: 11.5px; }
.set-badge.extreme { border-color: color-mix(in srgb, var(--rose) 60%, transparent); color: var(--rose); }
@media (max-width: 640px) { .worlds-set .world { border-left: 0; border-top: 1px solid var(--line); } .reading-label { min-width: 0; flex: 1 0 100%; } }
/* ---- Sound rack (Next Evolution, C-78/C-79): instances, layers, sound browser, device parameters, automation */
.rack { display: grid; gap: var(--s-3); min-width: 0; }
.rack-head { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: end; justify-content: space-between; }
.rack-name { font: 600 18px var(--sans); color: var(--text); background: transparent; border: 1px solid transparent; border-radius: var(--radius-s); padding: 2px 6px; margin-left: -6px; min-width: 0; max-width: 100%; }
.rack-name:hover, .rack-name:focus { border-color: var(--line-2); background: var(--inset); outline: none; }
.rack-family, .rack-actions, .rack-multi, .rack-part, .rack-ramp, .rack-voices { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rack-family .chip-btn { --c: var(--cyan); } .rack-family .chip-btn.on, .rack-multi .chip-btn.on { background: color-mix(in srgb, var(--c) 28%, transparent); border-color: var(--c); }
.rack-multi .chip-btn { --c: var(--violet); }
.rack-label { font: 600 var(--t-2xs)/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-right: 2px; }
.rack-sound { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.rack-browser { border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--inset); padding: 10px; display: grid; gap: 8px; }
.rack-browser[data-mode="layer"] { border-color: color-mix(in srgb, var(--violet) 50%, var(--line-2)); }
.rack-search { flex: 1 1 220px; min-height: var(--control-s); background: var(--panel); border: 1px solid var(--line-2); color: var(--text); border-radius: var(--radius-s); padding: 0 10px; }
.rack-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 340px; overflow-y: auto; }
.rack-list li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: var(--radius-s); background: var(--panel); border: 1px solid var(--line-soft); }
.rack-list li.current { border-color: var(--cyan-dim); } .rack-list li.fit-other { opacity: .82; }
.rack-item { min-width: 0; } .rack-item .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.rack-item .tag { font-size: 10.5px; padding: 1px 6px; border-radius: 99px; background: var(--panel-3); color: var(--text-2); }
.rack-item-actions { display: flex; gap: 4px; flex: none; }
.rack-device { display: grid; gap: 6px; }
.rack-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.rack-section > summary { cursor: pointer; padding: 6px 10px; font: 600 12.5px var(--sans); color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.rack-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--violet); display: inline-block; }
.rack-knobs { display: flex; flex-wrap: wrap; gap: 6px 4px; padding: 4px 8px 10px; align-items: flex-start; }
.rack-knobs .knob-s { width: 66px; } .rack-knobs .knob-s .knob-label { white-space: normal; text-align: center; line-height: 1.15; min-height: 2.3em; overflow-wrap: anywhere; }
.rack-choice { display: grid; gap: 4px; align-content: start; padding: 2px 4px; }
.rack-choice.edited .rack-label, .knob.edited .knob-label { color: var(--violet); }
.rack-inserts, .rack-auto { display: grid; gap: 6px; } .rack-inserts h4, .rack-auto h4 { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); }
/* Kit pieces / sample slots: one row per piece — identity, ▶, its knobs, Swap… (browser opens under the row). */
.rack-kit { display: grid; gap: 2px; } .rack-kit h4 { margin: 6px 0 2px; font-size: 12.5px; color: var(--text-2); }
.kit-row { display: grid; grid-template-columns: minmax(110px, 160px) 1fr; gap: 4px 10px; align-items: center; padding: 4px 8px; border-radius: var(--radius-s); background: var(--panel-2); border: 1px solid var(--line-soft); }
.kit-row.swapping { border-color: var(--cyan-dim); }
.kit-id { display: grid; min-width: 0; } .kit-id b { font-size: 12.5px; } .kit-id span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kit-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.kit-ctl .knob-s { width: 58px; } .kit-ctl .knob-s .knob-label { text-align: center; }
.kit-more > summary { cursor: pointer; font-size: 11.5px; color: var(--muted); padding: 2px 6px; }
.kit-more[open] { flex-basis: 100%; } .kit-more .rack-knobs { padding: 2px 0 4px; }
.kit-browser { grid-column: 1 / -1; display: grid; gap: 6px; padding: 6px 0 2px; } .kit-list { max-height: 260px; }
@media (max-width: 640px) { .kit-row { grid-template-columns: 1fr; } }
.rack-insert { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.rack-insert > summary { cursor: pointer; padding: 6px 10px; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.rack-insert > summary b { color: var(--text); } .rack-insert > summary .btn { margin-left: auto; }
.rack-insert.bypassed > summary b { text-decoration: line-through; color: var(--muted); }
.rack-ramp select { min-height: var(--control-s); background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius-s); }
.btn.danger { color: var(--rose); }
@media (max-width: 640px) {
  .rack-list { max-height: 50vh; } .rack-list li { flex-wrap: wrap; } .rack-knobs { gap: 8px 6px; }
  .rack-actions .btn, .rack-item-actions .btn, .rack-voices .btn { min-height: var(--touch); }
}
/* ---- Optional external-AI reading (Create) */
.ai-body { display: grid; gap: var(--s-2); padding-top: var(--s-2); }
.ai-paste { width: 100%; box-sizing: border-box; min-height: 72px; background: var(--inset); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 6px 8px; font: 12.5px/1.4 ui-monospace, Consolas, monospace; }
.ai-out { display: flex; flex-wrap: wrap; gap: 6px; }
/* ---- Note editor (piano roll of one part in one section; score-derived drawing) */
.note-editor { display: grid; gap: var(--s-2); min-width: 0; outline: none; }
.note-editor:focus-visible .ne-scroll { box-shadow: 0 0 0 2px var(--cyan-dim); }
.ne-scroll { overflow: auto; max-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--inset); }
.ne-svg { display: block; }
.ne-row.chord { fill: #17312f; } .ne-row.scale { fill: var(--panel); } .ne-row.outside { fill: var(--inset); }
.ne-grid { stroke: var(--line-soft); stroke-width: 1; } .ne-grid.bar { stroke: var(--line-2); }
.ne-chord { fill: var(--panel-3); } .ne-chord.borrowed { fill: #3a2f1c; stroke: var(--amber); stroke-width: 1; }
.ne-chord-name { fill: var(--text-2); font-size: 10.5px; } .ne-key { fill: var(--panel-2); } .ne-key.black { fill: var(--bg); }
.ne-key-name { fill: var(--muted); font-size: 8.5px; }
.ne-note { fill: var(--cyan); stroke: var(--cyan-ink); stroke-width: 0.5; cursor: grab; touch-action: none; } .ne-note.user { fill: var(--violet); }
.ne-note.sel { fill: var(--amber); stroke: var(--text); stroke-width: 1.2; }
.ne-info { margin: 0; color: var(--text-2); min-height: 1.4em; } .ne-help { margin: 0; } .ne-empty { margin: var(--s-2) 0; }
.de-col { fill: var(--panel); } .de-col.odd { fill: var(--panel-2); }
.de-bar { fill: var(--muted); font-size: 10px; } .de-barline { stroke: var(--line-2); } .de-rowline { stroke: var(--line-soft); }
.de-slot { fill: var(--text-2); font-size: 11px; }
.de-hit { fill: var(--amber); } .de-hit.user { fill: var(--violet); } .de-hit.multi { stroke: var(--text); stroke-width: 1; }
.de-cursor { fill: none; stroke: var(--cyan); stroke-width: 1.5; }
@media (max-width: 640px) { .ne-scroll { max-height: 55vh; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
