@import url('/static/css/theme-system.css?v=1.0');
/* ═══════════════════════════════════════════════════════════════
   山非山 · 设计系统 v2.0
   山雾金 — Mountain Mist Gold

   设计概念：雾散山现
   墨色基底 + 山雾层次 + 金光点缀 + 玉色/朱砂功能色
   东方哲学内核 · 现代工具表达
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Design Tokens ── */
:root {
  /* 墨色层次 Ink Depths */
  --ink-deepest: #070B14;
  --ink-base: #0B101D;
  --stone: #131A2B;
  --stone-raised: #192236;
  --stone-high: #1F2A40;

  /* 雾色边框 Mist Borders */
  --mist: rgba(255, 255, 255, 0.05);
  --mist-visible: rgba(255, 255, 255, 0.08);
  --mist-hover: rgba(255, 255, 255, 0.12);
  --mist-active: rgba(255, 255, 255, 0.16);

  /* 宣纸色 Paper Tones (text) */
  --paper: #E9E6DF;
  --paper-dim: #8A8D96;
  --paper-muted: #545866;

  /* 山巅金 Gold (accent) */
  --gold: #C49B4A;
  --gold-dim: #A07832;
  --gold-soft: rgba(196, 155, 74, 0.10);
  --gold-glow: rgba(196, 155, 74, 0.20);
  --gold-focus: rgba(196, 155, 74, 0.30);

  /* 玉色 Jade (success) */
  --jade: #5B9A8B;
  --jade-soft: rgba(91, 154, 139, 0.12);

  /* 朱砂 Vermilion (danger) */
  --vermillion: #C4554D;
  --vermillion-soft: rgba(196, 85, 77, 0.12);

  /* 青瓷 Celadon (info) */
  --celadon: #6B9EB7;
  --celadon-soft: rgba(107, 158, 183, 0.12);

  /* 兼容旧变量名（JS 引用） */
  --bg: var(--ink-deepest);
  --surface: var(--stone);
  --surface2: var(--stone-raised);
  --border: var(--mist);
  --border-hover: var(--mist-hover);
  --text: var(--paper);
  --muted: var(--paper-dim);
  --accent: var(--gold);
  --accent-dim: var(--gold-dim);
  --ok: var(--jade);
  --err: var(--vermillion);
  --danger: var(--vermillion);
  --warn: #D4A853;
  --blue: var(--celadon);
  --focus: var(--gold-focus);

  /* 字体 Font Stack */
  --font-display: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", "Songti SC", serif;
  --font-body: "Noto Sans SC", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Source Code Pro", Menlo, "DejaVu Sans Mono", monospace;

  /* 字号 Type Scale (1.25 ratio) */
  --text-2xs: 0.625rem;   /* 10px */
  --text-xs: 0.6875rem;    /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.375rem;     /* 22px */
  --text-2xl: 1.75rem;     /* 28px */
  --text-3xl: 2.25rem;     /* 36px */

  /* 间距 Spatial */
  --space-3xs: 2px;
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* 圆角 Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* 阴影 Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 0 1px rgba(196, 155, 74, 0.15), 0 8px 32px rgba(0, 0, 0, 0.5);

  /* 过渡 Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}

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

html {
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  height: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 350;
  line-height: 1.6;
  color: var(--paper);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(196, 155, 74, 0.025) 0%, transparent 60%),
    radial-gradient(ellipse at 85% 100%, rgba(91, 154, 139, 0.015) 0%, transparent 50%),
    var(--ink-deepest);
  overflow: hidden;
}

/* Subtle grain texture overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.015;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ── 3. Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.display-sm {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.06em;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--gold-dim);
}

/* ── 4. Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ── 5. Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  background: var(--stone);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out),
    opacity var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.btn:hover {
  background: var(--stone-raised);
  border-color: var(--mist-hover);
}

.btn:active {
  background: var(--stone-high);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.btn-sm {
  padding: 5px 10px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-ghost {
  background: transparent;
  border-color: var(--mist);
  color: var(--paper-dim);
}

.btn-ghost:hover {
  background: var(--stone);
  border-color: var(--mist-visible);
  color: var(--paper);
}

.btn-accent {
  background: linear-gradient(180deg, #D4A853 0%, var(--gold) 100%);
  color: #1A1408;
  border-color: #A07832;
  font-weight: 600;
}

.btn-accent:hover {
  filter: brightness(1.06);
  box-shadow: 0 2px 12px rgba(196, 155, 74, 0.25);
}

.btn-accent:active {
  filter: brightness(0.95);
}

.btn-danger {
  background: transparent;
  border-color: rgba(196, 85, 77, 0.3);
  color: var(--vermillion);
}

.btn-danger:hover {
  background: var(--vermillion-soft);
  border-color: var(--vermillion);
}

.btn-jade {
  background: transparent;
  border-color: rgba(91, 154, 139, 0.3);
  color: var(--jade);
}

.btn-jade:hover {
  background: var(--jade-soft);
  border-color: var(--jade);
}

/* ── 6. Inputs & Form Elements ── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  background: var(--ink-base);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.5;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

input::placeholder,
textarea::placeholder {
  color: var(--paper-muted);
  opacity: 0.6;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* ── 7. Cards ── */
.card {
  background: var(--stone);
  border: 1px solid var(--mist);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.card:hover {
  border-color: var(--mist-visible);
}

/* ── 8. Tags & Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-2xs);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.03em;
}

.tag-ok {
  background: var(--jade-soft);
  color: var(--jade);
}

.tag-warn {
  background: var(--gold-soft);
  color: var(--gold);
}

.tag-err {
  background: var(--vermillion-soft);
  color: var(--vermillion);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-2xs);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 99px;
  letter-spacing: 0.03em;
}

.badge-ok  { background: var(--jade-soft);  color: var(--jade); }
.badge-blue { background: var(--celadon-soft); color: var(--celadon); }
.badge-warn { background: var(--gold-soft); color: var(--gold); }
.badge-err  { background: var(--vermillion-soft); color: var(--vermillion); }

/* ── 9. Layout: Sidebar ── */
#sidebar,
.sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--stone);
  border-right: 1px solid var(--mist);
  display: flex;
  flex-direction: column;
  padding: var(--space-lg) 0;
  flex-shrink: 0;
  position: relative;
}

