/* ─── Bundled Fonts ─────────────────────────────────────────────────────── */
/* woff2 files must be placed in src/fonts/ (Apache 2.0 / OFL — freely available). */
/* Falls back to system-installed copy if the file is missing.                     */
@font-face {
  font-family: 'Inter';
  src: local('Inter'), url('../fonts/Inter.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: local('JetBrains Mono'), url('../fonts/JetBrainsMono.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
/* Landing (.home-screen) pins its own original palette in home.css.
   Studio + modals follow html[data-theme]. */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-studio: 'Segoe UI Variable Text', 'Segoe UI', 'SF Pro Text', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --panel-inspector-width: 320px;
  --panel-right-width: var(--panel-inspector-width);
  --transport-height: 56px;
  --topbar-height: 52px;
  --panel-header-height: 46px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-med:  200ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-panel: 0 0 0 1px color-mix(in oklch, var(--color-panel-border) 80%, transparent);
}

:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --color-app-bg:        oklch(0.19 0.025 275);
  --color-panel-bg:      oklch(0.23 0.028 275);
  --color-panel-border:  oklch(0.34 0.03 275);
  --color-surface-hover: oklch(0.28 0.03 275);
  --color-surface-active: oklch(0.31 0.032 275);

  --color-accent:        oklch(0.68 0.17 275);
  --color-accent-dim:    oklch(0.68 0.17 275 / 0.14);
  --color-accent-glow:   oklch(0.68 0.17 275 / 0.28);
  --color-accent-ink:    oklch(0.99 0.01 275);

  --color-text-primary:   oklch(0.95 0.012 275);
  --color-text-secondary: oklch(0.74 0.02 275);
  --color-text-muted:     oklch(0.60 0.02 275);
  --color-destructive:    oklch(0.68 0.17 32);

  /* Export task status — paused / completed. Tinted toward the app hue (275)
     so they sit in the same family as accent and destructive rather than
     reading as borrowed traffic-light colors. */
  --color-warn:      oklch(0.80 0.13 79);
  --color-warn-dim:  oklch(0.80 0.13 79 / 0.15);
  --color-ok:        oklch(0.79 0.15 158);
  --color-ok-dim:    oklch(0.79 0.15 158 / 0.15);

  --color-canvas-bg: oklch(0.15 0.02 275);
  --color-drop-veil: oklch(0.18 0.025 275 / 0.88);
}

html[data-theme="light"] {
  color-scheme: light;
  --color-app-bg:        oklch(0.96 0.012 275);
  --color-panel-bg:      oklch(0.99 0.006 275);
  --color-panel-border:  oklch(0.87 0.02 275);
  --color-surface-hover: oklch(0.94 0.016 275);
  --color-surface-active: oklch(0.91 0.02 275);

  --color-accent:        oklch(0.48 0.19 275);
  --color-accent-dim:    oklch(0.48 0.19 275 / 0.12);
  --color-accent-glow:   oklch(0.48 0.19 275 / 0.22);
  --color-accent-ink:    oklch(0.99 0.01 275);

  --color-text-primary:   oklch(0.24 0.03 275);
  --color-text-secondary: oklch(0.42 0.025 275);
  --color-text-muted:     oklch(0.52 0.02 275);
  --color-destructive:    oklch(0.55 0.18 32);

  /* Darkened against the light panel so they stay legible as badge text —
     measured 4.7:1 (paused) and 4.9:1 (done). */
  --color-warn:      oklch(0.50 0.13 62);
  --color-warn-dim:  oklch(0.50 0.13 62 / 0.13);
  --color-ok:        oklch(0.47 0.13 158);
  --color-ok-dim:    oklch(0.47 0.13 158 / 0.13);

  --color-canvas-bg: oklch(0.92 0.014 275);
  --color-drop-veil: oklch(0.99 0.006 275 / 0.88);
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--color-app-bg);
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  display: flex;
  flex-direction: column;
}

body.studio-active {
  font-family: var(--font-studio);
  font-size: 14px;
  line-height: 1.45;
}

