:root {
  --bg: #f3ede1;
  --panel: rgba(255, 250, 242, 0.9);
  --panel-strong: #fbf7ef;
  --text: #29261f;
  --muted: #6b6457;
  --border: #d8cebc;
  --accent: #6b4f1d;
  --accent-soft: rgba(107, 79, 29, 0.12);
  --reader-max-width: 1180px;
  --reader-font-size: 20px;
  --scholia-pane-width: 320px;
  --shadow: 0 8px 24px rgba(20, 20, 20, 0.08);
  --left-drawer-width: 360px;
  --right-drawer-width: 360px;
  --font-ui: "Aptos", "Segoe UI", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-reader-text: "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
}

body[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-strong: #ffffff;
  --text: #1d2430;
  --muted: #556173;
  --border: #dbe3ee;
  --accent: #1d5fd0;
  --accent-soft: rgba(29, 95, 208, 0.1);
}

body[data-theme="dark"] {
  --bg: #14161a;
  --panel: rgba(32, 35, 40, 0.92);
  --panel-strong: #1c2026;
  --text: #edf2fa;
  --muted: #a8b2c2;
  --border: #2f3742;
  --accent: #7db0ff;
  --accent-soft: rgba(125, 176, 255, 0.14);
  --shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(255,255,255,0.35), transparent 28%),
    linear-gradient(180deg, rgba(255, 249, 240, 0.32), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-reader-text);
}
button, input, select, summary, textarea { font: inherit; font-family: var(--font-ui); }
button, select, input {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 0.68rem 0.82rem;
}
textarea {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 0.68rem 0.82rem;
}
button {
  cursor: pointer;
  transition: transform 0.08s ease, background 0.18s ease, border-color 0.18s ease;
}
button:hover { background: var(--accent-soft); }
button:active { transform: translateY(1px); }
button:disabled {
  cursor: wait;
  opacity: 0.72;
}
.button-like {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 12px;
  padding: 0.68rem 0.82rem;
  font: inherit;
  font-family: var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.button-like:hover { background: var(--accent-soft); }
.button-like:active { transform: translateY(1px); }
.button-like.is-disabled,
.button-like[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}
.subscribe-cta {
  background: var(--accent);
  color: var(--panel-strong);
  border-color: var(--accent);
}
.subscribe-cta:hover {
  background: var(--accent);
  opacity: 0.92;
}
label {
  display: grid;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.92rem;
}
h1, h2, h3, p, menu { margin: 0; }
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
}
a { color: inherit; }

.app-shell { padding: 0.9rem; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  margin: 0 auto 0.85rem;
  max-width: 1840px;
}
.brand-block { display: grid; gap: 0.12rem; }
.topbar h1 { font-size: 1.2rem; line-height: 1.1; }
.topbar-subtitle { color: var(--muted); font-size: 0.92rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}
.topbar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: flex-end;
}
.topbar-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.compact-controls label { min-width: 140px; }
.compact-controls select { min-width: 110px; }
.settings-menu {
  position: relative;
}
.settings-menu > summary {
  list-style: none;
}
.settings-menu > summary::-webkit-details-marker {
  display: none;
}
.settings-panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 40;
  min-width: 290px;
  display: grid;
  gap: 0.8rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}
.settings-menu:not([open]) .settings-panel {
  display: none;
}
.settings-auth {
  display: grid;
  gap: 0.55rem;
}
.ghost-button {
  background: transparent;
  border-style: dashed;
}
.icon-button {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 0;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, var(--left-drawer-width)) minmax(0, 1fr) minmax(0, var(--right-drawer-width));
  gap: 1rem;
  max-width: 1840px;
  margin: 0 auto;
  align-items: start;
}
.layout.left-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) minmax(0, var(--right-drawer-width));
}
.layout.right-collapsed {
  grid-template-columns: minmax(0, var(--left-drawer-width)) minmax(0, 1fr) 0;
}
.layout.left-collapsed.right-collapsed {
  grid-template-columns: 0 minmax(0, 1fr) 0;
}
.sidebar, .reader-area { min-width: 0; }
.sidebar {
  display: grid;
  gap: 1rem;
  align-content: start;
  position: sticky;
  top: 0.9rem;
  max-height: calc(100vh - 1.8rem);
  overflow: auto;
  padding-right: 0.1rem;
}
.left-panel.hidden-drawer,
.right-panel.hidden-drawer {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}
.reader-area { display: grid; gap: 1rem; }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
  padding: 0.2rem 0.2rem 0;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0.08)), var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 0.95rem;
  backdrop-filter: blur(8px);
}
.compact-card { padding: 0.85rem 0.95rem; }
.panel-card, .drawer-card { display: grid; gap: 0.75rem; }
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}
.panel-header h2 { font-size: 1.04rem; }
.panel-meta { font-size: 0.8rem; }
.stack { display: grid; }
.gap-sm { gap: 0.6rem; }
.results-list { display: grid; gap: 0.5rem; }
.scroll-results {
  max-height: 340px;
  overflow: auto;
  padding-right: 0.2rem;
}
.tall-scroll-results { max-height: 520px; }
.coverage-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}
.result-item, .search-hit, .author-card {
  width: 100%;
  text-align: left;
  background: var(--panel-strong);
}
.result-item .title, .search-hit .title, .author-title { display: block; font-weight: 600; }
.result-item .meta, .search-hit .meta, .muted { color: var(--muted); }
.author-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.8rem;
  display: grid;
  gap: 0.6rem;
}
.author-works {
  display: grid;
  gap: 0.45rem;
  max-height: 200px;
  overflow: auto;
}
.group-block {
  display: grid;
  gap: 0.55rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
}
.group-title { font-weight: 700; }
.inline-chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.search-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  align-items: end;
}
.search-query-field { grid-column: 1 / 2; }
.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  max-width: 100%;
}
.help-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.help-tooltip-trigger {
  width: 1.45rem;
  height: 1.45rem;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.4);
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.help-tooltip-panel {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.45rem);
  transform: translate(-50%, 0.2rem);
  width: max-content;
  max-width: 280px;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  line-height: 1.35;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}
.help-tooltip:hover .help-tooltip-panel,
.help-tooltip:focus-within .help-tooltip-panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.search-workspace-main { gap: 0.9rem; }
.search-workspace-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.search-mode-pill {
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.58rem 0.9rem;
}
.search-mode-pill.is-active {
  background: var(--accent-soft);
  border-color: rgba(107, 79, 29, 0.28);
  color: var(--accent);
}
.workspace-mode-summary {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
}
.workspace-mode-summary-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.72rem;
  color: var(--muted);
}
.workspace-mode-summary-text {
  font-size: 0.96rem;
}
.workspace-section {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}
.workspace-collapsible-section {
  padding-top: 0.35rem;
}
.workspace-section-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.workspace-section-summary::-webkit-details-marker {
  display: none;
}
.workspace-section-summary-title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  font-size: 0.98rem;
}
.workspace-collapsible-section .workspace-section-summary::after {
  content: '\25B8';
  color: var(--muted);
  font-size: 0.82rem;
  transition: transform 0.14s ease;
}
.workspace-collapsible-section[open] .workspace-section-summary::after {
  transform: rotate(90deg);
}
.workspace-section-body {
  display: grid;
  gap: 0.7rem;
}
.workspace-section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}
.workspace-section-header h3 {
  margin: 0;
  font-size: 0.98rem;
}
.span-2 { grid-column: span 2; }
.search-direct-matches {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.direct-match-section {
  display: grid;
  gap: 0.55rem;
}
.direct-match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
}
.direct-match-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
}
.direct-match-type {
  font-size: 0.74rem;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.checkbox-label input[type="checkbox"] {
  margin: 0;
}
.multi-select {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
}
.multi-select > summary {
  list-style: none;
  padding: 0.7rem 0.82rem;
  cursor: pointer;
  color: var(--text);
}
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select[open] > summary {
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}
.multi-select-menu {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem 0.82rem;
  max-height: 230px;
  overflow: auto;
}
.multi-option {
  display: flex;
  gap: 0.55rem;
  align-items: start;
  font-size: 0.9rem;
  color: var(--text);
}
.multi-option input { margin-top: 0.15rem; }

.reader-toolbar {
  display: grid;
  gap: 0.85rem;
  position: relative;
  z-index: 20;
  overflow: visible;
}
.reader-toolbar-main {
  display: flex;
  align-items: end;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.toolbar-citation-field {
  flex: 1 1 320px;
  min-width: min(100%, 360px);
}
.toolbar-citation-field input {
  width: 100%;
}
.toolbar-omnibox-field {
  position: relative;
  flex: 1 1 420px;
  min-width: min(100%, 420px);
}
.toolbar-omnibox-field label {
  display: inline-flex;
  gap: 0.18rem;
  margin-bottom: 0.18rem;
}
.omnibox-control-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.omnibox-meta-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.65rem;
  margin-top: 0.18rem;
}
.toolbar-omnibox-field input {
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}
.omnibox-submit-button {
  flex: 0 0 auto;
  min-width: 5.5rem;
  white-space: nowrap;
}
.omnibox-status {
  min-height: 1rem;
  margin-top: 0;
  text-align: right;
}
.omnibox-results {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  right: 0;
  z-index: 280;
  display: grid;
  gap: 0.4rem;
  max-height: 340px;
  overflow: auto;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}
.omnibox-group {
  display: grid;
  gap: 0.35rem;
}
.omnibox-group-title {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 0.1rem 0.2rem;
}
.omnibox-item.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(107, 79, 29, 0.18);
}
.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) auto;
  gap: 0.75rem;
  align-items: start;
}
.toolbar-grid-action {
  display: grid;
  align-content: start;
  gap: 0.28rem;
}
.toolbar-grid-action-label {
  color: var(--muted);
  font-size: 0.92rem;
}
.toolbar-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar-export-menu {
  position: relative;
}
.toolbar-export-menu > summary {
  list-style: none;
}
.toolbar-export-menu > summary::-webkit-details-marker {
  display: none;
}
.toolbar-export-items {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 200;
  min-width: 10.75rem;
  display: grid;
  gap: 0.38rem;
  padding: 0.48rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}
