/* Auto subtitles — editor layout */

.sub-shell{
  display:grid;
  grid-template-columns:minmax(0,1fr) 340px;
  border-top:1px solid var(--rule);
}
@media (max-width:940px){ .sub-shell{grid-template-columns:1fr;} }

/* ---------- stage ---------- */

.sub-stage{
  background:#0b0d0c;
  display:flex;flex-direction:column;align-items:center;
  padding:18px 18px 0;gap:12px;min-height:340px;
}
.sub-stage .timeline-wrap{
  width:100%;margin:6px -18px 0;padding-left:18px;padding-right:18px;
  border-top:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
}
.sub-stage .tl-head{color:rgba(255,255,255,.55);}
.sub-stage .tl-head .hint{color:rgba(255,255,255,.4);}
.stage-frame{
  position:relative;line-height:0;
  max-width:100%;border-radius:6px;overflow:hidden;
  background:#000;
}
.stage-frame video{display:block;max-width:100%;max-height:52vh;height:auto;}
.stage-frame canvas{
  position:absolute;inset:0;width:100%;height:100%;pointer-events:none;
}

.transport{
  display:flex;align-items:center;gap:12px;width:100%;max-width:640px;
  color:#cfd4d1;font-family:var(--f-mono);font-size:.78rem;
}
.play-btn{
  width:38px;height:38px;flex-shrink:0;border-radius:50%;
  border:none;background:var(--accent);color:var(--accent-ink);
  cursor:pointer;display:grid;place-items:center;
}
.play-btn svg{width:16px;height:16px;}
.scrub{flex:1;accent-color:var(--accent);}
.tc{font-variant-numeric:tabular-nums;white-space:nowrap;}

/* ---------- side panel ---------- */

.sub-side{
  border-left:1px solid var(--rule);
  display:flex;flex-direction:column;min-height:0;
}
@media (max-width:940px){ .sub-side{border-left:none;border-top:1px solid var(--rule);} }

.tabs{display:flex;border-bottom:1px solid var(--rule);flex-shrink:0;}
.tabs button{
  flex:1;background:none;border:none;cursor:pointer;
  font-family:var(--f-ui);font-size:.87rem;font-weight:500;
  color:var(--ink-3);padding:13px 8px;
  border-bottom:2px solid transparent;margin-bottom:-1px;
}
.tabs button:hover{color:var(--ink);}
.tabs button[aria-selected="true"]{color:var(--accent);border-bottom-color:var(--accent);font-weight:600;}

.tab-body{padding:16px 18px;overflow-y:auto;max-height:56vh;}
@media (max-width:940px){ .tab-body{max-height:none;} }
.tab-body[hidden]{display:none;}

/* ---------- cue list ---------- */

.cue{
  border:1px solid var(--rule);border-radius:var(--radius-sm);
  padding:9px 11px;margin-bottom:8px;background:var(--surface);
  cursor:pointer;transition:border-color .12s,background .12s;
}
.cue:hover{border-color:var(--rule-2);}
.cue.active{border-color:var(--accent);background:var(--accent-soft);}
.cue-top{
  display:flex;align-items:center;gap:8px;margin-bottom:5px;
  font-family:var(--f-mono);font-size:.68rem;color:var(--ink-3);
}
.cue-top .sp{margin-left:auto;}
.cue-del{
  background:none;border:none;color:var(--ink-3);cursor:pointer;
  padding:0 2px;font-size:14px;line-height:1;
}
.cue-del:hover{color:var(--error);}
.cue textarea{
  width:100%;border:none;background:transparent;color:var(--ink);
  font-family:var(--f-ui);font-size:.9rem;line-height:1.4;
  resize:none;padding:0;overflow:hidden;
}
.cue textarea:focus{outline:none;}
.cue-hint{
  font-size:.78rem;color:var(--ink-3);margin:0 0 12px;line-height:1.45;
}

/* ---------- style controls ---------- */

.ctl{margin-bottom:15px;}
.ctl > label,.ctl-label{
  display:block;font-size:.73rem;font-weight:600;letter-spacing:.05em;
  text-transform:uppercase;color:var(--ink-3);margin-bottom:6px;
}
.ctl-row{display:flex;gap:8px;align-items:center;}
.ctl-row input[type="range"]{flex:1;accent-color:var(--accent);}
.ctl-val{
  font-family:var(--f-mono);font-size:.75rem;color:var(--ink-2);
  min-width:38px;text-align:right;font-variant-numeric:tabular-nums;
}
.swatch-row{display:flex;gap:6px;flex-wrap:wrap;}
.sw{
  width:26px;height:26px;border-radius:5px;cursor:pointer;padding:0;
  border:2px solid var(--rule-2);
}
.sw[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft);}
.sw.custom{
  display:grid;place-items:center;background:var(--surface-2);
  color:var(--ink-3);font-size:13px;line-height:1;
}
.chip-row{display:flex;gap:6px;flex-wrap:wrap;}
.chip-btn{
  border:1px solid var(--rule-2);background:var(--surface);
  border-radius:100px;padding:5px 12px;cursor:pointer;
  font-family:var(--f-ui);font-size:.8rem;color:var(--ink-2);
}
.chip-btn:hover{border-color:var(--accent);color:var(--ink);}
.chip-btn[aria-pressed="true"]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:600;}

