/* Bavli Blat v2 — Calm, Minimal, Zero-Clutter Vilna Tzurat HaDaf & Study Panel */
:root {
  --bg: #f8f5ee;
  --surface: #f2eee5;
  --surface-card: #fcfaf5;
  --surface-white: #ffffff;
  --border: #e4ddd0;
  --border-strong: #cfc5b2;
  --ink: #1f1c18;
  --ink-soft: #544c42;
  --ink-muted: #7c7266;

  --burgundy: #822d2d;
  --burgundy-dark: #682121;
  --burgundy-soft: #f6e9e8;
  --ochre: #8a6620;
  --ochre-soft: #f7f1e3;
  --slate: #33597a;
  --slate-soft: #eaf0f6;
  --teal: #28665e;
  --teal-soft: #e9f3f1;
  --plum: #6b446e;
  --plum-soft: #f2ebf3;
  --green: #2f7754;
  --green-soft: #e9f4ee;

  --highlight-yellow: rgba(235, 200, 95, 0.36);
  --highlight-yellow-strong: rgba(235, 198, 80, 0.56);
  --highlight-comm: rgba(235, 200, 95, 0.24);
  --sage-underline: rgba(130, 45, 45, 0.36);

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Spectral", Georgia, serif;
  --font-gemara: "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --font-rashi: "Noto Rashi Hebrew", "Frank Ruhl Libre", serif;
  --blat-scale: 1;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 28, 24, 0.05);
  --shadow-md: 0 6px 22px rgba(31, 28, 24, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  color: inherit;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 1480px;
  margin: 0 auto;
}

/* ===== Top Chrome ===== */
.top-chrome {
  padding: 8px 10px 6px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(228, 221, 208, 0.65);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 6px 10px;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tractate-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: 7px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tractate-btn:hover {
  background: rgba(31, 28, 24, 0.05);
}

.hdr-he {
  font-family: var(--font-gemara);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
}

.hdr-caret {
  font-size: 11px;
  color: var(--ink-muted);
}

.amud-nav {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-card);
  font-size: 17px;
  line-height: 1;
  color: var(--ink-soft);
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--ink);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.study-open-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink-soft);
}

.study-open-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

.yomi-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(130, 45, 45, 0.25);
  background: var(--burgundy-soft);
  color: var(--burgundy);
  white-space: nowrap;
}

.yomi-chip:hover {
  background: #f0dbda;
}

.menu-wrap {
  position: relative;
}

.menu-btn {
  background: transparent;
  border: none;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

.menu-btn:hover {
  background: rgba(31, 28, 24, 0.06);
  color: var(--ink);
}

.menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 252px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 12px;
  z-index: 60;
}

.menu-section {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.menu-section:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.menu-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.seg-control {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.seg-control button {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 5px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.seg-control button.is-active {
  background: #fff;
  color: var(--burgundy);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.menu-switches {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.menu-check input {
  accent-color: var(--burgundy);
  width: 15px;
  height: 15px;
}

.font-size-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.font-size-val {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  min-width: 40px;
  text-align: center;
}

.mini-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  border-radius: 7px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.mini-btn:hover {
  background: #fff;
  color: var(--ink);
}

.btn-burgundy {
  background: var(--burgundy);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.btn-burgundy:hover {
  background: var(--burgundy-dark);
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-link-btn {
  background: transparent;
  border: none;
  text-align: left;
  padding: 3px 2px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--burgundy);
}

.menu-link-btn:hover {
  text-decoration: underline;
}

/* ===== Mobile-Only Calm 4-Pill Switcher (Zero Counts!) ===== */
.mobile-pill-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 2px 1px;
}

.lens-pill {
  flex: 1;
  text-align: center;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.lens-pill:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.lens-pill.is-active {
  background: var(--burgundy-soft);
  border-color: rgba(130, 45, 45, 0.42);
  color: var(--burgundy);
  font-weight: 600;
}

/* Hide mobile 4-pill switcher when split-screen sheet is open (sheet has its own 4 tabs) and on desktop */
.app-shell.panel-open .mobile-pill-bar {
  display: none;
}

@media (min-width: 960px) {
  .mobile-pill-bar {
    display: none;
  }
}

/* ===== Workspace: Pure Blat + Single Unified Study Panel ===== */
.workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.blat-pane {
  flex: 1;
  padding: 8px 10px 26px;
  min-width: 0;
}

.app-shell.panel-open {
  height: 100dvh;
  overflow: hidden;
}

.app-shell.panel-open .workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-shell.panel-open .blat-pane {
  flex: 0 0 38%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 10px 18px;
  border-bottom: 1.5px solid var(--border-strong);
  background: var(--bg);
}

.app-shell.panel-open .study-panel {
  flex: 1 1 62%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-white);
  box-shadow: 0 -4px 18px rgba(31, 28, 24, 0.07);
}

@media (min-width: 960px) {
  .top-chrome {
    padding: 10px 20px 8px;
  }

  .app-shell.panel-open .workspace {
    flex-direction: row;
    align-items: stretch;
  }

  .app-shell.panel-open .blat-pane {
    flex: 1 1 56%;
    height: auto;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 16px 26px 40px;
  }

  .app-shell.panel-open .study-panel {
    flex: 0 0 44%;
    max-width: 560px;
    box-shadow: none;
    background: var(--surface-card);
  }

  .blat-pane {
    padding: 16px 28px 44px;
  }
}

/* ===== Loading Spinner ===== */
.blat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  font-size: 13.5px;
  color: var(--ink-muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--burgundy);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Serene Vilna Tzurat HaDaf (Pure Blat) ===== */
.vilna-page {
  max-width: 760px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--ink);
  padding: 4px 2px 12px;
}

.vilna-page-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  padding: 2px 4px 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-gemara);
  color: var(--ink-soft);
}

.vilna-hdr-chapter {
  font-size: calc(11.5px * var(--blat-scale));
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vilna-hdr-tractate {
  font-size: calc(15px * var(--blat-scale));
  font-weight: 700;
  color: var(--ink);
  padding: 0 10px;
}

.vilna-hdr-daf {
  font-size: calc(13px * var(--blat-scale));
  font-weight: 700;
  text-align: left;
  color: var(--burgundy);
}

/* 3-Column Vilna Grid: fits 100% inside 390px with zero overflow */
.vilna-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.44fr) minmax(0, 0.78fr);
  gap: 9px;
  align-items: start;
}

@media (min-width: 720px) {
  .vilna-grid {
    gap: 16px;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.38fr) minmax(0, 0.82fr);
  }
}

.vilna-col-tag {
  font-family: var(--font-gemara);
  font-size: calc(9.5px * var(--blat-scale));
  font-weight: 700;
  color: var(--ink-muted);
  text-align: center;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  opacity: 0.8;
}

.vilna-side {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
  overflow-wrap: break-word;
  color: #2c2720;
}

.rashi-font {
  font-family: var(--font-rashi);
  font-size: calc(9.6px * var(--blat-scale));
  line-height: 1.44;
}

.block-font {
  font-family: var(--font-gemara);
  font-size: calc(9.8px * var(--blat-scale));
  line-height: 1.46;
}

