/* Self-hosted: Archivo and IBM Plex Mono (SIL Open Font License 1.1, see OFL.txt). */
/* latin-ext */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(fonts/archivo-100-900-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url(fonts/archivo-100-900-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-400-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(fonts/ibm-plex-mono-600-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   Engine Loop Studio
   An instrument-panel look in the Ultrasonic Nexus family: soft paper or deep
   black surfaces around dark displays, hairline structure, a wide grotesk for
   labels, mono for readouts, and one accent colour (see the tokens).
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;

  --font-ui: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --wide: 118%;                       /* Archivo's width axis, for labels */
  --ease: cubic-bezier(.22, 1, .36, 1);
  --r-xs: 4px; --r-sm: 7px; --r: 10px; --r-lg: 14px; --r-pill: 999px;
  --bar-h: 52px;                      /* top bar */
  --head-h: 44px;                     /* panel / editor heads (kept equal) */
  --foot-h: 48px;                     /* panel foot / transport (kept equal) */

  /* Colour is rationed. The interface is ink on paper with ONE accent
     (violet: selection, focus, what is switched on or playing). Red and amber
     appear only for trouble. Things of a kind look the same: every RPM target,
     loop and step shares one style and is told apart by its number. The four
     brand colours live on in the logo mark alone. */
  --m-1: #3A00AD; --m-2: #F6492C; --m-3: #FBA702; --m-4: #A8C200;

  /* surfaces: soft paper, a step below white, so a long session stays easy on
     the eyes (near-white panels around white inputs glared) */
  --bg: #D5D2CB;
  --panel: #E3E0DA;
  --raised: #EDEBE6;
  --sunken: #D9D6CF;
  --hover: rgba(12, 12, 13, .055);
  --press: rgba(12, 12, 13, .10);

  /* text & lines */
  --ink: #0C0C0D;
  --ink-2: #3E3D43;
  --ink-3: #626066;
  --ink-4: #96949A;
  --line: rgba(12, 12, 13, .10);
  --line-2: rgba(12, 12, 13, .17);
  --line-3: rgba(12, 12, 13, .32);

  /* roles */
  --accent: #3A00AD;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(58, 0, 173, .09);
  --accent-line: rgba(58, 0, 173, .45);
  --primary: #0C0C0D;
  --primary-ink: #F2F0EB;
  --primary-hover: #2B2A2F;
  --warn-text: #865300;
  --danger: #F6492C; --danger-ink: #FFFFFF; --danger-text: #B92E17; --danger-soft: rgba(246, 73, 44, .12);
  --focus-ring: 0 0 0 3px rgba(58, 0, 173, .20);
  --shadow-1: 0 1px 2px rgba(12, 12, 13, .07);
  --shadow-pop: 0 1px 2px rgba(12, 12, 13, .07), 0 16px 40px rgba(12, 12, 13, .16);
  --scrim: rgba(24, 23, 28, .40);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23626066' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23F2F0EB' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4.2 4.2 8.8-9.2'/%3E%3C/svg%3E");

  /* waveform thumbnails in lists and cards: part of the page, not a display */
  --thumb-bg: #D9D6CF;
  --thumb-wave: #2A292E;
  --thumb-loop: rgba(12, 12, 13, .05);

  /* displays (canvas views), read by js/theme.js. A display is a dark screen in
     BOTH themes: a spectrogram reads as light on dark (inverted on white it
     looked like a smudged print), and the big white canvases were most of the
     light theme's glare. Light sets the screens in graphite, dark in black.
     Three colours on a display, each with one job: ink for the signal, violet
     for what you place (loop, fade, targets, tracks), lime for what is live
     (the RPM contour, the playhead). */
  --d-bg: #1A1A1D;
  --d-grid: rgba(242, 241, 238, .07);
  --d-axis: #8E8C87;
  --d-axis-2: #6C6A66;
  --d-wave: #E8E6E1;
  --d-wave-over: rgba(236, 234, 229, .34);   /* the waveform drawn over the spectrogram */
  --d-dim: rgba(26, 26, 29, .64);
  --d-dim-edge: rgba(242, 241, 238, .16);
  --d-band-edge: rgba(155, 125, 255, .55);
  --d-contour: #C8E606;
  --d-contour-2: #C8E606;
  --d-draw: #F2F1EE;
  --d-ink: #F2F1EE;
  --d-on-ink: #1A1A1D;
  --d-cross: rgba(242, 241, 238, .30);
  --d-scroll: rgba(242, 241, 238, .06);
  --d-scroll-thumb: rgba(242, 241, 238, .30);
  --d-scroll-active: #9B7DFF;
  --d-loop: rgba(155, 125, 255, .10);
  --d-loop-edge: #9B7DFF;
  --d-outside: rgba(26, 26, 29, .45);
  --d-play: #C8E606;
  --d-zc-a: #D5D3CE;                  /* what fades out / the 1st half: ink */
  --d-zc-b: #9B7DFF;                  /* what fades in / the 2nd half: violet */
  --d-zc-seam: #F2F1EE;
  --d-target: #9B7DFF; --d-target-ink: #0A0A0B;   /* every RPM target, track and simulator voice */
  --d-spec-0: #1A1A1D; --d-spec-1: #201640; --d-spec-2: #2C0F78; --d-spec-3: #5A1FB0;
  --d-spec-4: #B3306C; --d-spec-5: #F6492C; --d-spec-6: #FBA702; --d-spec-7: #EEF78A;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #080809;
  --panel: #111112;
  --raised: #19191B;
  --sunken: #0C0C0D;
  --hover: rgba(242, 241, 238, .055);
  --press: rgba(242, 241, 238, .10);

  --ink: #F2F1EE;
  --ink-2: #B5B3AE;
  --ink-3: #7F7D78;
  --ink-4: #55544F;
  --line: rgba(242, 241, 238, .08);
  --line-2: rgba(242, 241, 238, .14);
  --line-3: rgba(242, 241, 238, .26);

  --accent: #9B7DFF;
  --accent-ink: #0A0A0B;
  --accent-soft: rgba(155, 125, 255, .14);
  --accent-line: rgba(155, 125, 255, .55);
  --primary: #F2F1EE;
  --primary-ink: #0A0A0B;
  --primary-hover: #FFFFFF;
  --warn-text: #FBA702;
  --danger-text: #FF6A4D; --danger-soft: rgba(246, 73, 44, .15);
  --focus-ring: 0 0 0 3px rgba(155, 125, 255, .30);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-pop: 0 1px 2px rgba(0, 0, 0, .5), 0 20px 48px rgba(0, 0, 0, .55);
  --scrim: rgba(0, 0, 0, .58);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237F7D78' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230A0A0B' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5.5 12.5l4.2 4.2 8.8-9.2'/%3E%3C/svg%3E");

  --m-1: #9B7DFF; --m-2: #FF5A3C; --m-3: #FBA702; --m-4: #C8E606;

  --thumb-bg: #0A0A0B;
  --thumb-wave: #ECEAE5;
  --thumb-loop: rgba(242, 241, 238, .06);

  /* the same displays, set in black */
  --d-bg: #0A0A0B;
  --d-grid: rgba(242, 241, 238, .06);
  --d-axis: #6E6C68;
  --d-axis-2: #56544F;
  --d-wave: #ECEAE5;
  --d-dim: rgba(10, 10, 11, .64);
  --d-on-ink: #0A0A0B;
  --d-outside: rgba(10, 10, 11, .45);
  --d-spec-0: #0A0A0B; --d-spec-1: #140A2C;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 13px/1.4 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
:where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(button) { cursor: pointer; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 16px; height: 16px; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: middle; pointer-events: none;
}
b, strong { font-weight: 600; }
::selection { background: var(--accent-soft); }

/* No accidental selection of UI chrome; fields stay selectable. */
#app { -webkit-user-select: none; user-select: none; }
input, textarea, [contenteditable="true"], .selectable { -webkit-user-select: text; user-select: text; }

/* A single, clear keyboard focus ring (mouse clicks stay clean). */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Two voices for text that names things, and they don't mix:
   - names of sections, panels and toolbar groups: wide, uppercase, tracked;
   - the label of a row (a field, a slider, a readout): plain sentence case,
     the same whether the row holds an input or a measured value. (Readout
     rows used the uppercase voice, so "Mode" and "MEASURED" sat in one list.) */
.panel-head h2, .insp-block h3, .sweep-block h3, .seam-card h3, .sim-curve-card h3,
.sim-controls h3, .sim-block h4, .combo-pane-h, .spec-card h3, .list-section,
.sim-cand-head, .tb-label {
  font-stretch: var(--wide);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* Section names: one construction everywhere. A dash in one of the four
   signature colours (data-sig="1..4", in the logo's order down a panel), a
   step number where the section is a step, then the name. This is where the
   brand colours live in the interface; everything else stays ink and accent. */
.sweep-block h3:not(.view-title), .insp-block h3, .seam-card h3, .sim-curve-card h3, .sim-block h4, .combo-pane-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 10.5px; font-weight: 650; color: var(--ink);
}
.sweep-block h3:not(.view-title)::before, .insp-block h3::before, .seam-card h3::before,
.sim-curve-card h3::before, .sim-block h4::before, .combo-pane-h::before {
  content: ""; flex: 0 0 auto; width: 16px; height: 4px; border-radius: 2px;
  background: var(--sig, var(--ink-4));
}
[data-sig="1"] { --sig: var(--m-1); }
[data-sig="2"] { --sig: var(--m-2); }
[data-sig="3"] { --sig: var(--m-3); }
[data-sig="4"] { --sig: var(--m-4); }

/* Scrollbars: thin, quiet */
* { scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------------------------------------------------------------- frame */
html, body, #app { margin: 0; padding: 0; }
#app {
  display: grid;
  grid-template-rows: var(--bar-h) minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);   /* the 3-pane body never widens the page */
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
.layout { min-height: 0; height: 100%; }
.layout > * { min-height: 0; min-width: 0; overflow: hidden; }
.layout .inspector { overflow-y: auto; overflow-x: hidden; }
.layout .sample-panel { overflow: hidden; }
.editor, .view { overflow: hidden; }
.view-sweep.active { display: flex; flex-direction: column; }
.sweep-grid, .sweep-left { overflow: hidden; }
.sweep-right { overflow-y: auto; overflow-x: hidden; }
.sweep-strip { flex: 0 0 auto; }

/* ---------------------------------------------------------------- buttons
   One button language everywhere: pill, hairline, wide uppercase label.
   .accent = the primary action (solid ink). .warn = destructive. */
/* :where() keeps this at zero specificity, so any class rule (.accent, .full,
   .warn…) refines it without a fight. */
:where(.menu, .export-group, .wave-toolbar, .form, .sweep-block, .combo-actions, .combo-bar,
    .ww-actions, .sim-buttons, .modal-actions, .zc-controls, .bank-right, .ww-block, .lic, .app-toast) :where(button:not(.icon-btn):not(.mode-btn):not(.seg-btn):not(.linkish)),
.modal-btn, .bank-detect, .import-btn, .license-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 30px; padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--ink);
  font-size: 10.5px; font-weight: 650; font-stretch: 112%;
  text-transform: uppercase; letter-spacing: .07em; line-height: 1;
  white-space: nowrap;
  transition: background-color .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), transform .1s var(--ease);
}
:where(.menu, .export-group, .wave-toolbar, .form, .sweep-block, .combo-actions, .combo-bar,
    .ww-actions, .sim-buttons, .modal-actions, .zc-controls, .bank-right, .ww-block, .lic, .app-toast) :where(button:not(.icon-btn):not(.mode-btn):not(.seg-btn):not(.linkish):not(.accent):not(:disabled)):hover,
.modal-btn:not(.modal-ok):hover, .bank-detect:hover, .license-pill:hover { border-color: var(--line-3); background: var(--panel); }
.import-btn { padding: 0 16px 0 13px; }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; }
button .ic { width: 15px; height: 15px; }