/* ─── App Layout (stage + inspector) ─────────────────────────────────────── */
.app-layout {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--panel-inspector-width);
  grid-template-rows: 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transition: grid-template-columns var(--transition-med);
}

/* ─── Panel Base ─────────────────────────────────────────────────────────── */
.panel {
  background: var(--color-panel-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity var(--transition-med);
}

.panel.collapsed {
  opacity: 0;
  pointer-events: none;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--panel-header-height);
  padding: 0 14px;
  border-bottom: 1px solid var(--color-panel-border);
  flex-shrink: 0;
}

.app-icon { width: 20px; height: 20px; flex-shrink: 0; display: block; color: var(--color-accent); }

.app-name {
  display: flex;
  align-items: center;
  height: 20px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--color-text-primary);
}

/* ─── Studio top bar ─────────────────────────────────────────────────────── */
.studio-topbar {
  position: relative;
  /* Above the panel toggle tabs (z-index 10, 11 on web). The top bar creates a
     stacking context, so its dropdown menus — File/Edit/Help and the Export
     Process menu — can only paint as high as this value; at 6 the toggles
     clipped their lower-right corner. Kept below the video-mode transport bar
     (20) and the modal overlays (200), which must still cover the top bar. */
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-height);
  padding: 0 12px 0 14px;
  background: var(--color-panel-bg);
  border-bottom: 1px solid var(--color-panel-border);
  flex-shrink: 0;
}

.studio-topbar-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.studio-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.studio-track {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: clamp(18rem, 34vw, 34rem);
  height: 32px;
  margin: 0;
  padding: 0 10px 0 8px;
  background: var(--color-app-bg);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.studio-track:hover {
  background: var(--color-surface-hover);
  border-color: color-mix(in oklch, var(--color-text-muted) 50%, var(--color-panel-border));
  color: var(--color-text-primary);
}

.studio-track-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.studio-track-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}

.studio-track[data-empty="false"] {
  color: var(--color-text-primary);
}

.studio-track[data-empty="false"] .studio-track-icon {
  display: none;
}

.studio-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.studio-history {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-app-bg);
}

.studio-history .btn-icon-sm {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.studio-history .btn-icon-sm + .btn-icon-sm {
  border-left: 1px solid var(--color-panel-border);
}

.studio-history .btn-icon-sm svg {
  width: 16px;
  height: 16px;
}

.studio-history .btn-icon-sm:not(:disabled):hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.studio-history .btn-icon-sm:not(:disabled):active {
  background: var(--color-surface-active);
}

.studio-topbar-actions > .btn-icon-sm {
  width: 32px;
  height: 32px;
}

/* ─── Export Mission icon + process menu ─────────────────────────────────── */
.studio-mission-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.btn-mission-icon {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--color-accent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-mission-icon:hover,
.btn-mission-icon.is-active {
  background: var(--color-surface-hover);
  border-color: var(--color-panel-border);
}

/* Menu-open ring, tinted from the icon's own state colour so it stays in sync
   when the task is paused or finished. */
.btn-mission-icon.is-active { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }

/* Same status colours as the cards inside the menu. */
.btn-mission-icon.is-paused { color: var(--color-warn); }
.btn-mission-icon.is-completed { color: var(--color-ok); }

.mission-circular-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mission-circle-bg { stroke: var(--color-surface-active); }
.mission-circle-fg {
  stroke: currentColor;
  transition: stroke-dashoffset 180ms ease;
}

.mission-icon-inner {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--color-panel-bg);
  border-radius: 50%;
}

.mission-glyph { width: 12px; height: 12px; }

.mission-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  background: var(--color-accent);
  color: var(--color-app-bg);
  border: 2px solid var(--color-app-bg);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.export-process-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 300;
  width: min(400px, calc(100vw - 24px));
  overflow: hidden;
  background: var(--color-panel-bg);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px oklch(0.12 0.03 275 / 0.30), 0 18px 46px oklch(0.12 0.03 275 / 0.42);
  transform-origin: top right;
  animation: mission-menu-in 140ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes mission-menu-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.export-menu-head,
.export-menu-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-panel-border);
}

/* Only used when a footer is present — the "Minimize dialog by default" option
   that lived here is commented out in index.html along with the dialog. */
