/* =============================================================== Verbatim
   An editorial reading tool: quiet chrome, one accent, type does the work.
   UI: Segoe UI Variable · Reading: Sitka (Windows' optical-size serif) · Numbers: tabular. */

:root {
  --bg: #fbfaf7;
  --side: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f4f2ed;
  --hover: rgba(28, 27, 24, .05);
  --ink: #1c1b18;
  --ink-2: #57534b;
  --ink-3: #8e8a80;
  --line: #e6e3dc;
  --line-2: #d6d2c8;
  --accent: #c9441c;
  --accent-ink: #ffffff;
  --accent-soft: rgba(201, 68, 28, .09);
  --accent-line: rgba(201, 68, 28, .35);
  --now: rgba(201, 68, 28, .06);
  --word: rgba(201, 68, 28, .16);
  --hit: rgba(46, 104, 214, .10);
  --hit-cur: rgba(46, 104, 214, .22);
  --ok: #2b7a4b;
  --warn: #a8690f;
  --err: #be3326;
  --focus: 0 0 0 3px rgba(201, 68, 28, .22);
  --shadow-1: 0 1px 2px rgba(20, 18, 12, .05);
  --shadow-2: 0 10px 30px -12px rgba(20, 18, 12, .22), 0 2px 6px rgba(20, 18, 12, .05);
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --read: "Sitka Text", Charter, "Iowan Old Style", Georgia, "Nirmala UI", serif;
  --read-display: "Sitka Heading", "Sitka Subheading", "Sitka Text", Charter, Georgia, serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312;
    --side: #0e0e0d;
    --surface: #1a1a18;
    --surface-2: #222220;
    --hover: rgba(255, 252, 245, .06);
    --ink: #ecebe6;
    --ink-2: #b2aea5;
    --ink-3: #7b7871;
    --line: #262624;
    --line-2: #34332f;
    --accent: #ff7447;
    --accent-ink: #1d0d06;
    --accent-soft: rgba(255, 116, 71, .12);
    --accent-line: rgba(255, 116, 71, .45);
    --now: rgba(255, 116, 71, .07);
    --word: rgba(255, 116, 71, .22);
    --hit: rgba(110, 160, 255, .12);
    --hit-cur: rgba(110, 160, 255, .26);
    --ok: #63c98e;
    --warn: #e2ad46;
    --err: #ff8574;
    --focus: 0 0 0 3px rgba(255, 116, 71, .28);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 18px 40px -14px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131312;
  --side: #0e0e0d;
  --surface: #1a1a18;
  --surface-2: #222220;
  --hover: rgba(255, 252, 245, .06);
  --ink: #ecebe6;
  --ink-2: #b2aea5;
  --ink-3: #7b7871;
  --line: #262624;
  --line-2: #34332f;
  --accent: #ff7447;
  --accent-ink: #1d0d06;
  --accent-soft: rgba(255, 116, 71, .12);
  --accent-line: rgba(255, 116, 71, .45);
  --now: rgba(255, 116, 71, .07);
  --word: rgba(255, 116, 71, .22);
  --hit: rgba(110, 160, 255, .12);
  --hit-cur: rgba(110, 160, 255, .26);
  --ok: #63c98e;
  --warn: #e2ad46;
  --err: #ff8574;
  --focus: 0 0 0 3px rgba(255, 116, 71, .28);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-2: 0 18px 40px -14px rgba(0, 0, 0, .7), 0 2px 8px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
code { font: 12.5px var(--mono); background: var(--surface-2); padding: 2px 6px; border-radius: 5px; color: var(--ink-2); }
kbd, .kbd {
  font: 11px/1 var(--ui); color: var(--ink-3);
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  padding: 2px 5px; background: var(--surface);
}
.muted { color: var(--ink-3); }
::selection { background: var(--word); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.ic {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.ic.sm { width: 15px; height: 15px; }
.ic.xl { width: 30px; height: 30px; stroke-width: 1.5; }
use[href="#i-play"], use[href="#i-more"] { fill: currentColor; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-weight: 560; font-size: 13.5px; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap; user-select: none;
  box-shadow: var(--shadow-1);
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn .ic { color: var(--ink-2); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.primary .ic { color: currentColor; }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--bg)); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.icon { width: 34px; padding: 0; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; gap: 5px; }
.btn.icon.sm { width: 28px; padding: 0; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: var(--r); }
.btn.block { width: 100%; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.done .ic { color: var(--ok); }

/* ---------------------------------------------------------------- shell */
.app {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  height: 100vh;
}

/* ---------------------------------------------------------------- library (sidebar) */
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.side-top { padding: 18px 16px 10px; display: grid; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 2px 4px; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--ink);
  display: grid; place-items: center; flex: none;
}
.brand .mark svg { width: 30px; height: 30px; fill: var(--accent); }
.wordmark { font: 650 17px/1 var(--display); letter-spacing: -.02em; }

.libsearch {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 10px;
  border-radius: var(--r-sm); background: var(--hover);
  color: var(--ink-3);
}
.libsearch:focus-within { box-shadow: var(--focus); background: var(--surface); }
.libsearch input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13.5px; color: var(--ink); }
.libsearch input::placeholder { color: var(--ink-3); }

.library { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 12px; }
.jobs, .group-items { list-style: none; margin: 0; padding: 0; }
.group + .group { margin-top: 10px; }
.group-head {
  width: 100%; display: flex; align-items: center; gap: 6px;
  border: 0; background: none; cursor: pointer; text-align: left;
  padding: 7px 8px 5px; border-radius: var(--r-sm); color: var(--ink-3);
}
.group-head:hover { background: var(--hover); }
.group-head .ic { width: 14px; height: 14px; transition: transform .15s; }
.group.collapsed .group-head .ic { transform: rotate(-90deg); }
.group.collapsed .group-items { display: none; }
.group-head .gname {
  font-size: 11.5px; font-weight: 650; letter-spacing: .055em; text-transform: uppercase; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.group-head .gsub { font-size: 11px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.group-head .gcount { font: 11px var(--ui); color: var(--ink-3); font-variant-numeric: tabular-nums; margin-left: auto; flex: none; }

.job {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; gap: 1px 8px;
  padding: 7px 10px 8px 12px; border-radius: var(--r-sm); cursor: pointer;
}
.job:hover { background: var(--hover); }
.job.sel { background: var(--surface); box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line); }
.job.sel::before {
  content: ""; position: absolute; left: 3px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--accent);
}
.job .jn { font-size: 13.5px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.job .jt { font: 11.5px var(--ui); color: var(--ink-3); font-variant-numeric: tabular-nums; align-self: center; }
.job .js { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; min-width: 0; }
.job .js span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2); flex: none; }
.job.done .dot { background: var(--ok); }
.job.running .dot, .job.uploading .dot { background: var(--accent); animation: pulse 1.3s infinite; }
.job.error .dot { background: var(--err); }
.job.cancelled .dot { background: var(--ink-3); }
.job.running .js { color: var(--ink-2); }
.job .bar { grid-column: 1 / -1; margin-top: 5px; }
@keyframes pulse { 50% { opacity: .3; } }
.emptyq { color: var(--ink-3); font-size: 13px; padding: 14px 10px; line-height: 1.5; }

.side-foot { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; }
.queue-status { font-size: 12px; color: var(--ink-2); display: grid; gap: 6px; }
.queue-status:empty { display: none; }
.queue-status .qs-line { display: flex; justify-content: space-between; gap: 8px; }
.queue-status .qs-line span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.foot-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.engine { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); min-width: 0; }
.engine .ic { width: 15px; height: 15px; color: var(--ok); }
.engine.cpu .ic { color: var(--warn); }
.engine span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-actions { display: flex; gap: 2px; }
.foot-actions .btn { width: 30px; height: 30px; }