#sidebar::after,
.sidebar::after {
  content: "";
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(196, 155, 74, 0.15) 30%,
    rgba(196, 155, 74, 0.08) 70%,
    transparent 100%
  );
}

#sidebar .brand,
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-lg) var(--space-lg);
  border-bottom: 1px solid var(--mist);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--paper);
}

#sidebar .brand img,
.sidebar .brand img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--mist);
  background: var(--ink-base);
}

#sidebar .nav,
.sidebar .nav {
  margin-top: var(--space-md);
  flex: 1;
}

#sidebar .nav a,
.sidebar .nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px var(--space-lg);
  color: var(--paper-dim);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 400;
  border-left: 3px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
  letter-spacing: 0.03em;
}

#sidebar .nav a:hover,
.sidebar .nav a:hover {
  color: var(--paper);
  border-left-color: var(--mist-hover);
  background: rgba(255, 255, 255, 0.02);
}

#sidebar .nav a.on,
.sidebar .nav a.on {
  color: var(--paper);
  border-left-color: var(--gold);
  background: var(--gold-soft);
  font-weight: 500;
}

#sidebar .nav a .step-dot,
.sidebar .nav a .step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mist-visible);
  flex-shrink: 0;
  transition: background var(--duration-fast) var(--ease-out);
}

#sidebar .nav a.on .step-dot,
.sidebar .nav a.on .step-dot {
  background: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}

