/* Colours, radii and fonts come from tokens.css only: a theme is a token set. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--page);
  color: var(--text);
  font: 14px/1.4 var(--font);
}

/* ---- the rail and the pages (P26) ------------------------------------------------ */
.rail {
  grid-column: 1; grid-row: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 0; background: var(--panel); border-right: 1px solid var(--line);
  backdrop-filter: var(--glass); min-height: 0;
}
.rail .logo {
  width: 36px; height: 36px; display: grid; place-items: center; margin-bottom: 12px;
  border-radius: var(--radius-sm); background: var(--logo-tile); color: var(--logo-mark);
}
.rail .logo .icon { width: 24px; height: 24px; }
.rail .grow { flex: 1; }
.nav {
  position: relative; display: grid; justify-items: center; gap: 3px; width: 64px; padding: 8px 0 6px;
  border: 0; border-radius: var(--radius-sm); background: none; color: var(--muted);
  font: 500 11px var(--font); text-decoration: none; cursor: pointer;
}
.nav .icon { width: 20px; height: 20px; }
/* H1c: "Plans" on the app and the website, the state under it (Free / Premium) */
.nav-sub { margin-top: -3px; font-size: 9px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.nav.premium .nav-sub { color: var(--mark); }
/* the account's name in a 64 px rail: cut with an ellipsis, whole in its tip */
#account-name { max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav:hover { background: var(--hover); color: var(--text); }
.nav.on { background: var(--hover); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav .badge {
  position: absolute; top: 3px; right: 10px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--remove); color: var(--on-fill); font-size: 10px; font-weight: 700;
  display: grid; place-items: center;
}
.side-grip { display: none; }
/* P56: Moments' summary beside the rail, from another page */
.rail-pop {
  position: fixed; left: 64px; top: 56px; z-index: 40; width: min(400px, calc(100vw - 80px)); max-height: calc(100vh - 80px);
  /* H3e: title, the columns' titles, the rows: a line each; opaque (--menu): the neon
     theme's 72 % panel let the page show through and the rows read badly */
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 6px; padding: 10px;
  background: var(--menu); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.rail-pop[hidden] { display: none; }
.rail-pop ol { overflow-y: auto; margin: 0; padding: 0; }  /* the summary's own rows (.list) */
.rail .help-pop { left: calc(100% + 8px); right: auto; top: auto; bottom: 0; }
.page { grid-column: 2; grid-row: 1; height: 100vh; min-width: 0; overflow-y: auto; }
/* --chrome-h: the height around the player (header, curve, filters, cut, dock): the
   player gets the rest. Measured: 0 px to scroll at 1920x1080 and 2560x1440 (P27). */
#page-moments { display: grid; grid-template-rows: auto auto 1fr auto; overflow: hidden; --chrome-h: 480px; }
#page-moments:has(.strip-wrap.open) { --chrome-h: 516px; }
.page-title {
  margin: 0; font: 600 18px var(--font-head); text-transform: var(--head-case);
  letter-spacing: var(--head-spacing); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#vod-name { max-width: 40vw; }

/* Library (P58b): a card per VOD, the strip's card: Twitch's picture, the chat curve
   small under it, the name. */
.vod-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px 18px; padding: 16px; }
/* P58c: a channel's heading when All shows several */
.vod-group {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; margin: 6px 0 -8px;
  font: 600 15px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.vod-group:first-of-type { margin-top: 0; }
.vod-group .count, .chip .count { color: var(--muted); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }
.lib-channels { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: none; color: var(--muted); font: 500 13px var(--font); cursor: pointer;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip[aria-pressed="true"] { color: var(--text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.vod-card, .analysing { display: grid; gap: 0; align-content: start; min-width: 0; cursor: pointer; border-radius: var(--radius); }
.vod-card:focus-visible { outline: none; }
.vod-thumb {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--raise);
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.vod-thumb > img:not([hidden]) { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.vod-thumb > .signature.big { position: absolute; inset: 0; height: auto; border-radius: 0; }
.vod-card > .signature { height: 26px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.vod-card .vod-thumb, .vod-card > .signature { transition: border-color .18s; }
.vod-card:hover .vod-thumb, .vod-card:hover > .signature,
.vod-card:focus-visible .vod-thumb, .vod-card:focus-visible > .signature { border-color: var(--accent); }
.vod-card > .signature .pin { top: 5px; }
.vod-card > .signature .pin:not(.star).listed { top: 7px; }
.vod-thumb-top { position: absolute; top: 6px; left: 6px; right: 6px; display: flex; align-items: center; gap: 6px; }
.vod-thumb-top > .thumb-badge { position: static; }
.vod-card-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .15s; }
.vod-card:hover .vod-card-actions, .vod-card:focus-within .vod-card-actions { opacity: 1; }
.vod-card-actions .btn { width: 28px; height: 28px; background: rgba(0, 0, 0, .66); }
.vod-card-actions .btn:hover:not(:disabled) { background: rgba(0, 0, 0, .85); }
.thumb-badge.moments { left: 6px; bottom: 6px; }
.vod-card-name {
  margin: 9px 0 2px; font: 600 15px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vod-card > .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The analysis under way: the card it will become, its progress over the picture */
.analysing { cursor: default; }
.analysing-veil {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 12px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); text-align: center;
}
.analysing .progress { width: 160px; }
.analysing #analyse-status { max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.analysing.failed #analyse-status { color: var(--error); }
#analysing-close { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; }
.analysing .vod-thumb { border-bottom: 1px solid var(--line); border-radius: var(--radius); }
.signature {
  position: relative; height: 56px; border-radius: var(--radius-sm); background: var(--sunken); overflow: hidden;
}
.signature svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.signature path { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
/* A pin per favourite (a gold star) and per moment in a montage (a violet dot);
   both: the star on the violet dot. */
.signature .pin {
  position: absolute; top: 4px; width: 15px; height: 15px; border-radius: 50%; transform: translateX(-50%);
  display: grid; place-items: center; cursor: pointer;
}
.signature .pin.listed { background: var(--make); box-shadow: 0 0 0 2px var(--sunken); }
.signature .pin:not(.star).listed { width: 11px; height: 11px; top: 6px; }
.signature .pin.star .icon { width: 13px; height: 13px; color: var(--mark); fill: var(--mark); }
.signature .pin.star.listed .icon { width: 10px; height: 10px; }
.empty-library { display: grid; justify-items: center; gap: 10px; padding: 40px 16px; text-align: center; grid-column: 1 / -1; }
.empty-library h2 { margin: 0; font: 600 20px var(--font-head); }

/* Library (P58, P58b): Find a VOD first, the analysed VODs under it, scrolling in their
   own box so the box and its source stay in sight (docs/design.md, rule 7). */
#page-library { display: grid; grid-template-rows: auto auto minmax(260px, 1fr); }
.finder {
  display: grid; gap: 16px; padding: 28px 24px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel); min-width: 0;
}
/* P58c: the search + Analyse centred on the page, the most important thing on it */
.finder-row { display: flex; gap: 10px; align-items: stretch; width: min(900px, 100%); justify-self: center; }
.finder-row > .btn.primary { height: 54px; padding: 0 24px; font-size: 16px; border-radius: var(--radius); }
/* The source, inside the box it changes (a search scope): proximity, design.md 2 */
.finder-scope { flex: none; padding: 2px; background: var(--panel); }
.finder-scope button { padding: 8px 12px; font-size: 14px; }
.finder-box {
  position: relative; flex: 1 1 auto; display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 14px 0 6px; border-radius: var(--radius);
  background: var(--sunken); border: 1px solid var(--line-strong);
  transition: border-color .15s, box-shadow .15s;
}
.finder-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.finder-box > .icon { width: 18px; height: 18px; color: var(--muted); flex: none; }
.finder-box input {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; outline: 0; background: none;
  color: var(--text); font: 400 16px var(--font);
}
.finder-box input::placeholder { color: var(--faint); }
.finder-box input::-webkit-search-cancel-button { cursor: pointer; }
.finder-box:focus-within > kbd { display: none; }

/* The suggestions: under the box, over the strip */
.finder-suggest {
  position: absolute; z-index: 30; left: -1px; right: -1px; top: calc(100% + 6px);
  display: grid; padding: 6px; border-radius: var(--radius);
  background: var(--menu); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.finder-option {
  display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: var(--radius-sm);
  cursor: pointer;
}
.finder-option[aria-selected="true"] { background: var(--hover); }
.finder-option-name { flex: 1 1 auto; display: grid; min-width: 0; font-weight: 500; }
.finder-option-name > * { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finder-avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%; object-fit: cover;
  display: grid; place-items: center; background: var(--raise); color: var(--muted);
}
.finder-avatar.vod { border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.finder-note { margin: 0; padding: 8px 10px; }
.live-pill {
  flex: none; padding: 1px 6px; border-radius: 4px; background: var(--live); color: #fff;
  font: 700 10px/1.6 var(--font); text-transform: uppercase; letter-spacing: .04em;
}

/* The channel's VODs: a strip of thumbnails, newest first */
.finder-head { display: flex; align-items: center; gap: 10px; min-height: 32px; margin-bottom: -6px; }
.finder-channel { font: 600 16px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing); }
.finder-head .muted.small, .vod-card > .muted.small, .channel-vod > .muted.small { font-size: 13px; }
.finder-vods {
  display: flex; gap: 16px; overflow-x: auto; padding: 4px 2px 6px; min-height: 212px;
  scrollbar-width: none;  /* no snap: it pulled each wheel step back to the same tile */
}
.finder-vods::-webkit-scrollbar { display: none; }
/* the side with more to see fades out: the strip says it goes on */
.finder-vods.more-on { mask-image: linear-gradient(to right, #000 calc(100% - 72px), transparent); }
.finder-vods.more-back { mask-image: linear-gradient(to left, #000 calc(100% - 72px), transparent); }
.finder-vods.more-on.more-back {
  mask-image: linear-gradient(to right, transparent, #000 72px, #000 calc(100% - 72px), transparent);
}
.channel-go {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: color-mix(in srgb, var(--make) 55%, rgba(0, 0, 0, .5)); color: #fff; font-weight: 600;
  opacity: 0; transition: opacity .15s;
}
.channel-vod:hover .channel-go, .channel-vod:focus-visible .channel-go { opacity: 1; }
.channel-vod {
  flex: 0 0 264px; display: grid; gap: 4px; align-content: start; text-align: left; padding: 0;
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
  border-radius: var(--radius-sm);
}
.channel-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-sm); background: var(--raise); border: 1px solid var(--line);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.channel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.channel-vod:hover .channel-thumb, .channel-vod:focus-visible .channel-thumb {
  transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 22%, transparent);
}
.channel-vod:focus-visible { outline: none; }
.channel-live { font: 700 11px var(--font); text-transform: uppercase; letter-spacing: .06em; color: var(--live); }
.thumb-badge {
  position: absolute; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px;
  border-radius: 4px; font: 600 12px/1.6 var(--font); font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .72); color: #fff; white-space: nowrap; width: max-content;
}
.thumb-badge.length { right: 6px; bottom: 6px; }
.thumb-badge .icon { width: 12px; height: 12px; stroke-width: 2.6; }
.channel-vod-title {
  font-size: 14px; font-weight: 500; line-height: 1.35; overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 4px;
}
.channel-vod.ghost { cursor: default; aspect-ratio: 16 / 9; height: auto; align-self: start;
  border-radius: var(--radius-sm); background: linear-gradient(100deg, var(--raise) 40%, var(--hover) 50%, var(--raise) 60%) 0 0 / 300% 100%;
  animation: ghost 1.2s linear infinite; }
@keyframes ghost { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .channel-vod.ghost { animation: none; }
  .channel-thumb, .finder-box, .channel-go, .vod-card-actions, .vod-card .vod-thumb { transition: none; }
}

/* A strip with nothing to show says why, and the one way on */
.finder-empty {
  flex: 1 1 auto; align-self: center; display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.finder-empty-text { display: grid; gap: 2px; flex: 1 1 auto; }
.finder-empty-icon {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}
.finder-empty-icon .icon { width: 20px; height: 20px; }

/* C2: not connected, the strip is a card: what Twitch brings, and the connection itself */
.connect-card {
  flex: 1 1 auto; align-self: center; display: flex; align-items: center; gap: 18px;
  padding: 20px 24px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: linear-gradient(120deg, var(--accent-soft), transparent 60%);
}
.connect-card-text { display: grid; gap: 8px; flex: 1 1 auto; min-width: 0; }
.connect-card-text strong { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.connect-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.connect-perks li { display: flex; align-items: center; gap: 8px; }
.connect-perks .icon { width: 15px; height: 15px; color: var(--ok); flex: none; }
.connect-card-go { display: grid; gap: 6px; justify-items: start; flex: 0 1 400px; }
/* waiting on Twitch: the instructions take the hint's place (the strip keeps its height) */
.connect-card-go:has(.twitch-code:not([hidden])) > .muted.small { display: none; }
.connect-card-go .connect-row { margin: 0; flex-wrap: wrap; }
.connect-card-go .twitch-code { margin: 0; }
.connect-email { font-size: 13px; color: var(--muted); }  /* H1c: the website's other way in */
.connect-email:hover { color: var(--text); }

/* C5: the connected account, on the channel row; its menu switches or disconnects */
.account-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font: 500 13px var(--font); cursor: pointer;
}
.account-chip:hover, .account-chip[aria-expanded="true"] { border-color: var(--accent); }
.account-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.account-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.account-chip.stale .account-dot { background: var(--mark); }  /* Twitch refused it: reconnect */
.connect-perks.steps li > b:first-child {
  display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none;
  border-radius: 50%; background: var(--accent-soft); color: var(--text); font-size: 11px;
}

.twitch-ask { width: min(480px, 92vw); }
.twitch-misses { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.twitch-misses li { display: grid; grid-template-columns: 16px 96px 1fr; align-items: center; gap: 8px; }
.twitch-misses .icon { width: 15px; height: 15px; color: var(--error); }
.twitch-ask .connect-status:empty { display: none; }
.twitch-ask .settings-actions span { margin-right: 0; }
.twitch-ask label.check { display: flex; align-items: center; gap: 6px; margin: 0 auto 0 0; cursor: pointer; }

/* Analysed: the VODs already here, their cards scrolling in their own box */
.analysed-vods { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.analysed-head { display: flex; align-items: center; gap: 14px; padding: 16px 24px 0; }
.analysed-head h2 { margin: 0; font: 600 16px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing); }
.analysed-head .count { color: var(--muted); font-weight: 500; margin-left: 4px; font-variant-numeric: tabular-nums; }
.analysed-vods > .vod-cards { overflow-y: auto; align-content: start; padding: 12px 24px 20px; }

/* A name renamed by a click on it (P28b): it says so on hover. */
.renamable { cursor: text; border-radius: var(--radius-sm); }
.renamable:hover { text-decoration: underline dotted var(--muted); text-underline-offset: 4px; }

/* Montages (P60): one page, master-detail. The montages on the left, each its covers;
   the one chosen on the right as what it will be: 9:16 shorts, a timeline to scale,
   the export at the end of the flow (docs/design.md 1). */
.montage-empty { display: grid; justify-items: center; gap: 10px; padding: 80px 16px; text-align: center; }
.montage-empty h2 { margin: 0; font: 600 20px var(--font-head); }
.montage-empty p { max-width: 420px; margin: 0; }
#page-montage { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.montage-split { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 0; }
.montage-rail {
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 12px; padding: 16px 14px;
  border-right: 1px solid var(--line); background: var(--panel); min-height: 0;
}
.montage-rail > .btn { justify-self: stretch; }
.montage-tiles { display: grid; gap: 10px; align-content: start; overflow-y: auto; padding: 2px; }
.montage-tile {
  display: grid; gap: 3px; padding: 8px; text-align: left; cursor: pointer; color: inherit; font: inherit;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
}
.montage-tile:hover { background: var(--hover); }
.montage-tile.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.montage-cover {
  display: flex; gap: 2px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm);
  background: var(--raise); margin-bottom: 4px;
}
.cover-slice { flex: 1 1 0; min-width: 0; background: var(--sunken); }
.cover-slice img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-empty { margin: auto; }
.montage-tile-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* P62: the montage as it comes out on top (the screen takes the height left, docs/
   design.md 7), its timeline under it, each short's picture under its own segment;
   the inspector beside it. */
.montage-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; min-width: 0; min-height: 0; }
.montage-stage {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; gap: 10px;
  padding: 16px 24px 14px; min-width: 0; min-height: 0;
}
.montage-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.montage-title {
  margin: 0; font: 600 20px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.montage-head > .muted { white-space: nowrap; font-size: 14px; }
/* the screen: 9:16, as tall as the stage allows, in the middle */
.mv-screen { position: relative; min-height: 0; height: 100%; }
/* absolute: in the flow, the canvas's own 960 px set the row's height (it measured 963) */
#mv-canvas {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  height: 100%; aspect-ratio: 9 / 16; width: auto; max-width: 100%;
  border-radius: var(--radius); background: #000; border: 1px solid var(--line); cursor: pointer;
  touch-action: none;
}
.mv-note {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); padding: 3px 10px;
  border-radius: 999px; background: rgba(0, 0, 0, .7); color: #fff; font-size: 12px; white-space: nowrap;
}
.mv-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mv-time { font: 600 14px var(--font); font-variant-numeric: tabular-nums; }
.mv-bar .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the timeline: a label column, then the lanes; everything in it placed in % of the
   montage's length, the thumbnails too, so a short's picture sits under its segment */
.tl { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 6px; user-select: none; }
.tl-labels { display: grid; grid-auto-rows: 28px; gap: 4px; align-items: center; justify-items: center; color: var(--muted); }
.tl-labels .icon { width: 15px; height: 15px; }
.tl-lanes { position: relative; display: grid; grid-auto-rows: 28px; gap: 4px; touch-action: none; cursor: text; }
.tl-track { position: relative; border-radius: 6px; background: var(--sunken); }
.tl-seg, .tl-bar { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; gap: 6px; min-width: 6px;
  overflow: hidden; white-space: nowrap; font-size: 12px; border-radius: 6px; }
.tl-seg {
  padding: 0 10px; justify-content: center; cursor: pointer;
  background: color-mix(in srgb, var(--short-color, var(--accent)) 40%, var(--raise));
  box-shadow: inset -1px 0 0 var(--bg), inset 1px 0 0 var(--bg);  /* a cut between two shorts */
}
.tl-seg.on { background: color-mix(in srgb, var(--short-color, var(--accent)) 75%, var(--raise)); color: #fff; }
.tl-seg-label b { font-weight: 700; }
.tl-bar { padding: 0 10px; }
.tl-bar .icon { width: 13px; height: 13px; flex: none; }
.tl-bar.music {
  background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--make) 40%, transparent) 0 2px, transparent 2px 5px),
    color-mix(in srgb, var(--make) 22%, var(--raise));
}
.tl-bar.logo { background: color-mix(in srgb, var(--show) 40%, var(--raise)); cursor: grab; }
/* the handles: an edge to drag, wider than it looks */
.tl-handle {
  position: absolute; top: 0; bottom: 0; width: 10px; z-index: 1; cursor: ew-resize;
  background: linear-gradient(90deg, transparent 3px, rgba(255, 255, 255, .85) 3px 5px, transparent 5px);
  opacity: 0; transition: opacity .12s;
}
.tl-handle.in, .tl-handle.from { left: 0; }
.tl-handle.out, .tl-handle.to { right: 0; }
.tl-seg:hover .tl-handle, .tl-seg.on .tl-handle, .tl-bar:hover .tl-handle { opacity: 1; }
.tl-empty {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px; cursor: pointer;
  font-size: 12px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 6px;
}
.tl-empty:hover { color: var(--text); border-color: var(--accent); }
.tl-empty .icon { width: 13px; height: 13px; }
.tl-playhead {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; z-index: 2; pointer-events: none;
  background: var(--text); box-shadow: 0 0 0 1px var(--bg);
}
/* the shorts' pictures: absolute, the same left and width as their segments */
.cards.tl-thumbs {
  position: relative; display: block; height: 76px; margin: 0 0 0 34px; padding: 0; overflow: visible;
  border-color: transparent;  /* dashed only while dragging */
}
.cards.tl-thumbs .empty { padding: 26px 0; }
.tl-thumbs .card.short {
  position: absolute; top: 0; bottom: 0; display: flex; justify-content: center; padding: 0;
  background: none; border: 0; cursor: grab; min-width: 0;
}
.tl-thumbs .card.short.drop-before::before { left: 0; }
.tl-thumbs .short-poster {
  position: relative; height: 100%; aspect-ratio: 9 / 16; overflow: hidden; border-radius: 6px; background: #000;
  border: 1px solid var(--line); transition: border-color .15s, transform .15s;
}
.tl-thumbs .card.short:hover .short-poster { border-color: var(--line-strong); transform: translateY(-2px); }
.tl-thumbs .card.short.on .short-poster { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tl-thumbs .card.short:focus-visible { outline: none; }
.tl-thumbs .card.short:focus-visible .short-poster { border-color: var(--accent); }
.short-canvas { display: block; width: 100%; height: 100%; }
.tl-thumbs .pos {
  position: absolute; bottom: 3px; left: 3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  display: grid; place-items: center; background: rgba(0, 0, 0, .75); color: #fff; font: 700 10px var(--font);
}
/* the inspector's chosen short */
.sel-pos {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--accent); color: var(--on-fill); font: 700 12px var(--font);
}
.sel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#short-sel .insp-title { align-items: center; }
.sel-layout select { width: 100%; }
.sel-layout, .sel-cut { grid-column: 2 / 4; font-variant-numeric: tabular-nums; }
.sel-actions { display: flex; gap: 8px; }
.sel-actions > .btn:first-child { flex: 1 1 auto; }

/* the inspector: Logo, Music, then the export at the foot, the page's one primary */
.montage-inspector {
  display: flex; flex-direction: column; gap: 0; min-height: 0; overflow-y: auto;
  border-left: 1px solid var(--line); background: var(--panel);
}
.insp-group { display: grid; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.insp-title { display: flex; align-items: baseline; gap: 8px; margin: 0; font: 600 14px var(--font); }
.insp-title .icon { align-self: center; width: 16px; height: 16px; color: var(--muted); }
.insp-drop {
  display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; font-size: 14px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--text);
}
.insp-drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.insp-drop .icon { color: var(--make); }
.insp-drop > span { display: grid; }
.insp-set { display: grid; gap: 10px; }
.insp-file { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.insp-file > span { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-file img {
  width: 36px; height: 36px; object-fit: contain; border-radius: 6px;
  background: repeating-conic-gradient(var(--raise) 0 25%, var(--sunken) 0 50%) 0 0 / 10px 10px;
}
.insp-line { display: grid; grid-template-columns: 64px minmax(0, 1fr) 48px; align-items: center; gap: 8px; font-size: 13px; }
.insp-line > span:first-child { color: var(--muted); }
.insp-line input[type=range] { width: 100%; accent-color: var(--make); }
.insp-line output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.insp-export { margin-top: auto; border-bottom: 0; border-top: 1px solid var(--line); }
.insp-export .montage-folder { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-export .montage-folder #montage-folder { color: var(--text); }
.insp-export > .btn { justify-self: stretch; }
.insp-export > .btn.primary { height: 44px; font-size: 15px; }
.insp-export .export-status:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .short-poster, .tl-handle { transition: none; } }

/* Trash: a row per deleted VOD. */
.trash-rows { display: grid; gap: 8px; padding: 16px; max-width: 980px; }
.trash-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.trash-row strong { font-weight: 600; }
.confirm-dialog { width: min(420px, 92vw); }
.confirm-field { width: 100%; box-sizing: border-box; margin: 4px 0 12px; }
button, select, textarea, input { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- buttons: one grammar ---------------------------------------------------------
   <button class="btn act-mark" data-tip="Bookmark" data-key="b"> icon <span class="word">
     .btn             transparent, the icon in its kind of action's colour
     .act-*           make · cut · mark · show · remove   (tokens.css)
     .on              pressed: a soft fill and a border of that colour
     .primary         filled: one per screen
     .outline         a word-only button that needs an edge (Change…, Browse…)
     .square          icon only
   Settings › Appearance › Buttons = Icons hides the words beside an icon, except on
   the primary: the one action of the screen keeps its word. */
.act-make { --act: var(--make); }
.act-cut { --act: var(--cut); }
.act-mark { --act: var(--mark); }
.act-show { --act: var(--show); }
.act-remove { --act: var(--remove); }

.icon {
  width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text); cursor: pointer; white-space: nowrap; flex: none;
}
.btn > .icon { color: var(--act, var(--muted)); }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.on, .btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--act, var(--accent)) 16%, transparent);
  border-color: color-mix(in srgb, var(--act, var(--accent)) 45%, transparent);
}
.btn.primary { background: var(--act, var(--make)); color: var(--on-fill); font-weight: 600; padding: 0 14px; }
.btn.primary > .icon { color: inherit; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--act, var(--make)) 85%, white); }
.btn.outline { border-color: var(--line); }
.btn.square { width: 32px; padding: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
/* Icons mode (H4c3, user 2026-11-03): only a menu or a category goes bare (.icon-only:
   Clips, Bookmarked, Style, Dictionary, Shown); an action keeps its word ("Export this
   clip" was a lone upload icon). Squeezed to its icon, it sits by its neighbours */
[data-labels="icons"] .btn.icon-only:has(> .icon) > .word { display: none; }
[data-labels="icons"] .btn.icon-only:has(> .icon):has(> .word):not(:has(> .count)) { width: 32px; padding: 0; }

/* One tooltip for every button: its name and its key, on hover and on keyboard focus
   (a native title shows late, never on focus, and has no room for the key). */
.tip {
  position: fixed; z-index: 50; pointer-events: none; display: flex; align-items: center; gap: 8px;
  padding: 4px 8px; border-radius: 6px; font-size: 12px; white-space: nowrap;
  background: var(--raise); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
}
kbd, .tip kbd {
  font: 500 11px/1.4 var(--font); color: var(--muted); background: var(--sunken);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px;
}

/* What just happened, and the way back (Undo / Redo): bottom centre, over the dock. */
.toast {
  position: fixed; z-index: 40; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px;
  border-radius: var(--radius); background: var(--raise); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); backdrop-filter: var(--glass);
}
.toast .btn { height: 28px; }

/* ---- top bar ------------------------------------------------------------------- */
.top, .filters, .bottom {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 16px;
}
.top {
  background: var(--panel); border-bottom: 1px solid var(--line); backdrop-filter: var(--glass);
  flex-wrap: nowrap; min-height: 52px;
}
#stats, #analyse-status { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#analyse-status { max-width: 420px; }
#analyse-status.error { color: var(--error); }
.spacer { flex: 1 1 0; }
.sep { width: 1px; height: 20px; background: var(--line); flex: none; }
select {
  background: var(--menu); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 5px 8px;
}
/* The open list is drawn by Chrome on white: a see-through theme colour left white
   text on white (Neon). Opaque, always. */
option { background: var(--menu); color: var(--text); }

/* The analysis bar: filled to the job's fraction, striped while it runs so a stage
   with no percentage of its own (ranking, the judge) still shows it is alive. */
.progress {
  flex: none; width: 140px; height: 8px; border-radius: 4px;
  background: var(--raise); border: 1px solid var(--line); overflow: hidden;
}
.progress > span {
  display: block; height: 100%; width: 0; background: var(--make);
  transition: width .4s ease;
  background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%,
    transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%);
  background-size: 12px 12px;
  animation: progress-stripes 0.8s linear infinite;
}
@keyframes progress-stripes { to { background-position: 12px 0; } }
@media (prefers-reduced-motion: reduce) { .progress > span { animation: none; } }

.help { position: relative; flex: none; }
.help-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  padding: 8px 12px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: 12px;
  white-space: nowrap; backdrop-filter: var(--glass);
}
.help:hover .help-pop, .help:focus-within .help-pop { display: block; }
.help-pop td { padding: 2px 10px 2px 0; color: var(--muted); }
.help-pop td:first-child { text-align: right; }
.help-pop kbd { color: var(--text); }
.vod-title { width: 320px; }

/* ---- dialogs ------------------------------------------------------------------- */
/* Analyse (P59): one button in two, its options in a popover under it */
.split-analyse { position: relative; display: flex; flex: none; }
.split-analyse > .btn.primary { height: 54px; font-size: 16px; }
.split-main { padding: 0 20px 0 22px; border-radius: var(--radius) 0 0 var(--radius); }
.split-more {
  width: 46px; padding: 0; border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--on-fill) 28%, transparent);
}
.split-more[aria-expanded="true"] { background: color-mix(in srgb, var(--make) 80%, black); }
.split-more .icon { transition: transform .2s ease; }
.split-more[aria-expanded="true"] .icon { transform: rotate(60deg); }
.mic-tag { font-weight: 500; opacity: .85; }
.analyse-pop {
  position: absolute; z-index: 35; top: calc(100% + 8px); right: 0; width: 360px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; border-radius: var(--radius);
  background: var(--menu); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.pop-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pop-group + .pop-group { padding-top: 12px; border-top: 1px solid var(--line); }
.pop-label { font: 600 11px var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.analyse-pop label.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.analyse-pop label.check > span:first-of-type { display: grid; }
.analyse-pop label.check input { margin: 3px 0 0; accent-color: var(--make); width: 16px; height: 16px; }
.analyse-pop label.missing > :not(.needs) { opacity: .5; }
.analyse-pop .needs { margin-left: auto; align-self: center; color: var(--muted); white-space: nowrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--show); font: inherit; cursor: pointer; text-decoration: underline; }
.analyse-pop label.soon { opacity: .55; cursor: default; align-items: center; }
.soon-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: var(--accent-soft); color: var(--text);
}
.pop-line { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.pop-line > input, .mic-row > input {
  flex: 1 1 0; width: 0; min-width: 0; height: 32px; padding: 0 10px; color: var(--text);  /* width 0: a field's ~20 characters widened the popover */
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm); text-overflow: ellipsis;
}
.pop-line > span:first-child { flex: none; }
.stepper { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.stepper input {
  width: 52px; height: 32px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums;
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm); -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.pop-foot { display: flex; align-items: center; gap: 8px; }
.pop-foot:has(> :not([hidden])) { padding-top: 2px; }
.finder.dropping .finder-box { border-style: dashed; border-color: var(--accent); }
.finder-box.want { border-color: var(--error); box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 18%, transparent); }
.finder-hint { margin: -8px 0 0; justify-self: center; color: var(--error); font-size: 13px; }
.settings {
  width: min(560px, 92vw); background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
  backdrop-filter: var(--glass);
}
.settings::backdrop { background: rgba(0, 0, 0, .6); }
.close-x { position: absolute; top: 10px; right: 10px; }
.settings h3 {
  margin: 0 0 8px; font: 600 15px var(--font-head);
  text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.settings label { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; }
.settings input {
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 8px; color: var(--text);
}
.settings a { color: var(--show); }
.settings a.off { color: var(--muted); opacity: .5; pointer-events: none; text-decoration: none; }
.settings code { background: var(--raise); padding: 0 4px; border-radius: 4px; }
.settings .steps { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 4px; }
.connect-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 4px; }
.twitch-code { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
/* C3: waiting on Twitch, what to click there; the code only on demand */
.twitch-code .spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .twitch-code .spinner { animation: none; } }
.code-fallback { flex-basis: 100%; }
.code-fallback summary { cursor: pointer; width: max-content; }
.code-fallback code { font: 600 14px var(--mono); letter-spacing: .08em; }
#connect-status.ok { color: var(--ok); }
#connect-status.error { color: var(--error); }
.settings details { margin: 6px 0; }
.settings summary { cursor: pointer; }
.settings-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.settings-actions span { margin-right: auto; }
.settings .cache-title { margin-top: 16px; }