.bar { height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .5s ease; }
.bar.indet i { width: 32% !important; animation: slide 1.5s ease-in-out infinite; }
@keyframes slide { from { margin-left: -32%; } to { margin-left: 100%; } }

/* ---------------------------------------------------------------- main */
.main { overflow-y: auto; min-height: 0; position: relative; scroll-padding-top: 70px; }

/* empty state */
.empty { min-height: 100%; display: grid; place-items: center; padding: 48px 32px; }
.empty-inner { max-width: 640px; }
.eyebrow { font-size: 12px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); margin: 0 0 14px; }
.empty h1 { font: 500 40px/1.12 var(--read-display); letter-spacing: -.015em; margin: 0 0 16px; }
.empty .lede { font-size: 16px; line-height: 1.6; color: var(--ink-2); margin: 0 0 26px; max-width: 560px; }
.empty-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 40px; }
.empty-cta .muted { font-size: 13px; }
.steps { list-style: none; margin: 0 0 30px; padding: 26px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 22px 28px; }
.steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.steps b { color: var(--ink); font-weight: 600; display: block; margin-bottom: 2px; }
.steps .n { font: 600 12px/24px var(--ui); text-align: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; color: var(--ink-3); margin: 0; }

/* transcript view */
.view { padding: 0 36px 80px; max-width: 1480px; }
.vhead {
  display: flex; gap: 20px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  padding: 30px 0 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px;
}
.vtitle { min-width: 0; flex: 1 1 380px; }
.crumb { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb:empty { display: none; }
.vtitle h1 { font: 600 28px/1.15 var(--display); letter-spacing: -.022em; margin: 0 0 8px; overflow-wrap: anywhere; }
.meta { margin: 0; font-size: 13px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; font-variant-numeric: tabular-nums; }
.meta > span { white-space: nowrap; }
.meta > span + span::before { content: "·"; margin: 0 8px; color: var(--line-2); }
.meta b { color: var(--ink-2); font-weight: 560; }
.meta .warn { color: var(--warn); }
.meta button.linkish { border: 0; background: none; padding: 0; cursor: pointer; color: var(--warn); font: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] > summary { background: var(--surface-2); }
.menu-list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  min-width: 240px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-2); display: grid;
  animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-list.right { left: auto; right: 0; min-width: 280px; }
