/* ======================================================================
   WAVELENGTH — design tokens and components
   ====================================================================== */
:root {
  --font-body: 'Switzer', 'Inter', 'Helvetica Neue', sans-serif;
  --font-mono: 'JetBrains Mono', 'Menlo', monospace;

  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.375rem, 1.1rem + 0.9vw, 1.875rem);

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem; --space-10: 2.5rem; --space-12: 3rem;

  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-xl: 14px; --radius-full: 9999px;

  --hdr-w: 224px;
  --lane-h: 76px;
  --ruler-h: 30px;
  --tap: 36px;
}

/* Dark (studio) theme: default */
:root, [data-theme="dark"] {
  --color-bg: #15152A;
  --color-surface: #1B1B33;
  --color-surface-2: #222240;
  --color-surface-3: #2A2A4C;
  --color-border: #2E2E52;
  --color-border-subtle: #252546;
  --color-text: #E6E6F5;
  --color-text-muted: #9A9ABF;
  --color-text-faint: #6C6C94;
  --color-primary: #00D4FF;
  --color-primary-hover: #4CE1FF;
  --color-on-primary: #04212B;
  --color-green: #00FF87;
  --color-orange: #FF6B35;
  --color-pink: #FF3E8A;
  --color-yellow: #FFD166;
  --color-red: #FF3B30;
  --color-red-dim: rgba(255, 59, 48, 0.15);
  --grid-line: rgba(255, 255, 255, 0.06);
  --grid-strong: rgba(255, 255, 255, 0.1);
  --knob-bg: #24244A;
  --knob-border: #3A3A64;
  --lane-alt: rgba(255, 255, 255, 0.015);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}
[data-theme="light"] {
  --color-bg: #EEF0F6;
  --color-surface: #FFFFFF;
  --color-surface-2: #F4F5FA;
  --color-surface-3: #E7E9F2;
  --color-border: #D5D8E5;
  --color-border-subtle: #E3E5EF;
  --color-text: #17172B;
  --color-text-muted: #5A5C78;
  --color-text-faint: #8A8CA6;
  --color-primary: #0077C8;
  --color-primary-hover: #00649F;
  --color-on-primary: #FFFFFF;
  --color-green: #00A35A;
  --color-orange: #D9531E;
  --color-pink: #D72264;
  --color-yellow: #C98A00;
  --color-red: #D93025;
  --color-red-dim: rgba(217, 48, 37, 0.1);
  --grid-line: rgba(20, 20, 60, 0.07);
  --grid-strong: rgba(20, 20, 60, 0.12);
  --knob-bg: #EDEEF6;
  --knob-border: #C9CCDC;
  --lane-alt: rgba(20, 20, 60, 0.02);
  --shadow-sm: 0 1px 3px rgba(20, 20, 60, 0.08);
  --shadow-md: 0 6px 20px rgba(20, 20, 60, 0.1);
  --shadow-lg: 0 18px 50px rgba(20, 20, 60, 0.18);
  color-scheme: light;
}

body { font-size: var(--text-base); }
[hidden] { display: none !important; }
button:disabled { opacity: 0.42; cursor: not-allowed; }

/* ================================================================ APP SHELL */
.app-shell { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; position: relative; }

.app-bar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  height: 52px; padding: 0 var(--space-3) 0 var(--space-2);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  flex-shrink: 0; z-index: 40;
}
.app-bar__left, .app-bar__right { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.app-bar__center { flex: 1; min-width: 0; display: flex; justify-content: center; }
.app-logo { display: flex; align-items: center; gap: var(--space-2); padding: 4px 8px; border-radius: var(--radius-md); min-height: 40px; }
.app-logo:hover { background: var(--color-surface-2); }
.app-logo__text { font-weight: 650; font-size: var(--text-base); letter-spacing: 0.01em; }
.project-title-btn {
  display: inline-flex; align-items: center; gap: var(--space-2); max-width: 100%;
  padding: 6px 12px; border-radius: var(--radius-md); min-height: 40px;
  font-size: var(--text-sm); font-weight: 550; color: var(--color-text-muted);
}
.project-title-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-title-btn svg { flex-shrink: 0; opacity: 0; transition: opacity 150ms; }
.project-title-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.project-title-btn:hover svg, .project-title-btn:focus-visible svg { opacity: 0.8; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: var(--radius-md); color: var(--color-text-muted);
}
.icon-btn:hover { color: var(--color-text); background: var(--color-surface-2); }
.icon-btn--danger:hover { color: var(--color-red); background: var(--color-red-dim); }

.view { display: none; flex: 1; min-height: 0; overflow: hidden; }
.view.active { display: flex; }
/* scrolling screens are plain blocks so their content never gets squeezed */
.view--library.active, .view--recording.active, .view--effects.active, .view--export.active, .view--mobile.active { display: block; overflow-y: auto; }

.screen-nav {
  display: flex; align-items: stretch; justify-content: center; gap: var(--space-1);
  height: 58px; padding: 4px var(--space-2) max(4px, env(safe-area-inset-bottom));
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  flex-shrink: 0; z-index: 40;
}
.screen-nav__btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 68px; padding: 0 var(--space-3); border-radius: var(--radius-md);
  font-size: var(--text-2xs); font-weight: 550; color: var(--color-text-faint); letter-spacing: 0.02em;
}
.screen-nav__btn:hover { color: var(--color-text-muted); background: var(--color-surface-2); }
.screen-nav__btn.active { color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, transparent); }

/* ================================================================ BUTTONS & FIELDS */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.btn--primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn--primary:hover { background: var(--color-primary-hover); }
.btn--record { background: var(--color-red); color: #fff; }
.btn--record:hover { background: #ff5a50; }
.btn--secondary { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }
.btn--secondary:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn--ghost { background: transparent; color: var(--color-primary); border-color: var(--color-border); }
.btn--ghost:hover:not(:disabled) { background: var(--color-surface-2); border-color: var(--color-primary); }
.btn--danger-ghost { background: transparent; color: var(--color-red); border-color: color-mix(in srgb, var(--color-red) 40%, transparent); }
.btn--danger-ghost:hover { background: var(--color-red-dim); }
.btn--sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn--lg { min-height: 50px; font-size: var(--text-base); }
.btn--full { width: 100%; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.25); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; }
.field > span, .field > legend { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); display: flex; justify-content: space-between; gap: var(--space-2); }
.field small { font-weight: 400; color: var(--color-text-faint); }
.field output { font-family: var(--font-mono); font-weight: 500; color: var(--color-text); }
.field input:not([type=range]):not([type=checkbox]):not([type=radio]), .field select, .field textarea,
.select-field select, .chapter-row input, .search-field input {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--color-text);
}
.field textarea { resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .chapter-row input:focus, .search-field input:focus, .select-field select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 22%, transparent); }
input[type=range] { accent-color: var(--color-primary); min-height: 24px; cursor: pointer; }
.select-field { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.select-field select { width: auto; min-width: 140px; }
.select-field--inline select { min-width: 150px; }
.field-error { color: var(--color-red); font-size: var(--text-xs); }

.toggle-switch { position: relative; display: inline-flex; width: 40px; height: 22px; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle-switch__slider { position: absolute; inset: 0; border-radius: var(--radius-full); background: var(--color-surface-3); border: 1px solid var(--color-border); transition: background 180ms; }
.toggle-switch__slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--color-text-muted); transition: transform 180ms, background 180ms; }
.toggle-switch input:checked + .toggle-switch__slider { background: var(--color-primary); border-color: var(--color-primary); }
.toggle-switch input:checked + .toggle-switch__slider::after { transform: translateX(18px); background: #fff; }
.toggle-switch input:focus-visible + .toggle-switch__slider { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-switch__slider { opacity: 0.4; }
.toggle-line { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: 44px; font-size: var(--text-sm); cursor: pointer; }
.toggle-line > span:first-child { display: flex; flex-direction: column; }
.toggle-line small { color: var(--color-text-faint); font-size: var(--text-xs); }

.title-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tab-color, var(--color-primary)); flex-shrink: 0; }
.view-title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
.view-sub { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: 4px; }
.card-title { font-size: var(--text-base); font-weight: 650; display: flex; align-items: center; gap: var(--space-2); }
.count-pill { font-size: var(--text-2xs); font-weight: 650; padding: 2px 8px; border-radius: var(--radius-full); background: var(--color-surface-3); color: var(--color-text-muted); }
.panel-empty { color: var(--color-text-muted); font-size: var(--text-sm); padding: var(--space-4); text-align: center; }
.panel-empty strong { color: var(--color-text); display: block; margin-bottom: 4px; }
.panel-empty--card { border: 1px dashed var(--color-border); border-radius: var(--radius-lg); }
.grid-line { stroke: var(--grid-line); stroke-width: 1; }
.grid-line.dashed { stroke-dasharray: 3 4; }
.axis-label { fill: var(--color-text-faint); font: 500 10px var(--font-mono); }

