:root {
  --ink: #231b14;
  --ink-soft: #5e4a35;
  --ink-muted: #8a745d;
  --paper: #efe4cf;
  --paper-strong: #e4d4bb;
  --card: #fffaf2;
  --card-strong: #f8eedf;
  --line: #d3bea0;
  --line-strong: #b88f58;
  --gold: #9b7136;
  --gold-strong: #6f4c1d;
  --wine: #6f2b2b;
  --olive: #587549;
  --slate: #2a536b;
  --shadow-lg: 0 24px 54px rgba(61, 40, 17, 0.17);
  --shadow-sm: 0 10px 24px rgba(61, 40, 17, 0.08);
  --radius: 24px;
  --radius-sm: 16px;
  --workspace-height: clamp(560px, calc(100vh - 240px), 820px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  font-family: "Source Sans 3", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 244, 219, 0.88), transparent 28%),
    radial-gradient(circle at 84% 5%, rgba(171, 116, 55, 0.18), transparent 24%),
    radial-gradient(circle at 90% 92%, rgba(120, 61, 48, 0.12), transparent 22%),
    repeating-linear-gradient(
      135deg,
      rgba(132, 102, 58, 0.028) 0,
      rgba(132, 102, 58, 0.028) 2px,
      transparent 2px,
      transparent 13px
    ),
    linear-gradient(145deg, #f6efdf 0%, #ebddc2 54%, #e0d0b4 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: 0;
}

body::before {
  top: 6%;
  left: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(173, 130, 73, 0.12), rgba(173, 130, 73, 0));
}

body::after {
  right: -90px;
  bottom: 6%;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(111, 43, 43, 0.11), rgba(111, 43, 43, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1720px;
  margin: 0 auto;
  padding: 18px 10px 42px 26px;
}

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

.settings-menu {
  position: absolute;
  top: 10px;
  right: 14px;
  z-index: 5;
}

.settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(141, 107, 58, 0.34);
  background: rgba(255, 250, 242, 0.92);
  color: #5e3f1a;
  box-shadow: var(--shadow-sm);
}

.settings-toggle-icon {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.settings-menu.open .settings-toggle {
  background: linear-gradient(135deg, #7d5724, #643f17);
  color: #fffaf2;
  border-color: rgba(99, 63, 23, 0.9);
}

.settings-toggle:hover {
  transform: none;
  filter: none;
}

.settings-panel {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 24px;
  color: var(--ink);
  border: 1px solid rgba(141, 107, 58, 0.28);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(246, 237, 221, 0.96));
  box-shadow: var(--shadow-lg);
}

.settings-panel::backdrop {
  background: rgba(35, 27, 20, 0.45);
}

body.settings-open,
body.contents-open {
  overflow: hidden;
}

.settings-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.settings-heading h2 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.8rem;
  line-height: 1.1;
}

.settings-close {
  flex: 0 0 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 1.4rem;
}

.settings-overview {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.settings-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.settings-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--gold-strong);
}

.settings-field {
  display: grid;
  gap: 8px;
}

.settings-field span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.settings-note {
  margin: 10px 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.86fr);
  gap: 16px;
  overflow: hidden;
  padding: 18px 22px;
  border: 1px solid rgba(141, 107, 58, 0.28);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  background:
    linear-gradient(135deg, rgba(255, 249, 240, 0.95), rgba(241, 226, 198, 0.9)),
    radial-gradient(circle at 78% 22%, rgba(184, 140, 79, 0.22), transparent 34%);
}

.hero::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -40px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(188, 149, 92, 0.28), rgba(188, 149, 92, 0));
}

.hero::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(153, 121, 77, 0.15);
  border-radius: 16px;
}

.hero-copy,
.hero-side {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
}

.hero-brand {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}

.hero-logo-wrap {
  width: clamp(118px, 14vw, 176px);
  aspect-ratio: 2752 / 1536;
  overflow: hidden;
  border: 1px solid rgba(146, 111, 65, 0.28);
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.84);
  box-shadow: var(--shadow-sm);
}

.hero-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-brand-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hero-kicker,
.section-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-strong);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  line-height: 0.98;
  color: #2f2418;
}