.toolbar-export-menu:not([open]) .toolbar-export-items {
  display: none;
}
.toolbar-export-items button {
  width: 100%;
  text-align: left;
}
.reader-stage { display: grid; gap: 1rem; min-height: 70vh; }
.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}
.reader-title { font-size: 1.45rem; font-weight: 700; }
.reader-pg-warning {
  min-height: 0;
}
.reader-pg-warning:empty {
  display: none;
}
.status-cluster { display: flex; align-items: center; gap: 0.7rem; }
.status-badge {
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.45rem 0.8rem;
  font-size: 0.86rem;
  white-space: nowrap;
}
.thinking-indicator {
  display: inline-flex;
  gap: 0.28rem;
  align-items: center;
}
.thinking-indicator span {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 999px;
  background: var(--accent);
  opacity: 0.35;
  animation: thinking-bounce 1s infinite ease-in-out;
}
.thinking-indicator span:nth-child(2) { animation-delay: 0.12s; }
.thinking-indicator span:nth-child(3) { animation-delay: 0.24s; }
@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.32; }
  40% { transform: translateY(-4px); opacity: 1; }
}
.reader-content {
  width: 100%;
  max-width: none;
}
.small-link {
  font-size: 0.84rem;
}
.reader-debug-link {
  justify-self: end;
}

.pg-debug-shell {
  display: grid;
  gap: 1rem;
}
.pg-debug-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 1rem;
}
.pg-debug-sidebar,
.pg-debug-main {
  display: grid;
  gap: 1rem;
  align-content: start;
}
.pg-debug-filters {
  display: grid;
  gap: 0.75rem;
}
.pg-debug-work-list {
  max-height: 70vh;
  overflow: auto;
}
.pg-work-button {
  display: grid;
  gap: 0.35rem;
}
.pg-work-button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.quality-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  color: var(--muted);
}
.quality-chip.green {
  background: rgba(65, 160, 90, 0.14);
  color: #3a8a52;
}
.quality-chip.orange {
  background: rgba(214, 141, 31, 0.14);
  color: #ad6d10;
}
.quality-chip.red {
  background: rgba(184, 67, 67, 0.16);
  color: #b44343;
}
.warning-banner {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  background: rgba(214, 141, 31, 0.12);
}
.warning-banner.red {
  background: rgba(184, 67, 67, 0.14);
}
.key-value-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.key-value-grid .label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.artifact-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.artifact-tab.active {
  border-color: var(--accent);
  color: var(--accent);
}
.artifact-viewer {
  min-height: 420px;
}
.artifact-viewer pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.5;
}
.reader-jump-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
}
.reader-jump-row label {
  min-width: 180px;
}

@media (max-width: 1100px) {
  .pg-debug-grid {
    grid-template-columns: 1fr;
  }
  .pg-debug-work-list {
    max-height: 320px;
  }
}
.reader-content.parallel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.reader-content.single { display: block; }
.reader-column {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  min-height: 300px;
}
.reader-column h3 {
  margin-bottom: 0.75rem;
  font-size: 0.98rem;
  color: var(--muted);
}
.cite-break {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(127,127,127,0.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.cite-label {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}
.segment {
  display: grid;
  grid-template-columns: 2.4rem 1fr;
  gap: 0.7rem;
  align-items: start;
  padding: 0.35rem 0;
  font-size: var(--reader-font-size);
  line-height: 1.75;
  font-family: var(--font-reader-text);
}
.segment-number {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
  padding-top: 0.2rem;
}
.segment-text {
  white-space: pre-wrap;
  font-family: var(--font-reader-text);
}
.word-token {
  display: inline;
  border-radius: 8px;
  padding: 0.04rem 0.12rem;
  margin: 0 -0.04rem;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: var(--font-reader-text);
}
.word-token:hover,
.word-token.active-token {
  background: var(--accent-soft);
}
.word-token.highlight-preview {
  box-shadow: inset 0 -0.24rem 0 rgba(251, 191, 36, 0.45);
}
.word-token.highlight-amber {
  box-shadow: inset 0 -0.3rem 0 rgba(245, 158, 11, 0.45);
}
.word-token.highlight-mint {
  box-shadow: inset 0 -0.3rem 0 rgba(16, 185, 129, 0.4);
}
.word-token.highlight-sky {
  box-shadow: inset 0 -0.3rem 0 rgba(14, 165, 233, 0.4);
}
.word-token.highlight-rose {
  box-shadow: inset 0 -0.3rem 0 rgba(244, 63, 94, 0.35);
}
.notice {
  padding: 1rem;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--muted);
}
.loading-notice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.loading-notice .thinking-indicator {
  flex: 0 0 auto;
}
.empty-state { padding: 2rem 1rem; text-align: center; color: var(--muted); }

.drawer-section-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text);
  font-weight: 700;
}
.drawer-section-body {
  display: grid;
  gap: 0.8rem;
}
.drawer-section-body[hidden] { display: none; }
.drawer-section-toggle {
  padding: 0.15rem 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.01em;
}
.drawer-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
}
.drawer-card-title {
  font-size: 1.15rem;
  line-height: 1.15;
}
.drawer-work-byline {
  font-size: 0.95rem;
}
.current-work-card,
.structure-drawer-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.08)),
    linear-gradient(135deg, rgba(107, 79, 29, 0.08), transparent 45%),
    var(--panel);
}
.work-facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.work-fact {
  display: grid;
  gap: 0.2rem;
  padding: 0.68rem 0.75rem;
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.18);
}
.work-fact-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.work-fact-value {
  font-size: 0.95rem;
  line-height: 1.35;
}
.secondary-drawer-card {
  gap: 0.55rem;
}
.compact-search-panel {
  gap: 0.65rem;
}
.search-filters {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
}
.search-filters > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.7rem 0.82rem;
  color: var(--muted);
}
.search-filters > summary::-webkit-details-marker {
  display: none;
}
.search-filters[open] > summary {
  border-bottom: 1px solid var(--border);
}
.search-filters > :not(summary) {
  padding: 0.75rem 0.82rem 0.82rem;
}
.compact-results {
  max-height: 260px;
}
.structure-range-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  background: rgba(107, 79, 29, 0.14);
  color: var(--accent);
  font-size: 0.82rem;
  font-family: var(--font-ui);
}
.structure-branch-summary {
  display: grid;
}
.structure-summary-card {
  display: grid;
  gap: 0.45rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 18px;
  background: rgba(255,255,255,0.18);
}
.structure-summary-kicker {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.structure-summary-title {
  font-family: var(--font-display);
  font-size: 1.16rem;
}
.structure-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.structure-summary-span {
  color: var(--muted);
  font-size: 0.9rem;
}
.structure-subsection {
  display: grid;
  gap: 0.7rem;
}
.structure-subsection-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: end;
}
.structure-subsection-header h3 {
  font-size: 1.02rem;
}
.structure-node-list {
  display: grid;
  gap: 0.55rem;
}
.structure-node-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.75rem 0.8rem;
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.14);
}
.structure-node-card.is-open {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(107, 79, 29, 0.18);
}
.structure-node-card.is-focused {
  background: rgba(107, 79, 29, 0.11);
}
.structure-node-card.is-boundary {
  border-style: dashed;
}
.structure-node-copy {
  display: grid;
  gap: 0.35rem;
}
.structure-node-link {
  justify-self: start;
  padding: 0;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 1.04rem;
  color: var(--text);
}
.structure-node-link:hover {
  background: transparent;
  color: var(--accent);
}
.structure-node-incipit {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.structure-node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.structure-meta-separator {
  color: rgba(107, 79, 29, 0.45);
}
.structure-open-button {
  white-space: nowrap;
}
.structure-leaf-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  max-height: 220px;
  overflow: auto;
  padding-right: 0.1rem;
}
.structure-leaf-chip {
  display: grid;
  gap: 0.18rem;
  justify-items: start;
  min-width: 104px;
  padding: 0.55rem 0.72rem;
  border-radius: 14px;
  background: rgba(255,255,255,0.16);
}
.structure-leaf-chip.is-open {
  border-color: var(--accent);
  background: rgba(107, 79, 29, 0.12);
}
.structure-leaf-chip.is-focused {
  box-shadow: inset 0 0 0 1px rgba(107, 79, 29, 0.16);
}
.structure-leaf-chip.is-boundary {
  border-style: dashed;
}
.structure-leaf-label {
  font-family: var(--font-display);
  font-size: 0.96rem;
}
.structure-leaf-meta {
  color: var(--muted);
  font-size: 0.76rem;
}
.study-controls {
  display: flex;
  gap: 0.75rem;
  align-items: end;
  flex-wrap: wrap;
}
.compact-study-controls label { min-width: 180px; }
.small-note { font-size: 0.84rem; }
.structure-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.1rem;
}
.structure-breadcrumb[hidden] { display: none; }
.structure-current-path {
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.14);
}
.structure-current-chip {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0;
  font-size: 0.92rem;
  font-family: var(--font-ui);
}
.structure-current-chip.is-current {
  color: var(--accent);
  font-weight: 700;
}
.breadcrumb-chip {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.16);
  color: var(--text);
  border-radius: 999px;
  padding: 0.3rem 0.72rem;
  font-size: 0.82rem;
  font-family: var(--font-ui);
}
.breadcrumb-chip.is-current {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.breadcrumb-separator {
  color: var(--muted);
  font-size: 0.82rem;
}
.structure-spine-rail {
  display: grid;
  gap: 0.38rem;
}
.structure-spine-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
  width: 100%;
  padding: 0.42rem 0.1rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.structure-spine-item:hover {
  background: rgba(107, 79, 29, 0.06);
}
.structure-spine-marker {
  position: relative;
  width: 0.92rem;
  min-height: 2.25rem;
  display: flex;
  justify-content: center;
}
.structure-spine-marker::before {
  content: "";
  position: absolute;
  inset: 0.08rem auto 0.08rem 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(107, 79, 29, 0.22);
}
.structure-spine-marker::after {
  content: "";
  position: relative;
  width: 0.52rem;
  height: 0.52rem;
  margin-top: 0.86rem;
  border-radius: 999px;
  background: rgba(107, 79, 29, 0.38);
  box-shadow: 0 0 0 1px rgba(107, 79, 29, 0.18);
}
.structure-spine-item.is-active .structure-spine-marker::before {
  background: linear-gradient(180deg, var(--accent), rgba(107, 79, 29, 0.28));
}
.structure-spine-item.is-active .structure-spine-marker::after {
  width: 0.62rem;
  height: 0.62rem;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(107, 79, 29, 0.12);
}
.structure-spine-copy {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}
.structure-spine-label {
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.2;
}
.structure-spine-meta {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
}
.structure-nearby-nav {
  display: grid;
  gap: 0.45rem;
}
.structure-nearby-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  padding: 0.62rem 0.74rem;
  border-radius: 14px;
  border: 1px solid rgba(107, 79, 29, 0.14);
  background: rgba(255,255,255,0.14);
  color: var(--text);
  text-align: left;
}
.structure-nearby-item.is-current {
  background: rgba(107, 79, 29, 0.1);
  border-color: rgba(107, 79, 29, 0.22);
}
.structure-nearby-prefix {
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.structure-nearby-copy {
  min-width: 0;
  display: grid;
  gap: 0.08rem;
}
.structure-nearby-label {
  font-size: 0.9rem;
  line-height: 1.2;
}
.structure-nearby-cite {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.2;
}
.structure-debug-panel {
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 16px;
  background: rgba(255,255,255,0.1);
}
.structure-debug-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.72rem 0.86rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.structure-debug-panel > summary::-webkit-details-marker {
  display: none;
}
.structure-debug-panel[open] > summary {
  border-bottom: 1px solid rgba(107, 79, 29, 0.12);
}
.structure-debug-panel > :not(summary) {
  padding: 0.2rem 0.72rem 0.78rem;
}
.token-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-height: 180px;
  overflow: auto;
}
.token-chip {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  border-radius: 999px;
  padding: 0.32rem 0.62rem;
  line-height: 1.2;
}
.token-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.token-detail {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.95rem;
}
.token-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.detail-block { display: grid; gap: 0.18rem; }
.detail-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}
.detail-value { font-weight: 600; }
.feature-list {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.intertext-list {
  display: grid;
  gap: 0.8rem;
  max-height: calc(100vh - 360px);
  overflow: auto;
  padding-right: 0.15rem;
}
.intertext-group {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.75rem;
  display: grid;
  gap: 0.65rem;
  background: rgba(255,255,255,0.04);
}
.intertext-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.intertext-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.mini-citation-chip {
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.82rem;
  border: 1px solid var(--border);
  background: var(--panel-strong);
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
}

.edge-dialog {
  border: none;
  padding: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--text);
  max-width: 680px;
  width: min(92vw, 680px);
}
.edge-dialog::backdrop { background: rgba(0,0,0,0.38); }
.edge-dialog-card {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 22px;
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}
.edge-dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.edge-dialog-body {
  display: grid;
  gap: 0.8rem;
}
.edge-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}
.edge-dialog-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: flex-end;
  padding: 0;
}