.export-menu-foot { border-top: 1px solid var(--color-panel-border); border-bottom: 0; }

.export-menu-head {
  background: color-mix(in srgb, var(--color-surface-hover) 60%, var(--color-panel-bg));
}

.export-menu-title-wrap { display: flex; align-items: center; gap: 8px; }
.export-menu-title { font-size: 12.5px; font-weight: 650; color: var(--color-text-primary); letter-spacing: 0.01em; }

.export-menu-status-badge,
.mission-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: var(--color-surface-active);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The header badge picks its own colour; a card badge must NOT, or it would
   override the status colour it inherits from `.mission-item.status-*`. */
.export-menu-status-badge { color: var(--color-text-secondary); }

/* Leading status dot. Its colour is `currentColor`, so each state is readable
   by shape as well as hue. */
.export-menu-status-badge::before,
.mission-item-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  flex-shrink: 0;
  border-radius: 50%;
  background: currentColor;
}

.export-menu-status-badge.badge-active { color: var(--color-accent);         background: var(--color-accent-dim); }
.export-menu-status-badge.badge-paused { color: var(--color-warn);           background: var(--color-warn-dim); }
.export-menu-status-badge.badge-queued { color: var(--color-text-secondary); background: var(--color-surface-active); }
.export-menu-status-badge.badge-done   { color: var(--color-ok);             background: var(--color-ok-dim); }

.export-menu-head-actions { display: flex; align-items: center; gap: 4px; }
.btn-text-xs, .btn-icon-xs {
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  transition: color var(--transition-fast), background var(--transition-fast), opacity var(--transition-fast);
}
.btn-text-xs { padding: 4px 7px; }
.btn-icon-xs { width: 24px; height: 24px; padding: 0; font-size: 12px; line-height: 1; }
.btn-text-xs:hover, .btn-icon-xs:hover { color: var(--color-accent); background: var(--color-accent-dim); }
.btn-text-xs:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-text-xs:disabled:hover { color: var(--color-text-muted); background: transparent; }

/* Show 4 task cards, then scroll. All cards are the same height — 13px/12px
   padding + header + progress block + 26px (.btn-xs) action row + divider,
   measured at ~94.5px each (4 cards occupy 378px of content). `overflow-y:
   auto` therefore only draws a scrollbar once a 5th card exists. The +2px
   tolerance absorbs subpixel rounding and font-metric drift; the trade-off is
   a ~2px peek of the next card, which usefully hints that the list scrolls.
   The 60vh cap keeps the menu inside short windows, where
   `.export-process-menu`'s own `overflow: hidden` would otherwise clip the
   list with no way to reach the rest.
   Re-measure both numbers if the card layout changes. */
.export-menu-list {
  --mission-card-h: 95px;
  max-height: min(calc(4 * var(--mission-card-h) + 2px), 60vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-panel-border) transparent;
}
/* Mirrors .panel-body's scrollbar treatment. Note `scrollbar-width: thin` above
   takes precedence over these in Chromium (measured gutter: 10px, not 4px) —
   kept for parity with the panel scrollbars. */
.export-menu-list::-webkit-scrollbar { width: 4px; }
.export-menu-list::-webkit-scrollbar-track { background: transparent; }
.export-menu-list::-webkit-scrollbar-thumb { background: var(--color-panel-border); border-radius: 2px; }

.mission-item {
  padding: 13px 14px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-panel-border) 62%, transparent);
  transition: background var(--transition-fast);
}
.mission-item:last-child { border-bottom: 0; }
.mission-item:hover { background: color-mix(in srgb, var(--color-surface-hover) 45%, transparent); }

/* Each status sets one colour; the badge tint and progress fill both derive
   from it via currentColor, so a status only has to be defined once.
   These values are also badge *text*, so they must clear 4.5:1 against their
   own 15% tint — hence secondary (not muted) for the inactive states. */
.mission-item.status-recording { color: var(--color-accent); }
.mission-item.status-paused    { color: var(--color-warn); }
.mission-item.status-completed { color: var(--color-ok); }
.mission-item.status-queued,
.mission-item.status-cancelled { color: var(--color-text-secondary); }