/* ================================================================ LIBRARY */
.view--library { flex-direction: column; overflow-y: auto; }
.library { width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--space-8) clamp(16px, 3vw, 48px) var(--space-12); }
.library__header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-5); }
.library__title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.01em; }
.library__stats { color: var(--color-text-muted); font-size: var(--text-sm); margin-top: 4px; }
.library__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.library__toolbar { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-5); flex-wrap: wrap; }
.search-field { position: relative; flex: 1 1 260px; max-width: 420px; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-text-faint); pointer-events: none; }
.search-field input { padding-left: 36px; min-height: 44px; }
.library__toolbar .select-field select { min-height: 44px; }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--space-4); }
.project-card {
  position: relative; display: flex; flex-direction: column; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl); overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--color-primary) 60%, var(--color-border)); }
.project-card__open { display: flex; flex-direction: column; text-align: left; width: 100%; }
.project-card__art {
  height: 112px; display: flex; align-items: center; padding: 18px 16px;
  background: radial-gradient(120% 140% at 0% 0%, var(--c1) 0%, transparent 55%), linear-gradient(135deg, var(--c2), color-mix(in srgb, var(--c2) 40%, #000));
}
.project-card__art svg { width: 100%; height: 64px; }
.project-card__art path { stroke: rgba(255, 255, 255, 0.85); stroke-width: 1.2; vector-effect: non-scaling-stroke; fill: none; }
.project-card__info { display: flex; flex-direction: column; gap: 3px; padding: var(--space-3) var(--space-4) var(--space-4); }
.project-card__show { font-size: var(--text-2xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-faint); }
.project-card__title { font-size: var(--text-base); font-weight: 650; line-height: 1.3; padding-right: 8px; }
.project-card__meta { display: flex; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.meta-sep { opacity: 0.45; }
.project-card__menu {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border-radius: var(--radius-md);
  display: grid; place-items: center; color: #fff; background: rgba(0, 0, 0, 0.28); backdrop-filter: blur(6px);
}
.project-card__menu:hover, .project-card__menu[aria-expanded="true"] { background: rgba(0, 0, 0, 0.5); }
.project-card--new {
  align-items: center; justify-content: center; gap: 6px; min-height: 210px; border-style: dashed;
  background: transparent; color: var(--color-text-muted);
}
.project-card--new:hover { color: var(--color-primary); }
.project-card__plus { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface-2); margin-bottom: 6px; }
.project-card__label { font-weight: 650; font-size: var(--text-base); color: var(--color-text); }
.project-card__hint { font-size: var(--text-xs); color: var(--color-text-faint); }
.empty-state { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); padding: var(--space-10) var(--space-4); color: var(--color-text-muted); text-align: center; border: 1px dashed var(--color-border); border-radius: var(--radius-xl); }
.empty-state strong { color: var(--color-text); }

/* ================================================================ EDITOR */
.view--editor { flex-direction: column; }
.transport {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  min-height: 56px; padding: 6px var(--space-3); flex-shrink: 0;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.transport__controls, .transport__tools { display: flex; align-items: center; gap: 2px; }
.transport__tools { margin-left: auto; }
.tool-sep { width: 1px; height: 22px; background: var(--color-border); margin: 0 6px; }
.transport-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--radius-md); color: var(--color-text-muted);
}
.transport-btn:hover:not(:disabled) { color: var(--color-text); background: var(--color-surface-2); }
.transport-btn--text { width: auto; padding: 0 10px; font-size: var(--text-xs); font-weight: 650; }
.transport-btn--play { width: 44px; height: 44px; margin: 0 4px; background: var(--color-primary); color: var(--color-on-primary); border-radius: 50%; }
.transport-btn--play:hover:not(:disabled) { background: var(--color-primary-hover); color: var(--color-on-primary); }
.icon-pause { display: none; }
.is-playing .icon-play { display: none; }
.is-playing .icon-pause { display: block; }
.is-playing .transport-btn--play { background: var(--color-orange); }
.transport-btn--record { color: var(--color-red); }
.transport-btn--record:hover { background: var(--color-red-dim) !important; color: var(--color-red) !important; }
.transport__time { display: flex; align-items: baseline; gap: 8px; }
.timecode { font-family: var(--font-mono); font-size: 1.375rem; font-weight: 500; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.timecode__ms { font-size: 0.8125rem; color: var(--color-text-muted); }
.transport__length { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-faint); }
.master-meter { display: flex; flex-direction: column; gap: 3px; width: 96px; }
.master-meter__bar { height: 5px; border-radius: 3px; background: var(--color-surface-3); overflow: hidden; }
.master-meter__bar i { display: block; height: 100%; clip-path: inset(0 100% 0 0); background: linear-gradient(90deg, var(--color-green) 0 65%, var(--color-yellow) 65% 85%, var(--color-red) 85%); }
.zoom-slider { width: 110px; }

