/* ==========================================================================
   HYPERFRAMES THAI STUDIO — STUDIO-GRADE DARK NLE STYLESHEET
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #11151b;
  --panel2: #171c24;
  --line: #252b35;
  --line2: #303744;
  --text: #f2f4f7;
  --muted: #8b95a5;
  --blue: #3b82f6;
  --blue2: #2563eb;
  --green: #58c998;
  --red: #ef6b6b;
  --primary: #3b82f6;
  --ground: #090b0f;
  --sheet: #11151b;
  --sheet-soft: #171c24;
}

html.dark {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #11151b;
  --panel2: #171c24;
  --line: #252b35;
  --line2: #303744;
  --text: #f2f4f7;
  --muted: #8b95a5;
  --blue: #3b82f6;
  --blue2: #2563eb;
  --green: #58c998;
  --red: #ef6b6b;
  --primary: #3b82f6;
  --ground: #090b0f;
  --sheet: #11151b;
  --sheet-soft: #171c24;
}

html:not(.dark) {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel2: #f9fafb;
  --line: #e5e7eb;
  --line2: #d1d5db;
  --text: #111827;
  --muted: #6b7280;
  --blue: #2563eb;
  --blue2: #1d4ed8;
  --green: #059669;
  --red: #dc2626;
  --primary: #2563eb;
  --ground: #f3f4f6;
  --sheet: #ffffff;
  --sheet-soft: #f9fafb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans Thai", "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 12px;
  line-height: 1.45;
  overflow: hidden;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: transparent;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   SHELL & TOPBAR
   -------------------------------------------------------------------------- */
.editor-shell {
  min-height: 100dvh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  height: 54px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 16px;
  background: #0d1015;
  flex: none;
  z-index: 10;
}

.brand-lockup, .top-center, .top-actions {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
  min-width: 250px;
}

.brand-mark {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  width: 25px;
  height: 24px;
  padding: 4px;
  background: #1b2741;
  border: 1px solid #30466d;
  border-radius: 6px;
}

.brand-mark span {
  width: 4px;
  background: #5b91f6;
  border-radius: 1px;
}

.brand-mark span:nth-child(1) { height: 8px; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 17px; }

.brand-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Reads as metadata beside the product name, not as part of it: lighter weight, muted, and
   tabular figures so the version does not jitter the lockup when a deploy changes it. */
.build-badge {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  cursor: help;
}

.project-name {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

.top-center {
  gap: 6px;
}

.top-divider {
  height: 18px;
  border-left: 1px solid var(--line2);
  margin: 0 8px;
}

.save-state {
  color: #9ca7b8;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
}

.top-actions {
  gap: 8px;
}

.icon-btn, .transport-btn {
  border: 0;
  background: transparent;
  color: #98a3b3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  transition: all 0.15s;
}

.icon-btn:hover, .transport-btn:hover {
  background: #202733;
  color: #fff;
}

.icon-btn svg, .transport-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn.muted {
  color: #515c6d;
}

.export-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 31px;
  background: var(--blue2);
  border: 1px solid #5790f8;
  color: #fff;
  border-radius: 5px;
  padding: 0 14px;
  font-weight: 600;
  font-size: 12px;
  transition: background 0.15s;
}

.export-btn:hover {
  background: #3478ed;
}

.export-btn svg {
  width: 14px;
  height: 14px;
}

/* User Profile Badge */
.nav-user {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #171d26;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px 2px 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-chip-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #243450;
  color: #8bb3f8;
  display: grid;
  place-items: center;
}

.user-chip-avatar svg {
  width: 12px;
  height: 12px;
}

.user-chip-name {
  font-size: 11px;
  font-weight: 600;
  color: #dce4f2;
}

.nav-logout-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
}

.nav-logout-btn:hover {
  color: var(--red);
  background: rgba(239, 107, 107, 0.1);
}

.nav-logout-btn svg {
  width: 11px;
  height: 11px;
}

/* --------------------------------------------------------------------------
   WORKSPACE GRID (4 COLUMNS)
   -------------------------------------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: 58px 300px minmax(0, 1fr) 292px;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   COLUMN 1: TOOL RAIL
   -------------------------------------------------------------------------- */
.tool-rail {
  border-right: 1px solid var(--line);
  background: #0d1015;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 7px 10px;
  width: 58px;
  flex: none;
}

.rail-tools, .rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}

.rail-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: #748091;
  width: 44px;
  height: 46px;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  transition: all 0.15s;
}

.rail-btn svg {
  width: 17px;
  height: 17px;
}

.rail-btn:hover {
  color: #dce5f7;
  background: #171d27;
}

.rail-btn.is-active, .rail-btn.active {
  color: #eaf1ff;
  background: #192642;
}

