/* ============================================================
   AI STUDIO EDITOR — Unified Professional Interface
   Combines the simple wizard + advanced editor into one polished UI.
   Built on top of simple-mode.js engine; keeps all original element IDs.
   ============================================================ */

:root {
  --as-bg:           #050810;
  --as-panel:        #0c1220;
  --as-panel-2:      #111827;
  --as-panel-3:      #161f33;
  --as-border:       rgba(96, 116, 158, .18);
  --as-border-2:     rgba(96, 116, 158, .28);
  --as-text:         #eaf2ff;
  --as-text-dim:     #9fb0ca;
  --as-text-mute:    #6b7a93;
  --as-accent:       #3b82f6;
  --as-accent-2:     #8b5cf6;
  --as-accent-grad:  linear-gradient(135deg, #2563eb, #7c3aed);
  --as-success:      #22c55e;
  --as-warning:      #f59e0b;
  --as-danger:       #ef4444;
  --as-radius:       12px;
  --as-radius-sm:    8px;
  --as-shadow:       0 12px 40px rgba(0,0,0,.42);
  --as-shadow-sm:    0 4px 14px rgba(0,0,0,.28);
  --as-sidebar-w:    232px;
  --as-inspector-w:  360px;
  --as-toolbar-h:    56px;
  --as-statusbar-h:  32px;

  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

/* ====== RESET & GLOBALS ====== */
html, body {
  margin: 0;
  padding: 0;
  background: var(--as-bg);
  color: var(--as-text);
  height: 100%;
  overflow: hidden;
}

* { box-sizing: border-box; }

button {
  font-family: inherit;
  cursor: pointer;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,.2); }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,.3); }

/* ====== APP SHELL ====== */
.as-app {
  display: grid;
  grid-template-rows: var(--as-toolbar-h) 1fr var(--as-statusbar-h);
  height: 100vh;
  width: 100vw;
  background:
    radial-gradient(circle at 20% 0%, rgba(37,99,235,.06) 0%, transparent 60%),
    radial-gradient(circle at 80% 100%, rgba(124,58,237,.05) 0%, transparent 60%),
    var(--as-bg);
}

/* ====== TOP TOOLBAR ====== */
.as-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: linear-gradient(90deg, #0a0f1c, #111827 50%, #0a0f1c);
  border-bottom: 1px solid var(--as-border);
  box-shadow: var(--as-shadow-sm);
  z-index: 10;
}
.as-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 14px;
  border-right: 1px solid var(--as-border);
  height: 100%;
}
.as-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--as-accent-grad);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(37,99,235,.4);
  letter-spacing: -.5px;
}
.as-brand-name {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .2px;
}
.as-brand-tag {
  font-size: 10px;
  font-weight: 700;
  color: #c4b5fd;
  background: rgba(124,58,237,.18);
  border: 1px solid rgba(167,139,250,.3);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 2px;
}

.as-tb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 100%;
  border-right: 1px solid var(--as-border);
}
.as-tb-group:last-child { border-right: 0; }
.as-tb-spacer { flex: 1; }

.as-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--as-border-2);
  background: var(--as-panel-3);
  color: var(--as-text);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  transition: all .15s ease;
}
.as-btn:hover {
  background: #1d2840;
  border-color: rgba(96,165,250,.42);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37,99,235,.16);
}
.as-btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.as-btn.icon-only { padding: 0 10px; }
.as-btn.primary {
  background: var(--as-accent-grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 22px rgba(37,99,235,.35);
}
.as-btn.primary:hover { filter: brightness(1.1); box-shadow: 0 10px 28px rgba(37,99,235,.45); }
.as-btn.gold {
  background: linear-gradient(135deg, #b45309, #f59e0b);
  border-color: transparent;
  color: #fff;
}
.as-btn.ghost { background: transparent; border-color: var(--as-border); }
.as-btn.danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.as-btn.sm { height: 28px; font-size: 11px; padding: 0 9px; }
.as-btn.xs { height: 24px; font-size: 10px; padding: 0 7px; }

.as-tb-select {
  height: 32px;
  border: 1px solid var(--as-border-2);
  background: var(--as-panel-3);
  color: var(--as-text);
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
}

.as-tb-divider {
  width: 1px;
  height: 22px;
  background: var(--as-border);
  margin: 0 2px;
}

.as-tb-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--as-text-dim);
  padding: 4px 10px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: 999px;
  font-weight: 600;
}
.as-tb-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

/* ====== WORKSPACE GRID ====== */
.as-workspace {
  display: grid;
  grid-template-columns: var(--as-sidebar-w) 1fr var(--as-inspector-w);
  min-height: 0;
  overflow: hidden;
}

/* ====== LEFT SIDEBAR — Tool Tabs ====== */
.as-sidebar {
  background: linear-gradient(180deg, #0b1020, #080b15);
  border-right: 1px solid var(--as-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 8px 8px 16px;
}
.as-side-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--as-border);
}
.as-side-section:last-child { border-bottom: 0; }
.as-side-section-label {
  font-size: 10px;
  font-weight: 800;
  color: var(--as-text-mute);
  letter-spacing: .15em;
  text-transform: uppercase;
  padding: 6px 10px 8px;
}
.as-side-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--as-text-dim);
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  width: 100%;
  transition: all .15s ease;
  position: relative;
}
.as-side-btn:hover {
  background: rgba(96,165,250,.08);
  color: var(--as-text);
}
.as-side-btn.active {
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(124,58,237,.18));
  color: #bfdbfe;
  box-shadow: inset 0 0 0 1px rgba(96,165,250,.32);
}
.as-side-btn.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: var(--as-accent-grad);
}
.as-side-btn .as-side-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.as-side-btn .as-side-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(124,58,237,.25);
  color: #d8b4fe;
  letter-spacing: .5px;
}

/* ====== CENTER CANVAS AREA ====== */
.as-center {
  display: grid;
  grid-template-rows: 46px 1fr auto;
  min-width: 0;
  overflow: hidden;
  background: var(--as-bg);
}
.as-center-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--as-border);
  background: rgba(11,16,32,.6);
  backdrop-filter: blur(8px);
}
.as-center-toolbar .as-zoom-readout {
  font-size: 11px;
  font-weight: 700;
  color: var(--as-text-dim);
  min-width: 48px;
  text-align: center;
}
.as-canvas-stage {
  position: relative;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 1px 1px, rgba(148,163,184,.10) 1px, transparent 0)
    0 0 / 22px 22px,
    var(--as-bg);
}
.as-canvas-stage canvas {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(96,165,250,.22),
    0 28px 80px rgba(0,0,0,.55);
  background: #000;
}

/* ====== BOTTOM DOCK — Layers / Timeline ====== */
.as-dock {
  border-top: 1px solid var(--as-border);
  background: linear-gradient(180deg, #0a0f1c, #050810);
  display: flex;
  flex-direction: column;
  min-height: 64px;
  max-height: 42vh;
  overflow: hidden;
}
.as-dock-tabs {
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-bottom: 1px solid var(--as-border);
  background: rgba(11,16,32,.7);
  gap: 2px;
  flex-shrink: 0;
}
.as-dock-tab {
  background: transparent;
  border: 0;
  color: var(--as-text-mute);
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px 8px 0 0;
  border-bottom: 2px solid transparent;
  transition: all .15s ease;
}
.as-dock-tab:hover { color: var(--as-text); background: rgba(96,165,250,.06); }
.as-dock-tab.active {
  color: #bfdbfe;
  border-bottom-color: var(--as-accent);
  background: rgba(37,99,235,.08);
}
.as-dock-spacer { flex: 1; }
.as-dock-body {
  overflow: auto;
  padding: 10px 14px;
  min-height: 40px;
}
.as-dock-panel { display: none; }
.as-dock-panel.active { display: block; }

/* Layer list styling within dock */
.as-dock #layerPanelList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

/* ====== RIGHT INSPECTOR ====== */
.as-inspector {
  background: linear-gradient(180deg, #0b1020, #080b15);
  border-left: 1px solid var(--as-border);
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  overflow: hidden;
}
.as-insp-head {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--as-border);
  background: rgba(11,16,32,.55);
}
.as-insp-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.as-insp-title h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .2px;
}
.as-insp-title .as-insp-step {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .15em;
  color: var(--as-text-mute);
  text-transform: uppercase;
}
.as-insp-desc {
  font-size: 11px;
  color: var(--as-text-dim);
  line-height: 1.5;
  margin: 0;
}
.as-insp-body {
  overflow-y: auto;
  padding: 14px;
}
.as-insp-section { display: none; }
.as-insp-section.active { display: block; }