.vilna-gemara {
  font-family: var(--font-gemara);
  font-size: calc(12.2px * var(--blat-scale));
  line-height: 1.58;
  text-align: justify;
  text-justify: inter-word;
  color: #161310;
  overflow-wrap: break-word;
}

@media (min-width: 720px) {
  .rashi-font {
    font-size: calc(12.6px * var(--blat-scale));
    line-height: 1.5;
  }
  .block-font {
    font-size: calc(12.8px * var(--blat-scale));
    line-height: 1.52;
  }
  .vilna-gemara {
    font-size: calc(16.2px * var(--blat-scale));
    line-height: 1.64;
  }
  .vilna-col-tag {
    font-size: calc(11px * var(--blat-scale));
  }
}

/* Serene Interactive Gemara Segments — warm yellow highlight ONLY on active passage */
.blat-seg {
  cursor: pointer;
  border-radius: 3px;
  padding: 0 1px;
  transition: background 0.14s ease;
}

.blat-seg:hover {
  background: rgba(235, 200, 95, 0.2);
}

.blat-seg.is-active {
  background: var(--highlight-yellow);
  box-shadow: 0 0 0 1px rgba(205, 165, 58, 0.3);
}

.blat-seg.is-mishnah-start {
  font-weight: 500;
}

/* Subtle Sage Reference */
.blat-sage-ref {
  border-bottom: 1px dotted var(--sage-underline);
  padding-bottom: 0.5px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.blat-sage-ref:hover,
.blat-sage-ref.is-sage-active {
  border-bottom: 1.5px solid var(--burgundy);
  background: rgba(130, 45, 45, 0.1);
  border-radius: 2px;
}

/* Interactive Rashi & Tosafot Entries */
.blat-comm-entry {
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.14s ease;
}

.blat-comm-entry:hover {
  background: rgba(235, 200, 95, 0.18);
}

.blat-comm-entry.is-linked {
  background: var(--highlight-comm);
}

.blat-comm-entry.is-selected {
  background: var(--highlight-yellow-strong);
  box-shadow: 0 0 0 1px rgba(130, 45, 45, 0.4);
}

.blat-dh {
  font-weight: 700;
  color: #161310;
}

.vilna-empty-col {
  display: block;
  text-align: center;
  color: var(--ink-muted);
  opacity: 0.4;
  padding-top: 8px;
}

/* Seamless Classic Vilna Bottom Continuation — ZERO border, ZERO box, exact same parchment surface */
.vilna-bottom {
  margin-top: 3px;
  padding-top: 0;
  border: none;
  background: transparent;
}

.vilna-bottom-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 9px;
  text-align: justify;
  text-justify: inter-word;
}

.vilna-bottom-full .vilna-bottom-span {
  text-align: justify;
  text-justify: inter-word;
  column-count: 2;
  column-gap: 10px;
}

@media (min-width: 720px) {
  .vilna-bottom-split {
    gap: 16px;
  }
  .vilna-bottom-full .vilna-bottom-span {
    column-count: 2;
    column-gap: 18px;
  }
}

/* ===== Linear Study View ===== */
.linear-page {
  max-width: 720px;
  margin: 0 auto;
}

.linear-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--ink-soft);
}

.linear-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linear-seg {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  cursor: pointer;
}

.linear-seg.is-active {
  background: #fdf8e7;
  border-color: rgba(205, 165, 58, 0.55);
}

.linear-seg-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.linear-seg-num {
  font-weight: 700;
  color: var(--burgundy);
}

.linear-seg-he {
  font-family: var(--font-gemara);
  font-size: calc(18px * var(--blat-scale));
  line-height: 1.6;
  margin-bottom: 6px;
}

.linear-seg-en {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ===== Quiet Blat Attribution Footer ===== */
.blat-footer {
  max-width: 760px;
  margin: 18px auto 0;
  padding-top: 10px;
  border-top: 1px solid rgba(228, 221, 208, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.blat-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}

.blat-footer a:hover {
  color: var(--burgundy);
  text-decoration: underline;
}

.footer-sep {
  opacity: 0.5;
}

/* ===== Single Unified Study Panel ===== */
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.panel-tab {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  transition: background 0.14s ease, color 0.14s ease;
}

.panel-tab:hover {
  color: var(--ink);
  background: rgba(31, 28, 24, 0.04);
}

.panel-tab.is-active {
  color: var(--burgundy);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.lang-mini-toggle {
  display: inline-flex;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
}

.lang-mini-toggle button {
  border: none;
  background: transparent;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}

.lang-mini-toggle button.is-active {
  background: var(--burgundy);
  color: #fff;
}

.panel-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  font-size: 19px;
  line-height: 1;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.panel-close-btn:hover {
  background: rgba(31, 28, 24, 0.07);
  color: var(--ink);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 28px;
}

.calm-empty {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted);
  margin: 8px 0;
}

.row-chevron,
.sugya-chevron {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.row-chevron.is-open,
.sugya-chevron.is-open {
  transform: rotate(90deg);
  color: var(--burgundy);
}

.inline-text-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--burgundy);
}

.inline-text-btn:hover {
  text-decoration: underline;
}

.sef-link {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--slate);
  text-decoration: none;
}

.sef-link:hover {
  text-decoration: underline;
}

.he-only-pill {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

.he-only-wrap {
  margin-bottom: 4px;
}

.custom-en-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #365745;
  background: rgba(54, 87, 69, 0.09);
  border: 1px solid rgba(54, 87, 69, 0.22);
  border-radius: 999px;
  padding: 1px 6.5px;
  line-height: 1.35;
  white-space: nowrap;
  flex-shrink: 0;
}

.comm-focus-ref-wrap,
.mef-entry-ref-wrap {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.rema-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 3px;
}

/* ===== TAB 1: CLEAN ZERO-REPETITION SUGYA MAP ===== */
.sugya-card {
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 10px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.sugya-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sugya-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.fs-map-trigger {
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.fs-map-trigger:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: var(--burgundy-soft);
}

.sugya-diagram-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.sugya-nodes-list {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.sugya-arrows-rail {
  width: 48px;
  flex-shrink: 0;
  position: relative;
}

.sugya-arrows-svg {
  display: block;
  overflow: visible;
}

.sugya-node-box {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-card);
  transition: border-color 0.14s ease, background 0.14s ease;
}

.sugya-node-box.is-active {
  border-color: rgba(196, 154, 48, 0.72);
  background: #fdf9ec;
}

.sugya-node-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 10px;
  cursor: pointer;
}

.sugya-num-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.sugya-node-box.is-active .sugya-num-badge {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}

.sugya-node-main {
  flex: 1;
  min-width: 0;
}

.sugya-node-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.node-role-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.node-role-tag.role-mishnah,
.node-role-tag.role-mishnahcont {
  background: var(--burgundy-soft);
  color: var(--burgundy);
}

.node-role-tag.role-question {
  background: var(--slate-soft);
  color: var(--slate);
}

.node-role-tag.role-challenge {
  background: #faeaea;
  color: #963232;
}

.node-role-tag.role-answer,
.node-role-tag.role-alternative {
  background: var(--green-soft);
  color: var(--green);
}