.hero-lede {
  margin: 0;
  max-width: 62ch;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.hero.hero-compact {
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 60px 12px 20px;
}

.hero-compact .hero-copy {
  gap: 8px;
}

.hero-compact .hero-brand {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.hero-compact .hero-logo-wrap {
  width: clamp(64px, 7vw, 96px);
  border-radius: 12px;
}

.hero-compact h1 {
  font-size: clamp(1.6rem, 2.5vw, 2rem);
  line-height: 1.05;
}

.hero-compact .hero-lede {
  max-width: none;
  font-size: 0.9rem;
}

.hero-compact .hero-subtitle {
  margin: 0;
  font-size: clamp(.9rem, 1.3vw, 1.05rem);
  line-height: 1.25;
  color: var(--ink);
}

.concordia-context { display: inline-block; margin: 8px 0; font-size: .78rem; color: var(--gold-strong); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(159, 123, 70, 0.33);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.72);
  color: #52381b;
  font-size: 0.84rem;
  font-weight: 700;
}

.hero-side {
  display: grid;
  gap: 10px;
  align-content: center;
}

.hero-note {
  padding: 16px 18px;
  border: 1px solid rgba(146, 111, 65, 0.24);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(248, 239, 225, 0.7));
  box-shadow: var(--shadow-sm);
}

.hero-note-label {
  display: block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.hero-note p {
  margin: 0;
  line-height: 1.6;
  color: var(--ink-soft);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-card {
  padding: 10px 12px;
  border: 1px solid rgba(160, 127, 80, 0.24);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.92), rgba(247, 238, 224, 0.82));
  box-shadow: var(--shadow-sm);
}

.metric-card-wide {
  grid-column: 1 / -1;
}

.metric-label {
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.metric-value {
  display: block;
  font-size: 0.94rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink);
  word-break: break-word;
}

.controls {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 250, 242, 0.88);
  backdrop-filter: blur(14px);
}

.controls-head {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: end;
}

.controls-head h2 {
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.95rem;
  line-height: 1;
  color: #342417;
}

.controls-head p:last-child {
  margin: 0;
  line-height: 1.55;
  color: var(--ink-soft);
}

.controls-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(220px, 0.95fr) minmax(180px, 0.78fr) auto;
  gap: 12px 14px;
  align-items: end;
  margin-top: 0;
}

.controls-grid > * {
  min-width: 0;
}

.control-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.control-field input,
.control-field select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.control-field span {
  padding-left: 2px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-muted);
}

input,
select,
button {
  min-height: 42px;
  border: 1px solid rgba(142, 110, 67, 0.35);
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 0.93rem;
  font-family: inherit;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    background-color 0.18s ease;
}

input,
select {
  background: rgba(255, 253, 248, 0.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

input::placeholder {
  color: #9d8669;
}

input:focus,
select:focus,
button:focus {
  outline: none;
  border-color: rgba(137, 97, 42, 0.62);
  box-shadow: 0 0 0 4px rgba(167, 126, 69, 0.18);
}

button {
  min-width: 108px;
  background: linear-gradient(135deg, #8f652a, #6b4519);
  color: #fffaf2;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 14px 26px rgba(82, 53, 18, 0.18);
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.active-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.summary-card {
  min-height: 0;
  padding: 9px 11px;
  border: 1px solid rgba(168, 132, 83, 0.22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 242, 228, 0.92));
}

.active-summary .summary-card-wide {
  grid-column: auto;
}

.summary-card span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.63rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.summary-card strong {
  display: block;
  margin-top: 4px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-card p {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 12px;
  align-items: stretch;
  height: var(--workspace-height);
  min-height: var(--workspace-height);
  max-height: var(--workspace-height);
  margin-top: 12px;
}

.panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(141, 107, 58, 0.28);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.96), rgba(248, 240, 227, 0.92));
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, rgba(151, 109, 53, 0.82), rgba(204, 177, 126, 0.66), rgba(111, 43, 43, 0.7));
}

.panel-head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.85fr);
  gap: 16px;
  align-items: end;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(181, 151, 107, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0));
}

.panel-head-tight {
  padding-bottom: 12px;
}

.panel-head h2 {
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.6rem;
  line-height: 1;
  color: #342417;
}

