/* ============================================================
   ClipCut Editor — light theme, matching the VidLab tool pages
   (same palette as ../style.css: Outfit + JetBrains Mono,
   magenta #FF006E video accent, soft surfaces on #F7F7FB)
   ============================================================ */
:root {
  --bg: #F7F7FB;
  --surface: #FFFFFF;
  --surface2: #F1F1F8;
  --cyan: #0090C8;
  --magenta: #FF006E;
  --violet: #7C3AED;
  --amber: #D98A00;
  --text: #14141F;
  --muted: rgba(20,20,31,0.55);
  --dim: rgba(20,20,31,0.38);
  --border: rgba(20,20,31,0.10);
  --border-bright: rgba(20,20,31,0.22);
  --success: #00A278;
  --error: #E03131;
  /* darker variants for small text: the vivid accents above are for fills,
     borders and buttons, but fall under 4.5:1 as 10px type on white */
  --magenta-text: #D1005B;
  --cyan-text: #00709C;
  --amber-text: #8A5A00;
  --r-sm: 6px; --r-md: 10px; --r-lg: 12px;
  --mono: 'JetBrains Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============ TOP BAR ============ */
.topbar {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.logo {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.5px;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.logo b { color: var(--magenta); }
.logo-mark {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--magenta), #b0004d);
  color: #fff;
  border-radius: 6px;
  font-size: 10px;
}
.logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 9999px;
}

.project-name {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 5px 10px;
  min-width: 160px;
  outline: none;
  transition: border-color 200ms ease;
}
.project-name:hover, .project-name:focus { border-color: var(--border-bright); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* autosave indicator — quiet until it actually saves */
.save-state {
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--success);
  opacity: 0;
  transition: opacity 250ms ease;
  pointer-events: none;
}
.save-state.on { opacity: 1; }

/* restore-last-project prompt */
.restore-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: 14px;
  box-shadow: 0 18px 44px rgba(20,20,31,0.24);
  opacity: 0;
  transition: opacity 250ms ease, transform 250ms ease;
  max-width: min(620px, 92vw);
}
.restore-bar.show { opacity: 1; transform: translate(-50%, 0); }
.rb-text { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.rb-meta { font-size: 9.5px; letter-spacing: 1px; color: var(--dim); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.aspect-label { font-size: 10px; letter-spacing: 2px; color: var(--dim); }

.select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 8px;
  font-size: 13px;
  outline: none;
}
.select:hover { border-color: var(--border-bright); }

.btn {
  border: none;
  border-radius: var(--r-md);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
}
.btn-primary {
  background: var(--magenta);
  color: #fff;
  box-shadow: 0 6px 18px rgba(255,0,110,0.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(255,0,110,0.3); }
.btn-ghost {
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-bright); }

/* ============ WORKSPACE ============ */
.workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-left { width: 264px; flex: 0 0 264px; }
.panel-right {
  width: 296px; flex: 0 0 296px;
  border-right: none;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.panel-tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: var(--surface2);
}
.ptab {
  flex: 0 0 20%;
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  padding: 8px 0 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-bottom: 2px solid transparent;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.pt-ico { font-size: 15px; line-height: 1; }
.ptab:hover { color: var(--text); background: rgba(255,0,110,0.05); }
.ptab.active { color: var(--magenta-text); border-bottom-color: var(--magenta); background: var(--surface); }

/* galleries for stickers / effects / transitions / filters */
.sticker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.sticker {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}
.sticker:hover { transform: translateY(-2px) scale(1.06); border-color: rgba(255,0,110,0.45); }

.fx-grid, .filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fx-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  background: var(--surface2);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.fx-card:hover { transform: translateY(-2px); border-color: rgba(255,0,110,0.45); box-shadow: 0 8px 20px rgba(255,0,110,0.12); }
.fx-card.on { border-color: var(--magenta); box-shadow: 0 0 0 1px var(--magenta); }
.fx-prev { height: 46px; display: grid; place-items: center; font-size: 17px; color: #fff; }
.fx-name {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 5px 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* drag-to-resize handles */
.resizer { flex: 0 0 5px; position: relative; z-index: 25; }
.resizer-v { cursor: col-resize; }
.resizer-h { cursor: row-resize; height: 5px; flex: 0 0 5px; width: 100%; }
.resizer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 150ms ease;
}
.resizer:hover::after, .resizer.active::after { background: rgba(255,0,110,0.45); }

/* timeline drop target */
.tl-track.drop-hint {
  background: rgba(255,0,110,0.10);
  box-shadow: inset 0 0 0 1.5px rgba(255,0,110,0.55);
}

.ptab-page { flex: 1; overflow-y: auto; padding: 14px; }
.panel-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; margin-bottom: 12px; }

/* Dropzone */
.dropzone {
  border: 1.5px dashed rgba(255,0,110,0.35);
  border-radius: var(--r-lg);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease;
  background: rgba(255,0,110,0.035);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--magenta);
  background: rgba(255,0,110,0.07);
}
/* once media exists the import box shrinks to a strip, giving the
   library the space instead of repeating the big empty prompt */
.dropzone.compact { padding: 9px 12px; display: flex; align-items: center; gap: 10px; text-align: left; }
.dropzone.compact .dz-icon { font-size: 15px; margin: 0; }
.dropzone.compact .dz-title { font-size: 12.5px; }
.dropzone.compact .dz-sub, .dropzone.compact .dz-formats { display: none; }
.dz-icon { font-size: 26px; margin-bottom: 6px; }
.dz-title { font-weight: 700; font-size: 15px; }
.dz-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.dz-formats {
  margin-top: 10px;
  font-size: 9.5px;
  letter-spacing: 1px;
  color: var(--dim);
}

/* Media grid */
.media-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.media-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  position: relative;
}
.media-item:hover {
  transform: translateY(-2px);
  border-color: rgba(255,0,110,0.4);
  box-shadow: 0 8px 22px rgba(255,0,110,0.14);
}
.media-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
  background: #E4E4EF;
}
.media-thumb-audio {
  width: 100%;
  aspect-ratio: 16/10;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: linear-gradient(135deg, rgba(0,144,200,0.16), rgba(255,0,110,0.16));
}
.media-name {
  font-size: 11px;
  padding: 6px 8px 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.media-dur {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--dim);
  padding: 0 8px 7px;
}
.media-add {
  position: absolute;
  top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--magenta);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 200ms ease;
}
.media-item:hover .media-add { opacity: 1; }
.media-del {
  position: absolute;
  top: 6px; left: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.94);
  color: var(--error);
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  opacity: 0;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.media-item:hover .media-del { opacity: 1; }
.media-del:hover { background: var(--error); color: #fff; border-color: var(--error); }

/* Templates */
.tpl-grid { display: flex; flex-direction: column; gap: 10px; }
.tpl-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.tpl-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,0,110,0.4);
  box-shadow: 0 8px 22px rgba(255,0,110,0.14);
}
.tpl-prev {
  height: 58px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 8px;
}
.tpl-name { font-weight: 600; font-size: 13px; }
.tpl-meta { font-family: var(--mono); font-size: 10px; color: var(--dim); margin-top: 2px; letter-spacing: 0.5px; }