/* ====== FORM CONTROLS (right inspector + others) ====== */
.as-field {
  margin-bottom: 12px;
}
.as-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.as-field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.as-field-row.full { grid-template-columns: 1fr; }
.as-field label,
.as-field-row > div > label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--as-text-dim);
  margin-bottom: 5px;
  letter-spacing: .2px;
}
.as-field label .as-val {
  float: right;
  color: var(--as-accent);
  font-weight: 800;
}
.as-field input[type="text"],
.as-field input[type="url"],
.as-field input[type="number"],
.as-field input[type="email"],
.as-field input[type="password"],
.as-field textarea,
.as-field select,
.as-field-row input[type="text"],
.as-field-row input[type="url"],
.as-field-row input[type="number"],
.as-field-row textarea,
.as-field-row select {
  width: 100%;
  background: #091223;
  color: var(--as-text);
  border: 1px solid var(--as-border-2);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
}
.as-field textarea { resize: vertical; min-height: 70px; line-height: 1.55; }
.as-field input:focus,
.as-field textarea:focus,
.as-field select:focus,
.as-field-row input:focus,
.as-field-row textarea:focus,
.as-field-row select:focus {
  border-color: var(--as-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.as-field input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 3px;
  background: #091223;
  border: 1px solid var(--as-border-2);
  border-radius: 8px;
  cursor: pointer;
}
.as-field input[type="range"] {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #1f2a3d;
  border-radius: 4px;
  margin: 8px 0;
}
.as-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--as-accent-grad);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}
.as-field input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--as-accent);
  cursor: pointer;
  border: 0;
}
.as-field input[type="file"] {
  width: 100%;
  font-size: 11px;
  color: var(--as-text-dim);
}
.as-hint {
  font-size: 10px;
  color: var(--as-text-mute);
  line-height: 1.5;
  margin-top: 4px;
}

/* Toggle pills */
.as-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--as-text);
  cursor: pointer;
  font-weight: 600;
}
.as-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--as-accent);
  cursor: pointer;
}

/* Section card */
.as-card {
  background: rgba(255,255,255,.025);
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  padding: 12px;
  margin-bottom: 12px;
}
.as-card h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--as-text-dim);
}
.as-card .as-card-sub {
  font-size: 11px;
  color: var(--as-text-mute);
  line-height: 1.5;
  margin: 0 0 10px;
}

/* Chip rows */
.as-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.as-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  color: var(--as-text-dim);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.as-chip:hover { background: #14213a; border-color: rgba(96,165,250,.36); color: var(--as-text); }
.as-chip.active {
  background: linear-gradient(135deg, rgba(37,99,235,.32), rgba(124,58,237,.22));
  border-color: rgba(96,165,250,.5);
  color: #fff;
}

/* Mode tabs (Content input mode etc.) */
.as-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: #0b1220;
  border: 1px solid var(--as-border);
  border-radius: var(--as-radius);
  margin-bottom: 12px;
}
.as-mode-tab {
  background: transparent;
  border: 0;
  color: var(--as-text-dim);
  padding: 8px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  transition: all .15s ease;
}
.as-mode-tab:hover { color: var(--as-text); }
.as-mode-tab.active {
  background: var(--as-accent-grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(37,99,235,.32);
}
.as-mode-panel { display: none; }
.as-mode-panel.active { display: block; }

/* Grid of visual cards (templates, presets, etc.) */
.as-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.as-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.as-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.as-grid-card {
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  text-align: center;
  transition: all .15s ease;
  font-size: 11px;
  font-weight: 700;
  color: var(--as-text);
}
.as-grid-card:hover {
  border-color: rgba(96,165,250,.5);
  background: rgba(37,99,235,.08);
  transform: translateY(-1px);
}
.as-grid-card.active {
  border-color: var(--as-accent);
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(124,58,237,.16));
  box-shadow: 0 0 0 2px rgba(37,99,235,.22);
}
.as-grid-card .as-grid-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
}
.as-grid-card small {
  display: block;
  margin-top: 3px;
  color: var(--as-text-mute);
  font-weight: 600;
  font-size: 10px;
}

/* Status / progress */
.as-statusbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(90deg, #07101e, #0b1422);
  border-top: 1px solid var(--as-border);
  font-size: 11px;
  color: var(--as-text-dim);
  font-weight: 600;
}
.as-statusbar .as-sb-spacer { flex: 1; }
.as-statusbar .as-sb-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(96,165,250,.1);
  border: 1px solid rgba(96,165,250,.22);
  color: #bfdbfe;
  font-weight: 700;
}

/* AI loading overlay (carried from index.html) */
.as-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}
.as-overlay.show { display: flex; }
.as-overlay-box {
  background: var(--as-panel-2);
  border: 1px solid var(--as-border-2);
  border-radius: 18px;
  padding: 30px 38px;
  text-align: center;
  min-width: 300px;
  max-width: 380px;
  box-shadow: 0 24px 70px rgba(0,0,0,.65);
}
.as-overlay-title { font-size: 16px; font-weight: 800; margin: 0 0 6px; }
.as-overlay-detail { font-size: 12px; color: var(--as-text-dim); line-height: 1.6; min-height: 18px; }
@keyframes as-spin { to { transform: rotate(360deg); } }
.as-spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 4px solid #1f2a3d;
  border-top-color: var(--as-accent);
  animation: as-spin 1s linear infinite;
}

/* Status text colors (legacy compat) */
.status { padding: 6px 10px; font-size: 12px; color: var(--as-text-dim); }
.status .bad, .bad { color: #fca5a5; }
.status .oktxt, .oktxt { color: #86efac; }

/* Hide legacy simple.html elements we redirect through */
.legacy-hidden { display: none !important; }

/* Hide top steps indicator (we use top bar instead) */
.steps { display: none; }

/* Variants thumbnails inside content panel */
.variants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.variant {
  padding: 10px;
  border: 1px solid var(--as-border-2);
  border-radius: 10px;
  background: #0b1220;
  cursor: pointer;
  font-size: 11px;
}
.variant.active { border-color: var(--as-warning); box-shadow: 0 0 0 2px rgba(251,191,36,.18); }
.variant b { display: block; font-size: 12px; direction: rtl; }
.variant p { margin: 4px 0 0; color: var(--as-text-mute); font-size: 11px; direction: rtl; }

/* Audio player bar */
.audioBar { display: none; background: #091223; border: 1px solid var(--as-border-2); border-radius: 10px; padding: 10px; margin-top: 10px; }
.audioBar.show { display: block; }
.audioBar audio { width: 100%; }

/* Score / checklist */
.score-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.22);
  font-size: 12px;
}
.score-card b { display: block; font-size: 13px; }
.score-card span { color: var(--as-text-dim); font-size: 11px; }
.checklist { display: grid; gap: 6px; margin-top: 10px; }
.checkitem { padding: 8px 10px; border-radius: 9px; background: rgba(255,255,255,.04); font-size: 11px; line-height: 1.5; }
.checkitem.ok { border-left: 3px solid #22c55e; }
.checkitem.warn { border-left: 3px solid #f59e0b; }
.checkitem.bad { border-left: 3px solid #ef4444; }

/* Layer panel */
.layer-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px;
}

/* Image gallery */
.bg-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.bg-thumb {
  position: relative;
  border: 1px solid var(--as-border-2);
  background: #0b1220;
  border-radius: 10px;
  overflow: hidden;
  padding: 6px;
  cursor: pointer;
  font-size: 10px;
}
.bg-thumb.active { outline: 2px solid var(--as-accent); }
.bg-thumb img { display: block; width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 7px; }
.bg-thumb b { display: block; font-size: 10px; margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-empty { padding: 14px; border: 1px dashed var(--as-border-2); border-radius: 10px; color: var(--as-text-mute); font-size: 11px; text-align: center; }

/* Image tab pills */
.image-tabs {
  display: flex;
  gap: 4px;
  margin: 10px 0 6px;
  padding: 3px;
  background: #0b1220;
  border-radius: 10px;
  border: 1px solid var(--as-border);
}
.img-tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--as-text-dim);
  padding: 6px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 7px;
}
.img-tab.active { background: var(--as-accent-grad); color: #fff; }
.image-panel { display: none; }
.image-panel.active { display: block; }

/* Subtitle/preset strips */
.subtitle-preset-strip,
.sub-style-picker,
.sub-fx-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.subtitle-preset-strip > *,
.sub-style-picker > *,
.sub-fx-picker > * {
  padding: 6px 10px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  color: var(--as-text-dim);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s ease;
}
.subtitle-preset-strip > *.active,
.sub-style-picker > *.active,
.sub-fx-picker > *.active {
  background: var(--as-accent-grad);
  color: #fff;
  border-color: transparent;
}

/* Anim style buttons */
.anim-style-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}
.anim-style-btn {
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  color: var(--as-text-dim);
  border-radius: 9px;
  padding: 10px 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}
.anim-style-btn span { display: block; font-size: 10px; margin-top: 3px; }
.anim-style-btn.active { background: var(--as-accent-grad); color: #fff; border-color: transparent; }

/* Voice mood */
.voice-mood-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}
.voice-mood-btn {
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  color: var(--as-text-dim);
  border-radius: 9px;
  padding: 9px 4px;
  font-size: 11px;
  font-weight: 700;
}
.voice-mood-btn.active { background: var(--as-accent-grad); color: #fff; border-color: transparent; }

/* Render progress panel */
.render-progress-panel {
  margin-top: 10px;
  padding: 12px;
  background: rgba(37,99,235,.08);
  border: 1px solid rgba(96,165,250,.3);
  border-radius: 10px;
}
.render-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}
.render-progress-bar {
  height: 6px;
  background: #1f2a3d;
  border-radius: 999px;
  overflow: hidden;
}
.render-progress-bar span {
  display: block;
  height: 100%;
  background: var(--as-accent-grad);
  width: 0%;
  transition: width .25s ease;
}
.render-progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--as-text-mute);
}
.render-progress-note {
  font-size: 11px;
  color: var(--as-text-dim);
  margin-top: 6px;
}