/* primary */
button.accent, .modal-ok {
  background: var(--primary); border-color: var(--primary); color: var(--primary-ink);
}
button.accent:hover:not(:disabled), .modal-ok:hover {
  background: var(--primary-hover); border-color: var(--primary-hover); color: var(--primary-ink);
}
/* destructive */
button.warn { color: var(--danger-text); border-color: color-mix(in srgb, var(--danger) 40%, transparent) !important; }
button.warn:hover:not(:disabled) { background: var(--danger-soft) !important; border-color: var(--danger) !important; }

/* icon buttons: round, quiet */
.icon-btn, .panel-toggle {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; padding: 0; flex: 0 0 auto;
  border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--ink-2);
  transition: background-color .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.icon-btn:hover, .panel-toggle:hover { background: var(--hover); color: var(--ink); }
.icon-btn .ic, .panel-toggle .ic { width: 17px; height: 17px; }
.icon-btn.accent { background: var(--primary); color: var(--primary-ink); }

/* ---------------------------------------------------------------- fields */
#app input[type="text"], #app input[type="number"], #app select,
.modal-dialog input[type="text"], .modal-dialog input[type="number"], .modal-dialog select {
  height: 30px; width: 100%;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--raised);
  color: var(--ink);
  font: 500 12px var(--font-ui);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
#app input[type="number"] { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; }
#app select {
  -webkit-appearance: none; appearance: none;
  padding-right: 28px;
  background-image: var(--chevron); background-repeat: no-repeat;
  background-position: right 9px center; background-size: 13px;
  cursor: pointer;
}
#app input[type="text"]:hover, #app input[type="number"]:hover, #app select:hover { border-color: var(--line-3); }
#app input[type="text"]:focus, #app input[type="number"]:focus, #app select:focus {
  border-color: var(--accent-line); box-shadow: var(--focus-ring); outline: none;
}
#app input[readonly] { background: var(--sunken); color: var(--ink-2); }
#app input::placeholder { color: var(--ink-4); }

/* range: a hairline track that fills to the value (--fill set by js/theme.js) */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 18px; margin: 0; background: transparent; cursor: pointer;
  --fill: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px; border-radius: 2px;
  background: linear-gradient(to right, var(--ink) 0 var(--fill), var(--line-2) var(--fill) 100%);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; margin-top: -5px; border-radius: 50%;
  background: var(--raised); border: 1.5px solid var(--ink);
  transition: box-shadow .15s var(--ease), transform .15s var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--hover); }
input[type="range"]:active::-webkit-slider-thumb { box-shadow: 0 0 0 6px var(--accent-soft); border-color: var(--accent); transform: scale(1.1); }
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: var(--focus-ring); }
input[type="range"]::-moz-range-track { height: 2px; border-radius: 2px; background: var(--line-2); }
input[type="range"]::-moz-range-progress { height: 2px; border-radius: 2px; background: var(--ink); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--raised); border: 1.5px solid var(--ink); }