.editor { flex: 1; min-height: 160px; display: flex; overflow: hidden; }
.timeline-scroll { flex: 1; min-width: 0; overflow: auto; position: relative; background: var(--color-bg); overscroll-behavior: contain; }
.timeline-grid { display: flex; width: max-content; min-width: 100%; min-height: 100%; }
.track-headers {
  position: sticky; left: 0; z-index: 25; flex: none; width: var(--hdr-w);
  background: var(--color-surface); border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
}
.track-header-corner {
  position: sticky; top: 0; z-index: 2; height: var(--ruler-h); flex: none;
  display: flex; align-items: center; padding: 0 var(--space-3);
  font-size: var(--text-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-faint);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
}
.track-header {
  display: flex; height: var(--lane-h); flex: none; padding: 8px 10px 8px 8px; gap: 8px;
  border-bottom: 1px solid var(--color-border-subtle); cursor: default;
}
.track-header.selected { background: color-mix(in srgb, var(--track-color) 8%, var(--color-surface)); }
.track-header__color { width: 4px; border-radius: 2px; background: var(--track-color); flex-shrink: 0; }
.track-header.is-silent .track-header__color { opacity: 0.35; }
.track-header__main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.track-header__top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.track-name {
  flex: 1; min-width: 0; text-align: left; font-size: var(--text-sm); font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 4px; margin-left: -4px; border-radius: var(--radius-sm);
}
.track-name:hover { background: var(--color-surface-2); }
.track-header.is-silent .track-name { color: var(--color-text-faint); }
.track-meter { width: 5px; height: 22px; border-radius: 3px; background: color-mix(in srgb, var(--color-surface-3) 60%, transparent); overflow: hidden; display: flex; align-items: flex-end; flex-shrink: 0; }
.track-meter i { display: block; width: 100%; height: 100%; clip-path: inset(100% 0 0 0); background: linear-gradient(0deg, var(--color-green) 0 65%, var(--color-yellow) 65% 85%, var(--color-red) 85%); }
.track-header__controls { display: flex; align-items: center; gap: 5px; }
.track-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; flex-shrink: 0;
  border-radius: var(--radius-sm); font-size: 11px; font-weight: 750; background: var(--color-surface-3); color: var(--color-text-muted);
}
.track-btn:hover { color: var(--color-text); }
.track-btn--solo.active { background: #F2C230; color: #2A2000; }
.track-btn--mute.active { background: var(--color-red); color: #fff; }
.volume-slider { flex: 1; min-width: 0; width: 60px; height: 24px; }
.fx-badge { flex-shrink: 0; font-size: 10px; font-weight: 750; letter-spacing: 0.04em; padding: 5px 7px; border-radius: var(--radius-sm); background: var(--track-color); color: #0B0B1A; }
.fx-badge.off { background: var(--color-surface-3); color: var(--color-text-faint); }
.add-track {
  display: flex; align-items: center; gap: 8px; height: 52px; flex: none; padding: 0 var(--space-4);
  font-size: var(--text-xs); font-weight: 650; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border-subtle);
}
.add-track:hover { color: var(--color-primary); background: var(--color-surface-2); }

.timeline { position: relative; flex: none; min-height: 100%; }
.time-ruler {
  position: sticky; top: 0; z-index: 20; height: var(--ruler-h);
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono); font-size: 10px; color: var(--color-text-faint); cursor: col-resize;
}
.time-ruler__tick { position: absolute; bottom: 0; width: 1px; height: 6px; background: var(--color-border); }
.time-ruler__tick--major { height: 12px; background: var(--color-text-faint); }
.time-ruler__mark { position: absolute; top: 3px; transform: translateX(4px); white-space: nowrap; pointer-events: none; }
.chapter-flag {
  position: absolute; top: 15px; height: 14px; display: flex; align-items: center; max-width: 160px;
  padding: 0 6px 0 5px; border-left: 2px solid var(--color-yellow); font: 600 9.5px var(--font-body);
  color: var(--color-yellow); background: color-mix(in srgb, var(--color-yellow) 12%, var(--color-surface)); border-radius: 0 3px 3px 0; z-index: 2;
}
.chapter-flag span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-flag.is-tight span { display: none; }
.chapter-flag.is-tight { padding: 0 4px; }
.chapter-flag:hover { background: color-mix(in srgb, var(--color-yellow) 25%, var(--color-surface)); z-index: 3; max-width: 260px; }
.ruler-head { position: absolute; bottom: 0; width: 0; height: 0; transform: translateX(-6px); border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 9px solid var(--color-red); z-index: 4; pointer-events: none; }

.lanes { position: relative; }
.track-lane {
  position: relative; height: var(--lane-h); border-bottom: 1px solid var(--color-border-subtle);
  background-image: linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
}
.track-lane:nth-child(even) { background-color: var(--lane-alt); }
.track-lane.selected { background-color: color-mix(in srgb, var(--clip-color) 4%, transparent); }
.track-lane.is-silent .audio-clip { opacity: 0.35; filter: saturate(0.4); }
.lane-spacer { height: 52px; }
.lane-empty { position: sticky; left: 12px; display: inline-flex; align-items: center; height: 100%; padding-left: 12px; font-size: var(--text-xs); color: var(--color-text-faint); font-style: italic; }
.audio-clip {
  position: absolute; top: 5px; bottom: 5px; border-radius: var(--radius-md); overflow: hidden; cursor: grab;
  background: color-mix(in srgb, var(--clip-color) 13%, var(--color-bg));
  border: 1px solid color-mix(in srgb, var(--clip-color) 35%, transparent);
  touch-action: pan-x pan-y; transition: border-color 120ms, box-shadow 120ms;
}
.audio-clip:hover { border-color: var(--clip-color); }
.audio-clip.is-selected { border-color: var(--clip-color); box-shadow: 0 0 0 2px var(--clip-color), 0 6px 18px rgba(0, 0, 0, 0.3); touch-action: none; z-index: 2; }
.audio-clip.dragging { cursor: grabbing; opacity: 0.9; z-index: 3; }
.audio-clip:focus-visible { outline: 2px solid var(--color-text); outline-offset: 1px; }
.waveform { position: absolute; inset: 0; width: 100%; height: 100%; }
.waveform-path { stroke: var(--clip-color); stroke-width: 1.4px; vector-effect: non-scaling-stroke; opacity: 0.4; fill: none; }
.waveform-rms { stroke: var(--clip-color); stroke-width: 1.4px; vector-effect: non-scaling-stroke; opacity: 0.95; fill: none; }
.clip-label {
  position: absolute; top: 3px; left: 6px; max-width: calc(100% - 12px); overflow: hidden; text-overflow: ellipsis;
  font-size: 10px; font-weight: 600; color: var(--clip-color); white-space: nowrap; pointer-events: none;
  text-shadow: 0 0 4px var(--color-bg), 0 0 2px var(--color-bg);
}
.clip-fade { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.clip-fade--in { left: 0; background: linear-gradient(to top right, color-mix(in srgb, var(--color-bg) 70%, transparent) 50%, transparent 50%); }
.clip-fade--out { right: 0; background: linear-gradient(to top left, color-mix(in srgb, var(--color-bg) 70%, transparent) 50%, transparent 50%); }
.playhead { position: absolute; top: 0; bottom: 0; left: 0; width: 0; z-index: 15; pointer-events: none; will-change: transform; }
.playhead__head { display: none; }
.playhead__line { position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: var(--color-red); box-shadow: 0 0 8px rgba(255, 59, 48, 0.45); }

/* clip bar */
.clip-bar {
  display: flex; align-items: center; gap: var(--space-3); padding: 6px var(--space-3); flex-shrink: 0;
  background: color-mix(in srgb, var(--clip-color) 8%, var(--color-surface)); border-top: 1px solid var(--color-border);
}
.clip-bar[hidden] { display: none; }
.clip-bar__info { display: flex; align-items: center; gap: var(--space-2); min-width: 0; font-size: var(--text-xs); }
.clip-bar__info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; font-size: var(--text-sm); }
.clip-bar__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clip-color); flex-shrink: 0; }
.clip-bar__time { font-family: var(--font-mono); color: var(--color-text); white-space: nowrap; }
.clip-bar__len { color: var(--color-text-muted); white-space: nowrap; }
.clip-bar__actions { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 10px; flex-shrink: 0;
  border-radius: var(--radius-md); background: var(--color-surface-2); border: 1px solid var(--color-border);
  font-size: var(--text-xs); font-weight: 600; color: var(--color-text);
}
.chip-btn:hover:not(:disabled) { border-color: var(--clip-color, var(--color-primary)); }
.chip-btn.on { background: color-mix(in srgb, var(--clip-color) 22%, var(--color-surface-2)); border-color: var(--clip-color); }
.chip-btn--danger { color: var(--color-red); }
.chip-btn--icon { width: 34px; padding: 0; justify-content: center; }

