@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-ext.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-ext-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-latin.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3-latin-ext.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f3eee4;
  --paper-2: #faf6ef;
  --ink: #221c16;
  --ink-soft: #655c51;
  --rule: #e2d5c4;
  --oxblood: #6f2c2c;
  --oxblood-ink: #f6f0e7;
  --gold: #8d6a32;
  --gold-wash: #f0e2c4;
  --pick: #efe0bf;
  --shadow: 0 18px 50px rgba(55, 36, 16, 0.12);
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Noto Serif", "Noto Naskh Arabic", "Times New Roman", serif;
  --sans: "Source Sans 3", "Avenir Next", "Segoe UI", sans-serif;
  --verse-size: 21px;
  --header: 64px;
  color-scheme: light;
}

html[data-theme="dark"] {
  --paper: #141210;
  --paper-2: #1d1a16;
  --ink: #ece4d6;
  --ink-soft: #b7ab9a;
  --rule: #322c26;
  --oxblood: #e7b6a6;
  --oxblood-ink: #2a1614;
  --gold: #d4b483;
  --gold-wash: #3a3124;
  --pick: #3d3428;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 420px at 12% -10%, rgba(141, 106, 50, 0.09), transparent 55%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--oxblood); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: #e4d0a4; color: inherit; }
html[data-theme="dark"] ::selection { background: #5a4a30; }

.top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--header);
  padding: 0.45rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 12;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
  padding: 0.1rem 0.2rem 0.1rem 0;
}
.brand .sigil {
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  border-radius: 6px;
  box-shadow: 0 0 0 1px var(--rule);
}
.brand-name {
  font-family: var(--serif);
  font-weight: 560;
  font-size: 1.05rem;
  line-height: 1.05;
  letter-spacing: -0.015em;
}
.brand-name em {
  font-style: italic;
  font-weight: 480;
  color: var(--oxblood);
}
.brand-name small {
  display: block;
  margin-top: 0.12rem;
  font-family: var(--sans);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.chip, .tool, .notes-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.38rem 0.6rem;
  white-space: nowrap;
}
.chip { border-color: var(--rule); background: var(--paper-2); }
.chip strong { font-weight: 600; }
.chip .caret { color: var(--ink-soft); font-size: 0.75rem; margin-left: 0.2rem; }
.tool:hover, .chip:hover, .notes-btn:hover { background: var(--gold-wash); }
.tool[aria-pressed="true"] { background: var(--gold-wash); border-color: var(--gold); }
.notes-btn { font-weight: 600; }
.notes-btn .badge {
  display: inline-block;
  min-width: 1.3rem;
  text-align: center;
  background: var(--oxblood);
  color: var(--oxblood-ink);
  border-radius: 99px;
  font-size: 0.75rem;
  padding: 0 0.35rem;
  margin-left: 0.2rem;
}
.search { position: relative; flex: 1; min-width: 8rem; }
.search input {
  width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.48rem 0.7rem;
}
.results {
  position: absolute;
  z-index: 16;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  max-height: min(60vh, 28rem);
  overflow: auto;
  box-shadow: var(--shadow);
}
.hit, .status-row {
  display: block;
  width: 100%;
  text-align: start;
  background: none;
  border: 0;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
.hit:last-child { border-bottom: 0; }
.hit small, .status-row { color: var(--ink-soft); display: block; }
.hit:hover, .hit.active { background: var(--gold-wash); }
.hit mark { background: #ead7a2; color: inherit; border-radius: 2px; padding: 0 0.05em; }
html[data-theme="dark"] .hit mark { background: #5c4b32; }
.tools { display: flex; align-items: center; gap: 0.1rem; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22.5rem;
}
@media (min-width: 1181px) {
  #app { height: 100dvh; }
}
body.is-compare .workspace { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 20rem; }
.reading, .compare-col, .desk { min-height: 0; overflow: auto; }
.compare-col { border-left: 1px solid var(--rule); background: color-mix(in srgb, var(--paper) 90%, var(--gold-wash)); }
.desk {
  border-left: 1px solid var(--rule);
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  padding: 0.9rem 0.9rem 1rem;
}

.page { max-width: 42rem; margin: 0 auto; padding: 1.6rem 1.3rem 4.5rem; }
.compare-col .page { padding-top: 1.1rem; }
.hero { margin-bottom: 1.1rem; }
.kicker {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: clamp(3rem, 6vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin: 0.12em 0 0.15em;
}
.version-name { margin: 0; color: var(--ink-soft); font-size: 0.95rem; }
.audio { display: flex; gap: 0.4rem; align-items: center; margin-top: 0.7rem; }
.audio select, .listen {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
}
.scripture {
  font-family: var(--serif);
  font-size: var(--verse-size);
  line-height: 1.68;
  font-weight: 430;
}
.scripture .h {
  font-family: var(--sans);
  font-size: 0.72em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--oxblood);
  font-weight: 650;
  margin: 1.5em 0 0.45em;
}
.scripture .subhead {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 450;
  font-size: 0.92em;
  color: var(--ink-soft);
  margin: -0.2em 0 0.8em;
}
.para { margin: 0 0 0.9em; }
.verse { }
.vnum {
  font-family: var(--sans);
  font-size: 0.62em;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--gold);
  vertical-align: super;
  margin-right: 0.28em;
  border: 0;
  background: none;
  padding: 0 0.08em;
  user-select: none;
}
.scripture[dir="rtl"] .vnum { margin-right: 0; margin-left: 0.28em; }
.verse.picked .vnum { color: var(--oxblood); }
.verse.picked .vtext {
  background: var(--pick);
  border-radius: 0.16em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.verse.target .vtext { animation: arrive 1.8s ease; }
@keyframes arrive {
  from { background: var(--gold-wash); }
  to { background: transparent; }
}
.verse.picked.target .vtext { animation: none; }
.verse:has(.ln) {
  display: grid;
  grid-template-columns: 1.7em minmax(0, 1fr);
  column-gap: 0.4em;
  margin: 0.12em 0 0.28em;
}
.verse:has(.ln) .vnum { margin: 0.15em 0 0; text-align: end; align-self: start; }
.vtext .ln { display: block; }
.vtext .ln.p2 { padding-inline-start: 1.25em; }
.vtext .ln.p3 { padding-inline-start: 2.5em; }
.vtext .ln.p4 { padding-inline-start: 3.75em; }
.note {
  font-family: var(--sans);
  font-size: 0.65em;
  vertical-align: super;
  color: var(--gold);
  background: none;
  border: 0;
  padding: 0 0.15em;
  user-select: none;
}
.scripture.verse-mode .verse {
  display: block;
  margin: 0.28em 0;
  padding: 0.08em 0.15em;
}
.turn {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 2.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.turn button {
  background: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.55rem 0.8rem;
  max-width: 48%;
  text-align: start;
}
.turn button span { display: block; color: var(--ink-soft); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; }
.turn .next { margin-left: auto; text-align: end; }
.quiet { color: var(--ink-soft); font-size: 0.85rem; margin-top: 1.4rem; }
.quiet a { color: var(--ink-soft); }
.colophon {
  margin: 2.4rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}
.colophon strong { color: var(--ink); font-weight: 650; }
.colophon a { color: inherit; }

.desk-head { display: flex; flex-direction: column; gap: 0.55rem; }
.desk-head h2 {
  font-family: var(--serif);
  font-weight: 520;
  font-size: 1.55rem;
  margin: 0;
  letter-spacing: -0.02em;
}
.primary, .ghost {
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  border: 1px solid transparent;
}
.primary { background: var(--oxblood); color: var(--oxblood-ink); font-weight: 650; }
html[data-theme="dark"] .primary { background: #8d3d36; color: #f6efe6; }
.primary:disabled, .ghost:disabled { opacity: 0.45; cursor: default; }
.ghost { background: transparent; border-color: var(--rule); }
.hint, .empty { color: var(--ink-soft); font-size: 0.92rem; }
.empty { margin-top: 0.4rem; }
.cards { list-style: none; margin: 0.4rem 0; padding: 0; overflow: auto; }
.card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.55rem 0.65rem 0.5rem;
  margin-bottom: 0.5rem;
  background: var(--paper);
}
.card.dragging { opacity: 0.45; }
.card-top { display: flex; align-items: flex-start; gap: 0.3rem; }
.card-ref {
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  color: var(--oxblood);
  flex: 1;
}
.card-text {
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.45;
  margin: 0.28rem 0 0.15rem;
  white-space: pre-wrap;
}
.card-actions { display: flex; gap: 0.15rem; }
.icon {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0 0.3rem;
  line-height: 1.4;
}
.icon:hover { background: var(--gold-wash); color: var(--ink); }
.desk-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--rule);
  font-size: 0.88rem;
}
.desk-foot label {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.desk-foot label input { margin-top: 0.2rem; flex: none; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(28, 22, 16, 0.48);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 4vh 4vw;
}
.sheet {
  background: var(--paper-2);
  color: var(--ink);
  width: min(980px, 100%);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.sheet header, .sheet-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
}
.sheet header h2, .sheet h2 { font-family: var(--serif); font-weight: 520; margin: 0; font-size: 1.4rem; }
.sheet header input, .finder {
  flex: 1;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.45rem 0.65rem;
}
.sheet-body { display: grid; grid-template-columns: 1fr 1fr; min-height: 0; overflow: hidden; flex: 1; }
.col { overflow: auto; padding: 0.6rem 0.8rem 1.2rem; }
.col + .col { border-left: 1px solid var(--rule); }
.group-label {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0.8rem 0.3rem 0.25rem;
}
.book-list button, .lang-list button, .trans-list button, .ch-grid button {
  background: none;
  border: 0;
  border-radius: 8px;
  text-align: start;
}
.book-list button, .lang-list button { display: block; width: 100%; padding: 0.38rem 0.5rem; }
.book-list button.on, .lang-list button.on, .trans-list button.on, .ch-grid button.on,
.book-list button:hover, .lang-list button:hover, .trans-list button:hover, .ch-grid button:hover {
  background: var(--gold-wash);
}
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.7rem, 1fr)); gap: 0.35rem; }
.ch-grid button {
  aspect-ratio: 1;
  text-align: center;
  border: 1px solid var(--rule);
  font-variant-numeric: tabular-nums;
}
.ch-grid button.on { background: var(--oxblood); color: var(--oxblood-ink); border-color: transparent; }
.trans-list button {
  display: flex;
  gap: 0.7rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  align-items: baseline;
}
.trans-list .abbr {
  font-weight: 700;
  min-width: 4.2rem;
  color: var(--oxblood);
  font-variant-numeric: tabular-nums;
}
.trans-list small, .scope { color: var(--ink-soft); display: block; }
.prose { padding: 0.4rem 1.1rem 1.4rem; overflow: auto; max-width: 42rem; }
.prose p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.55; }
.sample {
  font-family: var(--serif);
  background: var(--paper);
  border-left: 3px solid var(--oxblood);
  padding: 0.6rem 0.8rem;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  z-index: 40;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  padding: 0.6rem 0.7rem 0.6rem 0.9rem;
  display: flex;
  gap: 0.7rem;
  align-items: center;
  box-shadow: var(--shadow);
}
.toast button { background: transparent; color: inherit; border: 1px solid color-mix(in srgb, var(--paper) 40%, transparent); border-radius: 6px; padding: 0.2rem 0.5rem; }
.float {
  position: fixed;
  z-index: 25;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.float button { background: none; color: inherit; border: 0; padding: 0.5rem 0.75rem; }
.note-pop {
  position: fixed;
  z-index: 26;
  max-width: min(22rem, calc(100vw - 1.5rem));
  background: var(--paper-2);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  box-shadow: var(--shadow);
  font-size: 0.95rem;
}
.scrim { position: fixed; inset: 0; z-index: 18; background: rgba(20, 16, 12, 0.4); border: 0; }
.skel-line, .skel-title {
  height: 0.8rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--rule), var(--gold-wash), var(--rule));
  background-size: 200% 100%;
  animation: sheen 1.2s linear infinite;
  margin: 0.7rem 0;
}
.skel-title { height: 2.4rem; width: 30%; }
.skel-line:nth-child(odd) { width: 96%; }
.skel-line:nth-child(even) { width: 88%; }
@keyframes sheen { to { background-position: -200% 0; } }
.miss { padding: 2rem 1.2rem; max-width: 36rem; margin: 0 auto; }
.miss h2 { font-family: var(--serif); font-weight: 520; }

