:root {
  --font: "Firman Sans", "Noto Sans", "MiSans Latin VF", "MiSans VF",
    "MiSans", "Xiaomi Sans", "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --ink: #111111;
  --muted: #666666;
  --accent: #ad7935;
  --accent-dark: #77501f;
  --accent-soft: #f6eee2;
  --paper: #ffffff;
  --surface: #f7f7f7;
  --line: #dedede;
}

@font-face {
  font-family: "Firman Sans";
  src: url("/fonts/NotoSans-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Firman Sans";
  src: url("/fonts/NotoSans-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
}

@font-face {
  font-family: "Firman Sans";
  src: url("/fonts/NotoSans-Italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Firman Sans";
  src: url("/fonts/NotoSans-BoldItalic.ttf") format("truetype");
  font-style: italic;
  font-weight: 500 800;
  font-display: swap;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font);
}

button, select, input { font: inherit; }
button, select { cursor: pointer; }

.site-header {
  min-height: 92px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 13px; }
.brand small { margin-top: 3px; font-size: 9px; color: var(--muted); }
.brand-logo {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: cover;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .13);
}

.search-toggle {
  min-height: 40px;
  padding: 0 18px;
  color: #fff;
  background: #171717;
  border: 1px solid #171717;
  border-radius: 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  line-height: 1;
  text-transform: uppercase;
}
.search-toggle:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.hero {
  max-width: 1120px;
  margin: 0 auto;
  padding: 76px 32px 58px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
}

.hero h1 {
  margin: 0;
  font: 650 clamp(48px, 7vw, 86px)/.98 var(--font);
  letter-spacing: -.055em;
}

.hero h1 span { color: var(--accent-dark); font-weight: 650; }
.hero-copy { max-width: 580px; margin: 28px auto 0; color: var(--muted); line-height: 1.7; }

.reader-shell {
  max-width: 1280px;
  margin: 0 auto 80px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .07);
  overflow: clip;
}

.reader-toolbar {
  min-height: 92px;
  display: grid;
  grid-template-columns: 1fr 1.6fr .7fr;
  align-items: end;
  gap: 24px;
  padding: 20px 36px;
  border-bottom: 1px solid var(--line);
}

.reader-toolbar label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.reader-toolbar select {
  width: 100%;
  padding: 8px 28px 8px 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
  font-weight: 600;
}

.reader-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.passage { min-height: 720px; padding: 48px clamp(30px, 6vw, 82px) 70px; }

.passage-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.passage-heading h2 {
  margin: 0;
  font: 650 clamp(38px, 5vw, 56px)/1 var(--font);
  letter-spacing: -.04em;
}

.chapter-nav { display: flex; gap: 10px; }
.chapter-nav button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: linear-gradient(180deg, #fff 0%, #f8f3eb 100%);
  border: 1px solid rgba(173, 121, 53, .24);
  border-radius: 50%;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .07);
  transition: transform .16s ease, box-shadow .16s ease, color .16s ease, background .16s ease;
}
.chapter-nav button span {
  display: block;
  margin-top: -2px;
  font-size: 0;
  font-weight: 500;
  line-height: 1;
}

.chapter-nav button span::before {
  font-size: 32px;
}

#prevChapter span::before,
#prevChapterBottom span::before {
  content: "\2039";
}

#nextChapter span::before,
#nextChapterBottom span::before {
  content: "\203A";
}