/* Export platform grid */
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.export-platform-card {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 4px;
  padding: 12px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: all .15s ease;
  color: var(--as-text);
}
.export-platform-card:hover {
  border-color: rgba(96,165,250,.5);
  background: rgba(37,99,235,.08);
  transform: translateY(-1px);
}
.epc-icon {
  font-size: 22px;
  font-weight: 900;
  color: var(--as-accent);
}
.epc-name { font-size: 12px; font-weight: 700; }
.epc-size { font-size: 10px; color: var(--as-text-mute); }
.epc-actions { display: flex; gap: 5px; justify-content: center; margin-top: 4px; }
.epc-btn {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(96,165,250,.16);
  border: 1px solid rgba(96,165,250,.3);
  color: #bfdbfe;
}
.epc-btn.mp4 { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.3); color: #fcd34d; }

/* Quality option cards */
.quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.quality-option {
  display: block;
  padding: 9px 10px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
}
.quality-option:has(input:checked) {
  border-color: var(--as-accent);
  background: rgba(37,99,235,.1);
}
.quality-option b { display: block; margin: 4px 0 2px; font-size: 12px; }
.quality-option span { display: block; color: var(--as-text-mute); font-size: 10px; }

/* Accordion (advanced design controls) */
.as-accordion { margin: 6px 0; }
.as-acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  color: var(--as-text);
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  margin-bottom: 4px;
  /* Button reset (the head is now a real <button> so we need to
     normalize browser defaults). */
  font-family: inherit;
  line-height: 1.3;
  cursor: pointer;
  outline-offset: 2px;
}
.as-acc-head:focus-visible { outline: 2px solid var(--as-accent); }
.as-acc-head:hover { background: #111c32; }
.as-acc-head .as-acc-chev { margin-left: auto; transition: transform .2s; font-size: 14px; }
.as-acc-head.open .as-acc-chev { transform: rotate(90deg); }
.as-acc-body { display: none; padding: 10px 4px 4px; }
.as-acc-body.open { display: block; }

/* Quality-of-life: when an inspector section is wide, allow rows */
.as-insp-body .formgrid,
.as-insp-body .acc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.as-insp-body .formgrid .full,
.as-insp-body .acc-grid .full { grid-column: 1 / -1; }

/* ============ MOBILE ============ */
@media (max-width: 1100px) {
  .as-workspace {
    grid-template-columns: 64px 1fr 320px;
  }
  .as-side-btn span:not(.as-side-icon):not(.as-side-badge) { display: none; }
  .as-side-btn { justify-content: center; padding: 10px 6px; }
  .as-side-section-label { text-align: center; font-size: 9px; }
  .as-brand-tag { display: none; }
}

@media (max-width: 860px) {
  :root { --as-toolbar-h: 50px; --as-inspector-w: 100%; }
  .as-workspace {
    grid-template-columns: 56px 1fr;
    grid-template-rows: 1fr auto;
  }
  .as-inspector {
    position: fixed;
    inset: auto 0 0 0;
    border-left: 0;
    border-top: 1px solid var(--as-border);
    max-height: 60vh;
    z-index: 50;
    box-shadow: 0 -20px 60px rgba(0,0,0,.5);
    transform: translateY(calc(100% - 50px));
    transition: transform .3s ease;
  }
  .as-inspector.open { transform: translateY(0); }
  .as-insp-head {
    cursor: pointer;
    position: relative;
  }
  .as-insp-head::after {
    content: "⌃";
    position: absolute;
    top: 14px;
    right: 16px;
    font-size: 16px;
    color: var(--as-text-mute);
    transition: transform .3s;
  }
  .as-inspector.open .as-insp-head::after { transform: rotate(180deg); }
  .as-brand-name { display: none; }
  .as-tb-group { padding: 0 6px; }
  .as-btn { padding: 0 9px; font-size: 11px; }
  .as-btn span.long { display: none; }
}

/* ============================================================
   TIMELINE PRO — toggle button + dock tab + placeholder + expanded dock
   ============================================================ */

/* Toolbar toggle button — visually distinct when active */
#asTimelineToggle[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(245,158,11,.22), rgba(124,58,237,.22));
  border-color: rgba(245,158,11,.55);
  color: #fcd34d;
  box-shadow: 0 0 0 1px rgba(245,158,11,.32), 0 6px 18px rgba(245,158,11,.16);
}
#asTimelineToggle[aria-pressed="true"]::before {
  content: "● ";
  color: #f59e0b;
  font-size: 8px;
  margin-right: 1px;
}

/* Timeline dock tab gets a gold accent when visible */
.as-dock-tab-pro {
  position: relative;
  color: #fcd34d !important;
}
.as-dock-tab-pro.active {
  background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(124,58,237,.12)) !important;
  border-bottom-color: #f59e0b !important;
}

/* Dock auto-expands when Timeline tab is active */
.as-dock.timeline-active {
  max-height: 68vh;
  min-height: 460px;
}
.as-dock.timeline-active .as-dock-body {
  padding: 0;          /* timeline brings its own padding */
  background: #060912; /* darker work area */
}

/* Empty-state placeholder before Timeline Pro is activated */
.as-timeline-placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 240px;
  padding: 28px 18px;
  gap: 8px;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(245,158,11,.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(124,58,237,.06) 0%, transparent 60%);
}
.as-tp-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, #b45309, #7c3aed);
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  box-shadow: 0 12px 32px rgba(245,158,11,.32);
  margin-bottom: 6px;
}
.as-timeline-placeholder h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .2px;
}
.as-timeline-placeholder p {
  margin: 0 0 8px;
  max-width: 480px;
  font-size: 12px;
  color: var(--as-text-dim);
  line-height: 1.6;
}

/* Once activated, the engine drops its #workspaceTimeline inside this panel.
   Make sure scrolling and sizing work in the dock context. */
.as-dock-panel-timeline #workspaceTimeline {
  height: 100%;
  display: flex;
  flex-direction: column;
}
.as-dock-panel-timeline .track-list {
  flex: 1;
  overflow: auto;
}

/* ============================================================
   ANIMATED PRESET LIVE PREVIEWS — intro/outro picker thumbnails

   Engine expects:
     <button class="io-preset-card" data-io-kind data-io-preset>
       <canvas class="io-preset-thumb" data-io-thumb="...">
       <span class="io-preset-play-badge">
       <div class="io-preset-label"><b>title</b><span>desc</span></div>
     </button>
   ============================================================ */
.io-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}
.io-preset-card {
  position: relative;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all .15s ease;
  padding: 0;
  display: block;
  text-align: left;
  color: var(--as-text);
  width: 100%;
}
.io-preset-card:hover {
  border-color: rgba(96,165,250,.5);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.32);
}
.io-preset-card.active {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,.32);
}
.io-preset-card .io-preset-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: cover;
}
.io-preset-card .io-preset-label {
  padding: 8px 10px;
  display: grid;
  gap: 2px;
}
.io-preset-card .io-preset-label b {
  font-size: 11px;
  font-weight: 700;
  display: block;
  line-height: 1.3;
  color: var(--as-text);
}
.io-preset-card .io-preset-label span {
  font-size: 10px;
  color: var(--as-text-mute);
  line-height: 1.4;
}
.io-preset-card .io-preset-play-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  font-size: 9px;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.io-preset-card:hover .io-preset-play-badge { opacity: 1; }
.io-preset-card.active .io-preset-play-badge {
  opacity: 1;
  background: rgba(245,158,11,.85);
}