/* checkbox: a small ink square */
input[type="checkbox"] {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; margin: 0; flex: 0 0 auto;
  border-radius: 4px; border: 1.5px solid var(--line-3);
  background: var(--raised) center / 11px no-repeat;
  cursor: pointer;
  transition: background-color .12s var(--ease), border-color .12s var(--ease);
}
input[type="checkbox"]:hover { border-color: var(--ink-3); }
input[type="checkbox"]:checked { background-color: var(--ink); border-color: var(--ink); background-image: var(--check); }
.ck { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); cursor: pointer; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 12px 0 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-width: 0; overflow: hidden;
}
.topbar .grow { flex: 1 1 auto; min-width: 8px; }
.brand {
  display: inline-flex; align-items: center; gap: 11px; flex: 0 0 auto;
  background: none; border: 0; margin: 0; padding: 6px 10px 6px 6px;
  border-radius: var(--r-sm); color: var(--ink); text-align: left;
}
.brand:hover { background: var(--hover); }
.mark { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 18px; }
.mark i { display: block; width: 3.5px; border-radius: 2px; }
.mark i:nth-child(1) { height: 42%; background: var(--m-1); }
.mark i:nth-child(2) { height: 100%; background: var(--m-2); }
.mark i:nth-child(3) { height: 66%; background: var(--m-3); }
.mark i:nth-child(4) { height: 84%; background: var(--m-4); }
.brand-name {
  font-size: 12.5px; font-weight: 750; font-stretch: 125%;
  text-transform: uppercase; letter-spacing: .03em; white-space: nowrap;
}
.menu { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; padding-left: 10px; border-left: 1px solid var(--line); }
.menu button:not(.icon-btn) { border-color: transparent !important; background: transparent !important; color: var(--ink-2) !important; padding: 0 10px !important; }
.menu button:not(.icon-btn):hover { background: var(--hover) !important; color: var(--ink) !important; }
.import-btn { flex: 0 0 auto; }
.export-group { display: flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; }
.field-join {
  display: flex; align-items: stretch; height: 30px; min-width: 0;
  border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--raised); overflow: hidden;
  transition: border-color .14s var(--ease);
}
.field-join:hover { border-color: var(--line-3); }
.field-join:focus-within { border-color: var(--accent-line); box-shadow: var(--focus-ring); }
#app .field-join .topbar-input { height: 100%; border: 0; border-radius: 0; background-color: transparent; box-shadow: none; }
#app .field-join #export-template { width: 200px; min-width: 70px; padding: 0 10px 0 14px; font: 500 11.5px var(--font-mono); color: var(--ink-2); }
#app .field-join #export-depth { width: auto; flex: 0 0 auto; border-left: 1px solid var(--line); padding-left: 10px; font-size: 11.5px; }
.theme-toggle .ic-sun { display: none; }
[data-theme="dark"] .theme-toggle .ic-sun { display: block; }
[data-theme="dark"] .theme-toggle .ic-moon { display: none; }
@media (max-width: 1180px) { #app .field-join #export-template { width: 130px; } }
@media (max-width: 1020px) { .field-join { display: none; } }
@media (max-width: 1100px) { .brand-text { display: none; } }

/* ---------------------------------------------------------------- layout */
.layout {
  display: grid;
  /* side panels cap at 280/300 but shrink before the editor's 360px floor */
  grid-template-columns: minmax(0, 280px) minmax(360px, 1fr) minmax(0, 304px);
  min-height: 0;
  transition: grid-template-columns .26s var(--ease);
}
.layout.samples-folded:not(.drag-expanding) { grid-template-columns: minmax(52px, 52px) minmax(360px, 1fr) minmax(0, 304px); }
@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 224px) minmax(340px, 1fr) minmax(0, 256px); }
  .layout.samples-folded:not(.drag-expanding) { grid-template-columns: minmax(52px, 52px) minmax(340px, 1fr) minmax(0, 256px); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 168px) minmax(300px, 1fr) minmax(0, 208px); }
  .layout.samples-folded:not(.drag-expanding) { grid-template-columns: minmax(52px, 52px) minmax(300px, 1fr) minmax(0, 208px); }
}
@media (max-width: 1000px) {
  .inspector .form label:not(.ck):not(.slider-row) { grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 8px; }
}
.panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.inspector { border-right: none; border-left: 1px solid var(--line); }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; flex: 0 0 auto;
  height: var(--head-h); padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 10.5px; font-weight: 650; color: var(--ink-3); }
.panel-tools { display: flex; gap: 4px; }
.panel-foot {
  display: flex; align-items: center; gap: 18px; flex: 0 0 auto;
  height: var(--foot-h); padding: 0 16px;
  border-top: 1px solid var(--line);
}
.kv { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.kv > span { font-size: 12px; color: var(--ink-2); }
.kv b { font: 500 12px var(--font-mono); color: var(--ink); }

/* ---------------------------------------------------------------- samples panel */
.bank-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  margin: 0 12px 8px; padding: 12px 10px; min-height: 58px;
  border: 1px dashed var(--line-3); border-radius: var(--r);
  background: transparent; text-align: center; cursor: pointer;
  transition: background-color .14s var(--ease), border-color .14s var(--ease);
}
.bank-drop:hover, .bank-drop.drag-over { border-style: solid; border-color: var(--ink-3); background: var(--hover); }
.bank-drop.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.bank-drop strong { font-size: 10.5px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .07em; color: var(--ink); }
.bank-drop span { font-size: 11px; color: var(--ink-3); }
.sweep-drop { margin-top: 12px; }
.drop-icon { display: none; line-height: 0; }

