/* Dark base theme -- recolored to Cloud Chaburah's editorial-blue family
   (see chaburah.css's --cc-* tokens). In practice every page that loads
   this file also loads watch-theme.css right after it, which overrides
   :root with Chaburah's actual LIGHT values, so this dark variant rarely
   paints -- kept internally consistent (same blue family, just darkened)
   rather than left in the old gold palette in case that ever changes. */
:root {
  --bg: #0b1a2b;
  --bg-soft: #0f2337;
  --card: rgba(19, 42, 66, 0.9);
  --card-strong: #14304a;
  --line: rgba(151, 179, 205, 0.17);
  --line-strong: rgba(151, 179, 205, 0.3);
  --text: #f5f8fb;
  --muted: #91a7bd;
  --accent: #4d8ab8;
  --accent-soft: rgba(47, 110, 165, 0.16);
  --accent-strong: #2f6ea5;
  --blue: #52a7ff;
  --highlight: #f0d38a;
  --highlight-text: #2d240f;
  --danger: #ff7c89;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: "Assistant", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(47, 110, 165, 0.16), transparent 30%),
    radial-gradient(circle at 98% 18%, rgba(82, 167, 255, 0.1), transparent 26%),
    linear-gradient(180deg, #06101d 0%, #081422 100%);
}
button, input, select { font: inherit; }
button { color: inherit; }

/* Fixed left sidebar nav, matching player/index.html's own (locally-styled)
   layout -- browse/watch/studio previously had no desktop-visible nav of
   their own at all (see nav.js's renderDesktopNav), then a compact icon
   strip in the topbar; this replaces that with the same full sidebar
   every page now uses, populated by nav.js the same way it already fills
   player.html's. Driven by the shared CSS custom properties, so it
   automatically follows watch-theme.css's re-skin like everything else
   here does. index.html and player/index.html each still define their own
   copy locally (a different, non-shared page shell in both cases) --
   duplicated by hand rather than factored out, matching this codebase's
   established no-shared-HTML-partial approach elsewhere.
   --sidebar-width is a real custom property (not just a literal 148px
   repeated everywhere) so collapse.js's inline collapsed-width override
   below has one source of truth to restore from. */
:root { --sidebar-width: 148px; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--card-strong);
  border-right: 1px solid var(--line);
  overflow: hidden;
  transition: width .2s ease;
}
.sidebar > .brand {
  height: 104px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.brand-mark { display: grid; place-items: center; color: var(--accent); }
.brand-mark img, .brand-mark svg { width: 100%; height: 100%; object-fit: contain; }
.sidebar .brand-mark { width: 104px; height: 82px; }
.sidebar .brand-name { display: none; }
.brand-name { font: 700 clamp(24px,2.4vw,34px) Georgia,"Times New Roman",serif; letter-spacing: -1px; color: var(--text); }
/* Compact brand shown in the topbar only below the 760px breakpoint, once
   the fixed sidebar (and the full-size brand living inside it) hides. */
.mobile-brand { display: none; }
.mobile-brand .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.mobile-brand .brand-mark { width: 40px; height: 40px; }
.mobile-brand .brand-name { display: block; font-size: 24px; }
@media (max-width: 760px) { .mobile-brand { display: block; } }
.sidebar .desktop-navigation { display: flex; flex-direction: column; }
.icon { flex: 0 0 auto; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.side-link {
  height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border-left: 3px solid transparent;
  transition: .18s ease;
}
.side-link .icon { width: 22px; height: 22px; }
.side-link:hover, .side-link.active { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); }

/* The button that hides/reveals the sidebar (collapse.js) -- pinned to the
   sidebar's own right edge so it moves with it, flipping which way its
   chevron points to match the action it now performs. */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: var(--sidebar-width);
  transform: translate(-50%, -50%);
  z-index: 21;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card-strong);
  color: var(--muted);
  cursor: pointer;
  transition: left .2s ease;
}
.sidebar-toggle:hover { color: var(--accent); }
.sidebar-toggle .icon { width: 14px; height: 14px; transition: transform .2s ease; }
body.sidebar-collapsed .sidebar { width: 0; border-right: 0; }
body.sidebar-collapsed .sidebar-toggle { left: 0; }
body.sidebar-collapsed .sidebar-toggle .icon { transform: rotate(180deg); }

.app-shell { width: min(1540px, calc(100% - 32px - var(--sidebar-width))); margin: 0 auto 0 var(--sidebar-width); padding-bottom: 56px; transition: margin-left .2s ease; }
body.sidebar-collapsed .app-shell { margin-left: 0; width: min(1540px, calc(100% - 32px)); }
@media (max-width: 760px) {
  .sidebar, .sidebar-toggle { display: none; }
  .app-shell { margin-left: 0; width: min(1540px, calc(100% - 32px)); }
}
/* A landscape phone is wider than 760px, so the rule above leaves the
   desktop sidebar and a 100px header in place and the video is left with
   a short band. Height is what makes it a phone here, not width. */
@media (max-height: 520px) and (max-width: 1100px) {
  .sidebar, .sidebar-toggle { display: none; }
  .app-shell { margin-left: 0; width: min(1540px, calc(100% - 18px)); }
}
.topbar {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.top-actions, .file-row, .input-with-button, .compact-actions, .player-controls, .time-row,
.card-heading, .editor-heading, .editor-actions, .daf-footer, .daf-toolbar, .workflow-card { display: flex; align-items: center; }
.top-actions { gap: 10px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); font-size: 13px; background: rgba(255,255,255,.025);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(47, 110, 165,.1); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.setup-strip { display: grid; grid-template-columns: 1.1fr 1fr 1.15fr; gap: 22px; padding: 18px 20px; margin-bottom: 18px; }
.setup-field { min-width: 0; }
.setup-field + .setup-field { border-left: 1px solid var(--line); padding-left: 22px; }
.setup-field > label { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 9px; }
.file-row, .compact-actions { gap: 10px; flex-wrap: wrap; }
.field-note { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.daf-empty-note { direction: ltr; text-align: left; color: var(--muted); font-family: "Assistant", sans-serif; font-size: 14px; line-height: 1.6; max-width: 420px; }
.input-with-button { gap: 8px; }
.daf-picker-row { display: flex; gap: 8px; }
.daf-picker-row select { min-width: 0; }
.daf-picker-narrow { flex: 0 0 68px; }
.daf-picker-row .amud-toggle { flex: 0 0 auto; }
input[type="text"], input[type="number"], select {
  width: 100%; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4, 14, 27, .7);
  border-radius: 11px; padding: 10px 12px; outline: none;
}
input:focus, select:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
.input-with-button input { min-width: 0; }

/* color/text-decoration are needed here, not just inherited, because a
   couple of these ("Back to library" etc.) are <a> tags, not <button>s --
   an anchor has its own UA-default blue/underline that the plain
   `button { color: inherit; }` reset above never reaches. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-radius: 11px; padding: 10px 15px; color: inherit; font-weight: 700; text-decoration: none; cursor: pointer; transition: .18s ease; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: #fff; background: var(--accent); box-shadow: 0 10px 28px rgba(47, 110, 165,.15); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { background: rgba(255,255,255,.055); border: 1px solid var(--line); }
.button.secondary:hover, .button.ghost:hover { background: rgba(255,255,255,.09); }
.button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.button.small { padding: 8px 11px; font-size: 13px; }
.file-button { display: inline-flex; align-items: center; justify-content: center; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .9fr); gap: 18px; align-items: stretch; }
.player-card, .daf-card { padding: 20px; min-width: 0; min-height: 640px; display: flex; flex-direction: column; }
.card-heading { justify-content: space-between; gap: 20px; margin-bottom: 8px; }
.card-heading > div:first-child { min-width: 0; }
#lectureTitle, #dafTitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* #lectureTitle is an <h1> (see player/browse/watch/studio index.html), but
   the video's real title reads as a caption for the player, not a page
   headline -- the generic h1 size below was reported as much too large for
   that role. An id selector here beats the bare h1 rule (and the mobile
   h1 override in player/index.html) regardless of source order, so this
   is the only place font-size needs to change. */
#lectureTitle { font-size: 17px; font-weight: 700; letter-spacing: 0; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 5px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(20px, 2vw, 27px); margin-bottom: 0; letter-spacing: -.4px; }
h2 { margin-bottom: 0; }
.live-location { text-align: right; }
.live-location span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.live-location strong { display: block; font-size: 14px; color: var(--highlight); margin-top: 4px; }

/* The docked chrome's two rows are sized from these rather than from three
   separately hand-tuned pixel values that had to be kept in agreement by
   hand (the control bar's height, the timeline's offset above it, and the
   Vilna overlay's clearance below both). Compact mode -- see
   .video-frame.is-compact, applied by player-chrome.js from the frame's own
   width -- only has to override these two for all three to follow. */
/* The player chrome is dark on every page, including the three that load the
   light watch-theme -- so the brand gold is re-tuned brighter here, once,
   scoped to the frame, instead of each chrome rule reaching for a different
   variable than the rest of the site's. Everything inside inherits it,
   the scrubber's played-position gradient included: app.js writes that
   inline as var(--accent) (see updateScrubberFill), which resolves against
   whatever the element itself computes. */
.video-frame { --pc-bar-h: 68px; --pc-timeline-h: 74px; --accent: #2f6ea5; --accent-soft: rgba(47, 110, 165,.16); position: relative; background: #020812; overflow: hidden; border-radius: 15px; aspect-ratio: 16/9; border: 1px solid var(--line); flex-shrink: 0; }
.video-frame.is-compact { --pc-bar-h: 40px; --pc-timeline-h: 30px; }
.video-frame video { width: 100%; height: 100%; display: block; object-fit: contain; object-position: center top; background: #030914; }
.video-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); }
.empty-icon { font-size: 32px; color: var(--accent); }
.large-play { position: absolute; inset: 0; margin: auto; width: 74px; height: 74px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); background: rgba(4,14,27,.72); color: white; display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(10px); transition: .2s ease; }
.large-play:hover { transform: scale(1.05); background: rgba(47, 110, 165,.85); color: #fff; }
.large-play svg { width: 38px; height: 38px; }
.large-play.is-loading,
#playButton.is-loading { cursor: progress; }
.large-play.is-loading > *,
#playButton.is-loading > * { visibility: hidden; }
.large-play.is-loading::after,
#playButton.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  animation: dafsync-play-spin .8s linear infinite;
}
#playButton.is-loading { position: relative; }
@media (prefers-reduced-motion: reduce) {
  .large-play.is-loading::after,
  #playButton.is-loading::after { animation: none; }
}
@keyframes dafsync-play-spin { to { transform: rotate(360deg); } }

/* Covers the whole video frame -- the bottom used to stop short by
   calc(var(--pc-bar-h) + var(--pc-timeline-h)) to stay clear of the docked
   timeline + control bar below, but those auto-hide during playback
   (.video-frame.controls-hidden), so that reserved strip sat empty of daf
   most of the time a video is actually playing: reported directly as "the
   bottom third or so is clear of daf." z-index alone keeps this from
   covering the controls when they ARE shown -- .player-controls is 6 and
   .scrubber-wrap is 7, both above this wrap's 3, so the browser always
   routes a click in the control bar's own screen area to it, never to this
   wrap's pointer-events:auto canvas beneath, independent of how far down
   this box now extends. */
.video-vilna-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.video-vilna-overlay.mode-strip { top: auto; height: 30%; }
/* A phone's band of current lines is a little taller: three or four lines. */
@media (max-width: 760px), (pointer: coarse) {
  .video-vilna-overlay.mode-strip { height: 40%; }
}
#videoVilnaCanvas { width: 100%; height: 100%; display: block; pointer-events: auto; cursor: grab; touch-action: none; }
#videoVilnaCanvas:active { cursor: grabbing; }

.video-fullscreen-button { flex-shrink: 0; width: 30px; height: 30px; padding: 0; border: none; background: none; color: white; display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.video-fullscreen-button:hover { color: var(--accent); background: rgba(255,255,255,.1); }
.video-fullscreen-button svg { width: 16px; height: 16px; }

/* The overlay canvas is a sibling of the video/iframe, not inside either --
   the browser's native video/iframe fullscreen only shows that one element,
   which would leave the overlay behind. Fullscreening the whole .video-frame
   container instead keeps both together. */
.video-frame:fullscreen { width: 100vw; height: 100vh; aspect-ratio: unset; border-radius: 0; }
/* Standard-view video fullscreen has no Esc key on a phone. The control
   bar's own fullscreen icon hides with the chrome, so this stays on screen. */
.video-fullscreen-exit { display: none; }
.video-frame:fullscreen .video-fullscreen-exit,
.video-frame:-webkit-full-screen .video-fullscreen-exit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 30;
  top: max(12px, env(safe-area-inset-top, 0px));
  left: max(12px, env(safe-area-inset-left, 0px));
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 999px;
  background: rgba(8, 17, 28, .82);
  color: #fff;
  font: 800 14px "Assistant", sans-serif;
  cursor: pointer;
}
.video-frame:-webkit-full-screen { width: 100vw; height: 100vh; aspect-ratio: unset; border-radius: 0; }
.overlay-controls { display: flex; align-items: center; gap: 18px; margin-bottom: 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; }
.overlay-controls em { color: var(--muted); font-style: normal; opacity: .7; font-size: 11px; }
.overlay-hint { flex-basis: 100%; }
.overlay-mode-label, .overlay-opacity-label { display: flex; align-items: center; gap: 7px; }
.overlay-mode-label select { background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 4px 8px; }
.overlay-opacity-label input[type="range"] { accent-color: var(--accent); width: 110px; }

/* Playback controls -- scrubber+time, then play/seek/volume/settings/
   fullscreen -- docked directly onto the bottom of the video frame (see the
   HTML comment on .video-frame in every page that embeds this player)
   instead of sitting below it in normal page flow, replacing YouTube's own
   (now hidden -- see the `controls: 0` playerVar in app.js) control bar with
   this app's own. Real descendants of .video-frame this way, unlike their
   old below-the-card position, which is also what makes the FULL control set
   reachable in native fullscreen: only .video-frame's own descendants render
   at all there. Fixed pixel heights, both bars stacked absolutely with
   z-index above the daf overlay's own -- see that rule's comment for why the
   overlay's box can extend the full height of the frame without either bar
   losing clicks to it. */
/* z-index 7, one above .player-controls's 6: reported (with a screenshot)
   as the bottom half of the scrubber thumb getting cut off underneath the
   control bar. They share one edge (this wrap's bottom sits exactly at the
   control bar's top) with zero designed overlap, but the ::-webkit/-moz
   thumb pseudo-elements paint via negative margins that can round
   differently by sub-pixel amounts across browsers/zoom levels -- with
   identical z-index, DOM order alone decided the tie, and .player-controls
   comes second so it always won. A real z-index gap makes the thumb win
   any such overlap outright instead of depending on source order. */
.scrubber-wrap { position: absolute; left: 0; right: 0; bottom: var(--pc-bar-h); z-index: 7; height: var(--pc-timeline-h); padding: 0 18px 8px; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(to top, rgba(4,14,27,.72), rgba(4,14,27,0)); }
/* A plain `background` on <input type="range"> is a no-op in every
   browser's native (accent-color-driven) track rendering -- confirmed
   directly (a computed 3-stop gradient with genuinely distinct colors
   painted as flat, identical pixels across the whole unfilled track). The
   "played" position readers already saw was accent-color's own native fill,
   not this CSS -- fine for a plain two-color slider, but there's no
   accent-color equivalent for a THIRD color (the buffered-but-unplayed
   segment updateScrubberFill's now-3-stop gradient in app.js computes).
   appearance:none + explicit track/thumb pseudo-elements is the only
   reliable cross-browser way to make a JS-driven multi-color track actually
   render; `background: inherit` on the track pulls in whatever gradient
   app.js set on the input itself. Scoped to .scrubber only -- the volume/
   opacity sliders don't need a third color and keep their native
   accent-color rendering as-is. */
/* YouTube-style timeline: a thin track, red for what has played, a lighter
   grey for what is buffered, a muted grey for the rest, and a round red
   thumb. The input box is taller than the track (--scrub-hit) so a finger
   or a mouse lands on it easily; only the track and the thumb are painted,
   so the visible control stays a hairline. Hover, keyboard focus, and a
   drag thicken the track and grow the thumb, the way YouTube's does.
   app.js keeps --scrub-played-f / --scrub-buffered-f (0-1) current. The
   red ends at the thumb's centre, which the native range places between
   thumb/2 and width - thumb/2; scrubTimeFromClientX in app.js maps a press
   the same way, so the pressed point, the thumb, and the fill agree. */