/* Dimmed, but not so far that the badge stops being readable. */
.mission-item.status-cancelled { opacity: 0.75; }
.mission-item.status-cancelled:hover { opacity: 1; }

.mission-item-header, .mission-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.mission-item-title { min-width: 0; overflow: hidden; color: var(--color-text-primary); font-size: 12.5px; font-weight: 600; letter-spacing: -0.005em; text-overflow: ellipsis; white-space: nowrap; }
/* Inherits the status colour set on the card, so the badge tint always matches
   the progress fill without a rule per status. */
.mission-item-badge { color: inherit; background: color-mix(in srgb, currentColor 15%, transparent); }

.mission-item-progress-track {
  position: relative;
  height: 4px;
  margin: 10px 0 9px;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-surface-active) 75%, transparent);
  border-radius: 999px;
}
.mission-item-progress-fill {
  height: 100%;
  background: currentColor;
  border-radius: inherit;
  transition: width 180ms linear;
}

/* A queued task has no progress to show, so the empty track gets a slow sweep
   to say "waiting", not "stalled". Motion is neutralised globally by the
   prefers-reduced-motion block at the end of this file. */
.mission-item.status-queued .mission-item-progress-track::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-text-muted) 45%, transparent), transparent);
  animation: mission-queued-sweep 2.4s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

@keyframes mission-queued-sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.mission-meta-info {
  min-width: 0;
  overflow: hidden;
  /* Secondary rather than muted: this is 10px, so it needs the contrast. The
     hierarchy still reads because of the size, weight and mono family. */
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mission-item-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.btn-xs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-hover);
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 10.5px;
  font-weight: 550;
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.btn-xs:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-active);
  border-color: color-mix(in srgb, var(--color-panel-border) 55%, var(--color-text-secondary));
}
.btn-xs:active { transform: translateY(0.5px); }
.btn-xs:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-xs:disabled:hover { color: var(--color-text-secondary); background: var(--color-surface-hover); border-color: var(--color-panel-border); }

/* Cancel stops a job that is still running, so it reads destructive on hover. */
.btn-mission-cancel:hover { color: var(--color-destructive); border-color: var(--color-destructive); background: color-mix(in srgb, var(--color-destructive) 12%, transparent); }

.icon-xs { width: 11px; height: 11px; }
.mission-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 30px 16px;
  text-align: center;
  color: var(--color-text-muted);
}
.mission-empty-state svg { width: 18px; height: 18px; opacity: 0.55; margin-bottom: 5px; }
.mission-empty-title { font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
.mission-empty-sub { font-size: 11px; }
.export-menu-opt { display: flex; align-items: center; gap: 7px; color: var(--color-text-secondary); font-size: 11px; cursor: pointer; }
.export-menu-opt input { accent-color: var(--color-accent); }

/* Dead rule — `#export-modal` is commented out in index.html.
body.export-minimized #export-modal { display: none; }
*/

@media (max-width: 640px) {
  .export-process-menu { right: -46px; }
  .studio-topbar-actions { gap: 4px; }
  .studio-export .btn-export { padding: 0 10px; }
  .studio-export .btn-export .icon-sm { display: none; }
}

.studio-export {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  position: relative;
}

.studio-export.is-disabled {
  pointer-events: none;
}

.studio-export .btn-export {
  width: auto;
  height: 34px;
  min-width: 0;
  padding: 0 14px;
  border-radius: 999px;
}

.studio-export .export-hint {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ─── Custom in-app menu bar (Windows/Linux only) ──────────────────────────── */
/* File/Edit/Help sit in the studio top bar. Dropdowns open below each trigger. */
.studio-topbar .app-menu-bar {
  display: flex;
  align-items: center;
  position: static;
  height: auto;
  padding: 0;
  background: transparent;
  border: none;
}

.menu-bar {
  display: flex;
  gap: 2px;
}

.menu-bar.collapsed { display: none; }

.menu-item { position: relative; }

.menu-trigger {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font: inherit;
  font-size: 13px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.menu-trigger:hover { background: var(--color-surface-hover); color: var(--color-text-primary); }

.menu-item.active .menu-trigger {
  background: var(--color-surface-active);
  color: var(--color-accent);
}

.menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--color-panel-bg);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  padding: 6px;
  z-index: 100;
}

.menu-item.active .menu-dropdown { display: block; }

.menu-action {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text-primary);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.menu-action:hover { background: var(--color-surface-hover); color: var(--color-accent); }

.menu-separator {
  height: 1px;
  background: var(--color-panel-border);
  margin: 5px 4px;
}

.menu-recent-item { font-size: 12px; color: var(--color-text-secondary); }
.menu-recent-item:hover { color: var(--color-accent); }

.menu-recent-empty {
  color: var(--color-text-muted);
  pointer-events: none;
  cursor: default;
}

.menu-recent-clear {
  color: var(--color-destructive);
  font-size: 12px;
}
.menu-recent-clear:hover { background: var(--color-surface-hover); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-panel-border) transparent;
}