/* Text presets */
.text-presets { display: flex; flex-direction: column; gap: 10px; }
.text-preset {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  overflow: hidden;
}
.text-preset:hover {
  transform: translateY(-2px);
  border-color: rgba(0,144,200,0.45);
  box-shadow: 0 8px 22px rgba(0,144,200,0.14);
}
.tp-sample { font-size: 19px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-name {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 6px;
  display: block;
}

/* Motion graphics presets */
.gfx-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.gfx-preset {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 8px 10px;
  text-align: center;
  cursor: pointer;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.gfx-preset:hover {
  transform: translateY(-2px);
  border-color: rgba(124,58,237,0.5);
  box-shadow: 0 8px 22px rgba(124,58,237,0.16);
}
.gp-icon { font-size: 22px; display: block; }
.gp-name {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 7px;
  display: block;
}

/* Human FX status */
.seg-status {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--amber-text);
}
.seg-status.ready { color: #007A5A; }

/* ============ STAGE ============ */
.stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(0,144,200,0.07), transparent 55%),
    radial-gradient(ellipse at 80% 100%, rgba(255,0,110,0.07), transparent 55%),
    var(--bg);
}

/* flex (not grid) centring on purpose: a grid row is auto-sized, so the
   canvas's max-height:100% could not resolve and it overflowed the stage,
   covering the transport controls. A flex container has a definite cross
   size, so the percentage resolves and the canvas letterboxes correctly at
   every aspect ratio. */