.chapter-nav-bottom {
  justify-content: center;
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.chapter-nav button:hover {
  color: white;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 14px 30px rgba(119, 80, 31, .24);
  transform: translateY(-1px);
}
.chapter-nav button:active {
  transform: translateY(0) scale(.96);
  box-shadow: 0 6px 14px rgba(119, 80, 31, .18);
}

.verses {
  padding-top: 28px;
  font: 400 20px/1.9 var(--font);
  letter-spacing: -.01em;
}
.verse { display: inline; transition: background .2s; }
.verse.selected { background: var(--accent-soft); }
.verse-actions {
  position: fixed;
  z-index: 20;
  transform: translate(-50%, -100%);
  display: flex;
  overflow: visible;
  background: #171717;
  border: 1px solid #171717;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}
.verse-actions button {
  min-height: 34px;
  padding: 0 13px;
  color: #fff;
  background: transparent;
  border: 0;
  font: 700 10px/1 var(--font);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.verse-actions button + button {
  border-left: 1px solid rgba(255, 255, 255, .18);
}
.verse-actions::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 10px;
  height: 10px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}
.verse-actions.copied {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.verse-actions[hidden] { display: none; }
.verse-number {
  padding: 0;
  margin: 0 7px 0 3px;
  color: var(--accent);
  background: none;
  border: 0;
  font: 650 10px var(--font);
  vertical-align: super;
}

.original-word {
  display: inline;
  padding: 0 1px;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px dotted rgba(173, 121, 53, .8);
  font: inherit;
  line-height: inherit;
}
.original-word.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-bottom-style: solid;
}

@media (hover: hover) and (pointer: fine) {
  .original-word:hover {
    color: var(--accent-dark);
    background: var(--accent-soft);
    border-bottom-style: solid;
  }
}

.loading { color: var(--muted); font-family: var(--font); font-size: 14px; }
.net-label {
  margin-left: 4px;
  color: var(--accent-dark);
  font: 650 9px var(--font);
  text-decoration: none;
  vertical-align: super;
}
.net-label:hover { text-decoration: underline; }
.net-attribution {
  margin: 40px 0 0;
  padding-top: 20px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.6;
}
.net-attribution a { color: var(--accent-dark); font-weight: 650; }

.study-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 48px 32px;
  color: var(--ink);
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-radius: 0 0 23px 0;
  scrollbar-width: thin;
  scrollbar-color: #c8c8c8 transparent;
}

.study-panel .eyebrow { color: var(--accent); }
.study-panel h3 { margin: 0 0 18px; font: 650 30px/1.08 var(--font); letter-spacing: -.03em; }
.study-panel > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.7; }

.drawer-handle,
.quick-version {
  display: none;
}