/* Settings in panels (S1): tabs on the left, one panel on the right. A fixed size, so a
   tab never makes the dialog jump; a long panel (the dictionary) scrolls inside. */
.settings-panes { width: min(820px, 94vw); height: min(560px, 88vh); padding: 0; overflow: hidden; }
.settings-panes form { display: grid; grid-template-columns: 184px minmax(0, 1fr); height: 100%; }
.settings-nav {
  display: flex; flex-direction: column; gap: 2px; padding: 16px 10px;
  background: var(--raise); border-right: 1px solid var(--line);
}
.settings-nav h2 {
  margin: 0 0 12px 10px; font: 600 17px var(--font-head);
  text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.settings-nav [role=tab] {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-align: left;
  background: none; border: 0; border-radius: var(--radius-sm); color: var(--muted);
  font: inherit; font-size: 14px; cursor: pointer;
}
.settings-nav [role=tab]:hover { background: var(--hover); color: var(--text); }
/* H1: the chosen tab's mark, a pill inside it: an inset shadow followed the rounded
   corners and read as a bar cut off at the left */
.settings-nav [role=tab][aria-selected="true"] { position: relative; background: var(--hover); color: var(--text); }
.settings-nav [role=tab][aria-selected="true"]::before {
  content: ""; position: absolute; left: 3px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 2px; background: var(--accent);
}
.settings-nav [role=tab][hidden] { display: none; }
.settings-nav .icon { width: 16px; height: 16px; flex: none; }
.settings-body { display: flex; flex-direction: column; min-height: 0; padding: 18px 24px 14px; }
/* H1b: a scroller clips what passes its edge: 4 px for the focus ring (2 px + 2 px offset,
   the dictionary's field cut on the left), taken back by the margin: the text stays put */
.settings-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 32px 4px 4px; margin: -4px 0 -4px -4px; }
.settings-panel h3 { font-size: 18px; margin-bottom: 4px; }
.settings-panel .lead { margin: 0 0 18px; max-width: 52ch; }
.settings-panes .settings-actions { margin-top: 8px; min-height: 20px; }
.cache { width: 100%; border-collapse: collapse; font-size: 13px; }
.cache td { padding: 3px 6px 3px 0; }
.cache .num { text-align: right; font-variant-numeric: tabular-nums; }
.cache .total td { border-top: 1px solid var(--line); font-weight: 600; }