.panel-head p:last-child {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.paragraph-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.paragraph-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.contents-toggle {
  min-width: 0;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.contents-panel {
  width: min(760px, calc(100vw - 32px));
  overflow-y: auto;
}

.contents-panel .settings-heading {
  margin-bottom: 12px;
}

.contents-help {
  margin: 0 0 18px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.contents-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.contents-list .contents-list {
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.contents-list li + li {
  margin-top: 6px;
}

.contents-list summary {
  padding: 12px 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.contents-list summary:focus-visible,
.paragraph-card:focus-visible {
  outline: 2px solid var(--gold-strong);
  outline-offset: -2px;
}

.contents-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  width: 100%;
  min-width: 0;
  margin-bottom: 6px;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  box-shadow: none;
  font-size: 0.85rem;
  letter-spacing: normal;
  overflow-wrap: anywhere;
}

.contents-link[aria-current] {
  border-color: var(--gold-strong);
  background: var(--paper-strong);
}

.contents-range {
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 400;
  white-space: nowrap;
}

.paragraph-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.paragraph-pagination button {
  min-width: 0;
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.85rem;
}

.paragraph-pagination button:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  filter: none;
  box-shadow: none;
}

.paragraph-list {
  display: grid;
  gap: 12px;
  overflow: auto;
  min-height: 0;
  padding: 12px 14px 16px 16px;
}

.paragraph-list::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.paragraph-list::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(150, 116, 72, 0.35);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.paragraph-card {
  position: relative;
  padding: 16px 16px 14px;
  border: 1px solid rgba(183, 150, 101, 0.44);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.95), rgba(248, 239, 225, 0.92));
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.paragraph-card::before {
  content: "";
  position: absolute;
  inset: 12px auto 12px 0;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(161, 116, 52, 0.92), rgba(210, 181, 123, 0.72));
}

.paragraph-card:hover {
  transform: translateY(-2px);
  border-color: rgba(151, 109, 53, 0.62);
  box-shadow: 0 18px 30px rgba(61, 40, 17, 0.12);
}

.paragraph-card.active {
  border-color: rgba(111, 43, 43, 0.58);
  background: linear-gradient(180deg, rgba(255, 251, 246, 0.98), rgba(247, 235, 220, 0.94));
  box-shadow: 0 22px 34px rgba(61, 40, 17, 0.14);
}

.paragraph-card.active::before {
  background: linear-gradient(180deg, rgba(111, 43, 43, 0.96), rgba(177, 107, 89, 0.72));
}

.paragraph-card-static {
  cursor: default;
}

.paragraph-card-static:hover {
  transform: none;
  border-color: rgba(183, 150, 101, 0.44);
  box-shadow: var(--shadow-sm);
}

.paragraph-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 8px;
}

.paragraph-kicker {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.paragraph-title {
  margin-top: 4px;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 700;
  color: #2f2215;
}

.paragraph-count {
  flex-shrink: 0;
  padding: 7px 11px;
  border: 1px solid rgba(173, 137, 85, 0.38);
  border-radius: 999px;
  background: rgba(255, 249, 239, 0.9);
  font-size: 0.78rem;
  font-weight: 700;
  color: #654825;
}

.paragraph-taxonomy {
  margin-bottom: 10px;
  font-size: 0.8rem;
  line-height: 1.5;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b6740;
}

.paragraph-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  font-size: 1rem;
  line-height: 1.65;
  color: #2f261f;
}

.paragraph-card.active .paragraph-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.prologue-preface-card {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(245, 236, 219, 0.96));
}

.prologue-preface-body {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.prologue-preface-quote {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.68;
  color: #2f261f;
}

.reference-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.reference-chip {
  padding: 6px 11px;
  border: 1px solid rgba(181, 143, 86, 0.8);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.94);
  color: #58401d;
  font-size: 0.78rem;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.reference-chip[data-type="bible"] {
  border-color: rgba(83, 123, 75, 0.75);
  background: rgba(241, 250, 237, 0.96);
  color: #2b5a2c;
}

.reference-chip.active {
  border-color: rgba(90, 28, 28, 0.86);
  background: linear-gradient(135deg, #73463a, #5e2b2b);
  color: #fff9f2;
  box-shadow: 0 10px 18px rgba(67, 24, 24, 0.18);
}

.reference-chip:hover {
  transform: translateY(-1px);
}

.paragraph-empty {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.detail-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  min-width: 0;
}

.detail-tabs {
  display: flex;
  gap: 8px;
  padding: 10px 12px 0;
  border-bottom: 1px solid rgba(181, 151, 107, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0));
}

.detail-tab-btn {
  min-width: 0;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(181, 139, 77, 0.4);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: rgba(245, 235, 220, 0.92);
  color: #6b4a22;
  box-shadow: none;
}

.detail-tab-btn:hover {
  transform: none;
  filter: none;
}

.detail-tab-btn.active {
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(255, 248, 238, 0.98));
  color: #342417;
  border-color: rgba(181, 139, 77, 0.56);
}