.searchable-panel.is-loading,
.results-list.is-loading {
  position: relative;
}
.searchable-panel.is-loading::after,
.results-list.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  animation: shimmer 1.1s infinite;
  pointer-events: none;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (max-width: 1600px) {
  :root { --left-drawer-width: 330px; --right-drawer-width: 330px; }
  .toolbar-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto; }
}

@media (max-width: 1320px) {
  .layout {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  }
  .right-panel {
    position: static;
    max-height: none;
    grid-column: 1 / -1;
  }
  .layout.right-collapsed {
    grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  }
  .layout.left-collapsed,
  .layout.left-collapsed.right-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .app-shell { padding: 0.7rem; }
  .topbar, .reader-header { flex-direction: column; align-items: stretch; }
  .topbar-inline-actions,
  .reader-toolbar-main {
    flex-direction: column;
    align-items: stretch;
  }
  .settings-panel {
    position: static;
    min-width: 0;
  }
  .layout,
  .layout.left-collapsed,
  .layout.right-collapsed,
  .layout.left-collapsed.right-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .toolbar-grid,
  .reader-content.parallel,
  .search-hero-grid,
  .filter-grid,
  .work-facts-grid,
  .token-detail-grid,
  .edge-dialog-grid {
    grid-template-columns: 1fr;
  }
  .span-2 { grid-column: auto; }
}

.top-nav-links {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-strong);
}
.nav-link {
  text-decoration: none;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--muted);
}
.nav-link:hover {
  color: var(--ink);
  background: rgba(107, 79, 29, 0.08);
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.nav-link.reader-help-link-guided,
.nav-link.reader-help-link-pulse {
  color: var(--accent);
  border-color: rgba(107, 79, 29, 0.45);
  background: rgba(107, 79, 29, 0.12);
}
.nav-link.reader-help-link-pulse {
  animation: reader-help-pulse 1.35s ease-out 3;
}
.top-nav-links span.nav-link {
  cursor: default;
}

@keyframes reader-help-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(107, 79, 29, 0.28);
  }
  70% {
    box-shadow: 0 0 0 0.48rem rgba(107, 79, 29, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(107, 79, 29, 0);
  }
}

/* Keep rounded top navigation and settings trigger consistent across all compact page headers. */
.topbar.compact .top-nav-links,
.topbar.compact .topbar-inline-actions {
  gap: 0.45rem;
}

.topbar.compact .nav-link,
.topbar.compact .topbar-inline-actions > .ghost-button,
.topbar.compact .settings-menu > summary {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  border-style: solid;
  font-size: 0.84rem;
  line-height: 1.2;
}

.topbar.compact .topbar-inline-actions > .ghost-button,
.topbar.compact .settings-menu > summary {
  background: var(--panel-strong);
  color: var(--text);
}

.topbar.compact .settings-menu > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.article-link-list {
  display: grid;
  gap: 0.9rem;
}
.article-link-item {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 1.05rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.08)), var(--panel);
  text-decoration: none;
  color: inherit;
}
.article-link-item:hover {
  border-color: rgba(107, 79, 29, 0.22);
  box-shadow: 0 10px 24px rgba(20, 20, 20, 0.06);
}
.article-link-title {
  font-weight: 700;
}
.article-link-copy {
  color: var(--muted);
}

.content-page {
  --content-max-width: 1240px;
  --content-prose-width: 72ch;
}

.content-page .app-shell {
  padding-bottom: 1.35rem;
}

.content-page .topbar {
  max-width: var(--content-max-width);
  margin-bottom: 0;
}

.content-page .topbar-controls {
  min-width: 0;
  justify-content: flex-end;
}

.content-page .top-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: 100%;
}

.content-page .topbar-inline-actions {
  justify-content: flex-end;
}

.content-page .topbar.compact .top-nav-links {
  align-items: center;
}