/* ============================================================
   NEWS BADGES section
   ============================================================ */
.as-badge-preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.as-badge-preset {
  border: none;
  padding: 10px 8px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .04em;
  cursor: pointer;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,.32);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.as-badge-preset:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0,0,0,.4);
}
.as-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  margin-bottom: 4px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.as-badge-row:hover { background: #14213a; }
.as-badge-row.active { border-color: var(--as-accent); background: rgba(37,99,235,.1); }
.as-badge-row-swatch {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.1);
}
.as-badge-row-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Shared color swatch grid */
.as-color-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
}
.as-color-grid.wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.as-color-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  transition: transform .12s, border-color .12s;
}
.as-color-swatch.wide { aspect-ratio: 2 / 1; }
.as-color-swatch:hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,.4);
}

/* ============================================================
   EMOJI section
   ============================================================ */
.as-radio-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.as-radio {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--as-text-dim);
  transition: all .15s ease;
}
.as-radio:hover { color: var(--as-text); border-color: rgba(96,165,250,.36); }
.as-radio input[type="radio"] {
  accent-color: var(--as-accent);
  cursor: pointer;
  flex-shrink: 0;
}
.as-radio:has(input:checked) {
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(124,58,237,.16));
  border-color: rgba(96,165,250,.5);
  color: #bfdbfe;
}
.as-emoji-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 0;
}
.as-emoji-cat {
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, border-color .12s;
}
.as-emoji-cat:hover { background: #14213a; }
.as-emoji-cat.active {
  background: linear-gradient(135deg, rgba(37,99,235,.2), rgba(124,58,237,.14));
  border-color: rgba(96,165,250,.5);
}
.as-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
  background: #060b16;
  border: 1px solid var(--as-border);
  border-radius: 8px;
}
.as-emoji-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  transition: background .12s, transform .12s;
}
.as-emoji-btn:hover {
  background: rgba(96,165,250,.14);
  border-color: rgba(96,165,250,.32);
  transform: scale(1.1);
}
.as-sticker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  margin-bottom: 4px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  cursor: pointer;
}
.as-sticker-row:hover { background: #14213a; }
.as-sticker-row.active { border-color: var(--as-accent); background: rgba(37,99,235,.1); }
.as-sticker-row-emoji { font-size: 22px; line-height: 1; flex-shrink: 0; }
.as-sticker-row-label {
  flex: 1;
  font-size: 11px;
  color: var(--as-text-dim);
  font-weight: 600;
}

/* ============================================================
   PAINT TOOLS section
   ============================================================ */
.as-paint-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.as-paint-tool {
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  color: var(--as-text);
  border-radius: 9px;
  padding: 10px 4px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.as-paint-tool:hover {
  background: #14213a;
  border-color: rgba(96,165,250,.4);
}
.as-paint-tool.active {
  background: linear-gradient(135deg, rgba(37,99,235,.32), rgba(124,58,237,.22));
  border-color: rgba(96,165,250,.6);
  box-shadow: 0 0 0 2px rgba(37,99,235,.22);
}
.as-paint-color-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.as-paint-color-swatch {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 9px;
  border: 2px solid #0b1220;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12);
  cursor: pointer;
  overflow: hidden;
}
.as-paint-color-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
}
.as-paint-eyedrop-hint {
  background: rgba(249,199,79,.1);
  border: 1px solid rgba(249,199,79,.3);
  color: #fbbf24;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 11px;
  margin-top: 8px;
  font-weight: 600;
}

/* Make the canvas look interactive when Paint section is active */
.as-insp-section[data-section="paint"].active ~ * #poster,
.as-insp-section[data-section="paint"]:has(.as-paint-tool.active) ~ * #poster {
  cursor: crosshair;
}

/* ============================================================
   TIMELINE PRO — DaVinci/Premiere-style polish

   Overrides the engine's generic flat styling with pro track design:
   - Track-type accent strips
   - Clip header bars with type label
   - Alternating row tints with deeper contrast
   - Snap grid lines in lane backgrounds
   - Pulsing playhead with TC badge
   - Larger ruler with major/minor ticks
   - Bold active/selected states

   All rules are scoped under .as-dock-panel-timeline so we don't affect
   anywhere else the engine might render a timeline.
   ============================================================ */

/* Shell + track variables. We declare on .timeline-pro INSIDE our dock
   because the engine's simple-mode.css also sets --tl-row-h on
   .timeline-pro — and CSS variables resolve to the nearest ancestor
   declaration. Setting it higher up (e.g. on the dock panel) loses
   to the engine's declaration on .timeline-pro itself. */
.as-dock-panel-timeline,
.as-dock-panel-timeline .timeline-pro,
.as-dock-panel-timeline #workspaceTimeline.timeline-pro {
  --tl-row-h:           42px;
  --tl-label-w:         196px;
  --tl-ruler-h:         34px;
  --tl-label-bg:        #0a1322;
  --tl-label-bg-alt:    #0c1626;
  --tl-lane-bg:         #0d1626;
  --tl-lane-bg-alt:     #0f1a2d;
  --tl-divider:         rgba(148,163,184,.07);
  --tl-divider-strong:  rgba(148,163,184,.14);
  --tl-grid-line:       rgba(148,163,184,.06);
  --tl-grid-major:      rgba(148,163,184,.14);
  --tl-text:            #dbeafe;
  --tl-text-dim:        #94a3b8;
}

/* Make sure the timeline panel uses our background */
.as-dock-panel-timeline #workspaceTimeline {
  background: linear-gradient(180deg, #060b16 0%, #050810 100%);
  border-radius: 0;
  color: var(--tl-text);
}

