/* Caption editor: a workspace on the site's own paper. Transcript on the left, the picture on the right, the strip below. */
.ce { display: grid; gap: 14px; --ce-side: clamp(300px, 30%, 380px); --ce-tl: 100px; }

/* the first screen */
.ce-start { display: grid; gap: 22px; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: var(--r-frame); box-shadow: var(--shadow-frame); }
.ce-drop { display: grid; justify-items: center; gap: 8px; padding: 56px 20px; border: 1.5px dashed rgba(14, 8, 7, 0.24); border-radius: 22px; text-align: center; cursor: pointer; transition: border-color var(--t) var(--ease), background var(--t) var(--ease); }
.ce-drop:hover, .ce-drop.is-over { border-color: var(--ink); background: var(--paper-2); }
.ce-drop-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; margin-bottom: 6px; }
.ce-drop-icon svg { width: 22px; height: 22px; }
.ce-drop b { font: 600 18px/1.3 var(--sans); }
.ce-drop small { color: var(--muted); font-size: 13.5px; max-width: 40ch; }
.ce-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; font: 500 14px/1.4 var(--sans); }

/* tips, above the workspace: two short points on one line */
.ce-tips { justify-self: start; display: flex; align-items: center; gap: 16px; max-width: 100%; padding: 9px 18px 9px 16px; background: var(--paper-2); border-radius: 999px; font: 400 13.5px/1.3 var(--sans); color: #3a3432; scroll-margin-top: 96px; }
.ce-tips-head { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.ce-tips-head svg { width: 16px; height: 16px; }
.ce-tips ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 0; }
.ce-tips li + li { margin-left: 16px; padding-left: 16px; border-left: 1px solid rgba(14, 8, 7, 0.14); }
.ce-tips li[hidden] + li { margin-left: 0; padding-left: 0; border-left: 0; }
.ce-tips kbd { display: inline-block; margin-right: 4px; padding: 3px 9px; border-radius: 8px; background: #fff; border: 1px solid rgba(14, 8, 7, 0.12); box-shadow: 0 1px 0 rgba(14, 8, 7, 0.12); font: 600 12.5px/1.2 var(--sans); color: var(--ink); }
@media (max-width: 700px) { .ce-tips { border-radius: 18px; align-items: flex-start; padding: 12px 16px; } .ce-tips ul { display: grid; gap: 8px; } .ce-tips li + li { margin-left: 0; padding-left: 0; border-left: 0; } }

/* the workspace */
.ce-app { scroll-margin-top: 96px; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-frame); overflow: hidden; min-height: 620px; height: min(calc(100vh - 120px), 860px); box-shadow: var(--shadow-frame); }
/* the video is the point: the workspace takes the height there is, and an upright video gets no less than it needs */
.ce-tips:not([hidden]) + .ce-app { height: calc(100vh - 152px); }
.ce.is-upright .ce-tips:not([hidden]) + .ce-app { height: max(calc(100vh - 152px), 860px); }
.ce-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.ce-bar-file { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ce-name { font: 600 14px/1.3 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ce-meta { font: 400 12.5px/1.3 var(--sans); color: var(--muted); white-space: nowrap; }
.ce-bar-mid { display: flex; gap: 4px; }
.ce-bar-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* controls in the site's shapes */
.ce-ib { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; font: 500 18px/1 var(--sans); }
.ce-ib:hover { background: var(--paper-2); }
.ce-ib[disabled] { opacity: 0.3; cursor: default; }
.ce-ib svg { width: 18px; height: 18px; }
.ce-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: var(--pill); border: 1px solid rgba(0, 0, 0, 0.32); background: transparent; color: var(--ink); font: 600 13.5px/1 var(--sans); cursor: pointer; text-decoration: none; transition: background var(--t) var(--ease), border-color var(--t) var(--ease); }
.ce-btn:hover { border-color: var(--ink); }
.ce-btn.ce-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.ce-btn.ce-primary:hover { background: #000; }
.ce-btn.ce-quiet { border-color: transparent; color: var(--muted); }
.ce-btn.ce-quiet:hover { color: var(--ink); background: var(--paper-2); }
.ce-btn.ce-wide { width: 100%; padding: 14px 16px; font-size: 15px; }
.ce-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.ce-link { font: 500 13px/1.3 var(--sans); color: var(--muted); text-decoration: underline; text-underline-offset: 3px; background: none; border: 0; padding: 0; cursor: pointer; }
.ce-link:hover { color: var(--ink); }

/* left: the two panes, filled by captions-ui.mjs */
.ce-main { display: grid; grid-template-columns: var(--ce-side) 12px minmax(0, 1fr); min-height: 0; }
/* the gutters the shared handles (panels.css) sit in */
.ce-resize-x { grid-column: 2; background: var(--paper-2); }
.ce-resize-y { height: 12px; background: #fff; border-top: 1px solid var(--line); }
.ce-side { grid-column: 1; display: grid; grid-template-rows: auto 1fr; min-height: 0; border-right: 1px solid var(--line); }
.ce-tabs { display: flex; gap: 2px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); }
.ce-tabs button { padding: 12px 14px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--muted); font: 600 13.5px/1 var(--sans); cursor: pointer; }
.ce-tabs button:hover:not(.is-on) { color: var(--ink); }
.ce-tabs button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(14, 8, 7, 0.16); border-radius: 6px 6px 0 0; }
.ce-tabs button.is-on { color: var(--ink); border-bottom-color: var(--ink); }
.ce-pane { overflow: auto; min-height: 0; padding: 18px 16px 24px; display: grid; gap: 16px; align-content: start; scrollbar-width: thin; }
#ce-style-box { display: grid; gap: 16px; }
.ce-source { display: grid; gap: 12px; }
.ce-working { display: grid; gap: 8px; }
.ce-working .bar i { background: var(--ink); transition: width var(--t-slow) var(--ease); }
.ce-working small { color: var(--muted); font-size: 13px; }
.ce-lines-foot { display: flex; padding-top: 4px; }
.ce-hint { margin: 0; font: 400 12.5px/1.45 var(--sans); color: var(--muted); }
.ce-stage canvas.can-drag { cursor: grab; }
.ce-hint a { color: var(--ink); }

/* right: the picture */
.ce-stage-wrap { grid-column: 3; display: grid; grid-template-rows: 1fr auto; min-height: 0; min-width: 0; background: var(--paper-2); }
.ce-stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; background: var(--paper-2); padding: 12px; }
.ce-stage video { display: block; object-fit: contain; max-width: 100%; max-height: 100%; border-radius: 12px; background: #000; box-shadow: 0 12px 32px -14px rgba(14, 8, 7, 0.4); }
.ce-stage canvas { position: absolute; left: 0; top: 0; touch-action: none; }
/* with picture.mjs drawing the frames, the canvas is the picture and the video element only plays */
.ce.has-picture .ce-stage video { visibility: hidden; }
.ce.has-picture .ce-stage canvas { border-radius: 12px; box-shadow: 0 12px 32px -14px rgba(14, 8, 7, 0.4); }
.ce-stage canvas.is-drag { cursor: grabbing; }
.ce-stage canvas.can-drag { cursor: grab; }
.ce-stage-hint { position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--ink); font: 500 13px/1 var(--sans); }
.ce-controls { display: grid; grid-template-columns: auto auto 1fr auto; align-items: center; gap: 14px; padding: 8px 18px; border-top: 1px solid var(--line); background: #fff; }
.ce-play { background: var(--ink); color: #fff; border-radius: 50%; }
.ce-play:hover { background: #000; }
.ce-play svg { width: 16px; height: 16px; }
.ce-time { font: 500 12.5px/1 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ce-controls input[type="range"] { width: 100%; accent-color: var(--ink); }
.ce-controls select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: 500 12.5px/1 var(--sans); }

/* below: the strip */
.ce-timeline { position: relative; height: var(--ce-tl); background: #fafaf9; }
.ce-timeline canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.ce-timeline canvas.is-edge { cursor: ew-resize; }
.ce-timeline canvas.is-move { cursor: grab; }
.ce-tl-tools { position: absolute; right: 12px; bottom: 10px; display: flex; gap: 4px; }
.ce-tl-tools .ce-ib { width: 28px; height: 28px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; }

/* the export sheet */
.ce-sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(14, 8, 7, 0.4); backdrop-filter: blur(4px); }
.ce-sheet-box { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: #fff; color: var(--ink); border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.35); }
.ce-sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 10px 20px; font: 600 16px/1.2 var(--sans); }
.ce-export-body { display: grid; gap: 18px; padding: 6px 22px 24px; }
.ce-export-done { display: grid; gap: 10px; }
.ce-export-done video { width: 100%; max-height: 300px; background: #000; border-radius: 12px; }
.ce-export-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ce-export-files { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); font: 500 13px/1 var(--sans); color: var(--muted); }
.ce-export-files span { margin-right: 6px; }
.ce-error { margin: 0; }
.ce-foot-note { margin: 0; font: 400 13px/1.45 var(--sans); color: var(--muted); }
.ce .turnstile-slot:empty { display: none; }

@media (max-width: 900px) {
  .ce-app, .ce-tips:not([hidden]) + .ce-app, .ce.is-upright .ce-tips:not([hidden]) + .ce-app { height: auto; min-height: 0; }
  .ce-main { grid-template-columns: 1fr; }
  .pn-resize { display: none; }
  .ce-side, .ce-stage-wrap { grid-column: 1; }
  .ce-side { order: 2; border-right: 0; border-top: 1px solid var(--line); }
  .ce-pane { max-height: 60vh; }
  .ce-stage-wrap { order: 1; }
  .ce-stage { height: min(64vh, 560px); padding: 10px; }
  .ce-timeline { order: 3; height: 112px; border-top: 1px solid var(--line); }
  .ce-bar { grid-template-columns: 1fr auto; }
  .ce-bar-mid { display: none; }
}
@media (max-width: 600px) { .ce-start { padding: 18px; } .ce-drop { padding: 40px 14px; } .ce-bar-actions .ce-quiet { display: none; } .ce-controls { grid-template-columns: auto auto 1fr; } .ce-controls select { display: none; } }
