/* Scoped to the video reader; reuse Nanani/Reader typography and surfaces. */
#videoShell.video-study {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: auto auto 203px auto minmax(180px, 1fr);
  grid-template-areas: 'header header' 'views views' 'transcript player' 'transcript tools' 'transcript dock';
  background: var(--bg); overflow: auto; isolation: isolate; position: relative;
}
.video-study > .reader-top { grid-area: header; }
.video-study > .reader-top { padding: 8px 16px; }
.video-study > .reader-top .btn, .video-study > .reader-top .icon-btn { height: 36px; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.video-study .vs-controls { grid-area: views; }
.video-study > .video-player-wrap { grid-area: player; }
.video-study > .video-toolbar { grid-area: tools; }
.video-study > .video-body-wrap { display: contents; }
.video-study .video-subs-wrap { grid-area: transcript; }
.video-study .reader-dock { grid-area: dock; }
.video-study .vs-caption { grid-area: caption; display: none; }
#videoShell.video-study > .video-player-wrap {
  min-height: 200px; min-width: 200px; max-height: none; opacity: 1;
  pointer-events: auto; transition: none; overflow: visible;
}
#videoShell.video-study #ytPlayerEl,
#videoShell.video-study .video-player-wrap iframe {
  width: auto; height: 100%; min-height: 200px; min-width: 200px;
  max-width: 100%; max-height: none; aspect-ratio: 16 / 9; border: 0;
}
.vs-controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 18px; border-bottom: 1px solid var(--border); background: var(--panel);
  font-family: var(--sans); position: relative; z-index: 21;
}
.vs-modes { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; }
/* It speaks only while subtitles are on their way or after quiet retries are
   spent, so it stays text-weight: readable, never louder than the video. */
#videoPreparationStatus { color: var(--muted); }
#videoPreparationRetry {
  font: inherit; color: inherit; background: none; border: 0; border-radius: 4px;
  padding: 4px 2px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: color 160ms ease-out, text-decoration-color 160ms ease-out;
}
#videoPreparationRetry:hover { color: var(--amber); text-decoration-color: currentColor; }
#videoPreparationRetry:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
#videoPreparationRetry:disabled { opacity: .6; cursor: default; }
.vs-mode {
  font: inherit; font-size: 14px; font-weight: 500; color: var(--muted); border: 0;
  padding: 6px 15px; background: transparent; border-radius: 9px; cursor: pointer;
  transition: background 160ms, color 160ms;
}
.vs-mode:hover { color: var(--ink); background: color-mix(in srgb, var(--muted) 10%, transparent); }
.vs-mode[aria-pressed='true'] { color: var(--ink); background: color-mix(in srgb, var(--accent) 15%, var(--panel)); }
.vs-mode:focus-visible, .video-study .rw:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
/* The reader selection ring already marks the focused selection. Keep one
   border after grading with 1–5; unselected/ignored words retain keyboard focus. */