.node-role-tag.role-proof,
.node-role-tag.role-baraita,
.node-role-tag.role-baraitacase {
  background: var(--ochre-soft);
  color: var(--ochre);
}

.node-role-tag.role-conclusion {
  background: var(--plum-soft);
  color: var(--plum);
}

.node-sub-count {
  font-size: 10.5px;
  color: var(--ink-muted);
}

.sugya-node-title {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.38;
  color: var(--ink);
}

.sugya-node-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 3px;
}

.sugya-mef-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--surface);
  border-radius: 999px;
  padding: 1px 7px;
}

/* Expanded node detail — sleek, concise, ZERO inline Tosafot/Rashi dumps */
.sugya-node-detail {
  padding: 0 10px 10px 41px;
  border-top: 1px solid rgba(228, 221, 208, 0.6);
  margin-top: 2px;
  padding-top: 8px;
}

.node-en-excerpt {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.node-he-excerpt {
  font-family: var(--font-gemara);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  margin-bottom: 8px;
}

.substep-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 9px;
}

.substep-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.substep-row.is-active {
  border-color: rgba(196, 154, 48, 0.7);
  background: #fdf7e3;
  color: var(--ink);
}

.substep-letter {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.substep-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.substep-he {
  font-family: var(--font-gemara);
  font-size: 13.5px;
  color: var(--ink);
}

.node-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.node-seg-ref {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.node-mef-action {
  border: 1px solid rgba(130, 45, 45, 0.28);
  background: var(--burgundy-soft);
  color: var(--burgundy);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.14s ease;
}

.node-mef-action:hover {
  background: #f0dbda;
}

.sugya-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 9px;
  margin-top: 9px;
  border-top: 1px solid rgba(228, 221, 208, 0.6);
  font-size: 11px;
  color: var(--ink-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  width: 14px;
  height: 2px;
  border-radius: 2px;
}

/* Quick Review Collapsed Accordion inside Map Tab */
.review-accordion {
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  margin-top: 10px;
}

.review-accordion-head {
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.review-accordion-head:hover {
  background: var(--surface-card);
}

.review-accordion-left {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.review-accordion-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.review-accordion-meta {
  font-size: 12px;
  color: var(--ink-muted);
}

.review-qa-list {
  border-top: 1px solid var(--border);
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.review-qa-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-card);
  overflow: hidden;
}

.review-qa-q {
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
}

.review-qa-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.review-qa-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--burgundy);
}

.review-qa-a {
  padding: 0 10px 10px;
  border-top: 1px solid rgba(228, 221, 208, 0.7);
  padding-top: 8px;
}

.review-qa-a p {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ===== TAB 2: CALM ENGLISH-FIRST BACKGROUND ===== */
.bg-section {
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.bg-section-title {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.bg-context-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.bg-tractate-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.bg-chapter-pill {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  padding: 2px 9px;
  border-radius: 999px;
}

.bg-prose {
  margin: 0 0 6px;
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.58;
  color: var(--ink-soft);
}

.bg-prose-muted {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.bg-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.calm-chip {
  border: 1px solid var(--border);
  background: var(--surface-card);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.calm-chip:hover {
  border-color: var(--border-strong);
  background: #fff;
}

.calm-chip.is-active {
  border-color: rgba(130, 45, 45, 0.5);
  background: var(--burgundy-soft);
  color: var(--burgundy);
  font-weight: 600;
}

.chip-detail-card {
  margin-top: 10px;
  padding: 11px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.chip-detail-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.chip-detail-head strong {
  font-size: 14px;
  color: var(--ink);
}

.chip-detail-meta {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.chip-detail-he {
  font-family: var(--font-gemara);
  font-size: 14px;
  color: var(--ink-soft);
}

.chip-detail-body {
  margin: 0 0 8px;
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 1.52;
  color: var(--ink-soft);
}

.chip-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bg-steinsaltz-body {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
}

.bg-steinsaltz-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(228, 221, 208, 0.65);
}

.bg-steinsaltz-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.panel-quiet-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 14px;
  padding-top: 10px;
  font-size: 12px;
  color: var(--ink-muted);
}

.panel-quiet-footer a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
}

.panel-quiet-footer a:hover {
  color: var(--burgundy);
  text-decoration: underline;
}

/* ===== TAB 3: COMPACT 4-STAGE HALACHA STEPPER ===== */
.halacha-chain-card {
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.halacha-chain-card.is-collapsed {
  padding: 0;
}

.halacha-collapsed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  cursor: pointer;
}

.halacha-collapsed-row:hover {
  background: var(--surface-card);
  border-radius: 12px;
}

.halacha-collapsed-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.halacha-line-pill {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate);
  background: var(--slate-soft);
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}

.halacha-collapsed-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.halacha-chain-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 11px;
  margin-bottom: 11px;
  border-bottom: 1px solid var(--border);
}

.halacha-chain-head-left {
  min-width: 0;
}

.halacha-kicker {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 3px;
}

.halacha-chain-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.32;
  color: var(--ink);
}

.blat-jump-chip {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.blat-jump-chip:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: var(--burgundy-soft);
}

.halacha-stages {
  display: flex;
  flex-direction: column;
  gap: 11px;
  position: relative;
}

.halacha-stage {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.stage-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.stage-dot.stage-1 { background: var(--burgundy); }
.stage-dot.stage-2 { background: var(--ochre); }
.stage-dot.stage-3 { background: var(--teal); }
.stage-dot.stage-4 { background: var(--slate); }

.stage-box {
  flex: 1;
  min-width: 0;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
}

.stage-kicker {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 4px;
}

.stage-source-row,
.stage-ref-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.stage-source-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.stage-more-count {
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.stage-preview-en {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-preview-he {
  font-family: var(--font-gemara);
  font-size: 15px;
  line-height: 1.48;
  color: var(--ink);
}

.stage-he-only-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.stage-preview-he-inline {
  font-family: var(--font-gemara);
  font-size: 14px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.stage-toggle-row {
  margin-top: 6px;
}

.stage-expand-btn {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--burgundy);
}

.stage-expand-btn:hover {
  text-decoration: underline;
}

.stage-empty-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-muted);
}

.stage-expanded-entry {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(228, 221, 208, 0.7);
}

.stage-expanded-entry:last-of-type {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

/* Collapsed Nosei Keilim & Super-Commentary Rows */
.nk-wrap {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.nk-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.nk-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 5px;
  overflow: hidden;
}

.nk-row:last-child {
  margin-bottom: 0;
}

.nk-head {
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  min-width: 0;
}

.nk-head:hover {
  background: var(--surface-card);
}

.nk-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
  flex-shrink: 0;
}

.nk-preview {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nk-body {
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(228, 221, 208, 0.7);
  background: var(--surface-card);
}

/* ===== TAB 4: CALM COLLAPSED-BY-DEFAULT MEFORSHIM ===== */
.mef-sticky-head {
  margin-bottom: 10px;
}

.mef-scope-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.mef-scope-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.scope-toggle-chip {
  border: 1px solid var(--border);
  background: var(--surface-white);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.scope-toggle-chip:hover,
.scope-toggle-chip.is-active {
  border-color: rgba(130, 45, 45, 0.4);
  background: var(--burgundy-soft);
  color: var(--burgundy);
}

.mef-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mef-chip {
  border: 1px solid var(--border);
  background: var(--surface-white);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.mef-chip:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.mef-chip.is-active {
  border-color: var(--burgundy);
  background: var(--burgundy);
  color: #fff;
  font-weight: 600;
}

.mef-chip-n {
  opacity: 0.72;
  font-size: 10.5px;
  margin-left: 2px;
}

.mef-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mef-row-card {
  background: var(--surface-white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.14s ease;
}

.mef-row-card:hover {
  border-color: var(--border-strong);
}

.mef-row-card.is-open {
  border-color: rgba(130, 45, 45, 0.35);
}

.mef-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
}

.pin-btn {
  border: none;
  background: transparent;
  padding: 2px 3px;
  font-size: 15px;
  line-height: 1;
  color: var(--border-strong);
  flex-shrink: 0;
}

.pin-btn:hover,
.pin-btn.is-pinned {
  color: var(--ochre);
}

.mef-row-main {
  flex: 1;
  min-width: 0;
}

.mef-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.mef-group-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mef-cat-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.mef-count-quiet {
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.mef-row-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  min-width: 0;
}

.mef-preview-en {
  font-size: 12px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mef-preview-he {
  font-family: var(--font-gemara);
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mef-entries {
  border-top: 1px solid var(--border);
  background: var(--surface-card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mef-entry {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(228, 221, 208, 0.7);
}

.mef-entry:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.mef-entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

.mef-en-text {
  font-family: var(--font-serif);
  font-size: 14.5px;
  line-height: 1.56;
  color: var(--ink);
}

.mef-en-rich p {
  margin: 0 0 0.68em;
}

.mef-en-rich p:last-child {
  margin-bottom: 0;
}

.mef-en-rich em {
  font-style: italic;
}

.mef-he-text {
  font-family: var(--font-gemara);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  margin-top: 4px;
}

/* Focused Rashi / Tosafot Card */
.comm-focus-card {
  background: #fdf9ec;
  border: 1px solid rgba(205, 165, 58, 0.55);
  border-radius: 11px;
  padding: 11px 12px;
  margin-bottom: 12px;
}

.comm-focus-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--burgundy);
  margin-bottom: 6px;
}

.super-comm-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(205, 165, 58, 0.35);
}

.super-comm-note {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 7px;
}

/* ===== Full-Screen Interactive Sugya Map ===== */
.fs-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

.fs-map-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-strong);
}

.fs-map-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fs-back-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.fs-back-btn:hover {
  background: var(--burgundy-soft);
  color: var(--burgundy);
  border-color: var(--burgundy);
}

.fs-map-title-wrap {
  display: flex;
  flex-direction: column;
}

.fs-map-title-wrap strong {
  font-size: 15px;
  color: var(--ink);
}

.fs-map-title-wrap span {
  font-size: 11.5px;
  color: var(--ink-muted);
}

.fs-map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fs-cat-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fs-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fs-map-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (min-width: 900px) {
  .fs-map-main {
    flex-direction: row;
  }
}

.fs-map-canvas-wrap {
  flex: 1 1 58%;
  overflow: auto;
  padding: 16px;
  background: radial-gradient(circle at 1px 1px, rgba(130, 118, 100, 0.14) 1px, transparent 0);
  background-size: 20px 20px;
}

.fs-map-canvas {
  transform-origin: top left;
  max-width: 720px;
  margin: 0 auto;
  transition: transform 0.14s ease;
}

.fs-map-inspector {
  flex: 0 0 42%;
  max-height: 46%;
  overflow-y: auto;
  background: var(--surface-card);
  border-top: 1.5px solid var(--border-strong);
  padding: 14px;
}

@media (min-width: 900px) {
  .fs-map-inspector {
    max-height: none;
    max-width: 460px;
    border-top: none;
    border-left: 1px solid var(--border-strong);
  }
}

.fs-insp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.fs-insp-title {
  margin: 0 0 8px;
  font-size: 15.5px;
  line-height: 1.38;
  color: var(--ink);
}

/* ===== Modals (Picker + Tour) ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(31, 28, 24, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-card {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
}

.picker-quick-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.picker-jump-form {
  flex: 1;
  display: flex;
  gap: 6px;
  min-width: 170px;
}

.picker-jump-form input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
}

.picker-daf-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface-card);
  border-bottom: 1px solid var(--border);
}

.picker-daf-arrow {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 7px;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.picker-daf-arrow:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

.picker-daf-strip {
  flex: 1;
  min-width: 0;
  padding: 2px 4px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(120, 108, 95, 0.35) transparent;
}

.picker-daf-strip::-webkit-scrollbar {
  height: 4px;
}

.picker-daf-strip::-webkit-scrollbar-thumb {
  background: rgba(120, 108, 95, 0.35);
  border-radius: 99px;
}

.daf-num-btn {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 600;
}

.daf-num-btn.is-active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
}

.picker-sedarim {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 18px;
}

.seder-block {
  margin-bottom: 14px;
}

.seder-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.tractate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 6px;
}

.tractate-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  text-align: left;
}

.tractate-chip:hover {
  border-color: var(--burgundy);
  background: #fdf9f5;
}

.tractate-chip.is-active {
  border-color: var(--burgundy);
  background: var(--burgundy-soft);
}

.tc-en {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.tc-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.tour-card {
  max-width: 420px;
}

.tour-step-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--burgundy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tour-modal-title {
  margin: 14px 16px 6px;
  font-size: 17px;
  color: var(--ink);
}

.tour-modal-body {
  margin: 0 16px 16px;
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.tour-modal-foot {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

/* ===== Mobile 390px Polish: Zero Overflow & Clean Split-Screen ===== */
@media (max-width: 639px) {
  .header-bar {
    padding: 5px 8px;
    gap: 4px;
  }
  .tractate-btn {
    font-size: 15px;
    padding: 3px 4px;
    gap: 4px;
  }
  .hdr-he {
    display: none;
  }
  .yomi-chip {
    font-size: 11px;
    padding: 4px 8px;
  }
  .menu-btn {
    font-size: 13px;
    padding: 4px 5px;
  }
  .icon-btn {
    width: 26px;
    height: 26px;
    font-size: 15px;
  }
  .lens-pill {
    font-size: 11.5px;
    padding: 5px 6px;
  }
  .panel-header {
    padding: 6px 8px;
    gap: 4px;
  }
  .panel-tab {
    font-size: 11.5px;
    padding: 5px 7px;
  }
  .lang-mini-toggle button {
    font-size: 10px;
    padding: 2px 5px;
  }
  .panel-close-btn {
    width: 26px;
    height: 26px;
    font-size: 17px;
  }
  .panel-body {
    padding: 12px 12px 24px;
  }
  .sugya-node-detail {
    padding-left: 10px;
  }
}


/* ===== v3: Pinned Gemara/Mishnah Card, On-the-Blat Tier, Vilna Authority Sections & Hebrew-First Both Mode ===== */

/* Hebrew-First in Both Mode dividers & alignment across ALL bilingual blocks */
.mef-he-text {
  font-family: var(--font-gemara);
  font-size: 16.5px;
  line-height: 1.64;
  color: var(--ink);
  text-align: right;
  margin-top: 2px;
}

.mef-en-text {
  text-align: left;
}

.mef-he-text + .mef-en-text,
.mef-he-text + .he-only-wrap {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(130, 114, 92, 0.28);
}

.node-he-excerpt + .node-en-excerpt {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(130, 114, 92, 0.22);
}

.stage-preview-he + .stage-preview-en {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px dashed rgba(130, 114, 92, 0.22);
}

.substep-he + .substep-text {
  display: block;
  margin-top: 3px;
}

/* #1 Pinned Gemara / Mishnah Passage Card at Very Top of Meforshim Panel */
.gemara-top-card {
  background: #fffdf8;
  border: 1px solid rgba(130, 45, 45, 0.24);
  border-left: 3.5px solid var(--burgundy);
  border-radius: 11px;
  padding: 11px 13px 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(42, 32, 20, 0.04);
}

.gemara-top-card.is-compact {
  margin-top: 6px;
  margin-bottom: 8px;
  padding: 9px 11px 10px;
}

.gemara-top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.gemara-top-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--burgundy);
}

.gemara-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.gemara-he-toggle {
  border: 1px solid var(--border);
  background: var(--surface-card);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 2.5px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.gemara-he-toggle:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.gemara-top-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gemara-top-passage + .gemara-top-passage {
  padding-top: 8px;
  border-top: 1px solid rgba(228, 221, 208, 0.7);
}

.gemara-he-text {
  font-family: var(--font-gemara);
  font-size: 18px;
  line-height: 1.66;
  color: var(--ink);
  text-align: right;
}

.gemara-en-text {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 1.58;
  color: var(--ink);
  text-align: left;
}

.gemara-he-text + .gemara-en-text {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(130, 45, 45, 0.2);
}

/* Toggleable Linked Gemara Bar above Focused Rashi / Tosafot */
.focused-gemara-wrap {
  margin-bottom: 8px;
}

.focused-gemara-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-white);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.focused-gemara-toggle:hover {
  border-color: var(--border-strong);
}

.focused-gemara-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.focused-gemara-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}

/* #2 Dedicated "On the Blat" Tier (Rashi & Tosafot Buttons) */
.on-blat-tier {
  margin-bottom: 14px;
}

.on-blat-kicker-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.on-blat-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.on-blat-hint {
  font-size: 11px;
  color: var(--ink-muted);
}

.on-blat-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.on-blat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid rgba(130, 45, 45, 0.28);
  border-radius: 10px;
  background: var(--surface-white);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.on-blat-btn:hover:not(:disabled):not(.is-active) {
  border-color: var(--burgundy);
  background: #fdf9f3;
}

.on-blat-btn:disabled {
  opacity: 0.48;
  cursor: default;
  border-color: var(--border);
}

.on-blat-btn.is-active,
.on-blat-btn.is-active:hover {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #fff;
  box-shadow: 0 2px 6px rgba(130, 45, 45, 0.18);
}

.on-blat-btn.is-active .on-blat-btn-count,
.on-blat-btn.is-active .row-chevron {
  color: rgba(255, 255, 255, 0.85);
}

.on-blat-btn.is-active .custom-en-dot {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.on-blat-btn-main {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.on-blat-btn-name {
  font-weight: 700;
}

.on-blat-btn-count {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
}

.custom-en-dot {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 1px 5px;
  border-radius: 999px;
  background: #e7f3ee;
  color: #1f5c45;
  border: 1px solid rgba(31, 92, 69, 0.22);
}

.on-blat-drawer {
  margin-top: 8px;
  background: #fffdf8;
  border: 1px solid rgba(130, 45, 45, 0.24);
  border-radius: 11px;
  overflow: hidden;
}

.on-blat-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  background: #f8f2e7;
  border-bottom: 1px solid rgba(212, 198, 175, 0.7);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--burgundy);
}

.on-blat-entries {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.on-blat-entry {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(228, 221, 208, 0.75);
}

.on-blat-entry:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.on-blat-entry-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.on-blat-entry-title-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.on-blat-dh {
  font-family: var(--font-gemara);
  font-size: 15px;
  font-weight: 700;
  color: var(--burgundy);
}

.on-blat-ref {
  font-size: 11px;
  color: var(--ink-muted);
}

.on-blat-super-row {
  margin-top: 7px;
}

.on-blat-super-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  padding: 2px 0;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.on-blat-super-btn:hover {
  color: var(--burgundy);
}

/* #3 Five Separate Collapsible Vilna Shas Authority Sections */
.vilna-tiers-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.vilna-tier-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vilna-tier-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f7f3eb;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.vilna-tier-head:hover {
  border-color: var(--border-strong);
  background: #f2ede2;
}

.vilna-tier-back_of_gemara .vilna-tier-head {
  background: #f9f2ee;
  border-color: rgba(123, 40, 40, 0.22);
}

.vilna-tier-reference .vilna-tier-head {
  background: #f3f1ec;
  border-color: var(--border);
  color: var(--ink-soft);
}

.vilna-tier-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.vilna-tier-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vilna-tier-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.vilna-tier-reference .vilna-tier-title {
  color: var(--ink-soft);
}

.vilna-tier-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-muted);
}

.vilna-tier-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(205, 195, 178, 0.7);
  border-radius: 999px;
  padding: 1px 7px;
  flex-shrink: 0;
}

