/* =====================================================================
   Emmak Player 3.1 — Video Studio (CapCut-inspired dark workspace)
   Layout: top bar / (media | preview | inspector) / timeline
   Brand: charcoal panels + Emmak red (#D20000) accent.
   ===================================================================== */

.studio {
  --st-bg: #131316;
  --st-panel: #1d1d21;
  --st-panel-2: #232327;
  --st-panel-3: #2a2a2f;
  --st-border: #303036;
  --st-border-soft: #28282d;
  --st-text: #e9e9ec;
  --st-muted: #9b9ba4;
  --st-faint: #6d6d76;
  --st-accent: #d20000;
  --st-accent-soft: rgba(210, 0, 0, 0.16);
  --st-clip-video: #3a5a78;
  --st-clip-video-edge: #4d7396;
  --st-clip-audio: #2e7d5b;
  --st-clip-audio-edge: #3fa375;
  --st-clip-text: #8a6435;
  --st-clip-text-edge: #b08348;
  --st-clip-image: #6b4a7d;
  --st-clip-image-edge: #8a629e;
  --st-ruler: #26262b;
  --st-radius: 8px;
  --st-radius-sm: 6px;

  position: relative;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) var(--tl-height, 264px);
  height: 100dvh;
  min-height: 560px;
  background: var(--st-bg);
  color: var(--st-text);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.studio *, .studio *::before, .studio *::after { box-sizing: border-box; }
.studio button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.studio input, .studio select, .studio textarea { font: inherit; color: var(--st-text); }
.studio svg { display: block; }
.studio .hidden { display: none !important; }

/* ============================== Top bar ============================== */
.st-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: var(--st-panel);
  border-bottom: 1px solid var(--st-border);
  z-index: 40;
  position: relative;
}
.st-brand { display: flex; align-items: center; gap: 8px; }
.st-brand img { height: 26px; width: auto; }
.st-brand .st-brand-name { font-weight: 700; letter-spacing: .2px; font-size: 14px; color: #fff; }
.st-brand .st-brand-name em { color: var(--st-accent); font-style: normal; }

.st-project { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; justify-content: center; }
.st-projects-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--st-radius-sm);
  background: var(--st-panel-2); border: 1px solid var(--st-border);
  color: var(--st-muted); white-space: nowrap;
}
.st-projects-btn:hover { color: var(--st-text); background: var(--st-panel-3); }
.st-name-input {
  background: transparent; border: 1px solid transparent; border-radius: var(--st-radius-sm);
  padding: 5px 8px; color: #fff; font-weight: 600; min-width: 120px; max-width: 320px; width: 240px;
  text-overflow: ellipsis;
}
.st-name-input:hover { border-color: var(--st-border); }
.st-name-input:focus { outline: none; border-color: var(--st-accent); background: var(--st-panel-2); }
.st-save-state { font-size: 11px; color: var(--st-faint); white-space: nowrap; }
.st-save-state.saving { color: var(--st-muted); }
.st-save-state.saved { color: #57a773; }

.st-top-actions { display: flex; align-items: center; gap: 8px; }
.st-tool-badge {
  font-size: 11px; color: var(--st-muted); border: 1px solid var(--st-border);
  padding: 3px 8px; border-radius: 99px; white-space: nowrap;
}
.st-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--st-radius-sm); color: var(--st-muted);
}
.st-icon-btn:hover { background: var(--st-panel-3); color: var(--st-text); }
.st-icon-btn:disabled { opacity: .35; cursor: default; }
.st-icon-btn:disabled:hover { background: none; color: var(--st-muted); }
.st-export-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--st-accent); color: #fff; font-weight: 600;
  padding: 7px 16px; border-radius: var(--st-radius-sm); white-space: nowrap;
}
.st-export-btn:hover { background: #e60f0f; }
.st-export-btn:disabled { opacity: .5; cursor: default; }
.st-export-btn:disabled:hover { background: var(--st-accent); }

/* Projects dropdown */
.st-projects-menu {
  position: absolute; top: 46px; left: 50%; transform: translateX(-50%);
  width: 380px; max-width: calc(100vw - 24px);
  background: var(--st-panel-2); border: 1px solid var(--st-border); border-radius: 10px;
  box-shadow: 0 14px 44px rgba(0,0,0,.55); z-index: 60; overflow: hidden;
}
.st-pm-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--st-border-soft); }
.st-pm-head h3 { margin: 0; font-size: 12px; color: var(--st-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.st-new-project { color: var(--st-accent); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.st-new-project:hover { text-decoration: underline; }
.st-pm-list { max-height: 300px; overflow-y: auto; }
.st-pm-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
  border-bottom: 1px solid var(--st-border-soft);
}
.st-pm-item:hover { background: var(--st-panel-3); }
.st-pm-item.active { box-shadow: inset 3px 0 0 var(--st-accent); }
.st-pm-item .st-pm-icon { width: 34px; height: 22px; border-radius: 4px; background: var(--st-clip-video); flex: none; position: relative; overflow: hidden; }
.st-pm-item .st-pm-icon::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%); }
.st-pm-item .st-pm-meta { min-width: 0; flex: 1; }
.st-pm-item .st-pm-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-pm-item .st-pm-sub { font-size: 11px; color: var(--st-faint); }
.st-pm-item .st-pm-del { color: var(--st-faint); width: 26px; height: 26px; border-radius: 5px; flex: none; }
.st-pm-item .st-pm-del:hover { color: #ff6b6b; background: rgba(255,107,107,.12); }
.st-pm-empty { padding: 22px 12px; text-align: center; color: var(--st-faint); font-size: 12px; }

/* ============================== Main row ============================== */
.st-main { display: grid; grid-template-columns: 272px minmax(0, 1fr) 296px; min-height: 0; }

.st-panel { background: var(--st-panel); display: flex; flex-direction: column; min-height: 0; }
.st-media { border-right: 1px solid var(--st-border); }
.st-inspector { border-left: 1px solid var(--st-border); }
.st-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px; }
.st-panel-head h2 { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--st-muted); }