.detail-tab-panels {
  min-height: 0;
  height: 100%;
}

.detail-tab-panel[hidden] {
  display: none !important;
}

.detail-tab-panel-reference {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  height: 100%;
}

.detail-tab-panel-detail {
  min-height: 0;
  height: 100%;
}

.detail-tab-panel-commentary {
  min-height: 0;
  height: 100%;
}

.reference-detail {
  height: 100%;
  min-height: 0;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0));
  font-size: 0.95rem;
  overflow-x: hidden;
  overflow-y: auto;
}

.reference-commentary {
  height: 100%;
  min-height: 0;
  padding: 16px;
  background:
    radial-gradient(circle at top right, rgba(198, 155, 88, 0.14), transparent 34%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(249, 241, 228, 0.9));
  overflow-x: hidden;
  overflow-y: auto;
}

.detail-empty {
  padding: 8px 0;
  color: var(--ink-soft);
}

.detail-empty p {
  margin: 0;
  line-height: 1.6;
}

.detail-empty-kicker {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-strong);
}

.reference-identity h3 {
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  line-height: 1.05;
  color: #2d2115;
}

.commentary-identity h3 {
  margin: 6px 0 0;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  line-height: 1.05;
  color: #2d2115;
}

.detail-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gold-strong);
}

.detail-context {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.commentary-topline {
  margin: 10px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.commentary-verse-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 16px 0 18px;
}

.commentary-verse-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(163, 128, 81, 0.46);
  background: rgba(255, 248, 238, 0.96);
  color: #6a4a24;
  font-size: 0.82rem;
  font-weight: 700;
}

.commentary-verse-chip:hover {
  transform: none;
  filter: none;
  background: rgba(249, 236, 214, 0.96);
}

.commentary-verse-chip.active {
  border-color: rgba(124, 77, 33, 0.78);
  background: linear-gradient(180deg, rgba(122, 77, 33, 0.96), rgba(92, 58, 24, 0.96));
  color: #fff8ef;
}

.commentary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 18px;
}

.commentary-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(181, 139, 77, 0.72);
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.98), rgba(245, 230, 204, 0.92));
  color: #523a1b;
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
}

.commentary-card {
  padding: 18px 18px 20px;
  border: 1px solid rgba(174, 143, 98, 0.38);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(249, 241, 227, 0.96)),
    repeating-linear-gradient(
      180deg,
      rgba(132, 98, 52, 0.025),
      rgba(132, 98, 52, 0.025) 28px,
      rgba(255, 255, 255, 0) 28px,
      rgba(255, 255, 255, 0) 56px
    );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
}

.commentary-source-line {
  margin: 0 0 12px;
  color: #75552d;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.commentary-body {
  color: #2f261f;
  font-size: 1rem;
  line-height: 1.8;
}

.commentary-body p {
  margin: 0;
}

.commentary-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(181, 151, 107, 0.28);
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.6;
}

.commentary-empty-note {
  padding: 16px 18px;
  border: 1px dashed rgba(171, 137, 88, 0.42);
  border-radius: 16px;
  background: rgba(255, 249, 239, 0.7);
  color: var(--ink-soft);
  line-height: 1.65;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid rgba(191, 167, 132, 0.82);
  border-radius: 999px;
  background: #fff7ea;
  color: #5c4220;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-status-resolved_local,
.badge-status-resolved_remote {
  border-color: #3e7d5f;
  background: #e8f6ee;
  color: #1f5b3f;
}

.badge-status-external_bible {
  border-color: #4f7391;
  background: #e8f2fb;
  color: #244d6a;
}

.badge-status-unresolved,
.badge-status-not_attempted,
.badge-status-download_failed {
  border-color: #9c4a42;
  background: #fdecea;
  color: #7d2921;
}

.badge-confidence-high {
  border-color: #2f6f4f;
  background: #e4f5ea;
  color: #205037;
}

.badge-confidence-medium {
  border-color: #8f6d29;
  background: #fbf2df;
  color: #664a16;
}

.badge-confidence-low {
  border-color: #9a4b46;
  background: #fdecea;
  color: #77231f;
}

.badge-source-official_vatican {
  border-color: #6d4c99;
  background: #f3ebff;
  color: #4b2f77;
}

.badge-source-catholic_archive,
.badge-source-historical_archive {
  border-color: #5c6d96;
  background: #eef2fb;
  color: #324566;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-grid > div {
  padding: 12px 13px;
  border: 1px solid rgba(183, 150, 101, 0.34);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.74);
}