/* Settings › Appearance: a theme is picked by its look, the buttons by a switch. */
.appearance { display: grid; grid-template-columns: 80px 1fr; gap: 10px 14px; align-items: center; margin-bottom: 6px; }
.themes-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-card {
  display: grid; gap: 6px; min-width: 0; padding: 6px; cursor: pointer; text-align: left;
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.theme-card[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card .look {
  height: 52px; border-radius: 4px; display: grid; grid-template-columns: 12px 1fr; gap: 4px; padding: 5px;
  background: var(--page); box-shadow: inset 0 0 0 1px var(--line);
}
.theme-card .look i { display: block; border-radius: 2px; background: var(--raise); }
.theme-card .look .bar { align-self: end; height: 9px; width: 55%; background: var(--make); }
.theme-card .nm {
  font-size: 13px; font-weight: 600; font-family: var(--font-head);
  text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.views-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.view-card {
  display: grid; justify-items: center; align-content: end; gap: 4px; min-width: 58px; height: 62px;
  padding: 6px 6px 5px; cursor: pointer; color: var(--muted);
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.view-card:hover { color: var(--text); }
.view-card[aria-checked="true"] { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.view-card .nm { font-size: 11px; }
.segmented { justify-self: start; display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-sm); background: var(--sunken); border: 1px solid var(--line); }
.segmented button {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 0; border-radius: 5px;
  background: none; color: var(--muted); cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--hover); color: var(--text); }

/* ---- the activity strip --------------------------------------------------------- */
/* On the title's line, folded to a thin line (a row of its own took the height VIEW
   AS needed): it opens down over the filters under the pointer, without moving them,
   or stays open once pinned (remembered by the browser), the title line growing. */
#page-moments > .top { position: relative; z-index: 7; }
.strip-wrap { position: relative; flex: 1 1 auto; min-width: 160px; align-self: stretch; }
.strip-wrap.open { min-height: 74px; }
/* The strip is two layers: the games as coloured bands, the chat activity over them. */
.strip-box {
  position: absolute; left: 0; right: 40px; top: calc(50% - 9px); height: 18px;
  background: var(--panel); border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--line); transition: height .15s ease;
}
.strip-wrap:hover .strip-box, .strip-wrap.open .strip-box { height: 66px; }
.strip-wrap.open .strip-box { top: 4px; }
.strip-wrap:hover:not(.open) .strip-box { box-shadow: var(--shadow); background: var(--menu); }
.strip-wrap:not(:hover):not(.open) .band-label { display: none; }
.strip-pin { position: absolute; right: 0; top: calc(50% - 14px); width: 32px; height: 28px; }
.strip-pin .icon { transition: transform .15s ease; }
.strip-wrap.open .strip-pin .icon { transform: rotate(180deg); }
.games { position: absolute; inset: 0; pointer-events: none; }
.band {
  position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--game);
  background: color-mix(in srgb, var(--game) 30%, transparent);
}
.band-label {
  display: block; padding: 1px 5px; font-size: 10px; color: var(--text); opacity: .9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#strip {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  cursor: crosshair;
}
#strip .area { fill: color-mix(in srgb, var(--accent) 50%, transparent); }
/* Every moment a faint tick at the foot; a favourite gold over the top half, one in a
   montage violet over the bottom half (both: both halves). */
#strip .tick { stroke: var(--faint); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#strip .tick.star { stroke: var(--mark); stroke-width: 3; }
#strip .tick.listed { stroke: var(--make); stroke-width: 3; }
#strip .tick.hidden { opacity: .3; }
#strip .now { stroke: var(--text); stroke-width: 1; vector-effect: non-scaling-stroke; }

/* ---- filters ------------------------------------------------------------------- */
.filter-group { display: inline-flex; gap: 2px; }
.filter-group:empty { display: none; }
.cat-dot { width: 12px; height: 12px; border-radius: 50%; }
.chip-word { font-size: 12px; }
.search {
  width: 240px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 6px 10px; color: var(--text);
}

/* ---- list ---------------------------------------------------------------------- */
.body {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr;
  min-height: 0; border-top: 1px solid var(--line); position: relative;  /* the side grip (P56) */
}
.side { overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); backdrop-filter: var(--glass); }
.side-title {
  margin: 0; padding: 12px 12px 4px; font: 600 12px var(--font-head); text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
}
.list { list-style: none; margin: 0; padding: 4px; }
/* H3c: star · kind · signal · name · ✓ · score · time */
:root { --row-cols: 18px 12px 16px 16px minmax(0, 1fr) 12px 34px 56px; }  /* H3d: + the dot */
.list li {
  /* H3c: star, kind, signal, name, ✓, score, time; the eye over the time on hover */
  display: grid; grid-template-columns: var(--row-cols); gap: 6px; align-items: center;
  padding: 7px 8px 7px 10px; border-left: 3px solid transparent; cursor: pointer;
  border-radius: var(--radius-sm); position: relative;
}
/* the category, seen (H3d: the edge alone was missed): its colour on the edge and a tint */
.list li.grouped { border-left-color: var(--group); background: color-mix(in srgb, var(--group) 13%, transparent); }
.list li.grouped:hover { background: color-mix(in srgb, var(--group) 22%, transparent); }
.list .cat {
  width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 1.5px solid var(--line-strong);
  background: none; cursor: pointer; justify-self: center;
}
.list .cat.on { border-color: var(--group); background: var(--group); }
.list .cat:hover { border-color: var(--text); }
/* never opened: bold and bright, as unread mail; seen: plain and grey (the user: the bold
   alone did not tell them apart) */
.list .what-text { color: var(--muted); }
.list li.new .what-text { font-weight: 650; color: var(--text); }
.list .done { color: var(--make); font-size: 12px; }
/* the score in its own pill, so it never reads as part of the time beside it */
.list .score {
  justify-self: end; min-width: 30px; padding: 2px 5px; border-radius: 999px; box-sizing: border-box;
  background: var(--raise); font: 600 11px/1.2 var(--mono); color: var(--text); text-align: center;
}
/* H3c: the kind's colour on its icon; the signal grey */
.list .type, .list .signal { display: grid; place-items: center; }
.list .type .icon, .list .signal .icon { width: 14px; height: 14px; }
.list .signal { color: var(--muted); }
.type-marker { color: var(--marker); }
.type-viewer { color: var(--viewer); }
.type-candidate { color: var(--accent); }
.legend {
  display: grid; gap: 2px; padding: 6px 8px; position: sticky; bottom: 0; margin-top: auto;
  background: var(--menu); border-top: 1px solid var(--line);  /* opaque: rows pass under it */
}
.legend-row {
  display: grid; grid-template-columns: 16px auto auto 1fr; gap: 6px; align-items: baseline; padding: 4px 6px;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm); text-align: left;
  font: 500 12px var(--font); cursor: pointer;
}
.legend-row .icon { width: 14px; height: 14px; align-self: center; }
.legend-row b { color: var(--text); font-weight: 600; }
.legend-count { font: 11px var(--mono); color: var(--muted); }
.legend-says { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.legend-row:hover { background: var(--raise); }
.legend-row.on { border-color: currentColor; background: color-mix(in srgb, currentColor 10%, transparent); }
/* the same columns as the rows (--row-cols), fixed but the name's, so each title sits
   over its cells; Type spans the kind and the signal */
.list-cols {
  display: grid; grid-template-columns: var(--row-cols); gap: 6px;
  padding: 6px 12px 2px 17px; color: var(--muted); font: 600 10px var(--font);
  text-transform: uppercase; letter-spacing: .06em;
}
/* H3d: the titles are the sort: Type over the kind and signal, Name over the name and ✓ */
.list-cols button {
  padding: 0; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit;
  text-transform: inherit; text-align: left; cursor: pointer; white-space: nowrap;
}
.list-cols button:hover { color: var(--text); }
.list-cols button.on { color: var(--accent); }
.list-cols[hidden] { display: none; }
.list-cols .col-priority { grid-column: 3 / 5; }
.list-cols .col-name { grid-column: 5 / 7; }
.list-cols .col-score { text-align: center; }
.list .when { font: 12px/1 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.filter-group .count { margin-left: 4px; font: 11px var(--mono); color: var(--muted); }
.row-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; display: grid; place-items: center;
  background: var(--raise); border: 0; border-radius: 4px; color: var(--remove); cursor: pointer;
  visibility: hidden;
}
.row-eye .icon { width: 14px; height: 14px; }
.list li:hover .row-eye, .row-eye.on { visibility: visible; }
.row-eye:hover { background: var(--hover); }
.list li:hover { background: var(--raise); }
.list li.sel { background: var(--hover); border-left-color: var(--accent); }
.list .star { color: var(--line-strong); display: grid; place-items: center; }
.list .star .icon { width: 15px; height: 15px; }
.list .star.on { color: var(--mark); }
.list .star.on .icon { fill: currentColor; }
.list li.hidden { opacity: .45; }
/* A piece (P30): under its moment, indented, its length where the score bar was. */
.list li.piece { padding-left: 22px; }
.list .piece-len { font: 600 11px/1 var(--mono); color: var(--cut); }
.list li.editing { grid-template-columns: 1fr; cursor: default; }
/* The category dropdown under a row's tile. */
.group-menu {
  position: fixed; z-index: 20; min-width: 170px; padding: 4px; display: grid;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); backdrop-filter: var(--glass);
}
.group-entry {
  display: flex; align-items: center; gap: 8px; padding: 5px 8px; text-align: left;
  background: none; border: 0; border-radius: 5px; cursor: pointer;
}
.group-entry:hover { background: var(--raise); }
.group-entry.on { background: color-mix(in srgb, var(--mark) 14%, transparent); }
.group-entry.on::after { content: "✓"; margin-left: auto; color: var(--muted); }
.group-entry .dot, .group-pill .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.group-entry .dot.none, .group-pill .dot.none { border: 1px solid var(--muted); }
.row-name {
  min-width: 0; background: var(--sunken); border: 1px solid var(--accent); border-radius: 4px;
  padding: 3px 6px; color: var(--text);
}
.list .what { display: flex; align-items: center; gap: 4px; min-width: 0; }
.list .what-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.row-rename {
  flex: none; visibility: hidden; display: grid; place-items: center; padding: 2px; cursor: pointer;
  background: none; border: 0; border-radius: 4px; color: var(--muted);
}
.row-rename .icon { width: 13px; height: 13px; }
.row-rename:hover { color: var(--text); background: var(--hover); }
.list li:hover .row-rename, .row-rename:focus-visible { visibility: visible; }
.list .when { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.list .rank {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px;
  padding: 0 4px; margin-left: 6px;
}
.themes li { grid-template-columns: 1fr auto; }
.themes-box summary { cursor: pointer; user-select: none; }
.themes-box summary:hover { color: var(--text); }

/* ---- detail -------------------------------------------------------------------- */
.detail {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 16px; align-items: start; overflow-y: auto; padding: 12px 16px; min-width: 0;
}
/* The detail: a title row, one line of facts, one of links. */
.title-row { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 4px; align-items: center; }
.title-row .total {
  font: 700 20px var(--font-head); color: var(--text); font-variant-numeric: tabular-nums; margin: 0 4px;
}
.title-field {
  min-width: 0; background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 4px 6px; color: var(--text); font: 600 18px var(--font-head);
  text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.title-field::placeholder { color: var(--muted); }
.title-field:hover { border-color: var(--line); }
.title-field:focus { border-color: var(--accent); outline: none; background: var(--panel); }
.btn.act-mark.on > .icon { fill: currentColor; }
.meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 6px 0 0;
  color: var(--muted); font-size: 13px;
}
.group-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); font-size: 12px; cursor: pointer;
}
.group-pill:hover { border-color: var(--mark); }
.group-pill .caret { color: var(--muted); width: 13px; height: 13px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0 12px; font-size: 13px; }
.links a { color: var(--show); text-decoration: none; }
.links a:hover { text-decoration: underline; }
.in-export { color: var(--make); font-weight: 600; }
.marker-note { color: var(--marker); }
.info .block:first-of-type { margin-top: 12px; }

/* The player gets the height left between the filters and the export dock, and the
   width that height allows: at full column width the dock covered Twitch's own
   timeline and the layout buttons. */
.player {
  position: relative; aspect-ratio: 16 / 9; margin: 0 auto;
  width: min(100%, calc((100vh - var(--chrome-h)) * 16 / 9)); min-width: 320px;
  background: #000; border-radius: var(--radius-sm); overflow: hidden;
}
.info, .info-col { min-width: 0; }
.info .head { margin-top: 0; }
.player iframe, .player video {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000;
}
.player video { object-fit: contain; }
/* B3: a layout drawn by the page over the moment's local copy, which plays under it. */
.player canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
/* Twitch | Preview, over the layouts: the two halves of one switch, wide enough to hit. */
/* In the trimmer: its buttons are the cut's green, the switch keeps the segmented look. */
.segmented.source { flex: none; margin-right: 8px; }
.trimmer .segmented.source button {
  padding: 4px 10px; font-weight: 600; background: none; color: var(--muted); border-color: transparent;
}
.trimmer .segmented.source button[aria-checked="true"] { background: var(--hover); color: var(--text); }
.trimmer .segmented.source button.busy { opacity: .6; cursor: progress; }
/* The local copy's reach on the cut's timeline: the preview plays inside, Twitch outside. */
.trim-track .reach { position: absolute; top: 0; bottom: 0; background: var(--menu); }
.twitch-host { position: absolute; inset: 0; }
/* A 9:16 render in a 16:9 box is a sliver; give it the height instead. */
/* Height = the window minus header, strip, filters, footer and the layout bar, so the
   buttons stay on screen. */
.player.vertical {
  aspect-ratio: 9 / 16; width: auto; margin: 0 auto;
  height: clamp(320px, calc(100vh - var(--chrome-h)), 960px); min-width: 0;
}
.stage { min-width: 0; }
.view-as-row { display: flex; align-items: flex-end; gap: 12px; }
.list-add { margin-left: auto; flex: none; }
.list-add .btn { max-width: 260px; }
.list-add .btn .word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Already in: a quiet edge, not the fill that asks to be clicked. */
.list-add .btn.primary.in-list { background: none; color: var(--text); border: 1px solid var(--act); }
.list-add .btn.primary.in-list > .icon { color: var(--act); }
.list-add .btn.primary.in-list:hover:not(:disabled) { background: var(--hover); }
.layouts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
/* A pictogram of what each layout frames (P27), its key under it: no names. */
.layouts { align-items: flex-end; }
.layouts button {
  position: relative; display: grid; justify-items: center; gap: 3px; min-width: 40px;
  background: var(--raise); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 7px 3px; cursor: pointer; color: var(--muted);
}
.pictogram { display: block; }
.layouts button:hover:not(:disabled) { color: var(--text); background: var(--hover); }
.layouts button.ready { color: var(--text); }
.layouts button.active {
  border-color: color-mix(in srgb, var(--cut) 55%, transparent); color: var(--cut);
  background: color-mix(in srgb, var(--cut) 14%, transparent);
}
.layouts button.chosen::after {
  content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--make);
}
.layouts button.busy { border-style: dashed; border-color: var(--cut); }
.layouts button:disabled { opacity: .35; cursor: not-allowed; }
.layouts .key { font-size: 10px; line-height: 1; color: var(--faint); }
/* ✥ framing (B3c): apart from the layouts, the same button; the canvas grabs. */
/* P47: the app's Moments, the way to Editing and to the montage, on the trimmer's row */
.tc-row:has(.tc-go) { grid-template-columns: 1fr auto auto 1fr; }
.tc-go { display: flex; align-items: center; gap: 6px; }
.trimmer .edit-big { padding: 8px 18px; font-size: 15px; gap: 8px; }
.trimmer .edit-big .icon { width: 18px; height: 18px; }
.player canvas.framing { cursor: grab; touch-action: none; }
.player canvas.framing:active { cursor: grabbing; }
.render-status { margin-top: 6px; }
.render-status:empty { display: none; }  /* no line kept for a status that is not there */
.render-status.error { color: var(--error); }
.player-empty { position: absolute; inset: 0; display: grid; place-items: center; }

/* The export cut, drawn like an editor's timeline under the viewer: timecodes on
   top, a ruler, one clip on a track with trim handles, a playhead over both. */
.trimmer {
  width: min(100%, calc((100vh - var(--chrome-h)) * 16 / 9)); min-width: 320px; margin: 8px auto 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px 10px;
  user-select: none; backdrop-filter: var(--glass);
}
#page-edit .trimmer { width: 100%; min-width: 0; }  /* E2: under the source, its width */
.rail .nav.off { opacity: .45; cursor: not-allowed; }
/* P46: the Editing page, the export dock under it as under Moments */
#page-edit { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; }
/* each column scrolls on its own: a click on the last layout card scrolled the whole
   grid, the source out of sight (P48) */
#page-edit .ed-grid { overflow: hidden; min-height: 0; align-items: stretch; }
#page-edit .ed-grid > * { overflow-y: auto; min-height: 0; }
/* P49 (design.md rule 7): each column fills the height and keeps its controls in sight;
   the picture (source, phone) takes what is left (container units), the layout cards
   scroll inside their own list */