/* ============================== Media library ============================== */
.st-media-actions { display: flex; gap: 6px; }
.st-import-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--st-accent); color: #fff; font-weight: 600;
  padding: 5px 12px; border-radius: var(--st-radius-sm);
}
.st-import-btn:hover { background: #e60f0f; }
.st-mini-btn {
  width: 27px; height: 27px; border-radius: var(--st-radius-sm);
  background: var(--st-panel-2); border: 1px solid var(--st-border); color: var(--st-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.st-mini-btn:hover { color: var(--st-text); background: var(--st-panel-3); }

.st-media-search { padding: 0 12px 8px; display: grid; gap: 8px; }
.st-search-input {
  width: 100%; background: var(--st-panel-2); border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm); padding: 6px 10px; color: var(--st-text);
}
.st-search-input:focus { outline: none; border-color: var(--st-accent); }
.st-search-input::placeholder { color: var(--st-faint); }

.st-media-filters { display: flex; gap: 4px; background: var(--st-bg); padding: 3px; border-radius: var(--st-radius-sm); }
.st-media-filters button {
  flex: 1; padding: 4px 0; border-radius: 4px; color: var(--st-faint); font-size: 12px;
}
.st-media-filters button.active { background: var(--st-panel-3); color: var(--st-text); }

.st-dropzone {
  margin: 0 12px 10px; border: 1.5px dashed var(--st-border); border-radius: var(--st-radius);
  padding: 20px 14px; text-align: center; color: var(--st-faint); transition: .15s;
}
.st-dropzone strong { color: var(--st-muted); }
.st-dropzone.drag, .studio.st-dragging .st-dropzone { border-color: var(--st-accent); color: var(--st-text); background: var(--st-accent-soft); }

.st-media-list { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: grid; gap: 8px; align-content: start; }
.st-media-item {
  display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 6px;
  background: var(--st-panel-2); border: 1px solid var(--st-border-soft); border-radius: var(--st-radius);
  cursor: grab; position: relative;
}
.st-media-item:hover { border-color: #3d3d44; background: var(--st-panel-3); }
.st-media-item.dragging { opacity: .5; }
.st-media-item.adding { pointer-events: none; }
.st-media-thumb {
  width: 74px; height: 48px; border-radius: 5px; background: #101013 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: var(--st-faint); overflow: hidden; position: relative;
}
.st-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.st-media-thumb .st-media-badge { position: absolute; top: 3px; left: 3px; background: rgba(0,0,0,.66); color: #fff; font-size: 9px; padding: 1px 5px; border-radius: 3px; letter-spacing: .5px; text-transform: uppercase; }
.st-media-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-media-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-media-sub { font-size: 11px; color: var(--st-faint); display: flex; gap: 6px; flex-wrap: wrap; }
.st-media-item .st-media-del {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 5px;
  background: rgba(0,0,0,.55); color: #fff; opacity: 0; display: flex; align-items: center; justify-content: center;
}
.st-media-item:hover .st-media-del { opacity: 1; }
.st-media-item .st-media-del:hover { color: #ff6b6b; }
.st-media-item .st-media-add {
  position: absolute; bottom: 4px; right: 4px; height: 22px; padding: 0 7px; border-radius: 5px;
  background: var(--st-accent); color: #fff; font-size: 11px; font-weight: 600; opacity: 0;
  display: flex; align-items: center; gap: 4px;
}
.st-media-item:hover .st-media-add { opacity: 1; }
.st-media-empty { padding: 28px 10px; text-align: center; color: var(--st-faint); font-size: 12px; }

.st-media-progress { height: 3px; border-radius: 2px; background: var(--st-panel-3); overflow: hidden; margin-top: 2px; }
.st-media-progress > div { height: 100%; background: var(--st-accent); width: 0%; transition: width .2s; }

/* ============================== Preview ============================== */
.st-preview { background: #0d0d0f; }
.st-stage {
  flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 18px;
}
.st-canvas-wrap { position: relative; box-shadow: 0 6px 40px rgba(0,0,0,.5); background: #000; max-width: 100%; max-height: 100%; }
.st-canvas-wrap canvas { display: block; max-width: 100%; max-height: 100%; }
.st-stage .st-empty-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px;
  align-items: center; justify-content: center; color: var(--st-faint); text-align: center; padding: 20px;
  background: repeating-conic-gradient(#111114 0% 25%, #16161a 0% 50%) 50%/28px 28px;
}
.st-empty-state .st-empty-icon { color: #3a3a41; }
.st-empty-state h3 { margin: 0; color: var(--st-muted); font-size: 15px; }
.st-empty-state p { margin: 0; font-size: 12px; max-width: 380px; }

/* transport */
.st-transport {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; background: var(--st-panel); border-top: 1px solid var(--st-border-soft);
}
.st-transport-left, .st-transport-right { display: flex; align-items: center; gap: 6px; }
.st-play-btn {
  width: 34px; height: 34px; border-radius: 50%; background: #fff; color: #111;
  display: inline-flex; align-items: center; justify-content: center;
}
.st-play-btn:hover { transform: scale(1.05); }
.st-time { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--st-muted); margin-left: 6px; white-space: nowrap; }
.st-time b { color: var(--st-text); font-weight: 600; }
.st-tbtn {
  height: 28px; padding: 0 9px; border-radius: var(--st-radius-sm); color: var(--st-muted);
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; border: 1px solid transparent;
}
.st-tbtn:hover { color: var(--st-text); background: var(--st-panel-3); }
.st-tbtn.active { color: #fff; background: var(--st-accent-soft); border-color: var(--st-accent); }
.st-volume { display: flex; align-items: center; gap: 5px; }
.st-volume input[type="range"] { width: 74px; }

/* scrub bar (fine control under preview) */
.st-scrub { height: 18px; margin: 0 12px 8px; position: relative; cursor: pointer; }
.st-scrub .st-scrub-track { position: absolute; left: 0; right: 0; top: 8px; height: 3px; border-radius: 2px; background: var(--st-panel-3); }
.st-scrub .st-scrub-fill { position: absolute; left: 0; top: 8px; height: 3px; border-radius: 2px; background: var(--st-accent); width: 0; }
.st-scrub .st-scrub-handle {
  position: absolute; top: 4.5px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; transform: translateX(-50%); left: 0; box-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* region overlay (crop / delogo quick tools) */
.st-region { position: absolute; border: 1.5px dashed #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; }
.st-region .st-region-handle { position: absolute; width: 12px; height: 12px; background: #fff; border-radius: 3px; }
.st-region .st-region-handle.nw { top: -7px; left: -7px; cursor: nwse-resize; }
.st-region .st-region-handle.ne { top: -7px; right: -7px; cursor: nesw-resize; }
.st-region .st-region-handle.sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.st-region .st-region-handle.se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.st-region .st-region-label {
  position: absolute; top: -24px; left: 0; background: rgba(0,0,0,.7); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}

/* ============================== Inspector ============================== */
.st-tabs { display: flex; gap: 2px; padding: 8px 8px 0; flex-wrap: wrap; }
.st-tabs button {
  padding: 6px 10px; border-radius: var(--st-radius-sm) var(--st-radius-sm) 0 0;
  color: var(--st-faint); font-size: 12px; font-weight: 600;
}
.st-tabs button:hover { color: var(--st-text); }
.st-tabs button.active { color: #fff; background: var(--st-panel-3); }
.st-tab-panels { flex: 1; overflow-y: auto; padding: 10px 12px 16px; }
.st-tab-panel { display: none; }
.st-tab-panel.active { display: block; }

.st-insp-empty { text-align: center; color: var(--st-faint); padding: 40px 8px; font-size: 12.5px; }
.st-insp-clip-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.st-insp-clip-head .st-insp-clip-icon { width: 34px; height: 22px; border-radius: 4px; background: var(--st-clip-video); flex: none; }
.st-insp-clip-head .st-insp-clip-name { min-width: 0; }
.st-insp-clip-head .st-insp-clip-name b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.st-insp-clip-head .st-insp-clip-name span { font-size: 11px; color: var(--st-faint); }

.st-group { margin-bottom: 14px; background: var(--st-panel-2); border: 1px solid var(--st-border-soft); border-radius: var(--st-radius); padding: 10px 11px; }
.st-group > h4 {
  margin: 0 0 9px; font-size: 11px; text-transform: uppercase; letter-spacing: .7px;
  color: var(--st-muted); display: flex; justify-content: space-between; align-items: center;
}
.st-group > h4 .st-val { color: var(--st-text); font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0; }

.st-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; margin-bottom: 8px; }
.st-row:last-child { margin-bottom: 0; }
.st-row > label { font-size: 12px; color: var(--st-muted); }
.st-row .st-ctl { display: flex; align-items: center; gap: 7px; min-width: 0; }
.st-row .st-ctl input[type="range"] { flex: 1; min-width: 0; }
.st-row .st-ctl .st-num { width: 56px; text-align: right; font-variant-numeric: tabular-nums; font-size: 11.5px; color: var(--st-muted); }

.studio input[type="range"] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: var(--st-panel-3); outline: none;
}
.studio input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #fff; cursor: pointer;
}
.studio input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; cursor: pointer; }

.st-text-input, .st-select, .st-textarea {
  width: 100%; background: var(--st-bg); border: 1px solid var(--st-border);
  border-radius: var(--st-radius-sm); padding: 6px 9px; color: var(--st-text);
}
.st-text-input:focus, .st-select:focus, .st-textarea:focus { outline: none; border-color: var(--st-accent); }
.st-textarea { resize: vertical; min-height: 54px; }
.st-color-input { width: 34px; height: 26px; padding: 2px; background: var(--st-bg); border: 1px solid var(--st-border); border-radius: 5px; cursor: pointer; }

.st-chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.st-chip {
  padding: 4px 10px; border-radius: 99px; background: var(--st-bg); border: 1px solid var(--st-border);
  color: var(--st-muted); font-size: 12px;
}
.st-chip:hover { color: var(--st-text); border-color: #45454c; }
.st-chip.active { color: #fff; border-color: var(--st-accent); background: var(--st-accent-soft); }

.st-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.st-toggle input { display: none; }
.st-toggle .st-toggle-track { width: 30px; height: 17px; border-radius: 99px; background: var(--st-panel-3); position: relative; transition: .15s; flex: none; }
.st-toggle .st-toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: .15s; }
.st-toggle input:checked + .st-toggle-track { background: var(--st-accent); }
.st-toggle input:checked + .st-toggle-track::after { left: 15px; }
.st-toggle span { font-size: 12px; color: var(--st-muted); }

.st-filter-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.st-filter-cell {
  border-radius: var(--st-radius-sm); border: 1.5px solid var(--st-border); background: var(--st-bg);
  padding: 5px; cursor: pointer; text-align: center;
}
.st-filter-cell:hover { border-color: #45454c; }
.st-filter-cell.active { border-color: var(--st-accent); }
.st-filter-cell .st-filter-swatch { height: 34px; border-radius: 4px; margin-bottom: 5px; background: linear-gradient(135deg, #8a7f6a, #5d6b5a); }
.st-filter-cell .st-filter-name { font-size: 10.5px; color: var(--st-muted); }
.st-filter-cell.active .st-filter-name { color: #fff; }

.st-quick-note { font-size: 12px; color: var(--st-faint); background: var(--st-panel-2); border-radius: var(--st-radius-sm); padding: 8px 10px; margin-bottom: 10px; }

/* output tab */
.st-output-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.st-stat { background: var(--st-panel-2); border-radius: var(--st-radius-sm); padding: 8px 10px; }
.st-stat b { display: block; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }
.st-stat span { font-size: 10.5px; color: var(--st-faint); text-transform: uppercase; letter-spacing: .5px; }

/* ============================== Timeline ============================== */
.st-timeline { background: var(--st-panel); border-top: 1px solid var(--st-border); display: flex; flex-direction: column; min-height: 0; position: relative; }
.st-tl-resize { position: absolute; top: -3px; left: 0; right: 0; height: 6px; cursor: ns-resize; z-index: 30; }
.st-tl-resize:hover { background: linear-gradient(transparent, var(--st-accent-soft)); }

.st-tl-toolbar {
  display: flex; align-items: center; gap: 4px; padding: 5px 10px;
  border-bottom: 1px solid var(--st-border-soft); flex-wrap: nowrap; overflow-x: auto;
}
.st-tl-toolbar .st-sep { width: 1px; height: 18px; background: var(--st-border); margin: 0 5px; flex: none; }
.st-tl-toolbar .st-spacer { flex: 1; }
.st-tl-zoom { display: flex; align-items: center; gap: 6px; }
.st-tl-zoom input[type="range"] { width: 110px; }
.st-tl-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--st-muted); white-space: nowrap; }

.st-tl-body { flex: 1; display: grid; grid-template-columns: 128px minmax(0, 1fr); min-height: 0; overflow: hidden; }
.st-track-heads { border-right: 1px solid var(--st-border); overflow: hidden; background: var(--st-panel); z-index: 5; }
.st-ruler-head { height: 26px; border-bottom: 1px solid var(--st-border); display: flex; align-items: center; padding: 0 8px; font-size: 10px; color: var(--st-faint); letter-spacing: .5px; }

.st-track-head {
  display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px;
  border-bottom: 1px solid var(--st-border-soft); height: var(--track-h, 54px);
}
.st-track-head .st-track-kind { width: 7px; height: 26px; border-radius: 3px; flex: none; }
.st-track-head .st-track-label { min-width: 0; flex: 1; }
.st-track-head .st-track-label b { display: block; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-track-head .st-track-label span { font-size: 10px; color: var(--st-faint); }
.st-track-head .st-th-btn { width: 22px; height: 22px; border-radius: 4px; color: var(--st-faint); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.st-track-head .st-th-btn:hover { background: var(--st-panel-3); color: var(--st-text); }
.st-track-head .st-th-btn.off { color: var(--st-accent); }
.st-add-track { margin: 6px; color: var(--st-faint); font-size: 11.5px; padding: 4px 8px; border-radius: 5px; display: block; width: calc(100% - 12px); }
.st-add-track:hover { background: var(--st-panel-3); color: var(--st-text); }

.st-tl-scroll { overflow: auto; position: relative; scrollbar-gutter: stable; }
.st-ruler {
  position: sticky; top: 0; height: 26px; background: var(--st-ruler);
  border-bottom: 1px solid var(--st-border); cursor: pointer; z-index: 4; overflow: hidden;
}
.st-ruler canvas { display: block; height: 26px; }
.st-tracks { position: relative; }

.st-track { border-bottom: 1px solid var(--st-border-soft); height: var(--track-h, 54px); position: relative; }
.st-track.drop-target { background: rgba(210, 0, 0, .05); }
.st-track.drag-over { background: var(--st-accent-soft); }

.st-clip {
  position: absolute; top: 4px; bottom: 4px; border-radius: 6px; overflow: hidden;
  background: var(--st-clip-video); border: 1.5px solid var(--st-clip-video-edge);
  cursor: grab; user-select: none; min-width: 6px;
}
.st-clip.selected { border-color: #fff; box-shadow: 0 0 0 1.5px #fff, 0 4px 14px rgba(0,0,0,.4); z-index: 3; }
.st-clip.kind-audio { background: var(--st-clip-audio); border-color: var(--st-clip-audio-edge); }
.st-clip.kind-text { background: var(--st-clip-text); border-color: var(--st-clip-text-edge); }
.st-clip.kind-image { background: var(--st-clip-image); border-color: var(--st-clip-image-edge); }
.st-clip.locked { cursor: default; }

.st-clip .st-clip-body { position: absolute; inset: 0; display: flex; flex-direction: column; }
.st-clip .st-clip-thumb {
  flex: 1; background-repeat: repeat-x; background-size: auto 100%;
  opacity: .85; pointer-events: none;
}
.st-clip .st-clip-wave { position: absolute; inset: 0; pointer-events: none; }
.st-clip .st-clip-wave canvas { width: 100%; height: 100%; display: block; }
.st-clip .st-clip-label {
  position: absolute; top: 0; left: 0; right: 0; padding: 2px 6px; font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,.92); background: linear-gradient(rgba(0,0,0,.42), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.st-clip.kind-text .st-clip-label, .st-clip.kind-image .st-clip-label { background: none; }

.st-clip .st-clip-handle {
  position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; z-index: 2;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .1s;
}
.st-clip .st-clip-handle::after { content: ""; width: 3px; height: 40%; border-radius: 2px; background: #fff; }
.st-clip:hover .st-clip-handle { opacity: .9; }
.st-clip .st-clip-handle.l { left: 0; }
.st-clip .st-clip-handle.r { right: 0; }
.st-clip.muted-audio .st-clip-label::after { content: " · muted"; opacity: .8; }

.st-playhead { position: absolute; top: 0; bottom: 0; width: 0; z-index: 6; pointer-events: none; }
.st-playhead::before { content: ""; position: absolute; top: 0; left: -5.5px; width: 11px; height: 16px; background: #fff; border-radius: 3px; clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%); }
.st-playhead::after { content: ""; position: absolute; top: 0; bottom: 0; left: -.5px; width: 1.5px; background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.5); }

.st-tl-empty { position: absolute; inset: 26px 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--st-faint); font-size: 12px; pointer-events: none; }

/* export modal */
.st-modal-backdrop {
  position: fixed; inset: 0; background: rgba(8,8,10,.72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.st-modal {
  width: 440px; max-width: 100%; background: var(--st-panel-2); border: 1px solid var(--st-border);
  border-radius: 12px; box-shadow: 0 24px 80px rgba(0,0,0,.6); overflow: hidden;
}
.st-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--st-border-soft); }
.st-modal-head h3 { margin: 0; font-size: 14px; }
.st-modal-body { padding: 16px; }
.st-modal-body .st-progress-track { height: 6px; border-radius: 3px; background: var(--st-panel-3); overflow: hidden; margin: 12px 0 8px; }
.st-modal-body .st-progress-fill { height: 100%; background: var(--st-accent); width: 0%; transition: width .3s; }
.st-modal-body .st-export-status { text-align: center; color: var(--st-muted); font-size: 12.5px; }
.st-modal-body .st-export-done { text-align: center; }
.st-modal-body .st-export-done .st-done-icon { width: 46px; height: 46px; margin: 4px auto 10px; border-radius: 50%; background: #2e7d5b; display: flex; align-items: center; justify-content: center; color: #fff; }
.st-download-btn {
  display: inline-flex; align-items: center; gap: 8px; background: var(--st-accent); color: #fff;
  font-weight: 600; padding: 9px 22px; border-radius: var(--st-radius-sm); margin-top: 10px;
}
.st-download-btn:hover { background: #e60f0f; }
.st-modal-actions { display: flex; justify-content: center; gap: 8px; padding: 0 16px 16px; }
.st-ghost-btn { padding: 8px 16px; border-radius: var(--st-radius-sm); color: var(--st-muted); }
.st-ghost-btn:hover { background: var(--st-panel-3); color: var(--st-text); }
.st-history-list { margin-top: 14px; }
.st-history-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--st-radius-sm);
  background: var(--st-bg); margin-bottom: 6px; font-size: 12px;
}
.st-history-item .st-h-status { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--st-faint); }
.st-history-item.completed .st-h-status { background: #57a773; }
.st-history-item.failed .st-h-status { background: var(--st-accent); }
.st-history-item .st-h-meta { flex: 1; min-width: 0; }
.st-history-item .st-h-meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-history-item .st-h-meta span { color: var(--st-faint); font-size: 11px; }
.st-history-item .st-h-dl { color: var(--st-accent); font-weight: 600; flex: none; }
.st-history-item .st-h-dl:hover { text-decoration: underline; }

/* recorder overlay */
.st-rec-overlay {
  position: absolute; inset: 0; background: rgba(10,10,12,.9); z-index: 20;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; padding: 20px;
}
.st-rec-overlay video { max-width: min(720px, 90%); max-height: 60%; border-radius: 8px; background: #000; }
.st-rec-timer { font-variant-numeric: tabular-nums; font-size: 18px; color: #fff; }
.st-rec-timer.live { color: var(--st-accent); }
.st-rec-actions { display: flex; gap: 10px; }

/* toast */
.st-toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; }
.st-toast {
  background: #26262c; color: var(--st-text); border: 1px solid var(--st-border);
  padding: 9px 16px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 8px 30px rgba(0,0,0,.5);
  animation: st-toast-in .18s ease-out; max-width: 420px;
}
.st-toast.error { border-color: var(--st-accent); }
@keyframes st-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* scrollbars */
.studio ::-webkit-scrollbar { width: 9px; height: 9px; }
.studio ::-webkit-scrollbar-track { background: transparent; }
.studio ::-webkit-scrollbar-thumb { background: #3a3a41; border-radius: 5px; border: 2px solid var(--st-panel); }
.studio ::-webkit-scrollbar-thumb:hover { background: #4a4a52; }
.studio ::-webkit-scrollbar-corner { background: transparent; }

/* responsive */
.st-panel-toggle { display: none; }
@media (max-width: 1180px) {
  .st-main { grid-template-columns: 230px minmax(0, 1fr) 262px; }
}
@media (max-width: 980px) {
  .st-main { grid-template-columns: minmax(0, 1fr); }
  .st-media, .st-inspector { position: absolute; top: 48px; bottom: var(--tl-height, 264px); width: min(320px, 86vw); z-index: 25; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
  .st-media { left: 0; }
  .st-inspector { right: 0; }
  .st-media.collapsed-mobile, .st-inspector.collapsed-mobile { display: none; }
  .st-panel-toggle {
    display: inline-flex; position: absolute; top: 50%; z-index: 26; width: 22px; height: 52px;
    align-items: center; justify-content: center; color: var(--st-muted);
    background: var(--st-panel-2); border: 1px solid var(--st-border);
  }
  .st-media .st-panel-toggle { right: -22px; transform: translateY(-50%); border-left: 0; border-radius: 0 6px 6px 0; }
  .st-inspector .st-panel-toggle { left: -22px; transform: translateY(-50%); border-right: 0; border-radius: 6px 0 0 6px; }
  .st-brand .st-brand-name { display: none; }
  .st-tool-badge { display: none; }
}
@media (max-width: 640px) {
  .studio { grid-template-rows: 44px minmax(0, 1fr) var(--tl-height, 220px); }
  .st-name-input { width: 110px; }
  .st-projects-btn span { display: none; }
  .st-tl-body { grid-template-columns: 92px minmax(0, 1fr); }
}