.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-track { background: transparent; }
.panel-body::-webkit-scrollbar-thumb { background: var(--color-panel-border); border-radius: 2px; }

/* ─── Panel Sections ─────────────────────────────────────────────────────── */
.panel-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-panel-border);
}

.panel-section:last-child { border-bottom: none; }

.section-label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 10px;
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-label-row .section-label { margin-bottom: 0; }

/* ─── Tab Bar (per-panel section groups) ─────────────────────────────────── */
/* .tab-panel needs no rules of its own — the existing global .hidden rule
   (below) already covers show/hide, since it toggles on the wrapper only. */
.tab-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  background: var(--color-panel-bg);
  border-bottom: 1px solid var(--color-panel-border);
}

.tab-btn {
  flex: 1;
  padding: 10px 6px 9px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.tab-btn:hover:not(.active) {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.tab-btn.active {
  background: transparent;
  border-bottom-color: var(--color-accent);
  color: var(--color-text-primary);
}

/* ─── Inspector ──────────────────────────────────────────────────────────── */
.inspector {
  border-left: 1px solid var(--color-panel-border);
  background: var(--color-panel-bg);
}

.inspector-head {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  flex-shrink: 0;
}

.inspector-title {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--color-text-primary);
}

/* ─── Style strip under the preview ──────────────────────────────────────── */
.style-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 16px 10px;
  background: var(--color-panel-bg);
  border-top: 1px solid var(--color-panel-border);
}

.style-strip-label {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.style-picker-grid {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.style-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 4.5rem;
  padding: 8px 10px 7px;
  background: var(--color-app-bg);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.style-btn svg {
  width: 26px;
  height: 26px;
}

.style-btn span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.style-btn:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-text-muted);
  color: var(--color-text-primary);
}

.style-btn.active {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* ─── Center Panel ────────────────────────────────────────────────────────── */
.center-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--color-canvas-bg);
  overflow: hidden;
}

/* Panel collapse/expand tabs — mounted on the center panel's edges so they
   stay reachable even when the adjacent side panel is fully collapsed. */