#page-edit .ed-presets { display: flex; flex-direction: column; overflow: hidden; }
#page-edit .ed-preset-list { flex: 1 1 0; min-height: 0; overflow-y: auto; align-content: start; padding: 2px; }
.ed-layout-tools { display: grid; gap: 6px; margin-bottom: 8px; }
.ed-layout-tools .btn { width: 100%; justify-content: center; }
#page-edit .ed-stage, #page-edit .ed-side {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; overflow: hidden;
}
.ed-source-box, .phone-box { container-type: size; min-height: 120px; display: grid; place-items: center; }
/* H4a: the lanes may take the stage's room: no floor under them, and pulled to the top
   the stage goes (the phone beside still shows the short) */
#page-edit.caps-mode .ed-source-box { min-height: 0; }
#page-edit.tracks-full .ed-source-box { display: none; }
/* H4a3: no height of its own (shown in Layouts too, it cost the source its size): a
   10 px hit zone and its bar drawn over the trimmer's top edge */
.ed-grip { height: 0; position: relative; z-index: 4; cursor: ns-resize; touch-action: none; }
.ed-grip::after { content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 10px; }
.ed-grip[hidden] { display: none; }
.ed-room { border-radius: 4px; background: var(--sunken); }
/* H4a3: a lane's icon moves it (up / down), its bottom edge stretches it */
.cap-lane-grip { pointer-events: auto; cursor: grab; display: grid; place-items: center; width: 16px; height: 18px; border-radius: 4px;
  position: relative; z-index: 5; background: var(--sunken); }  /* H8h: over the tiles (one hid it) */
.cap-lane-grip:hover { background: var(--hover); color: var(--text); }
.cap-lane-grip:active { cursor: grabbing; }
.cap-lane-size { position: absolute; left: 0; right: 0; height: 5px; cursor: ns-resize; z-index: 2; }
.cap-lane-size:hover { background: color-mix(in srgb, var(--accent) 45%, transparent); }
/* H4a: a text held under the last lane: dropped there, it gets a lane of its own */
.cap-track.drop-below { box-shadow: inset 0 -2px 0 var(--accent); }
.ed-grip::before {
  content: ""; position: absolute; left: 50%; top: 1px; width: 44px; height: 4px; margin-left: -22px;
  border-radius: 2px; background: var(--line-strong);
}
.ed-grip:hover::before, .ed-grip:active::before { background: var(--accent); }
/* H4a: the timeline's zoom on the timecodes' line */
.trim-zoom { display: inline-flex; align-items: center; gap: 4px; }
.trim-zoom button {
  width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none;
  color: var(--muted); font: 600 14px/1 var(--font); cursor: pointer;
}
.trim-zoom button:hover { color: var(--text); border-color: var(--line-strong); }
.trim-zoom-range { width: 90px; accent-color: var(--accent); }
.trim-zoom-icon { display: grid; place-items: center; color: var(--muted); }  /* H4c2 */
.trim-zoom-icon .icon { width: 14px; height: 14px; }
/* H4c2: the video track's bottom edge, dragged: taller or shorter */
.trim-track .trim-size { position: absolute; left: 0; right: 0; height: 4px; z-index: 4; cursor: ns-resize; }
.trim-track .trim-size.edge-top { top: 0; }  /* H4c3: its top edge too */
.trim-track .trim-size.edge-bottom { bottom: 0; }
.trim-track .trim-size:hover { background: color-mix(in srgb, var(--accent) 45%, transparent); }
/* H4c2: a setting in a right-click menu: its name, its slider, its value */
.ctx-range { display: grid; grid-template-columns: 58px 1fr 48px; align-items: center; gap: 6px;
  padding: 4px 8px; font-size: 12px; }
.ctx-range input { width: 100%; accent-color: var(--accent); }
.ctx-range output { font: 11px var(--mono); color: var(--muted); text-align: right; }
#page-edit .phone-box { position: relative; }  /* F1d: #cap-bar is placed on it */
.ed-source-box .ed-source, .ed-source-box .ed-twitch { width: min(100cqw, 100cqh * 16 / 9); }
.ed-twitch { aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-sm); overflow: hidden; }
.speed { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.speed input { width: 84px; accent-color: var(--accent); }
.speed-val { min-width: 3.2ch; font-variant-numeric: tabular-nums; color: var(--text); }
.speed.set .speed-val { color: var(--cut); font-weight: 600; }  /* P63a: a clip not at 1x */
.phone-box .phone { width: min(100cqw, (100cqh - 2 * var(--phone-pad)) * var(--screen-w) + 2 * var(--phone-pad)); max-width: none; margin: 0; }
.phone.app-drawn .ed-preview { bottom: auto; height: auto; aspect-ratio: 9 / 16; }
/* H4b: an app's screen drawn from the user's screenshots: every spot placed in % of the
   screen, sized in its height (cqh); a text's or an icon's spot is its middle */
.app-ui .ui { position: absolute; box-sizing: border-box; }
.app-ui .ui.text { transform: translateY(-50%); white-space: nowrap; line-height: 1.2; font-weight: 500; }
.app-ui .ui.text.mid { transform: translate(-50%, -50%); }
.app-ui .ui.text.wrap { transform: none; width: 80%; white-space: normal; line-height: 1.43;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-ui .bold { font-weight: 700; }
.app-ui .dim { color: var(--app-dim); }
.app-ui .ui.glyph { transform: translate(-50%, -50%); display: grid; }
.app-ui .ui.glyph .icon { width: 100%; height: 100%; stroke-width: 2; fill: none; }
.app-ui .ui.glyph.solid .icon { fill: currentColor; }
.app-ui .ui.glyph.heavy .icon { stroke-width: 3.2; }
.app-ui .ui.glyph.dark { color: var(--app-dark); }
.app-ui .ui.glyph.dark .icon { stroke-width: 4; }
.app-ui .ui.box { display: grid; place-items: center; font-weight: 700; line-height: 1; }
.app-ui .box.ink { background: var(--app-ink); }
.app-ui .box.ink-ig { background: var(--app-ink-ig); }
.app-ui .box.ink-yt { background: var(--app-ink-yt); }
.app-ui .box.white { background: #fff; color: var(--app-dark); }
.app-ui .box.red { background: var(--app-red); color: #fff; }
.app-ui .box.round { border-radius: 99px; }
.app-ui .box.plus-tt { border-radius: 1.2cqh; box-shadow: -.35cqh 0 var(--app-tt-cyan), .35cqh 0 var(--app-red); font-size: 3cqh !important; }
.app-ui .box.line { background: var(--app-line); }
.app-ui .box.track { background: var(--app-line); }
.app-ui .box.outline { border: .15cqh solid #fff; border-radius: .8cqh; }
.app-ui .box.pill { border-radius: 99px; }
.app-ui .box.field { background: var(--app-field); border-radius: 99px; place-items: center start; padding-left: 5.9%;
  font-weight: 400; color: var(--app-dim); }
.app-ui .app-face { display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--app-avatar); }
.app-ui .app-face img { width: 100%; height: 100%; object-fit: cover; }
.app-ui .app-face.square { border-radius: .7cqh; border: .2cqh solid #fff; }
.app-ui .app-face.ring { border: .15cqh solid #fff; }
.app-ui .app-face.ring-ig { border: .3cqh solid transparent;
  background: linear-gradient(var(--app-avatar), var(--app-avatar)) padding-box,
    linear-gradient(45deg, var(--app-ig-ring-1), var(--app-ig-ring-2)) border-box; }
.app-ui .app-face.disc { border: .55cqh solid var(--app-disc); }
.app-ui .app-initial { font-size: 2cqh; font-weight: 700; }
/* H4b: the shortcuts window */
.keys-dialog { width: min(640px, 94vw); }
.keys-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; max-height: 66vh; overflow-y: auto; }
.keys-group h4 { margin: 4px 0 6px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.keys-row { display: grid; grid-template-columns: 112px 1fr; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; }
.keys-keys { color: var(--muted); }
.keys-keys kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--raise); color: var(--text); }
.tc-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.tc-side { display: flex; align-items: center; gap: 6px; }
.tc-side.end { justify-content: flex-end; }
.tc-mid { display: flex; align-items: center; gap: 8px; }
.tc {
  font: 600 17px/1 var(--mono); letter-spacing: .02em;
  background: var(--sunken); border: 1px solid var(--line); border-radius: 4px; padding: 4px 8px;
  cursor: pointer;
}
.tc:hover { border-color: var(--cut); }
/* The cut's length: green when it fits a short, amber above (export.short_seconds);
   filled once a cut is set, outlined while it is still the preview's span. */
.tc-len {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 14px/1 var(--mono); color: var(--cut);
  padding: 4px 8px; border-radius: 4px; background: color-mix(in srgb, var(--cut) 12%, transparent);
}
.tc-len .icon { width: 14px; height: 14px; }
.tc-len.long { color: var(--mark); background: color-mix(in srgb, var(--mark) 14%, transparent); }
.tc-len.set { color: var(--on-cut); background: var(--cut); }
.tc-len.set.long { color: #2a1d00; background: var(--mark); }
.trimmer button {
  display: inline-flex; align-items: center; gap: 5px;
  background: color-mix(in srgb, var(--cut) 12%, transparent); color: var(--cut);
  border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 13px; line-height: 1; padding: 5px 8px;
}
.trimmer button .icon { width: 14px; height: 14px; }
.trimmer button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--cut) 50%, transparent); }
.trimmer button:disabled { opacity: .35; cursor: default; }
.trimmer .play-cut { padding: 5px 9px; }
/* Under each handle: −1 · here · +1, following the handle, kept inside the timeline. */
.trim-steps { position: relative; height: 28px; margin-top: 4px; }
.step-group { position: absolute; top: 0; transform: translateX(-50%); display: flex; gap: 2px; }
.step-group[hidden] { display: none; }
.trimmer .step { padding: 4px 7px; font: 600 11px/1 var(--font); }

.trim-timeline { position: relative; margin-top: 8px; cursor: text; touch-action: none; }
.trim-ruler {
  position: relative; height: 22px; border-bottom: 1px solid var(--line);
  background: var(--sunken); border-radius: 4px 4px 0 0; overflow: hidden;
}
.trim-ruler .tick { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--line-strong); }
.trim-ruler .tick.major { height: 8px; background: var(--faint); }
.trim-ruler .tick.label { height: 12px; background: var(--muted); }
.trim-ruler .tick span {
  position: absolute; bottom: 11px; left: 3px; font: 10px/1 var(--mono);
  color: var(--muted); white-space: nowrap;
}
/* Outside the cut: hatched, like media past a clip's edges. */
.trim-track {
  position: relative; height: var(--trim-h, 40px); border-radius: 0 0 4px 4px; overflow: hidden;
  background: repeating-linear-gradient(135deg, var(--sunken) 0 6px, var(--raise) 6px 12px);
}
.trim-track .clip {
  position: absolute; top: 3px; bottom: 3px; cursor: grab;
  background: color-mix(in srgb, var(--cut) 26%, var(--menu)); border: 1px solid var(--cut); border-radius: 4px;
}
/* The default span (no cut set yet) is filled too, a shade lighter: the length pill says set or not. */
.trim-track .clip:not(.set) { background: color-mix(in srgb, var(--cut) 14%, var(--menu)); border-color: color-mix(in srgb, var(--cut) 55%, transparent); }
/* The other pieces of a split moment: pale, named; a click selects one. */
.trim-track .clip.piece-block {
  cursor: pointer; background: color-mix(in srgb, var(--cut) 8%, var(--menu));
  border: 1px dashed color-mix(in srgb, var(--cut) 45%, transparent);
}
.trim-track .clip.piece-block:hover { border-style: solid; }
.trimmer .delete-piece { color: var(--remove); background: color-mix(in srgb, var(--remove) 12%, transparent); }
.trim-track .clip-name {
  position: absolute; inset: 0 14px; display: flex; align-items: center; font-size: 12px;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
/* H4c: the cut's frames inside its block only, under its name and handles */
.trim-track .clip-frames { position: absolute; inset: 0; overflow: hidden; border-radius: 3px; pointer-events: none; }
.trim-track .clip-frame { position: absolute; top: 0; bottom: 0; background: center / cover no-repeat;
  border-right: 1px solid color-mix(in srgb, var(--menu) 60%, transparent); }
.trim-track .clip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.trim-track .clip.framed .clip-label, .trim-track .clip-speed {
  padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--menu) 78%, transparent);
  overflow: hidden; text-overflow: ellipsis;
}
.trim-track .clip-speed { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; flex: none;
  font: 600 11px/1 var(--mono); color: var(--cut); }
.trim-track .clip-speed .icon { width: 11px; height: 11px; }
.trim-track .handle {
  position: absolute; top: -1px; bottom: -1px; width: 10px; cursor: ew-resize;
  background: var(--cut); border-radius: 3px;
}
.trim-track .handle.in { left: -1px; border-radius: 4px 0 0 4px; }
.trim-track .handle.out { right: -1px; border-radius: 0 4px 4px 0; }
.trim-track .handle::after {
  content: ""; position: absolute; top: 30%; bottom: 30%; left: 4px; width: 2px;
  background: var(--on-cut); border-radius: 1px; opacity: .6;
}
.trim-track .anchor {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--mark); pointer-events: none;
}
.trim-track .anchor::before {
  content: ""; position: absolute; top: -4px; left: -4px; width: 8px; height: 8px;
  background: var(--mark); transform: rotate(45deg);
}
.trim-head {
  position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px;
  background: var(--text); pointer-events: none;
}
.trim-head::before {
  content: ""; position: absolute; top: 0; left: -5px;
  border: 6px solid transparent; border-top: 8px solid var(--text);
}
.trim-timeline.dragging-move .clip { cursor: grabbing; }
.trim-timeline.dragging-in, .trim-timeline.dragging-out { cursor: ew-resize; }
.trimmer { container-type: inline-size; }
/* Narrow: IN and OUT side by side, the middle controls under them. */
@container (max-width: 620px) {
  .tc-row { grid-template-columns: 1fr 1fr; }
  .tc-mid { grid-column: 1 / -1; grid-row: 2; justify-content: center; flex-wrap: wrap; }
  .tc-go { grid-column: 1 / -1; grid-row: 3; justify-content: center; }  /* Edit, + Add */
  .tc-row:has(.tc-go) { grid-template-columns: 1fr 1fr; }
  .tc { font-size: 15px; }
}