.content-page .content-shell {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.content-page .content-layout {
  display: grid;
  grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.content-page .content-toc {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.8rem;
  align-self: start;
}

.content-page .content-toc-card,
.content-page .content-more-menu,
.content-page .guide-section,
.content-page .content-hero {
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06)),
    var(--panel);
  box-shadow: var(--shadow);
}

.content-page .content-toc-card {
  padding: 1rem;
  display: grid;
  gap: 0.8rem;
}

.content-page .content-toc-card h2,
.content-page .content-more-menu h2,
.content-page .guide-section h2,
.content-page .content-hero h1 {
  margin: 0;
}

.content-page .content-toc-card h2 {
  font-size: 1rem;
}

.content-page .content-toc-list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
}

.content-page .content-toc-list a {
  display: block;
  padding: 0.38rem 0.55rem;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
}

.content-page .content-toc-list a:hover,
.content-page .content-toc-list a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.content-page .content-article {
  display: grid;
  gap: 1rem;
  max-width: var(--content-prose-width);
}

.content-page .content-hero {
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem 1.25rem;
}

.content-page .content-hero-title {
  display: grid;
  gap: 0.2rem;
}

.content-page .content-hero h1 {
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  line-height: 1.02;
}

.content-page .content-hero-subtitle {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.58;
}

.content-page .content-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.content-page .content-secondary-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
  align-items: center;
}

.content-page .content-more-menu {
  display: grid;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-style: dashed;
}

.content-page .content-more-menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.content-page .content-more-menu > summary::-webkit-details-marker {
  display: none;
}

.content-page .content-more-menu[open] > summary {
  margin-bottom: 0.2rem;
}

.content-page .content-more-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.content-page .content-more-links a,
.content-page .content-more-links span,
.content-page .content-secondary-links a,
.content-page .content-secondary-links span {
  display: inline-flex;
  align-items: center;
  min-height: 2.1rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: var(--text);
  text-decoration: none;
}

.content-page .content-secondary-links a:hover,
.content-page .content-secondary-links a:focus-visible,
.content-page .content-more-links a:hover,
.content-page .content-more-links a:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.content-page .content-more-links span,
.content-page .content-secondary-links span {
  background: var(--accent-soft);
  border-color: rgba(107, 79, 29, 0.18);
  color: var(--accent);
  font-weight: 700;
}

.content-page .guide-section {
  display: grid;
  gap: 0.95rem;
  padding: 1.15rem 1.2rem;
}

.content-page .guide-section-header {
  display: grid;
  gap: 0.28rem;
}

.content-page .guide-section-header h2 {
  font-size: clamp(1.22rem, 1.8vw, 1.6rem);
}

.content-page .guide-section-copy {
  max-width: 62ch;
  color: var(--muted);
  line-height: 1.58;
}

.content-page .guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.8rem;
}

.content-page .guide-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08)),
    var(--panel-strong);
}

.content-page .reading-card {
  min-height: 100%;
}

.content-page .guide-card h3,
.content-page .reading-card h3,
.content-page .example-code-card h3 {
  margin: 0;
  font-size: 1.03rem;
}

.content-page .guide-card p,
.content-page .reading-card p,
.content-page .example-code-card p,
.content-page .guide-section p,
.content-page .guide-section li {
  line-height: 1.58;
}

.content-page .guide-card ul,
.content-page .guide-card ol,
.content-page .reading-card ul,
.content-page .reading-card ol,
.content-page .guide-section ul,
.content-page .guide-section ol {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.28rem;
}

.content-page .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.content-page .badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(107, 79, 29, 0.16);
  background: rgba(107, 79, 29, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
}

.content-page a.badge {
  text-decoration: none;
}

.content-page a.badge:hover,
.content-page a.badge:focus-visible {
  background: var(--accent-soft);
  border-color: rgba(107, 79, 29, 0.24);
  color: var(--accent);
}

.content-page .example-code-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08)),
    var(--panel-strong);
}

.content-page .example-code-card code {
  display: block;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.45;
}

.content-page .guide-note {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.52;
}

.content-page a:focus-visible,
.content-page button:focus-visible,
.content-page summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.content-page .content-hero a.button-like {
  white-space: nowrap;
}

.side-tab {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  border-radius: 14px;
  padding: 0.75rem 0.65rem;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.08em;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.side-tab-left { left: 0.2rem; }
.side-tab-right { right: 0.2rem; }

.reader-stage {
  position: relative;
  overflow: visible;
}

.reader-float-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.9rem;
  margin-bottom: 0.8rem;
}

.view-float {
  position: sticky;
  top: 0.6rem;
  z-index: 8;
  width: auto;
  align-self: start;
}
.reader-view-controls {
  margin: 0;
  gap: 0.6rem;
}
.reader-passage-nav {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.reader-export-menu {
  margin: 0;
}
.reader-view-controls label {
  min-width: 180px;
}

.parse-float {
  position: sticky;
  top: 0.6rem;
  z-index: 8;
  margin-left: auto;
  width: min(100%, 430px);
  display: grid;
  justify-items: end;
  align-self: start;
}
.parse-float-card {
  width: 100%;
  padding: 0.9rem;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.75rem;
  max-height: calc(100vh - 1.8rem);
  overflow: auto;
}
.reader-scholia-float {
  display: none;
}
.reader-scholia-float-card {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
  max-height: min(33vh, 320px);
  overflow: hidden;
}
.reader-scholia-float-header,
.reader-chapter-intertexts-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}
.reader-scholia-float-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0.82rem 0.92rem 0.45rem;
  margin-bottom: 0;
  background: linear-gradient(to bottom, var(--panel) 78%, rgba(0,0,0,0));
}
.reader-scholia-float-body {
  overflow: auto;
  min-height: 0;
  padding: 0.5rem 0.92rem 0.9rem;
  max-height: 240px;
  scrollbar-gutter: stable;
}
.reader-scholia-topslot {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: var(--chapter-slot-height, auto);
  min-height: 0;
  overflow: hidden;
  margin-bottom: 0;
}
.reader-scholia-topslot-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.45rem;
  background: linear-gradient(to bottom, var(--panel) 78%, rgba(0,0,0,0));
}
.reader-scholia-topslot-body {
  min-height: 0;
  overflow: auto;
  padding: 0.15rem 0 0.35rem;
  scrollbar-gutter: stable;
}
.reader-scholia-rows-region {
  display: grid;
  gap: 0;
  align-content: start;
  min-height: 0;
}
.reader-scholia-align-header {
  min-height: 0;
}
.reader-chapter-intertexts {
  display: grid;
  gap: 0.55rem;
}
.reader-chapter-intertexts-block {
  display: grid;
  gap: 0.4rem;
  padding: 0;
  border-top: none;
}
.reader-chapter-intertexts-block:first-child {
  padding-top: 0;
  border-top: none;
}
.reader-chapter-intertexts-body {
  display: grid;
  gap: 0.65rem;
}
.parse-float.collapsed { display: none; }
.parse-float-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}
.token-focus-word {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
.token-detail-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-block-wide { grid-column: 1 / -1; }
.lexicon-entry-stack {
  display: grid;
  gap: 0.6rem;
}
.lexicon-entry-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: rgba(107, 79, 29, 0.05);
  border: 1px solid rgba(107, 79, 29, 0.12);
}
.lexicon-entry-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.lexicon-entry-headword {
  font-weight: 600;
}
.lexicon-entry-text {
  line-height: 1.5;
}