.video-study .rw.sel:not(.k-ignore):focus-visible { outline: none; }
.vs-fullscreen { margin-left: auto; }
/* Settings occupy the subtitle region, or flow beneath the Reading player. */
.video-study #videoSettingsBtn {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  gap: 7px; flex-shrink: 0;
}
.video-study #videoSettingsBtn svg { width: 16px; height: 16px; flex-shrink: 0; }
.video-study #videoSettingsBtn[aria-expanded='true'] { color: var(--amber); border-color: var(--amber); }
.vs-settings-panel {
  box-sizing: border-box; width: 100%; min-width: 0; padding: 14px 16px;
  color: var(--ink); background: var(--panel); font-family: var(--sans);
  display: flex; flex-direction: column; gap: 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 14px;
}
.vs-settings-panel[hidden], .vs-settings-panel [hidden] { display: none !important; }
.vs-settings-header { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.vs-settings-header h2, .vs-settings-header h3 {
  margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600;
}
.vs-settings-header #videoSettingsCloseBtn {
  margin-left: auto; flex-shrink: 0; height: 30px; min-height: 30px; width: 30px; padding: 4px;
}
.vs-settings-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.vs-settings-content > section, .vs-settings-sync, .vs-settings-reading { min-width: 0; }
.vs-settings-content h3 { margin: 0 0 7px; font-size: 13px; line-height: 1.4; font-weight: 600; }
.vs-settings-sync p { margin: 0 0 10px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.video-study .video-sync-controls { display: flex; align-items: center; justify-content: flex-start; gap: 6px; flex-wrap: wrap; }
.video-study .video-sync-controls :is(#syncMinusBtn, #syncPlusBtn) {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  flex: 1 1 80px; min-width: 0; height: 44px; min-height: 44px; padding: 5px 8px;
  font-size: 12px; line-height: 1.2; white-space: nowrap;
}
.video-study .video-sync-controls small { font-size: 11px; color: var(--muted); }
.video-study #syncOffsetValue { min-width: 58px; text-align: center; font-size: 14px; line-height: 1.5; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.video-study #syncResetBtn { font-size: 12px; color: var(--muted); }
.vs-sync-reset { display: flex; justify-content: center; margin-top: 7px; }
.vs-settings-footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 9px; border-top: 1px solid var(--border); }
.video-study .vs-settings-footer #videoDeleteBtn {
  display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted);
  border-color: transparent; background: transparent; font-size: 12px;
}
.video-study .vs-settings-footer #videoDeleteBtn:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.video-study .vs-settings-footer #videoDeleteBtn svg { width: 14px; height: 14px; }
.vs-delete-confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-basis: 100%; min-width: 0; }
.vs-delete-confirm p { margin: 0; flex: 1 1 180px; font-size: 12px; line-height: 1.4; }
.vs-delete-confirm .btn { font-size: 12px; }
.vs-delete-confirm #videoDeleteConfirmBtn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.vs-settings-error { margin: 0; color: var(--danger); font-size: 12px; line-height: 1.4; flex-basis: 100%; }
.vs-options-panel {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}
.vs-option {
  display: flex; flex-direction: row-reverse; justify-content: space-between;
  gap: 14px; align-items: center; padding: 6px 0; margin: 0; border-radius: 8px;
  font-size: 13px; line-height: 1.35; color: var(--ink); cursor: pointer;
}
.vs-option:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.vs-option input {
  appearance: none; box-sizing: border-box; width: 32px; min-width: 32px; height: 19px; min-height: 19px; flex-shrink: 0; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: 999px; position: relative;
  background: color-mix(in srgb, var(--muted) 22%, var(--panel)); cursor: pointer;
}
.vs-option input::before {
  content: ''; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--panel); box-shadow: 0 1px 3px #0002;
  transition: transform 140ms ease;
}
.vs-option input:checked { background: var(--amber); border-color: var(--amber); }
.vs-option input:checked::before { transform: translateX(13px); background: #fff; }
.vs-option input:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.vs-fs-notice { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
.vs-controls [hidden] { display: none !important; }
.video-study .video-toolbar { position: relative; z-index: 10; }
.video-study .video-toolbar .btn.tiny { min-height: 30px; height: 30px; padding: 4px 10px; }
/* Russian stress toggle: EN's compact size, always just left of EN. */
.video-study #videoToggleStress { width: 36px; height: 35px; min-height: 35px; padding: 0; display: grid; place-items: center; }
.video-study .reader-dock { min-height: 0; max-height: none; }
.video-study .vs-caption { padding: 16px 24px 22px; overflow-y: auto; min-height: 120px; border-top: 1px solid var(--border); }
/* Leo 2026-11-06: a drag that started between words painted the browser's text
   selection over the subtitles, often by accident. Words keep the app's own
   click-and-drag selection (mousedown on .rw), which never relied on this. */
#videoCurrentCaption, #videoBody { -webkit-user-select: none; user-select: none; }
.vs-caption .video-line { padding: 0; margin: 0; }
.vs-caption .video-line-text { font-size: clamp(22px, 2vw, 30px); line-height: 1.6; justify-content: center; }
.vs-caption .video-line-row { justify-content: center; }
.vs-caption .line-tr { text-align: center; margin: 12px 0 0; padding-inline: 0; font-size: 18px; color: var(--muted); }
#videoShell.video-study[data-video-mode='cinema'] {
  grid-template-columns: minmax(0, 1fr) 0px;
  transition: grid-template-columns 280ms cubic-bezier(.22, 1, .36, 1);
  /* Reserve subtitle space independently of the current cue's length. */
  grid-template-rows: auto auto minmax(200px, 1fr) clamp(124px, 14dvh, 148px);
  grid-template-areas: 'header header' 'views views' 'player dock' 'caption dock';
  /* The columns always fit; while the lookup rail opens from 0px, its collapse
     tab sticks out briefly and must not flash a horizontal scrollbar. */
  overflow-x: hidden;
}
.video-study[data-video-mode='cinema'] .video-subs-wrap { display: none; }
.video-study[data-video-mode='cinema'] .vs-caption {
  display: grid;
  /* One original row and one translation row. */
  --vs-orig-size: clamp(22px, 2vw, 30px); --vs-orig-h: calc(var(--vs-orig-size) * 1.6);
  --vs-tr-h: 27px; --vs-tr-gap: 8px;
  grid-template-columns: minmax(0, 1fr) 100px minmax(0, 960px) 100px minmax(0, 1fr);
  /* No invisible status row: balance the subtitle above and below. */
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center; gap: 0 12px; padding: 10px 20px;
  min-height: 0; overflow: hidden; position: relative;
}
.video-study[data-video-mode='cinema'] .vs-caption-text {
  grid-column: 3; grid-row: 1; min-width: 0; min-height: 0; height: 100%;
  overflow: hidden; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center;
}
/* Constant block height (original row + reserved translation row): cue changes,
   pending translations and gaps between cues never move the subtitle. */
.video-study[data-video-mode='cinema'] .vs-caption-text > * { min-width: 0; min-height: var(--vs-orig-h); }
.video-study[data-video-mode='cinema'] .vs-caption-text[data-trans] > * {
  min-height: calc(var(--vs-orig-h) + var(--vs-tr-gap) + var(--vs-tr-h));
}
.video-study[data-video-mode='cinema'] .vs-caption-text > .hint { display: flex; align-items: center; justify-content: center; margin: 0; }
/* Preparation status inside the fixed-height subtitle zone, so showing or
   hiding it never moves the video. With no subtitle yet it takes the subtitle's
   place (and replaces the "Subtitles will appear here" hint); next to a real
   subtitle it drops to the zone's bottom row. */
.video-study[data-video-mode='cinema'] .vs-caption > #videoPreparationStatus {
  grid-column: 3; grid-row: 1; justify-self: center; align-self: center;
  margin: 0; text-align: center; font-size: 14px;
}
.video-study[data-video-mode='cinema'] .vs-caption:has(.vs-caption-text .video-line) > #videoPreparationStatus {
  grid-row: 2; align-self: end; font-size: 13px;
}
.video-study[data-video-mode='cinema'] .vs-caption:has(> #videoPreparationStatus:not([hidden])) .vs-caption-text > .hint { visibility: hidden; }
/* Reading: the status already says it; don't repeat "Preparing subtitles…" below. */
#videoBody:has(> #videoPreparationStatus:not([hidden])) > [data-video-empty] { display: none; }
/* Leo 2026-11-05: while the lookup narrows the caption, a long line is clipped
   at its end (safe centre keeps its start in view) instead of being cut into a
   new page; --vs-line-shift slides it to keep the chosen word visible. */
.video-study[data-video-mode='cinema'] .vs-caption .video-line-text {
  justify-content: safe center;
  transform: translateX(var(--vs-line-shift, 0px));
  transition: transform 280ms cubic-bezier(.22, 1, .36, 1);
}
.video-study[data-video-mode='cinema'] .vs-caption-text.vs-line-tracking .video-line-text { transition: none; }
/* A line clipped by the open lookup fades out at its edges instead of a hard cut. */
.video-study[data-video-mode='cinema'].vs-consulting .vs-caption-text {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 20px, #000 calc(100% - 20px), transparent);
}
/* Leo 2026-11-05: no band behind the Cinema subtitle (active or hovered); word highlights stay. */
.video-study[data-video-mode='cinema'] .vs-caption .video-line,
.video-study[data-video-mode='cinema'] .vs-caption .video-line:hover,
.video-study[data-video-mode='cinema'] .vs-caption .video-line.reading,
.video-study[data-video-mode='cinema'] .vs-caption .video-line.reading:hover { background: transparent; box-shadow: none; }
.video-study[data-video-mode='cinema'] .vs-caption .video-line-text {
  /* --vs-unit-scale: one size per video so whole cues share a row (video-study.js captionScale). */
  flex-wrap: nowrap; white-space: nowrap; font-size: calc(var(--vs-orig-size) * var(--vs-unit-scale, 1)); line-height: 1.6; height: var(--vs-orig-h);
  /* The row keeps its full-size height; centre smaller text in it so it stays close to its translation. */
  padding-top: calc(var(--vs-orig-h) * (1 - var(--vs-unit-scale, 1)) / 2);
}
.video-study[data-video-mode='cinema'] .vs-caption .line-tr {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  height: var(--vs-tr-h); line-height: var(--vs-tr-h); min-height: 0 !important; margin: var(--vs-tr-gap) 0 0;
}
/* The paused status keeps its Retry button inside the single translation row. */
.video-study[data-video-mode='cinema'] .vs-caption .line-tr .translation-line-retry {
  height: calc(var(--vs-tr-h) - 4px); min-height: 0; padding: 0 10px; margin: 0 0 0 8px;
  line-height: 1; font-size: 13px; vertical-align: middle;
}
.video-study[data-video-mode='cinema'] .vs-caption [data-vs-hidden] { display: none !important; }
.video-study[data-video-mode='cinema'] .vs-caption-measure {
  position: fixed; left: -100000px; top: 0; visibility: hidden; pointer-events: none;
}
/* Cue changes clone delivered English; show it immediately instead of replaying
   the translation-arrived reveal used by the transcript. */
.video-study[data-video-mode='cinema'] .vs-caption .line-tr { animation: none; }
.video-study[data-video-mode='cinema'] .video-toolbar { display: contents; }
.video-study[data-video-mode='cinema'] #videoPlayPauseBtn { display: none; }
.video-study[data-video-mode='cinema'] #videoToggleTrans { grid-column: 2; grid-row: 1; justify-self: end; }
.video-study[data-video-mode='cinema'] #videoToggleStress { grid-column: 2; grid-row: 1; justify-self: end; margin-right: 44px; }
.video-study[data-video-mode='cinema'] #videoSettingsBtn { grid-column: 4; grid-row: 1; margin: 0; }
#videoShell.video-study[data-video-mode='cinema'].vs-settings-open {
  grid-template-rows: auto auto minmax(200px, 1fr) 288px;
}
.video-study[data-video-mode='cinema'] .vs-settings-panel {
  position: absolute; inset: 0; z-index: 2; height: 100%; width: 100%;
  overflow-y: auto; padding: 13px 24px; border: 0; border-radius: 0; gap: 10px;
}
.video-study[data-video-mode='cinema'] .vs-settings-content { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.video-study[data-video-mode='cinema'] .vs-settings-reading { border-left: 1px solid var(--border); padding-left: 28px; }
.video-study[data-video-mode='cinema'].vs-settings-open .vs-caption-text,
.video-study[data-video-mode='cinema'].vs-settings-open .vs-caption > .video-toolbar { visibility: hidden; }
.video-study[data-video-mode='cinema'] .vs-settings-header,
.video-study[data-video-mode='cinema'] .vs-settings-content,
.video-study[data-video-mode='cinema'] .vs-settings-footer { width: min(900px, 100%); margin-inline: auto; box-sizing: border-box; }
#videoShell.video-study[data-video-mode='cinema'].vs-consulting {
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas: 'header header' 'views views' 'player dock' 'caption dock';
}
/* Keep the rail within its own grid track: nothing slides over the iframe. */
.video-study[data-video-mode='cinema'] .reader-dock {
  display: flex; width: auto; min-width: 0; max-width: none; box-sizing: border-box;
  /* The closed rail has a zero-width track; padding/borders must not widen it. */
  padding: 18px 0 22px; border-left: 0; position: relative;
  box-shadow: inset 1px 0 var(--border);
  overflow-x: clip; overflow-y: auto; visibility: hidden; opacity: 0;
  transition: opacity 180ms ease, visibility 0s linear 280ms;
}
.video-study[data-video-mode='cinema'] .reader-dock-inner {
  flex: 0 0 auto; width: 360px; max-width: 100%; margin: auto 0 0;
  box-sizing: border-box; padding-inline: 38px 16px;
  transform: translateX(24px); opacity: 0;
  transition: transform 280ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease;
}
.video-study[data-video-mode='cinema'].vs-consulting .reader-dock {
  visibility: visible; opacity: 1; transition-delay: 0s;
}
.video-study[data-video-mode='cinema'].vs-consulting .reader-dock-inner { transform: translateX(0); opacity: 1; }
/* Leo 2026-11-06: while the column opens or closes, the lookup keeps its final
   width and the column uncovers it; squeezed to every in-between width, its lines
   rewrapped and the lemma dropped into place. At rest max-width: 100% still
   leaves room for a scrollbar. */