.panel-toggle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 18px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 0;
  background: var(--color-panel-bg);
  border: 1px solid var(--color-panel-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.panel-toggle:hover {
  color: var(--color-text-primary);
  background: var(--color-surface-hover);
}

.panel-toggle svg { width: 12px; height: 12px; flex-shrink: 0; transition: transform var(--transition-fast); }

.panel-toggle-right {
  right: var(--panel-inspector-width);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.panel-toggle-right.collapsed {
  right: 0;
}

.panel-toggle.collapsed svg { transform: rotate(180deg); }

/* Canvas Area */
.canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 28px 12px 20px;
  overflow: hidden;
  min-height: 0;
}

.canvas-drop-zone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.canvas-drop-zone.drag-over .canvas-wrapper {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.canvas-wrapper {
  position: relative;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  /* Size is managed by JS to fit available space at 16:9 */
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Canvas-only video play mode. The browser fullscreen API owns the viewport;
   this class removes editor chrome while keeping the real canvas active. */
body.video-playmode #studio {
  width: 100vw;
  height: 100vh;
}

body.video-playmode .studio-topbar,
body.video-playmode .left-panel,
body.video-playmode .right-panel,
body.video-playmode .style-strip,
body.video-playmode .transport-bar,
body.video-playmode .panel-toggle {
  display: none;
}

body.video-playmode .app-layout,
body.video-playmode .center-panel,
body.video-playmode .canvas-area,
body.video-playmode .canvas-drop-zone {
  width: 100%;
  height: 100%;
}

body.video-playmode .app-layout {
  display: block;
}

body.video-playmode .canvas-area {
  padding: 0;
}

body.video-playmode .canvas-wrapper {
  width: 100% !important;
  height: 100% !important;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

body.video-playmode .transport-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: color-mix(in srgb, var(--color-panel-bg) 88%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--color-panel-border) 85%, transparent);
  backdrop-filter: blur(10px);
}

.canvas-wrapper.viz-draggable         { cursor: grab; }
.canvas-wrapper.viz-draggable.viz-dragging { cursor: grabbing; }

/* Background position edit mode — takes precedence over the visualizer drag
   cursor above since both classes can be present at once (rule order wins). */
.canvas-wrapper.bg-draggable {
  cursor: move;
  outline: 1px dashed var(--color-accent);
  outline-offset: 2px;
}
.canvas-wrapper.bg-draggable.bg-dragging { cursor: grabbing; }

/* Snap-to-center guides — shown while dragging the background into alignment */
.bg-snap-guide {
  position: absolute;
  background: var(--color-accent);
  box-shadow: 0 0 4px var(--color-accent-glow);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 4;
}

.bg-snap-guide-v { top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); }
.bg-snap-guide-h { left: 0; right: 0; top: 50%; height: 1px; transform: translateY(-50%); }

.bg-snap-guide.active { opacity: 1; }

/* Drop overlay — shown when no audio is loaded */
.drop-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-drop-veil);
  backdrop-filter: blur(2px);
  transition: opacity var(--transition-med);
}

.drop-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.drop-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.drop-message svg {
  width: 48px;
  height: 48px;
  color: var(--color-accent);
  margin-bottom: 4px;
}

.drop-title {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
}

.drop-sub {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.drop-sub kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--color-surface-active);
  border: 1px solid var(--color-panel-border);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-primary);
}

.drop-formats {
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}

/* FPS badge */
.fps-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  letter-spacing: 0.01em;
}

/* Transport Bar */
.transport-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--transport-height);
  padding: 0 16px;
  background: var(--color-panel-bg);
  border-top: 1px solid var(--color-panel-border);
  flex-shrink: 0;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.volume-button {
  flex-shrink: 0;
}

.volume-slider {
  width: 76px;
  height: 4px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.volume-slider:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .volume-slider { width: 54px; }
}

.time-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-secondary);
  min-width: 36px;
  text-align: center;
  flex-shrink: 0;
}

/* Scrubber */
.scrubber-track {
  flex: 1;
  position: relative;
  height: 6px;
  background: var(--color-surface-active);
  border-radius: 999px;
  cursor: pointer;
  touch-action: none;
}

.scrubber-track:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.scrubber-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--color-accent);
  border-radius: 999px;
  pointer-events: none;
}

.scrubber-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 12px;
  height: 12px;
  background: var(--color-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px oklch(0.2 0.03 275 / 0.2);
  transform: translate(-50%, -50%);
  opacity: 1;
  transition: transform var(--transition-fast);
  pointer-events: none;
}

.scrubber-track:hover .scrubber-thumb {
  transform: translate(-50%, -50%) scale(1.15);
}

/* ─── Right Panel (inspector) ────────────────────────────────────────────── */
.right-panel {
  min-width: 0;
}

.inspector.collapsed {
  border-left-width: 0;
}

/* Audio metadata block */
.empty-state {
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 4px 0 8px;
}

.audio-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}

.meta-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
}

.meta-key {
  color: var(--color-text-muted);
  min-width: 52px;
  flex-shrink: 0;
}

.meta-val {
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 32px; height: 18px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-surface-active);
  border-radius: 9px;
  border: 1px solid var(--color-panel-border);
  transition: background var(--transition-fast), border-color var(--transition-fast);
  cursor: pointer;
}