/* Header bar */
.as-dock-panel-timeline .workspace-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #0a0f1c, #111827 50%, #0a0f1c);
  border-bottom: 1px solid var(--tl-divider-strong);
  box-shadow: 0 4px 12px rgba(0,0,0,.32);
  margin: 0;
}
.as-dock-panel-timeline .workspace-timeline-head .timeline-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.as-dock-panel-timeline .workspace-timeline-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #fcd34d;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}
.as-dock-panel-timeline .workspace-timeline-head h3::before {
  content: "⏱";
  font-size: 14px;
}
.as-dock-panel-timeline .timeline-help-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(124,58,237,.18);
  color: #c4b5fd;
  border: 1px solid rgba(167,139,250,.3);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.as-dock-panel-timeline .workspace-timeline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.as-dock-panel-timeline .workspace-timeline-actions .btn {
  height: 28px;
  padding: 0 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(148,163,184,.18);
  color: var(--tl-text);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .14s;
}
.as-dock-panel-timeline .workspace-timeline-actions .btn:hover {
  background: rgba(96,165,250,.14);
  border-color: rgba(96,165,250,.42);
}
.as-dock-panel-timeline .timeline-zoom-readout {
  font-size: 11px;
  font-weight: 700;
  color: var(--tl-text-dim);
  min-width: 46px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.as-dock-panel-timeline .workspace-zoom {
  width: 120px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #1f2a3d;
  border-radius: 999px;
}
.as-dock-panel-timeline .workspace-zoom::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(245,158,11,.4);
}
.as-dock-panel-timeline .timeline-snap-control {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--tl-text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.as-dock-panel-timeline .timeline-snap-control select {
  height: 26px;
  padding: 0 6px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 6px;
  color: var(--tl-text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* Shell layout — labels left, scrollable lanes right */
.as-dock-panel-timeline .timeline-premiere-shell {
  display: grid;
  grid-template-columns: var(--tl-label-w) 1fr;
  position: relative;
  /* allow scroll within the dock height */
  min-height: 0;
}

/* The engine renders .timeline-premiere-inner as a `display:grid`
   with grid-template-rows fixed at 32px for the first row (ruler)
   and grid-auto-rows: 42px for lanes. That grid compresses rows when
   the parent runs short of space — which is exactly what happens
   inside our 62vh dock. We override to flex column so lanes always
   have their natural --tl-row-h, and the parent scrolls when needed. */
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-inner,
.as-dock-panel-timeline .timeline-premiere-inner {
  display: flex !important;
  flex-direction: column !important;
  grid-template-rows: none !important;
  grid-auto-rows: auto !important;
}
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-inner > *,
.as-dock-panel-timeline .timeline-premiere-inner > * {
  flex: 0 0 auto;
}
/* Same idea on the label pane inner so labels line up 1:1 with lanes */
.as-dock-panel-timeline .timeline-premiere-label-inner {
  display: flex;
  flex-direction: column;
}
.as-dock-panel-timeline .timeline-premiere-label-inner > * {
  flex: 0 0 auto;
}
/* Make the dock taller when Timeline Pro is showing so we have room
   for all 7 tracks comfortably (ruler 34 + 7 lanes 42 + statusbar 30 =
   362, plus toolbar ~50 = ~412px minimum). */
.as-dock.timeline-active {
  max-height: 68vh;
  min-height: 460px;
}

/* Label pane (left) */
.as-dock-panel-timeline .timeline-premiere-labels {
  background: var(--tl-label-bg);
  border-right: 1px solid var(--tl-divider-strong);
  overflow: hidden;
  position: relative;
  z-index: 4;
}
.as-dock-panel-timeline .timeline-premiere-label-inner {
  width: 100%;
}
.as-dock-panel-timeline .timeline-premiere-ruler-spacer {
  height: var(--tl-ruler-h);
  background: linear-gradient(180deg, #0a1322 0%, #06101e 100%);
  border-bottom: 1px solid var(--tl-divider-strong);
  border-right: 1px solid var(--tl-divider-strong);
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font-size: 9px;
  font-weight: 800;
  color: var(--tl-text-dim);
  letter-spacing: .12em;
  text-transform: uppercase;
}
/* If the engine has injected its inline transport here, give it room.
   Otherwise show our "TRACK" label as a fallback. */
.as-dock-panel-timeline .timeline-premiere-ruler-spacer:empty::after {
  content: "TRACK";
  margin-left: auto;
  margin-right: 8px;
  font-size: 9px;
  font-weight: 800;
  color: var(--tl-text-dim);
  letter-spacing: .14em;
}
/* Engine-injected inline transport: Play / Stop / timecode */
.as-dock-panel-timeline .timeline-ruler-transport {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
}
.as-dock-panel-timeline .timeline-ruler-transport .btn {
  height: 22px;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(148,163,184,.18);
  color: var(--tl-text);
  border-radius: 5px;
  cursor: pointer;
  letter-spacing: .04em;
  text-transform: none;
}
.as-dock-panel-timeline .timeline-ruler-transport .btn:hover {
  background: rgba(96,165,250,.18);
  border-color: rgba(96,165,250,.46);
}
.as-dock-panel-timeline .timeline-ruler-transport .btn.ghost {
  background: transparent;
}
.as-dock-panel-timeline .timeline-ruler-transport #timelinePlayPauseBtn {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: rgba(34,197,94,.5);
  color: #fff;
  box-shadow: 0 2px 6px rgba(34,197,94,.3);
}
.as-dock-panel-timeline .timeline-ruler-transport #timelinePlayPauseBtn:hover {
  filter: brightness(1.15);
}
.as-dock-panel-timeline .timeline-ruler-transport .timeline-timecode {
  margin-left: auto;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  font-weight: 800;
  color: #fcd34d;
  letter-spacing: .04em;
  padding: 2px 7px;
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.32);
  border-radius: 4px;
  text-transform: none;
}

/* Track label — much richer than the engine default */
.as-dock-panel-timeline .timeline-premiere-label {
  height: var(--tl-row-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 0;
  border-bottom: 1px solid var(--tl-divider);
  background: var(--tl-label-bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--tl-text);
  white-space: nowrap;
  position: relative;
}
.as-dock-panel-timeline .timeline-premiere-label:nth-of-type(even) {
  background: var(--tl-label-bg-alt);
}
/* Track-type color stripe on left edge of each label row */
.as-dock-panel-timeline .timeline-premiere-label::before {
  content: "";
  width: 4px;
  height: 70%;
  border-radius: 0 4px 4px 0;
  align-self: center;
  margin-right: 2px;
  background: var(--tl-track-color, #475569);
  box-shadow: 0 0 8px var(--tl-track-color-glow, rgba(71,85,105,.5));
}

/* Track icon + name */
.as-dock-panel-timeline .timeline-premiere-label > span:first-of-type {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  letter-spacing: .02em;
  flex: 1;
}
/* Icon injected by ai-studio.js — see refreshTrackLabels() */
.as-dock-panel-timeline .timeline-premiere-label .tl-track-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--tl-track-color-bg, rgba(71,85,105,.2));
  color: var(--tl-track-color, #94a3b8);
  font-size: 13px;
  flex-shrink: 0;
}

/* Track tools (visibility / lock toggles) */
.as-dock-panel-timeline .timeline-premiere-label .track-tools {
  display: flex;
  gap: 3px;
  align-items: center;
}
.as-dock-panel-timeline .timeline-premiere-label .track-tools button {
  width: 24px;
  height: 24px;
  border: 1px solid transparent;
  background: rgba(255,255,255,.04);
  color: var(--tl-text-dim);
  font-size: 11px;
  border-radius: 5px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all .12s ease;
}
.as-dock-panel-timeline .timeline-premiere-label .track-tools button:hover {
  background: rgba(96,165,250,.16);
  border-color: rgba(96,165,250,.36);
  color: var(--tl-text);
}

/* Per-track color tokens. Apply via [data-label-track] on the label
   AND [data-track] on the lane (both set by the engine). */
.as-dock-panel-timeline [data-label-track="music"],
.as-dock-panel-timeline [data-track="music"] {
  --tl-track-color: #f97316;
  --tl-track-color-glow: rgba(249,115,22,.45);
  --tl-track-color-bg: rgba(249,115,22,.18);
}
.as-dock-panel-timeline [data-label-track="text"],
.as-dock-panel-timeline [data-track="text"] {
  --tl-track-color: #f59e0b;
  --tl-track-color-glow: rgba(245,158,11,.45);
  --tl-track-color-bg: rgba(245,158,11,.18);
}
.as-dock-panel-timeline [data-label-track="images"],
.as-dock-panel-timeline [data-track="images"] {
  --tl-track-color: #22c55e;
  --tl-track-color-glow: rgba(34,197,94,.45);
  --tl-track-color-bg: rgba(34,197,94,.18);
}
.as-dock-panel-timeline [data-label-track="background"],
.as-dock-panel-timeline [data-track="background"] {
  --tl-track-color: #10b981;
  --tl-track-color-glow: rgba(16,185,129,.4);
  --tl-track-color-bg: rgba(16,185,129,.18);
}
.as-dock-panel-timeline [data-label-track="subtitles"],
.as-dock-panel-timeline [data-track="captions"] {
  --tl-track-color: #ec4899;
  --tl-track-color-glow: rgba(236,72,153,.45);
  --tl-track-color-bg: rgba(236,72,153,.18);
}
.as-dock-panel-timeline [data-label-track="sub-style"],
.as-dock-panel-timeline [data-track="sub-style"] {
  --tl-track-color: #c084fc;
  --tl-track-color-glow: rgba(192,132,252,.45);
  --tl-track-color-bg: rgba(192,132,252,.18);
}
.as-dock-panel-timeline [data-label-track="voice"],
.as-dock-panel-timeline [data-track="voice"] {
  --tl-track-color: #60a5fa;
  --tl-track-color-glow: rgba(96,165,250,.5);
  --tl-track-color-bg: rgba(96,165,250,.18);
}
.as-dock-panel-timeline [data-label-track="effects"],
.as-dock-panel-timeline [data-track="effects"] {
  --tl-track-color: #fbbf24;
  --tl-track-color-glow: rgba(251,191,36,.45);
  --tl-track-color-bg: rgba(251,191,36,.18);
}
.as-dock-panel-timeline [data-label-track="empty"],
.as-dock-panel-timeline [data-track="empty"] {
  --tl-track-color: #475569;
  --tl-track-color-glow: rgba(71,85,105,.32);
  --tl-track-color-bg: rgba(71,85,105,.18);
}

/* Lanes (right side) */
.as-dock-panel-timeline .timeline-premiere-scroll {
  overflow: auto;
  position: relative;
}
.as-dock-panel-timeline .timeline-premiere-inner {
  position: relative;
}

/* Ruler — bolder, with timecode pills */
.as-dock-panel-timeline .timeline-premiere-ruler {
  position: sticky;
  top: 0;
  z-index: 8;
  height: var(--tl-ruler-h);
  background: linear-gradient(180deg, #0a1322 0%, #06101e 100%);
  border-bottom: 1px solid var(--tl-divider-strong);
}
.as-dock-panel-timeline .timeline-ruler-inner {
  position: relative;
  height: 100%;
  width: 100%;
}
.as-dock-panel-timeline .timeline-premiere-ruler button {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  background: rgba(15,23,42,.92);
  color: #cbd5e1;
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all .12s;
}
.as-dock-panel-timeline .timeline-premiere-ruler button:hover {
  background: rgba(37,99,235,.32);
  border-color: rgba(96,165,250,.46);
  color: #fff;
}
/* Tick stem below each ruler timecode */
.as-dock-panel-timeline .timeline-premiere-ruler button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translateX(-50%);
  width: 1px;
  height: 6px;
  background: rgba(148,163,184,.32);
}

/* Lane row — bigger, with grid lines. The engine's simple-mode.css
   uses `.timeline-pro .track-lane{height:36px!important}` so we have
   to use !important too. Scoped to our dock panel so we don't affect
   any other place a timeline might render. */
.as-dock-panel-timeline .timeline-premiere-lane,
.as-dock-panel-timeline .timeline-pro .track-lane,
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-lane {
  height: var(--tl-row-h) !important;
  min-height: var(--tl-row-h) !important;
  position: relative;
  border-bottom: 1px solid var(--tl-divider);
  overflow: visible !important;
  background:
    linear-gradient(90deg, var(--tl-track-color-bg, transparent) 0%, transparent 60%),
    var(--tl-lane-bg);
  background-size: 80px 100%, 100% 100%;
  background-repeat: no-repeat;
}
.as-dock-panel-timeline .timeline-premiere-lane:nth-of-type(even),
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-lane:nth-of-type(even) {
  background:
    linear-gradient(90deg, var(--tl-track-color-bg, transparent) 0%, transparent 60%),
    var(--tl-lane-bg-alt);
  background-size: 80px 100%, 100% 100%;
  background-repeat: no-repeat;
}
.as-dock-panel-timeline .timeline-premiere-label,
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-label {
  height: var(--tl-row-h) !important;
}

/* Snap grid lines — drawn as a repeating linear-gradient overlay */
.as-dock-panel-timeline .timeline-premiere-lane::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(90deg, var(--tl-grid-major) 0 1px, transparent 1px 100%);
  /* The engine uses % widths for clips, so we space grid lines as %; we
     don't know exact seconds, but for visual texture every 5% is fine. */
  background-size: 10% 100%;
  background-repeat: repeat-x;
  opacity: .55;
}

/* Clip blocks — pro design with header strip + body */
.as-dock-panel-timeline .tl-block {
  position: absolute;
  top: 5px;
  height: calc(var(--tl-row-h) - 10px);
  border-radius: 6px;
  padding: 0;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,.32);
  box-shadow: 0 2px 6px rgba(0,0,0,.36), inset 0 1px 0 rgba(255,255,255,.18);
  transition: filter .12s, transform .12s, box-shadow .12s;
  letter-spacing: .02em;
  /* Two-line layout: header + body */
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  user-select: none;
}
.as-dock-panel-timeline .tl-block:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.22);
}
/* Top header strip of the clip — darker than the body */
.as-dock-panel-timeline .tl-block::before {
  content: "";
  flex: 0 0 7px;
  background: linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,.12));
  border-bottom: 1px solid rgba(0,0,0,.22);
}
/* The text becomes the body */
.as-dock-panel-timeline .tl-block {
  align-items: stretch;
}
.as-dock-panel-timeline .tl-block::after {
  content: "";
  flex: 1;
}
/* Put the text content visually below the header strip with padding.
   The engine puts text directly inside .tl-block, so we use line-height
   tricks: shrink padding-top to push text below the 7px header. */