.rail-btn.is-active:before, .rail-btn.active:before {
  content: "";
  position: absolute;
  left: -7px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: #4b8af5;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   COLUMN 2: CONTEXT PANEL
   -------------------------------------------------------------------------- */
.context-panel {
  min-width: 0;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px 15px;
  overflow-y: auto;
}

.context-tab {
  display: none;
}

.context-tab.is-active {
  display: block;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-heading h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
  letter-spacing: 0.1px;
}

.section-label, .property-title, .eyebrow {
  color: #7e8999;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.section-label {
  margin: 18px 0 8px;
}

/* Upload Zone */
.upload-zone {
  width: 100%;
  min-height: 84px;
  border: 1px dashed #3b4657;
  background: #151b24;
  color: #dce4f2;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  padding: 12px;
  text-align: center;
  transition: all 0.15s;
}

.upload-zone:hover {
  border-color: #5d8fef;
  background: #182337;
}

.upload-zone svg {
  width: 20px;
  height: 20px;
  color: #6d9af2;
}

.upload-zone small, .helper-copy {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.45;
}

/* Media Item */
.media-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #171d25;
  border: 1px solid #29313d;
  border-radius: 5px;
}

.media-thumb {
  width: 32px;
  height: 32px;
  background: #263958;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #76a5fa;
  flex: none;
}

.media-thumb svg {
  width: 16px;
  height: 16px;
}

.media-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.media-info strong {
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-info span {
  font-size: 9px;
  color: var(--muted);
}

/* Form Controls */
.select-input, .wide-input, .range-row input, .advanced-grid input, .position-grid input, .unit-input input, .color-input input {
  height: 30px;
  border: 1px solid #303846;
  border-radius: 4px;
  background: #0d1117;
  color: #dfe5ed;
  padding: 0 9px;
  outline: none;
  width: 100%;
  font-size: 11px;
}

.select-input:focus, .wide-input:focus, input:focus, textarea:focus {
  border-color: #4e84e8;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.field-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  margin-bottom: 8px;
}

.mono, .timecode {
  font-family: ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.02em;
}

.range-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.range-row > div {
  flex: 1;
}

.range-row span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-bottom: 5px;
}

.range-row .arrow {
  padding-bottom: 7px;
  color: #657186;
}

