/* Auto Caption Generator */
.ac2-wrap { max-width: 1180px; }

/* ── setup ─────────────────────────────────── */
.ac2-setup { padding: 22px; }
.ac2-options {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px; margin-bottom: 18px;
}
.ac2-label { margin: 0; font-size: .85rem; font-weight: 600; color: var(--muted); }
.ac2-seg {
  display: flex; padding: 3px; gap: 3px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px;
}
.ac2-seg-btn {
  flex: 1 1 0; min-width: 0; padding: 9px 8px;
  font: inherit; font-size: .88rem; font-weight: 600; color: var(--muted);
  background: none; border: 0; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.ac2-seg-btn:hover { color: var(--text); }
.ac2-seg-btn.is-on { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 2px 8px -4px rgba(0,0,0,.6); }
.ac2-seg-btn:disabled { opacity: .4; cursor: not-allowed; }
.ac2-hint { margin: 6px 0 0; font-size: .78rem; color: var(--muted-2); line-height: 1.45; }
.ac2-drop { padding: 34px 20px; }
.ac2-privacy { margin-top: 14px; }

/* ── working ───────────────────────────────── */
.ac2-work { padding: 22px; }
.ac2-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.ac2-file { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ac2-file b { font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac2-file small { font-size: .8rem; color: var(--muted-2); }
.ac2-phase { margin: 0 0 10px; font-size: .92rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ── editor ────────────────────────────────── */
.ac2-editor {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px; align-items: start;
}
.ac2-stage-card { padding: 16px; }
.ac2-stage { position: relative; display: flex; justify-content: center; background: #000; border-radius: var(--radius-sm); overflow: hidden; }
.ac2-stage video { display: block; max-width: 100%; max-height: 64vh; }
/* Drawn by the same function as the export, so the preview is the export. It ignores the
   pointer so the video's own controls stay usable underneath. */
.ac2-overlay { position: absolute; pointer-events: none; }
.ac2-export { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ac2-export .btn-primary { flex: 1 1 220px; }
.ac2-exportbox { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ac2-small { margin-top: 10px; padding: 7px 12px; min-height: 36px; font-size: .82rem; }
.ac2-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.ac2-result video { display: block; width: 100%; max-height: 56vh; border-radius: var(--radius-sm); background: #000; }
.ac2-result-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.ac2-meta { font-size: .84rem; color: var(--muted); }

.ac2-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ac2-style-card, .ac2-cues-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.ac2-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ac2-style {
  display: grid; place-items: center; height: 64px; padding: 6px;
  font: inherit; color: #fff; background: #1a1f38; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: border-color .15s, transform .15s;
  text-align: center; line-height: 1.15;
}
.ac2-style:hover { border-color: var(--muted-2); }
.ac2-style.is-on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.ac2-style small { display: block; margin-top: 3px; font: 600 .68rem/1 Inter, system-ui, sans-serif; color: var(--muted-2); letter-spacing: .02em; text-transform: none; }
.ac2-style[data-s="subtitles"] span { font: 600 .82rem Inter, sans-serif; background: rgba(0,0,0,.75); padding: 2px 6px; border-radius: 3px; }
.ac2-style[data-s="bold"] span { font: 900 1rem Inter, sans-serif; text-transform: uppercase; -webkit-text-stroke: .6px #000; paint-order: stroke fill; text-shadow: 0 2px 0 #000; }
.ac2-style[data-s="karaoke"] span { font: 800 .92rem Inter, sans-serif; text-shadow: 0 2px 0 #000; }
.ac2-style[data-s="karaoke"] span i { font-style: normal; color: #ffd60a; }
.ac2-style[data-s="minimal"] span { font: 600 .84rem Inter, sans-serif; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.ac2-grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ac2-grid2 input[type=range] { width: 100%; accent-color: var(--accent); }
.ac2-grid2 input[type=color] { width: 100%; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); cursor: pointer; }
.ac2-val { font-weight: 500; color: var(--muted-2); font-size: .8rem; }
.ac2-check { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); cursor: pointer; }
.ac2-check input { accent-color: var(--accent); width: 16px; height: 16px; }

.ac2-cues-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ac2-cues { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; margin-right: -6px; padding-right: 6px; }
.ac2-cue {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) 28px; gap: 8px; align-items: start;
  padding: 7px 8px; border-radius: 9px; border: 1px solid transparent; background: var(--bg-soft);
}
.ac2-cue.is-now { border-color: color-mix(in srgb, var(--accent-2) 60%, transparent); }
.ac2-cue-t {
  padding: 5px 0; font: 600 .76rem/1.3 Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums;
  color: var(--accent); background: none; border: 0; cursor: pointer; text-align: left;
}
.ac2-cue-text {
  width: 100%; min-height: 32px; resize: none; overflow: hidden;
  padding: 5px 7px; font: inherit; font-size: .88rem; line-height: 1.4; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 6px;
}
.ac2-cue-text:hover { border-color: var(--line); }
.ac2-cue-text:focus { outline: none; border-color: var(--accent); background: var(--card-2); }
.ac2-cue-x {
  width: 28px; height: 28px; display: grid; place-items: center; margin-top: 2px;
  font-size: 1rem; line-height: 1; color: var(--muted-2); background: none; border: 0; border-radius: 6px; cursor: pointer;
}
.ac2-cue-x:hover { color: var(--danger, #ff6b8a); background: rgba(255,107,138,.1); }

@media (max-width: 980px) {
  .ac2-editor { grid-template-columns: minmax(0, 1fr); }
  .ac2-styles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ac2-options { grid-template-columns: minmax(0, 1fr); }
  .ac2-setup, .ac2-work { padding: 16px; }
  .ac2-stage-card, .ac2-style-card, .ac2-cues-card { padding: 12px; }
  .ac2-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Main action on its own row, the three small ones evenly beneath it — plain flex-wrap
     left them in ragged pairs at phone width. */
  .ac2-export { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ac2-export .btn-primary { grid-column: 1 / -1; }
  .ac2-stage video { max-height: 58vh; }
}
@media (pointer: coarse) { .ac2-seg-btn { min-height: 42px; } .ac2-cue-x { width: 36px; height: 36px; } .ac2-cue { grid-template-columns: 52px minmax(0, 1fr) 36px; } }