.mef-alias-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: #f5ebe6;
  color: var(--burgundy);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .gemara-top-card {
    padding: 10px 11px;
  }
  .gemara-he-text {
    font-size: 17px;
  }
  .gemara-en-text {
    font-size: 14px;
    line-height: 1.5;
  }
  .on-blat-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
}


/* ===== v4: Toggleable Shakla v'Tarya ("Logic Overlay") — Editorial Parchment-Safe Design ===== */

/* 1-Tap Logic Toggle Pill in Top Header */
.logic-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.logic-toggle-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: #fff;
}

.logic-toggle-glyph {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: -0.04em;
  opacity: 0.78;
}

.logic-toggle-btn.is-active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(130, 45, 45, 0.28);
}

.logic-toggle-btn.is-active:hover {
  background: var(--burgundy-dark);
  border-color: var(--burgundy-dark);
  color: #ffffff;
}

.logic-toggle-btn.is-active .logic-toggle-glyph {
  opacity: 0.95;
}

/* Slim 1-Line Logic Legend Bar tucked cleanly above the Blat */
.shakla-legend-bar {
  max-width: 760px;
  margin: 0 auto 8px;
  padding: 5px 10px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.shakla-legend-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.shakla-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  transition: background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.1s ease;
}

.shakla-chip-sym {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.shakla-chip-question {
  background: rgba(186, 134, 24, 0.13);
  border-color: rgba(164, 114, 16, 0.30);
  color: #744f0d;
}
.shakla-chip-question:hover,
.shakla-chip-question.is-selected {
  background: rgba(186, 134, 24, 0.24);
  border-color: #9e6e14;
}

.shakla-chip-answer {
  background: rgba(47, 119, 84, 0.11);
  border-color: rgba(47, 119, 84, 0.28);
  color: #215a3e;
}
.shakla-chip-answer:hover,
.shakla-chip-answer.is-selected {
  background: rgba(47, 119, 84, 0.22);
  border-color: #2f7754;
}

.shakla-chip-proof {
  background: rgba(51, 89, 122, 0.11);
  border-color: rgba(51, 89, 122, 0.28);
  color: #254764;
}
.shakla-chip-proof:hover,
.shakla-chip-proof.is-selected {
  background: rgba(51, 89, 122, 0.22);
  border-color: #33597a;
}

.shakla-chip-dispute {
  background: rgba(107, 68, 110, 0.11);
  border-color: rgba(107, 68, 110, 0.28);
  color: #553159;
}
.shakla-chip-dispute:hover,
.shakla-chip-dispute.is-selected {
  background: rgba(107, 68, 110, 0.22);
  border-color: #6b446e;
}

.shakla-legend-chip.is-selected {
  box-shadow: 0 0 0 1.5px currentColor;
}

.shakla-legend-clear {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 2.5px 9px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.shakla-legend-clear:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

/* Inline Logic Clause Overlays inside Gemara Column (Vilna & Linear) */
.shakla-clause {
  border-radius: 3px;
  padding: 0 2px 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.shakla-lead {
  white-space: nowrap;
}

.shakla-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.6em;
  font-weight: 700;
  line-height: 1;
  min-width: 1.35em;
  height: 1.35em;
  padding: 0 3px;
  margin-left: 3px;
  border-radius: 999px;
  vertical-align: 0.16em;
  user-select: none;
  letter-spacing: 0;
}

/* Question / Kashya — Warm Parchment Amber */
.shakla-question {
  background: rgba(186, 134, 24, 0.14);
  border-bottom: 1.5px solid rgba(164, 114, 16, 0.45);
}
.shakla-mark-question {
  background: rgba(186, 134, 24, 0.24);
  color: #744f0d;
  border: 1px solid rgba(164, 114, 16, 0.34);
}

/* Answer / Terutz — Calm Sage Green */
.shakla-answer {
  background: rgba(47, 119, 84, 0.12);
  border-bottom: 1.5px solid rgba(47, 119, 84, 0.42);
}
.shakla-mark-answer {
  background: rgba(47, 119, 84, 0.20);
  color: #1f573b;
  border: 1px solid rgba(47, 119, 84, 0.32);
}

/* Proof / Support (Rayah) — Soft Slate Blue */
.shakla-proof {
  background: rgba(51, 89, 122, 0.12);
  border-bottom: 1.5px solid rgba(51, 89, 122, 0.42);
}
.shakla-mark-proof {
  background: rgba(51, 89, 122, 0.20);
  color: #234663;
  border: 1px solid rgba(51, 89, 122, 0.32);
}

/* Dispute / Machloket — Soft Editorial Plum */
.shakla-dispute {
  background: rgba(107, 68, 110, 0.12);
  border-bottom: 1.5px solid rgba(107, 68, 110, 0.42);
}
.shakla-mark-dispute {
  background: rgba(107, 68, 110, 0.20);
  color: #542e57;
  border: 1px solid rgba(107, 68, 110, 0.32);
}

/* Mishnah Opening — Subtle Warm Gold Underline */
.shakla-mishnah {
  background: rgba(154, 112, 34, 0.07);
  border-bottom: 1.5px solid rgba(154, 112, 34, 0.34);
}
.shakla-mark-mishnah {
  font-family: var(--font-gemara);
  font-size: 0.66em;
  padding: 0 4px;
  background: rgba(154, 112, 34, 0.16);
  color: #744f0d;
  border: 1px solid rgba(154, 112, 34, 0.3);
}

/* Preserve clean selection visibility when Logic Overlay is ON without muddying clause tints */
.vilna-page.has-shakla .blat-seg.is-active {
  background: rgba(235, 200, 95, 0.12);
  box-shadow: inset 0 0 0 1px rgba(130, 45, 45, 0.26);
  border-radius: 4px;
}

/* Single-Role Spotlight Filter (dim non-matching overlays softly) */
[data-shakla-spotlight="question"] .shakla-clause:not(.shakla-question),
[data-shakla-spotlight="answer"] .shakla-clause:not(.shakla-answer),
[data-shakla-spotlight="proof"] .shakla-clause:not(.shakla-proof),
[data-shakla-spotlight="dispute"] .shakla-clause:not(.shakla-dispute) {
  background: transparent;
  border-bottom-color: transparent;
  opacity: 0.38;
}

[data-shakla-spotlight="question"] .shakla-clause:not(.shakla-question) .shakla-mark,
[data-shakla-spotlight="answer"] .shakla-clause:not(.shakla-answer) .shakla-mark,
[data-shakla-spotlight="proof"] .shakla-clause:not(.shakla-proof) .shakla-mark,
[data-shakla-spotlight="dispute"] .shakla-clause:not(.shakla-dispute) .shakla-mark {
  opacity: 0.3;
}

[data-shakla-spotlight="question"] .shakla-question {
  background: rgba(186, 134, 24, 0.24);
  border-bottom-color: #9e6e14;
}
[data-shakla-spotlight="answer"] .shakla-answer {
  background: rgba(47, 119, 84, 0.22);
  border-bottom-color: #2f7754;
}
[data-shakla-spotlight="proof"] .shakla-proof {
  background: rgba(51, 89, 122, 0.22);
  border-bottom-color: #33597a;
}
[data-shakla-spotlight="dispute"] .shakla-dispute {
  background: rgba(107, 68, 110, 0.22);
  border-bottom-color: #6b446e;
}

/* Role Badges in Pinned #1 Gemara Study Card & Linear Meta Row */
.gemara-top-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.shakla-card-badges,
.linear-shakla-pills {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.linear-seg-meta-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.shakla-card-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1.5px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

button.shakla-card-pill {
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

button.shakla-card-pill.is-selected {
  box-shadow: 0 0 0 1.5px currentColor;
}

.shakla-pill-question {
  background: rgba(186, 134, 24, 0.15);
  border-color: rgba(164, 114, 16, 0.32);
  color: #744f0d;
}
.shakla-pill-answer {
  background: rgba(47, 119, 84, 0.13);
  border-color: rgba(47, 119, 84, 0.30);
  color: #1f573b;
}
.shakla-pill-proof {
  background: rgba(51, 89, 122, 0.13);
  border-color: rgba(51, 89, 122, 0.30);
  color: #234663;
}
.shakla-pill-dispute {
  background: rgba(107, 68, 110, 0.13);
  border-color: rgba(107, 68, 110, 0.30);
  color: #542e57;
}
.shakla-pill-mishnah {
  background: rgba(154, 112, 34, 0.12);
  border-color: rgba(154, 112, 34, 0.30);
  color: #744f0d;
}

/* Mobile 390px Polish for Logic Toggle & Legend Bar */
@media (max-width: 639px) {
  .header-bar {
    padding: 5px 6px;
    gap: 4px;
  }
  .header-left {
    gap: 4px;
  }
  .header-right {
    gap: 4px;
  }
  .tractate-btn {
    font-size: 13.5px;
    padding: 3px 3px;
    gap: 3px;
  }
  .icon-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
  .logic-toggle-btn {
    font-size: 10.5px;
    padding: 3.5px 6.5px;
    gap: 3px;
  }
  .logic-toggle-glyph {
    font-size: 9.5px;
  }
  .yomi-chip {
    font-size: 10.5px;
    padding: 3.5px 6.5px;
  }
  .menu-btn {
    font-size: 12px;
    padding: 3.5px 4px;
  }
  .shakla-legend-bar {
    padding: 5px 8px;
    margin-bottom: 6px;
    gap: 6px;
  }
  .shakla-legend-chips {
    gap: 4px;
  }
  .shakla-legend-chip {
    font-size: 10.5px;
    padding: 2.5px 7px;
    gap: 3.5px;
  }
  .shakla-mark {
    font-size: 0.64em;
    min-width: 1.25em;
    height: 1.25em;
    padding: 0 2.5px;
    margin-left: 2px;
  }
}


/* ===== v5: Synced Human Shiur Player + Continuous Flow + Sugya Map Connector Clarity ===== */

/* 1-Tap Shiur Toggle Pill in Top Bar */
.shiur-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease;
}

.shiur-toggle-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: #fff;
}

.shiur-toggle-glyph {
  font-size: 9.5px;
  line-height: 1;
  opacity: 0.82;
}

.shiur-toggle-btn.is-active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(130, 45, 45, 0.28);
}

.shiur-toggle-btn.is-active:hover {
  background: var(--burgundy-dark);
  border-color: var(--burgundy-dark);
  color: #ffffff;
}

/* Direct Timestamp Play Pill on Pinned #1 Gemara / Mishnah Card */
.shiur-ts-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(130, 45, 45, 0.28);
  background: var(--burgundy-soft);
  color: var(--burgundy);
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.shiur-ts-pill:hover,
.shiur-ts-pill.is-active {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: #ffffff;
}

/* Continuous-Flow Top Strip inside Pinned #1 Gemara Card (← Map · Step N + ‹ Prev / Next ›) */
.gemara-flow-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(207, 197, 178, 0.55);
}