.tool-section {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 15px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-heading > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.section-heading svg {
  width: 14px;
  height: 14px;
  color: #7da7fa;
}

.live-pill {
  color: #5ed1a0;
  background: #143429;
  border: 1px solid #255541;
  border-radius: 12px;
  font-size: 9px;
  padding: 2px 7px;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin: 12px 0 6px;
}

/* Advanced details */
.advanced {
  margin-top: 12px;
  border-top: 1px solid #202733;
  padding-top: 10px;
}

.advanced summary {
  display: flex;
  justify-content: space-between;
  list-style: none;
  color: #aab4c3;
  font-size: 11px;
  cursor: pointer;
}

.advanced summary::-webkit-details-marker { display: none; }
.advanced summary svg { width: 13px; height: 13px; }

.advanced-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.advanced-grid label, .position-grid label {
  font-size: 9px;
  color: var(--muted);
}

.advanced-grid input, .position-grid input {
  margin-top: 4px;
  padding: 0 6px;
  font-size: 10px;
}

.process-btn {
  height: 34px;
  width: 100%;
  border: 1px solid #528af0;
  background: #285fc4;
  color: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 14px;
  transition: background 0.15s;
}

.process-btn:hover:not(:disabled) {
  background: #3472df;
}

.process-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.process-btn svg {
  width: 14px;
  height: 14px;
}

/* Progress bar */
.progress-wrap {
  margin-top: 13px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: #c8d1df;
  font-size: 10px;
}

.progress-track {
  height: 4px;
  background: #28313e;
  border-radius: 4px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: #55bd90;
  transition: width 0.3s ease;
}

/* Cut section & secondary buttons */
.cut-section {
  margin-top: 14px;
}

.secondary-btn, .download-srt, .tiny-action {
  height: 28px;
  border: 1px solid #334052;
  background: #171d26;
  color: #aeb8c7;
  border-radius: 4px;
  padding: 0 9px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.secondary-btn:hover, .download-srt:hover, .tiny-action:hover {
  background: #202733;
  color: #fff;
  border-color: #48566b;
}

.secondary-btn svg, .download-srt svg, .tiny-action svg {
  width: 13px;
  height: 13px;
}

.count-badge {
  background: #293c60;
  color: #a9c5ff;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
}

.cut-list {
  margin-top: 9px;
  color: #9ba7b7;
  font-size: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cut-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: #141920;
  border: 1px solid #242b35;
  border-radius: 3px;
}

.cut-dot {
  width: 5px;
  height: 5px;
  background: var(--red);
  border-radius: 50%;
}

.caption-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.caption-toolbar > span {
  flex: 1;
}

.tiny-action {
  height: 24px;
  padding: 0 7px;
  font-size: 9px;
}

.qa-note {
  margin: 10px 0;
  padding: 6px 8px;
  background: #11241d;
  color: #75c9a1;
  border: 1px solid #224837;
  border-radius: 3px;
  font-size: 9px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.qa-note svg {
  width: 12px;
  height: 12px;
}

/* Subtitle Cards List */
.subtitle-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.subtitle-cue {
  background: #151a22;
  border: 1px solid #262e3b;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.15s;
}

.subtitle-cue.is-active {
  background: #192538;
  border-color: #4a88f4;
}

.subtitle-cue.has-error {
  border-color: var(--red);
}

.subtitle-cue.has-warning {
  border-color: #d97706;
}

.cue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cue-seek {
  border: none;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 0;
  font-size: 10px;
}

.cue-index {
  font-weight: 700;
  color: #5e97f6;
  font-family: monospace;
}

.cue-summary {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dce4f2;
}

.cue-metrics {
  font-size: 9px;
  color: var(--muted);
  font-family: monospace;
  display: flex;
  gap: 5px;
}

.cue-delete {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
}

.cue-delete:hover {
  color: var(--red);
  background: rgba(239, 107, 107, 0.1);
}

.cue-delete svg {
  width: 12px;
  height: 12px;
}

.cue-time-grid {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
}

.cue-field {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
}

.cue-field span {
  font-size: 9px;
  color: var(--muted);
}

.cue-time {
  width: 100%;
  height: 24px;
  border: 1px solid var(--line2);
  background: #0d1117;
  color: var(--text);
  border-radius: 3px;
  padding: 0 5px;
  font-size: 9px;
  font-family: monospace;
}

.cue-text {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line2);
  background: #0d1117;
  color: var(--text);
  border-radius: 3px;
  padding: 5px;
  font-size: 11px;
  resize: vertical;
  line-height: 1.4;
}

.subtitle-editor-empty {
  text-align: center;
  padding: 24px 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.subtitle-editor-empty svg {
  width: 28px;
  height: 28px;
  color: #4b586e;
}

.download-srt {
  width: 100%;
  justify-content: center;
}

.ai-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 8px;
  border: 1px solid #293342;
  background: #151b24;
  margin-bottom: 7px;
  border-radius: 4px;
}

.ai-card > svg {
  width: 16px;
  height: 16px;
  color: #78a5fa;
  flex: none;
}

.ai-card div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.ai-card strong {
  font-size: 10px;
}

.ai-card span {
  color: #6bc49c;
  font-size: 9px;
}

.ai-card > svg:last-child {
  color: #63c99a;
  width: 13px;
}

/* --------------------------------------------------------------------------
   COLUMN 3: PROGRAM MONITOR & MULTITRACK TIMELINE
   -------------------------------------------------------------------------- */
.monitor-area {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) 48px 230px;
  background: #0b0e13;
  height: 100%;
  overflow: hidden;
}

.monitor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  border-bottom: 1px solid #1d232c;
  background: #0d1015;
  min-height: 56px;
  height: max-content;
  flex-wrap: wrap;
  gap: 8px;
  padding-block: 6px;
}

.monitor-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.resolution-badge {
  color: #7e8998;
  font-size: 10px;
  font-family: monospace;
  background: #151b24;
  border: 1px solid #283344;
  border-radius: 3px;
  padding: 2px 6px;
}

.monitor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-select {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #303846;
  background: #131820;
  color: #aab5c5;
  height: 24px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 10px;
}

/* Preview stage and selected video canvas */
.preview-stage {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #151a22 0%, #0b0e13 70%);
  padding: 10px;
  position: relative;
  overflow: hidden;
}