/* bottom panel */
.bottom-panel { flex-shrink: 0; display: flex; flex-direction: column; background: var(--color-surface); border-top: 1px solid var(--color-border); }
.bottom-panel__tabs { display: flex; align-items: stretch; gap: 2px; padding: 0 var(--space-2); border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.panel-tab { position: relative; min-height: 42px; padding: 0 var(--space-4); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.panel-tab:hover { color: var(--color-text); }
.panel-tab.active { color: var(--color-primary); }
.panel-tab.active::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-primary); }
.panel-collapse { margin-left: auto; width: 42px; display: grid; place-items: center; color: var(--color-text-muted); transition: transform 200ms; }
.panel-collapse:hover { color: var(--color-text); }
.bottom-panel.collapsed .panel-collapse { transform: rotate(180deg); }
.bottom-panel.collapsed .bottom-panel__content { display: none; }
.bottom-panel__content { height: 250px; overflow-y: auto; padding: var(--space-3) var(--space-4) var(--space-4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-3); }
.panel-head__title { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-width: 0; font-size: var(--text-sm); }
.panel-head__sub { color: var(--color-text-muted); font-size: var(--text-xs); }
.panel-head__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.effects-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--space-3); }
.effect-card { background: var(--color-surface-2); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); transition: opacity 180ms; }
.effect-card.is-off .knobs-row, .effect-card.is-off .mini-eq, .effect-card.is-off .slider-row, .effect-full-card.is-off .knobs-row, .effect-full-card.is-off .eq-editor, .effect-full-card.is-off .slider-row, .effect-full-card.is-off .eq-bands { opacity: 0.38; }
.effect-card__header, .effect-full-card__header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 28px; }
.effect-card__title { font-size: var(--text-sm); font-weight: 650; }
.mini-eq { position: relative; display: block; width: 100%; height: 96px; border-radius: var(--radius-md); background: var(--color-bg); overflow: hidden; }
.mini-eq svg { width: 100%; height: 76px; }
.mini-eq:hover { box-shadow: inset 0 0 0 1px var(--color-primary); }
.mini-eq__labels { position: absolute; left: 6px; right: 6px; bottom: 3px; display: flex; justify-content: space-between; font: 500 9px var(--font-mono); color: var(--color-text-faint); }
.effect-desc { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }
.effect-desc.warn { color: var(--color-yellow); }

.knobs-row { display: flex; justify-content: space-around; gap: var(--space-2); flex-wrap: wrap; }
.knob-group { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.knob { width: 52px; height: 52px; border-radius: 50%; cursor: ns-resize; touch-action: none; }
.knob svg { width: 100%; height: 100%; }
.knob--lg { width: 62px; height: 62px; }
.knob:hover .knob__face { stroke: var(--color-text-faint); }
.knob:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.knob.dragging .knob__face { stroke: var(--color-primary); }
.knob__face { fill: var(--knob-bg); stroke: var(--knob-border); stroke-width: 1.5; }
.knob__track { fill: none; stroke: var(--color-surface-3); stroke-width: 4; stroke-linecap: round; }
.knob__value { fill: none; stroke-width: 4; stroke-linecap: round; }
.knob__pointer { stroke-width: 3; stroke-linecap: round; }
.knob-label { font-size: var(--text-2xs); font-weight: 600; color: var(--color-text-muted); }
.knob-value { font: 500 var(--text-2xs) var(--font-mono); color: var(--color-text); font-variant-numeric: tabular-nums; }
.slider-row { display: grid; grid-template-columns: auto 1fr 3.5em; align-items: center; gap: var(--space-3); min-height: 44px; }
.slider-label { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.slider-value { font: 500 var(--text-xs) var(--font-mono); text-align: right; }

.automation { position: relative; height: 158px; background: var(--color-bg); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.automation svg { display: block; touch-action: none; }
.auto-hit { fill: transparent; cursor: crosshair; }
.auto-clip { fill: color-mix(in srgb, var(--track-color) 7%, transparent); }
.auto-area { fill: color-mix(in srgb, var(--track-color) 14%, transparent); pointer-events: none; }
.auto-line { fill: none; stroke: var(--track-color); stroke-width: 2.2; pointer-events: none; }
.auto-pt { cursor: grab; outline: none; }
.auto-pt__hit { fill: transparent; }
.auto-pt__dot { fill: var(--color-surface); stroke: var(--track-color); stroke-width: 2.5; }
.auto-pt.sel .auto-pt__dot, .auto-pt:focus-visible .auto-pt__dot { fill: var(--track-color); }
.auto-pt:focus-visible .auto-pt__hit { stroke: var(--color-text); stroke-width: 1.5; }
.auto-playhead { stroke: var(--color-red); stroke-width: 1.5; pointer-events: none; }
.axis-label--unit { font-weight: 700; }

.chapters-list { display: flex; flex-direction: column; gap: 6px; }
.chapter-row { display: grid; grid-template-columns: 24px 92px 1fr 40px 40px; align-items: center; gap: var(--space-2); }
.chapter-num { font: 600 var(--text-xs) var(--font-mono); color: var(--color-yellow); text-align: center; }
.chapter-row .chapter-time { font-family: var(--font-mono); text-align: center; }

.metadata-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3) var(--space-4); max-width: 1280px; }
.metadata-grid .field { grid-column: span 2; }
.metadata-grid .field--wide { grid-column: span 3; }
.metadata-grid .field--sm { grid-column: span 1; }
.metadata-grid .field--full { grid-column: 1 / -1; }
.metadata-grid .toggle-line { grid-column: span 2; align-self: end; flex-direction: row; }

/* ================================================================ RECORD */
.view--recording { overflow-y: auto; }
.record { width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--space-6) clamp(16px, 3vw, 40px) var(--space-10); display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(260px, 340px); gap: var(--space-4); align-items: start; }
.record-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.record-start { font-size: var(--text-xs); color: var(--color-text-muted); padding-top: var(--space-2); border-top: 1px solid var(--color-border-subtle); }
.record-start b { font-family: var(--font-mono); color: var(--color-text); }
.rec-gain { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-2) 0; }
.rec-gain .effect-desc { flex: 1; }
.record-stage { align-items: center; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-8); }
.rec-status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 650; background: var(--color-surface-2); color: var(--color-text-muted); }
.rec-status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-text-faint); }
.rec-status--recording { background: var(--color-red-dim); color: var(--color-red); }
.rec-status--recording .rec-status__dot { background: var(--color-red); animation: pulse 1s infinite; }
.rec-status--paused, .rec-status--count { background: color-mix(in srgb, var(--color-yellow) 15%, transparent); color: var(--color-yellow); }
.rec-status--paused .rec-status__dot, .rec-status--count .rec-status__dot { background: var(--color-yellow); }
@keyframes pulse { 50% { opacity: 0.3; } }
.recording-timer { font-family: var(--font-mono); font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 300; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.record-stage[data-state="recording"] .recording-timer { color: var(--color-red); }
.rec-note { font-size: var(--text-xs); color: var(--color-text-muted); text-align: center; }
.recording-waveform { position: relative; width: 100%; height: 150px; border-radius: var(--radius-lg); background: var(--color-bg); border: 1px solid var(--color-border-subtle); overflow: hidden; }
.recording-waveform canvas { display: block; }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font: 300 4rem var(--font-mono); color: var(--color-yellow); background: color-mix(in srgb, var(--color-bg) 70%, transparent); }
.countdown[hidden] { display: none; }
.vu-meter { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.vu-meter__row { display: grid; grid-template-columns: 14px 1fr 12px; align-items: center; gap: 8px; font: 600 10px var(--font-mono); color: var(--color-text-faint); }
.vu-meter__bar { height: 10px; border-radius: 5px; background: var(--color-surface-3); overflow: hidden; }
.vu-meter__fill { height: 100%; width: 100%; border-radius: 5px; clip-path: inset(0 100% 0 0); background: linear-gradient(90deg, var(--color-green) 0 60%, var(--color-yellow) 60% 85%, var(--color-red) 85%); }
.clip-led { width: 10px; height: 10px; border-radius: 50%; background: var(--color-surface-3); }
.clip-led.on { background: var(--color-red); box-shadow: 0 0 8px var(--color-red); }
.vu-meter__labels { display: flex; justify-content: space-between; padding: 0 20px 0 22px; font: 500 9px var(--font-mono); color: var(--color-text-faint); }
.recording-view__bottom { display: flex; align-items: center; gap: var(--space-8); margin-top: var(--space-2); }
.rec-control-btn { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); }
.rec-control-btn:hover:not(:disabled) { border-color: var(--color-primary); color: var(--color-primary); }
.rec-btn { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; border: 4px solid color-mix(in srgb, var(--color-red) 45%, transparent); background: transparent; }
.rec-btn:hover { border-color: var(--color-red); }
.rec-btn__inner { width: 58px; height: 58px; border-radius: 50%; background: var(--color-red); transition: border-radius 200ms, width 200ms, height 200ms; }
.rec-btn.recording .rec-btn__inner { width: 32px; height: 32px; border-radius: 8px; }
.rec-saved { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; justify-content: center; padding: 10px 14px; border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-green) 10%, var(--color-surface-2)); border: 1px solid color-mix(in srgb, var(--color-green) 35%, transparent); font-size: var(--text-sm); text-align: center; }
.rec-saved__icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--color-green); color: #052B17; flex-shrink: 0; }
.takes { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.take { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-2) var(--space-2) 0; border-radius: var(--radius-md); background: var(--color-surface-2); overflow: hidden; }
.take__bar { width: 4px; align-self: stretch; background: var(--clip-color); }
.take__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.take__info strong { font-size: var(--text-sm); }
.take__info span { font-size: var(--text-xs); color: var(--color-text-muted); }
.take--gone { opacity: 0.55; }