.head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 8px;
}
.head h2 { margin: 0; font-size: 18px; }
.swatch { width: 20px; height: 20px; border-radius: 50%; flex: none; display: inline-block; }
.groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.settings .group { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.settings .group input { flex: 1; min-width: 0; padding: 4px 8px; }
.tag {
  border-radius: 4px; padding: 1px 8px; font-size: 12px; background: var(--raise);
  border: 1px solid var(--line);
}
.tag.viewer { border-color: var(--viewer); color: var(--viewer); }
.tag.marker { border-color: var(--marker); color: var(--marker); }
.facts { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); margin-bottom: 10px; }
.facts a { color: var(--show); }
.said { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.said li { background: var(--raise); border-radius: 6px; padding: 3px 8px; }
.voice-said blockquote {
  margin: 6px 0 0; padding: 6px 10px; border-left: 3px solid var(--accent);
  background: var(--raise); border-radius: 0 6px 6px 0; font-size: 15px; line-height: 1.4;
}
.voice-said mark { background: none; color: var(--accent); font-weight: 700; }
/* The chat as Twitch draws it: dark column, time, coloured name, message. */
.twitch-chat {
  position: relative; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px;
  max-height: 260px; overflow-y: auto; font-size: 13px; line-height: 1.5;
}
.twitch-chat .msg { padding: 2px 6px; overflow-wrap: anywhere; border-left: 3px solid transparent; }
.twitch-chat .msg.context { opacity: 0.45; }
.twitch-chat .msg.counted { border-left-color: var(--accent); background: var(--accent-soft); }
.twitch-chat .ts { color: var(--muted); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.twitch-chat .who { font-weight: 700; color: color-mix(in srgb, var(--name), #000 var(--name-shade)); }
.view-as { margin-top: 8px; }
.why { list-style: none; margin: 2px 0 10px; padding: 0; display: grid; gap: 1px 8px;
  grid-template-columns: auto auto 1fr; font-size: 13px; }
.why li { display: contents; }
.why li.zero > * { opacity: .5; }
.why b { color: var(--accent); font-variant-numeric: tabular-nums; text-align: right; }
.why-part { display: grid; place-items: center; color: var(--muted); }
.why-part .icon { width: 15px; height: 15px; }
.block { margin: 0 0 12px; }
.block .label {
  color: var(--muted); font: 600 12px var(--font-head); text-transform: uppercase; letter-spacing: .06em;
}
.moments { list-style: none; padding: 0; margin: 4px 0; }
.moments li { padding: 4px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.moments li:hover { color: var(--accent); }
textarea {
  width: 100%; min-height: 72px; resize: vertical;
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px;
}
textarea:focus { border-color: var(--mark); outline: none; }

/* ---- the export dock ----------------------------------------------------------- */
.dock {
  background: var(--panel); border-top: 1px solid var(--line); padding: 6px 16px 8px;
  display: grid; gap: 6px; min-width: 0; backdrop-filter: var(--glass);
}
.dock-bar { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dock-bar > * { flex: none; }
.dock-bar > .spacer { flex: 1 1 0; }
.dock-title {
  cursor: help; display: inline-flex; align-items: center; gap: 6px;
  font: 600 14px var(--font-head); text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.dock-title .icon { color: var(--make); }
.dock-bar .folder { flex: 0 1 auto; min-width: 60px; max-width: none; }
#export-status { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#export-status.error { color: var(--error); }
.list-name {
  max-width: 200px; padding: 4px 6px; border: 0; background: none; color: var(--text);
  font: inherit; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.name-input {
  width: 180px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 5px 8px; color: var(--text);
}
.folder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.cards {
  list-style: none; margin: 0; padding: 4px; display: flex; gap: 8px; overflow-x: auto;
  min-height: 68px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
}
.cards.over { border-color: var(--make); background: color-mix(in srgb, var(--make) 10%, transparent); }
.cards .empty { align-self: center; padding: 0 8px; }
.card {
  position: relative; flex: 0 0 250px; display: grid; grid-template-columns: auto 1fr auto;
  gap: 6px; align-items: start; padding: 6px 8px; background: var(--raise);
  border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: grab; user-select: none;
}
.card.marker { border-left-color: var(--marker); }
.card.viewer { border-left-color: var(--viewer); }
/* H5b: the moment on screen, in the bar: quiet (an accent border read as a glow) */
.card.sel { border-color: var(--line-strong); background: var(--hover); }
.card.dragging { opacity: .4; }
.card.drop-before::before {
  content: ""; position: absolute; left: -6px; top: 4px; bottom: 4px; width: 3px;
  border-radius: 2px; background: var(--make);
}
.card .pos { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-body { min-width: 0; display: grid; gap: 4px; }
.card-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.card-clip, .card-vod { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-clip { flex: 1 1 auto; min-width: 0; }
.card-vod { flex: none; max-width: 45%; color: var(--muted); font-size: 11px; }
.card-meta { display: flex; min-width: 0; overflow: hidden; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.card-meta select { padding: 1px 4px; font-size: 12px; }
.card-meta .cut { white-space: nowrap; color: var(--cut); }
.list-switch { position: relative; }
.list-switch select { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.card .x {
  display: grid; place-items: center; width: 20px; height: 20px; padding: 0;
  background: none; border: 0; border-radius: 4px; color: var(--remove); cursor: pointer;
}
.card .x .icon { width: 14px; height: 14px; }
.card .x:hover { background: var(--hover); }

/* ---- where it runs (docs/web.md) -------------------------------------------------
   <html data-where="web|app">, from /api/mode: one PC's things are not on the website,
   the Twitch account is not in the app. A locked control keeps its place and wears a
   lock in its corner; a click on it says why (openLocked). */
html[data-where="web"] .app-only { display: none !important; }
html:not([data-where="web"]) .web-only { display: none !important; }
html[data-guest] .member-only { display: none !important; }  /* W8: the website, signed out */
#sign-in-form { display: grid; gap: 10px; }
.sign-in-twitch { justify-content: center; }
.sign-in-or { text-align: center; margin: 2px 0 0; }
.sign-in-email { display: grid; gap: 4px; }
.sign-in-email input { width: 100%; }
/* a montage with no short: its empty line alone, centred, no black 9:16 (2026-10-31) */
.montage-stage.empty :is(.mv-screen, .mv-bar, #montage-timeline) { display: none; }
.montage-stage.empty #montage-list { display: grid; place-items: center; align-self: stretch;
  height: auto; max-height: none; text-align: center; }  /* row 2, the 1fr */
a.btn { text-decoration: none; }
:is(.btn, .layouts button, .tc-mid button, .group-pill):has(> .lock-mark) { position: relative; }
svg.lock-mark {
  position: absolute; right: 1px; bottom: 1px; width: 12px; height: 12px; padding: 1px;
  border-radius: 3px; background: var(--raise); color: var(--muted);
  fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
}
.nav > svg.lock-mark { top: 4px; right: 16px; bottom: auto; }
.btn.primary > svg.lock-mark { background: var(--sunken); color: var(--text); }
.trimmer.locked .clip, .trimmer.locked .handle { cursor: not-allowed; }
/* No export bar on the website: its ~120 px go to the player (--chrome-h, P27). */
html[data-where="web"] #page-moments { --chrome-h: 360px; }
html[data-where="web"] #page-moments:has(.strip-wrap.open) { --chrome-h: 396px; }
.nav.premium > .icon { color: var(--mark); }
#export-dialog-status.error { color: var(--error); }
.export-dialog { width: min(440px, 92vw); }
.export-dialog .formats { display: grid; gap: 6px; margin: 10px 0 4px; }
.export-dialog label.check { display: flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; color: var(--text); }
.export-dialog input[type=radio] { padding: 0; }

/* #/pricing: the two plans side by side, the beta above, the Connect code under. */
.beta-banner {
  display: flex; align-items: center; gap: 8px; margin: 16px auto 0; padding: 10px 14px;
  box-sizing: border-box; max-width: min(736px, calc(100% - 32px));
  border-radius: var(--radius); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.beta-banner .icon { color: var(--accent); }
/* centred (2026-10-31): two cards on the left of a wide page read as unfinished */
.plans {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 320px)); gap: 16px; padding: 16px;
  justify-content: center;
}
.plan {
  display: flex; flex-direction: column; gap: 12px; padding: 18px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: var(--glass);
}
.plan.premium { border-color: color-mix(in srgb, var(--mark) 55%, transparent); }
/* H7: a card chosen like a radio; the same rows on each, label left, value right */
.plan { cursor: pointer; }
.plan.chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); cursor: default; }
.plan-dot {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none;
}
.plan.chosen .plan-dot { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }
.plan-title { margin: 0; display: grid; gap: 2px; }
.plan ul li { justify-content: space-between; align-items: center; min-height: 22px; }
.plan-label { color: var(--muted); }
.plan-value { font-weight: 700; }
.plan .plan-yes .icon { color: var(--ok); margin: 0; }
.plan .plan-no .icon { color: var(--muted); opacity: .6; margin: 0; }
/* H7c: compared across the plans: alike quiet, the one ahead lit, a lack in red */
.plan li.alike .plan-yes .icon { color: var(--muted); }
.plan li.alike .plan-value { color: var(--muted); font-weight: 600; }
.plan li.bonus .plan-yes .icon, .plan li.bonus .plan-value { color: var(--ok); }
.plan li.bonus .plan-label { color: var(--text); }
.plan li.bonus .plan-value { display: inline-flex; align-items: center; gap: 4px; }
.plan li.bonus .plan-value .icon { width: 14px; height: 14px; margin: 0; }
.plan li.short .plan-no .icon { color: var(--remove); opacity: 1; }
.plan li.short .plan-value { color: var(--muted); font-weight: 500; }
.plan h2 {
  margin: 0; display: flex; align-items: center; gap: 8px; font: 600 18px var(--font-head);
  text-transform: var(--head-case); letter-spacing: var(--head-spacing);
}
.plan h2 .icon { color: var(--mark); }
.plan-price { margin: 0; font: 600 26px var(--font-head); }
.plan ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plan li { display: flex; align-items: flex-start; gap: 8px; }
.plan li .icon, .plan-mine .icon { color: var(--ok); margin-top: 1px; }
.plan-mine {
  margin: 0; display: flex; align-items: center; gap: 6px; padding-top: 10px;
  border-top: 1px solid var(--line); font-weight: 600;
}
.plan-get { display: grid; gap: 6px; justify-items: start; margin-top: auto; }  /* H7b: the bottom */
.plan > .plan-mine { margin-top: auto; }
.plan-get p { margin: 0; }
.subscribe-box {
  display: grid; gap: 10px; margin: 0 auto 16px; padding: 14px 18px;
  box-sizing: border-box; max-width: min(736px, calc(100% - 32px));
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.subscribe-box p { margin: 0; display: flex; align-items: center; gap: 6px; }
.subscribe-box .ok { color: var(--ok); }
.subscribe-box .error { color: var(--error); }
.code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
#licence-key { width: 270px; font-family: var(--mono); letter-spacing: .04em; text-transform: uppercase; }
.user-code {
  padding: 4px 12px; font: 600 24px var(--mono); letter-spacing: .12em;
  background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-sm);
}

/* P49 (docs/design.md rule 7): no scroll to reach a control down to 1280x720. The
   player takes the height the page leaves (container units of .player-box), not a
   guessed --chrome-h; the chat scrolls inside its own box, the note stays in sight. */
@media (min-width: 1101px) {
  .detail { align-items: stretch; overflow: hidden; grid-template-rows: auto minmax(0, 1fr); }
  .stage { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-height: 0; }
  .player-box { container-type: size; min-height: 120px; display: grid; place-items: center; }
  .player-box .player { width: min(100cqw, 100cqh * 16 / 9); min-width: 0; height: auto; }
  .player-box .player.vertical { width: min(100cqw, 100cqh * 9 / 16); height: auto; }
  .stage .trimmer { width: 100%; min-width: 0; }
  .info-col { min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
  .info { display: flex; flex-direction: column; min-height: 0; flex: 1; }
  .info > .block:has(.twitch-chat) { flex: 1 1 auto; min-height: 80px; display: flex; flex-direction: column; }
  .info .twitch-chat { max-height: none; flex: 1 1 0; min-height: 0; }
}

@media (max-width: 1100px) {
  .detail { grid-template-columns: 1fr; }
  .montage-split { grid-template-columns: 200px minmax(0, 1fr); }  /* P60: the montages narrower */
}

@media (max-width: 760px) {
  .groups { grid-template-columns: 1fr; }
  #page-moments { grid-template-rows: auto auto auto auto auto; overflow-y: auto; }
  .vod-cards { grid-template-columns: 1fr; }
  .body { grid-template-columns: 1fr; }
  .side { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-panes form { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; overflow-x: auto; padding: 10px 48px 10px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-nav h2 { display: none; }
  /* a phone (2026-10-31): the search on its own line, Analyse under it, both on screen */
  #page-library, .finder, .analysed-vods { grid-template-columns: minmax(0, 1fr); }
  .finder { padding: 16px 12px; }
  .finder-row { flex-wrap: wrap; }
  .finder-box { flex-basis: 100%; min-width: 0; flex-wrap: wrap; height: auto; padding: 6px 12px 6px 6px; }
  .finder-box input { flex-basis: 120px; height: 40px; }
  .finder-scope { flex-basis: 100%; }
  .finder-scope button { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .analysed-head { padding: 12px 12px 0; }
  #lib-search { min-width: 0; flex: 0 1 160px; }
  .finder-box > kbd { display: none; }
  .split-analyse { flex: 1 1 auto; }
  .split-analyse > .btn.primary { flex: 1 1 auto; justify-content: center; }
}

/* ---- the editor (E1b): layouts | the source and its crops | the 9:16 ---------------- */
/* design.md rule 5: the preview's column at most 42 % of the source's, so the phone
   never outgrows what is edited on a small screen */
.ed-grid {
  display: grid; grid-template-columns: 190px minmax(0, 1fr) 140px minmax(0, .42fr);
  gap: 18px; padding: 12px 16px 16px; align-items: start;
}
.ed-presets h3 { margin: 0 0 8px; }
.ed-preset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-preset {
  display: grid; gap: 4px; justify-items: center; padding: 6px; cursor: pointer;
  background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 12px;
}
.ed-preset:hover { color: var(--text); }
.ed-preset[aria-checked="true"] { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ed-preset canvas { width: 100%; aspect-ratio: 9 / 16; border-radius: 4px; background: #000; }
.ed-label { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-weight: 600; }
.ed-label .muted { font-weight: 400; }
.ed-label select { margin-left: auto; }
.ed-source { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-sm); cursor: crosshair; touch-action: none; display: block; }
.ed-preview { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; display: block; }
.ed-preview.over-captions { cursor: move; }  /* F1d: the captions' line: drag it, click it */
/* The phone (E1c): drawn by us, as tall as the page allows, the 9:16 its screen. */
/* H4b: with an app, the screen is the 9:16 on top of the app's bottom bar (the user's
   screenshots, cut); --screen-w = width / height, set by renderAppUi. No app (user,
   2026-11-03): no phone, a plain rectangle the 9:16 fills. */
.phone { --screen-w: .5625; --phone-pad: 1.4vh; }
.phone {
  width: 100%; max-width: calc((100vh - 230px) * var(--screen-w)); margin: 0 auto; box-sizing: border-box;
  padding: var(--phone-pad);
  background: var(--phone-body); border-radius: 5vh; box-shadow: 0 0 0 2px var(--phone-rim), 0 18px 50px rgba(0, 0, 0, .45);
}
.phone-screen {
  position: relative; width: 100%; aspect-ratio: var(--screen-w); background: #000;
  border-radius: 3.6vh; overflow: hidden; container-type: size;
}
.phone:not(.app-drawn) { --phone-pad: 0px; background: none; border-radius: 0; box-shadow: none; }
.phone:not(.app-drawn) .phone-screen { border-radius: var(--radius-sm); }
/* The app over it: pointer-free, so the boxes under it still drag. Sizes in the
   screen's own units (cqw / cqh): the same picture at any phone height. */
.app-ui { position: absolute; inset: 0; pointer-events: none; color: #fff; font-family: system-ui, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }

.ed-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; min-width: 0; font-weight: 400; }
/* E1e: on the source's label line, compact, or the line takes the source's height */
.ed-stage > .ed-label { margin-bottom: 2px; }
.ed-tools .btn { height: 28px; min-height: 28px; padding-block: 0; }
.ed-tools .btn.square { width: 28px; }
/* H4b4: Shape from, 28 px tall as the line's buttons: shown on a crop's choice, a taller
   control grew the line and moved the source under the pointer (10 px) */
.ed-tools .segmented { padding: 2px; box-sizing: border-box; height: 28px; }
.ed-tools .segmented button { height: 22px; padding: 0 8px; }
.ed-tools select { height: 28px; padding-block: 0; box-sizing: border-box; }  /* was 31: +3 px on a choice */
.ed-preset-wrap { position: relative; display: grid; }
.ed-finish { margin-top: 10px; display: grid; gap: 6px; }
.ed-finish .btn { width: 100%; justify-content: center; padding: 10px 14px; font-size: 15px; min-width: 0; }
.ed-finish .btn .word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-side .ed-label select { min-width: 0; flex: 0 1 auto; }  /* a narrow column: no side scroll */
.ed-card-tools { position: absolute; top: 6px; right: 6px; display: none; gap: 2px; }
.ed-preset-wrap:hover .ed-card-tools, .ed-preset-wrap:focus-within .ed-card-tools { display: flex; }
.ed-card-tools .btn { background: var(--panel); }
.ed-preset.mine { border-style: dashed; }
.ed-star { position: absolute; bottom: 30px; left: 6px; display: none; background: var(--panel); }
.ed-star.on { display: inline-flex; color: var(--mark); }
.ed-star.on .icon { fill: currentColor; }
.ed-preset-wrap:hover .ed-star, .ed-preset-wrap:focus-within .ed-star { display: inline-flex; }

/* ---- M1: Moments: the list, the videos, the moment open ----------------------------
   browsing   [ #list (rows) ][ #cards: the videos, one column, each with its panel ]
   one open   [ #list ][ the moment ]   or, "Pictures": [ #cards, narrow ][ the moment ] */
.cards-col { display: none; overflow-y: auto; min-height: 0; }
.side-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.side-head .side-title { padding: 0; }
/* ‹ in the head: the analysed videos in place of the moments */
.side.vods-open > :is(#list, .themes-box, #legend, .list-cols) { display: none; }
.side-vods { list-style: none; margin: 0; padding: 4px; }
.side-vods li {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; align-items: center;
  padding: 6px 8px; border-left: 3px solid transparent; border-radius: var(--radius-sm); cursor: pointer;
}
.side-vods li:hover { background: var(--raise); }
.side-vods li.sel { background: var(--hover); border-left-color: var(--accent); }
.side-vod-thumb { aspect-ratio: 16 / 9; border-radius: var(--radius-sm); background: var(--raise); overflow: hidden; }
.side-vod-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.side-vod-text { display: flex; flex-direction: column; min-width: 0; }
.side-vod-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (min-width: 1101px) {
  .body { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .body.browsing .cards-col { display: block; }
  .body.browsing .detail { display: none; }
  #cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 10px; }
  #cards li {
    grid-template-columns: 18px 12px 16px 16px minmax(0, 1fr) auto 22px; row-gap: 6px; padding: 6px;
    border: 1px solid var(--line); border-left-width: 1px; background: var(--panel); align-content: start;
  }
  #cards li.piece { padding-left: 6px; }
  #cards .thumb { grid-column: 1 / -1; }
  #cards .score, #cards .piece-len { grid-row: 3; grid-column: 1 / 5; justify-self: start; }
  #cards .when { grid-row: 3; grid-column: 5 / -1; text-align: right; }
  #cards .row-eye { position: static; transform: none; grid-row: 2; grid-column: 7; }
  /* browsing: each video big, at its own shape, its panel beside it, room between */
  /* one moment fills the page (container units, so it follows the window): the video
     takes the height left at its 16:9, its panel the width beside it */
  .body.browsing { grid-template-columns: var(--side-w, clamp(300px, 16vw, 340px)) minmax(0, 1fr); }  /* a row needs ~250 px */
  /* P56: the grip on the summary's edge (main.body is its box) */
  .body.browsing .side-grip {
    display: block; position: absolute; top: 0; bottom: 0; z-index: 3; width: 8px; cursor: col-resize;
    left: calc(var(--side-w, clamp(300px, 16vw, 340px)) - 4px);
  }
  .side-grip:hover, .side-grip:active { background: color-mix(in srgb, var(--accent) 45%, transparent); }
  /* P55: each card at its video's own height, 32 px between them, no snapping */
  .body.browsing .cards-col { container-type: size; }
  .body.browsing #cards { gap: 80px; padding: 8px 12px; }
  /* P56: a line between two videos */
  .body.browsing #cards li[data-key] + li[data-key]::before {
    content: ""; position: absolute; top: -40px; left: 10%; right: 10%; height: 1px; background: var(--line);
  }
  .body.browsing #cards li {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 28%, 440px); grid-template-rows: auto 1fr;
    column-gap: 16px; padding: 8px; border-color: transparent; background: none; box-sizing: border-box;
    position: relative;
  }
  /* P55b: the video and its panel one block, centred in the column */
  .body.browsing #cards li:has(> .thumb.tall) { grid-template-columns: auto clamp(300px, 28%, 440px); justify-content: center; }
  .body.browsing #cards .thumb { align-self: start; width: min(100%, calc((100cqh - 48px) * 16 / 9)); }
  /* H1d: as tall as the column, but no wider than the room the panel leaves (72 px: the
     gap, the card's and the list's padding, the scrollbar), or on a narrow window it ran
     under the panel */
  .body.browsing #cards .thumb.tall {
    width: auto;
    height: min(calc(100cqh - 48px), calc((100cqw - clamp(300px, 28cqw, 440px) - 72px) * 16 / 9));
  }
  .body.browsing #cards .thumb { grid-column: 1; grid-row: 1 / -1; }
  .body.browsing #cards .thumb video { width: 100%; height: 100%; background: #000; }
  .body.browsing #cards .card-info { display: grid; grid-column: 2; grid-row: 1; }
  .body.browsing #cards .parts { display: none; }  /* its panel has them all */
  .body.browsing #cards li { cursor: default; }
  /* the panel as tall as the video: facts on top, actions at its bottom */
  .body.browsing #cards .card-info {
    grid-row: 1 / -1; align-self: stretch; max-height: calc(100cqh - 32px); overflow-y: auto;
    display: flex; flex-direction: column;
  }
  /* sticky: a long chat or note scrolls the panel, Edit stays in sight (2026-10-31: it
     was cut off at 1280x720) */
  .body.browsing #cards .card-actions {
    margin-top: auto; position: sticky; bottom: 0; padding-bottom: 2px; background: var(--bg);
  }
  .body.browsing #cards .twitch-chat { max-height: 22cqh; }
  .body.browsing #list li.sel:not(.on) { background: none; border-left-color: transparent; }  /* only the video on screen is lit */
}
#list li.on { background: var(--hover); border-left-color: var(--accent); }  /* the video in the middle */
/* the crumb over a moment open: where one is, the way back */
.crumbs { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; }
.body.browsing .crumbs { display: none; }
.crumb-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px 4px 4px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--show); font: 600 15px var(--font);
}
.crumb-link:hover { border-color: var(--show); }
.crumb-here { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-actions { display: grid; gap: 8px; padding-top: 12px; }
.card-actions .btn { justify-content: center; min-width: 0; }
.card-open { min-height: 44px; font-size: 15px; }
.thumb {
  aspect-ratio: 16 / 9; border-radius: 4px; background: var(--sunken); overflow: hidden;
  display: grid; place-items: center; color: var(--muted);
}
.thumb { position: relative; }
.thumb video { width: 100%; height: 100%; display: block; }
.thumb > .icon { width: 28px; height: 28px; opacity: .6; }
.thumb.tall { aspect-ratio: 9 / 16; }
/* a clip drawn in a layout (P55): the canvas, its video hidden, a bar of its own */
.drawn-player { position: relative; width: 100%; height: 100%; }
.drawn-player canvas { width: 100%; height: 100%; display: block; cursor: pointer; }
.drawn-player video { display: none; }
.thumb-bar {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .6));
}
.thumb-bar button { display: grid; place-items: center; padding: 2px; color: inherit; background: none; border: 0; cursor: pointer; }
.thumb-bar .icon { width: 18px; height: 18px; }
.thumb-bar .thumb-sound.off { opacity: .45; }
.drawn-player:fullscreen { background: #000; }
.drawn-player:fullscreen canvas { object-fit: contain; cursor: default; }
.thumb-seek { flex: 1 1 auto; min-width: 0; }
.thumb-time { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.info-col { position: relative; }
.list .parts { display: contents; }  /* a row's cells, as before */
.card-info { display: none; gap: 6px; align-content: start; font-size: 13px; }
.card-title { font: 600 16px var(--font-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-info .fact { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; }
#short-sel-vod { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  /* P62: a VOD's title is long */

/* P63b: the montage's tracks. A label per lane (its kind, + to add to it, x to drop it),
   items end to end, their fades drawn as ramps from the top corners' squares. */
/* the label the column's full 28 px: its + and x side by side, never one over the other */
.tl-labels .tl-label { position: relative; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; }
.tl-label .tl-add, .tl-label .tl-drop {
  display: none; position: absolute; width: 13px; height: 16px; padding: 0; border: 0; border-radius: 4px;
  background: var(--raise); color: var(--text); cursor: pointer; place-items: center;
}
.tl-label .tl-add { left: 0; top: 6px; }
.tl-label .tl-drop { right: 0; top: 6px; }
.tl-label .tl-add .icon, .tl-label .tl-drop .icon { width: 11px; height: 11px; }
.tl-label:hover > .icon { opacity: .25; }
.tl-label:hover .tl-add, .tl-label:hover .tl-drop { display: grid; }
.tl-label .tl-drop .icon { color: var(--remove); }
.tl-image, .tl-audio { background: var(--sunken); }
.tl-item {
  position: absolute; top: 0; bottom: 0; display: flex; align-items: center; min-width: 8px; overflow: hidden;
  border-radius: 6px; font-size: 12px; white-space: nowrap; cursor: grab;
  --tone: var(--show);
  background:
    linear-gradient(to top right, color-mix(in srgb, var(--bg) 70%, transparent) 50%, transparent 50%) left / var(--fade-in, 0%) 100% no-repeat,
    linear-gradient(to top left, color-mix(in srgb, var(--bg) 70%, transparent) 50%, transparent 50%) right / var(--fade-out, 0%) 100% no-repeat,
    color-mix(in srgb, var(--tone) 42%, var(--raise));
}
.tl-item.audio {
  --tone: var(--make);
  background:
    linear-gradient(to top right, color-mix(in srgb, var(--bg) 70%, transparent) 50%, transparent 50%) left / var(--fade-in, 0%) 100% no-repeat,
    linear-gradient(to top left, color-mix(in srgb, var(--bg) 70%, transparent) 50%, transparent 50%) right / var(--fade-out, 0%) 100% no-repeat,
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--make) 40%, transparent) 0 2px, transparent 2px 5px),
    color-mix(in srgb, var(--make) 22%, var(--raise));
}
.tl-item.on { box-shadow: inset 0 0 0 2px var(--text); }
.tl-item-name { display: flex; align-items: center; gap: 5px; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tl-item-name .icon { width: 12px; height: 12px; flex: none; }
.tl-handle.start { left: 0; }
.tl-handle.end { right: 0; }
.tl-item:hover .tl-handle, .tl-item.on .tl-handle { opacity: 1; }
/* a fade's square: at the top corner, where its ramp ends; dragged inward */
/* small, and only on the chosen item: a press near an edge is a cut or a move first */
.tl-fade {
  position: absolute; top: 0; width: 6px; height: 6px; z-index: 2; cursor: ew-resize; opacity: 0;
  background: #fff; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); transition: opacity .12s;
  pointer-events: none;
}
.tl-item.on .tl-fade { pointer-events: auto; }
.tl-fade.in { left: calc(var(--fade-in, 0%) + 1px); }
.tl-fade.out { right: calc(var(--fade-out, 0%) + 1px); }
.tl-item.on .tl-fade { opacity: 1; }
.tl-new { display: flex; gap: 8px; }
.tl-new .btn { height: 26px; padding: 0 10px; font-size: 12px; gap: 4px; }
.tl-new .btn .icon { width: 13px; height: 13px; }
.tl-speed { color: var(--cut); font-weight: 600; }
.sel-icon { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--raise); }
.sel-icon .icon { width: 13px; height: 13px; }
#item-sel > .btn { justify-self: start; }
.insp-hint { margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line); }
#item-sel:not([hidden]) + .insp-hint { display: none; }
button.tl-empty { background: none; font: inherit; font-size: 12px; text-align: left; }  /* P63b: an empty track's own + */

/* E4: the crops as layers, front first, between the source and the phone; a row is
   dragged onto another (the line shows where it lands), the layout's picture stays behind */
#page-edit .ed-layers { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.ed-layer-list { display: grid; gap: 4px; align-content: start; min-height: 0; overflow-y: auto; }
.layer-row {
  display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px 0 4px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: none; color: var(--muted);
  font: 500 12px var(--font); text-align: left; cursor: grab; user-select: none;
}
.layer-row .icon { width: 14px; height: 14px; flex: none; opacity: .6; }
.layer-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--dot, var(--crop-other)); }
.layer-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row:hover { color: var(--text); background: var(--hover); }
.layer-row[aria-selected="true"] {
  color: var(--text); border-color: var(--dot); background: color-mix(in srgb, var(--dot) 16%, transparent);
}
.layer-row.dragging { opacity: .4; }
.layer-row.drop-above { box-shadow: 0 -2px 0 var(--accent); }
.layer-row.drop-below { box-shadow: 0 2px 0 var(--accent); }
.layer-row.layer-fixed { cursor: default; border-style: dashed; padding-left: 8px; }
.layer-row.layer-fixed:hover { color: var(--muted); background: none; }
.ed-layers .crop-add { width: 100%; justify-content: center; border-style: dashed; }
/* H5: Editing's montage block: where the moment stands, its actions apart */
.in-montage { display: grid; gap: 6px; }
.in-montage-line { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); }
.in-montage-line .icon { width: 14px; height: 14px; color: var(--make); flex: none; }
.in-montage-line span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.in-montage-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.in-montage-actions .btn { flex: 1 1 auto; justify-content: center; }
.ed-add { width: 100%; justify-content: center; }
.ed-add-to { margin-left: 6px; font-weight: 400; opacity: .8; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* H5: a short's layout shown in the montage; chosen in Editing */
.layout-shown { color: var(--text); text-decoration: none; font-size: 13px; }
.layout-shown:hover .muted { color: var(--text); }
.card-layout { font-size: 11px; color: var(--muted); }
/* H5: a montage's export fills its shorts' cards, the one in work as it is encoded */
.card.xp-filling, .card.short.xp-filling .short-poster { position: relative; }
.card.xp-filling::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--xp, 0%);
  background: var(--make); border-radius: 0 2px 2px 0; transition: width .4s;
}

/* ---- Editing's tabs and its captions (F1) -------------------------------------------- */
/* The column's tools as tabs: Layouts as before; Captions widens the column (its
   sliders and the words said need the room), its own parts scroll inside it. */
.ed-tabs { display: flex; gap: 4px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.ed-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 5px; margin-bottom: -1px;
  background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;  /* H8a: 5 tabs in 240 px */
}
.ed-tab .icon { width: 15px; height: 15px; }
.ed-tab:hover { color: var(--text); }
.ed-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
/* H8a: five tabs in a 190 px column: the chosen one named, the others by their icon */
.ed-tab:not([aria-selected="true"]) .word { display: none; }
#page-edit .ed-tab-layouts { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; }
#page-edit .ed-tab-layouts[hidden], #page-edit .ed-caps[hidden] { display: none; }
.ed-grid:has(.ed-caps:not([hidden])) { grid-template-columns: 240px minmax(0, 1fr) minmax(0, .42fr); }
/* G2: Captions has the most to set: 320 px, the stage in the middle gives it (it had
   room on both sides of the 9:16 at 1280x720) */
.ed-grid:has(#ed-tab-captions:not([hidden])),
.ed-grid:has(#ed-tab-texts:not([hidden])) { grid-template-columns: 320px minmax(0, 1fr) minmax(0, .42fr); }  /* H6b1c: tiles alike */

#page-edit .ed-caps { display: flex; flex-direction: column; gap: 8px; flex: 1 1 0; min-height: 0; }

.cap-gen { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cap-gen .btn[aria-busy="true"] { opacity: .7; cursor: progress; }
.cap-gen .btn { min-width: 0; }
.cap-gen .btn .word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cap-status:empty { display: none; }
#cap-status.error { color: var(--remove); }
.cap-presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
#cap-presets, #txt-preset { grid-template-columns: repeat(4, minmax(0, 1fr)); flex: none; }  /* G2: a row less */
#cap-presets[hidden] { display: none; }
/* G3: a section's head: its name (a fold for the presets), its action at the right */
.cap-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.cap-sec-head .btn { font-size: 12px; height: 26px; touch-action: none; }
.cap-sec-title, .cap-fold { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); }
.cap-fold { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; background: none; border: 0;
  cursor: pointer; font-family: inherit; }
.cap-fold:hover { color: var(--text); }
.cap-fold .icon { width: 14px; height: 14px; transition: transform 150ms; }
.cap-fold[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.cap-fold-value { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); }
.cap-fold-value:not(:empty)::before { content: "· "; }
#page-edit .cap-said { display: flex; flex-direction: column; gap: 6px; flex: 1 1 0; min-height: 0; }
/* G3: a window over the page, moved by its bar, kept inside the window (floatPanel) */
.float { position: fixed; z-index: 35; width: 300px; max-height: calc(100vh - 24px); display: flex;
  flex-direction: column; background: var(--raise); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: var(--glass); }
.float[hidden] { display: none; }
.float-bar { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; cursor: grab;
  border-bottom: 1px solid var(--line); touch-action: none; user-select: none; }
.float-bar.moving { cursor: grabbing; }
.float-title { flex: 1; font-size: 12px; font-weight: 600; }
.float-bar .btn.square { width: 26px; height: 26px; }
.float-body { padding: 10px 12px 12px; overflow-y: auto; min-height: 0; }
.cap-rare { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.cap-rare .btn { font-size: 12px; height: 26px; }
.cap-preset {
  display: grid; gap: 2px; justify-items: center; padding: 5px 4px 3px; cursor: pointer;
  background: var(--cap-tile); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font: inherit; font-size: 11px;
}
.cap-preset:hover { border-color: var(--line-strong); }
.cap-preset[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cap-sample { line-height: 1.15; white-space: nowrap; }
.cap-preset-name { color: var(--cap-tile-text); }
/* H6a: + New style first, yours marked by a dot, a tile being named */
.cap-new { align-content: center; border-style: dashed; color: var(--muted); }
.cap-new .icon { width: 14px; height: 14px; }
.cap-new:hover { color: var(--text); }
/* H6a2: one of yours: its ⋯ on hover or focus, over the tile's corner */
.cap-tile { position: relative; display: grid; }
.cap-tile > .cap-preset { min-width: 0; }
.cap-tile-more {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 18px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--menu);
  color: var(--text); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; opacity: 0;
}
.cap-tile:hover .cap-tile-more, .cap-tile:focus-within .cap-tile-more { opacity: 1; }
.cap-tile-more:hover { border-color: var(--line-strong); }
.cap-new.full { opacity: .6; cursor: default; border-style: solid; }  /* H6a3: says why */
.cap-mine-hint { grid-column: 2 / -1; align-self: center; margin: 0; }
.txt-look .cap-fold { margin-top: 4px; }
.cap-naming { align-content: center; cursor: default; border-color: var(--accent); }
.cap-tile-edit { display: grid; place-items: center; }
.cap-tile-edit .icon { width: 11px; height: 11px; }
.cap-style-name { width: 86%; min-width: 0; font: inherit; font-size: 11px; padding: 1px 4px; height: 18px;
  text-align: center; box-sizing: border-box; }  /* H6b1c2: was the tile's whole width */
#cap-style .cap-font-mine select { grid-column: 2; }  /* one's own font: its ✕ in the 3rd column */
.cap-style { display: grid; gap: 2px; }
.cap-row { display: grid; min-height: 20px; grid-template-columns: 84px minmax(0, 1fr) 24px; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cap-row select { grid-column: 2 / 4; min-width: 0; }
.cap-row input[type="range"] { min-width: 0; }
.cap-row input[type="checkbox"] { justify-self: start; }
.cap-val { text-align: right; font-variant-numeric: tabular-nums; }
.cap-colours { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; }
/* H6b1: the style window's preview (4 grounds), swatches, stacked outlines */
.cap-preview-box { display: grid; gap: 4px; }
.cap-preview { width: 100%; height: 64px; border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
.cap-grounds { justify-self: center; }
.cap-grounds button { padding: 2px 8px; font-size: 11px; }
/* H6b1b: ↺ beside a setting changed from its preset; its room kept so rows stay aligned */
#cap-style .cap-row-reset { grid-template-columns: 84px minmax(0, 1fr) 24px 18px; }
#cap-style .cap-colour { display: grid; grid-template-columns: 84px 18px 30px minmax(0, 1fr) 18px; }  /* H6b1c: fixed (a later .cap-colour is flex) */
#cap-style .cap-colour > input[type="checkbox"] { margin: 0; justify-self: center; }
#cap-style .cap-colour .cap-outline-drop { justify-self: end; }
.cap-room { display: block; }
/* H6b1c: sections under bars that fold them */
.cap-sec { border-top: 1px solid var(--line); }
.cap-sec-bar { display: flex; width: 100%; align-items: center; justify-content: space-between; padding: 7px 0 5px;
  border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; cursor: pointer; }
.cap-sec-bar:hover { color: var(--text); }
.cap-sec-bar .icon { width: 14px; height: 14px; transition: transform .15s; }
.cap-sec-bar[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.cap-sec-body { display: grid; gap: 6px; padding-bottom: 8px; }
.cap-sec-body[hidden] { display: none; }
.cap-reset { width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--accent);
  font-size: 13px; line-height: 1; cursor: pointer; }
.cap-reset:hover { background: var(--hover); }
.cap-reset-room { width: 18px; }
.cap-swatch-btn { width: 30px; height: 18px; padding: 0; border: 1px solid var(--line); border-radius: 4px; cursor: pointer;
  background-clip: padding-box; }
.cap-swatch-btn:disabled { opacity: .35; cursor: default; }
/* H6b1b: the one colour popover */
.colour-pop { position: fixed; z-index: 40; width: 236px; display: grid; gap: 6px; padding: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0, 0, 0, .45); }
.colour-pop[hidden] { display: none; }
.colour-title { font-size: 12px; font-weight: 600; }
.colour-row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 6px; align-items: start; font-size: 11px; color: var(--muted); }
.colour-swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.colour-swatch { aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.colour-swatch:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.colour-square { width: 100%; height: 120px; border-radius: 4px; cursor: crosshair; touch-action: none; display: block; }
.colour-hue { width: 100%; height: 12px; -webkit-appearance: none; appearance: none; border-radius: 6px; margin: 0;
  background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); }
.colour-hue::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff;
  border: 2px solid #000; }
.colour-foot { display: flex; gap: 6px; align-items: center; }
.colour-hex { width: 84px; font: 12px var(--mono); }
.colour-back { margin-left: auto; padding: 2px 8px; font-size: 12px; }
.cap-outline { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.cap-outline-drop { width: 22px; height: 22px; min-height: 22px; }
.cap-outline-add { justify-self: start; padding: 2px 8px; }
.cap-colour { display: flex; align-items: center; gap: 5px; }
.cap-colour span { flex: 1; }
.cap-colour input[type="color"] { width: 26px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.cap-colour input[type="color"]:disabled { opacity: .35; cursor: default; }

/* F1d: the chosen line's bar, and the line retyped, over the phone's screen */
.cap-bar {
  position: fixed; transform: translateX(-50%); z-index: 30;
  display: flex; align-items: center; gap: 3px; padding: 3px; white-space: nowrap;
  background: var(--menu); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45);
}
.cap-bar select { max-width: 84px; font-size: 12px; }
.cap-bar .btn.square { width: 26px; height: 26px; }
.cap-bar-btn {
  min-width: 26px; height: 26px; padding: 0 4px; border: 0; border-radius: 4px; cursor: pointer;
  background: none; color: var(--text); font: inherit; font-size: 12px; font-weight: 700;
}
.cap-bar-btn:hover { background: var(--hover); }
.cap-bar input[type="color"] { width: 24px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 4px; background: none; cursor: pointer; }
.cap-line {
  position: fixed; z-index: 31; box-sizing: border-box; text-align: center;
  color: #fff; background: rgba(0, 0, 0, .88); border: 2px solid var(--accent); border-radius: 6px;
  padding: 0 6px; outline: none;
}

/* F1e: the montage's Text track: a box per line, at its time; its small window */
.tl-text .tl-cue, .tl-text .tl-cue-add {
  position: absolute; top: 2px; bottom: 2px; min-width: 4px; overflow: hidden; padding: 0 5px;
  border-radius: 4px; font: inherit; font-size: 11px; white-space: nowrap; text-overflow: ellipsis;
  text-align: left; cursor: pointer;
}
.tl-text .tl-cue {
  border: 0; color: var(--text); background: color-mix(in srgb, var(--mark) 30%, var(--raise));
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--mark) 70%, transparent);
}
.tl-text .tl-cue:hover { background: color-mix(in srgb, var(--mark) 48%, var(--raise)); }
.tl-text .tl-cue-add {
  display: flex; align-items: center; gap: 4px; color: var(--muted); background: none;
  border: 1px dashed var(--line-strong);
}
.tl-text .tl-cue-add:hover { color: var(--text); border-color: var(--accent); }
.tl-text .tl-cue-add .icon { width: 12px; height: 12px; }
.cue-pop {
  position: fixed; z-index: 20; width: 320px; display: grid; gap: 8px; padding: 10px;
  background: var(--menu); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
}
.cue-pop[hidden] { display: none; }
.cue-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.cue-pop-head .btn.square { width: 24px; height: 24px; }
.cue-pop input { font: inherit; font-size: 14px; padding: 6px 8px; }
.cue-pop-foot { display: flex; justify-content: space-between; gap: 8px; }

/* F1f: the Lines view: a row a line with its times; the chosen one's text and timing */
.cap-offset { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cap-offset > span:first-child { flex: 1; }
.cap-step {
  min-width: 30px; height: 24px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--raise); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.cap-step:hover { border-color: var(--line-strong); background: var(--hover); }
.cap-val-wide { min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12px; }
.cap-lines { display: flex; flex-direction: column; gap: 2px; flex: 1 1 0; min-height: 0; overflow-y: auto;
  position: relative; /* its rows' offsetTop: within it (capLight) */ }
.cap-line-row {
  display: grid; grid-template-columns: 20px 62px minmax(0, 1fr) 20px; gap: 5px; align-items: center;
  user-select: none;
  padding: 4px 6px; border: 0; border-radius: 4px; background: none; color: var(--text);
  font: inherit; font-size: 12px; text-align: left; cursor: pointer;
}
.cap-line-row:hover { background: var(--hover); }
.cap-line-row.lit { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.cap-line-row.chosen { box-shadow: inset 2px 0 0 var(--accent); background: var(--raise); }
.cap-line-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; white-space: nowrap; }
.cap-line-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* F1g: the Captions tab shows the short big in the centre; the source and its crop tools
   are the Layouts tab's */
.ed-big { height: 100cqh; max-width: 100cqw; aspect-ratio: 9 / 16; display: block; background: #000;
  border-radius: var(--radius-sm); touch-action: none; cursor: default; }
.ed-big[hidden] { display: none; }
.ed-big.over-captions { cursor: move; }
.ed-big.over-handle, .ed-preview.over-handle { cursor: grab; }
#page-edit.caps-mode .ed-source, #page-edit.caps-mode .ed-layers,
#page-edit.caps-mode .ed-tools { display: none; }

/* F1h: the Text track under the trimmer: a box a line; the resets over the lines */
.cap-track {
  position: relative; height: 40px; margin-top: 4px; border-radius: 4px; background: var(--sunken);
  touch-action: none; overflow: hidden;
}
.cap-track-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text);
  pointer-events: none; z-index: 2; }
.cap-track[hidden] { display: none; }
/* H4a2: a lane's tiles as an editor's clips (Premiere, CapCut): a fill per kind, its
   colour's bar on the left, the words left to right cut by an ellipsis, a hairline gap
   between neighbours, the handles seen on hover and when chosen, no letters crammed into
   a tile too narrow for them (.tiny) */
.cap-cue {
  --tile: var(--mark);
  position: absolute; min-width: 4px; display: flex; align-items: center; box-sizing: border-box;
  border-radius: 5px; border: 1px solid color-mix(in srgb, var(--tile) 55%, transparent);
  border-left: 3px solid var(--tile); margin-left: 1px;
  background: color-mix(in srgb, var(--tile) 24%, var(--sunken)); color: var(--text);
  font: 600 11px/1 var(--font); white-space: nowrap; overflow: hidden; cursor: grab;
}
.cap-cue[data-kind="text"] { --tile: var(--lane-text); }
.cap-cue[data-kind="zoom"] { --tile: var(--lane-zoom); }  /* H4c: its own colour */
.cap-cue[data-kind="image"] { --tile: var(--lane-image); }  /* H8a */
.cap-cue[data-kind="audio"] { --tile: var(--lane-audio); }
.cap-cue[data-kind="video"] { --tile: var(--lane-video); }
/* H8c: another tab's lane and its tiles, dimmed: the tab's own stand out */
.cap-lane.elsewhere { opacity: .55; }
/* H8d: a lane's eye, the pin mode's toggle and its + Track, a pinned lane's pin */
/* grid: the icon centred; #cap-track beats `.trimmer button` (the lanes live in the
   trimmer: its flex and 5px 8px padding pushed the icon 7 px off, H8e) */
/* H8i: the lane's head: one solid chip, centred on the lane's height, over the tiles */
#cap-track .cap-lane-head {
  position: absolute; left: 3px; top: 50%; transform: translateY(-50%); z-index: 5;
  display: flex; align-items: center; gap: 1px; padding: 1px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 6px; pointer-events: auto;
}
#cap-track .cap-lane-head .cap-lane-grip, #cap-track .cap-lane-head .cap-lane-eye,
#cap-track .cap-lane-head .cap-lane-pin {
  position: static; width: 18px; height: 18px; display: grid; place-items: center;
  background: none; border-radius: 4px; transform: none;
}
#cap-track .cap-lane-head .icon { width: 12px; height: 12px; }
#cap-track .cap-lane-head .cap-lane-eye:hover, #cap-track .cap-lane-head .cap-lane-grip:hover {
  background: var(--hover); color: var(--text);
}
#cap-track .cap-lane-eye, #cap-track .cap-lane-pin {  /* H8h: over the tiles, on its own ground */
  position: absolute; top: 2px; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px;
  background: var(--sunken); display: grid; place-items: center;
  color: var(--muted); cursor: pointer; pointer-events: auto; z-index: 5;
}
#cap-track .cap-lane-eye { left: 20px; }  /* each as specific as the rule above (H8e) */
#cap-track .cap-lane-pin { left: 38px; color: var(--accent); }
#cap-track .cap-lane-eye .icon, #cap-track .cap-lane-pin .icon { width: 12px; height: 12px; }
#cap-track .cap-lane-eye:hover { color: var(--text); }
/* H8e: a tile being moved to another lane: lifted, over everything; the lane it lands on lit */
.cap-cue.lifted { z-index: 7; box-shadow: 0 6px 16px rgba(0, 0, 0, .45); opacity: .92; }
.cap-lane.drop-target { outline: 2px solid var(--accent); outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 14%, transparent); opacity: 1; }
.cap-drop-new {  /* H8d: where a dropped tile's new lane appears */
  position: absolute; left: 0; right: 0; height: 18px; z-index: 6; pointer-events: none;
  display: flex; align-items: center; padding-left: 40px; font-size: 11px; font-weight: 600;
  color: var(--accent); border: 2px dashed var(--accent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
/* H8g: the band's eye: how many lanes are hidden, a click / hover lists them */
.cap-band .cap-hidden-lanes { width: auto; display: inline-flex; align-items: center; gap: 3px;
  padding: 0 5px; font-size: 10px; color: var(--accent); }
.cap-band .cap-tab-only.on { color: var(--accent); }
.cap-band .cap-lane-add {
  width: auto; display: inline-flex; align-items: center; height: 16px; padding: 0 6px; margin-left: 2px;
  font-size: 10px;
}
.cap-cue[data-elsewhere="true"] { opacity: .5; filter: saturate(.6); }
.cap-cue[data-elsewhere="true"]:hover { opacity: .8; }
/* H8a: the Media tab: yours as tiles, the chosen one's look */
.md-adds { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }  /* the 240 px column */
.md-adds .btn { justify-content: center; min-width: 0; }
.md-help { margin: 4px 0; }
.md-look .cap-row { grid-template-columns: 64px minmax(0, 1fr) 34px; }
.md-assets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; max-height: 150px; overflow-y: auto; }
/* H8c: the library takes what is left of the column and scrolls in it (a list browsed,
   as the clips' list is): the clip's own items above it never move */
.md-assets-all { display: grid; align-content: start; gap: 4px; margin-top: 6px; flex: 0 0 auto; }
.md-sec .cap-fold .icon + .icon { width: 13px; height: 13px; }
.md-sec-add { width: 22px; height: 22px; }
/* H8d: each tab's list of its objects takes the column's room (the user: what matters
   is big; a small scrolled box says it does not) */
/* H8i: the clip's list as tall as its rows, the library right under it, the tab scrolls
   (the library sat at the column's foot) */
#page-edit #md-list { flex: 0 0 auto; min-height: 0; }
#page-edit .ed-media { overflow-y: auto; }
/* H8a2b: the clip's items with their picture; yours as names unless asked as pictures */
/* H8c: In this clip grouped by kind; a row: its picture, its name, its time under it */
.md-group { display: flex; align-items: center; gap: 5px; margin: 6px 0 2px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.md-group .icon { width: 12px; height: 12px; }
.md-list .md-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center;
  gap: 8px; min-height: 44px; padding: 3px 4px; }
.md-row-text { display: grid; min-width: 0; gap: 1px; }
.md-row-name { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.md-row-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.md-thumb { width: 56px; height: 36px; flex: none; display: grid; place-items: center; object-fit: contain;
  border-radius: var(--radius-sm); background: var(--sunken); }
.md-thumb .icon { width: 15px; height: 15px; color: var(--lane-audio); }
.md-yours { margin-top: 4px; }
.md-view { width: 22px; height: 22px; }
.md-assets-all.as-list .md-assets { grid-template-columns: 1fr; gap: 1px; }
.md-assets-all.as-list .md-asset { display: flex; justify-items: start; padding: 3px 6px; gap: 6px; text-align: left; }
.md-assets-all.as-list .md-asset img { width: 18px; height: 18px; }
.md-assets-all.as-list .md-asset .icon { width: 14px; height: 14px; margin: 0; }
/* H8a2: an image's tile shows the image, repeated along it */
/* H8a2b: one picture, centred, in every state (.on and :hover set `background`, which
   wiped it); its text kept as a spacer, or the end edge slid to the start one */
.cap-cue.thumbs, .cap-cue.thumbs:hover, .cap-cue.thumbs.on {
  background-image: var(--thumb); background-size: auto 100%; background-repeat: no-repeat;
  background-position: center;
}
.cap-cue.thumbs .cap-cue-text { visibility: hidden; }
.md-asset {
  display: grid; gap: 3px; justify-items: center; padding: 5px 4px; min-width: 0; cursor: pointer;
  background: var(--cap-tile); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font: inherit; font-size: 11px;
}
.md-asset:hover { border-color: var(--line-strong); color: var(--text); }
.md-asset img { width: 100%; height: 42px; object-fit: contain; }
.md-asset .icon { width: 22px; height: 22px; margin: 10px 0; color: var(--lane-audio); }
.md-asset.video .icon { color: var(--lane-video); }
.md-asset-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-look { display: grid; gap: 4px; padding: 6px 8px 8px 10px; margin: 0 0 4px 4px; flex: none;
  border-left: 2px solid var(--accent); background: var(--sunken); border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.md-look[hidden] { display: none; }
.md-look-name { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; }
.md-look .btn { justify-self: start; }
.cap-cue.mine[data-kind="captions"] { --tile: var(--show); }
.cap-cue:hover { background: color-mix(in srgb, var(--tile) 34%, var(--sunken)); }
.cap-cue.lit { box-shadow: inset 0 -2px 0 var(--mark); }
.cap-cue.on { border-color: var(--text); background: color-mix(in srgb, var(--tile) 42%, var(--sunken)); }
.cap-cue-text { flex: 1; min-width: 0; padding: 0 5px; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.cap-cue.tiny .cap-cue-text { visibility: hidden; }
/* H8e: a tile narrower than its two 6 px handles: they overflowed it (the end one up to
   19 px past its right side, both seen at the left); now each a third of it, at its ends */
.cap-cue.tiny .cap-cue-edge { position: absolute; top: 0; bottom: 0; width: 33%; }
.cap-cue.tiny .cap-cue-edge.start { left: 0; }
.cap-cue.tiny .cap-cue-edge.end { right: 0; }
/* H4c: thick handles, seen without a hover (a grip line in each), brighter on hover or
   chosen; a tiny tile's thirds stay hover-only (they ARE the tile) */
.cap-cue-edge { position: relative; width: 8px; align-self: stretch; cursor: ew-resize; flex: none; }
.cap-cue:not(.tiny) .cap-cue-edge { background: color-mix(in srgb, var(--tile) 30%, transparent); }
.cap-cue:not(.tiny) .cap-cue-edge::after {
  content: ""; position: absolute; top: 30%; bottom: 30%; left: 3px; width: 2px;
  border-radius: 1px; background: var(--tile); opacity: .8;
}
.cap-cue:hover .cap-cue-edge, .cap-cue.on .cap-cue-edge { background: color-mix(in srgb, var(--tile) 60%, transparent); }
/* H4c: the kind's icon, then the words or the value; narrow: the icon only (the text kept
   as a spacer, or the end edge slides to the start one); tiny: nothing */
.cap-cue-icon { flex: none; display: grid; place-items: center; width: 14px; height: 14px; margin-left: 3px;
  color: var(--tile); pointer-events: none; }
.cap-cue-icon .icon { width: 12px; height: 12px; }
.cap-cue.thumbs .cap-cue-icon { background: var(--sunken); border-radius: 3px; }
.cap-cue-value { flex: none; padding: 0 4px; font: 600 10px/1 var(--mono); color: var(--muted); pointer-events: none; }
.cap-cue.narrow .cap-cue-text { visibility: hidden; }
.cap-cue.narrow .cap-cue-value, .cap-cue.tiny .cap-cue-value, .cap-cue.tiny .cap-cue-icon { display: none; }
.cap-cue-edge:hover { background: var(--accent) !important; }
/* the band on top: the lock, and the lanes' own ruler and − / + once unlocked */
.cap-band { position: absolute; left: 0; top: 0; height: 20px; display: flex; align-items: center; gap: 2px; padding-left: 2px; z-index: 3; }
.cap-band button {
  width: 18px; height: 16px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 4px;
  background: var(--raise); color: var(--muted); font: 600 12px/1 var(--font); cursor: pointer;
}
.cap-band button:hover { color: var(--text); }
.cap-band .icon { width: 11px; height: 11px; }
.cap-lock.off { color: var(--accent); }
.cap-tick { position: absolute; top: 4px; font: 9px var(--mono); color: var(--faint); padding-left: 2px; border-left: 1px solid var(--line); pointer-events: none; }
.cap-resets { display: flex; gap: 4px; flex-wrap: wrap; }
.cap-resets .btn { font-size: 11px; padding: 3px 6px; }
.cap-line-tools { display: flex; justify-content: space-between; gap: 4px; }
.cap-line-tools .btn { font-size: 11px; padding: 3px 6px; }

/* F1i: groups (a colour each), the text zone's edges */
.cap-cue.g-A { --tile: var(--cap-group-a); }
.cap-cue.g-B { --tile: var(--cap-group-b); }
.cap-cue.g-C { --tile: var(--cap-group-c); }
.ed-big.over-zone, .ed-preview.over-zone { cursor: ew-resize; }

/* F1j: the group chip, the row's delete, Add line on top and its ghost, Free */
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.cap-head .btn { font-size: 12px; padding: 0 8px; height: 22px; touch-action: none; }
.cap-chip {
  width: 20px; height: 18px; padding: 0; border: 0; border-radius: 4px; cursor: pointer;
  font: inherit; font-size: 10px; font-weight: 700; color: #0b0b0d; background: var(--line-strong);
}
.cap-chip.g-A { background: var(--cap-group-a); }
.cap-chip.g-B { background: var(--cap-group-b); }
.cap-chip.g-C { background: var(--cap-group-c); }
.cap-line-del {
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none;
  color: var(--muted); cursor: pointer; visibility: hidden; display: grid; place-items: center;
}
.cap-line-row:hover .cap-line-del, .cap-line-row.chosen .cap-line-del { visibility: visible; }
.cap-line-del:hover { color: var(--remove); background: var(--hover); }
.cap-line-del .icon { width: 13px; height: 13px; }
.cap-add-ghost {
  position: fixed; z-index: 40; pointer-events: none; padding: 3px 8px; border-radius: 4px; font-size: 11px;
  background: color-mix(in srgb, var(--show) 50%, var(--raise)); color: var(--text); box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.cap-track.drop-here { box-shadow: inset 0 0 0 2px var(--accent); }
.cap-free.on { background: var(--accent); color: #fff; }
.cap-bar .cap-chip { width: 26px; height: 22px; }
.cap-own-timing { justify-self: start; font-size: 11px; padding: 3px 6px; }

/* F1k: the right-click menu */
.ctx-menu {
  position: fixed; z-index: 50; min-width: 210px; padding: 4px; display: grid; gap: 1px;
  background: var(--menu); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5); font-size: 13px;
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
  display: grid; grid-template-columns: 14px 16px 1fr auto; gap: 6px; align-items: center;
  padding: 5px 8px; border: 0; border-radius: 4px; background: none; color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
}
.ctx-item:hover, .ctx-item:focus-visible { background: var(--hover); outline: none; }
.ctx-item[disabled] { color: var(--faint); cursor: default; }
.ctx-item.danger { color: var(--remove); }
.ctx-item .icon { width: 14px; height: 14px; }
.ctx-tick { color: var(--accent); font-size: 12px; }
.ctx-key { color: var(--faint); font-size: 11px; }
.ctx-sep { height: 1px; margin: 3px 4px; background: var(--line); }
.ctx-chips { display: flex; align-items: center; gap: 4px; padding: 4px 8px; }
.ctx-label { flex: 1; color: var(--muted); font-size: 12px; }
.ctx-chip.on { outline: 2px solid var(--text); outline-offset: 1px; }
.ctx-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* F1m: the line's steps as the cut's (.trim-steps, .step-group); its words retyped in its row */
/* H4a4: inside the track, under the chosen tile's lane */
.cap-track .cap-steps { position: absolute; left: 0; right: 0; height: 22px; z-index: 3; }
.cap-row-input { min-width: 0; font: inherit; font-size: 12px; padding: 1px 4px; }

/* F1n: the line's steps in its box's colour; the track's zoom switch */
.cap-steps .step {
  background: color-mix(in srgb, var(--tone, var(--mark)) 26%, var(--raise));
  color: color-mix(in srgb, var(--tone, var(--mark)) 80%, var(--text));
  border: 1px solid color-mix(in srgb, var(--tone, var(--mark)) 45%, transparent); border-radius: 4px; cursor: pointer;
}
.cap-steps .step:hover { background: color-mix(in srgb, var(--tone, var(--mark)) 42%, var(--raise)); }

/* F1o: whose look the Look tab changes */
.cap-target { display: flex; align-items: center; gap: 4px; }
.cap-target[hidden] { display: none; }
.cap-target span { margin-right: 4px; }
.cap-chip.on { outline: 2px solid var(--text); outline-offset: 1px; }

/* F1p: a font of one's own: the × beside it */
.cap-font-mine select { grid-column: 2 / 3; }
.cap-font-drop {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 4px; background: none;
  color: var(--muted); cursor: pointer; display: grid; place-items: center;
}
.cap-font-drop:hover { color: var(--remove); background: var(--hover); }
.cap-font-drop .icon { width: 12px; height: 12px; }

/* F1q: the Text track's row: its zoom, the lane, its add, side by side and of one height;
   the line's steps line up with the lane (the same side margins) */
.cap-track-row { display: flex; align-items: stretch; margin-top: 4px; }
.cap-track-row[hidden] { display: none; }
.cap-track-row .cap-track { flex: 1; min-width: 0; margin-top: 0; }

/* F2: the Text tab */
.txt-title { font-weight: 600; }
.txt-list { min-height: 90px; }  /* H8d: the column's room, as .cap-lines */
.txt-row { grid-template-columns: 16px 62px minmax(0, 1fr) 20px; }
.txt-mark { display: grid; place-items: center; color: var(--show); }
.txt-mark .icon { width: 12px; height: 12px; }
#page-edit .txt-look { flex: 1 1 0; min-height: 0; }
#page-edit .txt-look[hidden] { display: none; }
#page-edit .ed-texts[hidden] { display: none; }

/* F2b: the Text tab's presets: the captions' tiles, five a row, "Aa" in each look */

/* F2b: the lanes: Captions, then the Text lanes, an icon at each one's start */
.cap-lane {
  position: absolute; left: 0; right: 0; border-top: 1px solid var(--line);
  pointer-events: none; display: flex; align-items: center; padding-left: 3px; color: var(--faint);
}
.cap-lane .icon { width: 11px; height: 11px; }
.cap-lane.text { background: color-mix(in srgb, var(--show) 5%, transparent); }
.cap-cue { top: auto; bottom: auto; }
.txt-actions { display: flex; }
.txt-actions .btn { font-size: 11px; padding: 3px 8px; }

/* F2b: the montage's Texts lane */
.tl-text .tl-cue.text { background: color-mix(in srgb, var(--show) 34%, var(--raise));
  box-shadow: inset 1px 0 0 color-mix(in srgb, var(--show) 70%, transparent); }
.tl-text .tl-cue.text:hover { background: color-mix(in srgb, var(--show) 50%, var(--raise)); }

/* F2c: the Text tab's views; the layout's name hidden where the source is (captions, texts) */
#page-edit.caps-mode #ed-preset-name { display: none; }
/* F2c: the hint under the phone gone, its height stays the phone's limit: without it the
   phone grew past design.md's 42 % of the source (test_the_editors_layout_follows_docs_design) */
#page-edit .ed-side .phone-box { margin-bottom: 44px; }  /* the hint and its gap, measured */
/* F2d: the Text tab: its list, then the chosen text's look under it; the tab scrolls */
#page-edit .ed-texts { overflow-y: auto; }
/* H8e: the list takes the tab's room (In this clip, Texts, Zooms share .txt-list): this
   F2d cap (120 px) beat the H8d rule and kept every list a small scrolled box */
#page-edit .txt-list { flex: 1 1 0; min-height: 90px; }
/* H8g: a zoom or a text chosen: the list as tall as its rows, the look right under them
   (the list took the room and pushed the look to the column's foot) */
#ed-tab-zooms:has(#zm-look:not([hidden])) #zm-list,
#ed-tab-texts:has(#txt-look:not([hidden])) #txt-list { flex: 0 0 auto; min-height: 0; }
/* never shrunk (H8h: flex-shrink squashed the text list to 0 px under a tall look, its
   rows unclickable): the tab scrolls instead */
#page-edit .txt-look { flex: none; overflow: visible; }

/* F3: the Zoom tab and its lane */
#page-edit .ed-zooms { overflow-y: auto; }
.zm-look { display: flex; flex-direction: column; gap: 8px; }
.zm-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.zm-row > span { width: 36px; flex: none; }
.zm-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.zm-chip { font: inherit; font-size: 12px; padding: 3px 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--raise); color: var(--text); cursor: pointer; }
.zm-chip.on { border-color: var(--show); background: color-mix(in srgb, var(--show) 22%, var(--raise)); }
.cap-lane.zoom { background: color-mix(in srgb, var(--show) 9%, transparent); }

/* F3: four tabs in the 190 px Layouts column, sharing it */
.ed-tabs { gap: 0; }
.ed-tab { flex: 1 1 auto; justify-content: center; padding: 6px 3px; font-size: 12px; }

/* ---- X1: the export's panel, then its notice -----------------------------------------
   bottom right, over everything but the dialogs; ─ / ✕ while it runs folds it to a pill
   in the same corner, the export goes on. The short "prints": its picture in grey, the
   colour filling it top down as ffmpeg encodes. */
.xp {
  position: fixed; z-index: 45; right: 16px; bottom: 16px; width: 360px;
  border-radius: var(--radius); background: var(--raise); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); backdrop-filter: var(--glass); overflow: hidden;
  animation: xp-in 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes xp-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.xp-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 0 14px; font-size: 13px; }
.xp-head strong { flex: 1; font-weight: 600; }
.xp-head .xp-format { color: var(--muted); font-weight: 400; }
.xp-head button { width: 28px; height: 28px; padding: 0; justify-content: center; }
.xp-body { display: flex; gap: 14px; padding: 12px 14px 4px; }
.xp-short { position: relative; flex: none; width: 66px; aspect-ratio: 9 / 16; border-radius: 7px;
  overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
.xp-short img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.xp-short .grey { filter: grayscale(1) brightness(.55); }
.xp-short .ink { clip-path: inset(0 0 calc(100% - var(--printed, 0%)) 0); transition: clip-path 450ms linear; }
.xp-short .scan { position: absolute; left: 0; right: 0; height: 2px; top: var(--printed, 0%);
  background: var(--accent); box-shadow: 0 0 10px 2px var(--accent); transition: top 450ms linear; }
.xp.done .xp-short .scan, .xp-short:not(.printing) .scan { opacity: 0; }
.xp-main { flex: 1; min-width: 0; }
.xp-part { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px; }
.xp-part b { color: var(--text); font-weight: 600; }
.xp-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.xp-step { display: grid; grid-template-columns: 18px 1fr; column-gap: 7px; align-items: start;
  color: var(--faint); font-size: 12px; transition: color 200ms; }
.xp-step .icon { width: 14px; height: 14px; margin-top: 1px; }
.xp-step b { font-weight: 600; }
.xp-step small { grid-column: 2; color: var(--muted); font-size: 11px; line-height: 1.3;
  max-height: 0; overflow: hidden; opacity: 0; transition: max-height 250ms, opacity 250ms; }
.xp-step.now { color: var(--text); }
.xp-step.now small { max-height: 30px; opacity: 1; }
.xp-step.now .icon { color: var(--accent); animation: xp-pulse 1.2s ease-in-out infinite; }
.xp-step.past { color: var(--muted); }
.xp-step.past .icon { color: var(--cut); }
@keyframes xp-pulse { 50% { opacity: .35; transform: scale(.85); } }
.xp-bar { height: 4px; margin: 10px 14px 0; border-radius: 2px; background: var(--sunken); overflow: hidden; position: relative; }
.xp-bar > span { position: absolute; inset: 0 auto 0 0; width: var(--done, 0%); border-radius: 2px;
  background: var(--accent); transition: width 450ms linear; }
.xp-bar.sweep::after { content: ""; position: absolute; inset: 0; width: 30%;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  animation: xp-sweep 1.3s ease-in-out infinite; }
@keyframes xp-sweep { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.xp-foot { display: flex; align-items: center; gap: 8px; padding: 8px 14px 12px; font-size: 12px; color: var(--muted); }
.xp-foot .xp-pct { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.xp-foot .btn { margin-left: auto; height: 30px; }
.xp-where { font-size: 11px; color: var(--muted); word-break: break-all; margin-top: 4px; }
.xp.done .xp-head strong .icon { color: var(--cut); }
.xp.failed .xp-head strong .icon, .xp-error { color: var(--remove); }
.xp-error { font-size: 12px; margin-top: 4px; }
.xp.pill { width: auto; border-radius: 999px; cursor: pointer; animation: none; }
.xp.pill .xp-pill { display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; font-size: 12px;
  background: none; border: 0; color: var(--text); }
.xp-pill .xp-ring { width: 18px; height: 18px; border-radius: 50%;
  background: conic-gradient(var(--accent) var(--done, 0%), var(--sunken) 0); }
@media (prefers-reduced-motion: reduce) {
  .xp, .xp-step.now .icon, .xp-bar.sweep::after { animation: none; }
  .xp-short .ink, .xp-short .scan, .xp-bar > span { transition: none; }
}

/* ---- V1: the captions' dictionary in ⚙ Settings -------------------------------------- */
.vocab-channel { margin-left: 8px; color: var(--muted); font-weight: 400; }
.vocab { display: grid; gap: 4px; margin-bottom: 8px; }
.vocab-row { display: grid; grid-template-columns: minmax(56px, 120px) minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 4px 6px; border-radius: var(--radius-sm); background: var(--sunken); }
.vocab-row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.vocab-heard { min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; color: var(--muted); font-size: 12px; }
.vocab-chip { display: inline-flex; align-items: center; gap: 2px; padding: 0 2px 0 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text); }
.vocab-chip button, .vocab-row > button { background: none; border: 0; color: var(--muted); cursor: pointer;
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.vocab-chip button:hover, .vocab-row > button:hover { color: var(--remove); }
.vocab-chip .icon, .vocab-row > button .icon { width: 13px; height: 13px; }
.vocab-add { display: grid; gap: 6px; margin-top: 4px; }
.vocab-kinds { display: flex; align-items: center; gap: 4px; }
.vocab-kinds .muted { margin-right: 4px; }
.vocab-fix { display: flex; align-items: center; gap: 6px; }
.vocab-fix input { flex: 1 1 0; min-width: 0; width: 0; }
.vocab-fix .btn { flex: none; }
.float-body { overflow-x: hidden; }
.vocab-arrow { color: var(--muted); font-weight: 600; }
.vocab-help { margin: 0 0 8px; }
#vocab-float { width: 340px; }
#vocab-float-status:empty { display: none; }
.cap-sec-tools { display: flex; gap: 4px; }