.gemara-map-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2.5px 9px;
  white-space: nowrap;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.gemara-map-back-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: #ffffff;
}

.gemara-line-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.line-step-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2.5px 7px;
  white-space: nowrap;
  transition: background 0.13s ease, border-color 0.13s ease, color 0.13s ease;
}

.line-step-btn:hover:not(:disabled) {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: #ffffff;
}

.line-step-btn:disabled {
  opacity: 0.38;
  cursor: default;
}

.line-step-pos {
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted);
  padding: 0 3px;
}

/* Subtle "Now Playing" Accent on Blat (without hijacking manual clicks) */
.blat-seg.is-shiur-playing {
  background: rgba(130, 45, 45, 0.08);
  box-shadow: inset 0 -2px 0 rgba(130, 45, 45, 0.55);
  border-radius: 3px;
}

.blat-seg.is-active.is-shiur-playing {
  background: var(--highlight-yellow-strong);
  box-shadow: inset 0 -2.5px 0 var(--burgundy);
}

.shiur-now-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 0.56em;
  line-height: 1;
  width: 1.45em;
  height: 1.45em;
  border-radius: 999px;
  background: var(--burgundy);
  color: #ffffff;
  vertical-align: 0.15em;
  margin-left: 3px;
  user-select: none;
}