.video-frame {
  width: 100%;
  height: 100%;
  flex: none;
  position: relative;
  background: #151a22;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5);
  border: 1px solid #2c3541;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-frame video {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  flex: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.video-frame.has-video { background: #000; }
.canvas-control { display: flex; align-items: center; gap: 8px; min-width: 0; }
.canvas-control label { color: #c8d1df; font-size: 11px; }
.canvas-control .studio-select { width: 218px; max-width: 100%; }
.canvas-control .studio-select-trigger { background: #151b24; color: #f2f4f7; border-color: #445168; }
.canvas-ratio { color: #aab5c5; font-size: 11px; white-space: nowrap; }
.workspace-toggle { min-height: 44px; padding: 0 12px; border: 1px solid #445168; border-radius: 4px; background: #151b24; color: #f2f4f7; font: inherit; font-size: 12px; cursor: pointer; }
.workspace-toggle:hover { background: #253246; }
.workspace-toggle[aria-pressed="true"] { background: #1f3b6d; border-color: #648dda; }
.workspace-toggle:focus-visible { outline: 2px solid #93b4ff; outline-offset: 2px; }
.monitor-actions #fullscreen-btn { width: 44px; height: 44px; flex: none; }
@media (min-width: 801px) {
  .workspace.is-wide { grid-template-columns: 58px minmax(0, 1fr) 260px; }
  .workspace.is-wide .context-panel { display: none; }
}
@media (min-width: 801px) and (max-height: 600px) {
  .monitor-area { grid-template-rows: auto minmax(220px, 1fr) 48px 230px; overflow-y: auto; }
}
@media (max-width: 800px) {
  .workspace-toggle { display: none; }
  .canvas-control label { display: none; }
  .canvas-control .studio-select { width: min(218px, 58vw); }
  .monitor-actions { flex-wrap: wrap; max-width: 100%; }
  .monitor-area { min-height: 450px; }
}

.preview-safe-label {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-family: monospace;
  color: #4a5568;
  letter-spacing: 0.1em;
  pointer-events: none;
  z-index: 2;
}

.frame-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(8, 11, 15, 0.8);
  color: #adb8c8;
  border-radius: 3px;
  padding: 2px 6px;
  font: 9px monospace;
  z-index: 2;
}

.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  gap: 8px;
}

.preview-empty-state svg {
  width: 42px;
  height: 42px;
  color: #3b4657;
}

.preview-empty-state strong {
  font-size: 13px;
  color: #dce4f2;
}

.preview-empty-state span {
  font-size: 10px;
  max-width: 220px;
}

/* Caption Overlay on Video */
.caption-preview-layer {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

#editor-caption-overlay {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  display: inline-block;
  padding: 0;
  border-radius: 0;
  line-height: normal;
  width: max-content;
  max-width: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  touch-action: none;
}

#editor-caption-overlay:focus-visible,
#editor-caption-overlay:focus-within,
#editor-caption-overlay:hover,
#editor-caption-overlay.is-dragging,
#editor-caption-overlay.is-resizing {
  outline: 2px dashed var(--blue);
}

#editor-caption-overlay.is-dragging {
  cursor: grabbing;
}

.caption-resize-handle {
  position: absolute;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  touch-action: none;
  opacity: 0;
}

.caption-resize-handle::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid var(--blue);
  background: var(--panel2);
}

#editor-caption-overlay:hover .caption-resize-handle,
#editor-caption-overlay:focus-within .caption-resize-handle,
#editor-caption-overlay.is-resizing .caption-resize-handle { opacity: 1; }
.caption-resize-handle:focus-visible { outline: 2px solid var(--blue); }
.caption-resize-handle.corner-nw { left: -12px; top: -12px; cursor: nwse-resize; }
.caption-resize-handle.corner-ne { right: -12px; top: -12px; cursor: nesw-resize; }
.caption-resize-handle.corner-sw { left: -12px; bottom: -12px; cursor: nesw-resize; }
.caption-resize-handle.corner-se { right: -12px; bottom: -12px; cursor: nwse-resize; }

@media (pointer: coarse) {
  .caption-resize-handle { width: 44px; height: 44px; opacity: 1; }
  .caption-resize-handle::after { inset: 17px; }
  .caption-resize-handle.corner-nw { left: -22px; top: -22px; }
  .caption-resize-handle.corner-ne { right: -22px; top: -22px; }
  .caption-resize-handle.corner-sw { left: -22px; bottom: -22px; }
  .caption-resize-handle.corner-se { right: -22px; bottom: -22px; }
}

.caption-guide {
  position: absolute;
  background: rgba(59, 130, 246, 0.6);
  pointer-events: none;
}

.caption-guide.v-guide { top: 0; bottom: 0; width: 1px; }
.caption-guide.h-guide { left: 0; right: 0; height: 1px; }

/* Transport Controls */
.transport {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #10141a;
  flex: none;
  height: 48px;
}

.transport-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.play-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid #5a8ff0;
  background: #2f6edb;
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}

.play-btn:hover:not(:disabled) {
  background: #3b7ced;
}

.play-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.play-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  margin-left: 1px;
}

.transport-scrub {
  flex: 1;
  display: flex;
  align-items: center;
}

.transport-scrub input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  cursor: pointer;
}

.timecode {
  font-size: 10px;
  color: #e0e7f1;
  min-width: 55px;
}

.muted-text {
  color: #738095;
  text-align: right;
}

/* Timeline Multitrack Panel */
.timeline-panel {
  min-height: 0;
  background: #11151b;
  border-top: 1px solid #252c36;
  display: flex;
  flex-direction: column;
  height: 230px;
}

.timeline-toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.timeline-title svg {
  width: 14px;
  height: 14px;
  color: #7fa9fb;
}

.timeline-status {
  font-size: 9px;
  color: #68bd99;
  border-left: 1px solid var(--line2);
  padding-left: 8px;
  margin-left: 4px;
}