.sample-list { list-style: none; margin: 0; padding: 2px 8px 6px; overflow-y: auto; flex: 1; min-height: 0; }
.sample-list-block { flex: 1 1 0; min-height: 54px; }
.sample-list-block.empty-block { flex: 0 0 auto; min-height: 0; padding: 0; }
.sample-list .list-empty {
  display: block; padding: 8px; margin: 0; border: none; cursor: default;
  font-size: 11.5px; color: var(--ink-3); white-space: normal;
}
.sample-list .list-empty:hover { background: none; }
.sample-list li {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center; gap: 10px; min-width: 0;
  margin-bottom: 2px; padding: 6px 8px;
  border-radius: var(--r); border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .14s var(--ease), border-color .14s var(--ease);
}
.sample-list li > div { min-width: 0; }
.sample-list li:hover { background: var(--hover); }
.sample-list li.active { background: var(--raised); border-color: var(--line-2); box-shadow: var(--shadow-1); }
.sample-list li.in-combo { opacity: .5; cursor: default; }
.sample-list li[draggable="true"] { cursor: grab; }
.sample-list li.is-loop { margin-left: 14px; }
/* a locked ("marked good") loop says so in its RPM badge: padlock + tooltip */
.sample-list li.locked .rpm {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-3);
}
.sample-list .rpm .ic { width: 11px; height: 11px; margin-left: -2px; stroke-width: 2; }
.sample-list li.list-section {
  display: block; cursor: default; background: none; pointer-events: none;
  margin: 8px 0 0; padding: 8px 8px 4px;
  font-size: 9.5px; font-weight: 650; color: var(--ink-3);
}
.sample-list .swatch {
  position: relative; overflow: hidden;
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--sunken); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .14s var(--ease), color .14s var(--ease), transform .16s var(--ease), box-shadow .16s var(--ease);
}
.sample-list .swatch .ic { width: 15px; height: 15px; }
.sample-list li.active .swatch { background: var(--ink); color: var(--panel); box-shadow: none; }
.sample-list li.is-source .swatch { color: var(--ink); }
.sample-list li.active.is-source .swatch { color: var(--panel); }
.sample-list .nm { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sample-list .sub { margin-top: 1px; font: 400 10.5px var(--font-mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sample-list .kind-icon { display: none; }
.sample-list .rpm {
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--ink-2);
  font: 500 10.5px var(--font-mono); white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line);
}
.sample-list .rpm.is-source-rpm { font: 650 9.5px var(--font-ui); font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .07em; }
.sample-list .li-del {
  display: grid; place-items: center;
  width: 22px; height: 22px; padding: 0; flex: 0 0 auto;
  border: none; border-radius: 50%; background: transparent; color: var(--ink-3);
  opacity: 0; transition: opacity .12s var(--ease), color .12s var(--ease), background-color .12s var(--ease);
}
.sample-list .li-del .ic { width: 14px; height: 14px; }
.sample-list li:hover .li-del, .sample-list li.active .li-del { opacity: 1; }
.sample-list .li-del:hover { color: var(--danger-text); background: var(--danger-soft); }

/* folded rail: every row keeps its exact box, only the tile stays visible */
.fold-only { display: none; color: var(--ink-3); line-height: 0; }
.layout.samples-folded:not(.drag-expanding) .fold-only { display: block; }
.layout.samples-folded:not(.drag-expanding) .sample-panel .panel-head h2,
.layout.samples-folded:not(.drag-expanding) .sample-list .list-empty { display: none; }
.layout.samples-folded:not(.drag-expanding) .sample-panel .panel-head { justify-content: center; padding: 0; }
.layout.samples-folded:not(.drag-expanding) .sample-panel { border-right: 1px solid var(--line); }
.layout.samples-folded:not(.drag-expanding) .sample-panel .panel-foot { visibility: hidden; }
.layout.samples-folded:not(.drag-expanding) .sample-panel .bank-drop {
  width: 36px; min-height: 58px; margin-left: auto; margin-right: auto; padding: 0; gap: 0; border-radius: var(--r);
}
.layout.samples-folded:not(.drag-expanding) .sample-panel .bank-drop strong,
.layout.samples-folded:not(.drag-expanding) .sample-panel .bank-drop > span:not(.drop-icon) { display: none; }
.layout.samples-folded:not(.drag-expanding) .sample-panel .bank-drop .drop-icon { display: block; color: var(--ink-2); }
.layout.samples-folded:not(.drag-expanding) .sample-list { overflow-x: hidden; padding-left: 4px; padding-right: 4px; }
.layout.samples-folded:not(.drag-expanding) .sample-list li {
  position: relative; overflow: hidden;
  margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0;
  background: none; border-color: transparent; box-shadow: none;
}
.layout.samples-folded:not(.drag-expanding) .sample-list li:hover { background: var(--hover); }
.layout.samples-folded:not(.drag-expanding) .sample-list li > div:not(.swatch):not(.rpm) { visibility: hidden; }
.layout.samples-folded:not(.drag-expanding) .sample-list li > .rpm,
.layout.samples-folded:not(.drag-expanding) .sample-list li > .li-del,
.layout.samples-folded:not(.drag-expanding) .sample-list li > .fold-rpm { display: none; }
.fold-rpm, .sw-rpm { display: none; }
.layout.samples-folded:not(.drag-expanding) .sample-list .swatch {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
}
.layout.samples-folded:not(.drag-expanding) .sample-list .swatch .ic { display: none; }
.layout.samples-folded:not(.drag-expanding) .sample-list .sw-rpm {
  display: flex; align-items: center; justify-content: center;
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  font: 600 8.5px/1 var(--font-mono); letter-spacing: -.02em; color: inherit;
}
.layout.samples-folded:not(.drag-expanding) .sample-list li:hover .swatch { transform: translate(-50%, -50%) scale(1.08); }
.layout.samples-folded:not(.drag-expanding) .sample-list li.active .swatch { transform: translate(-50%, -50%) scale(1.08); }
.sample-panel.fold-animating .sample-list,
.sample-panel.fold-animating .bank-drop { animation: foldContent .26s var(--ease) both; }
@keyframes foldContent { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- editor */
.editor { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); }
.editor, .editor > .view, .sweep-grid, .sweep-left, .sweep-canvases, .wave-stack, .sim-grid { min-width: 0; }
.editor-head {
  display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: var(--head-h); padding: 0 10px 0 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.panel-toggle { margin-right: 4px; }
.tabs { display: flex; height: 100%; flex: 0 1 auto; min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; flex-shrink: 0;
  height: 100%; padding: 0 11px;
  border: none; background: transparent; color: var(--ink-3);
  font-size: 10px; font-weight: 650; font-stretch: 112%;
  text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
  transition: color .14s var(--ease);
}
.tab::after {
  content: ""; position: absolute; left: 11px; right: 11px; bottom: -1px; height: 2px;
  background: var(--ink); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transition: transform .22s var(--ease);
}
.tab:hover { color: var(--ink); }
@media (max-width: 1320px) { .tab .t-x { display: none; } }
.tab.active { color: var(--ink); }
.tab.active::after { transform: scaleX(1); }
.tab:active { transform: none !important; }
.editor-actions { display: flex; gap: 12px; margin-left: auto; }
.view { display: none; flex: 1; min-height: 0; flex-direction: column; }
.view.active { display: flex; }   /* tabs switch instantly: a fade reads as lag in a tool */
.view-title, .sweep-block h3.view-title { font-size: 13px; font-weight: 750; font-stretch: 125%; text-transform: uppercase; letter-spacing: .03em; }
.view-title { margin: 0; }

/* displays */
.empty {
  position: absolute; inset: 22px 0 0 0; z-index: 4;
  display: grid; place-items: center; padding: 0 16px;
  color: var(--d-axis); font-size: 13px; text-align: center; pointer-events: none;
}
.empty.hidden { display: none; }
.empty b { color: var(--d-ink); font-weight: 650; }

/* ---------------------------------------------------------------- transport */
.editor-transport {
  display: flex; align-items: center; gap: 16px; flex: 0 0 auto;
  height: var(--foot-h); padding: 0 12px 0 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.editor-transport .et-transport { display: flex; gap: 6px; flex: 0 0 auto; }
.big-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0; flex: 0 0 auto;
  border-radius: 50%; border: 1px solid var(--line-2);
  background: var(--raised); color: var(--ink);
  transition: background-color .14s var(--ease), color .14s var(--ease), border-color .14s var(--ease);
}
.big-btn .ic { width: 14px; height: 14px; }
.big-btn:hover { border-color: var(--line-3); }
.editor-transport .big-btn.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.editor-transport .big-btn.pressed { background: var(--danger); border-color: var(--danger); color: var(--danger-ink); }
.editor-transport .et-vol { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; font-size: 10px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.editor-transport .et-vol input[type="range"] { width: 132px; }
.editor-transport .et-vol b { min-width: 36px; font: 500 11px var(--font-mono); letter-spacing: 0; color: var(--ink); }
.editor-transport .et-export-vol { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; cursor: pointer; }
.editor-transport .grow { flex: 1; }
.editor-transport .et-hidden { display: none; }
.et-status {
  flex: 1 1 auto; min-width: 0; text-align: right;
  font: 400 11.5px var(--font-mono); color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .25s var(--ease);
}
#status-line[data-tone="ok"]   { color: var(--ink-2); }
#status-line[data-tone="warn"] { color: var(--warn-text); }
#status-line[data-tone="info"] { color: var(--ink-2); }
#status-line[data-tone="busy"] { color: var(--ink-3); }
#status-line.status-flash { animation: statusFlash .5s var(--ease); }
@keyframes statusFlash { from { opacity: .35; } to { opacity: 1; } }

/* level meters: L and R hairlines in ink, turning red near full scale */
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter.meter-h { flex: 0 0 auto; }
.meter-ch { display: flex; align-items: center; gap: 6px; }
.meter-lbl { width: 8px; font: 600 9px var(--font-mono); color: var(--ink-3); }
.meter-track { flex: 1; height: 4px; border-radius: 2px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.meter.meter-h .meter-track { width: 96px; }
.meter-fill {
  height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-2) 80%, var(--danger) 92%);
  clip-path: inset(0 100% 0 0);
  transition: clip-path 30ms linear;
}

/* ---------------------------------------------------------------- sweep extractor */
.sweep-grid {
  flex: 1; display: grid; gap: 0; min-height: 0; height: 100%; width: 100%;
  grid-template-columns: minmax(0, 1fr) minmax(232px, 320px);
  grid-template-rows: 1fr;
}
.sweep-left { display: flex; flex-direction: column; min-height: 0; background: var(--d-bg); }
.sweep-canvases { position: relative; flex: 1; min-height: 0; }
.sweep-canvases canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#sweep-overlay { cursor: crosshair; z-index: 4; }
#sweep-wave { z-index: 3; pointer-events: none; }
#sweep-curve { z-index: 2; }
#sweep-empty.empty {
  position: absolute; inset: 0; z-index: 4;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--d-bg) 76%, transparent);
  color: var(--d-axis); font-size: 13px;
}
#sweep-empty.hidden { display: none; }

.sweep-strip {
  display: flex; gap: 8px; height: 132px; padding: 10px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden;
}
.sweep-strip:empty::before {
  content: "Extracted loops appear here";
  margin: auto; align-self: center;
  font-size: 10.5px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-4);
}
.strip-card {
  flex: 0 0 176px; display: flex; flex-direction: column; gap: 6px;
  padding: 10px 10px 8px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--raised);
  cursor: pointer;
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.strip-card:hover { border-color: var(--line-3); }
.strip-card.active { border-color: var(--ink); box-shadow: inset 0 0 0 .5px var(--ink); }
.strip-card.locked { border-color: var(--ink-3); }
.strip-card .stripe-rpm {
  display: flex; align-items: center; gap: 7px;
  font: 600 14px var(--font-mono); color: var(--ink); letter-spacing: -.01em;
}
.strip-card canvas { width: 100%; height: 38px; border-radius: 6px; background: var(--thumb-bg); }
.strip-card .stripe-meta { display: flex; justify-content: space-between; font: 400 10px var(--font-mono); color: var(--ink-3); }
/* The number badge of a target or loop: the same in the target chips, the
   loop strip, the bank and the combo (they used to take a colour each). */