.linear-seg.is-shiur-playing {
  border-left: 3px solid var(--burgundy);
}

.shiur-now-linear-pill {
  font-size: 10px;
  font-weight: 700;
  color: var(--burgundy);
  background: var(--burgundy-soft);
  border: 1px solid rgba(130, 45, 45, 0.25);
  border-radius: 999px;
  padding: 1px 6px;
}

/* Synced Human Shiur Dock (Docked cleanly at bottom of app-shell; NEVER covers Vilna blat text) */
.shiur-dock {
  flex-shrink: 0;
  background: var(--surface-card);
  border-top: 1.5px solid var(--border-strong);
  box-shadow: 0 -4px 18px rgba(31, 28, 24, 0.08);
  z-index: 28;
  padding: 10px 18px;
}

.shiur-dock-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
}

.shiur-video-wrap {
  flex: 0 0 220px;
  width: 220px;
  height: 124px;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1714;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.shiur-yt-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.shiur-meta-controls {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shiur-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.shiur-title-block {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.shiur-speaker-line {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.shiur-beat-line {
  font-size: 12px;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shiur-close-btn {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1;
}

.shiur-close-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
  background: #ffffff;
}

.shiur-transport-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.shiur-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--burgundy);
  background: var(--burgundy);
  color: #ffffff;
  white-space: nowrap;
}

.shiur-play-btn:hover {
  background: var(--burgundy-dark);
  border-color: var(--burgundy-dark);
}

.shiur-ctrl-btn {
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 4.5px 9px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--ink-soft);
  white-space: nowrap;
}

.shiur-ctrl-btn:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

.shiur-sync-btn {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4.5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-soft);
  white-space: nowrap;
  margin-left: 2px;
}