.reader-content.manuscript-reader {
  display: block;
  max-width: none;
  font-family: var(--font-reader-text);
}
.reader-columns-shell {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-width: 0;
}
.reader-main-pane {
  flex: 1 1 auto;
  min-width: 0;
}
.reader-main-frame {
  width: min(100%, var(--reader-max-width));
  margin: 0 auto;
}
.reader-single-column {
  display: grid;
  gap: 0.8rem;
}
.reader-single-header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 0.45rem;
  background: linear-gradient(to bottom, var(--panel) 72%, rgba(0,0,0,0));
}
.reader-single-version {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.reader-single-body {
  width: min(100%, 70ch);
  margin: 0 auto;
  font-size: var(--reader-font-size);
  line-height: 1.8;
}
.reader-prose-paragraph {
  margin: 0;
}
.reader-prose-paragraph + .reader-prose-paragraph {
  margin-top: 1.1rem;
}
.reader-inline-prose + .reader-inline-prose::before {
  content: " ";
}
.reader-note-marker,
.reader-note-marker-row {
  display: inline-flex;
  align-items: center;
}
.reader-note-marker {
  margin: 0 0.18rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.reader-note-marker:hover {
  background: transparent;
}
.reader-note-marker sup {
  font-size: 0.94em;
  font-weight: 700;
}
.reader-note-popup-body {
  display: grid;
  gap: 0.55rem;
}
.reader-note-popup-prose {
  line-height: 1.65;
}
.reader-inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.reader-inline-number {
  color: var(--accent);
  font-size: 0.72em;
  line-height: 0;
  margin-right: 0.18rem;
  vertical-align: super;
}
.reader-dialogue-fragment,
.reader-inline-dialogue {
  padding-left: 5.5rem;
}
.reader-speaker-block {
  margin: 0.6rem 0 0.2rem;
}
.reader-speaker-label {
  margin-left: -4.6rem;
  width: 4.2rem;
  text-align: right;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  text-transform: none;
}
.reader-stage-block {
  margin: 0.35rem 0;
  padding-left: 5.5rem;
}
.reader-stage-text {
  font-style: italic;
  color: var(--muted);
}
.reader-explicit-break {
  height: 0.85rem;
}
.reader-explicit-break.break-speech {
  height: 1.1rem;
}
.reader-explicit-break.break-para,
.reader-explicit-break.break-stanza {
  height: 1.35rem;
}
.reader-scholia-splitter {
  width: 12px;
  flex: 0 0 12px;
  cursor: col-resize;
  position: relative;
}
.reader-scholia-splitter::before {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(107, 79, 29, 0.18);
}
.reader-scholia-splitter.is-hidden {
  display: none;
}
.reader-scholia-pane {
  width: var(--scholia-pane-width);
  flex: 0 0 var(--scholia-pane-width);
  min-width: 0;
  border-left: 1px solid rgba(107, 79, 29, 0.12);
  padding-left: 0.95rem;
  padding-top: 0;
  display: grid;
  gap: 0;
  align-content: start;
}
.reader-scholia-pane.is-collapsed {
  width: 148px;
  flex-basis: 148px;
}
.reader-scholia-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 3;
  padding-bottom: 0.45rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(to bottom, var(--panel) 78%, rgba(0,0,0,0));
}
.reader-scholia-title {
  font-family: var(--font-display);
  font-size: 1.02rem;
}
.reader-scholia-rows {
  display: grid;
  gap: 0.8rem;
  align-content: start;
}
.reader-scholia-row {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.82rem 0.86rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-strong);
}
.reader-scholia-row.is-empty {
  opacity: 0;
  border-color: transparent;
  background: transparent;
  pointer-events: none;
}
.reader-scholia-row.is-minimal {
  border-color: transparent;
  background: transparent;
}
.reader-scholia-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}
.reader-scholia-row-body {
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}
.reader-scholia-search-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding-top: 0.1rem;
}
.scholia-search-label {
  font-style: italic;
}
.scholia-search-direction-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.scholia-search-direction {
  text-decoration: none;
}
.reader-scholium-cite {
  font-family: var(--font-display);
  font-size: 0.98rem;
}
.reader-scholia-collapsed-copy {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  color: var(--muted);
  font-size: 0.9rem;
}
.parallel-grid,
.parallel-grid-header {
  display: grid;
  gap: 0.9rem;
  align-items: start;
}
.parallel-grid-two {
  grid-template-columns: 78px minmax(0, 1fr) minmax(0, 1fr);
}
.parallel-grid-single {
  grid-template-columns: 78px minmax(0, 1fr);
}
.parallel-grid-header {
  margin-bottom: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 2;
  padding-bottom: 0.45rem;
  background: linear-gradient(to bottom, var(--panel) 72%, rgba(0,0,0,0));
}
.parallel-header-cell {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.15rem 0.2rem;
}
.parallel-row {
  --row-height: auto;
  display: grid;
  gap: 0.9rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid rgba(107, 79, 29, 0.08);
}
.parallel-cell {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0.35rem 0.15rem 0.35rem 0.2rem;
}
.parallel-cell-header {
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.text-cell .parallel-cell-content {
  min-height: var(--row-height);
  font-size: var(--reader-font-size);
  line-height: 1.72;
  font-family: var(--font-reader-text);
}
.scholia-cell .parallel-cell-content {
  height: var(--row-height);
  max-height: var(--row-height);
  overflow: auto;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}
.cite-gutter {
  background: transparent;
  border: none;
  display: grid;
  align-content: start;
  justify-items: center;
  padding: 0.55rem 0.35rem;
}
.cite-gutter-target {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  display: grid;
  justify-items: center;
  gap: 0.15rem;
  cursor: pointer;
}
.cite-gutter-label {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.cite-gutter-scholarly,
.reader-scholarly-badge,
.reader-meter-chip,
.reader-citation-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  font-size: 0.72rem;
  color: var(--muted);
}
.reader-citation-badge.is-static {
  cursor: default;
}
.cite-gutter-scholarly {
  margin-top: 0.35rem;
  text-align: center;
}
.cite-gutter-inline-chips {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.5rem;
  justify-items: center;
}
.verse-fragment + .verse-fragment {
  margin-top: 0.22rem;
}
.verse-fragment.is-embedded,
.segment-type-line.is-embedded {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}
.verse-fragment-heading {
  margin: 0.2rem 0 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.98rem;
  line-height: 1.35;
  letter-spacing: 0;
}
.verse-fragment-heading.is-centered {
  text-align: center;
}
.verse-fragment-heading.is-bold {
  font-weight: 700;
}
.verse-fragment-empty {
  min-height: 1.8rem;
}
.segment-type-line {
  padding-left: 1.6rem;
  text-indent: -1.6rem;
  text-indent: 1.6rem hanging each-line;
}
.reader-citation-badge-row {
  margin: 0.2rem 0 0.5rem;
}
.reader-meter-chip {
  margin-left: 0.45rem;
}
.parallel-grid .segment-type-prose.continues-before {
  margin-top: 0;
}
.parallel-grid .segment-type-prose.continues-after {
  margin-bottom: 0;
}
.parallel-alignment-notice {
  margin-bottom: 0.35rem;
}
.scholium-stack,
.scholia-overview-card {
  display: grid;
  gap: 0.6rem;
}
.scholia-section {
  display: grid;
  gap: 0.35rem;
}
.scholia-section-label {
  font-size: 0.76rem;
  font-style: italic;
  color: var(--muted);
}
.scholia-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.inline-intertext-chip,
.scholium-author-chip {
  max-width: 100%;
}
.parallel-row.is-hover-linked,
.reader-scholia-row.is-hover-linked,
.reader-note-marker.is-hover-linked {
  background: rgba(199, 166, 91, 0.08);
}
.reader-note-marker.is-hover-linked {
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(199, 166, 91, 0.42);
}
.scholia-empty {
  color: var(--muted);
  align-self: start;
}
.compact-overview {
  max-height: none;
}

.collection-card {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 0.3rem;
}
.collection-card.active,
.author-card.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.work-card {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 0.85rem;
}
.work-card-actions {
  display: flex;
  align-items: center;
}
.ghost-link {
  text-decoration: none;
  border: 1px dashed var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
}
.library-shell {
  max-width: 1840px;
  margin: 0 auto;
}
.library-browser-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
  gap: 1rem;
  align-items: start;
}
.library-browser-card {
  max-width: 1080px;
  min-height: 72vh;
  justify-self: center;
  width: 100%;
  display: grid;
  gap: 1.1rem;
  padding: 1.35rem;
}
.library-browser-topline {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
}
.library-browser-topline h2 {
  font-size: clamp(1.7rem, 2vw, 2.3rem);
}
.library-utility-cluster {
  display: grid;
  justify-items: end;
  gap: 0.65rem;
}
.library-browser-controls {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(107, 79, 29, 0.12);
}
.library-breadcrumb-controls {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.library-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  min-height: 2rem;
}
.library-crumb {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  border-radius: 0;
}
.library-crumb:not(.current) {
  cursor: pointer;
}
.library-crumb.current {
  color: var(--text);
  font-weight: 600;
}
.library-crumb:hover:not(.current) {
  color: var(--accent);
  background: transparent;
}
.library-crumb-separator {
  color: var(--muted);
}
.library-browser-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  align-content: start;
}
.library-node-card {
  width: 100%;
  min-height: 150px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 0.9rem 0.95rem 1rem;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.06)),
    var(--panel-strong);
}
.library-node-card:hover {
  border-color: rgba(107, 79, 29, 0.28);
}
.library-node-card-compact {
  min-height: 0;
}
.library-node-rule {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(107, 79, 29, 0.15));
}
.library-node-card .title,
.library-work-copy .title {
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.2;
}
.library-node-card .meta,
.library-work-copy .meta {
  color: var(--muted);
  font-size: 0.88rem;
}
.library-browse-controls {
  display: grid;
  gap: 0.8rem;
  padding: 0.85rem 0 0.25rem;
  border-top: 1px solid rgba(107, 79, 29, 0.12);
}
.library-search-field,
.library-filter {
  display: grid;
  gap: 0.35rem;
}
.library-search-field input,
.library-filter select {
  width: 100%;
}
.library-mode-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.library-mode-controls .ghost-button.active {
  background: var(--accent-soft);
  border-color: rgba(107, 79, 29, 0.32);
  color: var(--text);
}
.library-filter-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.65rem;
}
.library-browser-results {
  display: grid;
  gap: 1rem;
}
.library-group-section,
.library-bible-section {
  display: grid;
  gap: 0.7rem;
}
.library-group-heading {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(107, 79, 29, 0.14);
}
.library-author-list,
.library-book-list,
.library-author-works {
  display: grid;
  gap: 0.65rem;
}
.library-author-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-strong);
  overflow: hidden;
}
.library-author-toggle {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0.95rem;
  cursor: pointer;
}
.library-author-toggle:hover {
  background: rgba(107, 79, 29, 0.04);
}
.library-author-copy {
  display: grid;
  gap: 0.22rem;
}
.library-author-count {
  color: var(--muted);
  white-space: nowrap;
}
.library-author-works {
  padding: 0 0.85rem 0.85rem;
  border-top: 1px solid rgba(107, 79, 29, 0.12);
}
.library-inline-work-card {
  padding: 0.8rem 0.85rem;
}
.library-sidecar {
  position: sticky;
  top: 0.9rem;
  align-self: start;
}
.library-side-panel {
  padding: 0.95rem;
}
.library-side-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
}
.library-side-summary::-webkit-details-marker {
  display: none;
}
.library-side-panel[open] .library-side-summary {
  margin-bottom: 0.8rem;
}
.library-recent-link {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.85rem;
  text-decoration: none;
  background: var(--panel-strong);
}
.library-work-card {
  min-height: 0;
  align-items: center;
}
.library-work-copy {
  display: grid;
  gap: 0.35rem;
}
.library-work-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.library-admin-tree-layout {
  display: grid;
  grid-template-columns: minmax(340px, 1.4fr) minmax(280px, 0.8fr);
  gap: 1rem;
}
.catalog-tree-container {
  --tree-scale: 1;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-strong);
  min-height: 440px;
  max-height: 68vh;
  overflow: auto;
  padding: 0.8rem;
}
.catalog-tree-root {
  transform: scale(var(--tree-scale));
  transform-origin: top left;
  display: grid;
  gap: 0.35rem;
}
.catalog-tree-empty {
  color: var(--muted);
}
.catalog-tree-branch {
  border-left: 1px dashed var(--border);
  margin-left: 0.35rem;
  padding-left: 0.6rem;
  display: grid;
  gap: 0.25rem;
}
.catalog-tree-node {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  padding: 0.26rem 0.62rem;
  cursor: pointer;
}
.catalog-tree-node.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.catalog-tree-node small {
  color: var(--muted);
}
.catalog-tree-inspector {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-strong);
  padding: 0.8rem;
  display: grid;
  gap: 0.65rem;
  align-content: start;
}
.catalog-tree-summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}
.catalog-tree-summary.active {
  color: var(--accent);
}
.library-column {
  min-height: 68vh;
}
.library-collection-list {
  display: grid;
  gap: 0.7rem;
}
.panel-inline-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
  align-items: end;
}
.edit-form-grid {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.edit-form-grid input,
.inline-controls input,
.inline-controls select {
  width: 100%;
}

@media (max-width: 1200px) {
  .library-browser-layout,
  .library-admin-tree-layout,
  .parallel-grid-two,
  .parallel-grid-single,
  .parallel-grid-header.parallel-grid-two,
  .parallel-grid-header.parallel-grid-single {
    grid-template-columns: 1fr;
  }
  .parse-float {
    width: 100%;
  }
  .reader-scholia-float {
    position: static;
    width: 100%;
  }
  .view-float {
    width: 100%;
  }
  .reader-float-row {
    flex-direction: column;
    align-items: stretch;
  }
  .reader-columns-shell {
    flex-direction: column;
    gap: 1rem;
  }
  .reader-main-frame {
    width: 100%;
  }
  .reader-scholia-splitter {
    display: none;
  }
  .reader-scholia-pane,
  .reader-scholia-pane.is-collapsed {
    width: 100%;
    flex-basis: auto;
    border-left: none;
    border-top: 1px solid rgba(107, 79, 29, 0.12);
    padding-left: 0;
    padding-top: 0.9rem;
    position: static;
    max-height: none;
  }
  .text-cell .parallel-cell-content {
    height: auto;
    max-height: none;
    min-height: 0;
  }
  .reader-dialogue-fragment,
  .reader-inline-dialogue,
  .reader-stage-block {
    padding-left: 2.6rem;
  }
  .reader-speaker-label {
    margin-left: -2.2rem;
    width: 1.9rem;
    font-size: 0.75rem;
  }
  .library-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .library-browser-topline {
    flex-direction: column;
  }
  .top-nav-links {
    order: -1;
  }
  .content-page .topbar {
    gap: 0.8rem;
  }
  .content-page .topbar-controls {
    width: 100%;
  }
  .content-page .top-nav-links {
    width: 100%;
  }
  .content-page .content-layout {
    grid-template-columns: 1fr;
  }
  .content-page .content-toc {
    position: static;
    order: -1;
  }
  .content-page .content-toc-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .content-page .content-article {
    max-width: 100%;
  }
  .content-page .content-hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .content-page .content-hero-actions a,
  .content-page .content-hero-actions button,
  .content-page .content-more-menu {
    width: 100%;
  }
  .content-page .content-secondary-links,
  .content-page .content-more-links {
    width: 100%;
  }
  .side-tab {
    top: auto;
    bottom: 0.8rem;
    transform: none;
    writing-mode: horizontal-tb;
  }
  .side-tab-left { left: 0.8rem; }
  .side-tab-right { right: 0.8rem; }
}

@media (max-width: 900px) {
  .library-browser-grid {
    grid-template-columns: 1fr;
  }

  .library-filter-grid {
    grid-template-columns: 1fr;
  }

  .library-work-card {
    flex-direction: column;
    align-items: stretch;
  }

  .library-work-actions {
    justify-content: flex-start;
  }

  .library-author-toggle {
    align-items: start;
    flex-direction: column;
  }
}

.edge-decision-panel {
  border-top: 1px solid var(--line, rgba(0,0,0,0.12));
  margin-top: 1rem;
  padding-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.grow-field {
  flex: 1 1 auto;
}

.review-card {
  padding: 0.75rem;
}

.graph-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem 0.8rem;
}

.review-expanded {
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
  display: grid;
  gap: 0.55rem;
}

.review-expanded details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.55rem;
  background: var(--panel-strong);
}

