/* Sadhguru Archive · Studio UI
   One visual system: CSS variables, 4/8 px spacing, one button family, thin SVG icons. */

/* ---------- tokens ---------- */
:root {
  --font-ui: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", ui-monospace, monospace;
  --font-serif: Georgia, Cambria, "Times New Roman", serif;
  --topbar-h: 60px;
  --dock-h: 164px;
  --dock-h-full: 164px;

  --bg: #faf8f5;
  --panel: #ffffff;
  --panel-2: #f5f2ed;
  --panel-3: #ece7df;
  --hover: rgba(60, 45, 30, .05);
  --hover-strong: rgba(60, 45, 30, .09);
  --border: #ebe6de;
  --border-soft: #f2eee8;
  --border-strong: #ddd6cb;
  --border-stronger: #c8bfb2;
  --text: #2a2622;
  --text-2: #5c554d;
  --muted: #8b8379;
  --accent: #c8660f;
  --accent-hover: #b35a0c;
  --accent-text: #a75309;
  --accent-soft: rgba(200, 102, 15, .09);
  --accent-softer: rgba(200, 102, 15, .05);
  --accent-soft-2: rgba(200, 102, 15, .16);
  --accent-border: rgba(200, 102, 15, .42);
  --mark-bg: #fbe2bf;
  --hl: #f7d6a6;
  --hl-text: inherit;
  --playhead: #e0362b;
  --danger: #c43d2f;
  --danger-soft: rgba(196, 61, 47, .08);
  --ok: #3d8b5a;
  --ai: #6b5bd2;
  --ai-soft: rgba(107, 91, 210, .12);
  --ai-fg: #5a4bbf;
  --toast-bg: #2a2622;
  --toast-fg: #f6f2ec;

  --b-words-bg: rgba(200, 102, 15, .10); --b-words-fg: #9c5310;
  --b-cc-bg: #e7f0e9;  --b-cc-fg: #3f6b4b;
  --b-meaning-bg: #edecf6; --b-meaning-fg: #585094;
  --b-title-bg: #e8eef5; --b-title-fg: #42617f;
  --b-lang-bg: #f2ede5; --b-lang-fg: #6d6358;

  --shadow-xs: 0 1px 2px rgba(42, 38, 34, .08);
  --shadow-sm: 0 1px 2px rgba(42, 38, 34, .05), 0 1px 1px rgba(42, 38, 34, .03);
  --shadow-md: 0 4px 14px rgba(42, 38, 34, .08), 0 1px 3px rgba(42, 38, 34, .06);
  --shadow-lg: 0 14px 40px rgba(42, 38, 34, .14), 0 2px 6px rgba(42, 38, 34, .06);
  --focus-ring: 0 0 0 3px rgba(200, 102, 15, .30);

  /* timeline canvas colours (read by timeline.js) */
  --tl-strip: #f3efe9; --tl-ch-a: #eee7dc; --tl-ch-b: #e5dccf; --tl-ch-text: #5c554d; --tl-ch-line: rgba(60, 45, 30, .10);
  --tl-tick: #b7aea2; --tl-tick-minor: #dad3c9; --tl-label: #7a7268;
  --tl-track: #f6f3ee; --tl-track-border: #e6e0d6;
  --tl-sel: rgba(200, 102, 15, .15); --tl-sel-line: rgba(200, 102, 15, .8);
  --tl-marker: #c8660f; --tl-marker-span: rgba(200, 102, 15, .30);
  --tl-hover: rgba(42, 38, 34, .35); --tl-ov: #ebe5dc; --tl-ov-thumb: #bcb2a5; --tl-grip: rgba(255, 255, 255, .85);
  --tl-speech: rgba(60, 45, 30, .30); --tl-speech-sel: rgba(200, 102, 15, .72); --tl-lane: #f4f0ea;
  --tl-word: #6a6259; --tl-word-line: rgba(60, 45, 30, .10);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #131210;
  --panel: #1b1916;
  --panel-2: #23201c;
  --panel-3: #2c2924;
  --hover: rgba(255, 240, 220, .05);
  --hover-strong: rgba(255, 240, 220, .09);
  --border: #2c2823;
  --border-soft: #25221e;
  --border-strong: #3a352e;
  --border-stronger: #4b453c;
  --text: #ebe6df;
  --text-2: #bab2a7;
  --muted: #868074;
  --accent: #dd7a22;
  --accent-hover: #ea8a35;
  --accent-text: #efa25b;
  --accent-soft: rgba(221, 122, 34, .13);
  --accent-softer: rgba(221, 122, 34, .07);
  --accent-soft-2: rgba(221, 122, 34, .22);
  --accent-border: rgba(221, 122, 34, .5);
  --mark-bg: rgba(221, 122, 34, .28);
  --hl: rgba(221, 122, 34, .42);
  --hl-text: #fff;
  --playhead: #ff4a3d;
  --danger: #e5675a;
  --danger-soft: rgba(229, 103, 90, .12);
  --ok: #5fb07c;
  --ai: #7d6df0;
  --ai-soft: rgba(125, 109, 240, .18);
  --ai-fg: #b4abff;
  --toast-bg: #f1ece5;
  --toast-fg: #1f1c19;

  --b-words-bg: rgba(221, 122, 34, .15); --b-words-fg: #eaa463;
  --b-cc-bg: rgba(95, 176, 124, .14); --b-cc-fg: #8fcca3;
  --b-meaning-bg: rgba(140, 128, 230, .16); --b-meaning-fg: #b7aef2;
  --b-title-bg: rgba(110, 160, 220, .15); --b-title-fg: #9fc2e9;
  --b-lang-bg: rgba(255, 240, 220, .07); --b-lang-fg: #bab2a7;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
  --focus-ring: 0 0 0 3px rgba(221, 122, 34, .38);

  --tl-strip: #211e1a; --tl-ch-a: #2a2621; --tl-ch-b: #332e27; --tl-ch-text: #bdb5aa; --tl-ch-line: rgba(255, 240, 220, .08);
  --tl-tick: #5e574d; --tl-tick-minor: #3b362f; --tl-label: #978e82;
  --tl-track: #201d19; --tl-track-border: #322d27;
  --tl-sel: rgba(221, 122, 34, .20); --tl-sel-line: rgba(221, 122, 34, .85);
  --tl-marker: #e88a35; --tl-marker-span: rgba(221, 122, 34, .38);
  --tl-hover: rgba(255, 240, 220, .35); --tl-ov: #2d2924; --tl-ov-thumb: #61594e; --tl-grip: rgba(255, 255, 255, .85);
  --tl-speech: rgba(255, 240, 220, .28); --tl-speech-sel: rgba(232, 138, 53, .8); --tl-lane: #1f1c18;
  --tl-word: #b3aa9e; --tl-word-line: rgba(255, 240, 220, .09);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--dock-h);
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
body.dock-collapsed { --dock-h: 46px; }
@media (max-height: 860px) { :root { --dock-h: 136px; --dock-h-full: 136px; } }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe { pointer-events: none; }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; margin: -1px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
kbd {
  display: inline-block; min-width: 18px; padding: 0 5px; text-align: center;
  font: 500 11px/17px var(--font-mono); color: var(--text-2);
  background: var(--panel-2); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
}
code { font-family: var(--font-mono); font-size: 12.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
mark { background: var(--mark-bg); color: inherit; border-radius: 3px; padding: 0 1px; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-stronger); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn .i { width: 16px; height: 16px; }
.btn .i.chev { width: 14px; height: 14px; margin-right: -4px; opacity: .7; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary kbd { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); color: #fff; margin-left: 2px; }
.btn.secondary { background: var(--panel); border-color: var(--border-strong); color: var(--text); }
.btn.secondary:hover, .btn.secondary.open { background: var(--panel-2); border-color: var(--border-stronger); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover, .btn.ghost.open { background: var(--hover); color: var(--text); }
.btn.ghost.active { color: var(--accent-text); background: var(--accent-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn:disabled, .icon-btn:disabled { opacity: .42; cursor: default; pointer-events: none; }
.btn.flash, .icon-btn.flash { animation: flash .35s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 var(--accent-soft-2); } 100% { box-shadow: 0 0 0 8px transparent; } }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 34px; height: 34px; padding: 0; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); cursor: pointer;
  transition: background-color .12s, color .12s;
}
.icon-btn:hover, .icon-btn.open { background: var(--hover); color: var(--text); }
.icon-btn .i { width: 18px; height: 18px; }
.icon-btn.sm { width: 30px; height: 30px; }
.icon-btn.sm .i { width: 16px; height: 16px; }
.icon-btn.xs { width: 26px; height: 26px; border-radius: 6px; }
.icon-btn.xs .i { width: 15px; height: 15px; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.link-quiet { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 12.5px; background: none; border: 0; padding: 2px 4px; border-radius: 4px; cursor: pointer; }
.link-quiet .i { width: 14px; height: 14px; }
.link-quiet:hover { color: var(--accent-text); }

.count-badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 1;
}
.count-badge.zero { background: var(--panel-3); color: var(--muted); }
.count-badge.pulse { animation: pulse .6s ease-out; }
@keyframes pulse { 0% { transform: scale(1); } 35% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* segmented control (radio labels or buttons) */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 8px; background: var(--panel-2); flex: none; }
.seg label { position: relative; display: block; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span, .seg button {
  display: block; padding: 0 10px; height: 28px; line-height: 28px; border-radius: 6px; border: 0; background: transparent;
  font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.seg span:hover, .seg button:hover { color: var(--text); }
.seg input:checked + span, .seg button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-xs); }
:root[data-theme="dark"] .seg input:checked + span, :root[data-theme="dark"] .seg button.active { background: var(--panel-3); }
.seg input:focus-visible + span { box-shadow: var(--focus-ring); }
.seg.sm span, .seg.sm button { height: 24px; line-height: 24px; padding: 0 8px; font-size: 12px; }

.input, .select {
  height: 32px; width: 100%; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text); font-size: 13px;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.select.sm { height: 30px; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input, .pill-check input, .menu-row input[type="checkbox"] { accent-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 28px; height: 16px; border-radius: 999px; background: var(--border-stronger); transition: background-color .15s; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--accent); }
.switch input:checked + .switch-ui::after { transform: translateX(12px); }
.switch input:focus-visible + .switch-ui { box-shadow: var(--focus-ring); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px; min-width: 0;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
.brand { font-family: var(--font-serif); font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: var(--text); text-decoration: none; white-space: nowrap; margin-right: 8px; }
.searchbar { flex: 1 1 auto; min-width: 280px; max-width: 840px; }
.search-box {
  display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 4px 0 12px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--panel);
  transition: border-color .12s, box-shadow .12s;
}
.search-box:hover { border-color: var(--border-stronger); }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-icon { color: var(--muted); }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 15px; color: var(--text); }
.search-box input:focus { box-shadow: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.slash-hint { color: var(--muted); }
.search-box:focus-within .slash-hint { display: none; }
.search-box .seg { height: 34px; padding: 3px; }
#filtersBtn { flex: none; }
#filtersBtn.has-filters { border-color: var(--accent-border); color: var(--accent-text); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 2px; min-width: 0; }
.stats { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; margin-right: 10px; }
@media (max-width: 1560px) { .stats { display: none; } }

/* ---------- popovers & menus ---------- */
.popover, .menu {
  position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); overflow-y: auto;
}
.filters-pop { width: 540px; max-width: calc(100vw - 16px); padding: 16px 18px 12px; }
.fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.fp-wide { grid-column: 1 / -1; }
.fp-group h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pill-checks { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-check { position: relative; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none;
}
.pill-check input:checked + span { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }
.pill-check input:focus-visible + span { box-shadow: var(--focus-ring); }
.fp-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fp-dates label span { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.fp-dur { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button {
  height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--panel); font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.chips button:hover { border-color: var(--border-stronger); color: var(--text); }
.chips button.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }
.dur-custom { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dur-custom .input { width: 64px; height: 28px; }
.fp-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }

.help-pop { width: 680px; max-width: calc(100vw - 16px); padding: 16px 20px 18px; }
.help-title { font-weight: 600; font-size: 15px; margin-bottom: 8px; }
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.help-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; align-items: center; font-size: 13px; }
.help-pop dt { white-space: nowrap; color: var(--text-2); }
.help-pop dd { margin: 0; color: var(--text-2); }
.help-pop dt.help-sec { grid-column: 1 / -1; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.help-pop dt.help-sec + dd { display: none; }

.menu { min-width: 232px; padding: 6px; border-radius: 10px; }
.menu-wide { width: 330px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text); font-size: 13.5px; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); box-shadow: none; }
.menu-item .i { width: 16px; height: 16px; color: var(--text-2); }
.menu-item.two { align-items: flex-start; padding: 8px 10px; }
.menu-item.two .i { margin-top: 2px; }
.menu-item b { display: block; font-weight: 500; }
.menu-item small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 1px; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 6px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.menu-label-meta { font: 400 11.5px var(--font-mono); color: var(--text-2); }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 10px; font-size: 13px; color: var(--text-2); }
.menu-row.check { justify-content: flex-start; cursor: pointer; }

/* ---------- studio layout ---------- */
.studio {
  --split: 40%;
  display: grid; grid-template-columns: var(--split) 12px minmax(0, 1fr);
  min-height: 0; padding: 12px 16px 12px 0;
}
.gutter { position: relative; cursor: col-resize; }
.gutter::after { content: ""; position: absolute; top: 8px; bottom: 8px; left: 50%; width: 2px; margin-left: -1px; border-radius: 2px; background: transparent; transition: background-color .15s; }
.gutter:hover::after, body.resizing .gutter::after { background: var(--border-stronger); }

/* ---------- results column ---------- */
.results-col { min-height: 0; overflow-y: auto; padding: 0 6px 24px 16px; scrollbar-gutter: stable; }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.fchip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 3px 0 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 500; }
.fchip-x { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.fchip-x .i { width: 13px; height: 13px; }
.fchip-x:hover { background: var(--accent-soft-2); }
.topics-wrap { position: relative; margin-bottom: 8px; }
.topics-bar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px 0 3px; }
.topics-arrow {
  position: absolute; top: 0; z-index: 2; display: none; place-items: center; width: 28px; height: 28px; padding: 0;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-2);
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.topics-arrow .i { width: 15px; height: 15px; }
.topics-arrow:hover { color: var(--accent-text); border-color: var(--accent-border); }
.topics-arrow.l { left: 0; }
.topics-arrow.r { right: 0; }
.topics-wrap.can-l .topics-arrow.l, .topics-wrap.can-r .topics-arrow.r { display: grid; }
.topics-bar::-webkit-scrollbar { display: none; }
.topics-bar.fade-r { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.topics-bar.fade-l { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px); mask-image: linear-gradient(90deg, transparent, #000 48px); }
.topics-bar.fade-l.fade-r { -webkit-mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
.topic-chip {
  flex: none; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text-2); font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.topic-chip:hover { border-color: var(--accent-border); color: var(--text); }
.suggest-bar { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 8px; font-size: 13px; color: var(--text-2); }
.suggest-bar .dym a { font-weight: 500; }
.chip-link { display: inline-block; padding: 1px 9px; margin: 1px 2px; border-radius: 999px; background: var(--panel-2); color: var(--text-2); text-decoration: none; font-size: 12.5px; }
.chip-link:hover { background: var(--accent-soft); color: var(--accent-text); }
.result-head {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 34px; padding: 4px 2px 6px; background: var(--bg); font-size: 12.5px; color: var(--muted);
}
.result-info { font-variant-numeric: tabular-nums; }

.view-head { margin: 0 0 8px; padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--border); }
.vh-top { display: flex; align-items: center; gap: 8px; }
.vh-top .btn { margin-left: -6px; }
.vh-title { font-weight: 600; font-size: 14px; }
.vh-from { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.vh-source { margin: 8px 0 0; padding: 6px 10px; border-left: 2px solid var(--accent); background: var(--accent-softer); border-radius: 0 6px 6px 0; font-size: 13px; color: var(--text-2); cursor: pointer; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: var(--border-strong); }
.card.active { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-soft-2); }
.card-head { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 12px; padding: 10px; cursor: pointer; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; padding: 0 5px; border-radius: 4px; background: rgba(0, 0, 0, .74); color: #fff; font: 500 11px/17px var(--font-mono); }
.card-info { min-width: 0; }
.card-title { margin: 1px 0 3px; font-size: 14.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12.5px; color: var(--muted); }
.card-meta .dot { margin: 0 5px; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.badge { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11px; line-height: 18px; font-weight: 500; white-space: nowrap; background: var(--b-lang-bg); color: var(--b-lang-fg); }
.badge.sm { font-size: 10.5px; line-height: 16px; padding: 0 6px; }
.badge.src-keyword { background: var(--b-words-bg); color: var(--b-words-fg); }
.badge.src-cc { background: var(--b-cc-bg); color: var(--b-cc-fg); }
.badge.src-meaning { background: var(--b-meaning-bg); color: var(--b-meaning-fg); }
.badge.src-title { background: var(--b-title-bg); color: var(--b-title-fg); }
.badge.hascc { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.moments { --tc-w: 72px; border-top: 1px solid var(--border-soft); padding: 4px; }
.moments.long-tc { --tc-w: 84px; }
.moment {
  position: relative; display: grid; grid-template-columns: var(--tc-w) minmax(0, 1fr) 60px; gap: 6px; align-items: start;
  padding: 6px 6px 6px 6px; border-radius: 7px; cursor: pointer;
}
.moment:hover { background: var(--hover); }
.moment.cursor { box-shadow: inset 0 0 0 1.5px var(--accent-border); }
.moment.playing { background: var(--accent-soft); }
.moment.playing::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--accent); }
.moment .tc {
  justify-self: start; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 7px 0 5px; border-radius: 999px;
  font: 500 12.5px/22px var(--font-mono); color: var(--accent-text); transition: background-color .12s, color .12s;
}
.moment .tc .i { width: 11px; height: 11px; opacity: .35; transition: opacity .12s; }
.moment:hover .tc, .moment.cursor .tc { background: var(--accent-soft); }
.moment:hover .tc .i, .moment.cursor .tc .i, .moment.playing .tc .i { opacity: 1; }
.moment.playing .tc { background: var(--accent); color: #fff; }
.moment.title-only .tc .i { width: 13px; height: 13px; opacity: 1; }
.snip { font-size: 13.5px; line-height: 1.55; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.moment.playing .snip { color: var(--text); -webkit-line-clamp: 6; }
.msrc { white-space: nowrap; cursor: help; }
.msrc .badge { vertical-align: 1px; margin-left: 2px; }
.why { display: inline-flex; flex-wrap: wrap; gap: 4px; cursor: help; }
.m-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity .12s; }
.moment:hover .m-actions, .moment.cursor .m-actions, .moment.playing .m-actions { opacity: 1; }
.m-actions .icon-btn { background: var(--panel); box-shadow: inset 0 0 0 1px var(--border); }
.m-actions .icon-btn:hover { background: var(--panel); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-border); }
.more-btn { display: block; margin: 2px 0 2px calc(var(--tc-w) + 6px); padding: 4px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.more-btn:hover { color: var(--accent-text); background: var(--hover); }

/* floating "why this matched" tooltip */
.hover-tip {
  position: fixed; z-index: 95; max-width: 300px; padding: 9px 11px; border-radius: 9px; pointer-events: none;
  background: var(--panel); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 12.5px; line-height: 1.4;
}
.hover-tip .ht-title { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.hover-tip .ht-row { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: start; }
.hover-tip .ht-row + .ht-row { margin-top: 6px; }
.hover-tip .ht-row .badge { justify-self: start; }
.hover-tip .ht-row span:last-child { color: var(--text-2); }

.state-box { padding: 40px 24px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.state-box .state-title, .state-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.state-box.home { text-align: left; max-width: 560px; margin: 8px auto; padding: 28px 8px; }
.state-box.home p { margin: 0 0 14px; line-height: 1.6; }
.state-box .tips { display: grid; gap: 6px; margin: 0 0 16px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.state-box .examples { margin-bottom: 14px; }
.state-box.error .state-title { color: var(--danger); }
.skeleton .thumb, .sk-line { background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk-line { height: 11px; border-radius: 6px; margin: 7px 0; }
.skeleton .moments { padding: 8px 12px; }
.w90 { width: 90%; } .w80 { width: 80%; } .w70 { width: 70%; } .w40 { width: 40%; } .w30 { width: 30%; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- monitor ---------- */
/* Wide monitors: player + transcript side by side, timeline and transport full width underneath.
   Narrow monitors: player, timeline, transport, then the transcript stacked. */
.monitor {
  container: mon / inline-size;
  min-width: 0; min-height: 0; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.mon-grid {
  --tx-w: clamp(300px, 32cqw, 440px);
  display: grid; height: 100%; min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto minmax(170px, 1fr);
  grid-template-areas: "head" "player" "tl" "tp" "tabs";
}
.mon-head { grid-area: head; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 8px 0 16px; min-width: 0; }
.mon-title-wrap { flex: 1; min-width: 0; }
.video-title { font-size: 15px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.video-meta > span:first-child { margin-right: 4px; overflow: hidden; text-overflow: ellipsis; }
.tl-chapter {
  flex: 0 1 auto; min-width: 0; max-width: 34%; height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--panel-2); color: var(--text-2); font-size: 12px; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.player-stage { grid-area: player; min-height: 0; min-width: 0; display: flex; justify-content: center; padding: 0 16px 12px; }
.player-box {
  position: relative; width: min(100%, calc(44vh * 16 / 9)); aspect-ratio: 16 / 9;
  border-radius: 8px; overflow: hidden; background: #000;
}
.player-box iframe, .player-box #player { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(ellipse at center, #26221d 0%, #14120f 75%); color: rgba(255, 255, 255, .55); font-size: 13px;
}
.player-empty .i { width: 28px; height: 28px; stroke-width: 1.4; }

/* timeline: one compact block (slim placeholder until a talk loads) */
.tl { grid-area: tl; min-width: 0; padding: 4px 4px 2px; user-select: none; }
.tl-empty {
  display: flex; align-items: center; gap: 8px; height: 36px; margin: 4px 12px 6px; padding: 0 12px; border-radius: 8px;
  border: 1px dashed var(--border-strong); color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden;
}
.tl-empty .i { width: 16px; height: 16px; flex: none; }
.tl-empty span:last-child { overflow: hidden; text-overflow: ellipsis; }
body.has-video .tl-empty { display: none; }
body:not(.has-video) .tl-wrap { display: none; }
.tl-wrap { position: relative; height: 112px; }
.tl-wrap canvas { position: absolute; left: 0; top: 0; display: block; }
#tlOver { touch-action: none; }
/* zoom + snap controls on the right end of the ruler row */
.tl-zoom {
  position: absolute; top: 16px; right: 12px; z-index: 3; height: 24px; display: flex; align-items: center; gap: 1px;
  padding: 0 0 0 6px; background: var(--panel);
}
.tl-zoom::before { content: ""; position: absolute; top: 0; bottom: 0; left: -18px; width: 18px; background: linear-gradient(90deg, transparent, var(--panel)); pointer-events: none; }
.tl-range { margin-right: 6px; font: 11px var(--font-mono); color: var(--muted); white-space: nowrap; }
.tlz-btn {
  display: grid; place-items: center; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--text-2); cursor: pointer;
}
.tlz-btn .i { width: 15px; height: 15px; }
.tlz-btn:hover { background: var(--hover); color: var(--text); }
.tlz-btn.snap-toggle { color: var(--muted); }
.tlz-btn.snap-toggle.active { color: var(--accent-text); background: var(--accent-soft); }
.tlz-sep { width: 1px; height: 14px; margin: 0 5px; background: var(--border-strong); }
.tl-zoom input[type="range"] { width: 84px; height: 4px; margin: 0 4px; accent-color: var(--accent); cursor: pointer; }
.tlz-txt {
  height: 22px; padding: 0 7px; border: 0; border-radius: 5px; background: transparent;
  font-size: 11.5px; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.tlz-txt:hover { background: var(--hover); color: var(--text); }
.tlz-txt.active { color: var(--accent-text); background: var(--accent-soft); }
.tlz-btn:focus-visible, .tlz-txt:focus-visible { box-shadow: var(--focus-ring); }
.tl-tip {
  position: absolute; z-index: 5; pointer-events: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  max-width: 320px; padding: 4px 8px; border-radius: 6px; background: var(--toast-bg); color: var(--toast-fg);
  font-size: 12px; line-height: 1.35; white-space: nowrap; box-shadow: var(--shadow-md);
}
.tl-tip b { font-weight: 600; }
.tl-tip span { font-family: var(--font-mono); font-size: 11.5px; opacity: .9; }
.tl-tip em { font-style: normal; font-size: 11px; opacity: .7; }
.tl-tip .tip-text { font-family: var(--font-ui); white-space: normal; width: max-content; max-width: 300px; opacity: .85; }
.tl-tip .tip-tc { opacity: 1; font-size: 12px; }

/* transport: [play + time] | marking tools | IN / OUT / DUR | Add + Download */
.transport { grid-area: tp; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 16px; min-width: 0; }
.tp-clock { display: flex; align-items: center; gap: 10px; flex: none; }
.play-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--panel-2); color: var(--text); }
.play-btn:hover { background: var(--panel-3); }
.play-btn .ic-pause, body.is-playing .play-btn .ic-play { display: none; }
body.is-playing .play-btn .ic-pause { display: block; }
.tc-big { font: 600 20px/1 var(--font-mono); letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-group { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 9px; background: var(--panel-2); flex: none; }
.tp-btn {
  display: grid; place-items: center; width: 32px; height: 30px; padding: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-2); cursor: pointer; transition: background-color .12s, color .12s;
}
.tp-btn .i { width: 18px; height: 18px; }
.tp-btn:hover { background: var(--panel); color: var(--text); box-shadow: var(--shadow-xs); }
:root[data-theme="dark"] .tp-btn:hover { background: var(--panel-3); }
.tp-btn.flash { animation: flash .35s ease-out; }
.tp-readouts { display: flex; align-items: center; gap: 6px; flex: none; min-width: 0; }
.ro {
  position: relative; display: flex; align-items: center; height: 32px; padding: 0 1px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid transparent; transition: border-color .12s;
}
.ro:hover, .ro:focus-within { border-color: var(--border-strong); }
.ro-l { padding: 0 3px 0 1px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.ro-in .ro-l, .ro-out .ro-l { color: var(--accent-text); }
.ro-v {
  height: 28px; padding: 0 3px; border: 0; border-radius: 6px; background: transparent;
  font: 500 13px/28px var(--font-mono); color: var(--text); white-space: nowrap; cursor: text; font-variant-numeric: tabular-nums;
}
button.ro-v:hover { background: var(--panel); }
:root[data-theme="dark"] button.ro-v:hover { background: var(--panel-3); }
.ro-v.static { cursor: default; color: var(--text-2); }
.ro-v.editing { visibility: hidden; }
.ro-dur { padding: 0 8px 0 6px; background: transparent; }
.ro-dur:hover { border-color: transparent; }
.nudge {
  display: grid; place-items: center; width: 22px; height: 28px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer; opacity: 0; transition: opacity .12s, background-color .12s;
}
.nudge .i { width: 15px; height: 15px; }
.ro:hover .nudge, .ro:focus-within .nudge { opacity: 1; }
.nudge:hover { color: var(--text); background: var(--panel); }
:root[data-theme="dark"] .nudge:hover { background: var(--panel-3); }
.ro-snap {
  position: absolute; top: -7px; right: -6px; display: none; place-items: center; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #fff; box-shadow: 0 0 0 2px var(--panel); pointer-events: none;
}
.ro-snap .i { width: 10px; height: 10px; stroke-width: 2.4; }
.ro.snapped .ro-snap { display: grid; }
.ro-input {
  position: absolute; left: 50%; top: 1px; transform: translateX(-50%); height: 28px; width: 108px; padding: 0 6px; border-radius: 6px;
  border: 1px solid var(--accent); box-shadow: var(--focus-ring); background: var(--panel); font: 500 13px var(--font-mono); color: var(--text); text-align: center;
}
body:not(.has-video) .tp-readouts, body:not(.has-video) .tp-group { opacity: .55; }
.tp-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.lbl-short { display: none; }

@container mon (max-width: 1180px) { #addInOutToBinBtn kbd { display: none; } }
@container mon (max-width: 1060px) { .hide-narrow { display: none; } }
@container mon (max-width: 960px) {
  #downloadBtn .lbl-long { display: none; }
  #downloadBtn { padding: 0 10px; }
}
@container mon (max-width: 880px) {
  #addInOutToBinBtn .lbl-long { display: none; }
  #addInOutToBinBtn .lbl-short { display: inline; }
  .transport { gap: 8px; }
}
@container mon (max-width: 820px) {
  .ro-dur { display: none; }
  .tc-big { font-size: 17px; }
  .tl-zoom input[type="range"] { width: 60px; }
  .tl-range { display: none; }
}
@container mon (max-width: 700px) {
  .nudge { display: none; }
  .ro { padding: 0 4px; }
  .tl-chapter { display: none; }
}
@container mon (max-width: 600px) { .tp-group { display: none; } }

/* tabs: transcript | script */
.mon-tabs { grid-area: tabs; min-height: 0; min-width: 0; overflow: hidden; display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.tabbar { display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 12px 0 10px; border-bottom: 1px solid var(--border); flex: none; min-width: 0; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 10px;
  border: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; min-width: 0; }
.track-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 16px; }
.transcript-empty, .script-empty { padding: 28px 16px; color: var(--muted); text-align: center; font-size: 13px; }
.script-empty { text-align: left; max-width: 520px; margin: 0 auto; }
.script-empty p { margin: 6px 0; line-height: 1.6; }
.line { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 10px; padding: 3px 8px; border-radius: 6px; }
.line.active { background: var(--panel-2); }
.line.hitline { box-shadow: inset 2px 0 0 var(--accent); background: var(--accent-softer); }
.line.hitline.active { background: var(--accent-soft); }
.line .t { font: 11.5px/24px var(--font-mono); color: var(--muted); cursor: pointer; }
.line .t:hover { color: var(--accent-text); }
.lt { font-size: 14px; line-height: 1.7; color: var(--text); }
.w { cursor: pointer; border-radius: 3px; }
.w:hover { background: var(--hover-strong); }
.w.active { background: var(--hl); color: var(--hl-text); }

@container mon (min-width: 680px) {
  .mon-grid {
    grid-template-columns: minmax(0, 1fr) var(--tx-w);
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "head tabs" "player tabs" "tl tl" "tp tp";
  }
  .player-stage { padding: 0 14px 14px 16px; }
  .player-box { width: 100%; height: 100%; aspect-ratio: auto; }
  .mon-tabs { border-top: 0; border-left: 1px solid var(--border); }
  .tabbar { height: 56px; padding: 0 10px 0 6px; gap: 0; }
  .tab { padding: 0 8px; }
  .tab.active::after { left: 8px; right: 8px; }
  .tabbar-right { gap: 8px; }
  .track-tabs { flex: 0 1 auto; min-width: 0; }
  .tabbar .switch > span:last-child { display: none; }
  .line { grid-template-columns: 48px minmax(0, 1fr); gap: 8px; padding: 3px 6px; }
  .lt { font-size: 13.5px; line-height: 1.65; }
  .tl { border-top: 1px solid var(--border); padding-top: 8px; }
  .tl-empty { margin-top: 2px; }
}

/* script list */
.script { flex: 1; min-height: 0; display: flex; }
.clip-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 12px; }
.clip-row {
  display: grid; grid-template-columns: 16px 112px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 8px 6px; border-radius: 8px; border: 1px solid transparent; cursor: pointer;
}
.clip-row + .clip-row { margin-top: 2px; }
.clip-row:hover { background: var(--hover); }
.clip-row.selected { background: var(--accent-softer); border-color: var(--accent-border); }
.clip-row.dragging { background: var(--panel); box-shadow: var(--shadow-md); border-color: var(--border-strong); cursor: grabbing; position: relative; z-index: 2; }
.cr-handle { display: grid; place-items: center; height: 63px; color: var(--muted); cursor: grab; opacity: .55; }
.clip-row:hover .cr-handle { opacity: 1; }
.cr-handle .i { width: 15px; height: 15px; }
.cr-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: var(--panel-3); }
.cr-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cr-dur { position: absolute; right: 3px; bottom: 3px; padding: 0 4px; border-radius: 3px; background: rgba(0, 0, 0, .74); color: #fff; font: 500 10.5px/15px var(--font-mono); }
.cr-body { min-width: 0; }
.cr-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cr-num { flex: none; padding: 0 5px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); font: 600 11px/18px var(--font-mono); }
.clip-row.playing .cr-num { background: var(--playhead); color: #fff; }
.cr-title { min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag-ai { flex: none; padding: 0 5px; border-radius: 4px; background: var(--ai-soft); color: var(--ai-fg); font-size: 10px; font-weight: 700; letter-spacing: .04em; line-height: 17px; }
.cr-tc { margin-top: 1px; font: 12px var(--font-mono); color: var(--accent-text); }
.cr-quote { margin-top: 3px; font-size: 13px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cr-edit { display: flex; gap: 6px; margin-top: 6px; }
.clip-note-input, .cr-role {
  height: 28px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font-size: 12.5px; padding: 0 8px;
}
.clip-note-input { flex: 1; min-width: 0; }
.clip-note-input::placeholder { color: var(--muted); }
.cr-role { width: 104px; flex: none; color: var(--text-2); }
.clip-note-input:hover, .cr-role:hover { border-color: var(--border-strong); }
.clip-note-input:focus, .cr-role:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.cr-actions { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .12s; }
.clip-row:hover .cr-actions, .clip-row.selected .cr-actions { opacity: 1; }

/* ---------- sequence dock ---------- */
.dock {
  display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: 0; overflow: hidden;
  background: var(--panel); border-top: 1px solid var(--border);
}
.dock-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 14px 12px 10px; border-right: 1px solid var(--border); }
.dock-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dock-label { font-size: 13px; font-weight: 600; margin-right: 2px; }
.dock-row-main .dock-stats { margin-left: auto; }
.dock-row-proj { padding-left: 4px; }
.dock-proj-btns { display: flex; gap: 0; flex: none; }
.proj-btn {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 10px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text);
  font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; transition: border-color .12s, background-color .12s;
}
.proj-btn:hover, .proj-btn.open { border-color: var(--border-stronger); background: var(--panel-2); }
.proj-btn:disabled { opacity: .6; cursor: default; }
.proj-btn-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-btn .i.chev { width: 14px; height: 14px; opacity: .65; }
.proj-menu { width: 440px; padding: 6px; }
.proj-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; margin-bottom: 4px; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.proj-search .i { width: 16px; height: 16px; }
.proj-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 13.5px; color: var(--text); }
.proj-search input::placeholder { color: var(--muted); }
.proj-search input:focus { box-shadow: none; }
.proj-list { max-height: min(340px, 50vh); overflow-y: auto; }
.proj-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 18px; gap: 10px; align-items: center; width: 100%; padding: 8px 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer;
}
.proj-item:hover, .proj-item.kb { background: var(--hover); }
.proj-item.active { background: var(--accent-softer); }
.proj-item.active.kb, .proj-item.active:hover { background: var(--accent-soft); }
.pi-main { display: block; min-width: 0; }
.pi-name { font-size: 13.5px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pi-name mark { padding: 0; }
.pi-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.proj-item > .i { width: 16px; height: 16px; color: var(--accent-text); }
.proj-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.dock-stats { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-row-actions { gap: 6px; margin-top: auto; padding-left: 4px; }
#playAllSeqBtn.is-on { color: var(--playhead); border-color: currentColor; }
.dock-chev { transition: transform .2s; }
.dock-track-area { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 8px 14px 10px 12px; }
.seq-head { display: flex; align-items: center; gap: 12px; height: 26px; flex: none; }
.seq-tc { font: 500 12.5px var(--font-mono); color: var(--text-2); white-space: nowrap; }
.seq-info { font-size: 12px; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seq-zoom { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.seq-scroll { position: relative; flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; border-radius: 8px; background: var(--panel-2); }
.seq-scroll::-webkit-scrollbar { height: 8px; }
.seq-inner { position: relative; height: 100%; min-width: 100%; }
.seq-ruler { position: absolute; left: 0; right: 0; top: 0; height: 18px; border-bottom: 1px solid var(--border); cursor: pointer; touch-action: none; user-select: none; }
.seq-ruler:hover { background: var(--hover); }
.sr-tick { position: absolute; top: 0; height: 18px; border-left: 1px solid var(--tl-tick); pointer-events: none; }
.sr-tick span { position: absolute; left: 4px; top: 1px; font: 10.5px/14px var(--font-ui); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.seq-blocks { position: absolute; left: 0; right: 0; top: 24px; bottom: 7px; touch-action: none; }
.seq-block {
  position: absolute; top: 0; bottom: 0; overflow: hidden; border-radius: 6px; background: #2a2622; cursor: grab; user-select: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .10); transition: box-shadow .12s;
}
.seq-block:hover { box-shadow: 0 0 0 1px rgba(0, 0, 0, .2), 0 2px 8px rgba(0, 0, 0, .14); }
/* the thumbnail is only a hint: dimmed + softly blurred so its baked-in text never fights our labels */
.sb-thumb { position: absolute; inset: -6px; background-size: cover; background-position: center; filter: blur(2px) saturate(.7) brightness(.5); }
.sb-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, .05) 45%, rgba(0, 0, 0, .2) 100%); }
.sb-strip { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--role-c, transparent); }
.seq-block[data-role="hook"] { --role-c: #e08a2c; }
.seq-block[data-role="body"] { --role-c: #5b8fd0; }
.seq-block[data-role="close"] { --role-c: #4fa36c; }
.seq-block[data-role="quote"] { --role-c: #a46fd6; }
.seq-block[data-role="b-roll"] { --role-c: #9a9288; }
.sb-top { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; align-items: center; gap: 4px; min-width: 0; z-index: 3; }
.sb-num { flex: none; min-width: 18px; padding: 0 5px; border-radius: 4px; background: rgba(255, 255, 255, .94); color: #1c1a17; font: 700 10.5px/17px var(--font-mono); text-align: center; }
.sb-ai { flex: none; padding: 0 5px; border-radius: 4px; background: var(--ai); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .04em; line-height: 17px; }
.sb-role { min-width: 0; padding: 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); color: #fff; font-size: 10.5px; font-weight: 500; line-height: 17px; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-del {
  margin-left: auto; flex: none; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px;
  background: rgba(0, 0, 0, .62); color: rgba(255, 255, 255, .9); cursor: pointer; opacity: 0; transition: opacity .12s, background-color .12s;
}
.sb-del .i { width: 12px; height: 12px; stroke-width: 2.2; }
.seq-block:hover .sb-del, .seq-block.selected .sb-del { opacity: 1; }
.sb-del:hover { background: var(--danger); color: #fff; }
.sb-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24px; padding: 0 8px; display: flex; align-items: center; gap: 6px;
  background: rgba(17, 15, 13, .94); border-top: 1px solid rgba(255, 255, 255, .07); color: #fff;
}
.sb-title { flex: 1; min-width: 0; font-size: 11.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-dur { flex: none; font: 500 10.5px var(--font-mono); color: rgba(255, 255, 255, .72); }
.seq-block.narrow .sb-title { display: none; }
.seq-block.narrow .sb-bottom { justify-content: center; padding: 0 4px; }
.seq-block.tiny .sb-role, .seq-block.tiny .sb-ai, .seq-block.tiny .sb-del { display: none; }
.sb-edge { position: absolute; top: 0; bottom: 0; z-index: 2; width: 9px; cursor: ew-resize; }
.sb-edge.l { left: 0; }
.sb-edge.r { right: 0; }
.sb-edge::after { content: ""; position: absolute; top: 32%; bottom: 32%; width: 3px; border-radius: 2px; background: rgba(255, 255, 255, .9); opacity: 0; transition: opacity .12s; }
.sb-edge.l::after { left: 2px; }
.sb-edge.r::after { right: 2px; }
.seq-block:hover .sb-edge::after, .seq-block.trimming .sb-edge::after { opacity: 1; }
.seq-block.selected { box-shadow: 0 0 0 2px var(--accent), 0 2px 10px rgba(0, 0, 0, .18); z-index: 1; }
.seq-block.playing { box-shadow: 0 0 0 2px var(--playhead); z-index: 1; }
.seq-block.dragging { z-index: 6; opacity: .92; cursor: grabbing; transition: none; box-shadow: 0 0 0 2px var(--accent), 0 10px 26px rgba(0, 0, 0, .32); }
.seq-insert { position: absolute; top: 20px; bottom: 3px; left: 0; z-index: 7; width: 2px; border-radius: 2px; background: var(--accent); pointer-events: none; }
.seq-playhead { position: absolute; top: 0; bottom: 0; left: 0; z-index: 5; width: 2px; margin-left: -1px; background: var(--playhead); opacity: .82; pointer-events: none; }
.seq-playhead::before { content: ""; position: absolute; top: 0; left: -6px; border: 7px solid transparent; border-top: 9px solid var(--playhead); border-bottom: 0; pointer-events: auto; cursor: grab; }
.seq-playhead.live { opacity: 1; }
.seq-empty { display: flex; align-items: center; justify-content: center; gap: 10px; height: 100%; padding: 0 16px; color: var(--muted); font-size: 13px; text-align: left; }
.seq-empty .i { width: 22px; height: 22px; stroke-width: 1.5; }

body.dock-collapsed .dock { grid-template-columns: minmax(0, 1fr); }
body.dock-collapsed .dock-track-area { display: none; }
body.dock-collapsed .dock-side { flex-direction: row; align-items: center; gap: 14px; padding: 7px 14px 7px 12px; border-right: 0; }
body.dock-collapsed .dock-row-proj .proj-btn { flex: 0 1 320px; }
body.dock-collapsed .dock-row-proj { flex: 0 1 420px; }
body.dock-collapsed .dock-row-main .dock-stats { margin-left: 8px; }
body.dock-collapsed .dock-row-actions { margin-top: 0; margin-left: auto; }
body.dock-collapsed .dock-chev { transform: rotate(180deg); }

/* ---------- toasts & job cards ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 16px); z-index: 90; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 14px; max-width: 520px; padding: 9px 14px; border-radius: 9px;
  background: var(--toast-bg); color: var(--toast-fg); font-size: 13.5px; box-shadow: var(--shadow-lg);
  pointer-events: auto; animation: toast-in .18s ease-out;
}
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
.toast-action { border: 0; background: transparent; color: var(--accent); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 0; }
:root:not([data-theme="dark"]) .toast-action { color: #f3a65f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.job-stack { position: fixed; right: 16px; bottom: calc(var(--dock-h) + 16px); z-index: 85; display: flex; flex-direction: column; gap: 8px; width: 340px; max-width: calc(100vw - 32px); }
.job-card { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); box-shadow: var(--shadow-lg); animation: toast-in .18s ease-out; }
.job-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-head .icon-btn { margin: -4px -6px -4px 0; }
.job-bar { height: 6px; margin: 10px 0 6px; overflow: hidden; border-radius: 3px; background: var(--panel-3); }
.job-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s ease; }
.job-card.is-done .job-fill { background: var(--ok); }
.job-card.is-error .job-fill { background: var(--danger); }
.job-card.is-error .job-status { color: var(--danger); }
.job-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.job-extra { max-width: 62%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); font-size: 11.5px; }
.job-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Visual mode: B-roll grid ---------- */
body.broll-mode .results-col { container-type: inline-size; }
body.broll-mode #topicsWrap, body.broll-mode #suggestBar, body.broll-mode #exportBtn { display: none !important; }
body.broll-mode .result-head { flex-wrap: wrap; justify-content: flex-start; gap: 4px 12px; padding: 2px 2px 10px; }
.broll-bar { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 4px 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border-soft); }
.bb-group { display: inline-flex; align-items: center; gap: 5px; }
.broll-bar .seg.sm button { padding: 0 6px; }
.bb-label { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.bb-toggle {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px 0 7px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-2); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.bb-toggle .i { width: 14px; height: 14px; }
.bb-toggle:hover { color: var(--text); border-color: var(--border-stronger); }
.bb-toggle.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-text); }
.result-info b { color: var(--text); font-weight: 600; }
.broll-interp { margin-left: auto; min-width: 0; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.broll-interp .bi-tag { color: var(--accent-text); font-weight: 500; }
.broll-interp .dot { margin: 0 5px; color: var(--muted); }
.broll-note { flex: 1 0 100%; display: flex; align-items: flex-start; gap: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.broll-note .i { width: 14px; height: 14px; margin-top: 1px; opacity: .8; }

#results.bgrid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
@container (min-width: 430px) { #results.bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 920px) { #results.bgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 1300px) { #results.bgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
#results.bgrid > .state-box { grid-column: 1 / -1; }

.bcard {
  position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; transition: border-color .15s, box-shadow .15s;
}
.bcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.bcard.sel { border-color: var(--accent-border); box-shadow: 0 0 0 2px var(--accent-soft-2); }
.bcard.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.bthumb { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #1d1a17; }
.bthumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.bthumb.noimg img { visibility: hidden; }
.bthumb.noimg { background: var(--panel-3); }
.bdur {
  position: absolute; right: 6px; bottom: 9px; padding: 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .78); color: #fff;
  font: 600 12px/20px var(--font-mono); letter-spacing: .01em; font-variant-numeric: tabular-nums;
}
.bmatch {
  position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px 0 6px;
  border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11px; font-weight: 500; line-height: 20px;
}
.bmatch i { width: 7px; height: 7px; border-radius: 50%; background: #a9a39a; }
.bmatch.m-strong i { background: #4cc27a; box-shadow: 0 0 0 2px rgba(76, 194, 122, .25); }
.bmatch.m-good i { background: #f0a040; }
.bmatch.m-weak { color: rgba(255, 255, 255, .8); }
.bnow {
  position: absolute; right: 6px; top: 6px; display: none; align-items: center; gap: 4px; height: 20px; padding: 0 8px 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; line-height: 20px;
}
.bnow .i { width: 10px; height: 10px; }
.bcard.playing .bnow { display: inline-flex; }
.bstrip { position: absolute; left: 6px; right: 6px; bottom: 3px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; pointer-events: none; }
.bstrip i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .38); }
.bstrip i.on { background: #fff; }
.bthumb:hover .bstrip { opacity: 1; }
.bft { position: absolute; left: 6px; bottom: 9px; padding: 0 6px; border-radius: 4px; background: rgba(0, 0, 0, .72); color: #fff; font: 500 11px/20px var(--font-mono); pointer-events: none; }
.bbody { display: flex; flex-direction: column; gap: 1px; min-width: 0; padding: 8px 10px 8px; }
.btitle { font-size: 13.5px; font-weight: 600; line-height: 1.35; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bmeta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.bmeta .dot { margin: 0 5px; }
.bm-tc { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); }
.bdesc { font-size: 11.5px; line-height: 1.38; color: var(--text-2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bmore-wrap { grid-column: 1 / -1; display: flex; justify-content: center; padding: 12px 0 8px; }
.bfoot { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 26px; margin-top: 5px; }
.bbadges { display: flex; flex-wrap: nowrap; gap: 4px; min-width: 0; overflow: hidden; }
.badge.bb-sg { background: var(--b-words-bg); color: var(--b-words-fg); }
.badge.bb-text { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.bacts { display: flex; align-items: center; gap: 1px; flex: none; opacity: 0; transition: opacity .12s; }
.bcard:hover .bacts, .bcard.sel .bacts, .bcard.playing .bacts, .bcard:focus-within .bacts { opacity: 1; }
@media (hover: none) { .bacts { opacity: 1; } }
.bacts .icon-btn { color: var(--muted); text-decoration: none; }
.bacts .icon-btn:hover { color: var(--accent-text); background: var(--accent-soft); }
.btn.badd { margin-left: 3px; gap: 3px; padding: 0 8px 0 6px; background: var(--accent-soft); color: var(--accent-text); }
.btn.badd:hover { background: var(--accent); color: #fff; }
.btn.badd .i { width: 13px; height: 13px; }
.bcard.skeleton { cursor: default; box-shadow: none; }
.bcard.skeleton .bthumb { background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.bcard.skeleton .bbody { padding: 6px 10px 10px; }
.bstate-ic { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-text); }
.bstate-ic .i { width: 22px; height: 22px; }
.bstate-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.bstate-home .examples { line-height: 2; }
.bstate-home .small + .small { margin-top: 6px; }
.vh-like { display: flex; align-items: center; gap: 10px; margin-top: 8px; min-width: 0; }
.vh-like img { flex: none; width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; cursor: pointer; background: var(--panel-3); }
.vh-like .vh-from { margin-top: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- small screens: let the page scroll instead of squeezing ---------- */
@media (max-width: 1100px), (max-height: 640px) {
  body { display: block; height: auto; min-height: 100vh; overflow: auto; }
  .topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); }
  .studio { grid-template-columns: minmax(0, 1fr); padding: 12px 16px; gap: 12px; }
  .gutter { display: none; }
  .results-col { max-height: 70vh; padding: 0; }
  .monitor { min-height: 820px; }
  .mon-grid { height: auto; min-height: 820px; }
  .dock { position: sticky; bottom: 0; height: var(--dock-h); z-index: 20; }
  .stats { display: none; }
}