.as-dock-panel-timeline .tl-block {
  padding: 9px 9px 0 9px;
}

/* Per-type clip palettes — refined gradients matching the track colors */
.as-dock-panel-timeline .tl-text {
  background: linear-gradient(180deg, #d97706 0%, #b45309 100%);
  color: #fff7ed;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.as-dock-panel-timeline .tl-img {
  background: linear-gradient(180deg, #16a34a 0%, #15803d 100%);
  color: #f0fdf4;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.as-dock-panel-timeline .tl-sub {
  background: linear-gradient(180deg, #db2777 0%, #9d174d 100%);
  color: #fdf2f8;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.as-dock-panel-timeline .tl-voice {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #eff6ff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.as-dock-panel-timeline .tl-music {
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  color: #fff7ed;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
/* Muted state */
.as-dock-panel-timeline .tl-block.muted {
  opacity: .42;
  filter: grayscale(.4);
  cursor: default;
}
.as-dock-panel-timeline .tl-block.muted:hover {
  transform: none;
}

/* Subtitle trim handles — engine adds ::before / ::after; make them prettier */
.as-dock-panel-timeline .timeline-premiere .tl-sub::before,
.as-dock-panel-timeline .timeline-premiere .tl-sub::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 5px;
  background: rgba(255,255,255,.35);
  border-radius: 3px;
  z-index: 3;
  /* override the engine's own ::before/::after styling */
  background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.2)) !important;
}
.as-dock-panel-timeline .timeline-premiere .tl-sub::before { left: 2px; }
.as-dock-panel-timeline .timeline-premiere .tl-sub::after  { right: 2px; left: auto; }

/* Active subtitle (currently under playhead) */
.as-dock-panel-timeline .tl-sub.active-subtitle {
  outline: 2px solid #fbbf24 !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(251,191,36,.22), 0 6px 18px rgba(0,0,0,.4) !important;
  z-index: 22;
  animation: tlActivePulse 1.4s ease-in-out infinite;
}
@keyframes tlActivePulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(251,191,36,.22), 0 6px 18px rgba(0,0,0,.4); }
  50%      { box-shadow: 0 0 0 6px rgba(251,191,36,.32), 0 8px 22px rgba(0,0,0,.5); }
}

/* Playhead — beefier, with timecode badge on top */
.as-dock-panel-timeline .timeline-premiere .tl-playhead,
.as-dock-panel-timeline .tl-playhead {
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 2.5px !important;
  background: #fbbf24 !important;
  border-radius: 999px;
  z-index: 30 !important;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.32),
    0 0 14px rgba(251,191,36,1),
    0 0 36px rgba(251,191,36,.5);
  pointer-events: none;
}

/* Subtle right-edge accent on every clip — pro editor look */
.as-dock-panel-timeline .tl-block:not(.muted) {
  position: relative;
}
.as-dock-panel-timeline .tl-text:not(.muted) {
  box-shadow:
    inset -2px 0 0 rgba(255,255,255,.32),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 2px 6px rgba(0,0,0,.36);
}
.as-dock-panel-timeline .tl-img:not(.muted) {
  box-shadow:
    inset -2px 0 0 rgba(255,255,255,.3),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 2px 6px rgba(0,0,0,.36);
}
.as-dock-panel-timeline .tl-sub:not(.muted) {
  box-shadow:
    inset -2px 0 0 rgba(255,255,255,.32),
    inset 0 1px 0 rgba(255,255,255,.2),
    0 2px 6px rgba(0,0,0,.36);
}
.as-dock-panel-timeline .tl-voice:not(.muted) {
  box-shadow:
    inset -2px 0 0 rgba(191,219,254,.42),
    inset 0 1px 0 rgba(255,255,255,.18),
    0 2px 6px rgba(0,0,0,.36);
}
.as-dock-panel-timeline .tl-music:not(.muted) {
  box-shadow:
    inset -2px 0 0 rgba(255,255,255,.32),
    inset 0 1px 0 rgba(255,255,255,.2),
    0 2px 6px rgba(0,0,0,.36);
}
/* Show the playhead "head" circle ONLY on the first lane's playhead,
   not every lane (each lane has its own .tl-playhead but the head
   should appear once at the top of the column, like Premiere/DaVinci). */
.as-dock-panel-timeline .timeline-premiere-lane:first-of-type .tl-playhead::before,
.as-dock-panel-timeline #workspaceTimeline .timeline-premiere-lane:first-of-type .tl-playhead::before {
  content: "" !important;
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fbbf24 !important;
  border: 2px solid #fef3c7;
  box-shadow: 0 0 14px rgba(251,191,36,.95), 0 2px 6px rgba(0,0,0,.4) !important;
  z-index: 31;
}
/* Suppress the head on all other lanes' playheads */
.as-dock-panel-timeline .timeline-premiere-lane:not(:first-of-type) .tl-playhead::before {
  content: none !important;
  display: none !important;
}