.review-expanded summary {
  cursor: pointer;
  font-weight: 600;
}

.review-expanded-body {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.review-evidence-row {
  display: grid;
  gap: 0.25rem;
}

.graph-edge-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-strong);
}

.annotation-group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.annotation-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.45rem;
  background: var(--panel-strong);
}

.annotation-meta {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.validation-summary {
  font-size: 0.82rem;
  color: var(--muted);
}

.validation-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  display: grid;
  gap: 0.45rem;
  background: var(--panel-strong);
}

.danger-text {
  color: #b42318;
}

@media (max-width: 980px) {
  .graph-filter-grid {
    grid-template-columns: 1fr;
  }
}

.master-data-toolbar {
  display: grid;
  gap: 0.8rem;
}

.wrap-controls {
  flex-wrap: wrap;
  align-items: end;
}

.alphabet-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.alphabet-button {
  border: 1px solid var(--border);
  background: var(--panel-strong);
  color: inherit;
  border-radius: 999px;
  padding: 0.25rem 0.65rem;
  cursor: pointer;
}

.alphabet-button.active {
  background: var(--accent);
  color: #fff;
}

.master-data-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 380px);
  gap: 0.85rem;
  align-items: start;
}

.master-data-tree-card,
.master-data-drawer {
  min-height: 68vh;
}

.master-data-tree-card {
  min-width: 0;
  overflow-x: auto;
}

.master-tree-columns,
.master-tree-row {
  display: grid;
  grid-template-columns:
    minmax(240px, 1.5fr)
    minmax(180px, 0.95fr)
    minmax(170px, 0.95fr)
    minmax(190px, 1.05fr)
    minmax(150px, 0.9fr)
    minmax(120px, 0.8fr)
    minmax(160px, 0.9fr);
  gap: 0.75rem;
  align-items: center;
}

.treegrid-head {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.master-tree {
  display: grid;
  gap: 0.25rem;
  padding-top: 0.5rem;
}

.master-tree-row {
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
  border-radius: 0.8rem;
  background: var(--panel-strong);
}

.master-tree-row.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(141, 111, 63, 0.12);
}

.work-row {
  margin-left: 0.85rem;
}

.version-row {
  margin-left: 1.7rem;
  opacity: 0.95;
}

.tree-cell {
  min-width: 0;
  overflow-wrap: anywhere;
}

.primary-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.indent-1 {
  padding-left: 1rem;
}

.indent-2 {
  padding-left: 2rem;
}