.preset-row{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin-bottom:16px;}
.preset{
  border:1px solid var(--rule-2);border-radius:var(--radius-sm);
  background:#111;cursor:pointer;padding:14px 8px;text-align:center;
  overflow:hidden;
}
.preset:hover{border-color:var(--accent);}
.preset[aria-pressed="true"]{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-soft);}
.preset span{display:inline-block;font-size:13px;line-height:1.1;}

/* ---------- progress / export ---------- */

.sub-actions{
  border-top:1px solid var(--rule);padding:14px 18px;
  display:flex;flex-direction:column;gap:8px;flex-shrink:0;
}
.sub-actions .btn{justify-content:center;}
.export-row{display:grid;grid-template-columns:1fr 1fr;gap:8px;}

.model-note{
  font-size:.76rem;color:var(--ink-3);line-height:1.45;margin:0;
}

/* volume — the transport is custom, so the element has no native controls */
.vol{display:flex;align-items:center;gap:6px;flex-shrink:0;}
.vol-btn{
  width:30px;height:30px;flex-shrink:0;padding:0;
  background:transparent;border:none;cursor:pointer;color:#cfd4d1;
  display:grid;place-items:center;border-radius:var(--radius-sm);
}
.vol-btn:hover{background:rgba(255,255,255,.09);color:#fff;}
.vol-btn svg{width:17px;height:17px;display:block;}
.vol-btn .i-off{display:none;}
.vol-btn[aria-pressed="true"] .i-on{display:none;}
.vol-btn[aria-pressed="true"] .i-off{display:block;}
.vol-slider{width:76px;accent-color:var(--accent);}
@media (max-width:520px){ .vol-slider{width:52px;} }

/* ---------- timeline ----------
   A vertical list tells you when a caption is; a timeline lets you change it.
   Blocks are dragged to move, edges to trim — the way every video editor does
   it, because that is what people already know. */

.timeline-wrap{
  border-top:1px solid var(--rule);
  background:var(--surface-2);
  padding:10px 14px 14px;
}
.tl-head{
  display:flex;align-items:center;gap:10px;
  font-size:.74rem;letter-spacing:.05em;text-transform:uppercase;
  color:var(--ink-3);font-weight:600;margin-bottom:8px;
}
.tl-head .hint{
  margin-left:auto;text-transform:none;letter-spacing:0;font-weight:400;
  font-size:.76rem;color:var(--ink-3);
}

.timeline{
  position:relative;
  height:76px;
  background:var(--surface);
  border:1px solid var(--rule);
  border-radius:var(--radius-sm);
  overflow:hidden;
  user-select:none;
  touch-action:pan-y;
}
.tl-ruler{
  position:absolute;inset:0 0 auto 0;height:18px;
  border-bottom:1px solid var(--rule);
  background:var(--surface-2);
}
.tl-tick{
  position:absolute;top:0;bottom:0;border-left:1px solid var(--rule-2);
  font-family:var(--f-mono);font-size:.62rem;color:var(--ink-3);
  padding-left:3px;line-height:18px;white-space:nowrap;
}
.tl-track{position:absolute;left:0;right:0;top:18px;bottom:0;}

.tl-cue{
  position:absolute;top:8px;height:40px;
  background:var(--accent-soft);
  border:1.5px solid var(--accent);
  border-radius:4px;
  cursor:grab;
  overflow:hidden;
  min-width:10px;
  display:flex;align-items:center;
}
.tl-cue:hover{background:var(--accent);}
.tl-cue:hover .tl-label{color:var(--accent-ink);}
.tl-cue.sel{box-shadow:0 0 0 2px var(--accent);background:var(--accent);}
.tl-cue.sel .tl-label{color:var(--accent-ink);}
.tl-cue.dragging{cursor:grabbing;opacity:.85;}
.tl-label{
  font-size:.72rem;color:var(--accent);font-weight:600;
  padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  pointer-events:none;
}
.tl-handle{
  position:absolute;top:0;bottom:0;width:9px;
  cursor:ew-resize;
}
.tl-handle::after{
  content:"";position:absolute;top:50%;left:50%;
  transform:translate(-50%,-50%);
  width:2px;height:16px;border-radius:2px;
  background:var(--accent);opacity:.75;
}
.tl-cue:hover .tl-handle::after,.tl-cue.sel .tl-handle::after{background:var(--accent-ink);}
.tl-handle.l{left:0;}
.tl-handle.r{right:0;}

.tl-playhead{
  position:absolute;top:0;bottom:0;width:2px;
  background:#ff5f56;pointer-events:none;z-index:3;
}
.tl-playhead::before{
  content:"";position:absolute;top:0;left:-4px;
  border-left:5px solid transparent;border-right:5px solid transparent;
  border-top:6px solid #ff5f56;
}

.tl-empty{
  display:grid;place-items:center;height:100%;
  font-size:.82rem;color:var(--ink-3);
}