@media (max-width: 1180px) {
  .workspace, body.is-compare .workspace { display: block; height: auto; overflow: visible; }
  body { height: auto; }
  .reading, .compare-col { overflow: visible; }
  .desk {
    position: fixed;
    z-index: 20;
    left: 0; right: 0; bottom: 0;
    height: min(78dvh, 680px);
    border-left: 0;
    border-top: 1px solid var(--rule);
    border-radius: 14px 14px 0 0;
    transform: translateY(110%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  body.desk-open .desk { transform: translateY(0); }
  .scrim { display: none; }
  body.desk-open .scrim { display: block; }
}
@media (min-width: 1181px) {
  .scrim { display: none !important; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; padding: 0.4rem 0.6rem; }
  .brand-name small { display: none; }
  .brand-name { font-size: 0.98rem; }
  .tools { flex-wrap: wrap; }
  .search { order: 5; flex: 1 0 100%; }
  .page, .reading, .scripture, .para { max-width: 100%; }
  .notes-btn {
    position: fixed;
    right: 0.7rem;
    bottom: 0.7rem;
    z-index: 15;
    background: var(--oxblood);
    color: var(--oxblood-ink);
    box-shadow: var(--shadow);
  }
  html[data-theme="dark"] .notes-btn { background: #8d3d36; color: #f6efe6; }
  body { overflow-x: clip; }
  .sheet-body { grid-template-columns: 1fr; }
  .col + .col { border-left: 0; border-top: 1px solid var(--rule); }
  .overlay { padding: 0; }
  .sheet { border-radius: 0; width: 100%; }
  .tool .wide { display: none; }
  .page { padding: 1.1rem 1rem 5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
@media print {
  .top, .desk, .compare-col, .toast, .float, .overlay, .scrim, .audio, .turn, .quiet { display: none !important; }
  .colophon { display: block; border-top-color: #ccc; color: #444; }
  .workspace { display: block; height: auto; }
  .reading { overflow: visible; }
  body { background: white; color: black; }
  .scripture { font-size: 12.5pt; }
  .verse.picked .vtext { background: transparent; }
}