/* ================================================================ EFFECTS VIEW */
.view--effects { overflow-y: auto; }
.effects-full { width: 100%; max-width: 1680px; margin: 0 auto; padding: var(--space-6) clamp(16px, 3vw, 40px) var(--space-10); display: flex; flex-direction: column; gap: var(--space-4); }
.effects-full__header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.fx-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.fx-actions .select-field select { min-height: 40px; min-width: 190px; }
.track-tabs { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.track-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: var(--radius-full); background: var(--color-surface); border: 1px solid var(--color-border); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
.track-tab:hover { color: var(--color-text); }
.track-tab.active { color: var(--color-text); border-color: var(--tab-color); background: color-mix(in srgb, var(--tab-color) 12%, var(--color-surface)); }
.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: var(--space-2) var(--space-3); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.chain__label { font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-faint); margin-right: 6px; }
.chain__step { min-height: 32px; padding: 0 12px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 600; border: 1px dashed var(--color-border); color: var(--color-text-faint); }
.chain__step.on { border-style: solid; border-color: var(--tab-color); color: var(--color-text); background: color-mix(in srgb, var(--tab-color) 12%, transparent); }
.chain__arrow { color: var(--color-text-faint); font-size: var(--text-xs); }
.chain__summary { margin-left: auto; font: 500 var(--text-2xs) var(--font-mono); color: var(--color-text-muted); }
.effects-full__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); grid-auto-flow: row dense; gap: var(--space-4); }
.effect-full-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.effect-full-card__header > span:first-child { font-size: var(--text-base); font-weight: 650; }
.effect-full-card--eq, .effect-full-card--preview { grid-column: span 2; }
.eq-editor { height: 220px; border-radius: var(--radius-lg); background: var(--color-bg); overflow: hidden; }
.eq-editor svg { display: block; touch-action: none; }
.eq-pt { cursor: grab; outline: none; }
.eq-pt__hit { fill: transparent; }
.eq-pt__dot { stroke: var(--color-surface); stroke-width: 2.5; }
.eq-pt:focus-visible .eq-pt__hit, .eq-pt:hover .eq-pt__hit { fill: color-mix(in srgb, var(--color-text) 8%, transparent); stroke: var(--color-text-faint); }
.eq-pt__label { font: 700 10px var(--font-mono); fill: var(--color-text); pointer-events: none; }
.eq-bands { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.eq-band { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--color-surface-2); font-size: var(--text-xs); }
.eq-band__num { grid-row: span 2; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #0B0B1A; font: 700 10px var(--font-mono); align-self: center; }
.eq-band__name { font-weight: 650; }
.eq-band__val { font-family: var(--font-mono); color: var(--color-text-muted); grid-column: 2; }
.eq-band__val + .eq-band__val { display: none; }
.eq-band { grid-template-columns: auto 1fr auto; }
.eq-band__name { grid-column: 2; }
.eq-band__val { grid-column: 2; }
.eq-band__val + .eq-band__val { display: block; grid-column: 3; grid-row: 1 / span 2; align-self: center; color: var(--color-text); font-weight: 600; }
.preview-box { height: 220px; border-radius: var(--radius-lg); background: var(--color-bg); overflow: hidden; }
.preview-box canvas { display: block; }
.preview-legend { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }
.lg--before { background: rgba(160, 160, 200, 0.5); }
.preview-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.pstat { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--color-surface-2); }
.pstat span { font-size: var(--text-2xs); font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-faint); }
.pstat b { font: 500 var(--text-sm) var(--font-mono); }
.pstat em { font-style: normal; color: var(--color-primary); font-weight: 650; }
.pstat small, .pstat .bad { color: var(--color-red) !important; font-size: var(--text-2xs); }
.knobs-row--large { justify-content: space-around; gap: 4px; padding: var(--space-2) 0; flex-wrap: nowrap; }
.knobs-row--large .knob-group { min-width: 0; flex: 1 1 0; }
.fx-stat { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding: 10px 12px; border-radius: var(--radius-md); background: var(--color-surface-2); }
.fx-stat__row { display: flex; justify-content: space-between; align-items: baseline; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 600; }
.fx-stat__row b { font: 600 var(--text-sm) var(--font-mono); color: var(--color-text); }
.fx-stat__bar { height: 6px; border-radius: 3px; background: var(--color-surface-3); overflow: hidden; }
.fx-stat__bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--color-primary); transition: width 200ms; }
.fx-stat__bar--gr i { background: var(--color-orange); }
.fx-stat small { font-size: var(--text-2xs); color: var(--color-text-faint); }