.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--color-text-muted);
  border-radius: 50%;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.toggle input:checked ~ .toggle-track {
  background: var(--color-accent-dim);
  border-color: var(--color-accent);
}

.toggle input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(14px);
  background: var(--color-accent);
}

/* Overlay controls (disabled state) */
.overlay-controls[data-disabled="true"] {
  opacity: 0.4;
  pointer-events: none;
}

/* Output path row */
.output-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Bitrate manual group */
.bitrate-manual {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.unit-label {
  font-size: 11px;
  color: var(--color-text-secondary);
}

/* Export Action */
.export-action {
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.export-hint {
  font-size: 11px;
  color: var(--color-text-muted);
  text-align: center;
}

.action-caption {
  font-size: 10px;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 3px;
}

/* ─── Export Progress Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(3px);
}

/* Export dialog styles — the dialog is shown on desktop (Electron); web exports
   run minimized in the Export Process menu. The opaque backdrop hides the
   preview canvas so motion isn't visible behind the modal during export. */
#export-modal.modal-overlay {
  background: rgba(13, 17, 23, 0.94);
  backdrop-filter: none;
}

body.exporting #canvas-wrapper {
  opacity: 0;
  pointer-events: none;
}

body.exporting #fps-counter,
body.exporting #transport-bar {
  opacity: 0;
  pointer-events: none;
}
.modal {
  background: var(--color-panel-bg);
  border: 1px solid var(--color-panel-border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  min-width: 380px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  height: 6px;
  background: var(--color-surface-active);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 3px;
  transition: width 200ms linear;
}

.progress-stats {
  font-size: 13px;
  color: var(--color-text-primary);
  font-family: var(--font-mono);
}

.progress-eta {
  font-size: 12px;
  color: var(--color-text-secondary);
}

.modal-actions {
  display: flex;
  gap: 8px;
}

.confirm-modal {
  min-width: min(420px, calc(100vw - 32px));
  gap: 16px;
}

.confirm-message {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  white-space: pre-line;
}

.confirm-actions {
  justify-content: flex-end;
  margin-top: 4px;
}

.confirm-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-ink);
}

.confirm-primary:hover {
  background: color-mix(in oklch, var(--color-accent) 88%, white);
  border-color: color-mix(in oklch, var(--color-accent) 88%, white);
}

.btn-ok {
  background: var(--color-ok);
  border-color: var(--color-ok);
  color: var(--color-accent-ink);
}

.btn-ok:hover {
  background: color-mix(in oklch, var(--color-ok) 88%, white);
  border-color: color-mix(in oklch, var(--color-ok) 88%, white);
}

/* Inline caution under a project action (e.g. desktop .spx Save). */
.caption-warning {
  margin: 4px 0 0;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--color-text-primary);
  background: var(--color-warn-dim);
  border-left: 3px solid var(--color-warn);
  border-radius: 4px;
}

.mt-4 { margin-top: 4px; }

.btn-destructive {
  background: transparent;
  border: 1px solid var(--color-destructive);
  color: var(--color-destructive);
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.btn-destructive:hover {
  background: color-mix(in oklch, var(--color-destructive) 12%, transparent);
}

/* ─── Encoder Badge ──────────────────────────────────────────────────────────── */
.encoder-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: rgba(125, 133, 144, 0.12);
  color: var(--color-text-muted);
  margin-left: 6px;
  vertical-align: middle;
}
.encoder-badge.hw {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

/* ─── Error Dialog ───────────────────────────────────────────────────────────── */
.error-log {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-destructive);
  background: rgba(255, 107, 53, 0.06);
  border: 1px solid rgba(255, 107, 53, 0.2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  max-height: 140px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ─── About ──────────────────────────────────────────────────────────────── */
.about-modal {
  position: relative;
  width: min(380px, calc(100vw - 32px));
  min-width: 0;
  max-width: 380px;
  padding: 28px 28px 24px;
  gap: 0;
  box-shadow: 0 16px 48px oklch(0.12 0.04 275 / 0.45);
}

html[data-theme="light"] #about-modal.modal-overlay {
  background: oklch(0.32 0.03 275 / 0.38);
}

.about-dismiss {
  appearance: none;
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.about-dismiss svg {
  width: 14px;
  height: 14px;
}

.about-dismiss:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-primary);
}