.stripe-num, .tgt-num, .bank-num, .combo-card .cc-num {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 600 10px/1 var(--font-mono); letter-spacing: 0;
}
.stripe-lock, .stripe-del {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; padding: 0; flex: 0 0 auto;
  border: none; border-radius: 50%; background: transparent; color: var(--ink-3);
  transition: color .12s var(--ease), background-color .12s var(--ease);
}
.stripe-lock { margin-left: auto; }
.stripe-lock .ic, .stripe-del .ic { width: 14px; height: 14px; }
.stripe-lock:hover { color: var(--ink); background: var(--hover); }
.stripe-lock.on { color: var(--ink); }
.stripe-del:hover { color: var(--danger-text); background: var(--danger-soft); }

.sweep-right { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.sweep-block { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.insp-block:last-child, .sweep-block:last-child { border-bottom: none; }
.sweep-block h3 { margin: 0 0 12px; }
.sweep-block h3.step b { font: 500 10px var(--font-mono); letter-spacing: 0; color: var(--ink-3); }
.sweep-block .hint, .hint { display: block; margin-top: 8px; font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }
.hint b { color: var(--ink-2); font-weight: 600; }
.hint em { font-style: normal; color: var(--ink-2); }
.sweep-block label {
  display: grid; grid-template-columns: minmax(0, 92px) minmax(0, 1fr);
  align-items: center; gap: 10px; margin-bottom: 8px;
  font-size: 12px; color: var(--ink-2);
}
.sweep-block label > * { min-width: 0; }
.sweep-block label.ck { display: flex; grid-template-columns: none; margin-top: 4px; }
.sweep-block label.slider-row { grid-template-columns: 64px 1fr 52px; }
.sweep-block .form.compact { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.sweep-block .form label.count-lbl { grid-template-columns: 44px 1fr; margin: 0; }
.sweep-block #sweep-count { min-width: 52px; text-align: center; }
.sweep-block button.full { width: 100%; height: 34px; }
.sweep-block button.full + .slider-row, .sweep-block button.full + label { margin-top: 14px; }
.sweep-block button.big { height: 44px; padding: 0 18px; justify-content: space-between; font-size: 11.5px; letter-spacing: .08em; }
.sweep-block button.big .ic { width: 17px; height: 17px; }
.sweep-block.sweep-go { position: sticky; bottom: 0; background: var(--panel); border-top: 1px solid var(--line); margin-top: -1px; }
.sweep-block button.small { height: 24px; padding: 0 10px; font-size: 10px; }

/* segmented controls (View/Tracks/Draw, simulator pool) */
.mode-row, .sim-pool-seg {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px;
  margin-top: 10px; padding: 3px;
  border-radius: var(--r-pill); background: var(--sunken);
  box-shadow: inset 0 0 0 1px var(--line);
}
.sim-pool-seg { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); margin: 4px 0 10px; }
.mode-btn, .sim-pool-seg .seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 26px; padding: 0 6px; border: none; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-3);
  font-size: 10px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
  transition: background-color .14s var(--ease), color .14s var(--ease), box-shadow .14s var(--ease);
}
.mode-btn .ic { width: 14px; height: 14px; }
.mode-btn:hover, .sim-pool-seg .seg-btn:hover:not(.active):not(:disabled) { color: var(--ink); }
.mode-btn.active, .sim-pool-seg .seg-btn.active {
  background: var(--raised); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px var(--line-2);
}
.sim-pool-seg .seg-btn:disabled { opacity: .4; cursor: not-allowed; }
/* a segment can never spill into its neighbour: the name clips with an
   ellipsis, the count badge stays whole */
.mode-btn, .sim-pool-seg .seg-btn { min-width: 0; overflow: hidden; }
.mode-btn > span, .seg-l { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seg-n {
  flex: 0 0 auto; min-width: 16px; padding: 1px 5px; border-radius: var(--r-pill);
  background: var(--line); color: var(--ink-3);
  font: 500 9.5px/1.3 var(--font-mono); letter-spacing: 0; text-align: center;
}
.sim-pool-seg .seg-btn.active .seg-n { background: var(--sunken); color: var(--ink-2); }

/* targets */
.sweep-targets {
  display: flex; flex-wrap: wrap; gap: 5px;
  max-height: 208px; overflow-y: auto;
  padding: 6px; border-radius: var(--r);
  background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
}
.sweep-targets .hint { margin: 0; padding: 6px; font-size: 11.5px; }
.tgt-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 4px 3px 3px;
  border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--raised); color: var(--ink);
  font: 500 11px var(--font-mono);
  transition: border-color .14s var(--ease);
}
.tgt-chip:hover { border-color: var(--line-3); }
.tgt-chip .x {
  display: inline-grid; place-items: center; width: 18px; height: 18px;
  border-radius: 50%; color: var(--ink-3); cursor: pointer; line-height: 0;
}
.tgt-chip .x .ic { width: 12px; height: 12px; }
.tgt-chip .x:hover { color: var(--danger-text); background: var(--danger-soft); }
#app input.tgt-rpm-input, #app input.tgt-len-input {
  width: 46px; height: 22px; margin: 0; padding: 2px 4px; box-shadow: none;
  border-radius: var(--r-xs); border: 1px solid transparent;
  background: transparent; color: var(--ink);
  font: 600 11px var(--font-mono); text-align: right;
  -moz-appearance: textfield;
}
#app input.tgt-len-input { width: 42px; font-weight: 400; color: var(--ink-2); }
.tgt-rpm-input::-webkit-outer-spin-button, .tgt-rpm-input::-webkit-inner-spin-button,
.tgt-len-input::-webkit-outer-spin-button, .tgt-len-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#app input.tgt-rpm-input:hover, #app input.tgt-len-input:hover { border-color: var(--line-2); }
#app input.tgt-rpm-input:focus, #app input.tgt-len-input:focus { outline: none; border-color: var(--accent-line); background: var(--panel); box-shadow: none; }
.tgt-rpm-unit { margin-right: 2px; font: 400 9.5px var(--font-mono); color: var(--ink-3); }
.tgt-play {
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; padding: 0; margin: 0 1px;
  border: none; border-radius: 50%; background: transparent; color: var(--ink-2);
}
.tgt-play .ic { width: 11px; height: 11px; }
.tgt-play:hover { background: var(--hover); color: var(--ink); }
.tgt-play.playing { background: var(--accent); color: var(--accent-ink); }
.tgt-idle {
  margin: 0 2px; padding: 2px 5px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: transparent; color: var(--ink-3);
  font: 650 8.5px/1.2 var(--font-ui); font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .06em;
}
.tgt-idle:hover { color: var(--ink); border-color: var(--line-2); }
.tgt-idle.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tgt-chip.is-idle { border-color: var(--accent-line); }
.tgt-chip.is-locked { background: var(--sunken); }
#app .tgt-chip.is-locked input.tgt-rpm-input, #app .tgt-chip.is-locked input.tgt-len-input { color: var(--ink-2); }
#app input.tgt-rpm-input:disabled, #app input.tgt-len-input:disabled, .tgt-idle:disabled { opacity: .7; cursor: not-allowed; border-color: transparent; background: transparent; }
.tgt-lock { display: inline-grid; place-items: center; color: var(--ink-2); line-height: 0; cursor: default; }
.tgt-lock .ic { width: 13px; height: 13px; }

/* placement mode button: unmistakably ON */
button[data-action="sweep-add"].placing, [data-action="sweep-add"].active {
  background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink) !important;
}
[data-action="zc-loop"].active, [data-action="sweep-pick-range"].active {
  background: var(--primary) !important; border-color: var(--primary) !important; color: var(--primary-ink) !important;
}