/* ================================================================ EXPORT */
.view--export { overflow-y: auto; }
.export { width: 100%; max-width: 1440px; margin: 0 auto; padding: var(--space-6) clamp(16px, 3vw, 40px) var(--space-10); }
.export-head { margin-bottom: var(--space-5); }
.export-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: var(--space-5); align-items: start; }
.export-settings { display: flex; flex-direction: column; gap: var(--space-4); }
.export-section { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-4) var(--space-5) var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); }
.export-section h2 { font-size: var(--text-sm); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.segmented { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.segmented__btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 60px; padding: 10px 12px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); background: var(--color-surface-2); font-size: var(--text-base); font-weight: 700; text-align: left; }
.segmented__btn small { font-size: var(--text-2xs); font-weight: 500; color: var(--color-text-muted); }
.segmented__btn:hover { border-color: var(--color-primary); }
.segmented__btn.active { border-color: var(--color-primary); background: color-mix(in srgb, var(--color-primary) 12%, var(--color-surface-2)); box-shadow: inset 0 0 0 1px var(--color-primary); }
.quality-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-3); }
.export-meta-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.cover-picker { display: grid; grid-template-columns: repeat(3, 52px); gap: 8px; }
.cover-swatch { width: 52px; height: 52px; border-radius: var(--radius-md); background: radial-gradient(120% 140% at 0% 0%, var(--c1) 0%, transparent 60%), linear-gradient(135deg, var(--c2), #000); border: 2px solid transparent; }
.cover-swatch.active { border-color: var(--color-text); box-shadow: 0 0 0 2px var(--color-primary); }
.export-meta-fields { display: grid; grid-template-columns: 1fr 1fr 110px; gap: var(--space-3); }
.dest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.dest { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 60px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); background: var(--color-surface-2); text-align: left; font-size: var(--text-sm); }
.dest small { color: var(--color-text-muted); font-size: var(--text-xs); }
.dest.active { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface-2)); }
.export-summary { position: sticky; top: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }
.summary-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.summary-cover { aspect-ratio: 16 / 9; border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; color: #fff; background: radial-gradient(120% 140% at 0% 0%, var(--c1) 0%, transparent 55%), linear-gradient(135deg, var(--c2), color-mix(in srgb, var(--c2) 35%, #000)); }
.summary-cover span { font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.85; }
.summary-cover strong { font-size: var(--text-lg); line-height: 1.25; }
.summary-list { display: flex; flex-direction: column; }
.summary-list div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 7px 0; border-bottom: 1px solid var(--color-border-subtle); font-size: var(--text-xs); }
.summary-list dt { color: var(--color-text-muted); }
.summary-list dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--color-surface-3); overflow: hidden; }
.progress-bar__fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--color-primary), var(--color-green)); transition: width 110ms linear; }
.progress-text { display: block; margin-top: 6px; font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-mono); }
.export-progress[hidden], .export-result[hidden] { display: none; }
.export-result { display: flex; gap: var(--space-3); padding: var(--space-3); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--color-green) 10%, var(--color-surface-2)); border: 1px solid color-mix(in srgb, var(--color-green) 35%, transparent); font-size: var(--text-xs); }
.export-result > div:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.export-result strong { font-size: var(--text-sm); overflow-wrap: anywhere; }
.export-result span { color: var(--color-text-muted); }
.export-result em { font-style: normal; font-weight: 650; color: var(--color-text); margin-top: 4px; }
.export-result__icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--color-green); color: #052B17; flex-shrink: 0; }
.recent-exports { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }
.recent-exports li { display: flex; gap: var(--space-3); align-items: flex-start; font-size: var(--text-xs); }
.recent-exports li div { display: flex; flex-direction: column; min-width: 0; }
.recent-exports strong { overflow-wrap: anywhere; font-size: var(--text-sm); }
.recent-exports span { color: var(--color-text-muted); }
.re-icon { width: 32px; height: 32px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--color-surface-2); color: var(--color-primary); flex-shrink: 0; }
.re-empty { color: var(--color-text-muted); }

/* ================================================================ PHONE LAYOUT (desktop preview) */
.view--mobile { overflow-y: auto; }
.phone-stage { width: 100%; max-width: 1200px; min-height: 100%; margin: 0 auto; align-content: center; padding: var(--space-8) clamp(16px, 3vw, 40px); display: grid; grid-template-columns: minmax(0, 420px) auto; gap: clamp(32px, 6vw, 96px); align-items: center; justify-content: center; }
.phone-intro { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.phone-points { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-2) 0; }
.phone-points li { font-size: var(--text-sm); color: var(--color-text-muted); padding-left: 18px; position: relative; }
.phone-points li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 7px; height: 7px; border-radius: 50%; background: var(--color-primary); }
.phone-points b { color: var(--color-text); }
.phone-frame { width: 360px; height: 740px; padding: 12px; border-radius: 52px; background: #0A0A14; box-shadow: 0 0 0 2px #2C2C44, var(--shadow-lg); }
.phone-screen { position: relative; height: 100%; border-radius: 40px; overflow: hidden; background: var(--color-bg); display: flex; flex-direction: column; }
.phone-status { display: flex; justify-content: space-between; padding: 14px 26px 6px; font: 600 13px var(--font-body); }
.phone-status__icons { font-size: 10px; letter-spacing: 1px; color: var(--color-text-muted); }
.phone-bar { display: flex; align-items: center; gap: 4px; padding: 0 8px 8px; }
.phone-bar strong { flex: 1; text-align: center; font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-track-nav { display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto; scrollbar-width: none; }
.mobile-track-tab { flex-shrink: 0; min-height: 36px; padding: 0 14px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 650; color: var(--color-text-muted); background: var(--color-surface-2); border: 1px solid var(--color-border); }
.mobile-track-tab.active { color: var(--color-text); border-color: var(--tab-color); background: color-mix(in srgb, var(--tab-color) 18%, var(--color-surface-2)); }
.mobile-wave { position: relative; margin: 6px 12px 0; height: 210px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border-subtle); cursor: pointer; touch-action: none; }
.mobile-wave svg { width: 100%; height: 100%; }
.mobile-wave__path { stroke: var(--clip-color); stroke-width: 2.4px; vector-effect: non-scaling-stroke; fill: none; opacity: 0.9; }
.mobile-wave__chapter { stroke: var(--color-yellow); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; opacity: 0.6; }
.mobile-wave.is-silent { opacity: 0.4; }
.mobile-playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--color-red); pointer-events: none; }
.mobile-time { display: flex; justify-content: space-between; padding: 4px 14px 0; font: 500 10px var(--font-mono); color: var(--color-text-faint); }
.mobile-info { display: flex; align-items: center; gap: 12px; padding: 14px 16px 6px; }
.mobile-timecode { font: 500 1.375rem var(--font-mono); font-variant-numeric: tabular-nums; }
.mobile-meter { flex: 1; height: 6px; border-radius: 3px; background: var(--color-surface-3); overflow: hidden; }
.mobile-meter i { display: block; height: 100%; clip-path: inset(0 100% 0 0); background: linear-gradient(90deg, var(--color-green) 0 65%, var(--color-yellow) 65% 85%, var(--color-red) 85%); }
.mobile-controls { display: flex; align-items: center; gap: 8px; padding: 6px 16px; }
.mobile-controls .track-btn { width: 44px; height: 44px; font-size: 13px; border-radius: var(--radius-md); }
.mobile-vol { flex: 1; display: flex; }
.mobile-vol input { width: 100%; }
.mobile-transport { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 12px 0; margin-top: auto; margin-bottom: 70px; }
.mobile-transport-btn { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--color-text-muted); }
.mobile-transport-btn:hover { background: var(--color-surface-2); color: var(--color-text); }
.mobile-transport-btn--play { width: 68px; height: 68px; background: var(--color-primary); color: var(--color-on-primary); }
.mobile-transport-btn--play:hover { background: var(--color-primary-hover); color: var(--color-on-primary); }
.is-playing .mobile-transport-btn--play { background: var(--color-orange); }
.mobile-fab { position: absolute; right: 20px; bottom: 22px; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface); box-shadow: var(--shadow-md); border: 1px solid var(--color-border); }
.mobile-fab span { width: 26px; height: 26px; border-radius: 50%; background: var(--color-red); }
.mobile-fab:hover { border-color: var(--color-red); }

