/* Video Redact - a calm editor: a light-grey workspace, a slightly darker well for the video, white panels. The
 * dark theme is the same thing in dark greys; nothing is black except a cover you choose to make black.
 * House rule: no vertical stripes. State is shown by fill, tint and weight, never by a coloured edge. System fonts. */

:root {
  --bg: #e9ebee;
  --panel: #f8f9fa;
  --raised: #ffffff;
  --ink: #1d2127;
  --dim: #58616e;
  --line: #d2d6dc;
  --well: #cdd1d7;
  --track: #dfe2e7;
  --accent: #2459c4;
  --accent-ink: #ffffff;
  --accent-soft: #dbe6fb;
  --face: #6d5bd0;
  --box: #0f8a7e;
  --text: #b86a00;
  --warn-bg: #fff1cc;
  --warn-ink: #6b4a00;
  --bad: #b3261e;
  --ok: #1a7f4b;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.08), 0 6px 20px rgba(20, 24, 31, 0.07);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #2b2d31;
  --panel: #34363b;
  --raised: #3d4046;
  --ink: #eceef1;
  --dim: #b0b6c0;
  --line: #4b4e56;
  --well: #232528;
  --track: #2c2e33;
  --accent: #8ab4ff;
  --accent-ink: #0c1c3a;
  --accent-soft: #33415c;
  --face: #b3a6ff;
  --box: #5fd3c6;
  --text: #f0b45c;
  --warn-bg: #4b3d16;
  --warn-ink: #ffdc94;
  --bad: #ff8a80;
  --ok: #6fdba3;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 20px rgba(0, 0, 0, 0.2);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--accent); }
.hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- controls ---- */
.btn { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 32px; }
.btn:hover { background: var(--panel); border-color: var(--dim); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--raised); border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:disabled:hover { filter: none; }
.btn.strong { font-weight: 600; background: var(--accent-soft); border-color: transparent; }
.btn.strong:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn.small { padding: 3px 9px; min-height: 26px; font-size: 13px; border-radius: 7px; }
.btn.big { padding: 11px 20px; font-size: 16px; border-radius: 10px; min-height: 46px; }
.btn.icon { padding: 6px 8px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
select, input[type="color"] { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; min-height: 32px; }
select { padding: 5px 8px; max-width: 100%; }

/* ---- top bar ---- */
.bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--ink); text-decoration: none; margin-right: 6px; }
.bar-group { display: inline-flex; gap: 6px; }
.bar-fill { flex: 1 1 0; }
.private { display: inline-flex; align-items: center; gap: 5px; color: var(--ok); font-weight: 600; font-size: 13px; margin-right: 4px; }

main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }

/* ---- first screen ---- */
.empty { max-width: 880px; width: 100%; margin: 0 auto; padding: 28px 16px 40px; }
.drop { background: var(--panel); border: 2px dashed var(--line); border-radius: 16px; padding: 44px 20px 34px; text-align: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop h1 { font-size: clamp(24px, 4.2vw, 34px); line-height: 1.15; letter-spacing: -0.01em; }
.lead { color: var(--dim); font-size: 16px; margin-top: 10px; }
.drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.fine { color: var(--dim); font-size: 12.5px; }
.drop .fine { margin-top: 14px; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.points li { background: var(--panel); border-radius: 12px; padding: 14px; color: var(--dim); }
.points b { color: var(--ink); display: block; margin-bottom: 2px; }
.about { margin-top: 30px; color: var(--dim); max-width: 700px; }
.about h2 { font-size: 16px; color: var(--ink); margin-top: 18px; }
.about p { margin-top: 4px; }

/* ---- the editor ---- */
.work { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; padding: 12px; flex: 1 1 auto; min-height: 0; align-items: start; }
.stage-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tools-note { color: var(--dim); font-size: 12.5px; }
.status { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 10px; padding: 7px 10px; }
#statusText { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.meter { flex: 1 1 80px; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; min-width: 60px; }
#statusFill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 4px; }
.eta { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px; }
.stage { position: relative; background: var(--well); border-radius: 12px; height: min(58vh, 620px); min-height: 160px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.stage video, .stage canvas { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: block; }
.stage video { opacity: 0.01; pointer-events: none; }
#overlay { touch-action: none; outline-offset: -3px; }
#overlay.draw { cursor: crosshair; }
.stage-note { position: absolute; left: 12px; right: 12px; bottom: 12px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 8px 10px; text-align: center; }
.transport { display: flex; align-items: center; gap: 6px; }
.clock { font-family: var(--mono); font-size: 13px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.keys { color: var(--dim); font-size: 12px; }

.timeline { background: var(--panel); border-radius: 10px; padding: 10px 14px 8px; user-select: none; -webkit-user-select: none; }
.tl-ruler { position: relative; height: 16px; background: var(--track); border-radius: 8px; cursor: pointer; touch-action: none; }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent-soft); border-radius: 8px; }
.tl-knob { position: absolute; top: 50%; left: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--panel); }
.tl-rows { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; max-height: 132px; overflow-y: auto; touch-action: pan-y; }
.tl-row { position: relative; height: 16px; background: var(--track); border-radius: 8px; flex: 0 0 auto; cursor: pointer; }
.tl-bar { position: absolute; top: 2px; bottom: 2px; min-width: 10px; border-radius: 6px; background: var(--box); opacity: 0.55; cursor: grab; }
.tl-bar.face { background: var(--face); }
.tl-bar.off { background: var(--dim); opacity: 0.25; }
.tl-bar.now { opacity: 0.85; }
.tl-bar.sel { opacity: 1; box-shadow: 0 0 0 2px var(--ink); }
.tl-end { position: absolute; top: -3px; bottom: -3px; width: 12px; cursor: ew-resize; touch-action: none; }
.tl-end.a { left: -4px; } .tl-end.b { right: -4px; }
.tl-none { color: var(--dim); font-size: 12.5px; padding: 2px 0; }

/* ---- the side panels ---- */
.side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel { background: var(--panel); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase; color: var(--dim); }
.count { font-weight: 600; text-transform: none; letter-spacing: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.stack .btn { justify-content: center; white-space: normal; }
.lab { color: var(--dim); width: 42px; flex: 0 0 auto; }
.val { font-family: var(--mono); font-size: 13px; flex: 1 1 auto; }
.pos { flex: 1 1 auto; text-align: center; font-variant-numeric: tabular-nums; }
.sum { font-weight: 600; }
.sum.bad { color: var(--bad); } .sum.good { color: var(--ok); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--track); border-radius: 9px; padding: 3px; gap: 3px; }
.seg-btn { font: inherit; color: var(--dim); background: transparent; border: 0; border-radius: 7px; padding: 5px 4px; cursor: pointer; min-height: 30px; }
.seg-btn[aria-checked="true"] { background: var(--raised); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.field { display: inline-flex; min-width: 0; }
.lab.wide { width: auto; }
.grow { flex: 1 1 auto; }
.panel input[type="text"] { font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 8px; min-height: 32px; padding: 5px 9px; width: 100%; }
.group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.group-head b { font-weight: 600; }
.warn p { margin-bottom: 6px; }
.tl-bar.text { background: var(--text); }
.swatches { gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.pick input { width: 40px; height: 28px; padding: 2px; min-height: 0; cursor: pointer; }
.emojis button { font-size: 20px; line-height: 1; width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--raised); cursor: pointer; padding: 0; }
.emojis button[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); }
.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 8px; padding: 7px 10px; font-weight: 600; font-size: 13px; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 4px; max-height: 260px; overflow-y: auto; }
.item { display: flex; align-items: center; gap: 9px; padding: 5px; border-radius: 9px; cursor: pointer; background: transparent; }
.item:hover { background: var(--track); }
.item.sel { background: var(--accent-soft); }
.item.off .thumb, .item.off .meta { opacity: 0.5; }
.thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--track); flex: 0 0 auto; display: block; }
.meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.meta b { font-weight: 600; }
.meta span { color: var(--dim); font-family: var(--mono); font-size: 12px; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; width: 100%; height: 100%; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--line); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { left: 19px; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.result { display: flex; flex-direction: column; gap: 8px; background: var(--raised); border-radius: 10px; padding: 10px; }
.result .btn { justify-content: center; }

.toasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 20; pointer-events: none; width: min(92vw, 520px); }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 9px 14px; box-shadow: var(--shadow); text-align: center; }
.foot { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px 14px; color: var(--dim); font-size: 12.5px; }
.foot a { color: var(--dim); }
.foot-theme { display: none; }

/* ---- one column: a phone ---- */
@media (max-width: 860px) {
  .work { grid-template-columns: minmax(0, 1fr); padding: 8px; gap: 8px; }
  .points { grid-template-columns: 1fr; }
  .bar { padding: 8px 10px; gap: 6px; }
  .private span, .keys, .tools-note, .lbl-long { display: none; }
  /* one row, always: the theme switch moves to the foot of the page, the sample to the first screen's own button */
  .bar { flex-wrap: nowrap; }
  .bar .btn { padding: 6px 10px; }
  .brand { margin-right: 0; }
  #themeBtn { display: none; }
  .foot-theme { display: inline-flex; }
  .foot { align-items: center; }
  .btn { min-height: 38px; }
  .btn.small { min-height: 34px; padding: 5px 11px; }
  #btnAll { flex: 1 1 100%; justify-content: center; min-height: 46px; font-size: 16px; }
  #btnFaces, #btnText, #btnBox { flex: 1 1 auto; justify-content: center; }
  .drop { padding: 30px 14px 24px; }
  .tl-rows { max-height: 84px; }
}
@media (max-width: 520px) {
  #btnSample { display: none; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
  #btnText { font-size: 13px; }
}
