:root {
  --paper: oklch(94.4% 0.008 85);
  --paper-2: oklch(91% 0.01 85);
  --ink: oklch(22% 0.008 70);
  --ink-2: oklch(42% 0.01 70);
  --line: oklch(84% 0.012 80);
  --well: oklch(19.5% 0.006 60);
  --well-ink: oklch(90% 0.008 85);
  --accent: oklch(50% 0.2 268);
  --accent-ink: oklch(98% 0.01 268);
  --accent-soft: oklch(90% 0.05 268);
  --r: 14px;
  --r-s: 9px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}
h1, h2 { margin: 0; letter-spacing: -0.02em; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* header */
.top {
  display: flex; align-items: center; gap: 18px;
  max-width: 1240px; margin: 0 auto; padding: 18px 20px 14px;
}
.brand { display: block; line-height: 0; }
#mark { height: 34px; width: auto; }
.tag { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; min-width: 0; }
.pro-pill {
  border: 1px solid var(--ink); background: transparent; border-radius: 999px;
  padding: 6px 14px; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.pro-pill:hover { background: var(--ink); color: var(--paper); }
.pro-pill.is-pro { border-color: var(--accent); color: var(--accent); }

/* layout */
.app {
  max-width: 1240px; margin: 0 auto; padding: 0 20px 48px;
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start;
}
.viewer { min-width: 0; }

/* the dark well holds the video */
.well {
  position: relative; background: var(--well); color: var(--well-ink);
  border-radius: var(--r); overflow: hidden; aspect-ratio: 16 / 9;
  display: grid; place-items: center;
}
.well.drag { outline: 2px dashed var(--accent); outline-offset: -8px; }
.empty { max-width: 560px; padding: 32px; }
.empty h1 { font-size: clamp(24px, 3.3vw, 38px); line-height: 1.08; font-weight: 700; text-wrap: balance; }
.empty p { color: oklch(78% 0.01 80); margin: 14px 0 0; text-wrap: pretty; }
.empty .fine { font-size: 13px; color: oklch(64% 0.01 80); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.stage { position: relative; width: 100%; height: 100%; display: grid; place-items: center; }
.stage canvas { grid-area: 1 / 1; max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; }
#ui { touch-action: none; cursor: crosshair; }
.tool-face #ui { cursor: pointer; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: oklch(44% 0.2 268); }
.btn.primary:disabled { background: var(--line); color: var(--ink-2); cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: currentColor; }
.well .btn.ghost { color: var(--well-ink); border-color: oklch(50% 0.01 80); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* transport */
.transport { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.icon {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--paper); display: grid; place-items: center; cursor: pointer;
}
.icon svg { width: 20px; height: 20px; fill: currentColor; }
.icon .i-pause, .icon.playing .i-play { display: none; }
.icon.playing .i-pause { display: block; }
.time { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--ink-2); white-space: nowrap; }

input[type="range"] { flex: 1; min-width: 0; accent-color: var(--accent); height: 28px; margin: 0; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.hint { margin: 0; color: var(--ink-2); font-size: 14px; }
.status { margin: 10px 0 0; min-height: 1.5em; font-size: 14px; color: var(--ink-2); }

/* segmented choices */
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px;
  background: var(--paper-2); border-radius: 999px; border: 1px solid var(--line);
}
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500;
  white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease);
}
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* side panel */
.panel { display: flex; flex-direction: column; }
.block { padding: 20px 0; border-top: 1px solid var(--line); }
.block:first-child { border-top: 0; padding-top: 4px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block h2 { font-size: 19px; font-weight: 700; }
.count { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.field { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
.field legend, .field.range > span { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; padding: 0; display: block; }
.field.range { display: block; }
.field.range input { width: 100%; }
.muted { color: var(--ink-2); font-size: 14px; margin: 10px 0 0; text-wrap: pretty; }
#noThings { margin: 0 0 14px; }

.switch { position: relative; display: inline-block; width: 46px; height: 28px; cursor: pointer; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span[aria-hidden] {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s var(--ease);
}
.switch span[aria-hidden]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px oklch(0% 0 0 / .25); transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.things { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.things li {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  background: var(--paper-2); border-radius: var(--r-s);
}
.things .num {
  flex: none; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 13px;
}
.things .what { flex: 1; min-width: 0; line-height: 1.3; }
.things .what b { display: block; font-weight: 600; }
.things .what small { color: var(--ink-2); font-size: 13px; }
.things button { background: none; border: 0; padding: 6px; cursor: pointer; color: var(--ink-2); border-radius: 6px; }
.things button:hover { color: var(--ink); background: var(--line); }

.progress { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s linear; }

/* Pro dialog */
.pro {
  border: 0; padding: 0; border-radius: var(--r); background: var(--paper); color: var(--ink);
  width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px oklch(0% 0 0 / .45);
}
.pro::backdrop { background: oklch(19% 0.006 60 / .55); }
.pro-body { position: relative; padding: 28px; }
.pro h2 { font-size: 26px; font-weight: 700; }
.price { margin: 6px 0 14px; color: var(--ink-2); }
.price strong { color: var(--ink); font-size: 22px; }
.pro ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.close {
  position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer; display: grid; place-items: center;
}
.close:hover { background: var(--paper-2); }
.close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .panel { padding-top: 4px; }
  .block:first-child { border-top: 1px solid var(--line); padding-top: 20px; }
}
@media (max-width: 560px) {
  .top { padding: 14px 16px 12px; gap: 12px; flex-wrap: wrap; }
  .tag { order: 3; flex-basis: 100%; font-size: 13px; }
  .pro-pill { margin-left: auto; }
  .app { padding: 0 16px 40px; }
  .well { aspect-ratio: auto; min-height: 360px; border-radius: 12px; }
  .well:has(.stage:not([hidden])) { aspect-ratio: 16 / 9; min-height: 0; }
  .empty { padding: 26px 22px; }
  .seg span { padding: 7px 11px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.foot { max-width: 1240px; margin: 0 auto; padding: 8px 24px 28px; font-size: 13px; color: var(--ink-2); text-align: center; }
.foot a { color: inherit; }