.shiur-sync-btn.is-active {
  background: var(--green-soft);
  border-color: rgba(31, 122, 76, 0.42);
  color: #1F7A4C;
}

.shiur-links-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.shiur-links-footer a {
  color: var(--slate);
  text-decoration: none;
  font-weight: 500;
}

.shiur-links-footer a:hover {
  color: var(--burgundy);
  text-decoration: underline;
}

.shiur-links-sep {
  opacity: 0.55;
}

/* Cross-Shas Fallback Bar (Berakhot 2a, Pesachim 3a, etc.) */
.shiur-fallback-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1120px;
  margin: 0 auto;
}

.shiur-fallback-copy {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.shiur-fallback-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--burgundy);
}

.shiur-fallback-note {
  font-size: 12px;
  color: var(--ink-soft);
}

.shiur-fallback-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.shiur-ext-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--slate);
  text-decoration: none;
  white-space: nowrap;
}

.shiur-ext-pill:hover {
  border-color: var(--burgundy);
  color: var(--burgundy);
}

/* ===== v5: Sugya Map Connector Clarity (Relation Pills + High-Contrast Rail Spotlight) ===== */

.sugya-card-top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sugya-rail-callout {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 230px;
}

.sugya-rail-callout[data-tone="challenge"] {
  background: rgba(200, 109, 20, 0.11);
  border-color: rgba(200, 109, 20, 0.36);
  color: #A8570B;
}

.sugya-rail-callout[data-tone="answer"] {
  background: rgba(31, 122, 76, 0.10);
  border-color: rgba(31, 122, 76, 0.36);
  color: #18643D;
}

.sugya-rail-callout[data-tone="proof"] {
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.34);
  color: #1D4ED8;
}

.sugya-rail-callout[data-tone="dispute"] {
  background: rgba(122, 70, 155, 0.11);
  border-color: rgba(122, 70, 155, 0.36);
  color: #663585;
}

/* Inline Clickable Relation Pills right on each Sugya Map step card */
.sugya-rel-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.sugya-rel-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.sugya-rel-pill:hover {
  transform: translateY(-0.5px);
  box-shadow: 0 1px 3px rgba(31, 28, 24, 0.12);
}