/* ================================================================ MODAL, MENU, TOAST */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--space-4); }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(5, 5, 15, 0.6); backdrop-filter: blur(3px); }
.modal__card { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-xl); padding: var(--space-5) var(--space-6) var(--space-6); box-shadow: var(--shadow-lg); }
.modal.open .modal__card { animation: pop 180ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes pop { from { transform: translateY(8px) scale(0.98); opacity: 0; } }
.modal__title { font-size: var(--text-lg); font-weight: 700; display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.modal__actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-5); }
.form { display: flex; flex-direction: column; gap: var(--space-4); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.choice__body { display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 10px 12px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); background: var(--color-surface-2); }
.choice__body strong { font-size: var(--text-sm); }
.choice__body small { font-size: var(--text-xs); color: var(--color-text-muted); }
.choice input:checked + .choice__body { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.choice input:focus-visible + .choice__body { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.swatch span { display: block; width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; }
.swatch input:checked + span { border-color: var(--color-text); }
.swatch input:focus-visible + span { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.sheet-links { display: flex; flex-wrap: wrap; gap: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--color-border-subtle); }
.shortcuts { display: flex; flex-direction: column; }
.shortcuts div { display: grid; grid-template-columns: 120px 1fr; gap: var(--space-3); padding: 8px 0; border-bottom: 1px solid var(--color-border-subtle); font-size: var(--text-sm); }
kbd { font: 600 var(--text-xs) var(--font-mono); padding: 3px 7px; border-radius: var(--radius-sm); background: var(--color-surface-3); border: 1px solid var(--color-border); border-bottom-width: 2px; }

.menu { position: fixed; z-index: 70; min-width: 180px; padding: 6px; border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.menu__item { text-align: left; min-height: 40px; padding: 0 12px; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 500; }
.menu__item:hover, .menu__item:focus-visible { background: var(--color-surface-2); outline: none; }
.menu__item--danger { color: var(--color-red); }

.toast-region { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(560px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; cursor: default; display: flex; align-items: center; gap: var(--space-3); padding: 10px 12px 10px 16px; border-radius: var(--radius-lg); background: #26264A; color: #F0F0FA; font-size: var(--text-sm); box-shadow: var(--shadow-lg); border: 1px solid #3A3A64; animation: toastIn 200ms cubic-bezier(0.16, 1, 0.3, 1); max-width: 100%; }
[data-theme="light"] .toast { background: #1E1E36; border-color: #1E1E36; }
[data-theme="light"] .waveform-rms, [data-theme="light"] .waveform-path, [data-theme="light"] .clip-label, [data-theme="light"] .mobile-wave__path { stroke: color-mix(in srgb, var(--clip-color) 70%, #0A0A30); color: color-mix(in srgb, var(--clip-color) 60%, #0A0A30); }
[data-theme="light"] .clip-label { text-shadow: 0 0 4px #fff, 0 0 2px #fff; }
[data-theme="light"] .audio-clip { background: color-mix(in srgb, var(--clip-color) 12%, #fff); border-color: color-mix(in srgb, var(--clip-color) 55%, #fff); }
[data-theme="light"] .chapter-flag { color: #8A5A00; background: color-mix(in srgb, var(--color-yellow) 14%, #fff); }
.toast--warn { border-color: var(--color-yellow); }
.toast__action { min-height: 32px; padding: 0 10px; border-radius: var(--radius-md); font-weight: 700; color: var(--color-primary); background: rgba(255, 255, 255, 0.06); flex-shrink: 0; }
[data-theme="light"] .toast__action { color: #5CD5FF; }
.toast--out { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ================================================================ RESPONSIVE */
@media (min-width: 1600px) {
  .effect-full-card--eq { grid-column: span 2; }
  :root { --lane-h: 84px; --hdr-w: 240px; }
  .bottom-panel__content { height: 270px; }
}
@media (max-width: 1200px) {
  .record { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }
  .record-takes { grid-column: 1 / -1; }
  .master-meter { width: 64px; }
}
@media (max-width: 1023px) {
  :root { --hdr-w: 200px; }
  .export-grid { grid-template-columns: 1fr; }
  .export-summary { position: static; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .phone-stage { grid-template-columns: 1fr; justify-items: center; }
  .phone-intro { max-width: 560px; align-items: center; text-align: center; }
  .transport__tools { margin-left: 0; }
  .zoom-slider { width: 80px; }
  .effect-full-card--eq, .effect-full-card--preview { grid-column: 1 / -1; }
  .metadata-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metadata-grid .field--wide { grid-column: span 2; }
  .metadata-grid .toggle-line { grid-column: span 2; }
}
@media (max-width: 900px) and (min-width: 641px) {
  .transport__length, .master-meter { display: none; }
  .transport { gap: var(--space-2); }
  .zoom-slider { width: 64px; }
  .tool-sep { margin: 0 2px; }
}
@media (max-width: 860px) {
  .record { grid-template-columns: 1fr; }
  .record-stage { order: -1; }
  .export-summary { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  :root { --hdr-w: 122px; --lane-h: 112px; --ruler-h: 28px; }
  .screen-nav__btn--phone { display: none; }
  .hide-phone { display: none !important; }
  .app-bar { height: 52px; padding: 0 4px; gap: 4px; }
  .app-logo__text { display: none; }
  .app-logo { min-height: 44px; min-width: 44px; justify-content: center; }
  .project-card__menu { width: 44px; height: 44px; }
  .app-bar .icon-btn, .icon-btn { width: 44px; height: 44px; }
  .project-title-btn { font-size: var(--text-sm); padding: 6px 8px; min-height: 44px; }
  .project-title-btn svg { display: none; }
  .screen-nav { gap: 0; padding-left: 2px; padding-right: 2px; height: 60px; }
  .screen-nav__btn { min-width: 0; flex: 1; padding: 0 2px; }

  .library { padding-top: var(--space-5); }
  .library__actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .library__actions .btn { min-height: 46px; }
  .library__toolbar .select-field { flex: 1; }
  .library__toolbar .select-field select { flex: 1; }
  .search-field { max-width: none; flex-basis: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card--new { min-height: 96px; flex-direction: row; gap: 14px; }
  .project-card--new .project-card__plus { margin: 0; width: 44px; height: 44px; }
  .project-card__hint { display: none; }

  .transport { gap: 4px 6px; padding: 4px 6px; }
  .transport__controls { gap: 0; }
  .transport-btn { width: 44px; height: 44px; }
  .transport-btn--play { width: 46px; height: 46px; margin: 0 2px; }
  .timecode { font-size: 1rem; }
  .timecode__ms { font-size: 0.6875rem; }
  .transport__length, .master-meter { display: none; }
  .transport__time { margin-left: auto; padding-right: 4px; }
  .transport__tools { width: 100%; justify-content: space-between; border-top: 1px solid var(--color-border-subtle); padding-top: 2px; }
  .zoom-slider { flex: 1; min-width: 60px; width: auto; }
  .tool-sep { margin: 0 2px; }
  .transport-btn--text { min-width: 44px; }

  .track-header { padding: 8px 6px 8px 6px; gap: 6px; }
  .track-header__main { gap: 6px; }
  .track-name { font-size: var(--text-xs); padding: 8px 4px; }
  .track-btn { width: 44px; height: 44px; font-size: 13px; border-radius: var(--radius-md); }
  .track-header__controls { gap: 6px; }
  .volume-slider, .fx-badge { display: none; }
  .track-meter { height: 18px; }
  .track-header-corner { padding: 0 8px; letter-spacing: 0.04em; }
  .add-track { height: 56px; padding: 0 10px; }
  .lane-spacer { height: 56px; }
  .clip-label { font-size: 9.5px; }

  .clip-bar { flex-direction: column; align-items: stretch; gap: 6px; padding: 6px 8px; }
  .clip-bar__info strong { max-width: 140px; }
  .clip-bar__len { display: none; }
  .clip-bar__actions { margin-left: 0; }
  .chip-btn { min-height: 44px; padding: 0 12px; }
  .chip-btn--icon { width: 44px; }

  .bottom-panel__content { height: 40dvh; padding: var(--space-3); }
  .automation { height: 136px; }
  .bottom-panel__tabs { overflow: visible; padding: 0 2px; }
  .panel-tab { min-height: 46px; padding: 0 6px; flex: 1 1 auto; font-size: 0.78rem; }
  .panel-tab.active::after { left: 4px; right: 4px; }
  .panel-collapse { width: 46px; flex: none; }
  .btn--sm { min-height: 44px; }
  .panel-head__actions { width: 100%; }
  .panel-head__actions .btn { flex: 1; padding: 0 8px; }
  .effects-row { grid-template-columns: 1fr; }
  .knob { width: 56px; height: 56px; }
  .chapter-row { grid-template-columns: 20px 74px 1fr 44px 44px; gap: 6px; }
  .chapter-row input { min-height: 44px; padding: 8px; }
  .metadata-grid { grid-template-columns: 1fr 1fr; }
  .metadata-grid .field, .metadata-grid .field--wide, .metadata-grid .toggle-line { grid-column: 1 / -1; }
  .metadata-grid .field--sm { grid-column: span 1; }
  .field input:not([type=range]):not([type=checkbox]):not([type=radio]), .field select, .field textarea, .select-field select { min-height: 46px; font-size: 16px; }
  .select-field--inline { flex-wrap: wrap; }
  .select-field--inline select { min-width: 0; width: 100%; }
  .panel-head__title { width: 100%; }
  .toggle-switch { width: 48px; height: 44px; }
  .toggle-switch__slider { top: 8px; bottom: 8px; }
  .toggle-switch__slider::after { width: 22px; height: 22px; }
  input[type=range] { height: 44px; }
  .track-name { min-height: 44px; }
  .fx-actions .select-field select { min-height: 44px; }
  .chain__step { min-width: 44px; }
  .chapter-flag { pointer-events: none; }
  .toggle-switch input:checked + .toggle-switch__slider::after { transform: translateX(18px); }

  .record { padding: var(--space-4) var(--space-3) var(--space-8); gap: var(--space-3); }
  .record-card { padding: var(--space-4); }
  .record-stage { padding: var(--space-4) var(--space-4) var(--space-6); }
  .recording-waveform { height: 120px; }
  .recording-view__bottom { gap: var(--space-6); }

  .effects-full, .export { padding: var(--space-4) var(--space-3) var(--space-8); }
  .effects-full__grid { grid-template-columns: 1fr; }
  .fx-actions { width: 100%; }
  .fx-actions .select-field { width: 100%; }
  .fx-actions .select-field select { flex: 1; min-width: 0; }
  .fx-actions .btn { flex: 1; }
  .track-tab { min-height: 44px; }
  .chain { gap: 4px; }
  .chain__label, .chain__arrow { display: none; }
  .chain__step { min-height: 44px; }
  .chain__summary { width: 100%; margin-left: 0; }
  .eq-editor, .preview-box { height: 190px; }
  .eq-bands { grid-template-columns: 1fr 1fr; }
  .preview-stats { grid-template-columns: 1fr; }
  .effect-full-card { padding: var(--space-4); }
  .knob--lg { width: 54px; height: 54px; }
  .slider-row input { min-height: 44px; }

  .segmented { grid-template-columns: 1fr 1fr; }
  .export-meta-grid { grid-template-columns: 1fr; }
  .cover-picker { grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
  .cover-swatch { width: 100%; height: auto; aspect-ratio: 1; min-height: 44px; }
  .export-meta-fields { grid-template-columns: 1fr 96px; }
  .export-meta-fields .field:first-child { grid-column: 1 / -1; }
  .dest-grid { grid-template-columns: 1fr; }

  .modal { padding: 0; align-items: end; }
  .modal__card { width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: var(--space-5) var(--space-4) max(var(--space-5), env(safe-area-inset-bottom)); max-height: 88dvh; }
  .modal__actions .btn { flex: 1; min-height: 46px; }
  .choice-grid { grid-template-columns: 1fr; }
  .sheet-links .btn { flex: 1 1 100%; min-height: 46px; }
  .swatch span { width: 44px; height: 44px; }
  .toast-region { bottom: 70px; }
}
@media (max-width: 380px) {
  :root { --hdr-w: 116px; }
  .timecode__ms { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .project-card:hover { transform: none; }
}