.expander-button {
  width: 1.6rem;
  height: 1.6rem;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

.row-select-link {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.action-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.tree-loading-row {
  margin-left: 1rem;
  color: var(--muted);
  padding: 0.25rem 0.75rem 0.55rem;
}

.version-marker {
  color: var(--accent);
}

.master-data-drawer {
  position: sticky;
  top: 0.75rem;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 0.8rem;
  width: 100%;
  max-width: 380px;
  min-width: 0;
  justify-self: end;
  align-self: start;
  max-height: calc(100vh - 1.5rem);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.master-drawer-tabs {
  display: flex;
  gap: 0.4rem;
}

.drawer-tab {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.drawer-tab.active {
  background: var(--accent);
  color: #fff;
}

.master-drawer-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
  min-height: 0;
  padding-bottom: 0.25rem;
}

.form-actions-wide {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.master-form-actions {
  margin-top: 0.35rem;
}

.detail-section {
  display: grid;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--panel-strong);
}

.detail-section h3,
.detail-section h4 {
  margin: 0;
}

.relationship-list,
.detail-stack,
.history-stack {
  display: grid;
  gap: 0.7rem;
}

.chip-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.card-subtle {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.2);
}

.authority-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.detail-table {
  display: grid;
  gap: 0.45rem;
}

.detail-table-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.16);
}

.history-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: rgba(255, 255, 255, 0.2);
}

.history-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.history-diffs {
  display: grid;
  gap: 0.35rem;
}

.history-diff-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 0.4rem;
  font-size: 0.92rem;
}

.master-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.master-data-secondary {
  margin-top: 1rem;
}

.reader-page .topbar {
  align-items: center;
  margin-bottom: 0.7rem;
}

.reader-page .brand-block {
  gap: 0.02rem;
}

.reader-page .topbar h1 {
  font-size: 1.08rem;
}

.reader-page .topbar-subtitle {
  font-size: 0.88rem;
}

.reader-page .top-nav-links,
.reader-page .topbar-inline-actions {
  gap: 0.45rem;
}

.reader-page .nav-link,
.reader-page .topbar-inline-actions > .ghost-button,
.reader-page .settings-menu > summary {
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  border-style: solid;
  font-size: 0.84rem;
}

.reader-page .sidebar {
  gap: 0.35rem;
  padding: 0.95rem 1rem 1.05rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.06)),
    var(--panel);
  box-shadow: 0 10px 24px rgba(20, 20, 20, 0.05);
  scrollbar-gutter: stable;
}

.reader-page .drawer-header {
  padding: 0 0 0.65rem;
  margin-bottom: 0.15rem;
  border-bottom: 1px solid rgba(107, 79, 29, 0.12);
}

.reader-page .drawer-header h2 {
  font-size: 1.14rem;
}

.reader-page .reader-sidebar-section {
  gap: 0.7rem;
}

.reader-page .reader-sidebar-section-priority {
  padding: 0.95rem;
  border-radius: 20px;
  border: 1px solid rgba(107, 79, 29, 0.12);
  box-shadow: none;
  backdrop-filter: none;
}

.reader-page .reader-sidebar-section-secondary,
.reader-page .reader-sidebar-section-utility {
  padding: 0.85rem 0 0;
  border: none;
  border-radius: 0;
  border-top: 1px solid rgba(107, 79, 29, 0.12);
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.reader-page .current-work-card,
.reader-page .structure-drawer-card,
.reader-page .right-panel .reader-sidebar-section-priority {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08)),
    linear-gradient(135deg, rgba(107, 79, 29, 0.06), transparent 52%);
}

.reader-page .drawer-card-title {
  font-size: 1.08rem;
}

.reader-page .drawer-work-byline,
.reader-page .panel-meta,
.reader-page .muted.small-note {
  color: var(--muted);
}

.reader-page .work-facts-grid {
  grid-template-columns: 1fr;
  gap: 0;
}

.reader-page .work-fact {
  gap: 0.18rem;
  padding: 0.42rem 0;
  border: none;
  border-top: 1px solid rgba(107, 79, 29, 0.1);
  border-radius: 0;
  background: transparent;
}

.reader-page .work-fact:first-child {
  border-top: none;
  padding-top: 0;
}

.reader-page .work-fact-label {
  font-size: 0.68rem;
  letter-spacing: 0.11em;
}

.reader-page .work-fact-value {
  font-size: 0.92rem;
}

.reader-page .inline-chip {
  border-color: rgba(107, 79, 29, 0.16);
  background: rgba(107, 79, 29, 0.06);
  padding: 0.1rem 0.48rem;
}

.reader-page .drawer-section-toggle {
  padding: 0;
  font-size: 0.98rem;
}

.reader-page .search-filters,
.reader-page .multi-select,
.reader-page .author-card,
.reader-page .work-card,
.reader-page .result-item,
.reader-page .search-hit {
  border-color: rgba(107, 79, 29, 0.12);
  box-shadow: none;
}

.reader-page .search-filters,
.reader-page .multi-select,
.reader-page .work-card,
.reader-page .author-card {
  background: rgba(255,255,255,0.12);
}

.reader-page .compact-results {
  max-height: 240px;
}

.reader-page .reader-toolbar-surface {
  padding: 0.45rem 0.72rem;
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(20, 20, 20, 0.04);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0.08)),
    var(--panel);
}

.reader-page .reader-toolbar-main {
  align-items: start;
  gap: 0.55rem;
}

.reader-page .omnibox-control-row {
  gap: 0.42rem;
}

.reader-page .toolbar-omnibox-field {
  flex: 1 1 100%;
}

.reader-page .toolbar-omnibox-field label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.reader-page .omnibox-meta-row {
  font-size: 0.78rem;
}

.reader-page .omnibox-submit-button {
  border-color: rgba(107, 79, 29, 0.2);
  background: rgba(107, 79, 29, 0.1);
}

@media (max-width: 640px) {
  .omnibox-submit-button {
    width: 100%;
  }
}

.reader-page .reader-toolbar button,
.reader-page .reader-toolbar select,
.reader-page .reader-toolbar input,
.reader-page .toolbar-export-menu > summary {
  padding: 0.46rem 0.78rem;
  border-radius: 999px;
}

.reader-page #prevPassageButton,
.reader-page #nextPassageButton,
.reader-page .toolbar-secondary-actions .ghost-button {
  background: transparent;
}

.reader-page .toolbar-export-menu > summary {
  border-color: rgba(107, 79, 29, 0.2);
  background: rgba(107, 79, 29, 0.1);
}

.reader-page .reader-stage-surface {
  padding: 1.35rem 1.5rem 1.7rem;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.1) 18%, rgba(255,255,255,0.02)),
    var(--panel);
  box-shadow: 0 16px 38px rgba(20, 20, 20, 0.08);
}

.reader-page .reader-header {
  margin-bottom: 0.15rem;
}

.reader-page .reader-title {
  font-size: clamp(1.52rem, 2.2vw, 1.9rem);
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.reader-page #readerSubtitle {
  max-width: 78ch;
  font-size: 0.96rem;
  line-height: 1.45;
}