.sugya-rel-pill .rel-sym {
  font-weight: 800;
}

.sugya-rel-pill.rel-tone-challenge {
  color: #A8570B;
  background: rgba(200, 109, 20, 0.11);
  border-color: rgba(200, 109, 20, 0.34);
}
.sugya-rel-pill.rel-tone-challenge:hover {
  background: rgba(200, 109, 20, 0.2);
  border-color: #C86D14;
}

.sugya-rel-pill.rel-tone-answer {
  color: #18643D;
  background: rgba(31, 122, 76, 0.10);
  border-color: rgba(31, 122, 76, 0.34);
}
.sugya-rel-pill.rel-tone-answer:hover {
  background: rgba(31, 122, 76, 0.18);
  border-color: #1F7A4C;
}

.sugya-rel-pill.rel-tone-proof {
  color: #1D4ED8;
  background: rgba(37, 99, 235, 0.10);
  border-color: rgba(37, 99, 235, 0.32);
}
.sugya-rel-pill.rel-tone-proof:hover {
  background: rgba(37, 99, 235, 0.18);
  border-color: #2563EB;
}

.sugya-rel-pill.rel-tone-dispute {
  color: #663585;
  background: rgba(122, 70, 155, 0.11);
  border-color: rgba(122, 70, 155, 0.34);
}
.sugya-rel-pill.rel-tone-dispute:hover {
  background: rgba(122, 70, 155, 0.19);
  border-color: #7A469B;
}

.sugya-rel-pill.rel-tone-continues {
  color: #6B6258;
  background: rgba(107, 98, 88, 0.08);
  border-color: rgba(107, 98, 88, 0.24);
}
.sugya-rel-pill.rel-tone-continues:hover {
  background: rgba(107, 98, 88, 0.16);
  border-color: #6B6258;
}

/* Interactive High-Contrast Right Rail SVG Spotlight */
.sugya-arrows-rail {
  flex: 0 0 50px;
}

.sugya-edge-group {
  cursor: pointer;
  transition: opacity 0.16s ease;
  opacity: var(--edge-rest-opacity, 0.72);
}

.sugya-edge-group .sugya-edge-path {
  transition: stroke-width 0.16s ease;
}

.sugya-edge-group.is-dimmed {
  opacity: 0.14;
}

.sugya-edge-group.is-spotlight {
  opacity: 1;
}

.sugya-edge-group.is-spotlight .sugya-edge-path {
  stroke-width: 2.8px;
}

/* Connected partner step card subtle matching highlight border */
.sugya-node-box.is-rel-connected {
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.sugya-node-box.is-rel-connected.is-rel-tone-challenge {
  border-color: rgba(200, 109, 20, 0.58);
  box-shadow: 0 0 0 2px rgba(200, 109, 20, 0.12);
}
.sugya-node-box.is-rel-connected.is-rel-tone-answer {
  border-color: rgba(31, 122, 76, 0.55);
  box-shadow: 0 0 0 2px rgba(31, 122, 76, 0.12);
}
.sugya-node-box.is-rel-connected.is-rel-tone-proof {
  border-color: rgba(37, 99, 235, 0.52);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.11);
}
.sugya-node-box.is-rel-connected.is-rel-tone-dispute {
  border-color: rgba(122, 70, 155, 0.55);
  box-shadow: 0 0 0 2px rgba(122, 70, 155, 0.12);
}

/* Unmistakable gentle pulse when jumping to a linked Step N */
@keyframes sugyaJumpPulse {
  0% { box-shadow: 0 0 0 0 rgba(130, 45, 45, 0.42); }
  45% { box-shadow: 0 0 0 5px rgba(130, 45, 45, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(130, 45, 45, 0); }
}

.sugya-node-box.is-jump-pulse {
  animation: sugyaJumpPulse 1.05s ease-out;
}

/* Updated Sugya Legend Swatches (Solid / Dashed / Dotted) */
.sugya-legend .legend-line {
  width: 18px;
  height: 0;
  background: transparent !important;
  border-top-width: 2.2px;
  border-top-style: solid;
}
.sugya-legend .legend-line.is-dashed {
  border-top-style: dashed;
}
.sugya-legend .legend-line.is-dotted {
  border-top-style: dotted;
}

/* ===== Mobile 390px Single-Row Header & Responsive Shiur Dock Polish ===== */
@media (max-width: 560px) {
  /* Keep Pesachim 2a ▾, ‹ ›, ?✓ Logic, ▶ Shiur, and Menu ▾ cleanly unclipped on ONE neat row!
     (Today's Daf Yomi remains 1 tap away inside Menu ▾ and the Tractate Picker.) */
  .yomi-chip {
    display: none;
  }
  .header-bar {
    padding: 5px 6px;
    gap: 4px;
  }
  .header-left {
    gap: 3px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .header-right {
    gap: 4px;
    flex-shrink: 0;
  }
  .tractate-btn {
    font-size: 13.5px;
    padding: 3px 3px;
    gap: 3px;
    max-width: 100%;
  }
  .icon-btn {
    width: 23px;
    height: 23px;
    font-size: 14px;
  }
  .logic-toggle-btn,
  .shiur-toggle-btn {
    font-size: 11px;
    padding: 3.5px 7px;
    gap: 3px;
  }
  .logic-toggle-glyph {
    font-size: 10px;
  }
  .shiur-toggle-glyph {
    font-size: 9px;
  }
  .menu-btn {
    font-size: 12px;
    padding: 3.5px 5px;
  }
}

@media (max-width: 720px) {
  .shiur-dock {
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .shiur-dock-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  /* Keep official YouTube player >= 200x112 (ToS compliant) cleanly centered/framed on mobile */
  .shiur-video-wrap {
    flex: 0 0 auto;
    width: 214px;
    height: 120px;
    margin: 0 auto;
  }
  .shiur-speaker-line {
    font-size: 12px;
  }
  .shiur-beat-line {
    font-size: 11px;
  }
  .shiur-transport-row {
    gap: 5px;
  }
  .shiur-play-btn {
    font-size: 11.5px;
    padding: 4px 10px;
  }
  .shiur-ctrl-btn,
  .shiur-sync-btn {
    font-size: 11px;
    padding: 4px 7.5px;
  }
  .shiur-links-footer {
    font-size: 11px;
  }
  .app-shell.panel-open.shiur-open .blat-pane {
    flex: 0 0 32%;
  }
  .app-shell.panel-open.shiur-open .study-panel {
    flex: 1 1 36%;
    min-height: 140px;
  }
  .gemara-flow-strip {
    gap: 6px;
  }
  .gemara-map-back-btn {
    font-size: 11px;
    padding: 2px 7.5px;
  }
  .line-step-btn {
    font-size: 10.5px;
    padding: 2px 6px;
  }
  .sugya-rail-callout {
    max-width: 155px;
    font-size: 10px;
  }
}

/* Ensure Shiur Dock stays immediately visible at bottom of viewport even when Study Panel is closed */
.app-shell.shiur-open {
  height: 100dvh;
  overflow: hidden;
}

.app-shell.shiur-open .workspace {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.app-shell.shiur-open:not(.panel-open) .blat-pane {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
