/* Caption generator. Builds on the site's /styles.css tokens (--blue, --ink, --radius-*, fonts, .btn, .section).
   Light theme only, like the rest of the site. Layout mirrors the homepage studio: tonal topbar,
   two panes with a #fafbfc secondary pane, 3px colour rails on stat cards. */
.cg {
  --blue: #1a73e8; --blue-hover: #1557b0; --blue-ink: #174ea6; --blue-tint: #e8f0fe;
  --ink: #202124; --ink-secondary: #5f6368; --ink-muted: #80868b;
  --border: #dadce0; --border-subtle: #e8eaed; --surface: #f8f9fa; --surface-alt: #f1f3f4;
  --green: #188038; --green-bright: #34a853; --green-tint: #e6f4ea;
  --amber: #b06000; --amber-tint: #fef7e0; --yellow: #fbbc04; --red: #d93025; --red-tint: #fce8e6;
  --pane: #fafbfc;
  --spk-0: #1a73e8; --spk-1: #188038; --spk-2: #a142f4; --spk-3: #e37400; --spk-4: #12858c; --spk-5: #c5221f;
}
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: #fff; padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.skip:focus { left: 12px; }
.cg :focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }
.cg-muted { color: var(--ink-secondary); margin: 0; }
.cg-fine { color: var(--ink-muted); font-size: 13px; margin: 12px 0 0; line-height: 1.5; }
.cg-nomargin { margin: 0; }
.cg-h { font-family: var(--font-sans); font-size: 17px; font-weight: 700; letter-spacing: -.015em; margin: 0; color: var(--ink); }
.cg-center { text-align: center; max-width: 680px; margin: 0 auto 36px; }
.cg-narrow { max-width: 920px; }
.cg-narrow .section-head { margin-bottom: 28px; }
#tool { scroll-margin-top: 80px; }

/* ---------- hero ---------- */
.cg-hero {
  padding: 40px 0 44px; text-align: center;
  background: radial-gradient(880px 340px at 50% -60px, rgba(26,115,232,.09), transparent 70%),
              radial-gradient(520px 260px at 82% 40px, rgba(52,168,83,.06), transparent 70%), #fff;
}
.cg-crumbs { display: flex; gap: 8px; justify-content: center; font-size: 13px; color: var(--ink-muted); margin-bottom: 20px; }
.cg-crumbs a { color: var(--ink-secondary); }
.cg-crumbs a:hover { color: var(--blue); }
.cg-hero h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.08; font-weight: 700; letter-spacing: -.032em; margin: 18px auto 16px; max-width: 860px; }
.cg-grad { background: linear-gradient(90deg, #1a73e8, #174ea6 65%, #188038); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cg-lede { color: var(--ink-secondary); font-size: 18px; line-height: 1.62; max-width: 700px; margin: 0 auto 24px; }
.cg-proof { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 0; margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink-secondary); }
.cg-proof li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; background: #fff; border: 1px solid var(--border-subtle); border-radius: 999px; box-shadow: var(--shadow-xs); }
.cg-check { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--green-tint); color: var(--green); font-size: 11px; font-weight: 700; }