.menu-list a {
  display: flex; gap: 10px; align-items: center; justify-content: space-between;
  padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13.5px;
}
.menu-list.right a { justify-content: flex-start; }
.menu-list a:hover { background: var(--hover); }
.menu-list a small { font-size: 11.5px; color: var(--ink-3); }
.menu-list a > span { display: grid; gap: 1px; }
.menu-list a .ic { color: var(--ink-3); }
.menu-list a.danger, .menu-list a.danger .ic { color: var(--err); }

/* progress */
.progress {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 18px; box-shadow: var(--shadow-1);
}
.progress .ph { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.progress .stage { font-weight: 600; font-size: 14px; }
.progress .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; font-variant-numeric: tabular-nums; }
.progress .bar { margin-top: 12px; height: 4px; }
.progress.err { border-color: color-mix(in srgb, var(--err) 40%, var(--line)); }
.progress.err .stage { color: var(--err); }
.progress .errtext { font: 12px/1.5 var(--mono); color: var(--ink-2); margin: 8px 0 0; white-space: pre-wrap; }

/* body: transcript + side column */
.vbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.col-side { display: grid; gap: 12px; align-content: start; }
@media (min-width: 1200px) {
  .vbody { grid-template-columns: minmax(0, 1fr) clamp(340px, 34%, 480px); }
  .col-side { position: sticky; top: 18px; max-height: calc(100vh - 36px); grid-template-rows: auto auto minmax(0, 1fr); }
}
@media (max-width: 1199px) {
  .col-side { order: -1; position: sticky; top: 0; z-index: 6; background: var(--bg); padding: 6px 0 10px; }
  .col-side .film { display: none; }
}