/* TC badge — engine renders this on the FIRST lane */
.as-dock-panel-timeline .tl-playhead-label {
  position: absolute;
  top: -23px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #fbbf24, #d97706);
  color: #1c1917;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(251,191,36,.4), 0 0 0 1px rgba(0,0,0,.32);
  z-index: 32;
  pointer-events: none;
}
.as-dock-panel-timeline .tl-playhead-label::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #d97706;
}

/* Scene markers — chevrons / scene number pills on the first lane */
.as-dock-panel-timeline .tl-scene-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

/* Voice clip with waveform */
.as-dock-panel-timeline .tl-voice-with-wave {
  background: linear-gradient(180deg, #2563eb 0%, #1e3a8a 100%) !important;
  position: relative;
  overflow: hidden;
}
.as-dock-panel-timeline .tl-voice-label {
  position: absolute;
  inset: 9px 9px auto 9px;
  font-size: 9.5px;
  font-weight: 800;
  color: #dbeafe;
  letter-spacing: .04em;
  z-index: 2;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  pointer-events: none;
}
.as-dock-panel-timeline .tl-voice-with-wave .tl-waveform {
  position: absolute;
  inset: 18px 6px 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1px;
  z-index: 1;
}
.as-dock-panel-timeline .tl-voice-with-wave .tl-waveform span {
  flex: 1;
  background: linear-gradient(180deg, rgba(191,219,254,.95), rgba(191,219,254,.45));
  border-radius: 1px;
  min-height: 2px;
}

/* Status bar — bottom of the timeline */
.as-dock-panel-timeline .timeline-statusbar {
  display: flex;
  gap: 18px;
  padding: 7px 16px;
  background: linear-gradient(180deg, #06101e 0%, #050810 100%);
  border-top: 1px solid var(--tl-divider-strong);
  font-size: 10.5px;
  color: var(--tl-text-dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.as-dock-panel-timeline .timeline-statusbar b {
  color: #fcd34d;
  font-weight: 800;
  margin-left: 4px;
}

/* Help popover */
.as-dock-panel-timeline .timeline-help-popover {
  position: absolute;
  top: 50px;
  left: 16px;
  background: #0a1322;
  border: 1px solid rgba(148,163,184,.24);
  border-radius: 9px;
  padding: 10px 14px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--tl-text-dim);
}
.as-dock-panel-timeline .timeline-help-popover b {
  color: #fcd34d;
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 4px;
  display: block;
}

/* Compact mode for shorter dock heights */
@media (max-height: 820px) {
  .as-dock-panel-timeline,
  .as-dock-panel-timeline .timeline-pro,
  .as-dock-panel-timeline #workspaceTimeline.timeline-pro {
    --tl-row-h: 38px; --tl-ruler-h: 30px;
  }
  .as-dock-panel-timeline .tl-block { font-size: 10px; padding-top: 8px; }
}
@media (max-height: 720px) {
  .as-dock-panel-timeline,
  .as-dock-panel-timeline .timeline-pro,
  .as-dock-panel-timeline #workspaceTimeline.timeline-pro {
    --tl-row-h: 34px; --tl-ruler-h: 28px;
  }
}

/* Mobile compact */
@media (max-width: 760px) {
  .as-dock-panel-timeline {
    --tl-label-w: 132px;
  }
  .as-dock-panel-timeline .timeline-premiere-label .track-tools { display: none; }
}

/* ============================================================
   Timeline Pro extras: selection, image drag, keyboard hint
   ============================================================ */

/* Selected subtitle clip — even louder than active-subtitle */
.as-dock-panel-timeline .tl-sub.tl-selected,
.as-dock-panel-timeline #workspaceTimeline .tl-sub.tl-selected {
  outline: 2px solid #60a5fa !important;
  outline-offset: 2px;
  box-shadow:
    0 0 0 4px rgba(96,165,250,.32),
    0 6px 18px rgba(0,0,0,.5) !important;
  z-index: 23 !important;
}

/* Image clip cursor — grabby when over a draggable image clip */
.as-dock-panel-timeline .timeline-premiere-lane[data-track="images"] .tl-img {
  cursor: grab;
}
.as-dock-panel-timeline .timeline-premiere-lane[data-track="images"] .tl-img.tl-img-dragging,
.as-dock-panel-timeline .timeline-premiere-lane[data-track="images"] .tl-img:active {
  cursor: grabbing;
  outline: 2px solid #22c55e !important;
  outline-offset: 1px;
  box-shadow:
    0 0 0 4px rgba(34,197,94,.32),
    0 8px 20px rgba(0,0,0,.5) !important;
  z-index: 25 !important;
  filter: brightness(1.15);
}
/* Lock the cursor when the images track is locked */
.as-dock-panel-timeline .timeline-premiere-lane[data-track="images"]:has(~ * .track-tools button[data-track-lock="images"]:not([data-locked="0"])) .tl-img {
  cursor: not-allowed;
}

/* Keyboard shortcuts hint chip in the timeline header */
.as-dock-panel-timeline .timeline-shortcuts-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 3px 9px;
  background: rgba(96,165,250,.1);
  border: 1px solid rgba(96,165,250,.28);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #bfdbfe;
  letter-spacing: .02em;
}
.as-dock-panel-timeline .timeline-shortcuts-hint kbd {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(0,0,0,.32);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 9px;
  color: #fef3c7;
}

/* Updated help popover content to mention keys */
.as-dock-panel-timeline .timeline-help-popover {
  min-width: 240px;
}

/* ============================================================
   Media inspector — bg-thumb grid fixes
   The engine's bg-thumb component was designed for a full-width
   editor pane. Inside our 360px right inspector it overflows:
   4-column slider grids cram to ~70px each, "Duplicate" gets cut
   to "Duplicat", "Brightness" to "Brightr", etc. We override
   inside the inspector to use compact 2-column grids and smaller
   buttons.
   ============================================================ */
.as-inspector .bg-thumb {
  padding: 10px;
  margin-bottom: 10px;
}

/* CRITICAL: the engine's CSS turns .bg-thumb.active into a 2-column grid
   (image 180px on the left, meta 1fr on the right). That works in the
   wide standalone editor but collapses metadata to ~105px in our 360px
   inspector — "Brightness" gets truncated to "Brightr", "Duplicate" to
   "Duplicat", etc. Override to stack vertically inside the inspector. */
.as-inspector .image-panel.active .bg-gallery .bg-thumb,
.as-inspector .image-panel.active .bg-gallery .bg-thumb.active {
  display: block !important;
  grid-template-columns: none !important;
  grid-template-areas: none !important;
  gap: 0 !important;
  padding: 12px !important;
  width: 100% !important;
}
.as-inspector .image-panel.active .bg-gallery .bg-thumb.active > img,
.as-inspector .image-panel.active .bg-gallery .bg-thumb.active > video,
.as-inspector .image-panel.active .bg-gallery .bg-thumb > img,
.as-inspector .image-panel.active .bg-gallery .bg-thumb > video {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 220px !important;
  aspect-ratio: 16 / 10 !important;
  object-fit: cover !important;
  margin-bottom: 10px;
  border-radius: 10px;
  grid-area: auto !important;
}
.as-inspector .image-panel.active .bg-gallery .bg-thumb.active .thumb-meta,
.as-inspector .image-panel.active .bg-gallery .bg-thumb .thumb-meta {
  width: 100% !important;
  margin-top: 0 !important;
  grid-area: auto !important;
}

.as-inspector .bg-thumb img {
  aspect-ratio: 1 / 1;
  max-height: 240px;
  width: 100%;
  object-fit: cover;
}

/* Force every slider/role/scene row to 2 columns max in the inspector */
.as-inspector .thumb-range-row,
.as-inspector .thumb-range-row.three,
.as-inspector .thumb-range-row.four,
.as-inspector .thumb-role-row,
.as-inspector .thumb-scenes-row {
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
}

/* Slider cell — allow labels to wrap if needed; never truncate */
.as-inspector .thumb-range-row > div,
.as-inspector .thumb-role-row > * ,
.as-inspector .thumb-scenes-row > * {
  min-width: 0;            /* prevent grid overflow */
}
.as-inspector .thumb-meta small {
  font-size: 10px;
  line-height: 1.25;
  white-space: normal;     /* allow "Brightness" to fit */
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
}

/* Inputs and selects — slightly tighter so they don't bleed past */
.as-inspector .thumb-meta input,
.as-inspector .thumb-meta select {
  font-size: 11px;
  padding: 6px 8px;
}
.as-inspector .thumb-meta input[type="range"] {
  padding: 0;
  margin: 2px 0 0;
  height: 18px;
}