.timeline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-action {
  height: 24px;
  background: #1b2535;
  border: 1px solid #344865;
  color: #a6c5fa;
  border-radius: 3px;
  padding: 0 8px;
  font-size: 9px;
  display: flex;
  gap: 5px;
  align-items: center;
  cursor: pointer;
}

.timeline-actions input[type="range"] {
  width: 65px;
  accent-color: #5b92f4;
}

.timeline-scroll {
  display: flex;
  min-height: 0;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}

.track-labels {
  width: 88px;
  flex: none;
  background: #151a21;
  border-right: 1px solid var(--line);
  z-index: 3;
}

.ruler-label {
  height: 24px;
  border-bottom: 1px solid var(--line);
}

.track-label {
  height: 42px;
  border-bottom: 1px solid #242b35;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  color: #7f8a9b;
  font-size: 9px;
  font-weight: 600;
}

.track-label svg {
  width: 12px;
  height: 12px;
}

.track-canvas-wrap {
  min-width: 0;
  flex: none;
  position: relative;
}

.time-ruler {
  height: 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 0 7px;
  align-items: center;
  color: #687589;
  font: 9px monospace;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 74px, #29313d 75px);
}

.track-canvas {
  position: relative;
  height: calc(100% - 24px);
  outline: none;
}

.track {
  height: 42px;
  border-bottom: 1px solid #242b35;
  position: relative;
  background: repeating-linear-gradient(90deg, transparent 0, transparent 74px, #1a202a 75px);
}

.source-clip {
  position: absolute;
  inset: 6px 6px;
  background: #273447;
  border: 1px solid #3b577e;
  border-radius: 3px;
  color: #9cb5df;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 9px;
}

.cut-track-blocks {
  position: absolute;
  inset: 0;
}

.cut-track-block {
  position: absolute;
  top: 6px;
  height: 30px;
  background: rgba(166, 77, 85, 0.4);
  border: 1px solid #a64d55;
  color: #dd858b;
  border-radius: 2px;
  font: 9px monospace;
  display: flex;
  align-items: center;
  justify-content: center;
}

.subtitle-track-blocks {
  position: absolute;
  inset: 0;
}

.subtitle-track-cue {
  position: absolute;
  top: 6px;
  height: 30px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #21477f;
  border: 1px solid #386db3;
  color: #b9d5ff;
  border-radius: 2px;
  padding: 6px 12px;
  font-size: 9px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.subtitle-track-help { margin: 0; padding: 4px 12px; color: var(--muted); background: var(--panel2); font-size: 10px; }
.subtitle-track-cue-label { display: block; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.subtitle-cue-handle { position: absolute; top: 0; bottom: 0; width: min(10px, 35%); cursor: ew-resize; background: rgba(255, 255, 255, 0.12); }
.subtitle-cue-handle::after { content: ""; position: absolute; top: 7px; bottom: 7px; left: 50%; border-left: 2px solid currentColor; opacity: 0.7; }
.subtitle-cue-handle.handle-start { left: 0; }
.subtitle-cue-handle.handle-end { right: 0; }
.subtitle-track-cue.is-editing { cursor: grabbing; outline: 2px solid var(--blue); z-index: 2; }
.subtitle-track-cue:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
html:not(.dark) .subtitle-track-cue { color: #fff; background: #1e4b86; }
html:not(.dark) .subtitle-track-cue.is-active { background: #2563a9; }

.subtitle-track-cue.is-active {
  background: #2d67b6;
  border-color: #74a9ff;
  color: #fff;
  box-shadow: 0 0 0 1px #74a9ff;
}

.subtitle-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef6b6b;
  z-index: 4;
  pointer-events: none;
}

.subtitle-playhead::before {
  content: "";
  position: absolute;
  top: 0;
  left: -4px;
  width: 10px;
  height: 10px;
  background: #ef6b6b;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* --------------------------------------------------------------------------
   COLUMN 4: INSPECTOR
   -------------------------------------------------------------------------- */
.inspector {
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
}

.inspector-heading {
  padding: 16px 14px 12px;
}

.inspector-heading h2 {
  font-size: 14px;
  margin: 6px 0 0;
}

.inspector-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  gap: 16px;
}

.inspector-tabs button {
  height: 30px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #758195;
  font-size: 10px;
}

.inspector-tabs button.active {
  color: #dce7fa;
  border-color: #4d87f5;
}

.inspector-content {
  padding: 14px;
}

.caption-tools-label { display: block; color: var(--text); margin-bottom: 8px; font-weight: 600; }
.caption-tools-help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 6px 0 0; }
.caption-font-sample { margin: 8px 0 14px; padding: 10px; font-size: 18px; color: var(--text); background: var(--panel2); border: 1px solid var(--line2); overflow-wrap: anywhere; }
.caption-bulk-button { width: 100%; min-height: 44px; color: var(--text); background: var(--panel2); border: 1px solid var(--blue); border-radius: 3px; font-weight: 600; }
.caption-bulk-button:hover { background: var(--panel); }
.caption-length-tools .secondary-btn { width: 100%; min-height: 44px; margin-top: 8px; }
#caption-edit-scope, #style-font, #caption-length { width: 100%; min-width: 0; min-height: 44px; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); }
.caption-bulk-button:disabled { opacity: .5; cursor: not-allowed; }
#caption-style-inspector button:focus-visible, #caption-style-inspector select:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
html:not(.dark) .inspector-scope, html:not(.dark) .property-row { color: var(--muted); }
html:not(.dark) .style-scope-badge { color: var(--text); background: var(--panel2); border-color: var(--line2); }
.inspector .unit-input input, .inspector .color-input input { color: var(--text); background: var(--panel2); border-color: var(--line2); }
#subtitle-qa-summary { display: flex; align-items: flex-start; gap: 8px; }
#subtitle-qa-summary svg { width: 16px; height: 16px; flex: none; }
html:not(.dark) .subtitle-cue { color: var(--text); background: var(--panel2); }
html:not(.dark) .subtitle-cue textarea, html:not(.dark) .subtitle-cue input { color: var(--text); background: var(--panel); }

.inspector-scope {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #8d98aa;
  font-size: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.style-scope-badge {
  display: inline-block;
  background: #192233;
  border: 1px solid #38547d;
  color: #b9d3fc;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 10px;
}

.property-group {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.property-title {
  margin-bottom: 12px;
}

.property-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
  color: #9ba6b6;
  font-size: 10px;
}

.unit-input {
  display: flex;
  align-items: center;
  gap: 4px;
}

.unit-input input {
  width: 48px;
  text-align: right;
  height: 26px;
}

.unit-input span {
  color: #6e7a8d;
  font-size: 9px;
}

.align-group {
  border: 1px solid #303a48;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}

.align-group button {
  width: 28px;
  height: 25px;
  border: 0;
  border-right: 1px solid #303a48;
  background: #131820;
  color: #7e8999;
  display: grid;
  place-items: center;
}

.align-group button:last-child {
  border-right: 0;
}

.align-group button.is-active, .align-group button.active {
  background: #2c5794;
  color: #dce9ff;
}

.align-group svg {
  width: 13px;
  height: 13px;
}

.color-input {
  display: flex;
  align-items: center;
  gap: 5px;
}

.color-input input[type="color"] {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid #303846;
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
}

.color-input input[type="text"] {
  width: 76px;
  height: 26px;
  font: 9px monospace;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8793a5;
  font-size: 10px;
  margin-top: 10px;
  cursor: pointer;
}

.check-row input {
  accent-color: #4e87ef;
}

/* --------------------------------------------------------------------------
   EXPORT MODAL DIALOG
   -------------------------------------------------------------------------- */
.dialog-backdrop { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; padding: 16px; background: transparent; color: var(--text); display: grid; place-items: center; }
.dialog-backdrop:not([open]) { display: none; }
.dialog-backdrop::backdrop { background: rgba(2, 4, 9, 0.78); }
.export-dialog { width: min(560px, 100%); padding: 24px; background: var(--panel); color: var(--text); border-radius: 8px; box-shadow: 0 20px 70px rgba(0,0,0,.5); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
html:not(.dark) .export-dialog { --green: #047857; }
.export-dialog .dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.export-dialog h2 { margin: 0; font-size: 20px; line-height: 1.4; }
.export-dialog h3 { margin: 0; font-size: 16px; line-height: 1.5; }
.export-dialog p { font-size: 13px; line-height: 1.6; }
#export-dialog-description { color: var(--muted); margin: 6px 0 20px; }
.export-dialog .icon-btn { width: 44px; height: 44px; flex: none; color: var(--text); }
.export-summary { display: grid; grid-template-columns: 1.3fr 1fr 1.3fr; margin: 0 0 24px; border-block: 1px solid var(--line2); padding-block: 14px; gap: 12px; }
.export-summary dt { color: var(--muted); font-size: 12px; }
.export-summary dd { margin: 5px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.export-steps { display: flex; list-style: none; padding: 0; margin: 0 0 20px; gap: 12px; }
.export-steps li { flex: 1; color: var(--muted); padding-bottom: 8px; border-bottom: 2px solid var(--line2); font-size: 13px; }
.export-steps .is-current { color: var(--blue); border-color: var(--blue); font-weight: 600; }
.export-steps .is-done { color: var(--green); border-color: var(--green); }
.export-state { padding-bottom: 20px; }
.export-state p { margin: 6px 0 0; color: var(--muted); }
.export-state[data-state="completed"] h3 { color: var(--green); }
.export-state[data-state="error"] h3, .export-state .export-error { color: var(--red); }
.export-state .export-error { margin-block: 12px; overflow-wrap: anywhere; }
.export-dialog .process-btn, .export-dialog .secondary-btn { min-height: 44px; height: auto; padding: 10px 14px; font-size: 14px; justify-content: center; text-decoration: none; }
.export-dialog .process-btn { margin-top: 16px; }
.export-dialog .secondary-btn { background: var(--panel2); color: var(--text); border-color: var(--line2); }
.export-dialog .secondary-btn:hover:not(:disabled) { background: var(--panel); border-color: var(--blue); }
.export-dialog .secondary-btn:disabled { opacity: .45; cursor: not-allowed; }
.export-dialog :is(button, a, summary):focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
#export-select-video, #export-recheck { margin-top: 12px; }
.export-state .export-background-note { font-size: 12px; margin-top: 10px; }
#export-progress { display: block; width: 100%; height: 8px; margin-top: 16px; accent-color: var(--blue); }
.export-result { padding-bottom: 20px; }
.export-result h3 { margin-bottom: 12px; }
.export-preview { position: relative; background: #090b0f; border-radius: 4px; overflow: hidden; }
#output-video { display: block; width: 100%; max-height: 260px; min-height: 180px; object-fit: contain; background: #090b0f; }
#export-video-loading { position: absolute; inset: 0; display: grid; place-items: center; color: #f2f4f7; background: #171c24; font-size: 14px; }
#export-video-error { color: var(--red); }
#export-render-again { width: 100%; margin-top: 8px; }
.export-subtitle-download { border-top: 1px solid var(--line2); padding-top: 16px; display: flex; align-items: center; gap: 14px; }
.export-subtitle-download span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.export-subtitle-download button { flex: none; }
.export-tools { margin-top: 20px; border-top: 1px solid var(--line2); padding-top: 14px; }
.export-tools summary { color: var(--muted); cursor: pointer; font-size: 13px; min-height: 44px; display: flex; align-items: center; list-style: revert; }
.export-tools .check-list { margin-block: 8px 16px; padding: 0; }
.export-tools .check-list > div { display: flex; justify-content: space-between; padding-block: 5px; font-size: 12px; color: var(--muted); }
.export-tools dd { margin: 0; color: var(--text); }
.export-tools button { width: 100%; }
@media (max-width: 480px) {
  .dialog-backdrop { padding: 8px; }
  .export-dialog { padding: 18px; max-height: calc(100dvh - 16px); }
  .export-dialog h2 { font-size: 18px; }
  .export-summary { grid-template-columns: 1fr; padding-block: 10px; gap: 9px; }
  .export-summary > div { display: flex; justify-content: space-between; gap: 12px; }
  .export-summary dd { margin: 0; text-align: right; }
  .export-subtitle-download { flex-direction: column; align-items: stretch; gap: 8px; }
  .export-subtitle-download span { text-align: center; }
}

/* --------------------------------------------------------------------------
   RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */
@media (max-width: 1250px) {
  .workspace {
    grid-template-columns: 58px 230px minmax(0, 1fr) 230px;
  }
}

@media (max-width: 800px) {
  .topbar { min-height: 54px; height: auto; flex-wrap: wrap; gap: 8px; padding: 8px; flex-shrink: 0; }
  .brand-lockup { min-width: 0; }
  .top-center { flex-wrap: wrap; }
  .top-actions { margin-left: auto; flex-wrap: wrap; max-width: 100%; }
  .workspace {
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    min-width: 0;
    width: 100%;
    min-height: 0;
    flex: 1;
    height: auto;
    overflow-y: auto;
  }
  .workspace > * { min-width: 0; max-width: 100%; }
  .tool-rail { order: 1; }
  .monitor-area { order: 2; }
  .context-panel { order: 3; overflow: visible; }
  .inspector { order: 4; overflow: visible; }
  .tool-rail {
    width: 100%;
    height: 52px;
    flex-direction: row;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 4px 10px;
  }
  .rail-tools {
    flex-direction: row;
  }
  .monitor-area {
    height: 550px;
  }
  .inspector {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

/* Shared time origin: ruler, clips, cues, playhead and seeking use the canvas width. */
.time-ruler { position: relative; width: 100%; display: block; padding: 0; }
.subtitle-ruler-tick { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.subtitle-ruler-tick:first-child { transform: none; }
.subtitle-ruler-tick:last-child { max-width: 100%; }
.track-canvas:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.subtitle-track-cue.is-selected, .subtitle-cue.is-selected { outline: 1px solid var(--blue); outline-offset: -1px; }
.section-label { display: block; }
.studio-update-notice { flex: none; padding: 8px 16px; color: var(--text); background: var(--panel2); border-bottom: 1px solid var(--line2); font-size: 12px; }
@media (min-width: 801px) and (max-width: 1100px) { .topbar { height: auto; min-height: 54px; flex-wrap: wrap; gap: 8px; padding-block: 8px; flex: none; } }

/* The editing panels follow the theme; monitor and rail retain a dark video surface. */
.topbar, .tool-rail, .monitor-area { color: #f2f4f7; }
.topbar .build-badge, .topbar .project-name { color: #aab5c5; }
.cue-summary { color: var(--text); min-width: 0; }
.inspector-tabs button.active { color: var(--text); }
.cue-header, .cue-seek, .cue-field { min-width: 0; }
.cue-seek { flex: 1; overflow: hidden; }
.cue-summary { flex: 1; }
.cue-metrics { flex: none; }
.cue-field { flex: 1 1 0; flex-direction: column; align-items: stretch; }
.cue-time { min-width: 0; }
.cue-time-grid { align-items: end; }
.caption-toolbar { flex-wrap: wrap; }
.caption-toolbar > span { flex: 1 0 100%; }
.subtitle-ruler-tick.is-end { transform: translateX(-100%); }
.source-clip { left: 0; right: 0; }

/* Compact cue timing stays readable without the subtitle sentence in the toolbar. */

/* Caption layers: stacked lanes on the timeline, read-only copies in the monitor */
.subtitle-track-scroll { overflow-y: auto; }
.caption-layer-labels { display: block; }
.caption-layer-label { position: relative; }
.caption-layer-remove { margin-left: auto; width: 16px; height: 16px; border: 0; border-radius: 3px; background: transparent; color: inherit; cursor: pointer; font-size: 12px; line-height: 1; }
.caption-layer-remove:hover { background: rgba(255, 255, 255, 0.12); }
.caption-lane-divider { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #242b35; pointer-events: none; }
.cue-layer-badge { margin-left: 6px; padding: 1px 6px; border-radius: 3px; background: rgba(91, 146, 244, 0.18); color: #a6c5fa; font-size: 9px; font-weight: 600; }
.caption-layer-ghost {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: none;
  user-select: none;
  display: inline-block;
  width: max-content;
  overflow-wrap: anywhere;
}

/* Target layer: where "+ ซับ" adds. Labels are buttons; the selected lane is tinted. */
.caption-layer-label { cursor: pointer; }
.caption-layer-label:hover { color: #a6c5fa; }
.caption-layer-label.is-target { color: #cfe0ff; background: rgba(91, 146, 244, 0.16); box-shadow: inset 3px 0 0 #5b92f4; }
.caption-layer-label:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.caption-lane-bg { position: absolute; left: 0; right: 0; height: 42px; pointer-events: none; }
.caption-lane-bg.is-target { background: rgba(91, 146, 244, 0.09); }

/* Fixed-height timeline: layers scroll vertically while the ruler and its corner stay put. */
.subtitle-track-scroll > * { align-self: flex-start; }
.subtitle-track-scroll .ruler-label { position: sticky; top: 0; z-index: 5; background: #151a21; }
.subtitle-track-scroll .subtitle-time-ruler { position: sticky; top: 0; z-index: 4; background-color: #11151b; }

/* --------------------------------------------------------------------------
   Timeline toolbar: one row, never wraps. Title and selection status give way first (ellipsis),
   then the action labels collapse to icons, then the duration badge and zoom label go. Driven
   by the toolbar's own width, so it behaves the same in a narrow window or a narrow column.
   -------------------------------------------------------------------------- */
.timeline-toolbar {
  container-type: inline-size;
  height: 40px;
  min-height: 0;
  flex-wrap: nowrap;
  gap: 12px;
  padding: 0 12px;
}
.timeline-title { flex: 1 1 0; min-width: 0; gap: 8px; }
.timeline-title > svg, .timeline-title > strong { flex: none; }
.timeline-title > strong { letter-spacing: 0.04em; white-space: nowrap; }
.timeline-status {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #cfe1fc;
}
.timeline-actions { flex: none; flex-wrap: nowrap; gap: 6px; }
.timeline-action {
  height: 26px;
  padding: 0 10px;
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  flex: none;
}
.timeline-action:hover:not(:disabled) { background: #22304a; border-color: #4a6a9c; color: #cfe1fc; }
.timeline-action:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.timeline-action:disabled { opacity: 0.45; cursor: not-allowed; }
.timeline-action svg { width: 13px; height: 13px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.timeline-divider { width: 1px; height: 18px; background: var(--line2); flex: none; }
.manual-duration-badge { font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-zoom { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.timeline-actions input[type="range"] { width: 72px; }
.subtitle-track-help {
  padding: 3px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  flex: none;
}
@container (max-width: 780px) {
  .timeline-title > strong { display: none; }
  .manual-duration-badge, .timeline-divider { display: none; }
}
@container (max-width: 560px) {
  .action-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .timeline-action { padding: 0; width: 28px; justify-content: center; position: relative; }
  .timeline-zoom-label { display: none; }
  .timeline-actions input[type="range"] { width: 56px; }
}