.scrubber {
  --scrub-red: #ff0033;
  --scrub-track-h: 3px;
  /* The thumb's layout size never changes (the native range maps a click
     using it, mid-hover included); it looks smaller at rest by scale. */
  --scrub-thumb: 15px;
  --scrub-thumb-scale: .8;
  --scrub-hit: 20px;
  --scrub-p: calc(var(--scrub-thumb) / 2 + (100% - var(--scrub-thumb)) * var(--scrub-played-f, 0));
  --scrub-b: calc(var(--scrub-thumb) / 2 + (100% - var(--scrub-thumb)) * var(--scrub-buffered-f, 0));
  --scrub-fill: linear-gradient(to right,
    var(--scrub-red) 0 var(--scrub-p),
    rgba(255,255,255,.45) var(--scrub-p) var(--scrub-b),
    rgba(255,255,255,.22) var(--scrub-b) 100%);
  display: block;
  width: 100%;
  height: var(--scrub-hit);
  margin: 0;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent !important;
  border-radius: 4px;
  /* A horizontal drag on the timeline is a seek, never a page scroll. */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.scrubber:hover,
.scrubber:focus-visible,
.scrubber.is-scrubbing { --scrub-track-h: 5px; --scrub-thumb-scale: 1; }
.scrubber:focus { outline: none; }
.scrubber:focus-visible { outline: 2px solid rgba(255,255,255,.75); outline-offset: 1px; }
.scrubber::-webkit-slider-runnable-track {
  height: var(--scrub-track-h);
  border: 0;
  border-radius: 0;
  background: var(--scrub-fill);
  transition: height .1s ease;
}
.scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--scrub-thumb);
  height: var(--scrub-thumb);
  margin-top: calc((var(--scrub-track-h) - var(--scrub-thumb)) / 2);
  border: 0;
  border-radius: 50%;
  background: var(--scrub-red);
  box-shadow: 0 0 0 1px rgba(0,0,0,.18);
  cursor: pointer;
  transform: scale(var(--scrub-thumb-scale));
  transition: transform .1s ease, margin-top .1s ease;
}
.scrubber::-moz-range-track { height: var(--scrub-track-h); border: 0; border-radius: 0; background: var(--scrub-fill); }
.scrubber::-moz-range-thumb { width: var(--scrub-thumb); height: var(--scrub-thumb); border: none; border-radius: 50%; background: var(--scrub-red); cursor: pointer; transform: scale(var(--scrub-thumb-scale)); }
.scrub-preview { position: absolute; top: -51px; left: 0; width: min(290px, 68%); transform: translateX(-50%); padding: 9px 11px; background: #162b43; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 12px 35px rgba(0,0,0,.35); pointer-events: none; z-index: 4; }
.scrub-preview::after { content: ""; position: absolute; bottom: -6px; left: 50%; width: 10px; height: 10px; background: #162b43; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); transform: translateX(-50%) rotate(45deg); }
.scrub-preview strong, .scrub-preview span { display: block; }
.scrub-preview strong { color: var(--accent); font-size: 12px; }
.scrub-preview span { direction: rtl; text-align: right; font-family: "Frank Ruhl Libre", serif; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time-row { justify-content: space-between; color: rgba(255,255,255,.85); font-size: 11px; margin-top: 3px; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.player-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: var(--pc-bar-h); gap: 14px; padding: 0 16px; justify-content: space-between; background: rgba(6,15,26,.93); border-top: 1px solid rgba(255,255,255,.07); backdrop-filter: blur(12px); }
/* Auto-hide (see showVideoControls/scheduleControlsHide in app.js): shown
   briefly when a video first cues, then only again on hover/tap over the
   frame -- previously this bar had no hidden state at all and permanently
   covered the bottom of the video. .large-play (the big center play
   button) is deliberately NOT included here; it has its own show/hide
   logic tied to playback state, not to hover. */
.video-frame.controls-hidden .scrubber-wrap,
.video-frame.controls-hidden .player-controls,
.video-frame.controls-hidden .player-topbar { opacity: 0; visibility: hidden; pointer-events: none; }
.scrubber-wrap, .player-controls, .player-topbar { transition: opacity .25s ease, visibility 0s linear .25s; }
.video-frame:not(.controls-hidden) .scrubber-wrap,
.video-frame:not(.controls-hidden) .player-controls,
.video-frame:not(.controls-hidden) .player-topbar { transition: opacity .25s ease, visibility 0s linear 0s; }
.icon-button, .play-button, .vaater-button { border: 1px solid rgba(255,255,255,.25); cursor: pointer; background: rgba(255,255,255,.1); color: #fff; }
/* display:grid + place-items:center (the same fix .video-fullscreen-button
   already had) -- without it, a native <button>'s own UA-default content
   alignment is what centers the SVG inside, which isn't reliable: reported
   (with a screenshot) as the mute button's speaker icon sitting visibly
   left-of-center in its own box. padding:0 so that centering isn't then
   skewed by the button's own default padding on one side. */
.icon-button { width: 30px; height: 30px; padding: 0; border-radius: 8px; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.icon-button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.pc-tools-menu .pc-stack.is-on { background: rgba(47, 110, 165, .42); }
.pc-tools-menu .pc-stack.is-on .pc-label { color: #fff; font-weight: 800; }
/* Wider than .icon-button on purpose -- named for the word it needs to fit
   ("Vaater"), not sized to it after the fact. The skip-forward glyph (two
   triangles + a bar, the same shape this control used before it grew a
   text label) reads as "skip" on sight, before a reader has learned what
   the word means. */
.vaater-button { height: 30px; padding: 0 13px 0 10px; border-radius: 8px; font-size: 13px; font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.vaater-button svg { width: 16px; height: 16px; flex-shrink: 0; }
.vaater-button:disabled { opacity: .35; cursor: not-allowed; }
.play-button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; border-color: transparent; }
.play-button svg { width: 18px; height: 18px; }
.control-divider { width: 1px; height: 18px; background: rgba(255,255,255,.25); margin: 0 2px; flex-shrink: 0; }
/* Separates the left-aligned playback controls from the right-aligned
   settings/fullscreen group -- NOT the shared .push-right (below), which the
   narrow-viewport media query (max-width:700px) stretches to width:100% for
   its one other use (#editModeButton, alone in .edit-mode-row); reusing it
   here would stretch this divider to the same 100% at that breakpoint and
   wrap the settings/fullscreen buttons clean out of the (fixed-height,
   never-wrapping) bar. */
.control-divider-end { margin-left: auto; }
.volume-button svg { width: 16px; height: 16px; }
.volume-slider { width: 54px; accent-color: var(--accent); flex-shrink: 0; }
.speed-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: inherit; font-size: 12px; }
.push-right { margin-left: auto; }

/* Edit-mode-row (admin-only "Edit synchronization" button, the one control
   that was in .player-controls but ISN'T a playback control -- it opens a
   whole separate sync-editing UI, not something that belongs floating over
   the video itself) -- back in normal page flow below the video frame. */
.edit-mode-row { margin-top: 9px; display: flex; }

/* Speed + quality tucked behind a small gear -- the same <details> pattern
   as .overlay-settings (player/index.html's own inline <style>) -- instead
   of two always-visible selects, since there's no room for those alongside
   everything else in a bar docked over a phone-width video. */
.video-settings { position: relative; flex-shrink: 0; }
.video-settings summary { list-style: none; cursor: pointer; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #fff; }
.video-settings summary:hover { background: rgba(255,255,255,.12); }
.video-settings summary::-webkit-details-marker { display: none; }
.video-settings summary::after { content: '⚙'; font-size: 15px; }
.video-settings-body {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  /* Above reading mode's own drag/resize overlays (.reading-video-pinch-
     surface at 11, .reading-video-resize at 12 -- see player/index.html and
     browse/index.html) -- both are also descendants of .video-frame and sat
     ABOVE this panel at its old z-index 8, so opening it there swallowed
     every click meant for the panel itself, silently. */
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 150px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(10,20,32,.96);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 14px 38px rgba(0,0,0,.45);
  font-size: 12px;
  color: rgba(255,255,255,.9);
}
.video-settings-body select { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: #fff; border-radius: 6px; padding: 4px 6px; }
.quality-control { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: inherit; font-size: 12px; }
.video-settings-overlay-group { display: flex; flex-direction: column; gap: 8px; }
/* Reparented to <body> by player-chrome.js (see there for why) -- position
   and right/bottom are then set inline per open, anchored to the gear's own
   screen coordinates; this covers everything that isn't per-instance
   geometry. z-index matches .daf-context-menu's own 600, the established
   value for a menu portaled to <body> specifically to never be clipped or
   outranked -- 30 was high enough to clear .toast (20) but not Split View's
   own full-viewport .watch-layout.split-active (500, see styles.css) or
   #noteDialog (also 500): reported directly as the gear's panel opening
   with nothing visible or clickable at the spot it should have appeared,
   only in Split View, where .watch-layout.split-active's own z-index:500
   stacking context paints its ENTIRE descendant tree -- the real video, the
   daf pane, everything -- above this panel's sibling-of-<body> position,
   leaving a real, positioned, non-hidden panel completely invisible and
   un-clickable underneath it. */
.video-settings-body-portal { z-index: 600; }
/* The Vilna overlay this section configures is unusable while reading mode
   is active (the two are mutually exclusive -- see setReadingMode in
   app.js), so its settings have nothing to do there either. Keyed off
   body.reading-mode-active alone, not .reading-video-float -- the panel
   itself is reparented to <body> (see player-chrome.js), so it's no longer
   a descendant of the mini player to scope a selector through, and this
   condition holds regardless of which page/frame the panel came from. */
body.reading-mode-active .video-settings-overlay-group { display: none !important; }
.video-settings-heading { margin: 4px 0 0; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.14); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

/* --- Player chrome --------------------------------------------------------
   The bar across the top of the video and the labelled control bar below it,
   both built by player-chrome.js (see there for why they're rendered in one
   shared script instead of hand-written into all four pages that embed the
   player). Everything here lives inside .video-frame, so it survives native
   fullscreen and fades with the rest of the chrome on .controls-hidden. */

/* The surface that lets faded-out controls be brought back over a YouTube
   shiur, whose iframe fills the frame and keeps every mouse event to itself
   (see player-chrome.js for the full story). Inert while the controls are
   showing, so it changes nothing about normal use; live only once they have
   hidden. z-index 2 puts it above the iframe but below the Vilna overlay (3)
   and the centre play button (4), both of which stay directly clickable. */
.video-click-surface {
  display: none;
  position: absolute;
  inset: 0 0 calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px));
  z-index: 2;
  background: transparent;
  cursor: pointer;
}
.video-frame.youtube-active .video-click-surface { display: block; }
.video-frame.controls-hidden .video-click-surface { pointer-events: none; }
.player-wake-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.video-frame.controls-hidden .player-wake-layer { pointer-events: auto; }

.player-topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 7;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; padding: 0 16px; color: #fff;
  background: linear-gradient(to bottom, rgba(4,12,22,.9), rgba(4,12,22,0));
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.video-frame:not(.controls-hidden) .player-topbar { transition: opacity .25s ease, visibility 0s linear 0s; }
.video-frame.controls-hidden .player-topbar { opacity: 0; visibility: hidden; pointer-events: none; }
.player-topbar-group { display: flex; align-items: center; gap: 11px; min-width: 0; }
.player-topbar-actions { flex-shrink: 0; }
.player-topbar-rule { width: 1px; height: 20px; background: rgba(255,255,255,.22); flex-shrink: 0; }
/* Nothing to separate until the Hebrew title actually resolves -- it needs
   both talmud_index.json's hebrewName and the gematria module (see
   refreshDafIdentity), so it can legitimately be empty. */
.player-topbar:not(.has-hebrew) .player-topbar-rule-he { display: none; }
.player-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; flex-shrink: 0; }
.player-brand img { width: 26px; height: 26px; }
.player-daf-button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 0; border-radius: 9px; background: none; color: #fff; font: inherit; font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.player-daf-button:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.player-daf-button:disabled { cursor: default; }
.player-daf-chevron { display: grid; place-items: center; transition: transform .18s ease; }
.player-daf-chevron svg { width: 15px; height: 15px; display: block; }
.player-daf-button[aria-expanded="true"] .player-daf-chevron { transform: rotate(180deg); }
.player-daf-hebrew { font-family: "Frank Ruhl Libre", serif; font-size: 17px; color: rgba(255,255,255,.86); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-chrome-button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 9px; background: none; color: rgba(255,255,255,.88); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.player-chrome-button svg { width: 17px; height: 17px; flex-shrink: 0; }
.player-chrome-button:hover { background: rgba(255,255,255,.12); color: #fff; }
.player-chrome-button[aria-pressed="true"] { color: var(--accent); }

.player-chrome-menu { position: absolute; top: calc(100% - 4px); z-index: 9; min-width: 210px; padding: 12px; border-radius: 13px; background: rgba(9,19,32,.98); border: 1px solid rgba(255,255,255,.16); box-shadow: 0 22px 54px rgba(0,0,0,.5); }
.player-daf-menu { left: 16px; }
.player-more-menu { right: 16px; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.player-chrome-menu-item { text-align: left; padding: 9px 11px; border: 0; border-radius: 8px; background: none; color: #f4f7fb; font: inherit; font-size: 13px; cursor: pointer; }
.player-chrome-menu-item:hover { background: rgba(255,255,255,.12); color: #fff; }
/* The page's real daf picker is moved in here rather than duplicated, so it
   arrives with the setup strip's own layout classes and needs re-fitting to
   a narrow popover. */
.player-daf-menu .setup-field { display: flex; flex-direction: column; gap: 9px; }
.player-daf-menu .setup-field > label { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #c5d4e4; }
.player-daf-menu select { color: #f4f7fb; background-color: rgba(4, 14, 27, .85); }
.player-daf-menu .daf-picker-row, .player-daf-menu .picker-toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.player-daf-menu select { min-width: 0; }

/* Control bar: three clusters, space-between. */
.pc-group { display: flex; align-items: center; min-width: 0; }
.pc-transport { gap: 10px; flex-shrink: 0; }
/* flex-shrink: 0 like its two siblings -- .pc-group's own min-width:0 makes
   every cluster shrinkable by default, and this was the one cluster that
   never opted back out. At a width the is-tiny tier still can't fit (see
   fitChrome in player-chrome.js, which has nothing narrower to step down
   to), .player-controls' justify-content: space-between had nothing left to
   collapse but this group's own box -- shrinking it past its own mute
   button's width let that button spill out and visually overlap .pc-tools'
   speed control right after it, reported (with a screenshot) as the volume
   and speed controls sitting on top of each other. Matching its siblings
   means the bar can still overflow the frame at an extreme width, but
   .video-frame's own overflow:hidden clips that overflow at its trailing
   (least essential) edge instead of two controls overlapping mid-bar. */
.pc-volume { gap: 8px; flex-shrink: 0; }
/* flex-start, so the pills (which carry their label inline and so are
   shorter) line their glyphs up with the icon row of the captioned stacks
   beside them, rather than centring against the stacks' taller boxes.

   flex-shrink: 0 like its two siblings (see .pc-volume's own comment for
   why matching them matters) -- whatever this group can't fit is moved into
   the "More" overflow menu by fitChrome() in player-chrome.js (see there),
   not scrolled to or clipped, so there's no need for this group itself to
   shrink or scroll: by the time it's rendered, it only ever holds what
   already fits. */
.pc-tools { gap: 8px; align-items: flex-start; flex-shrink: 0; }
/* A control with its caption underneath, as every item in the right-hand
   cluster is drawn. The caption is hidden (never removed) in compact mode,
   so the control itself keeps its place and its accessible name either way. */
/* flex-shrink: 0 so a stack keeps its natural size and .pc-tools' own
   overflow-x:auto is what absorbs the shrinkage, not each individual
   control getting squeezed thinner. */
.pc-stack { display: flex; flex-direction: column; align-items: center; gap: 3px; flex-shrink: 0; }
.pc-label { font-size: 10px; font-weight: 600; letter-spacing: .02em; color: rgba(255,255,255,.6); white-space: nowrap; }

.pc-transport .icon-button { width: 36px; height: 36px; border-radius: 50%; border-color: transparent; background: none; color: rgba(255,255,255,.92); }
.pc-transport .icon-button:hover { background: rgba(255,255,255,.12); color: #fff; }
.pc-transport .icon-button svg { width: 24px; height: 24px; }
/* An outlined gold ring rather than a filled disc -- at this size a solid
   fill dominates everything else docked over the video. */
.pc-transport .play-button { width: 46px; height: 46px; background: none; border: 2px solid var(--accent); color: var(--accent); }
.pc-transport .play-button:hover { background: var(--accent); color: #fff; }
.pc-transport .play-button svg { width: 20px; height: 20px; }
.pc-time { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; font-size: 13px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.86); white-space: nowrap; }
.pc-time-sep { color: rgba(255,255,255,.38); }

.pc-volume .volume-slider { width: 92px; }
/* Native select chrome replaced with the bar's own value + chevron, so speed
   reads as one control alongside the icon buttons rather than a form field.
   Still the same <select> app.js listens to (and still keyboard-navigable).
   Boxed the same way .icon-button/.pc-pill are (border, background, rounded
   corners) -- previously unboxed, with no height of its own, so it sized to
   its own short line of text rather than the row's other 30px controls.
   .pc-tools aligns every child to the row's TOP (see its own comment), so a
   shorter box there reads as sitting noticeably higher than its neighbors,
   reported (with a screenshot) as "1x" looking uncentered against the mute/
   captions buttons beside it -- giving it the same fixed height they already
   have is what actually fixes that, the box itself is just what makes that
   height read as intentional rather than arbitrary. */
/* padding/gap trimmed down from the box's first pass -- reported as reading
   noticeably longer than it needs to for two characters and a chevron ("1x
   ▾"), next to icon buttons that are all pure glyph with no padding to
   spare by comparison. */
/* #speedSelect is one plain <button>, not a wrapper around a differently-
   sized <select> -- see the long comment on its construction in
   player-chrome.js for why a native picker was replaced outright. The
   visible box and the clickable element are the same node, which makes the
   old bug class here (a pill bigger than the control it wraps, reported
   directly as "nothing happens when I press the 1x button") structurally
   impossible: there is no separate wrapper left to be the wrong size. */
.speed-select { position: relative; display: inline-flex; align-items: center; height: 30px; padding: 0 17px 0 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.92); font: inherit; font-size: 14px; font-weight: 700; line-height: 1; cursor: pointer; touch-action: manipulation; }
.speed-select:focus { outline: none; box-shadow: none; }
.speed-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* pointer-events: none -- purely decorative text, not an independently
   hit-testable target. Without it, a click landing exactly on the label
   still reaches the button (the click bubbles), but elementFromPoint would
   report the SPAN there instead of the button -- the same shape of gap
   (a child quietly answering for its own ancestor's hit area) that #126 was
   about in the first place, just with no functional break behind it here. */
.speed-select-value { pointer-events: none; }
.speed-select::after { content: '▾'; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 10px; line-height: 1; opacity: .75; pointer-events: none; }

/* The listbox itself: portaled to <body> and positioned in JS
   (positionSpeedMenu in player-chrome.js), exactly like .pc-tools-menu below
   and for the identical reason -- a descendant of .player-controls can't
   out-rank .scrubber-wrap's z-index, and .video-frame's own overflow:hidden
   would clip it outright in the reading-mode mini player specifically.
   z-index matches .daf-context-menu's own 600, not .video-settings-body-
   portal's ORIGINAL 30 -- see that rule's own comment: 30 cleared .toast but
   not Split View's full-viewport .watch-layout.split-active (z-index 500),
   whose entire descendant tree paints above a sibling-of-<body> element at
   30 regardless of this menu's own correct position/visibility, which is
   exactly what made choosing a speed do nothing while Split View was
   active -- the menu was genuinely there, just invisible and unclickable
   underneath the real video and daf pane. */
.speed-menu { position: fixed; z-index: 710; min-width: 92px; margin: 0; padding: 4px; list-style: none; border-radius: 10px; background: rgba(10,20,32,.96); border: 1px solid rgba(255,255,255,.15); box-shadow: 0 14px 38px rgba(0,0,0,.45); }
.speed-menu:focus { outline: none; }
.speed-menu li { padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.85); cursor: pointer; }
.speed-menu li:hover, .speed-menu li.is-active { background: rgba(255,255,255,.12); color: #fff; }
.speed-menu li[aria-selected="true"] { color: var(--accent); }

/* The two "where does the daf go" toggles. Their pressed look is the gold
   outline, so which one is on reads at a glance from across the room. */
.pc-pill { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); font: inherit; font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; flex-shrink: 0; }
.pc-pill svg { width: 17px; height: 17px; flex-shrink: 0; }
.pc-pill:hover { background: rgba(255,255,255,.13); color: #fff; }
.pc-pill[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* The "More" overflow tray: whatever fitChrome() (player-chrome.js) moves
   out of .pc-tools when the bar runs out of room lands here instead of off
   the edge of it. Reparented to <body> and positioned in JS from the "More"
   button's own screen coordinates each time it opens -- the exact same
   escape-the-clipping-and-stacking-context trick .video-settings-body-portal
   above already uses, and for the same reason: a descendant of
   .player-controls can't out-rank .scrubber-wrap's z-index no matter how
   high it's set, and .video-frame's own overflow:hidden would clip it
   outright in the reading-mode mini player specifically. Visually matched to
   .video-settings-body (dark panel, same radius/shadow) rather than
   .player-chrome-menu -- that one is styled for the light-mode watch-theme
   .player-chrome-menu-item rows expect, but this tray is scoped entirely to
   the always-dark video chrome, same as the settings panel it sits beside. */
.pc-tools-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 168px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(10,20,32,.96);
  border: 1px solid rgba(255,255,255,.15);
  box-shadow: 0 14px 38px rgba(0,0,0,.45);
  /* Matches .speed-menu/.video-settings-body-portal's own 600, not the
     original 30 -- see .video-settings-body-portal's comment on why that
     was never enough to clear Split View's .watch-layout.split-active. */
  z-index: 600;
}
/* Every row reuses the SAME control moved wholesale out of .pc-tools (not a
   copy -- see fitChrome), so it keeps its real listeners, pressed state and
   id; only its layout changes, from the bar's icon-over-caption stack to a
   plain icon + label row. Escaping .video-frame by being portaled to <body>
   is what lets this override win over the tiered is-snug/is-compact/is-tiny
   rules elsewhere in this file without fighting their specificity: those are
   all scoped through .video-frame, which this tray is no longer a
   descendant of once moved here. */
.pc-tools-menu .pc-label { pointer-events: none; }
.pc-tools-menu .pc-stack,
.pc-tools-menu .pc-pill {
  flex-direction: row;
  width: 100%;
  height: auto;
  padding: 8px 9px;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  background: none;
}
.pc-tools-menu .pc-stack:hover,
.pc-tools-menu .pc-pill:hover { background: rgba(255,255,255,.1); }
.pc-tools-menu .pc-pill { justify-content: flex-start; color: rgba(255,255,255,.9); }
.pc-tools-menu .pc-pill[aria-pressed="true"] { color: var(--accent); }
.pc-tools-menu .pc-label { display: block; order: 2; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }
.pc-tools-menu .icon-button,
.pc-tools-menu .video-settings summary { width: 26px; height: 26px; flex-shrink: 0; }
.pc-tools-menu .video-settings { position: static; }

/* Timeline: the scrubber with its two times at either end, and the chapter
   markers standing above it. */
.pc-rail { display: flex; align-items: center; gap: 12px; }
.pc-rail .scrubber { flex: 1; min-width: 0; }
.pc-rail-time { flex-shrink: 0; min-width: 42px; font-size: 12px; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.82); text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.pc-rail-time:last-child { text-align: right; }

.chapter-markers { position: relative; flex: 1; min-height: 0; margin: 0 42px 2px 54px; }
/* Anchored by its dot: the marker's whole label hangs to the right of the
   time it points at, with a hairline dropping to the bar. */
.chapter-marker { position: absolute; bottom: 0; transform: translateX(-4px); display: flex; align-items: flex-start; gap: 7px; max-width: 190px; padding: 0; border: 0; background: none; color: #fff; text-align: left; cursor: pointer; }
.chapter-marker::after { content: ''; position: absolute; left: 3px; top: 12px; bottom: -11px; width: 1px; background: rgba(255,255,255,.32); }
.chapter-marker-dot { width: 8px; height: 8px; margin-top: 3px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.chapter-marker-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.chapter-marker-ref { font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.chapter-marker-he { font-family: "Frank Ruhl Libre", serif; font-size: 13px; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.chapter-marker:hover .chapter-marker-ref, .chapter-marker:hover .chapter-marker-he { color: var(--accent); }
/* The last marker sits at (or near) the end of the bar, where a label
   hanging to the right would run off the frame -- it hangs left instead. */
.chapter-marker.is-last { transform: translateX(calc(-100% + 4px)); flex-direction: row-reverse; text-align: right; }
.chapter-marker.is-last .chapter-marker-body { align-items: flex-end; }
.chapter-marker.is-last::after { left: auto; right: 3px; }

/* Snug: the split layout's own video column, around 600-700px wide, where
   the full bar's captions and volume slider are the first things that can go
   without losing a control. Compact (below) goes further. Both are applied
   by player-chrome.js from the FRAME's width, not the viewport's -- one page
   shows this player at several sizes at once. */
.video-frame.is-snug { --pc-bar-h: 54px; --pc-timeline-h: 66px; }
.video-frame.is-snug .pc-label,
.video-frame.is-snug .volume-slider { display: none; }
/* The bar's own "12:47 / 45:36" readout duplicates what the timeline rail
   directly above it already shows at its two ends (pc-rail-time mirrors
   #currentTime/#duration live -- see mirrorTimes in player-chrome.js), so
   it's the first thing to give up here, not the pill labels next to it:
   dropping one truly redundant control buys back more room than shrinking
   two controls the redesign is actually about. */
.video-frame.is-snug .pc-time { display: none; }
.video-frame.is-snug .player-controls { gap: 6px; padding: 0 12px; }
.video-frame.is-snug .pc-tools { gap: 4px; }
.video-frame.is-snug .pc-transport { gap: 4px; }
.video-frame.is-snug .pc-transport .play-button { width: 38px; height: 38px; }
.video-frame.is-snug .pc-pill { height: 32px; padding: 0 9px; font-size: 12px; gap: 5px; }
.video-frame.is-snug .chapter-marker-he { display: none; }
/* The word stays at every width, including a phone. Hiding it left a
   26px icon that read as no button at all. */
.video-frame.is-snug .vaater-button,
.video-frame.is-compact .vaater-button,
.video-frame.is-tiny .vaater-button { padding: 0 8px 0 6px; flex-shrink: 0; }

/* Compact: reading mode's floating mini-player, and phones. */
.video-frame.is-compact .player-topbar { height: 38px; padding: 0 9px; }
/* .pc-time goes here rather than being squeezed: the timeline rail directly
   above already shows both times at its two ends, and dropping the one
   duplicated readout is what buys the room for every actual CONTROL to stay
   in the bar at this width instead of overflowing off the end of it. */
.video-frame.is-compact .player-brand span,
.video-frame.is-compact .player-daf-hebrew,
.video-frame.is-compact .player-topbar-rule,
.video-frame.is-compact .player-chrome-button span,
.video-frame.is-compact .pc-label,
.video-frame.is-compact .pc-pill span,
.video-frame.is-compact .pc-time,
.video-frame.is-compact .chapter-markers,
.video-frame.is-compact .volume-slider { display: none; }
.video-frame.is-compact .player-controls { gap: 8px; padding: 0 8px; }
.video-frame.is-compact .pc-transport { gap: 4px; }
.video-frame.is-compact .pc-transport .play-button { width: 30px; height: 30px; border-width: 1.5px; }
.video-frame.is-compact .pc-transport .play-button svg { width: 14px; height: 14px; }
.video-frame.is-compact .pc-transport .icon-button { width: 26px; height: 26px; }
.video-frame.is-compact .pc-transport .icon-button svg { width: 18px; height: 18px; }
.video-frame.is-compact .pc-time { margin-left: 2px; font-size: 11px; }
.video-frame.is-compact .pc-pill { height: 28px; padding: 0 8px; }
.video-frame.is-compact .pc-tools { gap: 4px; }
.video-frame.is-compact .scrubber-wrap { padding: 0 10px 5px; }
.video-frame.is-compact .pc-rail { gap: 7px; }
.video-frame.is-compact .pc-rail-time { min-width: 34px; font-size: 10px; }

/* Tiny: a mini-player dragged down to its smallest, or a narrow phone. The
   last tier still fits every control -- it buys the room back from the gaps
   and glyph sizes rather than by dropping any of them, since there's nowhere
   else left to reach a control that isn't in this bar. */
.video-frame.is-tiny { --pc-bar-h: 34px; --pc-timeline-h: 24px; }
.video-frame.is-tiny .player-controls { gap: 3px; padding: 0 5px; }
.video-frame.is-tiny .pc-transport { gap: 1px; }
.video-frame.is-tiny .pc-tools { gap: 1px; }
.video-frame.is-tiny .pc-transport .icon-button,
.video-frame.is-tiny .icon-button,
.video-frame.is-tiny .video-fullscreen-button,
.video-frame.is-tiny .video-settings summary { width: 22px; height: 22px; }
.video-frame.is-tiny .pc-transport .icon-button svg { width: 15px; height: 15px; }
.video-frame.is-tiny .pc-transport .play-button { width: 25px; height: 25px; }
.video-frame.is-tiny .pc-transport .play-button svg { width: 12px; height: 12px; }
.video-frame.is-tiny .pc-pill { height: 22px; padding: 0 5px; }
.video-frame.is-tiny .pc-pill svg { width: 14px; height: 14px; }
.video-frame.is-tiny .speed-select { height: 22px; padding: 0 15px 0 6px; font-size: 12px; }
.video-frame.is-tiny .player-topbar { height: 30px; padding: 0 7px; }

/* Phones (and a short landscape phone, which is still wide enough to miss
   the 760px sidebar breakpoint). The controls stay big enough to tap, but
   they read like a phone player: ~34px glyphs, no filled boxes, and a short
   light fade behind the title row and the control row instead of a tall
   dark slab over the picture. The reading-mode mini player below keeps its
   own smaller chrome so its resize handle stays reachable. */
@media (max-width: 760px), (max-height: 520px) and (max-width: 1100px) {
  .video-frame.is-compact,
  .video-frame.is-tiny { --pc-bar-h: 36px; --pc-timeline-h: 22px; }
  .video-frame.is-compact .player-topbar,
  .video-frame.is-tiny .player-topbar {
    height: 40px;
    padding: 0 8px;
    /* The fade ends at the bottom of the title row. It does not continue
       down over the picture. */
    background: linear-gradient(to bottom, rgba(4,12,22,.42), rgba(4,12,22,0));
  }
  /* The phone title row used to fade out, and YouTube's own title and
     icons sat in that transparent band, behind our controls. Keep this
     row solid for a YouTube shiur. The picture below it stays clear. */
  .video-frame.youtube-active.is-compact .player-topbar,
  .video-frame.youtube-active.is-tiny .player-topbar {
    background: #07111c;
  }
  .video-frame.is-compact .player-controls,
  .video-frame.is-tiny .player-controls {
    gap: 6px;
    padding: 0 8px;
    background: transparent;
    border-top: 0;
    backdrop-filter: none;
  }
  .video-frame.is-compact .player-controls::before,
  .video-frame.is-tiny .player-controls::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    /* The control row only. A 58px fade covered the timeline and a band of
       picture above it — about half of a short Split video. */
    height: 36px;
    background: linear-gradient(to top, rgba(4,14,27,.4), rgba(4,14,27,0));
    pointer-events: none;
    z-index: -1;
  }
  .video-frame.is-compact .scrubber-wrap,
  .video-frame.is-tiny .scrubber-wrap {
    background: none;
    padding: 0 8px 0;
  }
  .video-frame.is-compact .pc-transport,
  .video-frame.is-tiny .pc-transport,
  .video-frame.is-compact .pc-tools,
  .video-frame.is-tiny .pc-tools,
  .video-frame.is-compact .pc-volume,
  .video-frame.is-tiny .pc-volume { gap: 4px; }
  .video-frame.is-compact .pc-transport .icon-button,
  .video-frame.is-tiny .pc-transport .icon-button,
  .video-frame.is-compact .pc-volume .icon-button,
  .video-frame.is-tiny .pc-volume .icon-button,
  .video-frame.is-compact .pc-tools .icon-button,
  .video-frame.is-tiny .pc-tools .icon-button,
  .video-frame.is-compact .video-fullscreen-button,
  .video-frame.is-tiny .video-fullscreen-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .video-frame.is-compact .pc-transport .icon-button svg,
  .video-frame.is-tiny .pc-transport .icon-button svg,
  .video-frame.is-compact .pc-volume .icon-button svg,
  .video-frame.is-tiny .pc-volume .icon-button svg,
  .video-frame.is-compact .pc-tools .icon-button svg,
  .video-frame.is-tiny .pc-tools .icon-button svg,
  .video-frame.is-compact .video-fullscreen-button svg,
  .video-frame.is-tiny .video-fullscreen-button svg,
  .video-frame.is-compact .vaater-button svg,
  .video-frame.is-tiny .vaater-button svg {
    width: 22px;
    height: 22px;
  }
  .video-frame.is-compact .pc-transport .play-button,
  .video-frame.is-tiny .pc-transport .play-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    background: none;
    border: 1.5px solid rgba(255,255,255,.88);
    color: #fff;
  }
  .video-frame.is-compact .pc-transport .play-button svg,
  .video-frame.is-tiny .pc-transport .play-button svg { width: 16px; height: 16px; }
  .video-frame.is-compact .vaater-button,
  .video-frame.is-tiny .vaater-button {
    width: auto;
    height: 32px;
    min-width: 0;
    min-height: 32px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 13px;
    gap: 2px;
  }
  .video-frame.is-compact .speed-select,
  .video-frame.is-tiny .speed-select {
    height: 32px;
    min-height: 32px;
    min-width: 0;
    padding: 0 14px 0 4px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .video-frame.is-compact .pc-tools .icon-button[aria-pressed="true"],
  .video-frame.is-tiny .pc-tools .icon-button[aria-pressed="true"] {
    color: var(--accent);
    background: transparent;
  }
  /* A finger needs a tall target; the painted bar stays 3px. */
  .video-frame.is-compact .scrubber,
  .video-frame.is-tiny .scrubber {
    --scrub-hit: 28px;
    --scrub-thumb: 17px;
    --scrub-thumb-scale: .76;
  }
  .video-frame.is-compact .scrubber.is-scrubbing,
  .video-frame.is-tiny .scrubber.is-scrubbing { --scrub-thumb-scale: 1; }
  .split-toolbar .icon-button { width: 36px; height: 36px; min-width: 36px; min-height: 36px; }
  /* The reading-mode mini player is a small float with its resize handle in
     the bottom-right corner. 44px targets there cover that handle, so the
     float's own fullscreen button never receives the tap. It keeps the
     compact chrome the page already sets for the float. */
  body.reading-mode-active .reading-video-float .video-frame.is-compact .pc-transport .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .pc-transport .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-compact .pc-volume .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .pc-volume .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-compact .pc-tools .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .pc-tools .icon-button,
  body.reading-mode-active .reading-video-float .video-frame.is-compact .video-fullscreen-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .video-fullscreen-button {
    width: 22px;
    height: 22px;
    min-width: 0;
    min-height: 0;
  }
  body.reading-mode-active .reading-video-float .video-frame.is-compact .pc-transport .play-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .pc-transport .play-button {
    width: 25px;
    height: 25px;
    min-width: 0;
    min-height: 0;
  }
  body.reading-mode-active .reading-video-float .video-frame.is-compact .vaater-button,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .vaater-button {
    width: auto;
    min-width: 0;
    min-height: 0;
  }
  body.reading-mode-active .reading-video-float .video-frame.is-compact .speed-select,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .speed-select {
    height: 22px;
    min-width: 0;
    min-height: 0;
    padding: 0 15px 0 6px;
  }
  /* The mini player's resize handle shares this corner; keep its timeline
     box short so it does not reach over the handle. */
  body.reading-mode-active .reading-video-float .video-frame.is-compact .scrubber,
  body.reading-mode-active .reading-video-float .video-frame.is-tiny .scrubber {
    --scrub-hit: 14px;
    --scrub-thumb: 13px;
    --scrub-thumb-scale: .9;
  }
  body.reading-mode-active .reading-video-float .video-frame .player-controls {
    background: rgba(6,15,26,.93);
    border-top: 1px solid rgba(255,255,255,.07);
  }
  body.reading-mode-active .reading-video-float .video-frame .player-controls::before { content: none; }
}

.now-learning { margin-top: 17px; padding: 15px 17px; border-radius: 14px; border: 1px solid rgba(47, 110, 165,.24); background: linear-gradient(135deg, rgba(47, 110, 165,.11), rgba(82,167,255,.06)); min-height: 113px; }
.now-label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px; }
#currentPhrase { font-family: "Frank Ruhl Libre", serif; font-weight: 600; font-size: clamp(22px, 2.3vw, 31px); color: var(--highlight); }
#currentTranslation { margin: 5px 0 0; color: var(--muted); font-size: 14px; }

.daf-heading h2 { font-family: "Frank Ruhl Libre", serif; font-size: 28px; }
.view-switch { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line); }
.view-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.view-switch button.active { background: rgba(255,255,255,.08); color: var(--text); }
.daf-toolbar { justify-content: space-between; gap: 14px; margin-bottom: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.video-choice { margin: 0 0 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line, #d9e1eb); background: rgba(255,255,255,.04); }
.video-choice[hidden] { display: none; }
.video-choice-title { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text); }
.video-choice-list { display: grid; gap: 8px; }
.video-choice-option { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line, #d9e1eb); background: transparent; color: var(--text); cursor: pointer; font: inherit; min-width: 0; }
.video-choice-option:hover { background: rgba(255,255,255,.07); }
.video-choice-option[aria-pressed="true"] { border-color: var(--accent-strong); background: rgba(255,255,255,.1); }
.video-choice-option strong { font-size: 14px; }
.video-choice-option span { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-runs { margin: 12px 16px 4px; padding: 12px; border-radius: 12px; border: 1px solid var(--line, #d9e1eb); background: var(--paper, #fff); }
.test-runs[hidden] { display: none; }
.test-runs-title { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.test-runs-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.test-run-field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.test-run-field select { width: 100%; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #d9e1eb); background: var(--paper, #fff); color: var(--ink, #132238); font-size: 13px; text-overflow: ellipsis; }
.test-run-field select:disabled { opacity: .55; }
.test-runs-note { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.sync-method-switch { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line); }
.sync-method-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.sync-method-switch button.active { background: rgba(255,255,255,.08); color: var(--text); }
.toggle-label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.toggle-label input { position: absolute; opacity: 0; }
.toggle { width: 34px; height: 19px; border-radius: 999px; background: rgba(255,255,255,.14); position: relative; transition: .2s; }
.toggle::after { content: ""; position: absolute; left: 3px; top: 3px; width: 13px; height: 13px; border-radius: 50%; background: white; transition: .2s; }
.toggle-label input:checked + .toggle { background: var(--accent-strong); }
.toggle-label input:checked + .toggle::after { transform: translateX(15px); }
.toolbar-hint { color: var(--muted); font-size: 12px; text-align: right; }
.daf-scroll { flex: 1; overflow: auto; border-radius: 14px; background: #eef3f9; color: #132238; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); scrollbar-color: rgba(19,34,56,.35) transparent; }
.daf-page { min-height: 100%; padding: 26px 30px 60px; font-family: "Frank Ruhl Libre", "Times New Roman", serif; font-size: 24px; line-height: 1.85; text-align: justify; }
.daf-segment { display: inline; border-radius: 7px; padding: 2px 4px; margin: 0 1px; cursor: pointer; transition: background .17s ease, box-shadow .17s ease, color .17s ease; }
.daf-segment:hover { background: rgba(47, 110, 165, .12); box-shadow: 0 0 0 3px rgba(47, 110, 165,.08); }
.daf-segment.past { color: #65748a; }
.daf-segment.active { background: var(--highlight); color: var(--highlight-text); box-shadow: 0 0 0 4px rgba(255, 208, 84, .22); }
/* Estimated timing (fillMissingDafText) stays on the segment for seeking and
   "Not synced yet". The faded/hatched look is an admin diagnostic only, and
   it follows body.is-admin, which auth.js toggles once the profile arrives
   -- including when that happens after the phrases have already painted. */
body.is-admin .daf-segment.estimated { opacity: .72; background-image: repeating-linear-gradient(135deg, transparent, transparent 4px, rgba(19, 34, 56, .08) 4px, rgba(19, 34, 56, .08) 5px); }
body.is-admin .daf-segment.estimated.active { background: rgba(255, 208, 84, .38); color: inherit; box-shadow: none; outline: 2px dashed rgba(159, 85, 0, .75); outline-offset: 1px; }
.reader-daf-notes {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0 18px;
  overflow: hidden;
  box-sizing: border-box;
}
.reviewing-label, .not-synced-note { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .01em; color: #9a5b00; }
.skip-to-daf-chip { border: 1px solid rgba(47, 110, 165, .45); background: rgba(47, 110, 165, .12); color: #14324f; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; }
.skip-to-daf-chip:hover { background: rgba(47, 110, 165, .2); }
.skip-to-daf-chip[hidden], .reviewing-label[hidden], .not-synced-note[hidden] { display: none; }
.daf-card.seek-pending #vilnaPageWrap, .daf-card.seek-pending .daf-scroll { cursor: progress; }
.segment-marker { color: #65748a; font-size: .58em; vertical-align: super; margin-left: 2px; font-family: "Assistant", sans-serif; }
.daf-window-more { direction: ltr; text-align: center; color: #65748a; font-family: "Assistant", sans-serif; font-size: 12px; font-weight: 700; letter-spacing: .04em; margin: 4px 0 14px; opacity: .75; }
.vilna-placeholder { min-height: 100%; padding: 20px; color: #132238; text-align: center; }
/* This row holds a growing number of buttons (zoom, reset, admin-only Mark
   words/Show unmatched, and while mark mode is active, Save/Discard too, on
   top of Fullscreen) and needs to never let two of them overlap -- a real
   report of Fullscreen sitting on top of Discard changes on the player page
   while marking is what first put flex-wrap here. But wrapping the overflow
   onto a second row grows the whole sticky toolbar taller, and on an
   ordinary reader's narrow/zoomed-in screen it's usually just the LAST
   button (Fullscreen) that doesn't fit, wrapping alone onto its own row --
   reported directly as making the bar "thicker than it should be". Scrolling
   the overflow horizontally instead (the same pattern as .mobile-nav below)
   fixes both at once: nothing can ever overlap (nothing is ever forced into
   a shared row it doesn't fit in), and the bar's height never changes.
   flex-shrink: 0 on every child keeps buttons at their real size instead of
   getting squashed illegibly thin before the scroll takes over. */
.vilna-zoom-controls { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; align-items: center; gap: 8px; padding: 8px 10px; margin: -20px -20px 14px -20px; background: rgba(244,247,251,.94); backdrop-filter: blur(4px); border-bottom: 1px solid rgba(19, 34, 56,.14); }
.vilna-zoom-controls::-webkit-scrollbar { display: none; }
.vilna-zoom-controls > * { flex-shrink: 0; }
.vilna-zoom-btn { width: 28px; height: 26px; border-radius: 8px; border: 1px solid rgba(19, 34, 56,.25); background: rgba(255,255,255,.55); color: #132238; font-weight: 700; cursor: pointer; }
.vilna-zoom-btn:hover { background: rgba(255,255,255,.9); }
#vilnaZoomLabel { font-size: 12px; color: #132238; min-width: 38px; text-align: center; }
.vilna-zoom-reset { border: 1px solid rgba(19, 34, 56,.25); background: rgba(255,255,255,.55); color: #132238; border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.vilna-zoom-reset:hover { background: rgba(255,255,255,.9); }
.vilna-fullscreen-button { margin-left: auto; width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(19, 34, 56,.25); background: rgba(255,255,255,.55); color: #132238; display: grid; place-items: center; cursor: pointer; flex-shrink: 0; }
.vilna-fullscreen-button:hover { background: rgba(255,255,255,.9); }
.vilna-fullscreen-button svg { width: 15px; height: 15px; }
.vilna-page-status { padding: 22px 10px; }
.page-silhouette { width: min(360px, 92%); aspect-ratio: 0.75; margin: 0 auto 24px; background: #ffffff; border: 1px solid #d9e1eb; box-shadow: 0 12px 35px rgba(19, 34, 56,.18); padding: 22px; display: grid; grid-template-columns: .7fr 1.4fr .7fr; gap: 8px; }
.page-column { border-radius: 3px; background: repeating-linear-gradient(to bottom, #7a8699 0 2px, transparent 2px 7px); opacity: .58; }
.page-column.wide { background: repeating-linear-gradient(to bottom, #4a5568 0 2px, transparent 2px 8px); }
.vilna-placeholder h3 { margin-bottom: 6px; }
.vilna-placeholder p { max-width: 460px; margin: auto; line-height: 1.5; }
.vilna-page-wrap { position: relative; width: 100%; max-width: 100%; transform-origin: 0 0; }
/* .daf-scroll's own overflow:auto handles panning around a zoomed-in page --
   a CSS transform's rendered footprint still contributes to a scrolling
   ancestor's scrollable area, so no extra pan logic is needed here. */
.daf-card:fullscreen,
.daf-card:-webkit-full-screen {
  position: fixed;
  inset: 0;
  top: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.daf-card:fullscreen .daf-scroll,
.daf-card:-webkit-full-screen .daf-scroll {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow: auto;
  background: #fff;
}
.daf-card:fullscreen .daf-header,
.daf-card:-webkit-full-screen .daf-header,
.daf-card:fullscreen .card-heading.daf-heading,
.daf-card:-webkit-full-screen .card-heading.daf-heading {
  flex-shrink: 0;
  background: #f4f7fb;
}
.daf-fullscreen-exit {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(19, 34, 56, .28);
  background: #fff;
  color: #132238;
  font: 800 14px "Assistant", sans-serif;
  cursor: pointer;
}
.daf-card:fullscreen .daf-fullscreen-exit,
.daf-card:-webkit-full-screen .daf-fullscreen-exit { display: inline-flex; }
/* Fullscreen is meant for reading the page itself, full-bleed -- the
   auto-scroll/alignment-status row (.daf-toolbar) and the segment-count/
   Sefaria-attribution row (.daf-footer) below the page just eat vertical
   space a reader specifically asked to reclaim, so both are dropped
   entirely rather than shrunk. .daf-header/.card-heading.daf-heading (the
   top "Following: <daf>" bar, whichever class name a given page uses for
   it) stays, narrowed instead of removed -- it's the one piece of context
   worth keeping on screen (which daf this is, the Exit-mode/Follow-daf
   controls in Reading Mode) -- covers both a plain fullscreened .daf-card
   and Reading Mode's combined .watch-layout fullscreen (.daf-card itself
   is never the fullscreen element there). */
.daf-card:fullscreen .daf-toolbar,
.daf-card:-webkit-full-screen .daf-toolbar,
.daf-card:fullscreen .daf-footer,
.daf-card:-webkit-full-screen .daf-footer,
.watch-layout:fullscreen .daf-toolbar,
.watch-layout:-webkit-full-screen .daf-toolbar,
.watch-layout:fullscreen .daf-footer,
.watch-layout:-webkit-full-screen .daf-footer {
  display: none;
}
.daf-card:fullscreen .daf-header,
.daf-card:-webkit-full-screen .daf-header,
.daf-card:fullscreen .card-heading.daf-heading,
.daf-card:-webkit-full-screen .card-heading.daf-heading,
.watch-layout:fullscreen .daf-header,
.watch-layout:-webkit-full-screen .daf-header,
.watch-layout:fullscreen .card-heading.daf-heading,
.watch-layout:-webkit-full-screen .card-heading.daf-heading {
  padding-top: 6px;
  padding-bottom: 6px;
  min-height: 0;
}
.daf-card:fullscreen .daf-header h2,
.daf-card:-webkit-full-screen .daf-header h2,
.daf-card:fullscreen .card-heading.daf-heading h2,
.daf-card:-webkit-full-screen .card-heading.daf-heading h2,
.watch-layout:fullscreen .daf-header h2,
.watch-layout:-webkit-full-screen .daf-header h2,
.watch-layout:fullscreen .card-heading.daf-heading h2,
.watch-layout:-webkit-full-screen .card-heading.daf-heading h2 {
  font-size: 15px;
}
.daf-card:fullscreen .eyebrow,
.daf-card:-webkit-full-screen .eyebrow,
.watch-layout:fullscreen .eyebrow,
.watch-layout:-webkit-full-screen .eyebrow {
  display: none;
}
#vilnaPageCanvas { display: block; margin: 0 auto; max-width: 100%; height: auto; box-shadow: 0 12px 35px rgba(19, 34, 56,.18); }
.vilna-page-overlay { position: absolute; inset: 0; pointer-events: none; }
/* One region per PHRASE (segment), not per word -- built by app.js's
   renderVilnaWordBoxes from the exact same groupBoxesIntoLineRects
   line-rects .vilna-active-rect below already uses for the "currently
   playing" highlight, not a fixed per-box CSS transform. The old
   .vilna-word-box was a per-word box deliberately oversized (scale(1.2,
   1.7)) "for easier tapping"; a real report showed that oversizing routinely
   overlapped into the line above or below and stole taps meant for a
   neighboring word. A phrase's own line-shaped hit-region has no such
   padding to overlap with, and there's no way left to select a single word
   out of the phrase it belongs to -- hovering or clicking always means the
   whole phrase. */
.vilna-phrase-box {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  border-radius: 999px;
}
/* A tint of .vilna-active-rect's own blue (#8ecdf5) -- distinct
   from that solid "playing right now" highlight, so hovering a not-yet-
   played (or already-played) phrase never reads as if it were live. */
.vilna-phrase-box.phrase-hover { background: rgba(142, 205, 245, .58); mix-blend-mode: multiply; }
@keyframes vilna-highlight-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* The word(s) being spoken right now (updateVilnaOverlay in app.js) -- a
   separate overlay of whole-line rectangles built by
   groupBoxesIntoLineRects, not a class toggled per (deliberately
   oversized, for easier tapping -- see .vilna-word-box's own transform)
   individual word box. A multi-word phrase used to render as several
   overlapping oversized rectangles, tall and blocky enough to cover
   nearly two printed lines at once and visibly disconnected word to word
   -- one merged bar per line reads as a single continuous highlight
   instead, the same as .vilna-mark-target-rect below already did for the
   mark-target outline. */
.vilna-active-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-active-rect {
  position: absolute;
  background: #8ecdf5;
  mix-blend-mode: multiply;
  border-radius: 999px;
  animation: vilna-highlight-in .12s ease-out;
}
/* Same admin gate as .daf-segment.estimated above. Without it, a regular
   reader (and anyone signed out) sees the ordinary solid blue active bar
   and the ordinary hover, rings and all. */
body.is-admin .vilna-active-rect.estimated { background: transparent; outline: 2px dashed rgba(19, 34, 56, .75); mix-blend-mode: normal; }
body.is-admin .vilna-phrase-box.estimated { outline: 1px dashed rgba(19, 34, 56, .45); outline-offset: 1px; }
/* The phrase about to be marked (vilnaMarkMode) -- same whole-line-rect
   shape as .vilna-active-rect above, but an outline instead of a fill, so
   it stays visible layered on top of .vilna-active-rect's solid yellow
   when a word both is playing right now and is the one being corrected,
   instead of the two competing for the same pixels. */
.vilna-mark-target-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-mark-target-rect {
  position: absolute;
  outline: 2px dashed rgba(159, 85, 0, .8);
  outline-offset: 1px;
  border-radius: 4px;
}
.vilna-mark-toggle { width: auto; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.vilna-mark-toggle.active { background: var(--accent-strong); color: #fff; border-color: transparent; }
/* Admin diagnostic: every printed word whose ref has NO segment covering it
   at all, or (for a ref that DOES have word-level w0/w1 boundaries from at
   least one of its segments) whose own wordIndex falls in none of them --
   see renderVilnaUnmatchedWords. A ref whose only segments are still
   phrase-level (w0/w1 both null, no word-level boundary known yet at all)
   is deliberately left unflagged: with most alignments carrying only
   segment-level timing, flagging every word in that case would paint most
   of a normal daf red and bury the real coverage gaps this is meant to
   surface. Drawn from each word's own raw OCR box, not grouped into line
   rects or oversized the way .vilna-phrase-box is -- precisely which word
   is missing is the entire point here, and pointer-events stay off so this
   is a read-only diagnostic layered on top of, not a rival click target
   to, the phrase regions underneath. */
.vilna-unmatched-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-unmatched-box {
  position: absolute;
  background: rgba(214, 39, 39, .32);
  border: 1px solid rgba(214, 39, 39, .7);
  border-radius: 2px;
}
/* Only shown while mark mode is on (see toggleVilnaMarkMode) -- Save banks
   whatever's been marked so far as a local draft (same mechanism as the
   editor panel's own Save Draft button); Discard reverts to the last save
   (or, if nothing's been saved yet this session, to when mark mode was
   turned on -- see checkpointVilnaMarkChanges/discardVilnaMarkChanges). */
.vilna-mark-save, .vilna-mark-discard { width: auto; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.vilna-mark-save { background: rgba(56, 158, 92, .16); border-color: rgba(56, 158, 92, .4); color: #1c5a34; }
.vilna-mark-save:hover { background: rgba(56, 158, 92, .28); }
.vilna-mark-discard { background: rgba(179, 67, 47, .12); border-color: rgba(179, 67, 47, .35); color: #8a3220; }
.vilna-mark-discard:hover { background: rgba(179, 67, 47, .22); }
/* Signals "clicking marks this word" instead of the normal "clicking seeks
   here" -- the same crosshair browsers already show over an editable
   region, so it doesn't need an explanatory label to read as different. */
.vilna-page-wrap.mark-mode .vilna-phrase-box { cursor: crosshair; }

/* --- Select text: selecting a continuous word range on the Vilna page --
   freely across phrase-alignment/segment boundaries, including unaligned
   words -- to act on via the right-click/long-press context menu (add a
   note, highlight, copy, look up, flag, search: see
   toggleVilnaSelectTextMode/renderVilnaSelectTextWordTargets in app.js and
   vilnaTargetAt in daf-context-menu.js, which is what makes the whole
   selection the menu's target rather than just the one word under the
   pointer). Reader-facing, unlike .vilna-mark-toggle above -- same small
   pill look, no .admin-only gate. --- */
.vilna-select-text-toggle { width: auto; padding: 0 10px; font-size: 12px; white-space: nowrap; }
.vilna-select-text-toggle.active { background: var(--accent-strong); color: #fff; border-color: transparent; }

/* Invisible per-word hit targets -- only interactive while select-text mode
   is on (.vilna-page-wrap.select-text-mode below); otherwise
   pointer-events:none so the phrase-click overlay underneath keeps
   seeking/marking exactly as before. */
.vilna-select-text-word-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-select-text-word-target { position: absolute; pointer-events: none; cursor: pointer; touch-action: none; }
.vilna-page-wrap.select-text-mode .vilna-select-text-word-target { pointer-events: auto; }
.vilna-page-wrap.select-text-mode { cursor: text; }

/* The current selection -- drawn from the exact same per-line rects
   (groupBoxesIntoLineRects) and PAD_X end-cap padding as .vilna-active-rect
   above, but until now styled nothing like it: a thin rgba fill boxed in a
   1px border with 4px corners, which clipped the rounded end-cap padding
   PAD_X was added for and read as disconnected, uneven boxes on anything
   spanning more than one line. Now the identical solid-fill/multiply-blend/
   999px-pill/fade-in treatment as .vilna-active-rect, just gold (var(--highlight),
   already this site's "highlighted" wash -- see .daf-segment.active) instead
   of blue, to read as "this is what a menu action would act on," distinct
   from the blue "playing right now" highlight and the dashed mark-target
   outline. One rect PER RUN (see groupBoxesIntoRuns in app.js) when the
   selection crosses a phrase-alignment/ref boundary -- still one
   continuous-looking selection visually, just drawn as however many
   per-line bars its words actually span. */
.vilna-select-text-selection-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-select-text-selection-rect {
  position: absolute;
  background: var(--highlight);
  mix-blend-mode: multiply;
  border-radius: 999px;
  animation: vilna-highlight-in .12s ease-out;
}

/* Small floating "Add note"/clear action -- pinned to the bottom of the
   PAGE IMAGE ITSELF (position:absolute against .vilna-page-wrap, its own
   nearest positioned ancestor -- the same containing block every other
   overlay here already uses) rather than tracking the selection's own
   exact position, so it never has to fight the frame's edges for room on a
   selection near the top or bottom of the page. Deliberately NOT
   position:sticky: confirmed directly that stuck to the WHOLE document's
   own scroll instead (a printed page can be much taller than the
   viewport), so bringing it into view -- a real reader scrolling down to
   reach it, or a screen reader/keyboard focus jump, same as the browser's
   own scrollIntoView -- could jump the scroll position drastically,
   carrying the reader's place on the page along with it. Absolute against
   the wrap keeps it exactly where it visually belongs regardless of where
   the document itself happens to be scrolled. */
.vilna-select-text-action-bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 8px 10px;
  width: fit-content;
  max-width: calc(100% - 20px);
  border-radius: 999px;
  background: rgba(244, 247, 251,.97);
  border: 1px solid rgba(19, 34, 56,.16);
  box-shadow: 0 10px 26px rgba(29, 57, 88,.16);
}

/* Margin markers for word-range notes -- restrained (small, semi-
   transparent, further dimmed outside notes mode) so a page with several
   notes never reads as cluttered -- see this feature's own product-plan
   note that the page should never look like a social feed. Gold for a
   live/public note (matching .note-pill-live's own color above), navy for
   the reader's own private one -- private wins the color when a marker
   covers a mix of both, since "I already wrote something here" is the more
   actionable thing to notice at a glance. Positioned at the top-right
   corner of the note's own first line (Hebrew reads right-to-left, so
   that's where a passage visually starts) via the same fractional
   left/top math every other Vilna-page overlay already uses. --navy has no
   shared CSS variable outside player/index.html's own inline style (unlike
   --accent, defined site-wide in styles.css's own :root) -- watch-theme.css
   already carries this identical var(--navy, #0c263d) fallback pattern for
   the same reason. */
.vilna-note-markers-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-note-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(244, 247, 251,.9);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  opacity: .55;
  transition: opacity .15s ease, transform .15s ease;
}
.vilna-note-marker:hover, .vilna-note-marker:focus-visible { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
.vilna-note-marker-live { background: var(--accent); }
.vilna-note-marker-private { background: var(--navy, #0c263d); }
.vilna-page-wrap:not(.select-text-mode) .vilna-note-marker { opacity: .32; width: 10px; height: 10px; }
.vilna-page-wrap:not(.select-text-mode) .vilna-note-marker:hover { opacity: .85; }
.vilna-note-marker-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 12px;
  height: 12px;
  padding: 0 2px;
  border-radius: 999px;
  background: #f4f7fb;
  color: #132238;
  font-size: 8px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
}
/* The reader's own marker pen (see highlights.js) -- the bottom-most
   overlay on the page, so the "playing right now" bar, a Notes Mode
   selection and the note markers all still read clearly on top of it.
   Deliberately a soft wash rather than the selection's stronger gold: a
   highlight is a standing mark on the page, not the thing being acted on. */
.vilna-highlights-overlay { position: absolute; inset: 0; pointer-events: none; }
.vilna-highlight-rect {
  position: absolute;
  background: rgba(240, 200, 90, .32);
  border-radius: 3px;
}

/* Long-press opens this project's own menu (see daf-context-menu.js), so
   the platform's own callout -- "Save image" over the printed page, the
   selection magnifier over the text -- would just race it. */
.vilna-page-wrap, #dafPage { -webkit-touch-callout: none; }

.daf-footer { justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 12px; }

.scan-placeholder { min-height: 100%; padding: 20px; color: #132238; text-align: center; }
.scan-intro p { max-width: 420px; margin: 0 auto 18px; line-height: 1.5; }
.scan-intro-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.scan-hint { max-width: 420px; margin: 0 auto 14px; color: #65748a; font-size: 13px; line-height: 1.5; }
.scan-align-wrap, .scan-result-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto 14px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 35px rgba(19, 34, 56,.18);
  touch-action: none; /* the corner handles do their own drag handling */
}
.scan-align-wrap img, .scan-result-wrap img { display: block; width: 100%; height: auto; }
/* Pinch/pan zoom target (see wireScanResultZoom in app.js) -- transformed
   as one unit so the img and its word-tap overlay always stay aligned;
   .scan-result-wrap above stays the fixed-size, overflow:hidden viewport. */
.scan-result-zoom { transform-origin: 0 0; cursor: grab; }
.scan-result-zoom.dragging { cursor: grabbing; }
.scan-corner-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-corner-lines polygon { fill: rgba(47, 110, 165,.14); stroke: #2f6ea5; stroke-width: 2; }
.scan-corner-handle {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: #2f6ea5;
  border: 3px solid #132238;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
  cursor: grab;
  touch-action: none;
}
.scan-corner-handle:active { cursor: grabbing; transform: scale(1.15); }
.scan-align-actions { display: flex; justify-content: center; gap: 10px; }
.scan-video-picker, .scan-engine-picker { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0 0 14px; }
.scan-video-picker-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scan-word-overlay { position: absolute; inset: 0; }
/* One clickable region per PHRASE (segment), not per word -- exactly
   .vilna-phrase-box's own shape and reasoning (see renderScanMatch/
   renderVilnaWordBoxes in app.js): a word-sized hit-region, oversized for
   easier tapping, routinely bled into the line above or below and stole
   taps meant for a neighboring word; a phrase's own line-shaped region has
   no such padding to overlap with. Pure click target -- the "word being
   spoken right now" highlight is a separate layer
   (.scan-active-overlay/.scan-active-rect below), not a class toggled on
   these. */
.scan-phrase-box {
  position: absolute;
  cursor: pointer;
  border-radius: 999px;
}
/* .vilna-phrase-box.phrase-hover's own blue tint -- distinct from
   .scan-active-rect's solid "playing right now" highlight below. */
.scan-phrase-box.phrase-hover { background: rgba(142, 205, 245, .58); mix-blend-mode: multiply; }
/* The word(s) being spoken right now (updateScanOverlay in app.js) -- one
   merged bar per printed line via groupBoxesIntoLineRects/appendLineRects,
   the same pass and the same blue (#8ecdf5) .vilna-active-rect uses, so the
   scanned photo, the Vilna page and the in-video overlay all read as the
   same feature. This used to toggle .active on individual (deliberately
   oversized, for tapping) .scan-word-box elements, which rendered a
   multi-word phrase as a jagged block of overlapping solid-yellow
   rectangles -- reported directly as visibly out of step with the blue,
   narrow bar the other two views had already moved to. */
.scan-active-overlay { position: absolute; inset: 0; pointer-events: none; }
.scan-active-rect {
  position: absolute;
  background: #8ecdf5;
  mix-blend-mode: multiply;
  border-radius: 999px;
  animation: vilna-highlight-in .12s ease-out;
}
/* Live guided-capture camera view (see openScanCamera in app.js) --
   position: fixed so it sits above everything else full-screen regardless of
   where .scan-placeholder falls in the normal document flow, matching how a
   native camera UI takes over the whole screen. */
.scan-camera-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.scan-camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* "Photo" mode (a library photo being positioned behind the cutout, see
   showScanCameraPhotoCrop in app.js) -- overflow:hidden fixed-size viewport,
   same shape as .scan-result-wrap, with the img inside transformed by
   computeCropSourceRect's matching pinch/pan/zoom controller. width:100% +
   height:auto lets a landscape photo still pan into a portrait cutout. */
.scan-camera-photo-wrap { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.scan-camera-photo { display: block; width: 100%; height: auto; transform-origin: 0 0; cursor: grab; }
.scan-camera-photo.dragging { cursor: grabbing; }
/* The cutout div's own box IS the alignment target -- captureScanPhotoFromCamera
   reads its real rendered getBoundingClientRect() rather than duplicating
   this sizing math in JS, so this rule is the only place the guide's size
   lives. box-shadow with a huge spread is a standard cutout/spotlight trick:
   one box supplies both the dimming of everything outside it and the visible
   frame around it, so there's no separate mask element to keep in sync. */
.scan-camera-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.scan-camera-cutout {
  position: relative;
  aspect-ratio: 1 / 1.42; /* PAGE_ASPECT_RATIO in app.js -- a Vilna Shas page's own proportions */
  width: auto;
  height: min(68vh, calc(88vw * 1.42));
  max-width: 88vw;
  border: 3px solid #2f6ea5;
  border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.62);
}
/* Matches scan-daf-page.mjs's own HEADER_BAND fraction (top 5% of the
   aligned page) exactly -- see the HTML comment above this element. */
.scan-camera-header-band {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5%;
  border-bottom: 2px dashed #8ecdf5;
  background: rgba(142, 205, 245, .28);
  border-radius: 7px 7px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}
.scan-camera-header-band span {
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  text-shadow: 0 1px 3px rgba(0,0,0,.8);
  white-space: nowrap;
}
.scan-camera-top-text { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 16px; right: 16px; text-align: center; }
.scan-camera-hint { color: #fff; font-size: 13px; margin: 0 0 6px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.scan-camera-tips { color: rgba(255,255,255,.8); font-size: 11.5px; line-height: 1.4; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
/* ?debugScan=1 only -- deliberately un-styled-as-a-real-feature (dashed
   border, monospace, explicit "DEBUG" label) so it reads as a testing tool
   even to someone who stumbles onto the flag, not a hidden setting. */
.scan-camera-debug {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 118px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,.55);
  border: 1px dashed rgba(255,255,255,.5);
  border-radius: 8px;
  padding: 8px 12px;
}
.scan-camera-debug label {
  color: #fff;
  font: 11px/1.3 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: nowrap;
  flex: 0 0 auto;
}
.scan-camera-debug input[type="range"] { flex: 1 1 auto; }
/* Three fixed slots (cancel / shutter-or-confirm / library) on a grid rather
   than a centered flex row, so the shutter stays perfectly centered whether
   or not the library button on the right is visible (hidden while a library
   photo is being cropped -- see showScanCameraPhotoCrop). */
.scan-camera-controls {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
}
.scan-camera-controls-cancel { justify-self: start; }
.scan-camera-controls-library { justify-self: end; }
.scan-camera-controls .button { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.35); }
.scan-camera-controls-library { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; }
.scan-camera-controls-library svg { width: 22px; height: 22px; }
.scan-camera-shutter, .scan-camera-confirm {
  justify-self: center;
  grid-column: 2;
  grid-row: 1;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
  cursor: pointer;
}
.scan-camera-shutter { background: #fff; border: 4px solid rgba(255,255,255,.5); }
.scan-camera-shutter:active, .scan-camera-confirm:active { transform: scale(0.92); }
.scan-camera-confirm { background: #2f6ea5; border: 4px solid rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; color: #fff; }
.scan-camera-confirm svg { width: 30px; height: 30px; }

/* Live, shutter-free header scanner (see scan-live.js) -- same full-screen,
   fixed, black-background shell as .scan-camera-view above, kept as an
   entirely separate class hierarchy (not shared/reused) so nothing about
   this new flow can regress the legacy one it sits next to, and vice versa.
   #scanLive's own [data-state] attribute -- aligning / reading / almost /
   locked, set by scan-live.js's setScanLiveState -- is what every visual
   state below keys off of. */
.scan-live {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.scan-live-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* "Choose a photo" mode (see showScanLivePhotoCrop in scan-live.js) --
   same overflow:hidden fixed-size viewport as the legacy library flow's
   own .scan-camera-photo-wrap, with the img inside transformed by that
   same pinch/pan/zoom math (computeCropSourceRect in app.js, reused
   rather than reimplemented). width:100% + height:auto lets a landscape
   photo still pan into this cutout's own wide, short aspect ratio. */
.scan-live-photo-wrap { position: absolute; inset: 0; overflow: hidden; touch-action: none; background: #000; }
.scan-live-photo { display: block; width: 100%; height: auto; transform-origin: 0 0; cursor: grab; }
.scan-live-photo.dragging { cursor: grabbing; }
.scan-live-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
/* Same page-shaped guide as .scan-camera-cutout, but only the HEADER
   band's own proportions -- there's no full-page corner-marking step in
   this flow at all, so the guide only ever needs to be exactly the strip
   the reader lines the header text up with. Border color/shadow shift by
   [data-state] below instead of a separate modifier class, so every visual
   state lives in one place per property. */
.scan-live-cutout {
  position: relative;
  width: min(84vw, 480px);
  aspect-ratio: 5 / 1;
  border: 3px solid #8ecdf5;
  border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.62);
  transition: border-color .2s ease, box-shadow .2s ease;
}
/* Experimental "full page" capture mode (see scan-live.js's own
   SCAN_LIVE_FULL_PAGE_* comment) -- a page-shaped guide instead of the
   thin header strip above, driven by #scanLive's own [data-capture-mode]
   attribute (setScanLiveCaptureMode). computeCaptureSourceRect/
   computeCropSourceRect both read this element's OWN rendered rect fresh
   every time, so swapping this one rule is the entire client-side "switch
   modes" step -- no separate JS-computed sizing needed. Narrower width cap
   than the strip's own, since this box is much taller: at the strip's own
   84vw/480px cap this would run off the bottom of a lot of phone screens
   once the top status text and bottom controls row are accounted for. */
/* .scan-live-overlay centers its child (the cutout) across the FULL
   .scan-live viewport (position: absolute; inset: 0 -- see its own rule
   above) -- .scan-live-controls-row sits OUTSIDE that centering entirely
   (position: absolute, pinned a fixed distance from the true bottom of
   the screen, not from wherever the centered cutout happens to end).
   Centering a page-shaped box that size purely off a viewport-height
   FRACTION still let its bottom edge land on top of Cancel on a short
   phone screen (confirmed directly, at both 375x667 and 360x600): the
   controls row's own real position doesn't scale down proportionally
   just because the screen is shorter, so a box centered on the whole
   screen can still reach into it even after being shrunk.
   Anchoring from a fixed top offset instead of centering removes that
   guesswork -- the cutout's own top edge is always a known, fixed
   distance below the status text, and its height is computed directly
   against the controls row's own known worst-case height (Cancel + Choose
   a photo + Use photo scan instead + this mode toggle, four stacked
   pills), not a fraction that has to happen to leave enough room. */
.scan-live[data-capture-mode="fullPage"] .scan-live-overlay {
  align-items: flex-start;
  padding-top: 84px;
}
.scan-live[data-capture-mode="fullPage"] .scan-live-cutout {
  width: auto;
  height: min(calc(100vh - 84px - 230px), 420px);
  aspect-ratio: 0.68;
}
@media (prefers-reduced-motion: reduce) {
  .scan-live-cutout { transition: none; }
}
.scan-live[data-state="reading"] .scan-live-cutout,
.scan-live[data-state="almost"] .scan-live-cutout { border-color: #ffb020; }
.scan-live[data-state="locked"] .scan-live-cutout { border-color: #3fb47a; box-shadow: 0 0 0 100vmax rgba(0,0,0,.62), 0 0 0 4px rgba(63,180,122,.35); }
/* A gentle pulse on "almost" (one real read so far, waiting on a second
   agreeing one) -- purely decorative, so it's the one thing fully removed
   rather than just shortened under reduced motion (the state change itself
   is still conveyed via border color either way). */
@media (prefers-reduced-motion: no-preference) {
  .scan-live[data-state="almost"] .scan-live-cutout { animation: scan-live-pulse 1.1s ease-in-out infinite; }
}
@keyframes scan-live-pulse {
  0%, 100% { box-shadow: 0 0 0 100vmax rgba(0,0,0,.62), 0 0 0 0 rgba(255,176,32,.45); }
  50% { box-shadow: 0 0 0 100vmax rgba(0,0,0,.62), 0 0 0 6px rgba(255,176,32,.2); }
}
.scan-live-word-overlay { position: absolute; inset: 0; pointer-events: none; }
/* Positioned by scan-live.js as plain percentages of the cutout (matchedWords
   from scan-daf-header.mjs, already fractions of the exact same crop this
   cutout covers -- see that endpoint's own module comment). Green, not the
   site's usual sync-highlight blue, specifically so "recognized" reads as
   distinct from every other highlight color already in use elsewhere. */
.scan-live-word-box {
  position: absolute;
  border: 1.5px solid #3fb47a;
  background: rgba(63,180,122,.22);
  border-radius: 4px;
}
.scan-live-checkmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3fb47a;
  background: rgba(0,0,0,.32);
  border-radius: 7px;
}
.scan-live-checkmark svg { width: 25%; height: 25%; max-width: 56px; max-height: 56px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.5)); }
.scan-live-top-text { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 16px; right: 16px; text-align: center; }
.scan-live-status { color: #fff; font-size: 14px; font-weight: 600; margin: 0; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.scan-live[data-state="locked"] .scan-live-status { color: #b7f0d3; }
/* The bottom-anchored positioning lives HERE, on the outer row, not on
   either mode-specific group below -- Cancel (a direct child of this row,
   see the HTML's own comment on why) has to stay in the same fixed spot
   across both live-camera and photo-positioning mode, the same way the
   legacy camera view keeps ITS OWN cancel button in one fixed grid slot
   across its own live/photo-crop modes. */
.scan-live-controls-row {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
}
.scan-live-controls-row > .button { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.35); }
.scan-live-controls { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.scan-live-controls .button { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.35); }
/* Emphasized only after a real camera-access failure (see
   showScanLiveCameraError in scan-live.js) -- ordinarily this is a plain,
   equally-weighted secondary link next to Cancel, not a call to action;
   once the live path has actually failed, it becomes the one thing left to
   do, so it earns the visual weight. */
.scan-live-fallback-emphasized { background: #2f6ea5; border-color: transparent; font-weight: 700; }
/* Replaces .scan-live-controls' own mode-specific items once a photo has
   been chosen (see showScanLivePhotoCrop) -- a simple two-item row (back /
   confirm) rather than a column, since there's no third "Use photo scan
   instead" option to make room for here: the reader already IS using a
   photo. Cancel (the outer row's own direct child) stays visible either
   way, unaffected by this swap. */
.scan-live-photo-controls { display: flex; align-items: center; justify-content: center; gap: 28px; }
.scan-live-photo-controls .button { color: #fff; border-color: rgba(255,255,255,.5); background: rgba(0,0,0,.35); }
.scan-live-photo-confirm {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #2f6ea5;
  border: 4px solid rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.4);
}
.scan-live-photo-confirm:active { transform: scale(0.92); }
.scan-live-photo-confirm svg { width: 26px; height: 26px; }

.scan-status { max-width: 420px; margin: 14px auto 0; padding: 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.scan-status.error { background: rgba(255,124,137,.14); color: #7a2530; border: 1px solid rgba(255,124,137,.35); }
.scan-status.busy { background: rgba(47, 110, 165,.12); color: #132238; border: 1px solid rgba(47, 110, 165,.3); }

.editor { margin-top: 18px; padding: 21px; }
.editor-heading { justify-content: space-between; gap: 18px; align-items: flex-start; }
.editor-heading h2 { margin-bottom: 6px; }
.editor-heading p { color: var(--muted); margin-bottom: 0; }
.editor-actions { gap: 8px; }
/* A flex row-list, not a table -- a table forced a 760px min-width with
   horizontal scrolling to see every column, unusable on a phone (which is
   exactly where a reader is most likely to be doing this). Rows wrap their
   own controls onto a second line on narrow screens instead. */
.editor-list { margin-top: 18px; display: flex; flex-direction: column; }
.editor-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 11px 8px; border-top: 1px solid var(--line); }
.editor-row-num { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.editor-time { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.editor-time-display { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 44px; }
.nudge-btn { border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--muted); border-radius: 7px; padding: 5px 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.nudge-btn:hover { color: var(--text); border-color: var(--line-strong); }
.editor-phrase { flex: 1 1 220px; min-width: 160px; direction: rtl; text-align: right !important; font-family: "Frank Ruhl Libre", serif; font-size: 18px; }
.editor-row.active { background: rgba(47, 110, 165,.07); }
.editor-row.estimated { background: rgba(255,176,32,.06); border-top-color: rgba(255,176,32,.3); }
.editor-estimated-badge { direction: ltr; display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: rgba(255,176,32,.18); color: #ffb020; font-family: "Assistant", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
#phraseEditModeButton.active { background: var(--accent-strong); color: #fff; border-color: transparent; }
.split-word { border-radius: 5px; padding: 0 2px; cursor: pointer; }
.split-word:not(.split-word-first):hover { background: rgba(47, 110, 165,.22); box-shadow: 0 0 0 2px rgba(47, 110, 165,.3); }
.split-word-first { cursor: default; }
.merge-next { flex-shrink: 0; }

.workflow-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 18px; }
.workflow-card { gap: 14px; padding: 18px; box-shadow: none; }
.step-number { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.workflow-card h3 { margin-bottom: 3px; font-size: 16px; }
.workflow-card p { color: var(--muted); margin-bottom: 0; font-size: 13px; line-height: 1.45; }

dialog { width: min(560px, calc(100% - 28px)); border: 1px solid var(--line-strong); border-radius: 20px; background: #10233a; color: var(--text); padding: 28px; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
dialog::backdrop { background: rgba(0,7,15,.7); backdrop-filter: blur(5px); }
.dialog-close { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; font-size: 30px; color: var(--muted); cursor: pointer; }
dialog h2 { margin-bottom: 14px; }
dialog ol { color: #d8e2eb; padding-left: 21px; line-height: 1.6; }
.dialog-note { color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); padding: 12px; border-radius: 11px; margin-bottom: 0; }

/* Notes panel: a right-side sidebar, not a centered popup -- opened via
   dialog.show() (non-modal, see openNoteDialog/openNoteComposerForSelection
   in notes.js), not showModal(), so the daf/video behind it stays visible
   AND interactive (a modal dialog's top-layer promotion makes everything
   else on the page inert) while a note is being read or written. Only this
   one dialog gets this treatment -- search/auth/sync/favorites/help all stay
   centered modals, unaffected by an id-scoped override. */
#noteDialog {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(420px, 100vw);
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  border-radius: 0;
  border-width: 0 0 0 1px;
  box-shadow: -18px 0 60px rgba(0,0,0,.4);
  z-index: 500;
}
/* A non-modal dialog keeps its UA default of display:none while closed --
   this only applies once [open] is present, so it never fights that. */
#noteDialog[open] { display: flex; flex-direction: column; overflow: hidden; }
#noteDialog .note-list { flex: 1 1 auto; max-height: none; min-height: 0; overflow-y: auto; }
/* Reported directly: on a short phone screen the compose form (privacy
   toggle, category picker, formatting toolbar, textarea, timestamp toggle,
   Save button) is taller than what's left of the 100vh panel once the
   header and note list above it take their share. flex: 0 0 auto never let
   it shrink, and it had no scroll of its own, so its own bottom -- the Save
   button -- fell below the fold with no way to reach it (the panel's own
   overflow:hidden on #noteDialog[open] just clips it rather than scrolling).
   Giving it the same flex: 1 1 auto / min-height: 0 / overflow-y: auto shape
   .note-list already uses makes it shrink to share space with the list
   instead of forcing its full natural height, and scroll internally
   whenever it still doesn't fit -- the Save button is always reachable
   either way. */
#noteDialog .note-compose { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
@media (max-width: 480px) {
  #noteDialog { width: 100vw; }
  /* Same report: make the form itself more compact on a phone so there's
     less to scroll through in the first place. Desktop keeps the roomier
     spacing -- this is scoped to the narrow-screen case the report was
     about. */
  #noteDialog .note-list { max-height: 26vh; }
  #noteDialog .note-compose { padding-top: 10px; }
  #noteDialog .note-privacy-toggle { margin-bottom: 7px; }
  #noteDialog .note-category-picker { margin: 2px 0 8px; padding: 8px 0; }
  #noteDialog .note-format-toolbar { margin-bottom: 4px; }
  #noteDialog .note-cite-row { margin-bottom: 5px; }
  #noteDialog #noteBodyInput { height: 56px; }
  #noteDialog .note-timestamp-toggle { margin-top: 6px; }
  #noteDialog .note-compose-actions { margin-top: 7px; }
}
/* A phone: the panel is only as tall as what is actually visible (the
   browser's bars and the keyboard cover the rest -- notes.js keeps
   --note-dialog-h/-top in step with the visual viewport), the list shrinks
   to its notes, and Save stays pinned at the bottom of the form while the
   rest of it scrolls. */
@media (max-width: 760px) {
  #noteDialog[open] {
    top: var(--note-dialog-top, 0);
    bottom: auto;
    height: var(--note-dialog-h, 100dvh);
    max-height: var(--note-dialog-h, 100dvh);
    padding: 16px 16px 0;
  }
  #noteDialog .note-list { flex: 0 1 auto; }
  #noteDialog .note-compose-actions {
    position: sticky;
    bottom: 0;
    z-index: 1;
    margin-top: 8px;
    padding: 8px 0 calc(10px + env(safe-area-inset-bottom));
    background: var(--card, #fff);
    box-shadow: 0 -10px 12px -10px rgba(19, 34, 56, .22);
  }
}
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: #17304b; border: 1px solid var(--line-strong); color: white; padding: 11px 15px; border-radius: 12px; box-shadow: 0 12px 35px rgba(0,0,0,.35); transition: .25s; z-index: 20; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-color: rgba(255,124,137,.5); color: #ffd5da; }

@media (max-width: 1100px) {
  .setup-strip { grid-template-columns: 1fr 1fr; }
  .action-field { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px solid var(--line); padding: 16px 0 0 !important; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .player-card, .daf-card { height: auto; }
  .daf-card { min-height: 460px; }
  /* Unlike .daf-card just above, this was never relaxed for narrow
     screens -- the desktop 640px floor stuck around, forcing a tall empty
     card around what's really just a compact 16:9 video plus a couple of
     control rows on a phone. Harmless on its own, but a real problem once
     that card can become position:sticky (see player/index.html's
     .watch-layout.editing rules): a stuck 640px+ element eats most of a
     phone screen by itself, defeating the point of pinning it. */
  .player-card { min-height: auto; }
}
@media (max-width: 700px) {
  .app-shell { width: min(100% - 18px, 1540px); }
  /* flex-wrap was missing here -- .topbar's own two children (.mobile-brand,
     .top-actions) never wrapped, and .top-actions' own four buttons (How it
     works / Back to library / search / sign in) never did either, so on a
     narrow phone they all just overflowed the header sideways instead of
     stacking -- the "align-items: flex-start" alongside them only makes
     sense for a wrapped, multi-row header, which this now actually is. */
  .topbar { align-items: flex-start; padding: 16px 0; flex-wrap: wrap; row-gap: 10px; }
  .top-actions { flex-wrap: wrap; row-gap: 8px; }
  .top-actions .status-pill { display: none; }
  .setup-strip { grid-template-columns: 1fr; padding: 15px; }
  .setup-field + .setup-field { border-left: 0; border-top: 1px solid var(--line); padding: 15px 0 0; }
  .action-field { grid-column: auto; }
  .workspace { gap: 12px; }
  .player-card, .daf-card { padding: 14px; border-radius: 16px; }
  .card-heading { align-items: flex-start; }
  .live-location { display: none; }
  .push-right { width: 100%; margin-left: 0; margin-top: 4px; }
  .now-learning { min-height: 125px; }
  .daf-toolbar { align-items: flex-start; }
  .toolbar-hint { max-width: 52%; }
  .daf-page { padding: 22px 18px 50px; font-size: 22px; }
  .workflow-grid { grid-template-columns: 1fr; gap: 10px; }
  .editor-heading { flex-direction: column; }
}

/* Lecture source selector and linked-player support */
[hidden] { display: none !important; }
.source-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.16); }
.source-tab { border: 0; border-radius: 8px; padding: 6px 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.source-tab.active { background: rgba(47, 110, 165,.14); color: var(--accent); }
.source-panel { min-height: 38px; display: flex; align-items: center; gap: 9px; min-width: 0; }
.link-source-panel { display: block; }
.video-url-row { display: flex; gap: 7px; align-items: center; }
.video-url-row input { min-width: 0; }
.link-source-panel .field-note { display: block; margin-top: 6px; font-size: 12px; }
.lock-video-row { margin-top: 8px; }
input[type="url"] { width: 100%; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4,14,27,.7); border-radius: 11px; padding: 9px 11px; outline: none; }
input[type="url"]:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
/* The stage is its own stacking context (isolation + a transform). A
   YouTube iframe on Android Chrome otherwise paints over later siblings
   once an ancestor is position:fixed — which is Split view and fullscreen —
   so the pause poster never covered the embed there. */
.youtube-stage {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  isolation: isolate;
  transform: translateZ(0);
  background: #07111c;
  pointer-events: none;
  contain: paint;
}
.video-frame.youtube-active .youtube-stage { display: block; }
.youtube-player-host { position: absolute; inset: 0; z-index: 0; background: #000; overflow: hidden; }
.youtube-player-host iframe, #youtubePlayer { width: 100%; height: 100%; display: block; border: 0; }
/* The picture is a 16:9 box clipped by the frame. A taller pane covers
   (full height, sides cropped). A short pane used to contain that box and
   letterbox the sides, which left YouTube's title and logo inside the
   strip. Both shapes now grow the iframe past the frame so those rows hang
   outside the clip. The short-pane crop scales with the pane. No transform
   — one on the iframe freezes the picture on phones. */
.video-frame.youtube-active { container-type: size; container-name: yt-frame; }
.video-frame.youtube-active .youtube-player-host {
  inset: auto;
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
}
/* YouTube paints its title, share icon, watch-later, logo, and the
   pause "More videos" shelf inside the iframe. controls=0 does not
   remove them. The poster (.yt-shield) covers only the opening, before
   the first frame. After that, opaque bands (.yt-mask-layer) cover
   those regions and leave the middle of the frame clear. */
.video-frame.youtube-active .youtube-player-host,
.video-frame.youtube-active .youtube-player-host iframe,
.video-frame.youtube-active #youtubePlayer { pointer-events: none !important; }
.video-frame.youtube-active:not(.yt-started) .youtube-player-host { visibility: hidden; opacity: 0; }
.video-frame.youtube-active .youtube-player-host iframe,
.video-frame.youtube-active #youtubePlayer {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  /* Opacity under 1 keeps Android Chrome from promoting the cross-origin
     iframe onto a video overlay plane that paints above every sibling,
     which is how the title bar and the corner badge stayed visible on top
     of the poster and the top mask. A transform on this element freezes
     the picture on phones, so the opacity is the containment. */
  opacity: 0.99 !important;
}
.yt-shield {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  transform: translateZ(0);
  background-color: #07111c;
  background-position: center top;
  background-size: contain;
  background-repeat: no-repeat;
}
/* Same top-locked 16:9 box as the embed. cover + center used to crop the
   thumbnail from the top as the split pane shrank, which read as the
   picture sliding off the screen. The poster now scales inside the box. */
.video-frame.youtube-active .yt-shield {
  inset: auto;
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
}
.yt-shield::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, .38);
}
.video-frame.youtube-active:not(.yt-started) .yt-shield { display: block; }
/* Opaque bands on the same top-locked 16:9 box as the embed, above the
   stage (z-index 1) and under our own control bar (z-index 6). The outer
   edge is solid so the title row, the share and watch-later icons, the
   corner logo, and the More videos shelf cannot show through. A short
   gradient on the inner edge keeps the band from looking like a hard crop.
   The middle of the picture stays clear. */
.yt-mask-layer {
  display: none;
  position: absolute;
  inset: auto;
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
  z-index: 5;
  pointer-events: none;
  transform: translateZ(0);
}
.video-frame.youtube-active.yt-started.yt-mask .yt-mask-layer { display: block; }
.yt-edge { position: absolute; pointer-events: none; }
.yt-edge-top {
  top: 0;
  left: 0;
  right: 0;
  /* YouTube's title and channel line are about 48px at the top of the
     iframe. The solid run covers that row; only the inner edge fades. */
  height: clamp(76px, 20%, 100px);
  background: linear-gradient(to bottom, #07111c 0, #07111c calc(100% - 12px), rgba(7, 17, 28, 0) 100%);
}
.yt-edge-bottom {
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(96px, 38%, 220px);
  background: linear-gradient(to top, #07111c 0, #07111c calc(100% - 16px), rgba(7, 17, 28, 0) 100%);
}
/* YouTube lays the bottom row out in the iframe's own box: the More videos
   card is about x 55%–90% of that box, the logo runs to the iframe's right
   edge, and the share icon is a short span at the left. The iframe is often
   wider than the pane, so those fractions are not the pane's corners. The
   chips are the on-screen part of that row (52px: the control row plus
   padding) and nothing outside the mask. A full-width bottom band is never
   drawn. The picture is not lifted when our bar opens — the bar is
   translucent and sits on the bottom edge. */
.video-frame.youtube-active .yt-mask-layer {
  overflow: hidden;
  --yt-iframe-w: calc((100cqh + var(--yt-crop-top, 0px)) * 16 / 9);
  --yt-iframe-left: calc((100cqw - var(--yt-iframe-w)) / 2);
  --yt-mask-left: max(0px, var(--yt-iframe-left));
  --yt-origin: calc(var(--yt-iframe-left) - var(--yt-mask-left));
  --yt-clip: min(100cqw, var(--yt-iframe-w));
  --yt-card-l: max(0px, calc(var(--yt-origin) + 0.55 * var(--yt-iframe-w)));
  --yt-card-r: min(var(--yt-clip), max(0px, calc(var(--yt-origin) + var(--yt-iframe-w))));
  --yt-share-l: max(0px, var(--yt-origin));
  --yt-share-r: min(var(--yt-clip), max(0px, calc(var(--yt-origin) + 96px)));
}
.yt-edge-logo,
.yt-edge-share {
  display: none;
  bottom: 0;
  height: 52px;
  z-index: 2;
  background: #0e1014;
  opacity: 1;
}
.yt-edge-logo {
  left: var(--yt-card-l, 0px);
  right: auto;
  width: max(0px, calc(var(--yt-card-r, 0px) - var(--yt-card-l, 0px)));
}
.yt-edge-share {
  left: var(--yt-share-l, 0px);
  width: max(0px, calc(var(--yt-share-r, 0px) - var(--yt-share-l, 0px)));
}
.video-frame.youtube-active.yt-started.yt-corner:not(.yt-mask) .yt-mask-layer { display: block; }
.video-frame.youtube-active.yt-started.yt-corner:not(.yt-mask) .yt-edge:not(.yt-edge-logo):not(.yt-edge-share) { display: none; }
.video-frame.youtube-active.yt-started.yt-corner .yt-edge-logo,
.video-frame.youtube-active.yt-started.yt-corner .yt-edge-share {
  display: block;
  opacity: 1;
}
.video-frame.youtube-active.yt-started.yt-corner.yt-corner-out:not(.yt-mask) .yt-edge-logo,
.video-frame.youtube-active.yt-started.yt-corner.yt-corner-out:not(.yt-mask) .yt-edge-share {
  opacity: 0;
  transition: opacity .35s ease;
}
/* No full-width strip over the burned-in lines, including while the title
   band is up. The two chips above are the bottom mask. */
.video-frame.youtube-active .yt-edge-bottom { display: none; }
/* Desktop regular player (not Split). The pane is 16:9, so YouTube's title
   row sits inside the picture. The iframe stays 16:9, its bottom edge is
   the pane's bottom edge, and the extra height hangs off the top only. */
@media (min-width: 900px) {
  body:not(.split-view-active) .video-frame.youtube-active {
    --yt-crop-top: 60px;
  }
  body:not(.split-view-active) .video-frame.youtube-active .youtube-player-host,
  body:not(.split-view-active) .video-frame.youtube-active .yt-shield {
    --yt-crop-top: 60px;
    width: calc((100cqh + var(--yt-crop-top)) * 16 / 9);
    height: calc(100cqh + var(--yt-crop-top));
    max-width: none;
    max-height: none;
    top: auto;
    bottom: 0;
    left: calc((100cqw - (100cqh + var(--yt-crop-top)) * 16 / 9) / 2);
    right: auto;
    margin-inline: 0;
  }
}
.video-frame.youtube-active .player-topbar {
  background: #07111c;
}
/* Our own "YouTube" pill sits at the top-left of the picture, above the
   stage, so shifting the iframe never covered it. It is the grey badge
   that stays up once the topbar fades. The lecture title already names
   the shiur. */
.video-frame.youtube-active .video-source-badge { display: none !important; }
.video-source-badge { position: absolute; left: 10px; top: 10px; z-index: 3; padding: 5px 8px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(2,8,18,.72); color: #d9e5ee; font-size: 11px; font-weight: 700; backdrop-filter: blur(8px); pointer-events: none; }
/* z-index 13, not 4: in Split View, #splitVideoPinchSurface (z-index 11,
   see its own construction in app.js) sits directly over the video picture
   -- the exact same spot this button is centered in -- so every tap on it
   landed on the pinch surface instead, never reaching this button's own
   click listener at all. Reported directly: the big center play/pause
   button stopped doing anything, while the small one in the control bar
   kept working. It was never actually reachable here in Split View in the
   first place -- it only ever LOOKED like it worked because the pinch
   surface's own tap handler used to call togglePlay() unconditionally for
   any plain tap, a since-fixed bug of its own (see splitVideoTap's comment
   in app.js) that happened to produce the same visible effect as a real
   click on this button, for exactly as long as that bug lasted. Matches
   .player-topbar's own identical fix (z-index 13, see its Split View rule
   further down) for the same reason -- the daf picker/bookmark/notes/More
   buttons up there had the exact same problem. */
.video-frame .large-play { z-index: 13; }
/* The centre pause button (app.js) is for touchscreens only, where a tap on
   the picture no longer pauses. It fades with the rest of the controls. A
   mouse pauses with a click anywhere, as on YouTube, so desktop never shows
   it. */
.video-frame .large-pause { display: none; }
@media (hover: none), (pointer: coarse) {
  .video-frame .large-pause:not([hidden]) { display: grid; transition: opacity .25s ease, visibility 0s linear 0s; }
  .video-frame.controls-hidden .large-pause { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s ease, visibility 0s linear .25s; }
}

@media (max-width: 700px) {
  .source-tabs { width: 100%; }
  .source-tab { flex: 1; }
  .source-panel { align-items: flex-start; }
  .video-url-row { align-items: stretch; }
  .video-url-row .button { padding-inline: 10px; }
}

/* Rapid timestamp marking */
.alignment-badge { display: inline-flex; align-items: center; padding: 7px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.alignment-badge.needs-work { color: #ffe0a0; background: rgba(255, 190, 70, .12); border: 1px solid rgba(255,190,70,.28); }
.alignment-badge.in-progress { color: #b9dcff; background: rgba(82, 167, 255, .12); border: 1px solid rgba(82,167,255,.3); }
.alignment-badge.complete { color: #bfe6cf; background: rgba(57, 115, 88, .16); border: 1px solid rgba(57,115,88,.35); }

.marking-bar {
  margin-top: 12px;
  padding: 10px;
  border-radius: 13px;
  border: 1px solid rgba(255, 202, 92, .22);
  background: rgba(255, 202, 92, .055);
  display: flex;
  align-items: center;
  gap: 8px;
  /* Wraps whenever its 5 buttons don't fit, not just below the 900px
     *viewport* breakpoint further down -- the card this sits in can be far
     narrower than 900px on its own (a two-column layout, a split window)
     while the viewport itself is still well above that breakpoint, which
     let the row overflow its card and get covered by the next column. */
  flex-wrap: wrap;
}
.mark-target { min-width: 92px; text-align: center; }
.mark-target span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.mark-target strong { color: #ffdd8a; font-size: 14px; }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 5px; padding: 0 5px; border-radius: 6px; color: #17302d; background: rgba(255,255,255,.58); border: 1px solid rgba(0,0,0,.15); font: 800 11px/1 "Assistant", sans-serif; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset; }
.daf-segment.mark-target-segment { outline: 2px dashed rgba(203, 116, 0, .65); outline-offset: 3px; }
.daf-segment.active.mark-target-segment { outline-color: rgba(159, 85, 0, .8); }
.editor-row.mark-target-row { box-shadow: inset 4px 0 0 #ffd470; background: rgba(255, 202, 92, .055); }
.editor-row { cursor: pointer; }

#syncDialog { width: min(640px, calc(100% - 28px)); max-height: min(88vh, 780px); overflow-y: auto; }
.sync-picker { margin: 16px 0 14px; }
.sync-picker-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.sync-field { display: flex; flex-direction: column; gap: 6px; min-width: 140px; flex: 1; }
.sync-field-narrow { min-width: 84px; flex: 0 0 auto; }
.sync-field span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.amud-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.amud-option { border: 0; background: rgba(255,255,255,.04); color: var(--muted); padding: 9px 14px; cursor: pointer; font-weight: 700; }
.amud-option.active { background: var(--accent); color: #fff; }

.shiur-variant-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-top: 8px; }
.shiur-variant-option, .language-option { border: 0; background: rgba(255,255,255,.04); color: var(--muted); padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: 13px; flex: 1; }
.shiur-variant-option.active, .language-option.active { background: var(--accent); color: #fff; }
.picker-toggle-row { display: flex; gap: 10px; flex-wrap: wrap; }
.sync-readings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sync-readings-list { max-height: 150px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; background: rgba(0,0,0,.14); margin-bottom: 16px; }
.sync-reading-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px; }
.sync-reading-row + .sync-reading-row { border-top: 1px solid var(--line); }
.sync-reading-remove { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 6px; }
.sync-reading-remove:hover { color: var(--text); }
.sync-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 11px; background: rgba(0,0,0,.16); }
.sync-tab { border: 0; border-radius: 8px; padding: 6px 9px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 700; }
.sync-tab.active { background: rgba(47, 110, 165,.14); color: var(--accent); }
.sync-source-panel { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 2px 4px; min-width: 0; }
.sync-app-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.status-dot.muted { background: var(--muted); box-shadow: none; }
.status-dot.ready { background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,.15); }
.status-dot.error { background: #f87171; box-shadow: 0 0 0 4px rgba(248,113,113,.15); }
.sync-progress-wrap { margin-top: 16px; }
.sync-progress-row { display: flex; align-items: center; gap: 10px; }
.sync-progress-track { flex: 1; height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; }
.sync-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .3s ease; }
.sync-progress-pct { flex: 0 0 auto; min-width: 34px; text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.sync-log { margin-top: 10px; max-height: 140px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.18); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; }

@media (max-width: 900px) {
  .marking-bar .mark-target { order: -1; width: 100%; text-align: left; }
}
@media (max-width: 700px) {
  .marking-bar .button { flex: 1; }
  .marking-bar #saveDraftButton { flex-basis: 100%; }
}

/* Admin-only studio controls (Sync from video, editing, import/export) are
   hidden entirely for anonymous/non-admin visitors -- this is a UI
   convenience, not a security boundary; the underlying Netlify functions
   trust any caller today, same as before accounts existed. */
.admin-only { display: none !important; }
body.is-admin .admin-only { display: revert !important; }
body.is-admin .admin-only.setup-field { display: block !important; }
body.is-admin .marking-bar.admin-only { display: flex !important; }
/* .toggle-label needs its own inline-flex (checkbox + track + label text in
   a row), not the plain revert every other .admin-only element gets --
   revert would fall back to <label>'s plain inline UA default and break
   the toggle's alignment. Same fix as the two rules above, for the same
   reason. */
body.is-admin .toggle-label.admin-only { display: inline-flex !important; }
body:not(.is-admin) .setup-strip { grid-template-columns: 1.1fr 1fr; }
/* /watch/'s setup-strip only ever held admin tooling (video-source override,
   sync/import/export) and the daf-reference picker -- all of it belongs to
   choosing/editing what to sync, not to watching, so the whole row is
   dropped on the public player regardless of admin status. #dafRef and
   #loadDafButton live inside it and stay in the DOM either way (app.js
   reads/writes them directly, unconditionally), so this can't just delete
   the section outright. */
body.watch-page .setup-strip { display: none; }

/* /studio/'s login gate: locked by default (see the inline class on <body>
   in studio/index.html, so there's no flash of the backend before auth.js
   has had a chance to check the session) and lifted only once auth.js
   confirms an is_admin profile. Same UI-convenience caveat as .admin-only
   above -- this blocks the page's own controls, not the Netlify functions
   behind them. */
.studio-gate { display: none; }
body.studio-locked .studio-gate {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 9000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 12, 22, 0.94);
  backdrop-filter: blur(6px);
}
body.studio-locked .app-shell, body.studio-locked .sidebar, body.studio-locked .sidebar-toggle { visibility: hidden; }
.studio-gate-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--card-strong);
  text-align: center;
}
.studio-gate-card h2 { margin: 0 0 8px; color: var(--text); }
.studio-gate-card p { margin: 0 0 20px; color: var(--muted); }
.studio-gate-actions { display: flex; flex-direction: column; gap: 10px; }

/* --- Auth widget --------------------------------------------------------- */
.auth-widget { position: relative; }
.account-menu { position: relative; }
.account-trigger { display: inline-flex; align-items: center; gap: 8px; }
.admin-badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #2d240f; background: var(--highlight);
}
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 180px;
  background: var(--card-strong); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.account-dropdown-item {
  border: 0; background: transparent; color: var(--text); text-align: left; padding: 9px 11px;
  border-radius: 9px; cursor: pointer; font-size: 14px;
}
.account-dropdown-item:hover { background: rgba(255,255,255,.07); }

.google-auth-button {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 6px;
}
.auth-divider {
  display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 12px;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.auth-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-error { color: var(--muted); font-size: 13px; background: rgba(170,66,56,.1); border: 1px solid var(--line); padding: 10px 12px; border-radius: 11px; margin: 0; }
.auth-error.is-error { color: var(--danger); background: rgba(255,124,137,.1); border-color: rgba(255,124,137,.28); }

/* --- Favorite star -------------------------------------------------------- */
.favorite-button {
  border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 2px; margin-inline-start: 2px;
}
.favorite-button.is-favorited { color: var(--highlight); }
.favorite-item {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.03);
  color: var(--text); padding: 10px 12px; border-radius: 11px; cursor: pointer; margin-bottom: 8px; font-size: 14px;
}
.favorite-item:hover { background: rgba(255,255,255,.08); }

/* --- Line notes ------------------------------------------------------------- */
.segment-note-button {
  display: inline-grid; place-items: center; width: 20px; height: 20px; margin-inline-start: 2px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12px;
  cursor: pointer; vertical-align: middle; opacity: .55; transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.segment-note-button:hover { opacity: 1; background: rgba(255,255,255,.08); }
.segment-note-button.has-notes { opacity: 1; color: var(--accent); }
.note-list { max-height: 46vh; overflow-y: auto; margin: 14px 0; display: flex; flex-direction: column; gap: 10px; }
.note-item { border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; }
.note-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.note-item-author { font-weight: 700; font-size: 13px; color: var(--text); }
.note-item-time { color: var(--muted); font-size: 12px; margin-inline-start: auto; }
.note-delete-button { border: 0; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; }
.note-delete-button:hover { color: var(--text); }
.note-report-button { border: 0; background: transparent; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .55; }
.note-report-button:hover { opacity: 1; }
.note-item-body { color: #d8e2eb; font-size: 14px; line-height: 1.55; direction: ltr; text-align: left; white-space: pre-wrap; }
/* The specific words a Notes Mode word-range note is actually about --
   Frank Ruhl Libre and right-aligned like every other quoted Gemara text
   on the site (see .scrub-preview span, buildSegmentSpan's own .daf-segment
   rendering), distinct from the note body's own plain Assistant/LTR
   styling right below it. */
.note-item-quote { margin: 0 0 7px; padding: 6px 10px; border-right: 2px solid var(--accent); background: rgba(255,255,255,.03); border-radius: 0 8px 8px 0; font-family: "Frank Ruhl Libre", serif; font-size: 15px; line-height: 1.5; color: var(--text); }
.note-pill { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.note-pill-private { background: rgba(255,255,255,.08); color: var(--muted); }
.note-pill-live { background: var(--accent-soft); color: var(--accent); }
.note-pill-hidden { background: rgba(220,90,90,.16); color: #e2897f; }
.note-pill-drift { background: rgba(220,150,60,.16); color: #e2ac6a; }
.note-pill-demo { background: rgba(150,110,220,.18); color: #b79cf0; }
/* "From <document>": provenance on a note quoted out of an imported
   document -- the note's author always sees this, and so does anyone else
   once the document is unlisted/public (see sourceDocumentPillHtml). A
   document title can be long, so unlike the other pills this one is allowed
   to truncate rather than force the head row to wrap. */
.note-pill-source { background: rgba(255,255,255,.08); color: var(--muted); max-width: 190px; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.note-pill-download { border: 0; background: transparent; color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .7; }
.note-pill-download:hover { opacity: 1; color: var(--text); }
.note-category-pill { background: rgba(255,255,255,.08); color: var(--text); font-family: "Frank Ruhl Libre", serif; font-weight: 400; }
.note-timestamp-pill { background: rgba(255,255,255,.08); color: var(--muted); }
button.note-timestamp-seek { border: none; cursor: pointer; color: var(--accent); background: var(--accent-soft); }
button.note-timestamp-seek:hover { background: rgba(255,255,255,.16); }
/* --- Flat reply threads under a public note ------------------------------ */
.note-replies { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.reply-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 6px; }
.comment-item { border-inline-start: 2px solid var(--line); padding-inline-start: 10px; margin-inline-start: calc(var(--reply-depth, 0) * 14px); }
.reply-children { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.comment-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.comment-item-body { color: #d8e2eb; font-size: 13px; line-height: 1.5; direction: ltr; text-align: left; white-space: pre-wrap; }
.comment-delete-button { border: 0; background: transparent; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 0 2px; }
.comment-delete-button:hover { color: var(--text); }
.reply-toggle-button { border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; padding: 2px 0; }
.reply-toggle-button:hover { text-decoration: underline; }
.item-footer { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.reaction-count-label { color: var(--muted); font-size: 12px; }
/* An inline reveal, not a floating overlay -- .note-list (the dialog's
   scrollable note feed) has overflow-y:auto, which clips any absolutely-
   positioned child that extends past its bounds. A position:absolute
   dropdown here rendered completely invisible for exactly that reason
   (confirmed via a real headless-browser screenshot, not just reasoning
   about it) -- same class of bug as the settings-panel stacking-context
   issue found earlier in this project, just triggered by overflow instead
   of z-index. Reusing the reply-compose/mention-picker's own proven inline-
   reveal pattern sidesteps the whole bug class rather than working around
   it with position:fixed + JS-computed coordinates. */
.reaction-widget { display: inline-flex; flex-direction: column; align-items: flex-start; }
.reaction-trigger-button { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 9px; border-radius: 999px; }
.reaction-trigger-button:hover { color: var(--text); border-color: var(--line-strong); }
.reaction-trigger-button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.reaction-menu { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.reaction-menu-item { border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 12px; text-align: start; padding: 4px 9px; border-radius: 999px; cursor: pointer; }
.reaction-menu-item:hover { border-color: var(--line-strong); }
.reaction-menu-item.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.follow-toggle-button { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 2px 9px; border-radius: 999px; }
.follow-toggle-button:hover { color: var(--text); border-color: var(--line-strong); }
.follow-toggle-button.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.mention-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mention-chip { border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 9px; border-radius: 999px; }
.mention-chip:hover { color: var(--text); border-color: var(--line-strong); }
.mention-chip.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }

/* --- Notifications: bell + dropdown in the account menu ------------------- */
.notif-widget { position: relative; }
.notif-bell-button { position: relative; border: 1px solid var(--line); background: transparent; color: var(--text); font-size: 16px; cursor: pointer; padding: 6px 10px; border-radius: 9px; line-height: 1; }
.notif-bell-button:hover { border-color: var(--line-strong); }
.notif-badge { position: absolute; top: -4px; inset-inline-end: -6px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 800; line-height: 1; padding: 3px 5px; border-radius: 999px; min-width: 14px; text-align: center; }
.notif-dropdown { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 320px; max-width: 88vw; background: var(--card-strong); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow); z-index: 40; padding: 12px; }
.notif-dropdown-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; font-size: 13px; }
.notif-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.notif-item { display: block; width: 100%; text-align: start; border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.notif-item:hover { border-color: var(--line-strong); }
.notif-item.unread { border-color: var(--accent); background: var(--accent-soft); }
.notif-item-text { display: block; font-size: 12.5px; color: var(--text); font-weight: 600; }
.notif-item-preview { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
/* Formatting toolbar: a small hardcoded markup (see renderFormattedBody in
   notes.js), not a contenteditable rich-text editor -- the note/reply body
   stays a plain string in the DB either way. */
.note-format-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.note-format-button {
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
  border-radius: 7px; padding: 4px 9px; font-size: 13px; line-height: 1; cursor: pointer; min-width: 26px;
}
.note-format-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.08); }
.note-item-body mark, .comment-item-body mark, .note-item-quote mark { background: var(--accent-soft); color: var(--text); padding: 0 2px; border-radius: 3px; }
.note-body-large { font-size: 1.2em; font-weight: 600; }
.reply-compose { margin-top: 6px; }
.reply-body-input {
  width: 100%; resize: vertical; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4,14,27,.7);
  border-radius: 9px; padding: 8px 10px; font-family: inherit; font-size: 13px; outline: none;
}
.reply-body-input:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
.reply-compose-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.note-compose { border-top: 1px solid var(--line); padding-top: 14px; }
.note-privacy-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 10px; }
.note-privacy-option { border: 0; background: rgba(255,255,255,.04); color: var(--muted); padding: 7px 12px; cursor: pointer; font-weight: 700; font-size: 13px; }
.note-privacy-option.active { background: var(--accent); color: #fff; }
/* Category picker: a restrained, single visual treatment for every chip --
   18 distinct colors would fight the site's deliberately minimal navy/
   gold/ivory palette, so the icon + Hebrew/English pairing carries the
   distinction instead of color-coding. */
.note-category-picker { margin: 4px 0 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.note-category-label { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .03em; }
.note-category-options { display: flex; flex-wrap: wrap; gap: 6px; }
.note-category-options-secondary { margin-top: 8px; }
.note-category-chip {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: rgba(255,255,255,.03);
  border-radius: 10px; padding: 5px 9px; cursor: pointer; text-align: start;
}
.note-category-chip:hover { border-color: var(--line-strong); }
.note-category-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.note-category-chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.note-category-chip-he { font-family: "Frank Ruhl Libre", serif; font-size: 13px; color: var(--text); }
.note-category-chip-en { font-size: 10px; color: var(--muted); }
.note-category-more-toggle { display: block; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; padding: 8px 0 0; }
.note-category-more-toggle:hover { text-decoration: underline; }
#noteBodyInput {
  width: 100%; resize: vertical; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4,14,27,.7);
  border-radius: 11px; padding: 10px 12px; font-family: inherit; font-size: 14px; outline: none;
}
#noteBodyInput:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
.note-timestamp-toggle { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.note-timestamp-toggle input { accent-color: var(--accent); }
.note-compose-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.note-mod-actions { margin-top: 8px; display: flex; justify-content: flex-end; gap: 8px; }
/* Studio's user-role-labels panel: a text input sharing .note-mod-actions'
   own row with its Save button, rather than a whole extra layout of its
   own -- the only moderation row that needs an input alongside its action.
   Sizing only; input[type="text"] (above) already supplies the look. */
.role-label-input { flex: 1; min-width: 0; max-width: 220px; width: auto; padding: 6px 10px; }

/* Quote from my notes: pulling a passage out of the reader's own imported
   document (note_documents) while writing a note on the daf. The result is
   an ordinary note -- the passage is COPIED into the body, and the only
   thing the citation adds is line_notes.source_document_id, recording where
   the words came from. See the "Quote from my notes" section of notes.js. */
.note-cite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.note-cite-button {
  border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text);
  border-radius: 9px; padding: 6px 11px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.note-cite-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.08); }
/* The "From <title>" chip, shown only while a citation is actually set. */
.note-cite-current {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--text);
  border-radius: 9px; padding: 5px 6px 5px 10px; font-size: 12px;
}
/* A document title is text the reader chose and can be any length; it
   truncates rather than pushing the × off the end of the composer. */
.note-cite-current strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-cite-clear { border: 0; background: transparent; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; padding: 0 4px; }
.note-cite-clear:hover { color: var(--text); }

/* input[type="search"] is not covered by the global field rule at the top of
   this file (which matches text/number/select only), so it is styled here --
   the same reason #searchNotesInput carries its own rule. */
#noteCiteSearch {
  width: 100%; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4,14,27,.7);
  border-radius: 11px; padding: 10px 12px; font-family: inherit; font-size: 14px; outline: none;
}
#noteCiteSearch:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
.note-cite-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.note-cite-doc {
  display: flex; flex-direction: column; gap: 3px; width: 100%; text-align: start; cursor: pointer;
  border: 1px solid var(--line); background: rgba(255,255,255,.03); color: var(--text);
  border-radius: 11px; padding: 10px 12px; font: inherit;
}
.note-cite-doc:hover { border-color: var(--accent); background: var(--accent-soft); }
.note-cite-doc-title { font-weight: 700; font-size: 14px; }
.note-cite-doc-meta { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
/* Two lines of the generated `preview` column, so the list renders without
   ever fetching a document's full text. */
.note-cite-doc-preview {
  font-size: 12.5px; color: var(--muted); overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.note-cite-doc-heading { margin: 12px 0 8px; font-size: 15px; }
/* The passage pane. pre-wrap keeps the document's own line breaks without
   any of it becoming markup (it is set with textContent); overflow-wrap
   stops an unbroken run of characters from widening the dialog. user-select
   is stated explicitly because selecting text here IS the interaction. */
.note-cite-text {
  margin: 0; max-height: 44vh; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; user-select: text;
  font: inherit; font-size: 14px; line-height: 1.7;
  border: 1px solid var(--line); background: rgba(4,14,27,.7);
  border-radius: 11px; padding: 14px;
}
.note-cite-text:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); outline: none; }
.note-cite-text::selection { background: var(--accent-soft); }
.search-notes-field { margin: 14px 0; }
#searchNotesInput {
  width: 100%; border: 1px solid var(--line-strong); color: var(--text); background: rgba(4,14,27,.7);
  border-radius: 11px; padding: 10px 12px; font-family: inherit; font-size: 14px; outline: none;
}
#searchNotesInput:focus { border-color: rgba(47, 110, 165,.8); box-shadow: 0 0 0 3px rgba(47, 110, 165,.1); }
.search-notes-category-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.search-notes-category-filter select {
  flex: 1; border: 1px solid var(--line-strong); background: rgba(255,255,255,.04); color: var(--text);
  border-radius: 8px; padding: 6px 8px; font-family: inherit; font-size: 12px;
}
.search-result-item { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.search-result-item:hover { border-color: var(--line-strong); }

/* --- Right-click / long-press menu on the daf ------------------------------ */
/* Fixed to the viewport and appended to <body> (see daf-context-menu.js), so
   it is never clipped by the daf card's own overflow the way an in-flow menu
   would be -- the same overflow-clipping trap the reaction menu already hit
   once and had to be rebuilt to avoid. */
.daf-context-menu {
  position: fixed;
  z-index: 600;
  min-width: 232px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #10233a;
  box-shadow: 0 22px 54px rgba(0,0,0,.5);
}
.daf-context-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.daf-context-item:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.daf-context-item:disabled { color: var(--muted); cursor: default; }
.daf-context-hint { color: var(--muted); font-size: 11px; white-space: nowrap; }
.daf-context-sep { height: 1px; margin: 5px 6px; background: var(--line); }

/* Text-view counterpart to .vilna-highlight-rect above -- same wash, applied
   to the real words rather than painted over a page image. */
mark.daf-highlight { background: rgba(240, 200, 90, .34); color: inherit; border-radius: 3px; padding: 0 1px; }

.word-lookup-body { max-height: 52vh; overflow-y: auto; margin: 12px 0; display: flex; flex-direction: column; gap: 14px; }
.word-lookup-entry { border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.word-lookup-senses { margin: 8px 0 0; padding-inline-start: 20px; line-height: 1.55; font-size: 13px; }
.word-lookup-notes { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

/* --- "Search in Shas" (shas-search.js) ------------------------------------- */
.shas-search-body { max-height: 58vh; overflow-y: auto; margin: 12px 0; }
.shas-search-results { display: flex; flex-direction: column; gap: 10px; }
.shas-search-result {
  display: block;
  width: 100%;
  text-align: right;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
  color: inherit;
  cursor: pointer;
}
.shas-search-result:hover, .shas-search-result:focus-visible { background: rgba(255,255,255,.08); }
.shas-search-result-loc { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 700; color: var(--muted); text-align: left; direction: ltr; }
.shas-search-result-excerpt { display: block; font-family: "Frank Ruhl Libre", serif; font-size: 15px; line-height: 1.55; }
/* Same "here's the highlighted match" wash .note-item-body's own mark
   already uses -- the excerpt's <mark> comes straight from Sefaria's own
   highlighted snippet (see sefariaSnippetToSafeHtml), not a separate
   in-house match-finder, so it should read the same as every other
   "this word is what matched" marking already on the site. */
.shas-search-result-excerpt mark.shas-search-match { background: var(--accent-soft); color: var(--text); padding: 0 2px; border-radius: 3px; }
.shas-search-result-note { margin: 10px 2px 0; color: var(--muted); font-size: 12px; }

/* The destination side of a result: the whole matched segment, briefly
   drawing the eye the way .vilna-select-text-selection-rect's own fade-in
   does on the Vilna page -- same gold wash mark.daf-highlight above already
   uses, since visually it's the same idea ("this is what led you here"),
   just not a standing, saved highlight. */
@keyframes daf-search-flash-in { from { background-color: rgba(240, 200, 90, .7); } to { background-color: rgba(240, 200, 90, .34); } }
mark.daf-search-flash { background: rgba(240, 200, 90, .34); color: inherit; border-radius: 3px; padding: 0 1px; animation: daf-search-flash-in 1.2s ease-out; }

.shas-search-back-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 17px 0;
  padding: 9px 13px;
  border: 1px solid rgba(19, 34, 56,.16);
  border-radius: 11px;
  background: rgba(244, 247, 251,.8);
  color: var(--muted, #91a7bd);
  font-size: 13px;
}
.shas-search-back-button {
  flex-shrink: 0;
  padding: 5px 12px;
  border: 1px solid rgba(19, 34, 56,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.6);
  color: inherit;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.shas-search-back-button:hover { background: rgba(255,255,255,.95); }

/* --- Cloud Chaburah feed (chaburah/index.html) ----------------------------- */
.chaburah-main { display: flex; flex-direction: column; gap: 18px; }
.chaburah-hero { padding: 22px 24px; }
.chaburah-hero h1 { margin: 4px 0 6px; }
.chaburah-hero p { margin: 0; color: var(--muted); }
.chaburah-feed-card { padding: 20px 22px; }
/* Deliberately its own class, not a reuse of .view-switch -- app.js wires
   EVERY ".view-switch button" sitewide to its own daf Text/Vilna toggle
   (switchDafView, keyed on data-view), which would fire alongside (and
   fight with) this feed's own tab handler on every click. */
.chaburah-view-switch { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(0,0,0,.18); border: 1px solid var(--line); margin-bottom: 12px; }
.chaburah-view-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 8px; padding: 7px 10px; cursor: pointer; font-size: 13px; }
.chaburah-view-switch button.active { background: rgba(255,255,255,.08); color: var(--text); }
.chaburah-feed-list { max-height: none; }
.chaburah-card-actions { display: flex; gap: 8px; margin-top: 8px; }
.chaburah-meta { margin: 2px 0 0; }
.chaburah-feed-actions { display: flex; justify-content: center; margin-top: 14px; }

/* --- Catalog browser ------------------------------------------------------ */
.catalog-card { padding: 20px 22px; margin-bottom: 18px; }
.catalog-heading { align-items: flex-start; justify-content: space-between; }
.catalog-series-desc { color: var(--muted); font-size: 14px; margin: 6px 0 0; max-width: 640px; }
.catalog-controls { display: flex; align-items: center; gap: 16px; margin: 14px 0; flex-wrap: wrap; }
.catalog-controls .sync-field select { min-width: 200px; }
.catalog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-bottom: 14px;
}
.catalog-cell {
  position: relative; border-radius: 10px; padding: 10px 6px; font-weight: 700; font-size: 13px;
  cursor: pointer; text-align: center; border: 1px solid var(--line);
}
.catalog-cell.synced { background: rgba(57,115,88,.16); border-color: rgba(57,115,88,.4); color: #bfe6cf; }
.catalog-cell.synced:hover { background: rgba(57,115,88,.26); }
.catalog-cell.coming-soon { background: rgba(255,255,255,.03); color: var(--muted); }
.catalog-cell.coming-soon:hover { background: rgba(255,255,255,.07); }
.catalog-legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.catalog-legend span { display: inline-flex; align-items: center; gap: 6px; }
.catalog-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.catalog-swatch.synced { background: rgba(57,115,88,.7); }
.catalog-swatch.coming-soon { background: rgba(255,255,255,.15); }
.catalog-swatch.chazarah-dot {
  position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--blue);
  display: block;
}
.catalog-swatch.hebrew-dot {
  position: absolute; top: 3px; left: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--highlight);
  display: block;
}
.catalog-legend .chazarah-dot, .catalog-legend .hebrew-dot { position: static; display: inline-block; }
.catalog-legend .chazarah-dot { background: var(--blue); }
.catalog-legend .hebrew-dot { background: var(--highlight); }

/* Sitewide bottom tab bar (see nav.js) -- rendered on every page except
   index.html, which has its own equivalent inline copy (it doesn't load
   this stylesheet at all, so there's no conflict/duplication risk).
   Breakpoint and values kept pixel-identical to index.html's own copy on
   purpose, so the bar looks the same everywhere.

   A single horizontally-scrollable row, not a fixed-column grid -- a grid
   sized for a fixed tab count wraps a 6th (now Cloud Chaburah) tab onto its
   own second row the moment the bar gains one more entry than the grid was
   built for, which is exactly what happened here. A row that scrolls has no
   such ceiling: it already reads identically to the old grid whenever every
   tab fits the viewport, and simply lets a reader swipe to the rest once
   they don't, rather than silently wrapping into a second stacked row. */
.mobile-nav { display: none; }
@media (max-width: 760px) {
  .mobile-nav {
    align-items: stretch;
    /* Fully opaque, not translucent -- on a page whose own content behind it
       is a similarly pale card (the daf/Vilna pages, all ivory-themed via
       watch-theme.css), the old rgba(...,.96) let that content bleed
       faintly through, ghosting text underneath the tab labels. This bar is
       chrome, not a frosted overlay -- it should read as solid regardless
       of what's scrolled underneath it. */
    background: #f4f7fb;
    border-top: 1px solid var(--line);
    bottom: 0;
    box-shadow: 0 -5px 20px rgba(29, 57, 88, 0.06);
    display: flex;
    gap: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    left: 0;
    padding: 8px max(6px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-right));
    position: fixed;
    right: 0;
    z-index: 30;
  }
  .mobile-nav::-webkit-scrollbar { display: none; }

  .mobile-nav button,
  .mobile-nav a {
    align-items: center;
    background: transparent;
    border: 0;
    color: #65748a;
    display: flex;
    /* Five short tabs share the width evenly. */
    flex: 1 1 0;
    flex-direction: column;
    font-size: 11px;
    gap: 4px;
    min-width: 56px;
    padding: 4px 1px;
    scroll-snap-align: start;
    text-decoration: none;
    white-space: nowrap;
  }

  /* A two-word label (Cloud Chaburah, Maggidei Shiurim) wraps onto a second
     line inside its own tab rather than overflowing sideways into the next
     one -- the gap above keeps neighboring tabs apart even so, this just
     keeps the wrapped pair reading as one centered label instead of a
     loose, left-leaning stack. */
  .mobile-nav button span,
  .mobile-nav a span {
    text-align: center;
    line-height: 1.2;
  }

  .mobile-nav button.active,
  .mobile-nav a.active {
    color: var(--accent);
  }
}
.mobile-nav button:focus-visible,
.mobile-nav a:focus-visible {
  outline: 3px solid rgba(47, 110, 165, 0.45);
  outline-offset: 2px;
}

/* ===========================================================================
   Unified viewing-mode system: the prominent 3-button selector, and Split
   View (video and daf in separate, non-overlapping panes).
   ===========================================================================
   Shared here, in the ONE sitewide stylesheet, deliberately -- not as a new
   page-local <style> block copied into player/browse/watch/index.html the
   way Reading Mode's own CSS already is (see app.js's own Reading Mode
   comment on that being pre-existing duplication, not a pattern to repeat).
   Every rule below targets ids/classes app.js writes identically on whichever
   of those pages actually has them, so one copy here covers all three.

   Split View reuses .watch-layout -- the very same element already holding
   .player-card and .daf-card as plain siblings on every page that has it
   (browse/index.html and player/index.html both already carry this class;
   watch/index.html's .workspace now carries it too) -- as its own container.
   Nothing is ever moved into a new wrapper; only THIS element's own layout
   (CSS Grid) and position (fixed, full-viewport, while active) change. */

.viewer-mode-select {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}
/* Each mode's name sits under its icon, at every size -- an icon alone
   did not say which of three similar pictures meant what. */
.viewer-mode-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: auto;
  min-height: 52px;
  min-width: 44px;
  padding: 5px 16px;
  line-height: 1.1;
  white-space: nowrap;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255,255,255,.02) inset;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.viewer-mode-button svg { width: 20px; height: 20px; flex-shrink: 0; }
.viewer-mode-button:hover { border-color: var(--accent); color: var(--accent); }
.viewer-mode-button:active { transform: translateY(1px); }
.viewer-mode-button.active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
  box-shadow: 0 10px 26px rgba(47, 110, 165, .35);
}
.viewer-mode-button:focus-visible {
  outline: 3px solid rgba(47, 110, 165, .5);
  outline-offset: 2px;
}
.viewer-mode-button span:not(.sr-only) { display: block; }
@media (max-width: 560px) {
  .viewer-mode-select { gap: 8px; }
  .viewer-mode-button { min-height: 48px; padding: 4px 10px; font-size: 11.5px; }
}
/* A phone in portrait is often just over 380px. Stacking the name under
   the icon (instead of beside it) is what keeps all three on one row with
   their names showing; the old fix hid the names entirely. */
@media (max-width: 640px), (max-height: 520px) and (max-width: 1100px) {
  .viewer-mode-select { flex-wrap: nowrap; }
  .viewer-mode-button { flex: 0 1 auto; min-width: 44px; padding: 4px 9px; font-size: 11px; gap: 2px; }
  .viewer-mode-button svg { width: 19px; height: 19px; }
}

/* --- Split View container: .watch-layout in its "split-active" state ---- */

body.split-view-active .watch-layout.split-active {
  --split-divider-size: 10px;
  display: grid;
  grid-template-columns: calc((100% - var(--split-divider-size)) * var(--split-video-ratio, .5)) var(--split-divider-size) 1fr;
  grid-template-rows: 1fr;
  gap: 0;
  align-items: stretch;
  height: 100%;
}
body.split-view-active .watch-layout.split-active.split-stacked {
  grid-template-columns: 1fr;
  grid-template-rows: calc((100% - var(--split-divider-size)) * var(--split-video-ratio, .4)) var(--split-divider-size) 1fr;
}
body.split-view-active .watch-layout.split-active > .player-card {
  grid-column: 1; grid-row: 1; margin: 0; min-width: 0; min-height: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-start; overflow: hidden;
  /* Flush with the daf pane, and showing nothing but the video itself (see
     the child rule below) -- no card padding/background/border/shadow left
     to draw a frame around it. */
  padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
body.split-view-active .watch-layout.split-active > .daf-card {
  grid-column: 3; grid-row: 1; margin: 0; min-width: 0; min-height: 0; height: 100%; overflow: hidden;
  /* Flush with the video pane, the same way .player-card is -- no card
     padding/background/border/shadow of its own left to hold the printed
     page away from the shared edge. Unlike .player-card, nothing inside is
     hidden: the daf stays fully interactive (header, zoom toolbar, the page
     itself, the status bar), just flush to the pane instead of inset in it.
     position:relative is the phone panel's containing block. top/left must
     stay auto: the page stylesheet's sticky top:128px is ignored while the
     card is static, and turning it relative (below 1120px) was shifting the
     whole pane — and the dropdown — about 128px below the divider. */
  position: relative;
  top: auto;
  right: auto;
  bottom: auto;
  left: auto;
  padding: 0; background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
/* .daf-scroll already manages its own internal spacing independently of
   .daf-card's own padding (see .vilna-zoom-controls' own negative-margin
   trick, which cancels .vilna-placeholder's padding to span the full width
   of whatever contains it) -- zeroing ITS rounding is the only follow-on
   change flush needs there. The header (player/index.html's own
   .daf-header, or browse/watch's .card-heading) has no padding of its own
   at all normally, relying entirely on .daf-card's now-zeroed padding for
   its breathing room -- given a little back directly so its title/tools row
   isn't glued to the very edge. */
body.split-view-active .watch-layout.split-active > .daf-card .daf-scroll {
  border-radius: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
/* The header (back to the daf, Auto-scroll, the skip chip just under it)
   used to live inside the scrolling card, so a word tap or a flick hid the
   way back. The card itself no longer scrolls; only the page inside
   .daf-scroll does, and the header stays put. */
body.split-view-active .watch-layout.split-active > .daf-card > .daf-header,
body.split-view-active .watch-layout.split-active > .daf-card > .card-heading {
  padding: 14px 16px 0;
}
body.split-view-active .watch-layout.split-active .split-divider { grid-column: 2; grid-row: 1; }
body.split-view-active .watch-layout.split-active.split-stacked > .player-card { grid-column: 1; grid-row: 1; }
body.split-view-active .watch-layout.split-active.split-stacked > .daf-card { grid-column: 1; grid-row: 3; }
body.split-view-active .watch-layout.split-active.split-stacked .split-divider { grid-column: 1; grid-row: 2; }
body.split-view-active .watch-layout.split-active.split-video-end > .player-card { grid-column: 3; }
body.split-view-active .watch-layout.split-active.split-video-end > .daf-card { grid-column: 1; }
body.split-view-active .watch-layout.split-active.split-stacked.split-video-end > .player-card { grid-column: 1; grid-row: 3; }
body.split-view-active .watch-layout.split-active.split-stacked.split-video-end > .daf-card { grid-column: 1; grid-row: 1; }
/* .player-card carries page-specific chrome around the video that differs
   by page (player/index.html's own small .daf-header.video-header vs.
   browse/watch's larger .card-heading, plus .now-learning and
   .overlay-controls-page on the pages that have them) -- rather than listing
   every one of those page-local class names here, hide every direct child
   EXCEPT the video's own wrapper. What's left is the video player by
   itself, edge to edge, never "a crop of the player page" around it. */
body.split-view-active .watch-layout.split-active > .player-card > *:not(.reading-video-float) {
  display: none;
}
body.split-view-active .watch-layout.split-active > .player-card .reading-video-float {
  flex: 1; height: 100%; min-height: 0;
}
body.split-view-active .watch-layout.split-active > .player-card .reading-video-slot { height: 100%; }
/* border-radius was already zeroed here for the flush edge, but the base
   1px solid border .video-frame always has was left in place -- reported
   directly as a thin white line still framing the video on every side. */
body.split-view-active .watch-layout.split-active > .player-card .video-frame { flex: 1; height: 100%; aspect-ratio: auto; border-radius: 0; border: 0; }
/* Vaater's alignment editor (admin-only, see .watch-layout.editing in
   player/index.html's own page-local CSS) is a different, unrelated use of
   this same container -- Split View is not expected to be entered while it's
   open, so no interaction between the two is defined; this just keeps a
   .editing/.split-active combination from producing a broken layout if it
   ever happens. */
body.split-view-active .watch-layout.split-active.editing { display: grid; }

/* Distraction-free focus mode: the container leaves normal document flow
   and fills the viewport, while every other page chrome element (sidebar,
   topbar, breadcrumb, title row, the admin daf-picker strip) is hidden --
   none of them are removed or reparented, just not displayed while active. */
body.split-view-active .sidebar,
body.split-view-active .topbar,
body.split-view-active .breadcrumb,
body.split-view-active .title-row,
body.split-view-active .setup-strip {
  display: none;
}
body.split-view-active .page { padding: 0; min-height: 100vh; }
body.split-view-active main { padding: 0; max-width: none; }
/* The prominent selector lives OUTSIDE .watch-layout in normal document flow
   (directly above it) in every other mode -- but Split View's own focus mode
   just took .watch-layout out of flow entirely and pinned it fixed over the
   full viewport (z-index 500, right below), which would otherwise silently
   cover the selector and swallow every click meant for it. Elevating it to a
   fixed overlay of its own, at a higher z-index, keeps exactly the same
   nodes (never recreated) reachable instead of hiding or duplicating them.
   Known limitation: because it is a SIBLING of .watch-layout rather than a
   descendant, it is not part of what paints during REAL native browser
   fullscreen (only .watch-layout's own descendants render there -- the same
   constraint .split-toolbar itself is built to satisfy, being inside it) --
   Split View's own focus mode (the state every page actually opens Split
   View into) is unaffected by this, since it is plain fixed positioning, not
   native fullscreen. */
body.split-view-active .viewer-mode-select {
  position: fixed;
  top: max(10px, env(safe-area-inset-top, 0px));
  /* Anchored to the video pane, not the viewport center. A centered bar
     sits on the daf's Auto-scroll row. The width cap matches the video
     column (the ratio is published on the root because this bar is not
     inside .watch-layout) so a wrap stays over the picture. The picture
     already clears this bar via --viewer-mode-bar-h. */
  left: max(10px, env(safe-area-inset-left, 0px));
  right: auto;
  transform: none;
  box-sizing: border-box;
  z-index: 502;
  margin: 0;
  padding: 8px;
  border-radius: 14px;
  background: rgba(8,17,28,.82);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(6px);
  flex-wrap: wrap;
  justify-content: flex-start;
  width: max-content;
  max-width: calc((100vw - var(--split-divider-size, 10px)) * var(--split-video-ratio, .5) - 20px);
}
body.split-view-active.split-video-at-end:not(.split-layout-stacked) .viewer-mode-select {
  left: auto;
  right: max(10px, env(safe-area-inset-right, 0px));
}
body.split-view-active.split-layout-stacked .viewer-mode-select {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  max-width: calc(100vw - 20px);
}
body.split-view-active.split-layout-stacked.split-video-at-end .viewer-mode-select {
  top: calc((100dvh - var(--split-divider-size, 10px)) * var(--split-video-ratio, .4) + var(--split-divider-size, 10px) + max(10px, env(safe-area-inset-top, 0px)));
}
/* Icon-only in this specific overlay placement BELOW 680px (not the general
   <380px rule further down, which also applies to the normal in-flow
   selector on every other mode, and stays icon+label above that) -- three
   full labels do not reliably fit above a Split View video pane that can
   itself be narrower than the viewport (stacked layout, or a swapped/
   resized pane, or a phone screen), and flex-wrap turning this into a 3-row
   block was confirmed directly to grow tall enough to cover the whole top
   of the video and the Split View toolbar's own controls beneath it. Full
   desktop widths keep the labels -- the spec's own "icon+label, feels like
   a primary control" is otherwise lost for the one case (Split View,
   already the default mode) that matters most. */
/* Names stay visible here too: under the icon they cost height, not width,
   so the bar keeps to one row. */
body.split-view-active .viewer-mode-select .viewer-mode-button {
  padding: 4px 12px;
}
body.split-view-active .watch-layout.split-active {
  position: fixed;
  inset: 0;
  z-index: 500;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  background: var(--bg);
  border-radius: 0;
}
/* Native browser fullscreen on the SAME container (see toggleVilnaFullscreen
   in app.js, which targets .watch-layout whenever Split View or Reading Mode
   is active) needs no extra positioning rules here -- the UA already makes a
   :fullscreen element fill the screen on its own; only the radius/inset
   cleanup above still applies. */
body.split-view-active .watch-layout.split-active:fullscreen,
body.split-view-active .watch-layout.split-active:-webkit-full-screen {
  padding: 0;
}

.split-divider {
  position: relative;
  background: var(--line-strong);
  cursor: col-resize;
  touch-action: none;
  border-radius: 999px;
}
body.split-view-active .watch-layout.split-active.split-stacked .split-divider { cursor: row-resize; }
/* The visible bar can stay thin (10px, matching --split-divider-size) while
   the actual hit/touch target is >=44px, via a transparent pseudo-element
   extending past the bar's own edges rather than inflating the bar itself
   and eating into either pane. */
.split-divider::before {
  content: "";
  position: absolute;
  inset: 0 -17px;
}
body.split-view-active .watch-layout.split-active.split-stacked .split-divider::before { inset: -17px 0; }
/* Landscape phones get a vertical bar about 10px wide, and the panes paint
   over the old slop, so a finger never lands a tap. Raise the bar above
   the panes and bias the target into the daf, clear of the video controls.
   10px bar + 28px daf side + 10px video side is a 48px touch target. */
@media (pointer: coarse) and (orientation: landscape),
       (hover: none) and (orientation: landscape) {
  body.split-view-active .watch-layout.split-active:not(.split-stacked) .split-divider {
    z-index: 20;
  }
  body.split-view-active .watch-layout.split-active:not(.split-stacked) .split-divider::before {
    inset: -12px -28px -12px -10px;
  }
  body.split-view-active .watch-layout.split-active.split-video-end:not(.split-stacked) .split-divider::before {
    inset: -12px -10px -12px -28px;
  }
}
.split-divider:hover,
.split-divider.is-dragging,
.split-divider:focus-visible {
  background: var(--accent);
}
.split-divider:focus-visible {
  outline: 3px solid rgba(47, 110, 165, .5);
  outline-offset: 2px;
}
.split-divider::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 4px; height: 34px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: rgba(255,255,255,.5);
}
body.split-view-active .watch-layout.split-active.split-stacked .split-divider::after { width: 34px; height: 4px; }
body:not(.split-view-active) .split-divider,
.watch-layout:not(.split-active) .split-divider { display: none; }

/* Phone Split keeps the daf picker and the daf header out of the picture.
   They live in a panel the divider opens on tap. Collapsed, only the thin
   bar shows. Portrait uses this below 760px. Landscape phones are wider
   than that and side-by-side, so the same rules also follow a coarse or
   touch pointer in landscape. A mouse keeps the desktop chrome. */
.split-tools-panel { display: none; }
.split-tools-hint {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-radius: 50%;
  background: #c4840a;
  box-shadow: 0 0 0 2px rgba(255,255,255,.85);
  pointer-events: none;
}
.split-tools-hint[hidden] { display: none; }
@media (max-width: 760px),
       (pointer: coarse) and (orientation: landscape),
       (hover: none) and (orientation: landscape) {
  body.split-tools-phone .watch-layout.split-active .video-frame > #playerTopbar {
    display: none !important;
  }
  body.split-tools-phone:not(.split-tools-open) .watch-layout.split-active > .daf-card > .daf-header,
  body.split-tools-phone:not(.split-tools-open) .watch-layout.split-active > .daf-card > .card-heading,
  body.split-tools-phone:not(.split-tools-open) .watch-layout.split-active > .daf-card > #readerDafNotes,
  body.split-tools-phone:not(.split-tools-open) .watch-layout.split-active .vilna-zoom-controls {
    display: none !important;
  }
  body.split-tools-phone .watch-layout.split-active > .daf-card {
    position: relative;
    top: auto;
    right: auto;
    bottom: auto;
    left: auto;
  }
  /* A dropdown over the top of the daf pane. It sizes to its rows and
     only scrolls past 60% of the pane. The rows are chips, so at 412×915
     the picker, Notes, More, Auto-scroll, Daf page, Reviewing, and Skip
     all fit without an inner scroller. */
  body.split-tools-phone.split-tools-open #splitToolsPanel {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 60%;
    /* Visible so the daf picker can drop past the bar. The rows are short
       enough that 60% holds them; the card clips anything past the pane. */
    overflow: visible;
    background: #f4f7fb;
    color: #132238;
    box-shadow: 0 18px 42px rgba(8, 17, 28, .38);
    border-bottom: 1px solid rgba(19, 34, 56, .14);
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .split-tools-scroll {
    min-height: 0;
    flex: 0 0 auto;
    overflow: visible;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-topbar {
    position: relative !important;
    top: auto !important;
    height: auto !important;
    min-height: 0;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px 6px;
    padding: 4px 8px;
    background: #102033;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-topbar::before { content: none; }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-topbar-group { flex-wrap: nowrap; min-width: 0; }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-brand span,
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-daf-hebrew,
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-topbar-rule-he { display: none; }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-daf-button {
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    font-size: 13px;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel #playerDafLabel {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 46vw;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-chrome-button {
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .player-chrome-button svg { width: 14px; height: 14px; }
  body.split-tools-phone.split-tools-open #splitToolsPanel .daf-header,
  body.split-tools-phone.split-tools-open #splitToolsPanel .card-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    padding: 4px 8px 2px;
    height: auto;
    background: transparent;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .daf-header > div:first-child,
  body.split-tools-phone.split-tools-open #splitToolsPanel .card-heading > div:first-child,
  body.split-tools-phone.split-tools-open #splitToolsPanel .daf-tools,
  body.split-tools-phone.split-tools-open #splitToolsPanel .daf-heading-tools {
    display: contents;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .eyebrow { display: none; }
  body.split-tools-phone.split-tools-open #splitToolsPanel #dafTitle,
  body.split-tools-phone.split-tools-open #splitToolsPanel .daf-header h2 {
    flex: 1 1 100%;
    margin: 0;
    font: 700 14px Georgia, "Times New Roman", serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .header-auto-scroll,
  body.split-tools-phone.split-tools-open #splitToolsPanel .split-back-to-daf {
    height: 28px;
    margin: 0;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 12px;
    background: #fff;
    border: 1px solid rgba(19, 34, 56, .18);
    color: #132238;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .reading-mode-entry {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    justify-content: center;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .reading-mode-entry span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel #readerDafNotes {
    display: flex;
    height: auto;
    min-height: 0;
    max-height: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow: visible;
    padding: 2px 8px 4px;
    background: transparent;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .reviewing-label,
  body.split-tools-phone.split-tools-open #splitToolsPanel .not-synced-note {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .skip-to-daf-chip {
    flex: 0 1 auto;
    min-width: 0;
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }
  body.split-tools-phone.split-tools-open #splitToolsPanel .vilna-zoom-controls {
    position: relative;
    top: auto;
    display: flex;
    flex-wrap: nowrap;
    align-self: stretch;
    overflow: hidden;
    height: 32px;
    width: auto;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin: 2px 8px 6px;
    padding: 2px 6px;
    border-radius: 12px;
    z-index: 2;
  }
  /* A landscape daf pane is short. 60% of it clips the chips; the pane
     itself is the dropdown's ceiling. */
  @media (pointer: coarse) and (orientation: landscape),
         (hover: none) and (orientation: landscape) {
    body.split-tools-phone.split-tools-open #splitToolsPanel {
      max-height: 100%;
    }
  }
}

/* Split View's own small toolbar (layout toggle, swap, reset, fullscreen,
   exit) -- merged into ONE combined bar with the prominent selector rather
   than floating as a second bar of its own (reader-requested: two separate
   floating bars read as more chrome than one, and one narrower bar reads as
   less). initSplitView() (app.js) moves #splitToolbar to become a trailing
   child of #viewerModeSelect once, at page init, with a thin divider
   (.viewer-mode-bar-divider) between the three mode buttons and these
   utility icons -- so it contributes only its own row of buttons here, no
   separate position/background/border/blur of its own; the one shared
   background lives on #viewerModeSelect (see body.split-view-active
   .viewer-mode-select above). See showSplitChrome() in app.js for the
   auto-hide behavior applied to the combined bar as a whole -- fades on
   inactivity, returns on pointer/touch/keyboard activity within the player
   or daf pane, the same idea .player-controls already has via
   .controls-hidden. */
.split-toolbar {
  display: none;
  align-items: center;
  gap: 6px;
}
body.split-view-active .split-toolbar { display: flex; }
.split-toolbar .icon-button {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.85);
  cursor: pointer;
}
.split-toolbar .icon-button:hover { background: rgba(255,255,255,.12); color: #fff; }
body.split-view-active .split-toolbar #splitExitButton {
  opacity: 1;
  color: #102033;
  background: #fff;
  border: 1px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  cursor: pointer;
}
body.split-view-active .split-toolbar #splitExitButton:hover {
  background: #fff;
  color: #102033;
}
.split-toolbar .icon-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.split-back-to-daf {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-inline-end: 8px;
  border: 1px solid rgba(19, 34, 56, .28);
  background: #fff;
  color: #132238;
  border-radius: 999px;
  padding: 6px 12px;
  font: 800 13px "Assistant", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.split-back-to-daf:hover { background: #e7eef6; }
.split-back-to-daf[hidden] { display: none !important; }
.split-chrome-wake {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 28px;
  z-index: 14;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
body.split-view-active.split-chrome-hidden .split-chrome-wake {
  display: block;
}
.viewer-mode-bar-divider {
  display: none;
  width: 1px;
  align-self: stretch;
  margin: 4px 2px;
  background: rgba(255,255,255,.2);
}
body.split-view-active .viewer-mode-bar-divider { display: block; }
/* Auto-hide. visibility follows the opacity fade, and hit-testing stays on
   until that fade finishes, so a bar that still looks visible still receives
   the tap. Once it is hidden, taps reach the daf header and Auto-scroll.
   A thin strip on the video (#splitChromeWake) and a click on the daf bring
   it back. The always-visible "Daf page" button is the way out while the
   bar is gone, including in fullscreen where this bar isn't inside the
   fullscreen element. */
@media (prefers-reduced-motion: no-preference) {
  body.split-view-active .viewer-mode-select { transition: opacity .2s ease, visibility 0s linear .2s; }
  body.split-view-active:not(.split-chrome-hidden) .viewer-mode-select { transition: opacity .2s ease, visibility 0s linear 0s; }
}
body.split-view-active.split-chrome-hidden .viewer-mode-select {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* --- Split View's own video pinch-zoom/pan gesture surface --------------- */

.split-video-pinch-surface {
  display: none;
  position: absolute;
  /* The bottom inset has to clear BOTH docked strips, not just the control
     bar: .scrubber-wrap (the timeline) sits directly on top of
     .player-controls at bottom: var(--pc-bar-h), and reserving only
     --pc-bar-h left this surface covering the timeline outright at z-index
     11 against its 7. Seeking then did nothing at all -- worse, a drag
     along the timeline read as a pan and a tap on it as this surface's own
     tap-to-toggle-play, so the video reacted to a scrub attempt by playing
     or pausing instead of seeking. */
  inset: 0 0 calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px));
  z-index: 11;
  touch-action: none;
  cursor: zoom-in;
}
body.split-view-active .watch-layout.split-active .video-frame .split-video-pinch-surface { display: block; }
.video-frame .split-video-pinch-surface.is-zoomed { cursor: grab; }
/* Same bug as the timeline above, at the other end of the frame: the pinch
   surface's inset starts at the very top (0), same as .player-topbar, but
   sits above it at z-index 11 against the topbar's 7 -- so the daf picker,
   bookmark, notes and "more" buttons up there were all unreachable in
   Split View, silently swallowed by the gesture surface the same way the
   seek bar was.

   Raising the topbar's own z-index only fixes that half of it, though:
   #viewerModeSelect (the combined mode-selector/toolbar bar) is a
   position:fixed SIBLING of .watch-layout, not a descendant of it, so it
   paints in a stacking context above .watch-layout's ENTIRE subtree
   regardless of any z-index used inside .watch-layout -- confirmed
   directly, elementFromPoint at the daf picker's own coordinates returned
   #viewerModeSelect itself, sitting fixed at the top of the viewport right
   over it. No z-index fixes a stacking-context boundary; only moving the
   topbar out of the combined bar's own screen-space footprint does, so it
   is shifted down to clear it (matching the combined bar's own height)
   as well as raised above the pinch surface. */
body.split-view-active .watch-layout.split-active .video-frame .player-topbar {
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + var(--viewer-mode-bar-h, 74px));
  z-index: 13;
}
/* Shifting the topbar down vacates the strip above it (0 to its new top),
   which used to be covered by the topbar's own gradient background --
   left bare, it showed a hard seam where that background now starts
   abruptly mid-frame, and a YouTube shiur's own native title overlay
   showing through underneath, which this app hides everywhere else. A
   pseudo-element on the topbar itself (its nearest positioned ancestor is
   the topbar, so this extends upward from its own top edge) fills exactly
   that gap with the same starting color the gradient below it already
   uses, so the two reads as one continuous surface. pointer-events: none
   so the pinch-zoom surface underneath still receives gestures there --
   this is decoration only, nothing here is interactive. */
body.split-view-active .watch-layout.split-active .video-frame .player-topbar::before {
  content: '';
  position: absolute;
  top: calc(-1 * (max(10px, env(safe-area-inset-top, 0px)) + var(--viewer-mode-bar-h, 74px)));
  left: 0;
  right: 0;
  height: calc(max(10px, env(safe-area-inset-top, 0px)) + var(--viewer-mode-bar-h, 74px));
  background: rgba(4,12,22,.9);
  pointer-events: none;
}
/* On a phone the solid fill above the shifted title row, stacked on the
   control-bar scrim, covered most of a short split video. A short fade is
   enough to hide the embed's own title without painting the picture. */
@media (max-width: 760px), (max-height: 520px) and (max-width: 1100px) {
  body.split-view-active .watch-layout.split-active .video-frame .player-topbar::before {
    top: -10px;
    height: 10px;
    background: linear-gradient(to bottom, rgba(4,12,22,.28), rgba(4,12,22,0));
  }
  /* One row, over the video only while the player chrome is up. Two wrapped
     rows of 44px buttons were covering the top ~40% of a short Split video. */
  body.split-view-active .viewer-mode-select {
    flex-wrap: nowrap;
    gap: 4px;
    padding: 3px;
    border-radius: 12px;
    max-width: calc(100vw - 12px);
    overflow-x: auto;
    scrollbar-width: none;
  }
  body.split-view-active .viewer-mode-select::-webkit-scrollbar { display: none; }
  /* Icon over a 10px name set on two short lines ("Daf on / video"). On
     one line the three names need ~230px and the bar has ~185px beside
     the Split tools, so they were clipped; two lines fit in the 44px the
     close button already makes this bar. */
  body.split-view-active .viewer-mode-select .viewer-mode-button {
    flex: 0 0 auto;
    height: auto;
    min-height: 44px;
    min-width: 44px;
    padding: 3px 4px 3px;
    gap: 1px;
    font-size: 10px;
    border-radius: 9px;
  }
  body.split-view-active .viewer-mode-select .viewer-mode-button span:not(.sr-only) {
    max-width: 36px;
    white-space: normal;
    text-align: center;
    line-height: 1.05;
  }
  body.split-view-active .viewer-mode-select .viewer-mode-button svg { width: 17px; height: 17px; }
  /* A 360px phone: the last few pixels come from the tool icons' padding,
     not from the names or the close button's 44px target. */
  @media (max-width: 380px) {
    body.split-view-active .viewer-mode-select { gap: 3px; }
    body.split-view-active .split-toolbar .icon-button:not(#splitExitButton) {
      width: 30px;
      min-width: 30px;
    }
  }
  body.split-view-active .split-toolbar { gap: 2px; }
  body.split-view-active .split-toolbar .icon-button {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  /* The close control was the same faint stroke as the other icons, and on
     a phone it read as disabled. A solid chip stays obviously tappable. */
  body.split-view-active .split-toolbar #splitExitButton {
    width: 40px;
    height: 40px;
    min-width: 44px;
    min-height: 44px;
    opacity: 1;
    color: #102033;
    background: #fff;
    border: 1px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .45);
  }
  body.split-view-active .split-toolbar #splitExitButton svg {
    width: 18px;
    height: 18px;
  }
  body.split-view-active.split-chrome-hidden .watch-layout.split-active .video-frame .player-topbar {
    top: 0;
  }
}
/* Applied to the video PICTURE only (#video / #youtubePlayerHost -- exactly
   one is visible at a time, see app.js's own source-switch code) -- NOT to
   #videoFrame itself. #videoFrame also contains the topbar, control bar and
   this pane's own pinch surface/zoom indicator as ordinary children; scaling
   the whole frame would scale and reposition all of THOSE too (confirmed
   directly: an earlier, since-removed on-screen zoom-button group drifted
   toward the top of the viewport as zoom increased and started intercepting
   clicks meant for the prominent selector above). Clipped by .video-frame's
   own existing overflow:hidden either way. */
/* The transform itself is gated on .split-video-zoomed (toggled by
   setSplitVideoZoom below the 1.001 threshold), not applied unconditionally
   at scale(1) translate(0,0) -- even an identity transform promotes an
   element to its own composited layer, and on a YouTube shiur that element
   is a cross-origin iframe whose video the browser composites itself, a
   known way for the picture alone to stop updating on mobile while the
   rest of the page carries on. Nothing needs the transform until a reader
   actually zooms. */
body.split-view-active .watch-layout.split-active .video-frame.split-video-zoomed #video,
body.split-view-active .watch-layout.split-active .video-frame.split-video-zoomed #youtubePlayerHost {
  /* Translate first, so the pan is in screen pixels whatever the zoom. */
  transform: translate(var(--split-video-pan-x, 0px), var(--split-video-pan-y, 0px)) scale(var(--split-video-zoom, 1));
  transform-origin: center center;
}
body.split-view-active .watch-layout.split-active .video-frame #video {
  width: 100%;
  height: 100%;
  object-position: center top;
}
body.split-view-active .watch-layout.split-active .video-frame.youtube-active #youtubePlayerHost {
  /* Same top-locked 16:9 box as outside Split. Stretching this host to the
     whole pane, then cropping the iframe upward, slid the picture off the
     top as the pane shrank. A pane taller than 16:9 is the cover rule
     below: full height, sides cropped, bottom kept for the burned-in line. */
  inset: auto;
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
}
/* Pane taller than 16:9 (cover), outside Split only. The picture scales
   past the pane. The iframe is pinned to the pane's bottom edge, so the
   extra height — and the title row — can only hang off the top. Sides
   crop. Split View never uses this: there the whole frame is fitted inside
   the pane (see "Split View: the whole picture" below). */
@container yt-frame (aspect-ratio < 16 / 9) {
  body:not(.split-view-active) .video-frame.youtube-active .youtube-player-host,
  body:not(.split-view-active) .video-frame.youtube-active .yt-shield {
    --yt-crop-top: clamp(36px, 8cqh, 84px);
    width: calc((100cqh + var(--yt-crop-top)) * 16 / 9);
    height: calc(100cqh + var(--yt-crop-top));
    max-width: none;
    max-height: none;
    top: auto;
    bottom: 0;
    left: calc((100cqw - (100cqh + var(--yt-crop-top)) * 16 / 9) / 2);
    right: auto;
    margin-inline: 0;
  }
  body:not(.split-view-active) .video-frame.youtube-active .yt-mask-layer {
    --yt-crop-top: clamp(36px, 8cqh, 84px);
    top: 0;
    left: 0;
    right: auto;
    bottom: auto;
    margin: 0;
    width: 100cqw;
    height: 100cqh;
    max-width: none;
    max-height: none;
  }
  body:not(.split-view-active) .video-frame.youtube-active .yt-mask-layer .yt-edge-top {
    /* 48px of the iframe, scaled by how far the cover box is enlarged
       past the pane, then brought back by the crop. The band is at least
       that tall so the byline cannot sit above the toolbar. */
    height: max(80px, calc(48px * ((100cqh + var(--yt-crop-top)) * 16 / 9) / 100cqw - var(--yt-crop-top)));
  }
}
/* Divider dragged far down, outside Split. The title crop is already off
   the top, so the top band stays a hairline. */
@container yt-frame (aspect-ratio < 2 / 3) {
  body:not(.split-view-active) .video-frame.youtube-active .yt-mask-layer .yt-edge-top {
    height: clamp(18px, 4cqh, 36px);
  }
}
/* --- Split View: the whole picture --------------------------------------
   The iframe, the poster, and the mask share one box: the largest 16:9
   rectangle that fits inside the pane, top edge on the pane's top edge,
   centered across. Nothing is cropped off the top (the old title crop), so
   both burned-in caption lines stay in view. Shrinking the pane shrinks
   the picture from its top-anchored box, so it never slides off.

   Stacked (phone portrait): the default pane is exactly the full-width
   picture (stackedFullPictureRatio in app.js). Dragging the divider down
   past that keeps pulling the picture down with it: it fills the pane's
   height and its sides are cut evenly, so it zooms in and narrows instead
   of leaving empty space below (the cover rule just after this one).
   Side by side, the divider moves across, and the picture stays whole.
   The reader can still pinch to zoom; the Fit button (app.js) and a
   double-tap bring the full frame back.

   The iframe is exactly the picture, so YouTube lays its own rows out in
   this box: the chip variables are the box itself (origin 0, full width). */
body.split-view-active .watch-layout.split-active .video-frame.youtube-active #youtubePlayerHost,
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-shield,
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer {
  --yt-crop-top: 0px;
  --yt-iframe-w: min(100cqw, calc(100cqh * 16 / 9));
  --yt-iframe-left: 0px;
  --yt-mask-left: 0px;
  --yt-origin: 0px;
  --yt-clip: var(--yt-iframe-w);
  inset: auto;
  top: 0;
  bottom: auto;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: min(100cqw, calc(100cqh * 16 / 9));
  height: min(100cqh, calc(100cqw * 9 / 16));
  max-width: 100%;
  max-height: 100%;
}
/* Side by side with a mouse (a computer): the picture is centred in its
   pane, top to bottom, instead of hanging at the top of a tall pane. The
   controls sit along the pane's bottom, under the picture. Phones keep the
   top edge (stacked) or fill the height (sideways) as set elsewhere. */
@media (hover: hover) and (pointer: fine) {
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active #youtubePlayerHost,
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active .yt-shield,
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer {
    top: 0;
    bottom: 0;
    margin: auto;
  }
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame #video {
    object-position: center center;
  }
}
/* Stacked, pane taller than the full-width picture (divider dragged down):
   the picture follows the divider down -- full pane height, 16:9, sides cut
   evenly, top on the pane's top -- so there is no empty band below it. The
   caption lines stay at the pane's bottom edge. The mask is the visible
   pane; the poster keeps the picture's own box. */
@container yt-frame (aspect-ratio < 16 / 9) {
  body.split-view-active.split-layout-stacked .watch-layout.split-active .video-frame.youtube-active #youtubePlayerHost,
  body.split-view-active.split-layout-stacked .watch-layout.split-active .video-frame.youtube-active .yt-shield {
    top: 0;
    left: calc((100cqw - 100cqh * 16 / 9) / 2);
    right: auto;
    margin: 0;
    width: calc(100cqh * 16 / 9);
    height: 100cqh;
    max-width: none;
    max-height: none;
  }
  body.split-view-active.split-layout-stacked .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer {
    top: 0;
    left: 0;
    right: auto;
    margin: 0;
    width: 100cqw;
    height: 100cqh;
    max-width: none;
    max-height: none;
  }
  body.split-view-active.split-layout-stacked .watch-layout.split-active .video-frame #video {
    object-fit: cover;
    object-position: center top;
  }
}
/* A direct video link uses the same rule, so the frame is a size container
   in Split whatever the source. */
body.split-view-active .watch-layout.split-active .video-frame { container-type: size; container-name: yt-frame; }
/* Phone held sideways, side by side. The pane is about half the screen wide
   and the whole screen tall, so a full-width picture left a tall empty band
   below it. Here the picture fills the pane's whole height, as in stacked
   Split dragged down: 16:9 at that height, centered, its sides cut evenly.
   The controls float over its bottom and fade with the rest of the chrome.
   Dragging the divider right widens the pane and cuts less; pinching out
   shows the whole frame. A mouse in a wide window keeps the whole-picture
   rule above. */
@media (pointer: coarse) and (orientation: landscape),
       (hover: none) and (orientation: landscape) {
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame {
    --split-slot-h: 100cqh;
  }
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active #youtubePlayerHost,
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active .yt-shield {
    --yt-iframe-w: calc(var(--split-slot-h) * 16 / 9);
    --yt-clip: min(100cqw, var(--yt-iframe-w));
    top: 0;
    left: calc((100cqw - var(--split-slot-h) * 16 / 9) / 2);
    right: auto;
    margin: 0;
    width: calc(var(--split-slot-h) * 16 / 9);
    height: var(--split-slot-h);
    max-width: none;
    max-height: none;
  }
  /* The mask is what shows of the picture: the pane's width (or the
     picture's, if narrower), the picture's height. */
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer {
    --yt-iframe-w: min(100cqw, calc(var(--split-slot-h) * 16 / 9));
    --yt-clip: var(--yt-iframe-w);
    top: 0;
    left: max(0px, calc((100cqw - var(--split-slot-h) * 16 / 9) / 2));
    right: auto;
    margin: 0;
    width: min(100cqw, calc(var(--split-slot-h) * 16 / 9));
    height: var(--split-slot-h);
    max-width: none;
    max-height: none;
  }
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame #video {
    height: var(--split-slot-h);
    object-fit: cover;
    object-position: center top;
  }
  /* The controls float over the picture, as they do stacked: no solid bar,
     just a light fade behind the control row. */
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame .player-controls {
    background: transparent;
    border-top: 0;
    backdrop-filter: none;
  }
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame .player-controls::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px));
    background: linear-gradient(to top, rgba(4,14,27,.55), rgba(4,14,27,0));
    pointer-events: none;
    z-index: -1;
  }
  body.split-view-active:not(.split-layout-stacked) .watch-layout.split-active .video-frame .scrubber-wrap {
    background: none;
  }
}
/* What the mask still does in Split, and what it gives up. Measured on a
   real embed at phone size: YouTube's title row is about 48px of the
   iframe (after play, a seek, or while buffering), and its share button,
   channel card, and logo sit along the bottom row -- exactly where the
   two burned-in caption lines are -- for a few seconds before steady
   playback clears them.
   - The top band covers the title block (about 52px) and no more. The old
     76-100px band hid a third of a 412px-wide picture.
   - The bottom chips are not drawn. An opaque chip there hid the right
     half of both caption lines for six seconds after every play, seek,
     and pause, even when YouTube showed nothing there at all. YouTube's
     own small icons are allowed to show briefly instead. */
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer .yt-edge-top {
  /* Title, channel line, and avatar end ~52px down on a real embed. */
  height: min(60px, 26%);
  background: linear-gradient(to bottom, #07111c 0, #07111c calc(100% - 6px), rgba(7, 17, 28, 0) 100%);
}
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer .yt-edge-logo,
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer .yt-edge-share,
body.split-view-active .watch-layout.split-active .video-frame.youtube-active .yt-mask-layer .yt-edge-bottom {
  display: none !important;
}
/* Touch landscape, Split off. The daf picker is a row of the bottom chrome,
   and the picture ends above it. In Split the same bar lives in the divider
   panel; a mouse keeps it across the top of the video. */
@media (pointer: coarse) and (orientation: landscape),
       (hover: none) and (orientation: landscape) {
  /* The picture sits above the daf-name bar, the timeline and the controls.
     The frame is no taller than the screen, so those bars stay on it (sized
     from the width alone it ran ~90px past the bottom of a phone), and the
     daf overlay stays on the picture, off the bars. */
  body:not(.split-view-active) .video-frame:not(:fullscreen) {
    --phone-picker-h: 40px;
    max-height: calc(100dvh - 8px);
  }
  body:not(.split-view-active) .video-frame:not(:fullscreen) > .video-vilna-overlay {
    bottom: calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px) + var(--phone-picker-h, 40px));
  }
  body:not(.split-view-active) .video-frame > #playerTopbar {
    top: auto;
    bottom: calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px));
    height: var(--phone-picker-h);
    padding: 0 10px;
    background: #07111c;
    z-index: 8;
  }
  body:not(.split-view-active) .video-frame.youtube-active .youtube-player-host,
  body:not(.split-view-active) .video-frame.youtube-active .yt-shield,
  body:not(.split-view-active) .video-frame.youtube-active .yt-mask-layer {
    --chrome-h: calc(var(--pc-bar-h, 68px) + var(--pc-timeline-h, 74px) + var(--phone-picker-h, 40px));
    /* This slot is the contained picture, not the oversized crop. The
       chips have to use this box or they land on the wrong fraction. */
    --yt-iframe-w: min(100cqw, calc((100cqh - var(--chrome-h)) * 16 / 9));
    --yt-iframe-left: 0px;
    --yt-mask-left: 0px;
    --yt-origin: 0px;
    --yt-clip: var(--yt-iframe-w);
    top: 0;
    bottom: auto;
    left: 0;
    right: auto;
    margin-inline: auto;
    width: min(100cqw, calc((100cqh - var(--chrome-h)) * 16 / 9));
    height: min(calc(100cqh - var(--chrome-h)), calc(100cqw * 9 / 16));
    max-width: 100%;
    max-height: calc(100cqh - var(--chrome-h));
  }
  /* The picture fills the slot above the picker. Its own bottom edge is
     that slot's bottom edge, so the caption lines are not cropped and the
     iframe does not run under the controls. */
  body:not(.split-view-active) .video-frame.youtube-active .youtube-player-host,
  body:not(.split-view-active) .video-frame.youtube-active .yt-shield,
  body:not(.split-view-active) .video-frame.youtube-active .yt-mask-layer {
    top: auto;
    bottom: var(--chrome-h);
  }
}
body.split-view-active .watch-layout.split-active .video-frame #video,
body.split-view-active .watch-layout.split-active .video-frame #youtubePlayerHost {
  /* The pinch surface above is the ONE deliberate tap-to-play/pinch/pan
     handler for this picture in Split View, precisely because (per its own
     comment) it would otherwise "silently swallow" a tap meant for the
     video underneath it -- a design that assumes the video itself doesn't
     also need to see that tap. It was never actually cut off from
     receiving one, though: a real-device report showed every control-bar
     button (speed, settings, the mode pills) doing nothing at all when
     tapped. A YouTube shiur here is a cross-origin IFRAME occupying this
     exact box, full bleed under the opaque control bar included; on a real
     device its own compositor layer can receive a touch directly,
     independent of the DOM's own z-order/opacity, in a way no headless/
     synthetic-touch test reproduces -- confirmed directly earlier in this
     feature's history against the same symptom (a tap toggling play/pause
     instead of reaching the tapped button), and the fix carries the same
     way: cutting the iframe off from pointer input entirely forces every
     tap through the layers actually built to interpret it (the pinch
     surface, the topbar, the control bar). */
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body.split-view-active .watch-layout.split-active .video-frame #video,
  body.split-view-active .watch-layout.split-active .video-frame #youtubePlayerHost {
    transition: transform .12s ease-out;
  }
}
.split-video-zoom-indicator {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(8,17,28,.82);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.split-video-zoom-indicator.show { opacity: 1; }
/* Shown only while the picture is pinch-zoomed (see applySplitVideoTransform).
   Above the pinch surface (11) and the mask (5), below the topbar (13). */
.split-video-fit-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(8,17,28,.86);
  color: #fff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.split-video-fit-button[hidden] { display: none; }
/* The fixed mode bar covers the top of the video pane while it is up. */
body.split-view-active:not(.split-chrome-hidden) .split-video-fit-button {
  top: calc(max(10px, env(safe-area-inset-top, 0px)) + var(--viewer-mode-bar-h, 44px) + 6px);
}
/* Stacked with the video below, the bar sits over the daf instead. */
body.split-view-active.split-layout-stacked.split-video-at-end:not(.split-chrome-hidden) .split-video-fit-button { top: 8px; }
.split-video-fit-button svg { width: 16px; height: 16px; }
.split-video-fit-button:focus-visible { outline: 3px solid rgba(47, 110, 165, .6); outline-offset: 2px; }

/* --- Responsive defaults -------------------------------------------------
   Landscape (desktop, landscape tablet/phone) defaults to side-by-side via
   preferredSplitViewLayoutForViewport() in app.js; this only needs to keep
   the stacked minimums sane on small portrait screens -- a tall enough video
   band to stay useful, and the divider never eating unreasonable space. */
@media (max-width: 600px) {
  body.split-view-active .watch-layout.split-active:not(.split-stacked) { --split-divider-size: 14px; }
  body.split-view-active .watch-layout.split-active.split-stacked { --split-divider-size: 14px; }
  .split-toolbar { gap: 4px; }
  .split-toolbar .icon-button { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .viewer-mode-button,
  body.split-view-active .watch-layout.split-active .video-frame #video,
  body.split-view-active .watch-layout.split-active .video-frame #youtubePlayerHost,
  .split-video-zoom-indicator {
    transition: none;
  }
}


/* The Interactive Daf page keeps the daf picker on the page (see player-chrome.js);
   for a reader, who sees no admin fields, it is the strip's only field. */
body[data-page="browse"]:not(.is-admin) .setup-strip { grid-template-columns: 1fr; }

/* Helping readers find the daf's long-press / right-click menu
   (daf-context-menu.js). The ring grows under a finger held on a word until
   the menu opens; the hint is shown once per device. */
.daf-press-ring {
  position: fixed;
  z-index: 650;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-radius: 50%;
  background: rgba(47, 110, 165, .22);
  border: 2px solid rgba(47, 110, 165, .55);
  pointer-events: none;
  transform: scale(.25);
  opacity: .4;
}
.daf-press-ring.is-growing {
  transform: scale(1);
  opacity: 1;
  transition: transform var(--press-ms, 380ms) linear, opacity var(--press-ms, 380ms) linear;
}
.daf-menu-hint {
  position: fixed;
  z-index: 640;
  box-sizing: border-box;
  transform: translateY(-100%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border-radius: 12px;
  background: #132238;
  color: #fff;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(19, 34, 56, .3);
  /* Never in the way of the daf under it; only its close button takes taps. */
  pointer-events: none;
}
.daf-menu-hint span { flex: 1; }
.daf-menu-hint-close {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .daf-press-ring.is-growing { transition: none; }
}

/* --- Phone Split: the drop-down holds the viewing modes and the daf row ----
   The viewing-mode bar (with the Split tools) and the daf row (amud arrows,
   Auto-scroll, Select text) are two compact rows at the top of the divider's
   drop-down. The daf header and the zoom bar are not shown on a phone. */
@media (max-width: 760px),
       (pointer: coarse) and (orientation: landscape),
       (hover: none) and (orientation: landscape) {
  body.split-tools-phone .watch-layout.split-active > .daf-card > .daf-header,
  body.split-tools-phone .watch-layout.split-active > .daf-card > .card-heading,
  body.split-tools-phone .watch-layout.split-active .vilna-zoom-controls,
  body.split-tools-phone .split-chrome-wake {
    display: none !important;
  }
  body.is-admin.split-tools-phone.split-tools-open #splitToolsPanel .vilna-zoom-controls { display: flex !important; }
  #splitToolsPanel .split-tools-row {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px 3px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  #splitToolsPanel .split-tools-row::-webkit-scrollbar { display: none; }
  #splitToolsPanel .split-tools-daf { padding-top: 3px; padding-bottom: 6px; border-bottom: 1px solid rgba(19, 34, 56, .1); }
  /* One row on most phones; on a narrow one the Split tools wrap under the
     viewing modes rather than scroll sideways. */
  body.split-view-active #splitToolsPanel .viewer-mode-select {
    row-gap: 4px;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    transform: none;
    z-index: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    flex-wrap: wrap;
    justify-content: flex-start;
    column-gap: 4px;
    overflow: visible;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
  }
  body.split-view-active #splitToolsPanel .viewer-mode-select .viewer-mode-button {
    flex: 0 0 auto;
    min-height: 40px;
    min-width: 40px;
    padding: 3px 5px;
    gap: 1px;
    font-size: 10px;
    border-radius: 9px;
  }
  body.split-view-active #splitToolsPanel .viewer-mode-select .viewer-mode-button svg { width: 16px; height: 16px; }
  body.split-view-active #splitToolsPanel .viewer-mode-select .viewer-mode-button span:not(.sr-only) {
    max-width: 40px;
    white-space: normal;
    text-align: center;
    line-height: 1.05;
  }
  #splitToolsPanel .viewer-mode-bar-divider { align-self: stretch; width: 1px; margin: 4px 2px; background: rgba(19, 34, 56, .16); }
  #splitToolsPanel .split-toolbar { gap: 3px; margin-left: auto; }
  body.split-view-active #splitToolsPanel .split-toolbar .icon-button {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    border: 1px solid rgba(19, 34, 56, .16);
    background: #fff;
    color: #132238;
  }
  body.split-view-active #splitToolsPanel .split-toolbar .icon-button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
  body.split-view-active #splitToolsPanel .split-toolbar #splitExitButton {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background: #132238;
    border-color: #132238;
    color: #fff;
    box-shadow: none;
  }
  #splitToolsPanel .split-amud-step {
    flex: none;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0 0 3px;
    border: 1px solid rgba(19, 34, 56, .22);
    border-radius: 50%;
    background: #fff;
    color: #132238;
    font: inherit;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
  }
  #splitToolsPanel .split-amud-back {
    flex: none;
    height: 30px;
    padding: 0 10px;
    border: 0;
    border-radius: 999px;
    background: #132238;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }
  #splitToolsPanel .split-amud-back[hidden] { display: none; }
  #splitToolsPanel .split-live-button {
    position: relative;
    flex: none;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(19, 34, 56, .22);
    border-radius: 50%;
    background: #fff;
    color: #132238;
    cursor: pointer;
  }
  #splitToolsPanel .split-live-button[hidden] { display: none; }
  #splitToolsPanel .split-live-button svg { width: 17px; height: 17px; }
  #splitToolsPanel .split-live-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2e9d62;
    box-shadow: 0 0 0 2px #fff;
  }
  #splitToolsPanel .split-live-count {
    position: absolute;
    bottom: -4px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: #2f6ea5;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }
  #splitToolsPanel .split-live-count.is-new { background: #c2410c; }
  #splitToolsPanel .split-live-count[hidden] { display: none; }
  /* The drop-down has its own Live button; the floating one stays out of Split. */
  body.split-tools-phone .live-toggle { display: none; }
  #splitToolsPanel .split-tools-daf .header-auto-scroll { margin-left: 4px; flex: none; font-size: 12px; gap: 6px; }
  /* The Skip / Reviewing / Not synced notes end the daf row (two rows in
     all). The chip there reads "Skip to 2:29"; its full name stays its text. */
  body.split-tools-phone.split-tools-open #splitToolsDafRow > #readerDafNotes {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0;
    margin-left: 2px;
  }
  body.split-tools-phone.split-tools-open #splitToolsDafRow > #readerDafNotes:not(:has(> :not([hidden]))) { display: none; }
  body.split-tools-phone.split-tools-open #splitToolsDafRow .skip-to-daf-chip[data-short] {
    flex: none;
    font-size: 0;
    padding: 0 10px;
  }
  body.split-tools-phone.split-tools-open #splitToolsDafRow .skip-to-daf-chip[data-short]::after {
    content: "Skip to " attr(data-time);
    font-size: 12px;
  }
  /* A narrow phone (360px): a little tighter, still two rows. */
  @media (max-width: 400px) {
    #splitToolsPanel .split-tools-row { gap: 3px; padding-left: 6px; padding-right: 6px; }
    body.split-view-active #splitToolsPanel .viewer-mode-select { column-gap: 3px; }
    body.split-view-active #splitToolsPanel .viewer-mode-select .viewer-mode-button { padding: 3px 4px; }
    #splitToolsPanel .viewer-mode-bar-divider { margin: 4px 1px; }
    #splitToolsPanel .split-toolbar { gap: 2px; }
    body.split-view-active #splitToolsPanel .split-toolbar .icon-button { width: 30px; height: 30px; min-width: 30px; min-height: 30px; }
    body.split-view-active #splitToolsPanel .split-toolbar #splitExitButton { width: 34px; height: 34px; min-width: 34px; min-height: 34px; }
    #splitToolsPanel .split-amud-step { width: 30px; height: 30px; font-size: 20px; }
    #splitToolsPanel .split-tools-daf .header-auto-scroll { margin-left: 2px; font-size: 11px; gap: 4px; }
    body #splitToolsPanel .split-tools-daf .vilna-select-text-toggle { padding: 0 7px; font-size: 11px; }
    body.split-tools-phone.split-tools-open #splitToolsDafRow .skip-to-daf-chip[data-short] { padding: 0 8px; }
    body.split-tools-phone.split-tools-open #splitToolsDafRow .skip-to-daf-chip[data-short]::after { content: "Skip " attr(data-time); font-size: 11px; }
    body.split-tools-phone.split-tools-open #splitToolsPanel .split-tools-daf .header-auto-scroll { padding: 0 7px 0 5px; }
    #splitToolsPanel .split-tools-daf .header-auto-scroll .toggle { width: 26px; height: 15px; }
    #splitToolsPanel .split-tools-daf .header-auto-scroll .toggle::after { left: 2px; top: 2px; width: 11px; height: 11px; }
    #splitToolsPanel .split-tools-daf .header-auto-scroll input:checked + .toggle::after { transform: translateX(11px); }
    #splitToolsPanel .split-live-button { width: 30px; height: 30px; }
  }
  #splitToolsPanel .split-tools-daf .vilna-select-text-toggle {
    flex: none;
    width: auto;
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(19, 34, 56, .18);
    background: #fff;
    color: #132238;
    font-size: 12px;
    white-space: nowrap;
  }

  /* The divider says what it does: a handle with a chevron (and, until the
     drop-down has been opened once, the words "Daf tools") sits on the bar,
     bounces the first couple of times Split opens, and flips while open. */
  /* Only the handle is raised over the panes (it takes no taps); raising the
     whole bar would let its wide touch area cover the video's controls. */
  body.split-tools-phone .watch-layout.split-active .split-divider::after { content: none; }
  .split-divider-cue { display: none; }
  body.split-tools-phone .watch-layout.split-active .split-divider-cue {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    background: #132238;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(8, 17, 28, .3);
    pointer-events: none;
    z-index: 21;
  }
  .split-divider-cue svg { width: 12px; height: 12px; transition: transform .2s ease; }
  body.split-tools-open .split-divider-cue svg { transform: rotate(180deg); }
  .split-divider-cue-label[hidden] { display: none; }
  /* Side by side the bar is upright: the handle is a round button on it. */
  body.split-tools-phone .watch-layout.split-active:not(.split-stacked) .split-divider-cue { padding: 0; width: 24px; height: 24px; justify-content: center; }
  body.split-tools-phone .watch-layout.split-active:not(.split-stacked) .split-divider-cue-label { display: none; }
  body.split-tools-phone .watch-layout.split-active:not(.split-stacked) .split-divider-cue svg { transform: rotate(-90deg); }
  body.split-tools-phone.split-tools-open .watch-layout.split-active:not(.split-stacked) .split-divider-cue svg { transform: rotate(90deg); }
  .split-divider-cue.is-bouncing { animation: split-cue-bounce .7s ease-in-out 3; }
  @keyframes split-cue-bounce {
    0%, 100% { transform: translate(-50%, -50%); }
    50% { transform: translate(-50%, calc(-50% + 5px)); }
  }
  .split-divider-tip {
    position: fixed;
    z-index: 640;
    box-sizing: border-box;
    max-width: min(320px, calc(100vw - 24px));
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 9px 9px 13px;
    border-radius: 12px;
    background: #132238;
    color: #fff;
    font-size: 13px;
    line-height: 1.35;
    box-shadow: 0 8px 24px rgba(19, 34, 56, .3);
    pointer-events: none;
  }
  .split-divider-tip button {
    flex: none;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    pointer-events: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .split-divider-cue.is-bouncing { animation: none; }
}

/* The daf card's bottom rows are for admins: readers see neither the segment
   count nor a toolbar left with nothing in it for them (the Caption/Voice
   sync switch and Auto-scroll, where a page puts it there, still show). */
body:not(.is-admin) .daf-card .daf-footer { display: none; }
body:not(.is-admin) .daf-card .daf-toolbar:not(:has(> :not(.admin-only):not([hidden]))) { display: none; }

/* --- Computer Split: the divider's drop-down of daf tools ----------------
   Clicking the divider (not dragging it) opens a panel across the top of
   the daf side: the amud arrows, Auto-scroll, the Skip / Reviewing notes,
   and Live discussions. The viewing modes stay on the video and the zoom
   bar stays on the daf. A small round handle near the top of the divider
   says it is there. */
.split-divider-cue { display: none; }
body.split-tools-desk .watch-layout.split-active .split-divider-cue {
  position: absolute;
  top: 28px;
  left: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #132238;
  color: #fff;
  box-shadow: 0 2px 8px rgba(8, 17, 28, .3);
  cursor: pointer;
}
body.split-tools-desk .split-divider-cue-label { display: none; }
body.split-tools-desk .split-divider-cue svg { width: 13px; height: 13px; transition: transform .2s ease; }
body.split-tools-desk.split-tools-open .split-divider-cue svg { transform: rotate(180deg); }
body.split-tools-desk .split-divider:hover .split-divider-cue { background: var(--accent, #2f6ea5); }
body.split-tools-desk.split-tools-open #splitToolsPanel {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #f4f7fb;
  color: #132238;
  box-shadow: 0 14px 34px rgba(8, 17, 28, .22);
  border-bottom: 1px solid rgba(19, 34, 56, .14);
}
body.split-tools-desk #splitToolsPanel .player-topbar,
body.split-tools-desk #splitToolsPanel .split-tools-modes { display: none; }
body.split-tools-desk #splitToolsPanel .split-tools-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}
body.split-tools-desk #splitToolsPanel .split-amud-step,
body.split-tools-desk #splitToolsPanel .split-live-button {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid rgba(19, 34, 56, .22);
  border-radius: 50%;
  background: #fff;
  color: #132238;
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
body.split-tools-desk #splitToolsPanel .split-amud-step:hover,
body.split-tools-desk #splitToolsPanel .split-live-button:hover { border-color: var(--accent, #2f6ea5); }
body.split-tools-desk #splitToolsPanel .split-live-button { padding: 0; }
body.split-tools-desk #splitToolsPanel .split-live-button[hidden],
body.split-tools-desk #splitToolsPanel .split-amud-back[hidden] { display: none; }
body.split-tools-desk #splitToolsPanel .split-live-button svg { width: 18px; height: 18px; }
body.split-tools-desk #splitToolsPanel .split-live-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: #2e9d62; box-shadow: 0 0 0 2px #fff; }
body.split-tools-desk #splitToolsPanel .split-live-count { position: absolute; bottom: -4px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: #2f6ea5; color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
body.split-tools-desk #splitToolsPanel .split-live-count.is-new { background: #c2410c; }
body.split-tools-desk #splitToolsPanel .split-live-count[hidden] { display: none; }
body.split-tools-desk #splitToolsPanel .split-amud-back {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #132238;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
body.split-tools-desk #splitToolsPanel .header-auto-scroll {
  height: 32px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(19, 34, 56, .18);
  border-radius: 999px;
  background: #fff;
  color: #132238;
  font-size: 13px;
}
body.split-tools-desk #splitToolsPanel #readerDafNotes {
  height: auto;
  min-height: 0;
  max-height: none;
  padding: 0;
  overflow: visible;
}
body.split-tools-desk #splitToolsPanel #readerDafNotes:not(:has(> :not([hidden]))) { display: none; }

/* The daf zoom bar's extra controls: Fit page, set sizes, where the page
   sits across the pane, and back to the top. The bar stays one row and
   scrolls sideways when it doesn't fit; a phone keeps Fit page only. */
.vilna-zoom-size { flex: none; width: auto; min-width: 0; height: 26px; border-radius: 8px; border: 1px solid rgba(19, 34, 56,.25); background: rgba(255,255,255,.7); color: #132238; font-size: 12px; padding: 0 4px; cursor: pointer; }
.vilna-align-group { display: inline-flex; align-items: center; gap: 3px; padding-left: 6px; margin-left: 2px; border-left: 1px solid rgba(19, 34, 56,.16); }
.vilna-align-btn { display: grid; place-items: center; padding: 0; }
.vilna-align-btn svg { width: 15px; height: 15px; }
.vilna-align-btn[aria-pressed="true"], #vilnaFitPageButton[aria-pressed="true"] { background: var(--accent-soft, rgba(47, 110, 165, .16)); border-color: var(--accent, #2f6ea5); color: var(--accent, #2f6ea5); }
@media (max-width: 760px), (hover: none) {
  .vilna-zoom-size, .vilna-align-group { display: none; }
}