/* ── 10. Layout: Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--space-lg);
  border-bottom: 1px solid var(--mist);
  background:
    linear-gradient(180deg, var(--stone) 0%, rgba(19, 26, 43, 0.6) 100%);
  flex-shrink: 0;
  min-height: 48px;
  backdrop-filter: blur(8px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-center {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.brand-mark {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  border: 1px solid var(--mist);
  background: var(--ink-base);
}

.brand-title {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--paper-dim);
}

.project-name {
  border: 1px solid var(--mist);
  background: var(--ink-base);
  color: var(--paper);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: var(--text-sm);
  min-width: 150px;
  max-width: 260px;
}

.project-name::placeholder {
  color: var(--paper-muted);
}

/* ── 11. Layout: Workspace Grid ── */
.workspace {
  --ws-left: 1fr;
  --ws-mid: 1.5fr;
  --ws-right: 0.95fr;
  display: grid;
  grid-template-columns: var(--ws-left) 6px var(--ws-mid) 6px var(--ws-right);
  gap: 0;
  flex: 1;
  min-height: 0;
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--ink-deepest);
  position: relative;
}

.col::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(
    180deg,
    transparent,
    var(--mist) 20%,
    var(--mist) 80%,
    transparent
  );
  pointer-events: none;
}

.col:last-child::after {
  display: none;
}

.col-hd {
  padding: 9px 14px;
  font-size: var(--text-2xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-muted);
  border-bottom: 1px solid var(--mist);
  background: var(--stone);
}

.col-body {
  flex: 1;
  overflow: auto;
  padding: var(--space-sm) 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── 12. Pane Splitters ── */
.pane-splitter {
  background: var(--stone);
  cursor: col-resize;
  position: relative;
  user-select: none;
  touch-action: none;
  z-index: 2;
  transition: background var(--duration-fast) var(--ease-out);
}

.pane-splitter::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.10);
  transition:
    background var(--duration-fast) var(--ease-out),
    height var(--duration-fast) var(--ease-out);
}

.pane-splitter:hover {
  background: var(--stone-high);
}

.pane-splitter:hover::before {
  background: var(--gold);
  height: 48px;
}

/* ── 13. Media Card ── */
.media-card {
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--stone);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.media-card:hover {
  border-color: var(--mist-visible);
}

.media-thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ink-deepest);
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--paper-muted);
}

.media-name {
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 8px 10px 0;
  word-break: break-all;
}

/* ── 14. Pipeline Panel ── */
#pipelineOverlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 20, 0.6);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.pipeline-panel {
  background: var(--stone);
  border: 1px solid var(--mist);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  min-width: 400px;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
}

.pipeline-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-lg);
  font-size: var(--text-lg);
  font-weight: 600;
}

.pipeline-ver {
  font-size: var(--text-2xs);
  color: var(--paper-muted);
  margin-left: auto;
}

.pipeline-close {
  background: none;
  border: none;
  color: var(--paper-dim);
  cursor: pointer;
  font-size: 18px;
  padding: 0 4px;
  transition: color var(--duration-fast) var(--ease-out);
}

.pipeline-close:hover {
  color: var(--paper);
}

.pipeline-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: var(--space-lg);
}

.pipe-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--ink-base);
  font-size: var(--text-sm);
  border: 1px solid transparent;
  transition: all var(--duration-base) var(--ease-out);
}

.pipe-step .step-icon {
  font-size: 16px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.pipe-step .step-body {
  flex: 1;
}

.pipe-step .step-msg {
  font-weight: 500;
}

.pipe-step .step-detail {
  font-size: var(--text-xs);
  color: var(--paper-dim);
  margin-top: 2px;
}

.pipe-step.active {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.pipe-step.done {
  color: var(--jade);
}

.pipe-step.done .step-icon {
  color: var(--jade);
}

.pipe-step.error {
  color: var(--vermillion);
  border-color: rgba(196, 85, 77, 0.3);
}

.pipe-step.pending {
  opacity: 0.35;
}

.pipeline-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pipeline-controls label {
  font-size: var(--text-sm);
  color: var(--paper-dim);
}

/* ── 15. Segment Cards ── */
.segment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.seg-card {
  background: var(--stone);
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  transition: border-color var(--duration-fast) var(--ease-out);
}

.seg-card:hover {
  border-color: var(--mist-visible);
}

.seg-card .seg-title {
  font-weight: 500;
  font-size: var(--text-base);
  margin-bottom: 6px;
}

.seg-card .seg-meta {
  font-size: var(--text-xs);
  color: var(--paper-dim);
  margin-bottom: 10px;
}

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

.seg-card .seg-actions a {
  font-size: var(--text-xs);
  color: var(--gold);
  text-decoration: none;
}

.seg-card.done {
  border-color: rgba(91, 154, 139, 0.3);
}

.seg-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px;
}

.seg-switcher.hidden {
  display: none !important;
}

/* ── 16. Chat Messages ── */
.ai-chat-log {
  flex: 1;
  min-height: 140px;
  max-height: min(38vh, 340px);
  overflow-y: auto;
  padding: 4px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--text-xs);
}