.player { border-radius: var(--r); overflow: hidden; background: #000; box-shadow: var(--shadow-2); }
.player:empty { display: none; }
.player video { width: 100%; display: block; max-height: 44vh; background: #000; }
.player audio { width: 100%; display: block; background: var(--surface); }
.player:has(audio) { background: var(--surface); box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.player .loading { color: var(--ink-3); font-size: 13px; padding: 14px; background: var(--surface); }
.player .yt { position: relative; aspect-ratio: 16 / 9; max-height: 44vh; width: 100%; background: #000; }
.player .yt iframe, .player .yt > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 1199px) { .player .yt { max-height: 30vh; } }
.ytbox { border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); padding: 10px 10px 10px; display: grid; gap: 8px; }
.ytbox-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.ytbox-head .ic { color: #e5322d; }
.ytbox-head .muted { font-size: 12px; }
@media (max-width: 1199px) { .player video { max-height: 30vh; } }
.col-side .note { margin: 0; }
.note { font-size: 12.5px; color: var(--warn); margin: 0; }

/* filmstrip */
.film { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 8px; }
.film-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); padding: 0 2px; }
.film-head .muted { font-weight: 500; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.filmstrip {
  position: relative;
  overflow-y: auto; min-height: 0; padding: 2px 4px 4px 2px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-content: start;
}
.fs-item {
  position: relative; border: 0; padding: 0; cursor: pointer; background: none;
  border-radius: 8px; overflow: hidden; text-align: left;
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow .15s, opacity .15s;
}
.fs-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.fs-item span {
  position: absolute; left: 6px; bottom: 6px;
  font: 600 10.5px/1 var(--ui); font-variant-numeric: tabular-nums;
  padding: 3px 5px; border-radius: 4px; background: rgba(0, 0, 0, .62); color: #fff;
}
.fs-item:hover { box-shadow: 0 0 0 1px var(--ink-3); }
.fs-item.cur { box-shadow: 0 0 0 2px var(--accent); }
.fs-item.past { opacity: .62; }

/* transcript toolbar */
.tools {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 8px 0 12px; margin-bottom: 4px;
  background: linear-gradient(var(--bg) 82%, transparent);
}
@media (max-width: 1199px) { .tools { position: static; } }
.search {
  flex: 1 1 220px; max-width: 360px;
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 10px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); color: var(--ink-3);
  box-shadow: var(--shadow-1);
}
.search:focus-within { box-shadow: var(--focus); border-color: var(--accent-line); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13.5px; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
.search .count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.search:focus-within .kbd { display: none; }
.search-nav { display: flex; gap: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px 0 9px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 12.5px; font-weight: 560; color: var(--ink-2); cursor: pointer; user-select: none;
  transition: background .12s, color .12s, border-color .12s;
}
.pill input { position: absolute; opacity: 0; pointer-events: none; }
.pill .ic { width: 15px; height: 15px; }
.pill b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.pill:hover { border-color: var(--ink-3); }
.pill:has(input:checked) { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill:has(input:checked) b { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.pill.warn:has(input:checked) { background: var(--warn); border-color: var(--warn); color: #fff; }
.pill.warn:has(input:checked) b { color: rgba(255, 255, 255, .8); }
.pill:has(input:focus-visible) { box-shadow: var(--focus); }

/* transcript lines */
.lines { min-height: 160px; max-width: 760px; }
.lines .placeholder { color: var(--ink-3); padding: 40px 0; font-size: 14px; }
.ln {
  position: relative;
  display: grid; grid-template-columns: 64px minmax(0, 1fr) 30px; gap: 4px;
  padding: 5px 4px 5px 0; margin: 0 -4px; border-radius: var(--r-sm);
  scroll-margin: 140px;
}
.ln:hover { background: var(--hover); }
.ln .t {
  border: 0; background: none; cursor: pointer; align-self: start;
  font: 500 12px/1 var(--ui); font-variant-numeric: tabular-nums; letter-spacing: .01em;
  color: var(--ink-3); text-align: right; padding: 8px 12px 6px 4px; border-radius: 6px; white-space: nowrap;
}
.ln .t:hover { color: var(--accent); }
.ln .tx { margin: 0; font: 17.5px/1.72 var(--read); color: var(--ink); overflow-wrap: anywhere; padding: 1px 2px; border-radius: 5px; }
.ln .w { border-radius: 3px; cursor: pointer; transition: background .08s; }
.ln .w:hover { background: var(--hover); }
.ln .pen {
  border: 0; background: none; cursor: pointer; color: var(--ink-3);
  opacity: 0; align-self: start; width: 28px; height: 28px; margin-top: 2px; border-radius: 6px;
  display: grid; place-items: center;
}
.ln .pen .ic { width: 15px; height: 15px; }
.ln:hover .pen { opacity: 1; }
.ln .pen:hover { color: var(--ink); background: var(--hover); }

.ln.now { background: var(--now); }
.ln.now::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.ln.now .t { color: var(--accent); font-weight: 650; }
.ln .w.wnow { background: var(--word); box-shadow: 0 0 0 1px var(--word); }
.ln.hit { background: var(--hit); }
.ln.hitcur { background: var(--hit-cur); }
.ln.ed .t::after { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 5px; vertical-align: middle; border-radius: 50%; background: var(--accent); }
.ln.editing { background: var(--surface); box-shadow: 0 0 0 1px var(--accent-line), var(--shadow-2); }
.ln.editing .tx { outline: none; cursor: text; }
.show-unsure .w.u { text-decoration: underline wavy var(--warn); text-underline-offset: 5px; text-decoration-thickness: 1.4px; text-decoration-skip-ink: none; cursor: text; }
.show-unsure .w.fx { text-decoration: underline solid var(--ok); text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.w.fx { cursor: text; }
.ln .w.fixing { background: var(--accent-soft); box-shadow: 0 0 0 1.5px var(--accent); }
.ln.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 40% { background: var(--hit-cur); } }

/* inline key frames */
.kf { margin: 6px 0 14px 68px; display: inline-grid; gap: 5px; max-width: calc(100% - 68px); }
.kf img {
  display: block; width: 300px; max-width: 100%; height: auto; border-radius: 8px;
  box-shadow: 0 0 0 1px var(--line), var(--shadow-1); cursor: zoom-in; background: var(--surface-2);
  transition: box-shadow .15s, transform .15s;
}
.kf:hover img { box-shadow: 0 0 0 1px var(--ink-3), var(--shadow-2); }
.kf figcaption { font: 500 11px var(--ui); color: var(--ink-3); font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* word fixer */
.wordfix {
  position: absolute; z-index: 30; width: 340px; max-width: calc(100% - 16px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-2); padding: 8px; animation: pop .12s ease-out;
}
.wordfix .wf-row { display: flex; gap: 6px; align-items: center; }
.wordfix input {
  flex: 1; min-width: 0; height: 34px;
  border: 1px solid var(--line-2); background: var(--bg); border-radius: var(--r-sm); padding: 0 10px;
  font: 16.5px var(--read);
}
.wordfix input:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent-line); }
.wf-hint { font-size: 11.5px; color: var(--ink-3); margin: 8px 2px 1px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.wf-hint kbd { margin-right: 2px; }

/* ---------------------------------------------------------------- new transcription sheet */
.sheet {
  width: min(840px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--bg); color: var(--ink); box-shadow: var(--shadow-2);
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet .18s ease-out; }
@keyframes sheet { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.sheet::backdrop { background: rgba(10, 9, 8, .42); backdrop-filter: blur(3px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px 22px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font: 600 17px var(--display); letter-spacing: -.01em; }
.sheet-body { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); overflow-y: auto; }
.sheet-add { padding: 20px 22px 22px; display: grid; gap: 12px; align-content: start; }
.sheet-opts { padding: 20px 22px 22px; display: grid; gap: 14px; align-content: start; border-left: 1px solid var(--line); background: var(--side); }

.drop {
  border: 1.5px dashed var(--line-2); border-radius: var(--r);
  padding: 26px 18px 22px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icons { color: var(--ink-3); margin-bottom: 4px; }
.drop strong { font-size: 15px; font-weight: 600; }
.drop .muted { font-size: 12.5px; margin-bottom: 10px; }
.drop .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pathform { display: flex; gap: 6px; }
.pathform input, .fld select, .fld textarea {
  width: 100%; border: 1px solid var(--line-2); background: var(--surface); border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--ink);
}
.pathform input { flex: 1; min-width: 0; height: 34px; padding: 0 10px; }
.pathform input:focus, .fld select:focus, .fld textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent-line); }
.fineprint { font-size: 12px; color: var(--ink-3); margin: 0; line-height: 1.5; }
.fld { display: grid; gap: 5px; }
.fld > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fld > span i { font-style: normal; font-weight: 400; color: var(--ink-3); }
.fld select { height: 34px; padding: 0 8px; }
.fld-note { font-size: 12px; color: var(--ink-3); }
.fld-note:empty { display: none; }
.fld textarea { padding: 8px 10px; resize: vertical; min-height: 64px; line-height: 1.45; }

.switch { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; cursor: pointer; font-size: 13.5px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 32px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.switch small { display: block; font-size: 12px; color: var(--ink-3); }

/* ---------------------------------------------------------------- overlays */
.drop-overlay {
  position: fixed; inset: 0; z-index: 100; padding: 24px;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(4px);
  display: grid; place-items: center;
}
.drop-overlay div {
  border: 2px dashed var(--accent); border-radius: 20px; padding: 44px 48px; max-width: 460px; text-align: center;
  background: var(--surface); display: grid; gap: 8px; justify-items: center; box-shadow: var(--shadow-2);
}
.drop-overlay .ic { color: var(--accent); }
.drop-overlay b { font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.drop-overlay span { color: var(--ink-2); font-size: 13.5px; }

.lightbox { position: fixed; inset: 0; z-index: 150; background: rgba(8, 8, 7, .9); display: grid; place-items: center; padding: 24px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.lightbox figure { margin: 0; max-width: min(1440px, 100%); display: grid; gap: 12px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); border-radius: 10px; display: block; margin: 0 auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
.lightbox figcaption { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; color: #d8d5ce; font-size: 13px; font-variant-numeric: tabular-nums; }
.lightbox .lb-actions { display: flex; gap: 6px; }
.lightbox .btn { background: #22211f; border-color: #34322e; color: #ecebe6; box-shadow: none; }
.lightbox .btn .ic { color: #ecebe6; }
.lightbox .btn:hover { background: #2e2c29; }

.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; width: min(480px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 11px 15px;
  font-size: 13.5px; box-shadow: var(--shadow-2); animation: rise .2s ease-out;
}
.toast.err { background: var(--err); color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- TradingView indicators */
.ind-body { display: grid; gap: 26px; max-width: 980px; padding-bottom: 40px; }
.ind-body h2 { font: 650 12px var(--ui); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 10px; }
.ind-body .lede { font: 17px/1.65 var(--read); margin: 0; color: var(--ink); }
.concepts { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.concepts th { text-align: left; font: 600 11.5px var(--ui); color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; padding: 0 10px 8px 0; border-bottom: 1px solid var(--line); }
.concepts td { vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.concepts td:first-child { font-weight: 600; width: 18%; }
.concepts .lessons { font-size: 12px; color: var(--ink-3); }
.tag { display: inline-block; font: 600 11px var(--ui); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.tag.drawn { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.tag.partly { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.tag.not_automatable { background: var(--surface-2); color: var(--ink-3); }
.ind-body ol, .ind-body ul { margin: 0; padding-left: 20px; line-height: 1.6; color: var(--ink-2); }
.code { position: relative; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.code pre { margin: 0; padding: 16px 18px; max-height: 70vh; overflow: auto; font: 12.5px/1.55 var(--mono); color: var(--ink); tab-size: 4; }
.code .code-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--ink-3); }
.fixbox { display: grid; gap: 8px; }
.fixbox textarea { width: 100%; min-height: 90px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); padding: 10px 12px; font: 12.5px/1.5 var(--mono); color: var(--ink); resize: vertical; }
.fixbox textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--accent-line); }
.fixbox .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.versions { display: flex; gap: 6px; flex-wrap: wrap; }
.versions button.cur { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ind-dlg { padding: 18px 22px 22px; display: grid; gap: 14px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.ind-dlg p { margin: 0; }
.ind-dlg .keyrow { display: flex; gap: 6px; }
.ind-dlg input { flex: 1; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); padding: 0 10px; font: 13px var(--mono); color: var(--ink); }
.ind-dlg .est { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; color: var(--ink); }
.ind-dlg .actions-row { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------------------------------------------------------- remote (Vercel / tunnel) */
.remote #pickFiles, .remote #pickFolder, .remote #openAll, .remote #revealBtn,
.remote .drop .row, .remote .fineprint { display: none !important; }
.connect { max-width: 520px; margin: 14vh auto; padding: 0 24px; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.connect h1 { font: 500 32px/1.15 var(--read-display); color: var(--ink); margin: 0 0 14px; }
.connect ol { padding-left: 20px; }
.connect .warn { color: var(--err); }
.pairbox { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 22px; }
.pairbox .qr { background: #fff; padding: 12px; border-radius: 12px; line-height: 0; }
.pairbox .qr svg, .pairbox .qr img { width: 220px; height: 220px; }
.sheet.narrow { width: min(480px, calc(100vw - 32px)); }
.pairbox p { margin: 0; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.pairbox .row { display: flex; gap: 6px; width: 100%; }
.pairbox .status { font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.pairbox .status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pairbox .status.off .dot { background: var(--warn); }
.remote #remoteBtn { display: none !important; }
.pairbox input { width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 10px; font: 12px var(--mono); background: var(--surface); color: var(--ink); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .side { border-right: 0; border-bottom: 1px solid var(--line); }
  .library { max-height: 42vh; }
  .main { overflow: visible; }
  .view { padding: 0 16px 48px; }
  .vtitle h1 { font-size: 23px; }
  .empty { padding: 32px 16px; }
  .empty h1 { font-size: 30px; }
  .steps { grid-template-columns: 1fr; }
  .ln { grid-template-columns: 52px minmax(0, 1fr) 26px; }
  .ln .t { padding-right: 8px; }
  .ln .tx { font-size: 16.5px; }
  .ln .pen { opacity: 1; }
  .kf { margin-left: 52px; max-width: calc(100% - 52px); }
  .sheet-body { grid-template-columns: 1fr; }
  .sheet-opts { border-left: 0; border-top: 1px solid var(--line); }
  .pills { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