.about-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-right: 28px;
  margin-bottom: 18px;
}

.about-mark {
  width: 28px;
  height: 28px;
  color: var(--color-accent);
  margin-bottom: 6px;
}

.about-title {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--color-text-primary);
}

.about-lead {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.about-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 0;
}

.about-edition,
.about-version {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.about-edition {
  background: var(--color-surface-active);
  color: var(--color-text-secondary);
}

.about-version {
  background: var(--color-accent-dim);
  color: var(--color-accent);
}

.about-note {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--color-text-secondary);
}

.about-credits {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 0 18px;
  padding: 4px 0;
  border-top: 1px solid var(--color-panel-border);
  border-bottom: 1px solid var(--color-panel-border);
}

.about-credits div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 8px 0;
}

.about-credits div + div {
  border-top: 1px solid color-mix(in oklch, var(--color-panel-border) 70%, transparent);
}

.about-credits dt {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text-secondary);
}

.about-credits dd {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.about-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-section-label {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.about-licenses {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.about-licenses li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid color-mix(in oklch, var(--color-panel-border) 70%, transparent);
}

.about-licenses li:last-child,
.about-licenses li:not(:has(+ li:not(.hidden))) {
  border-bottom: none;
  padding-bottom: 0;
}

.about-lic-name {
  font-size: 12.5px;
  color: var(--color-text-primary);
}

.about-lic-id {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  text-align: right;
}

.about-ffmpeg-note {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.about-url {
  color: var(--color-accent);
}

/* ─── Update Banner ───────────────────────────────────────────────────────── */
.update-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  background: color-mix(in oklch, var(--color-accent) 14%, var(--color-panel-bg));
  border-bottom: 1px solid var(--color-accent);
  font-size: 12px;
  color: var(--color-text-primary);
  flex-shrink: 0;
}

.update-msg {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.update-progress-wrap {
  flex: 0 0 140px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.update-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.update-install-btn {
  flex-shrink: 0;
  padding: 3px 10px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.update-install-btn:hover {
  background: color-mix(in oklch, var(--color-accent) 86%, white);
}

.update-github-link {
  flex-shrink: 0;
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.update-github-link:hover { text-decoration: underline; }

.update-dismiss-btn {
  flex-shrink: 0;
  padding: 2px 6px;
  background: transparent;
  border: none;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

.update-dismiss-btn:hover { color: var(--color-text-primary); }

/* ─── Utility Classes ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.mt-6  { margin-top: 6px; }
.mt-8  { margin-top: 8px; }
.ml-8  { margin-left: 8px; }
.w-full { width: 100%; }

/* ─── Keyboard / a11y ─────────────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

input, textarea, select, [contenteditable] {
  user-select: text;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.skip-link:focus {
  top: 8px;
}

/* Web session status — plain text in the top bar; display-only */
.web-session-bar {
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.web-session-bar[data-state="unsaved"] {
  color: var(--color-text-secondary);
}

.web-session-bar[data-state="saved"],
.web-session-bar[data-state="imported"],
.web-session-bar[data-state="opened"] {
  color: var(--color-accent);
}

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

/* Browser layout: overlay side panels on narrower viewports so the preview stays usable. */
@media (max-width: 960px) {
  .app-name { display: none; }
  body[data-platform="web"] .app-layout {
    grid-template-columns: 1fr !important;
  }
  body[data-platform="web"] .inspector {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    width: min(320px, 88vw);
    box-shadow: 0 12px 40px oklch(0.12 0.03 275 / 0.35);
  }
  body[data-platform="web"] .inspector.collapsed {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
  body[data-platform="web"] .panel-toggle-right {
    z-index: 11;
    right: min(320px, 88vw);
  }
  body[data-platform="web"] .panel-toggle-right.collapsed {
    right: 0;
  }
  body[data-platform="web"] .studio-export .export-hint {
    display: none;
  }
}