.detail-grid-wide {
  grid-column: 1 / -1;
}

.detail-grid dt {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.detail-grid dd {
  margin: 0;
  line-height: 1.55;
  color: #2f261f;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.detail-actions a,
.detail-empty-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 0.83rem;
  font-weight: 700;
}

.detail-actions a {
  border: 1px solid rgba(181, 139, 77, 0.72);
  background: linear-gradient(180deg, rgba(255, 249, 239, 0.98), rgba(245, 230, 204, 0.92));
  color: #523a1b;
  text-decoration: none;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.detail-actions a:hover {
  background: #f2e3c7;
  transform: translateY(-1px);
}

.detail-empty-inline {
  border: 1px dashed rgba(173, 137, 85, 0.46);
  background: rgba(255, 250, 242, 0.7);
  color: var(--ink-muted);
}

.viewer-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid rgba(181, 151, 107, 0.34);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(247, 238, 225, 0.82));
}

.viewer-mode-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.viewer-mode-btn {
  min-width: 0;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(181, 139, 77, 0.55);
  background: rgba(255, 250, 240, 0.95);
  color: #5b4221;
  box-shadow: none;
  font-size: 0.75rem;
}

.viewer-mode-btn.active {
  background: linear-gradient(135deg, #7d5724, #643f17);
  color: #fffaf2;
  border-color: rgba(99, 63, 23, 0.9);
}

.viewer-toolbar-note {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--ink-soft);
  text-align: right;
}

#correctedPassageControl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--ink);
  font-size: 0.85rem;
}

#correctedPassageControl select {
  max-width: 100%;
  color: var(--ink);
  background: var(--surface, var(--paper));
}

.viewer-shell {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
  background: #fff;
}

#resourceFrame {
  --viewer-scale: 0.72;
  width: calc(100% / var(--viewer-scale));
  height: calc(100% / var(--viewer-scale));
  min-height: 0;
  border: none;
  background: #fff;
  display: block;
  transform: scale(var(--viewer-scale));
  transform-origin: top left;
}

#resourceFrame[hidden], .viewer-toolbar[hidden] {
  display: none;
}

#externalSourceNotice {
  padding: 24px;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

#externalSourceNotice h3 { margin-top: 0; }
#externalSourceNotice a { color: var(--ink); text-decoration: underline; }

.graph-panel,
.discrepancy-panel {
  margin-top: 14px;
}

.report-shell {
  max-width: 1320px;
}

.report-layout {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.report-panel {
  margin-top: 0;
}

.graph-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 320px) auto minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid rgba(181, 151, 107, 0.2);
  border-bottom: 1px solid rgba(181, 151, 107, 0.34);
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(247, 238, 225, 0.82));
}

.graph-zoom-control {
  display: grid;
  gap: 6px;
}

.graph-zoom-control span {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.graph-zoom-control input[type="range"] {
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.graph-zoom-value {
  justify-self: start;
  min-width: 60px;
  padding: 7px 10px;
  border: 1px solid rgba(173, 137, 85, 0.34);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.88);
  font-size: 0.83rem;
  font-weight: 700;
  color: #5f3f18;
  text-align: center;
}

.graph-toolbar-note {
  margin: 0;
  justify-self: end;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  text-align: right;
}

#graph {
  height: 660px;
  border-radius: 0 0 var(--radius) var(--radius);
  background:
    radial-gradient(circle at 50% 0%, rgba(194, 150, 84, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(
      90deg,
      rgba(162, 129, 85, 0.06) 0,
      rgba(162, 129, 85, 0.06) 1px,
      transparent 1px,
      transparent 42px
    ),
    #fffefb;
}

.discrepancy-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 16px;
}

.summary-stat {
  padding: 14px 15px;
  border: 1px solid rgba(168, 132, 83, 0.24);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 242, 228, 0.92));
}

.summary-stat span {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.summary-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.15rem;
  color: #5f311f;
}