.reader-page .reader-first-visit-banner {
  position: relative;
  margin: 0.9rem 0 1rem;
  padding: 0.95rem 3rem 0.95rem 1rem;
  border: 1px solid rgba(107, 79, 29, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(107, 79, 29, 0.12), rgba(255, 255, 255, 0.4)),
    var(--panel-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.reader-page .reader-first-visit-copy {
  display: grid;
  gap: 0.2rem;
}

.reader-page .reader-first-visit-close {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
}

.reader-page .reader-first-visit-message {
  font-size: 0.94rem;
  line-height: 1.45;
}

.reader-page .reader-first-visit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.reader-page .status-badge {
  padding: 0.3rem 0.68rem;
  font-size: 0.78rem;
}

.reader-page .reader-float-row {
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.reader-page .view-float,
.reader-page .parse-float,
.reader-page .reader-scholia-float {
  top: 0.35rem;
}

.reader-page .reader-view-controls {
  gap: 0.55rem 0.7rem;
}

.reader-page .reader-view-controls label {
  min-width: 160px;
}

.reader-page .parse-float-card {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.08);
}

.reader-page .reader-scholia-float-card {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(20, 20, 20, 0.08);
}

.reader-page .ghost-link {
  border-color: rgba(107, 79, 29, 0.16);
  background: rgba(107, 79, 29, 0.04);
}

.reader-page .side-tab {
  border: 1px solid rgba(107, 79, 29, 0.14);
  border-radius: 12px;
  padding: 0.48rem 0.42rem;
  font-size: 0.7rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(251, 247, 239, 0.86);
  box-shadow: 0 8px 18px rgba(20, 20, 20, 0.08);
  opacity: 0.92;
}

.reader-page .side-tab-left {
  left: 0.32rem;
}

.reader-page .side-tab-right {
  right: 0.32rem;
}

.reader-page .structure-subsection {
  gap: 0.58rem;
}

.reader-page .structure-subsection + .structure-subsection {
  padding-top: 0.12rem;
}

.reader-page .structure-range-pill {
  background: rgba(107, 79, 29, 0.09);
}

.reader-page .structure-breadcrumb {
  gap: 0.32rem;
}

.reader-page .breadcrumb-chip {
  border-color: rgba(107, 79, 29, 0.12);
  background: rgba(107, 79, 29, 0.05);
}

.reader-page .structure-spine-rail {
  gap: 0.12rem;
  padding-left: 0.1rem;
}

.reader-page .structure-spine-item {
  grid-template-columns: 0.72rem minmax(0, 1fr);
  gap: 0.55rem;
  padding: 0.22rem 0;
  border-radius: 10px;
}

.reader-page .structure-spine-item:hover {
  background: linear-gradient(90deg, rgba(107, 79, 29, 0.06), transparent 78%);
}

.reader-page .structure-spine-item.is-active {
  background: linear-gradient(90deg, rgba(107, 79, 29, 0.1), transparent 80%);
}

.reader-page .structure-spine-marker {
  width: 0.72rem;
  min-height: 1.95rem;
}

.reader-page .structure-spine-marker::before {
  width: 1px;
  background: rgba(107, 79, 29, 0.18);
}

.reader-page .structure-spine-marker::after {
  width: 0.42rem;
  height: 0.42rem;
  margin-top: 0.75rem;
  background: rgba(107, 79, 29, 0.32);
  box-shadow: none;
}

.reader-page .structure-spine-item.is-active .structure-spine-marker::after {
  width: 0.56rem;
  height: 0.56rem;
  background: var(--accent);
  box-shadow: 0 0 0 2px rgba(107, 79, 29, 0.1);
}

.reader-page .structure-spine-copy {
  gap: 0;
}

.reader-page .structure-spine-label {
  font-size: 0.92rem;
  line-height: 1.18;
}

.reader-page .structure-spine-meta {
  display: none;
}

.reader-page .structure-nearby-item {
  padding: 0.52rem 0;
  border: none;
  border-top: 1px solid rgba(107, 79, 29, 0.1);
  border-radius: 0;
  background: transparent;
}

.reader-page .structure-nearby-item:first-child {
  border-top: none;
  padding-top: 0;
}

.reader-page .structure-nearby-item.is-current {
  background: transparent;
}

.reader-page .structure-debug-panel > summary {
  padding: 0.55rem 0 0;
}

.reader-page .reader-main-frame {
  width: min(100%, calc(var(--reader-max-width) - 40px));
  padding-top: 0.15rem;
}

.reader-legal-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  margin: 0.8rem 0 0;
  padding: 0.9rem 1rem 0.2rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.reader-legal-footer a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.reader-legal-footer a:hover,
.reader-legal-footer a:focus-visible {
  color: var(--text);
  border-bottom-color: currentColor;
}

.reader-legal-label {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.policy-main {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.policy-card {
  display: grid;
  gap: 0.95rem;
}

.policy-card h2 {
  font-size: 1.42rem;
}

.policy-stack {
  display: grid;
  gap: 0.8rem;
}

.policy-stack section {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
}

.policy-stack h3 {
  margin: 0;
  font-size: 1rem;
}

.policy-stack p,
.policy-stack li {
  color: var(--muted);
  line-height: 1.5;
}

.policy-stack ul {
  margin: 0;
  padding-left: 1.1rem;
}

.policy-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.policy-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.reader-page .reader-single-header,
.reader-page .parallel-grid-header,
.reader-page .reader-scholia-header {
  padding-bottom: 0.3rem;
  background: linear-gradient(to bottom, rgba(251, 247, 239, 0.92) 76%, rgba(251, 247, 239, 0));
}

.reader-page .reader-single-version,
.reader-page .parallel-header-cell,
.reader-page .parallel-cell-header {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.reader-page .reader-single-body,
.reader-page .text-cell .parallel-cell-content {
  line-height: 1.84;
}

.reader-page .parallel-grid,
.reader-page .parallel-grid-header {
  gap: 1rem;
}

.reader-page .parallel-grid-two,
.reader-page .parallel-grid-single {
  grid-template-columns: 62px minmax(0, 1fr) minmax(0, 1fr);
}

.reader-page .parallel-grid-single {
  grid-template-columns: 62px minmax(0, 1fr);
}

.reader-page .parallel-row {
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(107, 79, 29, 0.05);
}

.reader-page .parallel-cell {
  padding: 0.15rem 0.05rem 0.35rem;
}

.reader-page .parallel-alignment-notice {
  font-size: 0.8rem;
}

.reader-page .cite-gutter {
  padding: 0.38rem 0.12rem;
}

.reader-page .cite-gutter-label {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
}

.reader-page .cite-gutter-scholarly,
.reader-page .reader-scholarly-badge,
.reader-page .reader-meter-chip,
.reader-page .reader-citation-badge {
  padding: 0.08rem 0.38rem;
  border: none;
  background: rgba(107, 79, 29, 0.08);
  color: var(--muted);
  font-size: 0.67rem;
}

.reader-page .cite-gutter-inline-chips {
  gap: 0.2rem;
  margin-top: 0.35rem;
}

.reader-page .reader-citation-badge-row {
  margin: 0.08rem 0 0.35rem;
}

.reader-page .reader-scholia-pane {
  border-left-color: rgba(107, 79, 29, 0.1);
  padding-left: 1.05rem;
}
.reader-page .reader-scholia-topslot {
  margin-bottom: 0;
}
.reader-page .reader-scholia-topslot-header {
  padding-bottom: 0.3rem;
  background: linear-gradient(to bottom, rgba(251, 247, 239, 0.92) 76%, rgba(251, 247, 239, 0));
}

.reader-page .reader-scholia-row {
  padding: 0.6rem 0;
  border: none;
  border-top: 1px solid rgba(107, 79, 29, 0.1);
  border-radius: 0;
  background: transparent;
}

.reader-page .reader-scholia-row:first-child {
  border-top: none;
  padding-top: 0;
}

.reader-page .reader-chapter-intertexts-card {
  padding: 0.6rem 0;
  border-top: 1px solid rgba(107, 79, 29, 0.1);
}

.reader-page .reader-chapter-intertexts-card:first-child {
  padding-top: 0;
  border-top: none;
}

.reader-page .reader-chapter-intertexts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.reader-page .reader-chapter-intertexts-body {
  display: grid;
  gap: 0.35rem;
}

.reader-page .reader-scholia-row.is-minimal {
  padding-bottom: 0.2rem;
}

.reader-page .right-panel .reader-sidebar-section-utility .drawer-section-toggle {
  color: var(--muted);
}

.reader-page .right-panel .notice,
.reader-page .left-panel .notice,
.reader-page #tokenDetail.notice,
.reader-page #legacyTokenDetail.notice {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  background: rgba(107, 79, 29, 0.08);
}

@media (max-width: 1200px) {
  .reader-page .reader-main-frame {
    width: 100%;
  }
}

@media (max-width: 980px) {
  .reader-page .sidebar {
    padding: 0.85rem 0.9rem 0.95rem;
  }

  .reader-page .reader-toolbar-surface,
  .reader-page .reader-stage-surface {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .reader-page .reader-first-visit-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .reader-page .toolbar-actions {
    justify-content: flex-start;
  }

  .reader-page .side-tab {
    padding: 0.5rem 0.72rem;
    letter-spacing: 0.1em;
    background: rgba(251, 247, 239, 0.92);
  }
}

@media (max-width: 1100px) {
  .master-data-layout {
    grid-template-columns: 1fr;
  }

  .master-data-drawer {
    position: static;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-link.reader-help-link-pulse {
    animation: none;
  }
}

@media (max-width: 900px) {
  .master-tree-columns,
  .master-tree-row {
    grid-template-columns: minmax(180px, 1.2fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(140px, 1fr);
  }

  .master-tree-columns > :nth-child(n + 5),
  .master-tree-row > :nth-child(n + 5) {
    display: none;
  }

  .authority-link-grid {
    grid-template-columns: 1fr;
  }

  .detail-table-row {
    grid-template-columns: 1fr;
  }

  .history-diff-row {
    grid-template-columns: 1fr;
  }
}

.account-page-main {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  gap: 1rem;
}

.auth-card {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  gap: 0.9rem;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.account-tabs .button-like.active {
  background: var(--accent);
  color: var(--panel-strong);
  border-color: var(--accent);
}

.account-form {
  display: grid;
  gap: 0.9rem;
}

.account-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-form label,
.account-form .checkbox-row {
  display: grid;
  gap: 0.3rem;
}

.account-form input,
.account-form select,
.account-form textarea {
  width: 100%;
  border: 1px solid rgba(107, 79, 29, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  padding: 0.7rem 0.8rem;
  font: inherit;
}

.checkbox-row {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-row input {
  width: auto;
}

.status-banner {
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  border: 1px solid rgba(107, 79, 29, 0.14);
  background: rgba(255, 255, 255, 0.2);
}

.status-banner[data-kind="success"] {
  border-color: rgba(56, 116, 51, 0.24);
  background: rgba(129, 181, 105, 0.14);
}

.status-banner[data-kind="error"] {
  border-color: rgba(154, 76, 76, 0.24);
  background: rgba(171, 88, 88, 0.12);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.data-list {
  display: grid;
  gap: 0.7rem;
}

.data-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 0.9rem;
  border: 1px solid rgba(107, 79, 29, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
}

.summary-box {
  display: grid;
  gap: 0.2rem;
}

@media (max-width: 680px) {
  .account-grid {
    grid-template-columns: 1fr;
  }

  .data-row {
    display: grid;
    align-items: start;
  }
}