.video-study[data-video-mode='cinema'].vs-columns-moving .reader-dock-inner { max-width: none; }
.vs-dock-collapse {
  display: none; grid-area: dock; justify-self: start; align-self: end; z-index: 2;
  margin: 0 0 42px; width: 28px; height: 72px; padding: 0; min-width: 0;
  border: 1px solid var(--border); border-left: 0; border-radius: 0 12px 12px 0;
  background: var(--panel); color: var(--muted); font: 30px/1 var(--sans);
  cursor: pointer; transition: color 160ms ease, background 160ms ease;
}
.video-study[data-video-mode='cinema'].vs-consulting .vs-dock-collapse { display: block; }
.vs-dock-collapse:hover { color: var(--ink); background: color-mix(in srgb, var(--amber) 12%, var(--panel)); }
.vs-dock-collapse:focus-visible { outline: 2px solid var(--amber); outline-offset: -3px; }
#videoShell.video-study[data-video-mode='cinema'].vs-collapsing { grid-template-columns: minmax(0, 1fr) 0px; }
.video-study[data-video-mode='cinema'].vs-collapsing .reader-dock-inner { transform: translateX(32px); opacity: 0; }
.video-study.vs-collapsing .vs-dock-collapse { visibility: hidden; }
#videoShell.video-study[data-video-mode='reading'] {
  grid-template-rows: auto auto 203px auto minmax(180px, 1fr);
  grid-template-areas: 'header header' 'views views' 'transcript player' 'transcript tools' 'transcript dock';
}
.video-study[data-video-mode='reading'] .video-toolbar { padding: 8px; gap: 6px; }
#videoShell.video-study[data-video-mode='reading'].vs-settings-open {
  grid-template-rows: auto auto 203px minmax(0, 1fr) 0px;
}
.video-study[data-video-mode='reading'].vs-settings-open .reader-dock { display: none; }
.video-study[data-video-mode='reading'].vs-settings-open .video-toolbar {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: 30px minmax(0, 1fr); align-items: start;
  min-height: 0; overflow: hidden;
}
.video-study[data-video-mode='reading'].vs-settings-open #videoPlayPauseBtn { grid-column: 1; grid-row: 1; }
.video-study[data-video-mode='reading'].vs-settings-open #videoToggleTrans { grid-column: 2; grid-row: 1; }
/* Shares EN's column; its margin widens the auto column so the two never overlap. */
.video-study[data-video-mode='reading'].vs-settings-open #videoToggleStress { grid-column: 2; grid-row: 1; justify-self: start; margin-right: 42px; }
.video-study[data-video-mode='reading'].vs-settings-open #videoToggleTrans { justify-self: end; }
.video-study[data-video-mode='reading'].vs-settings-open #videoSettingsBtn { grid-column: 3; grid-row: 1; justify-self: end; }
.video-study[data-video-mode='reading'] .vs-settings-panel {
  grid-column: 1 / -1; grid-row: 2; width: 100%; height: 100%;
  min-height: 0; max-height: none; overflow-y: auto;
}
.video-study[data-video-mode='reading'] .video-subs { padding: 26px 36px 24px 28px; }
.video-study[data-video-mode='reading'] .video-line { margin-bottom: 10px; padding: 10px 12px; }
.video-study[data-video-mode='reading'] .video-line-text { font-size: 18px; } /* long lines fit one row, like their translation */
.video-study[data-video-mode='reading'] .line-tr { font-size: 17px; }
/* Reading marks the current cue by its timestamp only: no line fill, no side
   bar, no hover fill. box-shadow must stay an explicit none, or .reader-line's
   active ring (and its negative margins) comes back and the transcript shifts. */