.source-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.source-name {
  flex: 1; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--sunken); color: var(--ink);
  font: 500 11.5px var(--font-mono);
  white-space: nowrap; text-overflow: ellipsis; overflow: hidden;
}
.source-name.is-empty { color: var(--ink-3); }

/* ---------------------------------------------------------------- loop editor */
.wave-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.wave-toolbar .grow { flex: 1 1 0; min-width: 8px; }
.wave-toolbar .ck { white-space: nowrap; margin-left: 10px; }
.tb-label { margin: 0 2px 0 8px; font-size: 9.5px; font-weight: 650; color: var(--ink-3); }
.sep-v { width: 1px; height: 20px; margin: 0 6px; background: var(--line-2); }
.zc-controls {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--sunken);
}
.zc-controls.hidden { display: none; }
.zc-controls .zc-tag { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .07em; color: var(--ink); }
.zc-controls .slider-row { margin: 0; display: grid; grid-template-columns: 76px 150px 40px; align-items: center; gap: 8px; }
.zc-controls .zc-legend { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 11px; color: var(--ink-3); }
.zc-controls .zc-legend i { display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 3px; box-shadow: 0 0 0 1px var(--line-3); }
.zc-controls .zc-legend i.sw-b { background: color-mix(in srgb, var(--d-zc-b) 50%, var(--d-bg)); }
.zc-controls .zc-legend i.sw-seam { background: var(--d-zc-seam); }
.zc-controls .zc-legend i.sw-a { background: color-mix(in srgb, var(--d-zc-a) 32%, var(--d-bg)); }

.wave-stack { position: relative; flex: 1 1 auto; min-height: 140px; background: var(--d-bg); }
.wave-stack canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ruler { z-index: 1; height: 22px !important; top: 0; bottom: auto !important; }
/* below the 22 px ruler: 100% tall from there overflowed the stack by 22 px */
.wave { z-index: 2; top: 22px !important; height: calc(100% - 22px) !important; }
.overlay { z-index: 3; top: 22px !important; height: calc(100% - 22px) !important; pointer-events: auto; cursor: crosshair; }
/* playhead: moved with a transform, never repaints the canvases */
.wave-playhead {
  position: absolute; top: 22px; bottom: 0; left: -1px; z-index: 4;
  width: 2px; background: var(--d-play); pointer-events: none; will-change: transform;
}
.wave-playhead.band { left: 0; box-sizing: border-box; background: none; border-inline: 2px solid var(--d-play); }
.wave-playhead.band::before { content: ""; position: absolute; inset: 0; background: var(--d-play); opacity: .2; }
.wave-hscroll { position: relative; flex: 0 0 auto; height: 12px; background: var(--panel); border-top: 1px solid var(--line); }
.wave-hscroll.hidden { display: none; }
.wave-hscroll-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 100%;
  border-radius: var(--r-pill); background: var(--line-2); cursor: grab;
}
.wave-hscroll-thumb:hover { background: var(--line-3); }
.wave-hscroll-thumb.dragging { cursor: grabbing; background: var(--ink-3); }

.seam-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 0 0 auto;
  padding: 10px 12px;
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.view.view-loop { overflow-y: auto; overflow-x: hidden; }
.seam-card { padding: 12px 14px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--raised); }
.seam-card > .kv { flex-direction: row; justify-content: space-between; align-items: baseline; padding: 3px 0; }
.seam-card h3 { margin: 0 0 8px; }
.seam { display: block; width: 100%; height: 96px; border-radius: 8px; background: var(--d-bg); box-shadow: inset 0 0 0 1px var(--line); }
.seam-meta { display: flex; gap: 16px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- inspector */
.inspector { overflow-y: auto; }
.insp-block { padding: 16px 16px 14px; border-bottom: 1px solid var(--line); }
.insp-block h3 { margin: 0 0 12px; }
.form { display: grid; gap: 8px; }
.form.compact { grid-template-columns: 1fr 1fr; gap: 6px; }
.insp-block .form + .form.compact { margin-top: 12px; }
.insp-block .form.compact button { width: 100%; padding: 0 8px; }
.form label {
  display: grid; grid-template-columns: minmax(0, 92px) minmax(0, 1fr);
  align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2);
}
.form label > * { min-width: 0; }
.form label.ck { grid-template-columns: 1fr; display: flex; }
.form label.is-disabled { opacity: .4; pointer-events: none; }
.insp-block .kv, .insp-block .form > .kv { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 12px; padding: 2px 0; }
.insp-block .kv b { text-align: right; }
.insp-block .kv b.over { color: var(--danger-text); }
.insp-block .slider-row { margin-top: 10px; }