/* ---------- shell + topbar ---------- */
.cg-tool { margin-top: -8px; margin-bottom: 28px; }
.cg-shell { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg, 20px); box-shadow: var(--shadow-md), 0 1px 2px rgba(60,64,67,.06); overflow: hidden; overflow: clip; }
.cg-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px 12px 14px; background: var(--surface); border-bottom: 1px solid var(--border-subtle); }
.cg-stepper { list-style: none; display: inline-flex; margin: 0; padding: 4px; gap: 3px; background: var(--surface-alt); border-radius: 999px; overflow-x: auto; max-width: 100%; }
.cg-stepper li { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--ink-muted); padding: 5px 14px 5px 5px; border-radius: 999px; white-space: nowrap; transition: background .15s, color .15s; }
.cg-stepper .n { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; background: #fff; border: 1px solid var(--border); font-size: 11.5px; color: var(--ink-secondary); }
.cg-stepper li.active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(60,64,67,.14); }
.cg-stepper li.active .n { background: var(--blue); border-color: var(--blue); color: #fff; }
.cg-stepper li.done { color: var(--green); }
.cg-stepper li.done .n { background: var(--green-tint); border-color: transparent; color: var(--green); font-size: 0; }
.cg-stepper li.done .n::after { content: "✓"; font-size: 11.5px; }
.cg-limits, .cg-filechip { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-secondary); padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--border-subtle); white-space: nowrap; }
.cg-limits .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-bright); box-shadow: 0 0 0 3px var(--green-tint); }
.cg-filechip { color: var(--ink); max-width: min(100%, 420px); }
.cg-filechip svg { color: var(--blue); flex: none; }
.cg-filechip .name { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cg-filechip .dur { font: 500 12px var(--font-mono); color: var(--ink-muted); }
.cg-filechip .dur:empty { display: none; }

/* ---------- step 1: upload (studio two-pane) ---------- */
.cg-upload { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .9fr); }
.cg-upload-main { padding: 26px 28px 24px; display: flex; flex-direction: column; }
.cg-upload-main > * { flex: none; }
.cg-upload-main > .cg-drop { flex: 1 0 auto; justify-content: center; min-height: 280px; }
.cg-upload-preview { padding: 24px 26px 26px; background: var(--pane); border-left: 1px solid var(--border-subtle); }
.cg-drop { position: relative; border: 1.5px dashed #c6dafc; border-radius: var(--radius-md, 14px); padding: 46px 22px 40px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; transition: border-color .15s, background .15s, box-shadow .15s;
  background: radial-gradient(420px 160px at 50% 0, rgba(26,115,232,.07), transparent 75%), linear-gradient(180deg, #f8fbff 0%, #fff 70%); }
.cg-drop:hover, .cg-drop.drag { border-color: var(--blue); border-style: solid; background: radial-gradient(420px 160px at 50% 0, rgba(26,115,232,.12), transparent 75%), #f8fbff; box-shadow: 0 0 0 4px var(--blue-tint); }
.cg-drop:hover .btn-primary { background: var(--blue-hover); }
.cg-drop-title { font-family: var(--font-sans); font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 0; color: var(--ink); }
.cg-drop .btn { margin-top: 14px; }
.cg-wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 48px; }
.cg-wave i { display: block; width: 6px; border-radius: 3px; background: #aecbfa; height: 30%; }
.cg-wave i:nth-child(1) { height: 36%; background: var(--blue); }
.cg-wave i:nth-child(2) { height: 80%; background: var(--blue); }
.cg-wave i:nth-child(3) { height: 56%; background: var(--green-bright); }
.cg-wave i:nth-child(4) { height: 28%; background: var(--yellow); }
.cg-wave i:nth-child(5) { height: 64%; background: var(--blue); }
.cg-wave i:nth-child(6) { height: 44%; background: #aecbfa; }
.cg-wave i:nth-child(7) { height: 22%; background: #aecbfa; }
.cg-drop:hover .cg-wave i, .cg-wave-live i { animation: cg-bar 1.1s ease-in-out infinite; transform-origin: center; }
.cg-drop:hover .cg-wave i:nth-child(2), .cg-wave-live i:nth-child(2) { animation-delay: -.15s; }
.cg-drop:hover .cg-wave i:nth-child(3), .cg-wave-live i:nth-child(3) { animation-delay: -.3s; }
.cg-drop:hover .cg-wave i:nth-child(4), .cg-wave-live i:nth-child(4) { animation-delay: -.45s; }
.cg-drop:hover .cg-wave i:nth-child(5), .cg-wave-live i:nth-child(5) { animation-delay: -.6s; }
.cg-drop:hover .cg-wave i:nth-child(6), .cg-wave-live i:nth-child(6) { animation-delay: -.75s; }
.cg-drop:hover .cg-wave i:nth-child(7), .cg-wave-live i:nth-child(7) { animation-delay: -.9s; }
@keyframes cg-bar { 0%, 100% { transform: scaleY(.45); } 50% { transform: scaleY(1.15); } }
@media (prefers-reduced-motion: reduce) { .cg-wave i { animation: none !important; } }

.cg-optrow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 18px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 12px; }
.cg-spacer { flex: 1; }
.cg-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.cg-field-inline { flex-direction: row; align-items: center; gap: 10px; }
.cg-field select, .cg-field input, .cg-speakers input {
  font: 14px var(--font-body); color: var(--ink); padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; min-width: 0;
}
.cg-field select:focus, .cg-field input:focus, .cg-speakers input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.cg-toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--ink); cursor: pointer; user-select: none; }
.cg-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cg-toggle .track { width: 34px; height: 20px; border-radius: 999px; background: #bdc1c6; position: relative; transition: background .15s; flex: none; }
.cg-toggle .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.cg-toggle input:checked + .track { background: var(--blue); }
.cg-toggle input:checked + .track::after { transform: translateX(14px); }
.cg-toggle input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }
.cg-toggle code { font-size: 12px; }
.cg-turnstile:empty { display: none; }
.cg-turnstile { margin-top: 14px; }
.cg-privacy { display: flex; gap: 8px; align-items: flex-start; }
.cg-privacy svg { flex: none; margin-top: 2px; color: var(--green); }
#upload-error { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--red-tint); color: var(--red); font-size: 14px; font-weight: 500; }

/* preview card: a still of the editor */
.cg-demo { background: #fff; border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-sm); overflow: hidden; }
.cg-demo-frame { position: relative; aspect-ratio: 16 / 8; display: flex; align-items: flex-end; justify-content: center; padding: 0 10% 7%;
  background: radial-gradient(260px 120px at 30% 20%, rgba(138,180,248,.35), transparent 70%), radial-gradient(240px 140px at 80% 80%, rgba(52,168,83,.25), transparent 70%), linear-gradient(160deg, #263044, #11141a); }
.cg-demo-badge { position: absolute; top: 10px; left: 10px; font: 700 10px/1 var(--font-sans); letter-spacing: .06em; color: #fff; border: 1.5px solid rgba(255,255,255,.7); border-radius: 4px; padding: 3px 5px; }
.cg-demo-cap { background: rgba(8,8,10,.82); color: #fff; font: 500 13px/1.4 var(--font-body); padding: 3px 9px; border-radius: 4px; text-align: center; }
.cg-demo-tl { position: relative; height: 26px; margin: 10px 12px 2px; border-radius: 6px; background: var(--surface-alt); overflow: hidden; }
.cg-demo-tl i { position: absolute; top: 5px; bottom: 5px; border-radius: 3px; background: #aecbfa; }
.cg-demo-tl i.s { background: #dadce0; }
.cg-demo-tl i.r { background: var(--blue); }
.cg-demo-tl i.w { background: var(--yellow); }
.cg-demo-tl b { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); border-radius: 1px; }
.cg-demo-cues { list-style: none; margin: 0; padding: 4px 0 6px; }
.cg-demo-cues li { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 10px; padding: 9px 14px; border-left: 3px solid transparent; }
.cg-demo-cues li + li { border-top: 1px solid var(--border-subtle); }
.cg-demo-cues li.on { background: #f1f6fe; border-left-color: var(--blue); }
.cg-demo-cues .t { font: 500 11px var(--font-mono); color: var(--ink-muted); }
.cg-demo-cues .spk { justify-self: start; font: 600 11px var(--font-sans); padding: 2px 8px; border-radius: 999px; }
.cg-demo-cues .spk.c1 { color: var(--spk-0); background: color-mix(in srgb, var(--spk-0) 11%, #fff); }
.cg-demo-cues .spk.c2 { color: var(--spk-1); background: color-mix(in srgb, var(--spk-1) 11%, #fff); }
.cg-demo-cues p { grid-column: 1 / -1; margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.cg-demo-cues li.snd p { grid-column: 2; font-style: italic; color: var(--ink-secondary); }
.cg-demo-cues mark { background: var(--blue-tint); color: var(--blue-ink); border-bottom: 2px dashed var(--blue); padding: 0 2px; border-radius: 3px 3px 0 0; }
.cg-demo-cues .chip { grid-column: 1 / -1; justify-self: start; font: 600 11px var(--font-sans); padding: 2px 9px; border-radius: 999px; }
.cg-demo-cues .chip.review { background: var(--blue-tint); color: var(--blue-ink); }
.cg-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.cg-points li { position: relative; padding-left: 28px; font-size: 14px; line-height: 1.5; color: var(--ink-secondary); }
.cg-points li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--green-tint); color: var(--green); font-size: 10.5px; font-weight: 700; }
.cg-points b { color: var(--ink); font-weight: 600; }
.cg-points code { font-size: 12px; }

/* ---------- step 2: progress ---------- */
.cg-progress { text-align: center; padding: 52px 28px 40px; max-width: 600px; margin: 0 auto; }
.cg-progress .cg-wave { height: 64px; margin-bottom: 14px; }
.cg-progress .cg-wave i { width: 8px; border-radius: 4px; }
.cg-progress .cg-h { font-size: 24px; letter-spacing: -.022em; margin-bottom: 6px; }
.cg-bar { height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; margin: 24px 0 22px; }
.cg-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #4285f4 60%, var(--green-bright)); transition: width .35s ease; }
.cg-checks { list-style: none; padding: 6px; margin: 0 auto 20px; display: grid; gap: 2px; text-align: left; max-width: 420px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 14px; }
.cg-checks li { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--ink-muted); padding: 9px 12px; border-radius: 10px; }
.cg-checks li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--border); box-sizing: border-box; }
.cg-checks li.active { color: var(--ink); font-weight: 600; background: #fff; box-shadow: var(--shadow-xs); }
.cg-checks li.active::before { border-color: var(--blue); border-top-color: transparent; animation: cg-spin .8s linear infinite; }
.cg-checks li.done { color: var(--ink-secondary); }
.cg-checks li.done::before { content: "✓"; display: grid; place-items: center; border: 0; background: var(--green-tint); color: var(--green); font-size: 12px; font-weight: 700; }
.cg-checks li.skipped { text-decoration: line-through; }
@keyframes cg-spin { to { transform: rotate(360deg); } }
.cg-progress .alert { text-align: left; margin: 0 0 14px; font-size: 14px; }

/* ---------- step 3: editor workspace ---------- */
.cg-editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); height: clamp(640px, calc(100vh - 150px), 920px); }
.cg-left { padding: 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; border-right: 1px solid var(--border-subtle); background: var(--pane); }
.cg-left > * { flex: none; }
.cg-right { display: flex; flex-direction: column; min-height: 0; }
.cg-player { position: relative; background: #0b0c0e; border-radius: var(--radius-md, 14px); overflow: hidden; box-shadow: var(--shadow-sm); }
.cg-player video { display: block; width: 100%; max-height: 42vh; background: #000; }
.cg-player.audio-only { aspect-ratio: 16 / 7; background: radial-gradient(420px 160px at 30% 10%, rgba(138,180,248,.32), transparent 70%), radial-gradient(360px 180px at 85% 90%, rgba(52,168,83,.2), transparent 70%), linear-gradient(160deg, #263044, #11141a); }
.cg-player audio { position: absolute; left: 12px; right: 12px; bottom: 12px; width: calc(100% - 24px); }
.cg-overlay { position: absolute; left: 0; right: 0; bottom: 18%; display: flex; justify-content: center; padding: 0 8%; pointer-events: none; }
.cg-player.audio-only .cg-overlay { bottom: 44%; }
.cg-overlay span { background: rgba(8,8,10,.82); color: #fff; font: 500 clamp(14px, 1.6vw, 19px)/1.4 var(--font-body); padding: 4px 10px; border-radius: 4px; white-space: pre-line; text-align: center; }

.cg-timeline { background: #fff; border: 1px solid var(--border-subtle); border-radius: 12px; padding: 10px 12px 8px; box-shadow: var(--shadow-xs); }
.cg-tl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cg-tl-head .compare-label { margin: 0; }
.cg-tl-legend { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-muted); flex-wrap: wrap; }
.cg-tl-legend i { width: 9px; height: 9px; border-radius: 2px; margin-left: 6px; }
.cg-tl-legend i.ok { background: #aecbfa; } .cg-tl-legend i.review { background: var(--blue); }
.cg-tl-legend i.warn { background: var(--yellow); } .cg-tl-legend i.snd { background: #dadce0; }
.cg-tl-track { position: relative; height: 34px; border-radius: 7px; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), var(--border-subtle) calc(10% - 1px) 10%), var(--surface); cursor: pointer; overflow: hidden; }
.cg-tl-track i { position: absolute; top: 7px; bottom: 7px; border-radius: 3px; background: #aecbfa; transition: filter .1s; }
.cg-tl-track i:hover { filter: brightness(.88); }
.cg-tl-track i.review { background: var(--blue); }
.cg-tl-track i.warn { background: var(--yellow); }
.cg-tl-track i.err { background: var(--red); }
.cg-tl-track i.snd { background: #dadce0; top: 11px; bottom: 11px; }
.cg-tl-track b { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; pointer-events: none; }
.cg-tl-track b::before { content: ""; position: absolute; top: -1px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.cg-tl-times { display: flex; justify-content: space-between; margin-top: 4px; font: 500 11px var(--font-mono); color: var(--ink-muted); }

.cg-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.cg-stat { position: relative; background: #fff; border: 1px solid var(--border-subtle); border-radius: 12px; padding: 13px 13px 11px; overflow: hidden; box-shadow: var(--shadow-xs); }
.cg-stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--c, var(--blue)); }
.cg-stat b { display: block; font: 700 23px/1.1 var(--font-sans); letter-spacing: -.025em; font-variant-numeric: tabular-nums; color: var(--ink); }
.cg-stat span { display: block; margin-top: 4px; font-size: 12px; line-height: 1.35; color: var(--ink-secondary); }
.cg-stat.ready { --c: var(--green-bright); } .cg-stat.review { --c: var(--blue); } .cg-stat.warn { --c: var(--yellow); } .cg-stat.error { --c: var(--red); }
.cg-stat.ready.full b { color: var(--green); }

.cg-export { background: #fff; border: 1px solid var(--border-subtle); border-radius: 14px; padding: 14px 16px 16px; box-shadow: var(--shadow-xs); }
.cg-export-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cg-export-head .cg-fine { font-size: 12.5px; }
.cg-dl { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.cg-dl .btn { justify-content: center; }
.cg-dl .btn::before { content: ""; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2v8m0 0L4.5 6.5M8 10l3.5-3.5M3 13.5h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 2v8m0 0L4.5 6.5M8 10l3.5-3.5M3 13.5h10' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }

.cg-settings { background: #fff; border: 1px solid var(--border-subtle); border-radius: 14px; padding: 0 16px; box-shadow: var(--shadow-xs); }
.cg-settings summary { cursor: pointer; padding: 13px 0; font: 600 15px var(--font-sans); color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.cg-settings summary::-webkit-details-marker { display: none; }
.cg-settings summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--ink-muted); border-bottom: 2px solid var(--ink-muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .15s; }
.cg-settings[open] summary::after { transform: rotate(225deg); }
.cg-settings[open] { padding-bottom: 16px; }
.cg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 14px; }
.cg-toggle-cell { align-self: end; padding-bottom: 9px; }
.cg-speakers { display: grid; gap: 8px; margin-bottom: 14px; }
.cg-speakers:empty { display: none; }
.cg-speakers .lbl { font: 600 13px var(--font-sans); }
.cg-speakers label { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-secondary); }
.cg-restart { align-self: flex-start; }

/* caption list */
.cg-list-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px 12px; flex-wrap: wrap; padding: 14px 18px; background: #fff; border-bottom: 1px solid var(--border-subtle); }
.cg-list-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cg-count { display: inline-block; margin-left: 4px; font: 600 12px var(--font-mono); color: var(--ink-secondary); background: var(--surface-alt); padding: 2px 8px; border-radius: 999px; vertical-align: 2px; }
.cg-tabs { display: inline-flex; background: var(--surface-alt); padding: 4px; border-radius: 999px; gap: 2px; }
.cg-tabs button { font: 600 13px var(--font-sans); border: 0; background: transparent; color: var(--ink-secondary); padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: color .15s; }
.cg-tabs button:hover { color: var(--ink); }
.cg-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(60,64,67,.14); }
.cg-tabs button .k { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 999px; background: rgba(60,64,67,.08); font: 600 11px/18px var(--font-sans); font-variant-numeric: tabular-nums; color: var(--ink-secondary); }
.cg-tabs button.active .k { background: var(--blue-tint); color: var(--blue-ink); }
.cg-cues { list-style: none; margin: 0; padding: 0; flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.cg-empty { padding: 48px 20px; text-align: center; color: var(--ink-secondary); }

.cue { --spk: var(--blue); position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 8px 12px; padding: 14px 18px 10px 15px; border-bottom: 1px solid var(--border-subtle); border-left: 3px solid transparent; transition: background .12s; }
.cue[data-spk="1"] { --spk: var(--spk-1); } .cue[data-spk="2"] { --spk: var(--spk-2); } .cue[data-spk="3"] { --spk: var(--spk-3); }
.cue[data-spk="4"] { --spk: var(--spk-4); } .cue[data-spk="5"] { --spk: var(--spk-5); }
.cue:hover { background: #fafbfc; }
.cue.active { background: #f1f6fe; border-left-color: var(--blue); }
.cue.has-review { border-left-color: color-mix(in srgb, var(--blue) 45%, transparent); }
.cue.has-warn { border-left-color: var(--yellow); }
.cue.has-error { border-left-color: var(--red); }
.cue.active.has-review, .cue.active.has-warn, .cue.active.has-error { border-left-color: var(--blue); }
.cue .num { font: 500 11.5px var(--font-mono); color: var(--ink-muted); padding-top: 6px; text-align: right; }
.cue.active .num { color: var(--blue); font-weight: 600; }
.cue .meta { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; min-width: 0; }
.cue .times { display: inline-flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border-subtle); border-radius: 8px; padding: 2px; }
.cue .times input { box-sizing: content-box; font: 500 12px var(--font-mono); color: var(--ink); width: 12ch; border: 0; background: transparent; padding: 3px 5px; border-radius: 6px; }
.cue .times input:hover { background: #fff; }
.cue .times input:focus { outline: none; background: #fff; box-shadow: 0 0 0 2px var(--blue-tint), inset 0 0 0 1px var(--blue); }
.cue .times .arrow { color: var(--ink-muted); font-size: 11px; }
.cue .dur { font: 500 11.5px var(--font-mono); color: var(--ink-muted); }
.cue select.spk { font: 600 12px var(--font-sans); color: var(--spk); background-color: color-mix(in srgb, var(--spk) 11%, #fff); border: 0; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.cue .tag-sound { font: 600 12px var(--font-sans); color: var(--ink-secondary); background: var(--surface-alt); border-radius: 999px; padding: 3px 10px; }
.cue .text { grid-column: 2; font-size: 15.5px; line-height: 1.55; color: var(--ink); padding: 8px 12px; border-radius: 9px; white-space: pre-wrap; min-height: 2.4em; background: #fff; box-shadow: inset 0 0 0 1px var(--border-subtle); transition: box-shadow .12s; }
.cue .text:hover { box-shadow: inset 0 0 0 1px var(--border); }
.cue .text:focus { outline: none; box-shadow: inset 0 0 0 1px var(--blue), 0 0 0 3px var(--blue-tint); }
.cue.sound .text { font-style: italic; color: var(--ink-secondary); background: var(--surface); }
.cue mark { background: var(--blue-tint); color: var(--blue-ink); border-bottom: 2px dashed var(--blue); padding: 0 2px; border-radius: 3px 3px 0 0; }
.cue .problems { grid-column: 2; display: flex; flex-wrap: wrap; gap: 6px; }
.cue .problems:empty { display: none; }
.cue .problems span { font: 600 11.5px var(--font-sans); padding: 3px 10px; border-radius: 999px; }
.cue .problems .review { background: var(--blue-tint); color: var(--blue-ink); }
.cue .problems .warn { background: var(--amber-tint); color: var(--amber); }
.cue .problems .error { background: var(--red-tint); color: var(--red); }
.cue .actions { grid-column: 2; display: flex; gap: 2px; flex-wrap: wrap; margin-left: -8px; transition: opacity .12s; }
.cue .actions button { font: 500 12.5px var(--font-body); color: var(--ink-secondary); background: transparent; border: 0; border-radius: 999px; padding: 4px 9px; cursor: pointer; }
.cue .actions button:hover { background: var(--surface-alt); color: var(--ink); }
.cue .actions button[data-act="play"] { color: var(--blue); font-weight: 600; }
.cue .actions button[data-act="reviewed"] { color: var(--blue-ink); background: var(--blue-tint); font-weight: 600; }
.cue .actions button.reviewed { color: var(--green); background: var(--green-tint); }
.cue .actions button[data-act="delete"]:hover { color: var(--red); background: var(--red-tint); }
/* quieter rows on desktop: secondary actions appear on hover, focus or the playing caption */
@media (hover: hover) and (pointer: fine) {
  .cue .actions button:not([data-act="play"]):not([data-act="reviewed"]) { opacity: 0; transition: opacity .12s; }
  .cue:hover .actions button, .cue:focus-within .actions button, .cue.active .actions button { opacity: 1; }
}

/* ---------- content sections ---------- */
.cg-how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.cg-how-card { position: relative; background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 26px 28px; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cg-how-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--blue); }
.cg-how-card:nth-child(2)::before { background: var(--green-bright); }
.cg-how-card:nth-child(3)::before { background: var(--yellow); }
.cg-how-card:hover { border-color: #8ab4f8; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.cg-how-n { font: 500 12.5px var(--font-mono); color: var(--blue-ink); background: var(--blue-tint); border: 1px solid #d2e3fc; padding: 4px 10px; border-radius: 7px; }
.cg-how-card h3 { font-size: 19px; letter-spacing: -.02em; margin: 16px 0 8px; }
.cg-how-card p { color: var(--ink-secondary); margin: 0; font-size: 15px; }
.cg-table { overflow-x: auto; }
.cg-table td:first-child { font-weight: 600; white-space: nowrap; }
.cg-table td { color: var(--ink-secondary); }
.cg-table td strong { color: var(--ink); font-weight: 600; }
.cg-split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.cg-cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.cg-code-top { display: flex; align-items: center; gap: 7px; padding: 12px 16px; background: #20232a; border-bottom: 1px solid #2b2f38; }
.cg-code-top span { width: 10px; height: 10px; border-radius: 50%; background: #3c4049; }
.cg-code-top em { font: normal 12px var(--font-mono); color: #9aa0a6; margin-left: 8px; }
.cg-faq { display: grid; gap: 10px; }
.cg-faq details { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 0 20px; transition: border-color .15s, box-shadow .15s; }
.cg-faq details[open] { border-color: #c6dafc; box-shadow: var(--shadow-sm); }
.cg-faq summary { cursor: pointer; padding: 16px 0; font: 600 16px var(--font-sans); letter-spacing: -.01em; color: var(--ink); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.cg-faq summary::-webkit-details-marker { display: none; }
.cg-faq summary::after { content: "+"; flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-tint); color: var(--blue); font-size: 17px; line-height: 1; }
.cg-faq details[open] summary::after { content: "–"; }
.cg-faq details p { margin: 0 0 16px; color: var(--ink-secondary); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .cg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .cg-upload { grid-template-columns: 1fr; }
  .cg-upload-preview { border-left: 0; border-top: 1px solid var(--border-subtle); }
  .cg-editor { grid-template-columns: 1fr; height: auto; }
  .cg-left { overflow: visible; border-right: 0; border-bottom: 1px solid var(--border-subtle); }
  .cg-list-head { position: sticky; top: 64px; z-index: 2; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
  .cg-cues { overflow: visible; flex: none; }
  .cg-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .cg-how { grid-template-columns: 1fr; }
  .cg-split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .cg-hero { padding: 28px 0 36px; }
  .cg-lede { font-size: 16.5px; }
  .cg-proof li { font-size: 12.5px; }
  .cg-topbar { padding: 10px; }
  .cg-stepper li { padding-right: 10px; }
  .cg-stepper li:not(.active) .l { display: none; }
  .cg-limits { display: none; }
  .cg-upload-main { padding: 16px; }
  .cg-upload-preview { padding: 18px 16px; }
  .cg-drop { padding: 34px 16px 30px; }
  .cg-drop-title { font-size: 19px; }
  .cg-optrow { gap: 12px 16px; }
  .cg-optrow .cg-spacer { display: none; }
  .cg-left { padding: 14px; }
  .cg-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cue { padding: 12px 12px 10px 9px; grid-template-columns: 24px 1fr; gap: 8px; }
  .cg-list-head { padding: 10px 8px; }
  .cg-list-head .cg-h { display: none; }
  .cg-list-tools { flex-wrap: nowrap; width: 100%; justify-content: space-between; }
  .cg-tabs button { padding: 6px 7px; font-size: 12.5px; white-space: nowrap; }
  .cg-tabs button .k { margin-left: 4px; }
  #next-issue { font-size: 12.5px; }
  #next-issue { padding-left: 9px; padding-right: 9px; white-space: nowrap; }
  .cg-list-tools { gap: 6px; }
  .cg-dl { grid-template-columns: 1fr 1fr; }
  .cg-dl .btn:last-child { grid-column: span 2; }
  .nav-actions .btn-secondary { display: none; }
  .cg-tl-legend { display: none; }
}