.chat-msg {
  font-size: 1em;
  line-height: 1.5;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  max-width: 100%;
  border: 1px solid var(--mist);
  background: var(--stone-raised);
}

.chat-msg .tag {
  font-size: 0.84em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 4px;
}

.chat-msg.ok   { border-left: 3px solid var(--jade); }
.chat-msg.warn { border-left: 3px solid var(--gold); }
.chat-msg.muted { opacity: 0.8; }

/* ── 17. Audio Viz / Waveform ── */
.audio-viz-wrap {
  border-top: 1px solid var(--mist);
  background: var(--ink-deepest);
  flex-shrink: 0;
}

.spectrum-bar { display: none; }
.spectrum-bar canvas { display: none; }

.time-ruler {
  height: 22px;
  background: rgba(7, 11, 20, 0.8);
  border-bottom: 1px solid var(--mist);
  position: relative;
  overflow: hidden;
}

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

.track-wrap {
  position: relative;
  height: 72px;
  cursor: pointer;
  overflow: hidden;
  background: #080C14;
  touch-action: none;
}

.track-thumbs {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: hidden;
}

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

.track-wave-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.track-wave-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gold);
  pointer-events: none;
  left: 0;
  z-index: 2;
  box-shadow: 0 0 8px rgba(196, 155, 74, 0.4);
}

.waveform-time-tip {
  position: absolute;
  top: 2px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--paper);
  font-size: var(--text-2xs);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  pointer-events: none;
  display: none;
  z-index: 3;
  white-space: nowrap;
}

.viz-label {
  font-size: var(--text-2xs);
  color: var(--paper-muted);
  padding: 2px 14px 0;
  letter-spacing: 0.06em;
}

/* ── 18. Video Shell ── */
.video-shell {
  flex: 1;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: var(--ink-deepest);
  position: relative;
  overflow: hidden !important;
}

#resultVideo,
#freeResultVideo {
  display: block;
  position: absolute !important;
  inset: 18px !important;
  max-width: calc(100% - 36px) !important;
  max-height: calc(100% - 36px) !important;
  width: calc(100% - 36px) !important;
  height: calc(100% - 36px) !important;
  object-fit: contain !important;
  border-radius: var(--radius-xs);
  border: 2px solid var(--gold);
  background: #000;
  box-shadow: var(--shadow-gold);
  transform-origin: center center;
  transform: none !important;
}

/* ── 19. Transport Bar ── */
.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--mist);
  background: var(--stone);
}

.transport label {
  font-size: var(--text-xs);
  color: var(--paper-dim);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* ── 20. Script Block ── */
.script-block {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 14px 12px;
  gap: 6px;
}

textarea#scriptArea {
  flex: 1;
  min-height: 200px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* ── 21. Zoom Controls ── */
.field-label {
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--paper-muted);
  letter-spacing: 0.06em;
}

.zoom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 2px;
}

.zoom-row .field-label {
  margin: 0;
}