/* Actions row — 5 buttons (Auto Match / Duplicate / Crop / Reset /
   Remove) does NOT fit in one row at 330px wide. Use a 3-col grid so
   buttons wrap to 2 rows: 3 on top, 2 on bottom (auto-fill). */
.as-inspector .thumb-actions {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 5px !important;
  margin-top: 10px;
}
.as-inspector .thumb-actions button {
  font-size: 11px;
  padding: 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
  font-weight: 700;
  background: #1e293b;
  color: #fff;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  cursor: pointer;
  min-width: 0;
}
.as-inspector .thumb-actions button:hover {
  background: #2a3a52;
  border-color: rgba(96,165,250,.4);
}

/* Per-image controls explainer note — allow wrap, small */
.as-inspector .thumb-meta .mini-note {
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
  overflow: visible;
  color: #94a3b8;
  margin-top: 2px;
  padding: 0 2px;
}

/* Drag handle / role badge / scene tag — keep readable */
.as-inspector .bg-thumb .order-badge,
.as-inspector .bg-thumb .drag-handle {
  font-size: 10px;
  padding: 3px 7px;
}

/* Quick "Use / Background / Auto scene" buttons under the thumb */
.as-inspector .bg-thumb .thumb-role-row select,
.as-inspector .bg-thumb .thumb-role-row button {
  font-size: 11px;
  padding: 6px 6px;
}

/* The right-edge column of the bg-thumb metadata (where Zoom, Brightness,
   Corner, Duplicate were getting cut) was sometimes being clipped by an
   overflow:hidden on the parent. Make sure overflow is visible. */
.as-inspector .bg-thumb {
  overflow: visible;
}
.as-inspector .bg-thumb img {
  border-radius: 10px;
}

/* When the inspector becomes a bottom drawer on mobile, restore some
   breathing room since width is now 100%. */
@media (max-width: 720px) {
  .as-inspector .thumb-range-row.four {
    grid-template-columns: 1fr 1fr 1fr 1fr !important;
  }
  .as-inspector .thumb-actions {
    grid-template-columns: repeat(5, 1fr) !important;
  }
}

/* ============================================================
   LAYERS — free-position image layers Creative Tool
   ============================================================ */

/* "Choose images" button styled like an input button */
.as-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(96,165,250,.16), rgba(124,58,237,.14));
  border: 1px solid rgba(96,165,250,.36);
  color: #dbeafe;
  border-radius: 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  transition: all .12s ease;
  text-align: center;
  width: 100%;
  justify-content: center;
}
.as-file-btn:hover {
  background: linear-gradient(135deg, rgba(96,165,250,.28), rgba(124,58,237,.22));
  border-color: rgba(96,165,250,.6);
}

/* Layer list row */
.as-layer-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px;
  background: #0b1220;
  border: 1px solid var(--as-border-2);
  border-radius: 9px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.as-layer-row:hover { background: #14213a; }
.as-layer-row.active {
  border-color: var(--as-accent);
  background: rgba(37,99,235,.12);
}
.as-layer-thumb {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #050810;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
}
.as-layer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.as-layer-info {
  min-width: 0;
  overflow: hidden;
}
.as-layer-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--as-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.as-layer-meta {
  font-size: 10px;
  color: var(--as-text-dim);
  font-variant-numeric: tabular-nums;
}
.as-layer-btns {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.as-layer-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(148,163,184,.18);
  color: var(--as-text-dim);
  border-radius: 5px;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: all .12s;
}
.as-layer-btn:hover {
  background: rgba(96,165,250,.18);
  color: var(--as-text);
  border-color: rgba(96,165,250,.4);
}
.as-layer-btn.danger:hover {
  background: rgba(239,68,68,.18);
  color: #fca5a5;
  border-color: rgba(239,68,68,.4);
}

/* When the Layers section is active, give the canvas a hint that
   it's interactive for this tool. */
.as-insp-section[data-section="layers"].active ~ * #poster {
  /* Cursor is set dynamically by the JS based on what's under the
     pointer, but a default 'default' here prevents the
     not-allowed/text cursor from sticking around. */
  cursor: default;
}

/* Warn variant of as-hint — used for "out of time window" notice */
.as-hint.warn {
  color: #fbbf24;
  background: rgba(251,191,36,.06);
  border: 1px solid rgba(251,191,36,.22);
  padding: 6px 9px;
  border-radius: 6px;
}

/* ============================================================
   LAYERS — video layer additions
   ============================================================ */

/* Placeholder thumbnail for video layers (no img src — show a play icon) */
.as-layer-thumb-video {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1e293b, #0f1729);
  color: #fbbf24;
  font-size: 18px;
  font-weight: 700;
}
.as-layer-thumb-video span {
  filter: drop-shadow(0 0 6px rgba(251,191,36,.5));
}

/* "VIDEO" inline tag on the layer name */
.as-layer-tag {
  display: inline-block;
  font-size: 8px;
  font-weight: 800;
  padding: 1px 5px;
  margin-right: 5px;
  border-radius: 3px;
  background: rgba(251,191,36,.18);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,.4);
  letter-spacing: .04em;
  vertical-align: middle;
}

/* ============================================================
   TIMELINE LAYERS LANE — injected "Layers" track in Timeline Pro
   ============================================================ */

/* ── Label (left column) ── */
.tl-layers-label {
  border-top: 1px solid rgba(148,163,184,.1);
}
.tl-layers-label > span {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #cbd5e1;
}

/* ── Lane (right column) ── */
.tl-layers-lane {
  border-top: 1px solid rgba(148,163,184,.1);
  position: relative;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(100% / 8 - 1px),
    rgba(148,163,184,.04) calc(100% / 8 - 1px),
    rgba(148,163,184,.04) calc(100% / 8)
  );
}
.tl-layers-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 10px;
  color: #475569;
  font-style: italic;
  pointer-events: none;
}

/* ── Clip bar ── */
.tl-layer-clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 5px;
  overflow: visible;   /* handles stick out */
  cursor: grab;
  display: flex;
  align-items: center;
  padding: 0 10px;
  box-sizing: border-box;
  min-width: 6px;
  transition: filter .08s;
  user-select: none;
}
.tl-layer-clip:active { cursor: grabbing; }
.tl-layer-clip:hover  { filter: brightness(1.15); }

/* Image layer clip — blue tones */
.tl-layer-image {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 60%, #3b82f6 100%);
  border: 1px solid rgba(96,165,250,.55);
  box-shadow: 0 1px 6px rgba(37,99,235,.35);
}
/* Video layer clip — amber tones */
.tl-layer-video {
  background: linear-gradient(135deg, #b45309 0%, #d97706 60%, #f59e0b 100%);
  border: 1px solid rgba(251,191,36,.55);
  box-shadow: 0 1px 6px rgba(217,119,6,.35);
}

/* ── Clip label ── */
.tl-layer-clip-label {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 16px);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  letter-spacing: .01em;
}

/* ── Trim handles ── */
.tl-layer-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  background: rgba(255,255,255,.25);
  border-radius: 3px;
  cursor: col-resize;
  z-index: 5;
  transition: background .1s;
}
.tl-layer-handle:hover,
.tl-layer-handle:active { background: rgba(255,255,255,.6); }
.tl-layer-handle-left  { left: 0;  border-radius: 5px 2px 2px 5px; }
.tl-layer-handle-right { right: 0; border-radius: 2px 5px 5px 2px; }

/* ── Video source-trim inner bar ── */
.tl-layer-source-bar {
  position: absolute;
  bottom: 2px;
  left: 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.45);
  pointer-events: none;
  z-index: 2;
}

/* ============================================================
   LAYERS — srcMissing / dead blob URL warning states
   ============================================================ */

/* Warning thumbnail — amber, shows ⚠ instead of ▶ */
.as-layer-thumb-missing {
  background: linear-gradient(135deg, #78350f, #92400e) !important;
  color: #fbbf24 !important;
}

/* Warning tag on layer row */
.as-layer-tag-warn {
  background: rgba(245,158,11,.18) !important;
  color: #fbbf24 !important;
  border-color: rgba(245,158,11,.4) !important;
}

/* Warning variant of the file button */
.as-file-btn-warn {
  background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(217,119,6,.14)) !important;
  border-color: rgba(245,158,11,.4) !important;
  color: #fde68a !important;
}
.as-file-btn-warn:hover {
  background: linear-gradient(135deg, rgba(245,158,11,.28), rgba(217,119,6,.24)) !important;
  border-color: rgba(245,158,11,.6) !important;
}