.study-placeholder {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 18px 12px;
  margin-top: 42px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.study-placeholder span {
  align-self: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .02em;
}
.study-placeholder p { margin: 0; font: 650 18px/1.25 var(--font); }
.study-placeholder button {
  align-self: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font: 650 18px/1.25 var(--font);
  text-align: left;
}
.study-placeholder button:hover { color: var(--accent-dark); }
.summary-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 18px;
  margin: 4px 0 12px;
}
.summary-video {
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.summary-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
}
.summary-video p {
  margin: 0;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.explanation-details {
  grid-column: 1 / -1;
  margin: 4px 0 12px;
}
.explanation-card {
  display: grid;
  gap: 12px;
}
.explanation-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-decoration-color: rgba(173, 121, 53, .45);
  text-underline-offset: 4px;
}
.explanation-title:hover { color: var(--accent-dark); }
.explanation-image-link {
  display: block;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .08);
}
.explanation-image-link img {
  width: 100%;
  display: block;
}
.explanation-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.key-points-details {
  grid-column: 1 / -1;
  margin: 4px 0 12px;
}
.key-points-card {
  display: grid;
  gap: 12px;
  padding: 2px 0 0;
}
.key-point {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 10px;
  align-items: start;
}
.key-point-picker {
  position: relative;
}
.key-point-picker summary {
  min-height: 34px;
  padding: 0 26px 0 11px;
  display: grid;
  align-items: center;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid rgba(173, 121, 53, .35);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.key-point-picker summary::-webkit-details-marker { display: none; }
.key-point-picker summary::after {
  content: "⌄";
  position: absolute;
  right: 10px;
  top: 7px;
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
}
.key-point-picker[open] summary {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.key-point-picker[open] summary::after { color: #fff; }
.key-point-choices {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 4;
  min-width: 100%;
  padding: 7px;
  display: grid;
  gap: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .14);
}
.key-point-choice {
  min-height: 30px;
  padding: 0 10px;
  color: var(--accent-dark);
  background: #fff;
  border: 1px solid rgba(173, 121, 53, .35);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
}
.key-point-choice:hover {
  color: #fff;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}
.key-point-choice.correct {
  color: #fff;
  background: #2f7d45;
  border-color: #2f7d45;
}
.key-point-choice.wrong {
  color: #9b2f2f;
  background: #fff1f1;
  border-color: rgba(155, 47, 47, .35);
}
.key-point-text {
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.key-point-text strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
}
.key-point-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.key-point.answered-correct .key-point-text {
  background: #edf8f0;
  border-color: rgba(47, 125, 69, .35);
}
.key-point.answered-correct .key-point-text strong {
  color: #1f5e35;
}
.key-point.answered-correct .key-point-text p {
  color: #2f6b42;
}
.key-points-summary {
  margin-top: 6px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.key-points-summary strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: 12px;
}
.key-points-summary p {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}
.original-details { display: grid; gap: 14px; margin-top: 28px; }
.lex-entry {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.lex-entry:first-child { border-top: 0; padding-top: 0; }
.lex-language {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.lex-lemma { margin: 0; font: 650 32px/1.15 var(--font); }
.lex-translit { margin: 5px 0 14px; color: var(--muted); font-size: 13px; }
.lex-grid { display: grid; grid-template-columns: 88px 1fr; gap: 8px; font-size: 12px; }
.lex-grid dt { color: var(--muted); }
.lex-grid dd { margin: 0; color: var(--ink); line-height: 1.5; }

dialog {
  width: min(850px, calc(100vw - 32px));
  max-height: 84vh;
  padding: 34px;
  background: var(--paper);
  border: 0;
  border-radius: 20px;
  box-shadow: 0 30px 100px rgba(0,0,0,.3);
}
dialog::backdrop { background: rgba(18, 27, 22, .65); backdrop-filter: blur(5px); }
.search-header { display: flex; justify-content: space-between; align-items: start; }
.search-header h2 { margin: 0; font: 650 28px/1.15 var(--font); letter-spacing: -.03em; }
.search-header button,
.compare-header button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: none;
  border: 0;
  font-size: 0;
  line-height: 1;
}
.search-header button::before,
.compare-header button::before {
  content: "\00D7";
  font-size: 30px;
  font-weight: 400;
}
.search-controls { margin: 28px 0 10px; }
.search-scope {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}
.search-scope span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.search-scope select {
  width: 100%;
  padding: 9px 32px 9px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.search-box { display: grid; gap: 10px; }
.search-box input { width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; }
.search-box button {
  min-height: 44px;
  padding: 0 24px;
  color: white;
  background: var(--ink);
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}
.search-status { color: var(--muted); font-size: 12px; }
.search-results { display: grid; gap: 10px; overflow: auto; }
.search-result {
  padding: 16px;
  text-align: left;
  background: var(--surface);
  border: 0;
  border-radius: 10px;
}
.search-result strong { display: block; margin-bottom: 5px; color: var(--accent-dark); }

.compare-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}
.compare-header h2 { margin: 0; font: 650 28px/1.15 var(--font); letter-spacing: -.03em; }
.compare-body {
  display: grid;
  gap: 0;
  margin-top: 22px;
}
.compare-verse {
  padding: 0 0 18px;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.compare-verse + .compare-verse {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.compare-verse h3 {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font: 750 13px/1.2 var(--font);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.compare-verse p {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
}

body.image-viewer-open,
body.compare-dialog-open {
  overflow: hidden;
}
.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #0c0c0c;
}
.image-viewer[hidden] { display: none; }
.image-viewer-toolbar {
  min-height: calc(56px + env(safe-area-inset-top));
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,.78), rgba(0,0,0,.12));
}
.image-viewer-toolbar button {
  min-width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: linear-gradient(180deg, #fff 0%, #f8f3eb 100%);
  border: 1px solid rgba(173, 121, 53, .24);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
  backdrop-filter: blur(8px);
  transition: transform .16s ease, box-shadow .16s ease, color .16s ease, background .16s ease;
}
.image-viewer-toolbar button:hover {
  color: white;
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .34);
  transform: translateY(-1px);
}
.image-viewer-toolbar button:active {
  transform: translateY(0) scale(.96);
}
#closeImageViewer {
  width: 48px;
  height: 48px;
}
#closeImageViewer span {
  display: block;
  margin-top: -2px;
  font-size: 32px;
  font-weight: 500;
  line-height: 1;
}
#shareImageViewer {
  min-height: 44px;
  padding: 0 16px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .12em;
}
.image-viewer-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 10px 0 calc(18px + env(safe-area-inset-bottom));
}
.image-viewer-stage img {
  width: 100%;
  height: auto;
  display: block;
}