.zoom-ctl {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.zoom-ctl .btn-zoom {
  min-width: 26px;
  height: 24px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1;
  border-radius: var(--radius-sm);
  border: 1px solid var(--mist);
  background: var(--stone-raised);
  color: var(--paper-dim);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.zoom-ctl .btn-zoom:hover {
  border-color: var(--gold-dim);
  color: var(--gold);
}

.zoom-ctl .zoom-val {
  font-size: var(--text-2xs);
  color: var(--paper-muted);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── 22. Misc Components ── */
.file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.transcribe-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--paper-dim);
  font-size: var(--text-xs);
  cursor: pointer;
  white-space: nowrap;
}

.transcribe-option input {
  accent-color: var(--gold);
}

.file-actions .transcribe-option {
  flex: 1 0 100%;
}

label.file-select-label {
  position: relative;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  overflow: hidden;
}

label.file-select-label input[type=file] {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 24px;
}

#clientErrorBanner {
  display: none;
  margin: 0 18px 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(196, 155, 74, 0.25);
  background: var(--gold-soft);
  color: #D4A853;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.live-status {
  font-size: var(--text-xs);
  color: var(--paper-dim);
  padding: 0 14px 8px;
  min-height: 20px;
  border-bottom: 1px solid var(--mist);
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 1200px) {
  .meta-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.hint {
  font-size: var(--text-2xs);
  color: var(--paper-muted);
  line-height: 1.5;
}

.status {
  white-space: pre-wrap;
  font-size: var(--text-xs);
  color: var(--paper-dim);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--stone);
  border: 1px solid var(--mist);
  min-height: 36px;
}

.stage {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--ink-deepest);
  overflow: hidden;
}

.col-edit .video-shell,
.free-edit-col .video-shell {
  flex: 0 1 auto;
  min-height: 180px;
  height: min(42vh, 480px);
  max-height: min(42vh, 480px);
  position: relative;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.download-link {
  display: none;
  text-decoration: none;
  color: var(--jade);
  font-weight: 600;
  font-size: var(--text-sm);
}

.timeline-bar {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--mist);
  margin-left: 12px;
  position: relative;
  overflow: hidden;
}

.timeline-bar::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 18%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 4px;
  opacity: 0.5;
}

/* ── 23. Tab Bar ── */
.nav-steps {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border: 1px solid var(--mist);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--stone);
}

.nav-step {
  flex: 1;
  padding: 10px 8px;
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--paper-dim);
  border-right: 1px solid var(--mist);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  user-select: none;
}

.nav-step:last-child {
  border-right: none;
}

.nav-step.active {
  background: var(--stone-raised);
  color: var(--paper);
  font-weight: 500;
}

.nav-step .step-num {
  display: block;
  font-size: var(--text-2xs);
  color: rgba(138, 141, 150, 0.4);
  margin-bottom: 2px;
  transition: color var(--duration-fast) var(--ease-out);
}

.nav-step.active .step-num { color: var(--gold); }
.nav-step.done .step-num { color: var(--jade); }
.nav-step.done { color: var(--paper-dim); }

/* ── 24. Progress Bar ── */
.progress-bar-wrap {
  height: 2px;
  background: var(--stone-raised);
  border-radius: 1px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.progress-bar {
  height: 2px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 1px;
  transition: width 0.4s var(--ease-out);
}

/* ── 25. Animations ── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes mistFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(1%, -2%) scale(1.02); }
  66%      { transform: translate(-1%, 1%) scale(0.98); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ── 26. Utility Classes ── */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--paper-dim);
}

.text-gold {
  color: var(--gold);
}

.text-jade {
  color: var(--jade);
}

.text-vermillion {
  color: var(--vermillion);
}

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

/* ── 27. Responsive ── */
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .col {
    border-right: 0;
    border-bottom: 1px solid var(--mist);
  }
  .col::after { display: none; }
  .workspace .pane-splitter { display: none; }
}

@media (max-width: 900px) {
  #sidebar,
  .sidebar {
    width: 60px;
    min-width: 60px;
  }
  #sidebar .brand,
  .sidebar .brand {
    justify-content: center;
    padding: 0 8px var(--space-md);
  }
  #sidebar .brand span,
  .sidebar .brand span {
    display: none;
  }
  #sidebar .nav a,
  .sidebar .nav a {
    justify-content: center;
    padding: 10px;
    font-size: 0;
  }
  #sidebar .nav a .step-dot,
  .sidebar .nav a .step-dot {
    margin: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    padding: 8px 12px;
  }
  .brand-title {
    display: none;
  }
}