.video-study[data-video-mode='reading'] .video-line.reading,
.video-study[data-video-mode='reading'] .video-line:hover,
.video-study[data-video-mode='reading'] .video-line.reading:hover { background: transparent; box-shadow: none; }
.video-study[data-video-mode='reading'] .cue-time:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.video-study[data-video-mode='reading'] .video-line.reading .cue-time {
  background: transparent; color: var(--ink); border-color: var(--ink); font-weight: 700; box-shadow: none;
}
.video-reading-jump { right: 44px; bottom: 24px; }
.video-study[data-video-mode='cinema'] .video-reading-jump { display: none; }
.video-study[data-video-mode='reading'] .video-subs .bilingual-group {
  margin-bottom: 0; padding-block: 4px; border-radius: 0;
  border-inline-start: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.video-study[data-video-mode='reading'] .video-subs .bilingual-group-start { padding-top: 10px; border-radius: 10px 10px 0 0; }
.video-study[data-video-mode='reading'] .video-subs .bilingual-group-end { padding-bottom: 10px; margin-bottom: 10px; border-radius: 0 0 10px 10px; }
.video-study .video-notice-banner { grid-column: 1 / -1; }
#videoShell.video-study:fullscreen { width: 100%; height: 100dvh; background: var(--bg); }
@media (max-width: 850px) {
  #videoShell.video-study, #videoShell.video-study[data-video-mode='reading'],
  #videoShell.video-study[data-video-mode='cinema'], #videoShell.video-study[data-video-mode='cinema'].vs-consulting {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto clamp(200px, 56.25vw, 30vh) auto minmax(180px, 1fr) auto;
    grid-template-areas: 'header' 'views' 'player' 'tools' 'transcript' 'dock';
  }
  #videoShell.video-study[data-video-mode='cinema'], #videoShell.video-study[data-video-mode='cinema'].vs-consulting {
    align-content: start;
    grid-template-rows: auto auto clamp(200px, 56.25vw, 42vh) clamp(180px, 25dvh, 220px) auto;
    grid-template-areas: 'header' 'views' 'player' 'caption' 'dock';
  }
  #videoShell.video-study[data-video-mode='reading'] { grid-template-rows: auto auto 200px auto minmax(220px, 1fr) auto; }
  .video-study .reader-dock { width: 100%; min-width: 0; max-width: none; border-left: 0; border-top: 1px solid var(--border); }
  .video-study:not(.vs-consulting) .reader-dock { display: none; }
  .video-study[data-video-mode='cinema'] .reader-dock-inner { width: 100%; }
  .video-study[data-video-mode='cinema'] .reader-dock { box-shadow: none; }
  .video-study[data-video-mode='cinema'].vs-collapsing { grid-template-columns: minmax(0, 1fr) !important; }
  .vs-controls { padding: 8px 10px; gap: 6px; }
  .vs-mode { padding: 6px 12px; }
  .video-study .vs-caption { padding: 14px 18px; }
  /* On narrow screens keep the text full-width and centered; tools below. */
  .video-study[data-video-mode='cinema'] .vs-caption {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) 30px auto;
    gap: 6px 8px; padding: 10px;
  }
  .video-study[data-video-mode='cinema'] .vs-caption-text { grid-column: 1 / -1; grid-row: 1; }
  .video-study[data-video-mode='cinema'] #videoToggleTrans { grid-column: 1; grid-row: 2; justify-self: start; }
  .video-study[data-video-mode='cinema'] #videoToggleStress { grid-column: 1; grid-row: 2; justify-self: start; margin: 0; }
  .video-study[data-video-mode='cinema']:has(#videoToggleStress) #videoToggleTrans { margin-left: 44px; }
  .video-study[data-video-mode='cinema'] #videoSettingsBtn { grid-column: 2; grid-row: 2; }
  .video-study[data-video-mode='cinema'] .vs-caption > #videoPreparationStatus { grid-column: 1 / -1; }
  .video-study[data-video-mode='cinema'] .vs-caption:has(.vs-caption-text .video-line) > #videoPreparationStatus { grid-row: 3; }
  #videoShell.video-study[data-video-mode='cinema'].vs-settings-open,
  #videoShell.video-study[data-video-mode='cinema'].vs-consulting.vs-settings-open {
    grid-template-rows: auto auto clamp(200px, 56.25vw, 42vh) 360px auto;
  }
  .video-study[data-video-mode='cinema'] .vs-settings-panel { padding: 12px 16px; }
  .video-study[data-video-mode='cinema'] .vs-settings-content { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .video-study[data-video-mode='cinema'] .vs-settings-reading { border-left: 0; border-top: 1px solid var(--border); padding: 10px 0 0; }
  #videoShell.video-study[data-video-mode='reading'].vs-settings-open {
    grid-template-rows: auto auto 200px auto minmax(220px, 1fr) 0px;
  }
  .video-study[data-video-mode='reading'].vs-settings-open .video-toolbar { grid-template-rows: 30px auto; }
  .video-study[data-video-mode='reading'] .vs-settings-panel { height: auto; max-height: min(440px, calc(100dvh - 290px)); }

  .video-study .video-subs, .video-study[data-video-mode='reading'] .video-subs { padding: 18px 26px 18px 12px; }
  .video-study .reader-top { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .vs-mode, .vs-option input::before, #videoShell.video-study, .video-study .reader-dock, .video-study .reader-dock-inner, .vs-dock-collapse { transition: none !important; }
  .video-study .video-line { transition: none; }
  .video-study[data-video-mode='cinema'] .vs-caption .video-line-text { transition: none; }
}