.preview-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
#preview {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--r-md);
  background: #111118;
  box-shadow: 0 0 0 1px var(--border), 0 18px 44px rgba(20,20,31,0.18);
  cursor: default;
}
#preview.text-hover { cursor: move; }

.transport {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 16px 14px;
}
.tbtn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  display: grid;
  place-items: center;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.tbtn:hover { border-color: var(--border-bright); transform: translateY(-1px); }
.tbtn-play {
  width: 44px; height: 44px;
  background: var(--magenta);
  color: #fff;
  border: none;
  font-size: 16px;
  box-shadow: 0 6px 18px rgba(255,0,110,0.28);
}
.timecode {
  margin-left: 12px;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tc-sep, #tcTotal { color: var(--dim); }

/* ============ INSPECTOR ============ */
.inspector-empty {
  padding: 32px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}
.ie-icon { font-size: 24px; color: var(--magenta); margin-bottom: 10px; }
.inspector-empty b { color: var(--text); }

.insp-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.insp-kind {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--magenta-text);
}
.insp-kind.text-kind { color: var(--cyan-text); }
.insp-kind.audio-kind { color: var(--amber-text); }
.insp-title {
  font-weight: 700;
  font-size: 15px;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.insp-tabs { display: flex; border-bottom: 1px solid var(--border); }
.insp-tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 10px 0;
  transition: color 200ms ease;
}
.insp-tab:hover { color: var(--text); }
.insp-tab.active { color: var(--magenta-text); border-bottom-color: var(--magenta); }

.insp-body { padding: 14px 16px 28px; display: flex; flex-direction: column; gap: 14px; }

.ctl-row { display: flex; flex-direction: column; gap: 5px; }
.ctl-label {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
}
.ctl-value { color: var(--magenta-text); }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #E2E2EE;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 2px 6px rgba(255,0,110,0.4);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--magenta);
  cursor: pointer;
}

.chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 9999px;
  padding: 6px 12px;
  font-size: 12px;
  transition: color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.chip:hover { color: var(--text); border-color: var(--border-bright); }
.chip.active {
  color: var(--magenta-text);
  background: rgba(255,0,110,0.08);
  border-color: rgba(255,0,110,0.5);
}
.chip.active-cyan {
  color: var(--cyan-text);
  background: rgba(0,144,200,0.08);
  border-color: rgba(0,144,200,0.5);
}

.insp-input, .insp-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13.5px;
  padding: 8px 10px;
  outline: none;
  transition: border-color 200ms ease;
}
.insp-input:focus, .insp-textarea:focus { border-color: rgba(255,0,110,0.5); }
.insp-textarea { resize: vertical; min-height: 56px; font-family: inherit; }

.color-row { display: flex; gap: 8px; align-items: center; }
input[type="color"] {
  width: 34px; height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 2px;
  cursor: pointer;
}

.reset-link {
  background: none;
  border: none;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  align-self: flex-end;
  text-decoration: underline;
}
.reset-link:hover { color: var(--text); }

.insp-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}