.summary-stat p {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid rgba(181, 151, 107, 0.34);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(189, 160, 120, 0.32);
  text-align: left;
  vertical-align: top;
  font-size: 0.87rem;
  line-height: 1.5;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7efde;
  color: #654726;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
}

tbody tr:nth-child(even) {
  background: rgba(255, 250, 241, 0.82);
}

tbody a {
  color: #7a5016;
  font-weight: 700;
  text-decoration: none;
}

tbody a:hover {
  text-decoration: underline;
}

.page-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.page-footer-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(141, 107, 58, 0.3);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.94), rgba(243, 231, 207, 0.9));
  box-shadow: var(--shadow-sm);
  color: #5a3d19;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.page-footer-link:hover {
  text-decoration: underline;
}

.embedded-report-panel {
  margin-top: 0;
}

.embedded-report-note {
  margin: 0;
  padding: 0 18px 16px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.embedded-report-frame-wrap {
  padding: 0 18px 18px;
}

.embedded-report-frame {
  display: block;
  width: 100%;
  height: clamp(620px, 76vh, 820px);
  border: 1px solid rgba(181, 151, 107, 0.34);
  border-radius: 18px;
  background: #fffefb;
}

.empty-note {
  color: #786146;
}

.empty-state {
  padding: 20px 18px;
  border: 1px dashed rgba(173, 137, 85, 0.46);
  border-radius: 16px;
  background: rgba(255, 251, 245, 0.78);
  color: var(--ink-soft);
}

.empty-state strong {
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--gold-strong);
}

.empty-state p {
  margin: 8px 0 0;
  line-height: 1.55;
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  }

  .hero {
    grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.9fr);
  }
}

@media (max-width: 1080px) {
  body::before,
  body::after {
    display: none;
  }

  .app-shell {
    padding: 20px 16px 40px;
  }

  .hero,
  .panel-head,
  .layout {
    grid-template-columns: 1fr;
  }

  .paragraph-heading {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .layout {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls-grid {
    grid-template-columns: 1fr 1fr;
  }

  .active-summary,
  .discrepancy-summary {
    grid-template-columns: 1fr 1fr;
  }

  .graph-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .graph-toolbar-note {
    grid-column: 1 / -1;
    justify-self: start;
    text-align: left;
  }

  .paragraph-list {
    max-height: 58vh;
  }

  .summary-card-wide {
    grid-column: auto;
  }

  .viewer-shell {
    height: 620px;
  }

  #resourceFrame {
    --viewer-scale: 0.7;
    height: calc(100% / var(--viewer-scale));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px 12px 32px;
  }

  .settings-menu {
    top: 6px;
    right: 12px;
  }

  .settings-panel {
    padding: 18px;
  }

  .hero.hero-compact {
    padding: 12px;
  }

  .hero-compact .hero-brand {
    padding-right: 28px;
    gap: 10px;
  }

  .hero {
    padding: 16px;
  }

  .hero-brand {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-logo-wrap {
    width: min(100%, 180px);
  }

  .hero:not(.hero-compact) h1 {
    font-size: clamp(2.2rem, 11vw, 3rem);
  }

  .hero-metrics,
  .controls-grid,
  .active-summary,
  .detail-grid,
  .discrepancy-summary {
    grid-template-columns: 1fr;
  }

  .controls {
    padding: 12px;
  }

  .panel-head {
    padding: 18px 18px 12px;
  }

  .paragraph-list {
    max-height: 58vh;
    padding: 12px;
  }

  .paragraph-meta {
    flex-direction: column;
    align-items: start;
  }

  .reference-detail {
    padding: 16px 16px 18px;
  }

  .graph-toolbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .graph-toolbar-note {
    justify-self: start;
    text-align: left;
  }

  .page-footer-nav {
    justify-content: stretch;
  }

  .page-footer-link {
    width: 100%;
  }

  .detail-tabs {
    flex-wrap: wrap;
    padding: 8px 12px 0;
  }

  .detail-tab-btn {
    flex: 1 1 180px;
  }

  .detail-grid-wide {
    grid-column: auto;
  }

  .viewer-toolbar {
    flex-direction: column;
    align-items: start;
  }

  .viewer-toolbar-note {
    text-align: left;
  }

  th,
  td {
    padding: 10px 12px;
  }

  #graph {
    height: 520px;
  }

  .viewer-shell {
    height: 460px;
  }

  #resourceFrame {
    --viewer-scale: 1;
    width: 100%;
    height: 100%;
    transform: none;
  }
}