.slider-row {
  display: grid; grid-template-columns: minmax(0, 64px) minmax(0, 1fr) 52px;
  gap: 10px; align-items: center; margin-bottom: 6px;
  font-size: 12px; color: var(--ink-2);
}
.slider-row > * { min-width: 0; }
.slider-row.tight { margin-bottom: 4px; }
.slider-row.ctl-disabled { opacity: .4; pointer-events: none; }
.slider-row b { font: 500 11px var(--font-mono); color: var(--ink); text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------- loop bank */
.view-bank { padding: 0; overflow: hidden; }
/* a list of rows, not a display: page colour (it shares .sweep-left's layout) */
.bank-left.sweep-left { overflow-y: auto; overflow-x: hidden; padding: 12px 14px; background: var(--bg); }
.bank-list { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bank-grid.sweep-grid { grid-template-columns: minmax(0, 1fr) minmax(232px, 320px); }
.bank-empty { padding: 28px; text-align: center; font-size: 13px; color: var(--ink-3); }
.bank-item { display: block; }
.bank-row {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 7px 10px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--raised); cursor: pointer;
  transition: border-color .14s var(--ease), background-color .14s var(--ease);
}
.bank-row:hover { border-color: var(--line-3); }
.bank-row.active, .bank-item.open .bank-row { border-color: var(--ink); }
.bank-toggle { display: inline-grid; place-items: center; width: 16px; color: var(--ink-3); line-height: 0; }
.bank-toggle .ic { width: 14px; height: 14px; }
.bank-play {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--raised); color: var(--ink);
}
.bank-play .ic { width: 12px; height: 12px; }
.bank-play:hover { border-color: var(--line-3); }
.bank-play.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bank-name { flex: 1 1 64px; min-width: 52px; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-wave { flex: 1 3 110px; min-width: 40px; max-width: 160px; height: 34px; border-radius: 6px; background: var(--thumb-bg); box-shadow: inset 0 0 0 1px var(--line); }
.bank-rpm-wrap { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.bank-oct {
  height: 24px; padding: 0 7px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font: 500 10.5px var(--font-mono);
}
.bank-oct:hover { color: var(--ink); border-color: var(--line-3); }
#app input.bank-rpm {
  width: 68px; height: 26px; padding: 0 8px; text-align: right;
  border-radius: var(--r-sm); font: 600 12px var(--font-mono);
  -moz-appearance: textfield;
}
.bank-rpm::-webkit-outer-spin-button, .bank-rpm::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bank-unit { display: none; }
@media (max-width: 1300px) { .bank-row .bank-blend { display: none; } }
@media (max-width: 1120px) { .bank-row .bank-detect { display: none; } }
.bank-detect { height: 26px !important; padding: 0 10px !important; flex: 0 0 auto; }
.bank-blend { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; gap: 1px; min-width: 132px; line-height: 1.25; }
.bank-blend .bb-range { font: 600 11px var(--font-mono); color: var(--ink); }
.bank-blend .bb-cents { font: 400 10px var(--font-mono); color: var(--ink-3); }
.bank-blend-empty { align-items: flex-end; font-size: 10.5px; color: var(--ink-3); }
.bank-spectro-panel { max-height: 0; overflow: hidden; opacity: 0; transition: max-height .22s var(--ease), opacity .18s var(--ease), margin .22s var(--ease); }
.bank-item.open .bank-spectro-panel { max-height: 260px; opacity: 1; margin: 6px 0 6px; }
.bank-spectro-canvas { display: block; width: 100%; height: 230px; border-radius: var(--r); cursor: crosshair; background: var(--d-bg); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------------------------------------------------------------- combo engine */
.view-combo { padding: 16px 18px; overflow: auto; }
.combo-wrap { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.combo-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.combo-bar .hint { max-width: 540px; margin-top: 6px; }
.combo-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.combo-actions select { width: auto; }
.combo-stage { display: flex; gap: 14px; flex: 1; min-height: 0; }
.combo-pane { display: flex; flex-direction: column; min-height: 0; }
.combo-sandbox { flex: 0 0 286px; min-width: 0; }
.combo-build { flex: 1; min-width: 0; }
.combo-pane-h { overflow: hidden; white-space: nowrap; margin: 0 0 8px; }
.combo-pane-sub {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; font-weight: 400; font-stretch: 100%; text-transform: none; letter-spacing: 0; color: var(--ink-4);
}
.combo-pool {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border-radius: var(--r-lg); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line);
}
.combo-pool-empty { margin: auto; padding: 12px; text-align: center; font-size: 12px; color: var(--ink-3); }
.combo-chip {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 8px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--raised); cursor: grab;
  transition: border-color .14s var(--ease);
}
.combo-chip:hover { border-color: var(--line-3); }
.combo-chip.dragging { opacity: .4; }
.combo-chip.in-combo { opacity: .5; cursor: default; }
.combo-chip .chip-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.combo-chip .chip-play, .combo-chip .chip-rpm, .combo-chip .chip-src, .combo-chip .chip-add { flex: 0 0 auto; }
.combo-chip .chip-rpm { min-width: 42px; font: 600 12px var(--font-mono); color: var(--ink); }
.combo-chip .chip-src, .combo-card .cc-src { font-size: 8.5px; font-weight: 650; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.combo-chip .chip-add {
  display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: none; border-radius: 50%; background: var(--primary); color: var(--primary-ink);
}
.combo-chip .chip-add .ic { width: 13px; height: 13px; }
.combo-chip .chip-add:disabled { background: var(--sunken); color: var(--ink-3); cursor: default; opacity: 1; }
.combo-chip .chip-play, .combo-card .cc-play {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 24px; height: 24px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-2); background: var(--raised); color: var(--ink);
}
.combo-chip .chip-play .ic, .combo-card .cc-play .ic { width: 11px; height: 11px; }
.combo-chip .chip-play:hover, .combo-card .cc-play:hover { border-color: var(--line-3); }
.combo-chip .chip-play.playing, .combo-card .cc-play.playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.combo-card .cc-play { width: 22px; height: 22px; }
.combo-dropzone {
  flex: 1; min-height: 150px; min-width: 0;
  display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start;
  padding: 12px; border-radius: var(--r-lg);
  border: 1px dashed var(--line-3); background: transparent;
  overflow-y: auto; overflow-x: hidden;
  transition: background-color .14s var(--ease), border-color .14s var(--ease);
}
.combo-dropzone.drag-over { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.combo-dropzone:empty::before, .combo-dropzone .combo-empty { content: ""; margin: auto; align-self: center; font-size: 13px; color: var(--ink-3); }
.combo-card {
  position: relative; flex: 0 0 188px; display: flex; flex-direction: column; gap: 5px;
  padding: 10px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--raised); cursor: grab;
  transition: border-color .14s var(--ease);
}
.combo-card:hover { border-color: var(--line-3); }
.combo-card.dragging { opacity: .4; }
.combo-card .cc-top { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.combo-card .cc-rpm { font: 600 14px var(--font-mono); color: var(--ink); }
.combo-card canvas { width: 100%; height: 34px; border-radius: 6px; background: var(--thumb-bg); }
.combo-card .cc-blend { font: 400 10px var(--font-mono); color: var(--ink-3); }
.combo-card .cc-del {
  position: absolute; top: 6px; right: 6px;
  display: grid; place-items: center; width: 22px; height: 22px; padding: 0;
  border: none; border-radius: 50%; background: transparent; color: var(--ink-3);
}
.combo-card .cc-del .ic { width: 13px; height: 13px; }
.combo-card .cc-del:hover { color: var(--danger-text); background: var(--danger-soft); }

/* ---------------------------------------------------------------- middleware export */
.view-wwise { overflow: auto; padding: 28px 24px; }
.wwise-export-view { max-width: 580px; margin: 0 auto; }
.ww-block { padding: 20px 22px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--raised); }
.ww-block h3 { margin: 0 0 16px; }
.inspector .ww-block { border: none; border-radius: 0; background: transparent; padding: 16px; }
.ww-group { display: flex; flex-direction: column; gap: 10px; }
.ww-group + .ww-group { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.ww-field { display: grid; grid-template-columns: minmax(0, 136px) minmax(0, 1fr); align-items: center; gap: 12px; }
.ww-field > * { min-width: 0; }
.ww-field > label { font-size: 12px; color: var(--ink-2); }
.ww-block input[type="checkbox"] { width: 15px; }
.ww-actions { display: flex; gap: 8px; margin-top: 4px; }
.ww-actions button { flex: 1; }
.ww-stat { display: flex; justify-content: space-between; align-items: baseline; font-size: 12px; }
.ww-stat > span { font-size: 12px; color: var(--ink-2); }
.ww-stat b { font: 500 12px var(--font-mono); color: var(--ink); }
.ww-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.ww-note { margin: -2px 0 2px; font-size: 11.5px; color: var(--ink-3); }
.ww-block .full { width: 100%; height: 36px; margin-top: 18px; }
.ww-block #ww-hint { margin-top: 12px; }
.ww-origin-help code { font: 500 11px var(--font-mono); color: var(--ink); overflow-wrap: anywhere; }
.ww-origin-help[hidden] { display: none; }
.wwise-fmod-note { margin-top: 16px; text-align: center; opacity: .6; }

/* ---------------------------------------------------------------- engine simulator */
.sim-grid { flex: 1; display: grid; grid-template-columns: 1fr 324px; gap: 12px; padding: 12px; min-height: 0; }
.sim-curve-card, .sim-controls {
  display: flex; flex-direction: column;
  padding: 14px 16px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--raised);
}
.sim-controls { overflow-y: auto; }
.sim-curve-card h3, .sim-controls h3 { margin: 0 0 10px; }
#sim-curve { width: 100%; flex: 1; min-height: 0; border-radius: var(--r); background: var(--d-bg); box-shadow: inset 0 0 0 1px var(--line); }
.sim-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; font: 500 11px var(--font-mono); }
.sim-legend .lg { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.sim-legend .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.big-rpm { padding: 16px 12px 14px; margin-bottom: 12px; border-radius: var(--r); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.rpm-num { font: 500 46px/1 var(--font-mono); letter-spacing: -.04em; color: var(--ink); }
.rpm-num em { margin-left: 8px; font: 650 10px var(--font-ui); font-style: normal; font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); }
.rpm-bar { height: 4px; margin-top: 14px; border-radius: 2px; background: var(--line); overflow: hidden; }
#rpm-bar-fill {
  height: 100%; width: 100%;
  background: var(--accent);
  clip-path: inset(0 90% 0 0); transition: clip-path 50ms linear;
}
.sim-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.sim-block h4 { margin: 0 0 10px; }
.sim-buttons { display: flex; gap: 6px; margin-top: 12px; }
.sim-buttons button { flex: 1; height: 36px !important; }
.sim-sample-list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.sim-sample-list label {
  display: grid; grid-template-columns: 18px 1fr auto auto; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-size: 12px; cursor: pointer;
  transition: border-color .14s var(--ease);
}
.sim-sample-list label:hover { border-color: var(--line-3); }
.sim-sample-list .sim-cand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sim-sample-list .rpm-tag { font: 500 11px var(--font-mono); color: var(--ink-2); }
.sim-cand-head { margin: 10px 0 2px; font-size: 9.5px; font-weight: 650; color: var(--ink-3); }
.sim-cand-head:first-child { margin-top: 0; }
.sim-solo {
  height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
  font: 650 9px var(--font-ui); font-stretch: var(--wide); text-transform: uppercase; letter-spacing: .06em;
}
.sim-solo:hover { color: var(--ink); border-color: var(--line-3); }