/* ============ TIMELINE ============ */
.timeline-area {
  flex: 0 0 auto;
  height: 286px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.tl-toolbar {
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.tlbtn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: var(--r-sm);
  padding: 5px 12px;
  font-size: 12.5px;
  transition: color 200ms ease, border-color 200ms ease;
}
.tlbtn:hover { color: var(--text); border-color: var(--border-bright); }
.tlbtn:disabled { opacity: 0.4; cursor: default; }
.tlbtn:disabled:hover { color: var(--muted); border-color: var(--border); }
.tl-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.tlbtn-danger:hover { color: var(--error); border-color: rgba(224,49,49,0.45); }
.tl-spacer { flex: 1; }
.tl-zoom-label { font-size: 9.5px; letter-spacing: 2px; color: var(--dim); }
.zoom-slider { width: 130px; }

.tl-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}
.tl-inner {
  position: relative;
  min-width: 100%;
  height: 100%;
  padding-left: 34px;
}

.tl-ruler {
  display: block;
  height: 26px;
  cursor: pointer;
}

.tl-track {
  position: relative;
  height: 44px;
  margin-top: 6px;
  background: rgba(20,20,31,0.04);
  border-radius: var(--r-sm);
}
.tl-track-video { height: 52px; }
.track-tag {
  position: absolute;
  left: -26px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--dim);
  width: 18px;
  text-align: center;
}

.tl-clip {
  position: absolute;
  top: 3px;
  bottom: 3px;
  border-radius: var(--r-sm);
  overflow: hidden;
  cursor: grab;
  border: 1px solid rgba(20,20,31,0.10);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: box-shadow 150ms ease;
}
.tl-clip:active { cursor: grabbing; }
.tl-clip .clip-label { overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 2; text-shadow: 0 1px 2px rgba(0,0,0,0.35); }

/* darker than the UI accents on purpose: white 11.5px labels sit on these,
   so each needs >4.5:1 contrast */
.clip-video { background: linear-gradient(180deg, #D4005C, #9E0046); }
.clip-image { background: linear-gradient(180deg, #9E6100, #7A4B00); }
.clip-text  { background: linear-gradient(180deg, #0080B0, #005E85); }
.clip-gfx   { background: linear-gradient(180deg, #7C3AED, #5B22B8); }
.clip-audio { background: linear-gradient(180deg, #008C66, #006B4E); }

.tl-clip.selected {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--text), 0 6px 16px rgba(20,20,31,0.22);
  z-index: 5;
}
.tl-clip.dragging { opacity: 0.75; z-index: 8; }

.trim-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 9px;
  z-index: 3;
  display: none;
}
.tl-clip.selected .trim-handle { display: block; cursor: ew-resize; }
.trim-handle::after {
  content: '';
  position: absolute;
  top: 25%; bottom: 25%;
  left: 3px;
  width: 3px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(20,20,31,0.25);
}
.trim-l { left: 0; }
.trim-r { right: 0; }

.trans-badge {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) rotate(45deg);
  width: 14px; height: 14px;
  background: var(--surface);
  border: 1.5px solid var(--magenta);
  border-radius: 3px;
  z-index: 6;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(255,0,110,0.3);
}
.trans-badge.none { border-color: var(--border-bright); box-shadow: none; opacity: 0.6; }
.trans-badge:hover { transform: translate(-50%, -50%) rotate(45deg) scale(1.2); }

.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--magenta);
  box-shadow: 0 0 6px rgba(255,0,110,0.5);
  z-index: 10;
  pointer-events: none;
}
.playhead-cap {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 14px;
  background: var(--magenta);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
}

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20,20,31,0.35);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal {
  width: min(440px, 90vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(20,20,31,0.25);
}
.modal h3 { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.modal-sub { color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.5; }
.progress-track {
  height: 4px;
  background: #E2E2EE;
  border-radius: 2px;
  margin: 22px 0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--magenta));
  border-radius: 2px;
  transition: width 200ms ease;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.modal-credit {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--dim);
}

/* Scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(20,20,31,0.18); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,20,31,0.3); }

/* Small screens */
@media (max-width: 980px) {
  .panel-left { width: 210px; flex-basis: 210px; }
  .panel-right { width: 240px; flex-basis: 240px; }
}