@media (max-width: 900px) {
  .reader-shell { margin: 0 16px 40px; }
  .reader-grid { grid-template-columns: 1fr; }
  .study-panel {
    position: static;
    max-height: none;
    min-height: 320px;
    overflow: visible;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 0 0 23px 23px;
  }
}

@media (max-width: 620px) {
  .site-header { min-height: 76px; }
  .brand-logo { width: 52px; height: 52px; border-radius: 11px; }
  .hero { padding: 58px 22px 40px; }
  .hero h1 { font-size: 48px; }
  .reader-toolbar { grid-template-columns: minmax(0, 1fr) 96px; gap: 16px; padding: 20px; }
  .reader-toolbar label:first-child { grid-column: 1 / -1; grid-row: 2; }
  .book-field { grid-column: 1; grid-row: 1; }
  .reader-toolbar label:last-child { grid-column: 2; grid-row: 1; }
  .passage { padding: 34px 22px calc(38dvh + 50px); }
  .passage-heading { align-items: center; }
  .chapter-nav { gap: 8px; }
  .chapter-nav button { width: 42px; height: 42px; }
  .chapter-nav button span { font-size: 0; }
  .chapter-nav button span::before { font-size: 28px; }
  .verses { font-size: 19px; }
  .study-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    height: var(--drawer-height, 33dvh);
    min-height: 72px;
    max-height: 76dvh;
    overflow-y: auto;
    padding: 10px 22px calc(24px + env(safe-area-inset-bottom));
    background: rgba(247, 247, 247, .97);
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    box-shadow: 0 -18px 50px rgba(0, 0, 0, .16);
    backdrop-filter: blur(10px);
    transition: height .22s ease;
    will-change: height;
  }
  .study-panel.drawer-dragging {
    transition: none;
    user-select: none;
  }
  .drawer-handle {
    position: sticky;
    top: -10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% + 44px);
    height: 28px;
    margin: -10px -22px 8px;
    padding: 0;
    background: rgba(247, 247, 247, .98);
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, .04);
    cursor: ns-resize;
    touch-action: none;
  }
  .drawer-handle::before {
    content: "";
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: #c9c1b7;
  }
  .quick-version {
    position: absolute;
    top: 40px;
    right: 18px;
    z-index: 3;
    display: grid;
    gap: 3px;
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
  }
  .quick-version select {
    min-width: 66px;
    height: 30px;
    padding: 0 22px 4px 0;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    outline: none;
    font: 750 14px/1 var(--font);
    box-shadow: none;
  }
  .study-panel[data-drawer-state="collapsed"] {
    overflow: hidden;
  }
  .study-panel h3 { margin-bottom: 10px; font-size: 24px; }
  .study-panel > p:not(.eyebrow) { font-size: 12px; line-height: 1.55; }
  .study-placeholder {
    margin-top: 12px;
    padding-top: 12px;
    gap: 14px 10px;
  }
  .summary-details { gap: 12px; }
  .key-point {
    grid-template-columns: 82px 1fr;
    gap: 8px;
  }
  .key-point-picker summary {
    min-height: 32px;
    padding-left: 10px;
    font-size: 9px;
  }
  .brand small { display: none; }
  .search-toggle {
    min-height: 36px;
    padding: 0 13px;
    border-radius: 15px;
    font-size: 9px;
    letter-spacing: .1em;
  }
  dialog { padding: 30px 28px; }
  .search-header h2 { font-size: 26px; }
}