/* ---------------------------------------------------------------- spectrum (legacy view) */
.spec-grid { flex: 1; display: grid; grid-template-rows: 1fr 1fr auto; gap: 10px; padding: 10px; min-height: 0; }
.spec-card { display: flex; flex-direction: column; min-height: 0; padding: 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--raised); }
.spec-card h3 { margin: 0 0 8px; font-size: 9.5px; font-weight: 650; color: var(--ink-3); }
.spec-card canvas { width: 100%; flex: 1; min-height: 0; border-radius: var(--r); background: var(--d-bg); }
.spec-meta { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--raised); }
.statusbar { display: flex; align-items: center; gap: 18px; padding: 0 12px; font: 400 11px var(--font-mono); color: var(--ink-3); background: var(--panel); border-top: 1px solid var(--line); }
.statusbar .grow { flex: 1; }

/* ---------------------------------------------------------------- dialogs */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: modalFade .16s var(--ease);
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog {
  width: min(440px, 90vw);
  padding: 22px 22px 18px;
  border-radius: 18px; border: 1px solid var(--line);
  background: var(--raised); color: var(--ink);
  box-shadow: var(--shadow-pop);
  animation: modalRise .22s var(--ease);
}
@keyframes modalRise { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-title { margin-bottom: 10px; font-size: 12px; font-weight: 750; font-stretch: 125%; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.modal-body { font-size: 13px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.modal-btn { height: 32px !important; padding: 0 16px !important; }
.modal-ok.danger { background: var(--danger) !important; border-color: var(--danger) !important; color: var(--danger-ink) !important; }
.about-dialog { max-width: 400px; }
.about-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.about-head .mark { height: 26px; gap: 3px; }
.about-head .mark i { width: 5px; }
.about-name { font-size: 14px; font-weight: 750; font-stretch: 125%; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.about-ver { margin-top: 2px; font: 400 11px var(--font-mono); color: var(--ink-3); }
.about-desc { margin: 0 0 14px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.about-rows { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.about-rows .kv { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; }
.about-rows .kv > span { flex: 0 0 auto; }
.about-rows .kv > b { min-width: 0; text-align: right; word-break: break-word; font: 500 12px var(--font-ui); color: var(--ink); }
.about-handle { font-weight: 400; color: var(--ink-3); }
.about-rows a { color: var(--accent); text-decoration: none; }
.about-rows a:hover { text-decoration: underline; text-underline-offset: 3px; }
.about-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; line-height: 1.5; color: var(--ink-3); }
.about-license { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.about-license b { font-weight: 650; color: var(--ink); }
.modal-body.rich { white-space: normal; }
.modal-actions .grow { flex: 1; }
.modal-dialog.busy { cursor: progress; }

/* ---------------------------------------------------------------- license
   The pill in the top bar, the License dialog, the "new version" notice. One
   accent: the dot of an active license and links; everything else is ink. */
.license-pill { flex: 0 0 auto; gap: 8px; padding: 0 13px 0 11px; background: transparent; color: var(--ink-2); }
.license-pill .lp-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--ink-4); }
.license-pill[data-tone="on"] { color: var(--ink); }
.license-pill[data-tone="on"] .lp-dot { border-color: var(--accent); background: var(--accent); }
.license-pill[data-tone="warn"] { color: var(--warn-text); }
.license-pill[data-tone="warn"] .lp-dot { border-color: var(--m-3); background: var(--m-3); }

.modal-dialog.license-dialog { width: min(470px, 92vw); max-height: min(88vh, 860px); overflow-y: auto; }
.modal-dialog.license-dialog.wide { width: min(720px, 94vw); }
.license-dialog .modal-actions { flex-wrap: wrap; }
.lic { display: flex; flex-direction: column; gap: 12px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.lic p { margin: 0; }
.lic-lead { font-size: 13px; color: var(--ink-2); }
.lic-meta, .lic-help, .lic-foot { font-size: 12px; color: var(--ink-3); }
.lic-notice, .lic-error { padding: 9px 12px; border-radius: var(--r); background: var(--danger-soft); color: var(--danger-text); font-size: 12.5px; }
.lic-ok { padding: 9px 12px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink); font-size: 12.5px; }
.lic-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lic-plans.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lic-plan { display: flex; flex-direction: column; gap: 6px; padding: 14px 14px 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); }
.lp-name { font-size: 11px; font-weight: 750; font-stretch: 125%; text-transform: uppercase; letter-spacing: .05em; color: var(--ink); }
.lp-price { font-size: 21px; font-weight: 650; line-height: 1.1; color: var(--ink); }
.lp-lines { flex: 1; display: flex; flex-direction: column; gap: 3px; margin: 2px 0 8px; padding: 0; list-style: none; font-size: 12px; line-height: 1.4; color: var(--ink-2); }
.lp-lines li { padding-left: 12px; text-indent: -12px; }
.lp-lines li::before { content: "\2013"; display: inline-block; width: 12px; text-indent: 0; color: var(--ink-4); }
.lic-plan .lp-buy { align-self: stretch; }
.lic-sep { display: flex; align-items: center; gap: 10px; margin-top: 2px; font-size: 10px; font-weight: 650; font-stretch: 112%; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.lic-sep::before, .lic-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lic-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto; gap: 8px; align-items: end; }
.lic-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 12px; color: var(--ink-2); }
.lic-input {
  height: 30px; width: 100%; min-width: 0; padding: 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--raised); color: var(--ink); font: 500 12px var(--font-ui);
  transition: border-color .14s var(--ease), box-shadow .14s var(--ease);
}
.lic-input:hover { border-color: var(--line-3); }
.lic-input:focus { outline: none; border-color: var(--accent-line); box-shadow: var(--focus-ring); }
.lic-input.mono { font: 500 12px var(--font-mono); letter-spacing: .02em; }
.lic-input::placeholder { color: var(--ink-4); }
.lic-row { display: flex; gap: 8px; }
.lic-row .lic-input { flex: 1; }
.lic-recover { display: flex; flex-direction: column; gap: 8px; }
.linkish { padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; }
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }
.lic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.lh-plan { font-size: 16px; font-weight: 750; font-stretch: 125%; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.lh-email { min-width: 0; overflow-wrap: anywhere; text-align: right; font: 500 12px var(--font-mono); color: var(--ink-2); }
.lic-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; font-size: 12.5px; color: var(--ink-2); }
.lic-status.warn { color: var(--warn-text); }
.lic-subhead { margin-bottom: 6px; font-size: 10px; font-weight: 650; font-stretch: 112%; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.lic-devblock { display: flex; flex-direction: column; gap: 6px; }
.lic-devices { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.lic-device { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; background: var(--raised); }
.lic-device + .lic-device { border-top: 1px solid var(--line); }
.ld-main { flex: 1; min-width: 0; }
.ld-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.ld-meta { font-size: 11.5px; color: var(--ink-3); }
.ld-tag { flex: 0 0 auto; padding-right: 6px; font-size: 10px; font-weight: 650; font-stretch: 112%; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.lic-passes { display: flex; flex-direction: column; gap: 8px; }
.lps-count { font-size: 13px; font-weight: 650; color: var(--ink); }
.lps-used { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.lps-used li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--raised); }
.lps-used li + li { border-top: 1px solid var(--line); }
.lpu-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.lpu-meta { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3); }
@media (max-width: 680px) {
  .lic-plans, .lic-plans.two { grid-template-columns: minmax(0, 1fr); }
  .lic-form { grid-template-columns: minmax(0, 1fr); }
}

.app-toast {
  position: fixed; right: 16px; bottom: 40px; z-index: 900;
  display: flex; align-items: center; gap: 14px;
  max-width: min(560px, calc(100vw - 32px)); padding: 10px 10px 10px 16px;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--raised);
  box-shadow: var(--shadow-pop); color: var(--ink); font-size: 12.5px; line-height: 1.45;
  animation: modalRise .22s var(--ease);
}
.at-text { min-width: 0; }
.at-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
