:root {
  color-scheme: dark;
  --bg: #0c1411;
  --surface: #121e1a;
  --surface-raised: #172720;
  --surface-soft: #1d3028;
  --border: #2c4037;
  --text: #f1eee6;
  --muted: #a7b4ad;
  --accent: #e3b765;
  --accent-strong: #f0c878;
  --green: #78b796;
  --shadow: 0 22px 60px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at 15% -10%, rgb(41 91 69 / 30%), transparent 34rem), var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:disabled, select:disabled { cursor: not-allowed; opacity: 0.45; }
.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;
}
.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  padding: 14px max(22px, calc((100vw - 1440px) / 2));
  border-bottom: 1px solid rgb(255 255 255 / 7%);
  background: rgb(12 20 17 / 90%);
  backdrop-filter: blur(18px);
}
.brand { display: flex; min-width: max-content; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(227 183 101 / 50%);
  border-radius: 13px 13px 13px 4px;
  background: linear-gradient(145deg, #263f34, #15271f);
  color: var(--accent-strong);
  font-family: Georgia, serif;
  font-size: 24px;
  box-shadow: inset 0 1px rgb(255 255 255 / 8%);
}
.brand h1, .brand p { margin: 0; }
.brand h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.brand p { margin-top: 2px; color: var(--muted); font-size: 12px; }
.header-actions {
  display: flex;
  width: min(760px, 100%);
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.search-box {
  display: flex;
  flex: 1;
  width: min(620px, 100%);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.search-box:focus-within {
  border-color: rgb(227 183 101 / 65%);
  box-shadow: 0 0 0 3px rgb(227 183 101 / 10%);
}
.search-icon { color: var(--accent); font-size: 22px; }
.search-box input {
  width: 100%;
  padding: 11px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.search-box input::placeholder { color: #809087; }
.bookmarks-trigger {
  display: flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.bookmarks-trigger:hover,
.bookmarks-trigger.is-active {
  border-color: rgb(227 183 101 / 55%);
  color: var(--accent-strong);
}
.bookmark-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.bookmarks-trigger-icon { color: var(--accent); }
.bookmark-count {
  min-width: 21px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgb(120 183 150 / 13%);
  color: #bde4ce;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
kbd {
  min-width: max-content;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0e1915;
  color: var(--muted);
  font-size: 11px;
}
.status-bar {
  padding: 8px 24px;
  border-bottom: 1px solid rgb(255 255 255 / 5%);
  background: #10231b;
  color: #b9ddc9;
  font-size: 13px;
  text-align: center;
}
.status-bar[data-tone="error"] { background: #321d1b; color: #ffd2cc; }
.status-bar:empty, .status-bar[hidden] { display: none; }
.layout {
  display: grid;
  width: min(1440px, 100%);
  min-height: calc(100vh - 170px);
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin: 0 auto;
  padding: 22px 22px 140px;
}
.layout.has-results { grid-template-columns: minmax(520px, 1.15fr) minmax(380px, 0.85fr); }
.reader-card, .results-card, .bookmarks-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgb(18 30 26 / 94%);
  box-shadow: var(--shadow);
}
.reader-toolbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}
.reader-toolbar label,
.reader-toolbar .toolbar-field {
  display: grid;
  flex: 1;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.book-picker { position: relative; }
.book-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0e1915;
  color: var(--text);
  text-align: left;
}
.book-trigger[aria-expanded="true"] { border-color: var(--accent); }
#book-selected-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: normal;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}
.book-trigger-meta {
  display: flex;
  align-items: center;
  gap: 9px;
}
.book-chevron {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}
.book-trigger[aria-expanded="true"] .book-chevron { transform: rotate(180deg) translateY(1px); }
.book-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 20;
  max-height: min(440px, 62vh);
  overflow-y: auto;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0b1612;
  box-shadow: 0 18px 44px rgb(0 0 0 / 48%);
  letter-spacing: normal;
  text-transform: none;
}
.book-menu[hidden] { display: none; }
.book-group-label {
  padding: 9px 10px 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.book-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.book-option:hover,
.book-option:focus-visible { background: rgb(218 177 92 / 11%); }
.book-option.is-selected { background: rgb(218 177 92 / 17%); }
.book-option.is-selected .book-option-name { color: var(--accent); }
.book-option-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-duration {
  color: #c7b785;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  letter-spacing: normal;
  text-align: right;
  text-transform: none;
  white-space: nowrap;
}
.book-duration.is-estimate { color: var(--muted); }
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0e1915;
  color: var(--text);
  font-size: 14px;
  text-transform: none;
}
.chapter-actions { display: flex; gap: 7px; }
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 20px;
}
.icon-button:not(:disabled):hover { border-color: rgb(227 183 101 / 50%); color: var(--accent-strong); }
.chapter-header, .results-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px 19px;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.chapter-header h2, .results-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 400;
}
.chapter-meta, #result-meta { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.verse-list { padding: 0 28px 18px; margin: 0; list-style: none; }
.verse-row {
  position: relative;
  display: grid;
  grid-template-columns: 38px 36px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 13px 10px;
  border-top: 1px solid rgb(255 255 255 / 6%);
  border-radius: 10px;
  transition: background 120ms ease;
}
.verse-row:hover, .verse-row.is-selected { background: rgb(120 183 150 / 8%); }
.verse-row.is-selected::before {
  position: absolute;
  top: 11px;
  bottom: 11px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
}
.play-button {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  margin-top: 1px;
  padding: 0;
  border: 1px solid rgb(120 183 150 / 45%);
  border-radius: 50%;
  background: rgb(120 183 150 / 12%);
  color: #bde4ce;
}
.play-icon { display: block; width: 16px; height: 16px; fill: currentColor; pointer-events: none; }
.play-button:not(:disabled):hover { background: var(--green); color: #0b1711; }
.play-button:disabled { border-color: var(--border); background: transparent; color: #66766e; }
.vnum {
  padding-top: 4px;
  color: var(--accent);
  font-family: Georgia, serif;
  font-size: 13px;
  text-align: right;
}
.vtext {
  color: #eee9df;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.62;
}
.verse-copy { min-width: 0; }
.verse-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 7px;
  vertical-align: -5px;
}
.verse-action-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  opacity: 0.32;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}
.verse-row:hover .verse-action-button,
.verse-action-button:focus-visible,
.verse-action-button:hover { opacity: 0.86; }
.verse-action-button:hover,
.verse-action-button:focus-visible {
  background: rgb(227 183 101 / 9%);
  color: var(--accent-strong);
}
.verse-bookmark-button.is-pinned {
  color: var(--accent-strong);
  opacity: 0.9;
}
.verse-bookmark-button.is-pinned .bookmark-icon,
.bookmark-remove.is-pinned .bookmark-icon { fill: currentColor; }
.definition-source { cursor: text; touch-action: manipulation; }
.definition-source::selection, .definition-source *::selection {
  background: var(--accent-strong);
  color: #182019;
}
.results-card {
  position: sticky;
  top: 94px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  align-self: start;
}
.results-header {
  position: sticky;
  z-index: 2;
  top: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  background: rgb(23 39 32 / 97%);
  backdrop-filter: blur(12px);
}
.results-header h2 { font-size: 30px; }
.result-list { display: grid; gap: 10px; padding: 16px; }
.result {
  width: 100%;
  padding: 14px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #101b17;
  color: var(--text);
  text-align: left;
}
.result:hover { border-color: rgb(227 183 101 / 45%); background: #17271f; }
.result .head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}
.result .verse {
  display: block;
  margin-top: 9px;
  color: #ddd8cf;
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
}
.empty-results { padding: 34px 20px; color: var(--muted); text-align: center; }
mark { padding: 0 2px; border-radius: 3px; background: var(--accent-strong); color: #182019; }
.more-button {
  width: calc(100% - 32px);
  margin: 0 16px 18px;
  padding: 11px 14px;
  border: 1px solid rgb(227 183 101 / 42%);
  border-radius: 10px;
  background: rgb(227 183 101 / 10%);
  color: var(--accent-strong);
}
.bookmarks-card { min-height: min(720px, calc(100vh - 190px)); }
.bookmarks-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}
.bookmarks-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 400;
}
#bookmarks-meta { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.bookmarks-close {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}
.bookmarks-close:hover { border-color: rgb(227 183 101 / 50%); color: var(--accent-strong); }
.bookmark-list { display: grid; gap: 10px; padding: 18px; }
.bookmark-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  gap: 8px;
}
.bookmark-open {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #101b17;
  color: var(--text);
  text-align: left;
}
.bookmark-open:hover,
.bookmark-open:focus-visible { border-color: rgb(227 183 101 / 45%); background: #17271f; }
.bookmark-reference {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 750;
}
.bookmark-text {
  color: #e5e0d7;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.5;
}
.bookmark-remove {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgb(227 183 101 / 7%);
  color: var(--accent-strong);
}
.bookmark-remove:hover { border-color: rgb(227 183 101 / 55%); background: rgb(227 183 101 / 13%); }
.bookmarks-empty {
  padding: 70px 20px;
  color: var(--muted);
  text-align: center;
}
.bookmarks-empty h3 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 400;
}
.bookmarks-empty p { max-width: 420px; margin: 10px auto 0; line-height: 1.6; }
.definition-popover {
  position: fixed;
  z-index: 60;
  width: min(390px, calc(100vw - 24px));
  max-height: min(430px, calc(100vh - 24px));
  overflow: auto;
  padding: 17px 18px 18px;
  border: 1px solid rgb(227 183 101 / 55%);
  border-radius: 14px;
  background: rgb(18 30 26 / 98%);
  box-shadow: 0 20px 55px rgb(0 0 0 / 48%);
  backdrop-filter: blur(18px);
}
.definition-popover.is-translation {
  width: min(680px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 24px));
}
.definition-popover[hidden] { display: none; }
.definition-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}
.definition-heading h2 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 400;
}
.definition-close {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
}
.definition-close:hover { border-color: rgb(227 183 101 / 50%); color: var(--accent-strong); }
.definition-reference {
  margin: 7px 0 0;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}
.definition-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.definition-status[data-tone="loading"]::before {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}
.definition-status[data-tone="error"] { color: #ffbdb5; }
.definition-body {
  margin: 11px 0 0;
  color: #eee9df;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-line;
}
.definition-body:empty { display: none; }
.translation-list {
  display: grid;
  gap: 8px;
}
.translation-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 15px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid rgb(255 255 255 / 7%);
  border-radius: 10px;
  background: rgb(255 255 255 / 3%);
}
.translation-item.is-original-language {
  border-color: rgb(227 183 101 / 30%);
  background: rgb(227 183 101 / 7%);
}
.translation-language-tools {
  display: grid;
  justify-items: start;
  gap: 8px;
}
.translation-item h3 {
  margin: 3px 0 0;
  color: var(--accent-strong);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.07em;
  line-height: 1.35;
  text-transform: uppercase;
}
.translation-pin {
  padding: 4px 8px;
  border: 1px solid rgb(167 180 173 / 28%);
  border-radius: 999px;
  background: rgb(255 255 255 / 3%);
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.translation-pin:hover {
  border-color: rgb(227 183 101 / 55%);
  color: var(--accent-strong);
}
.translation-pin.is-pinned {
  border-color: rgb(120 183 150 / 55%);
  background: rgb(120 183 150 / 13%);
  color: #bde4ce;
}
.translation-item p {
  margin: 0;
  color: #f3efe6;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.translation-item p[dir="rtl"] { text-align: right; }
.player-bar {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(320px, 620px);
  align-items: center;
  gap: 28px;
  padding: 12px max(22px, calc((100vw - 1440px) / 2));
  border-top: 1px solid var(--border);
  background: rgb(13 23 19 / 96%);
  box-shadow: 0 -16px 40px rgb(0 0 0 / 28%);
  backdrop-filter: blur(18px);
}
.player-copy p { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
#now-playing { font-family: Georgia, serif; font-size: 17px; }
#audio-status { margin-top: 3px; color: var(--muted); font-size: 11px; }
.player-controls {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 12px;
}
.speed-control {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.speed-control select {
  min-height: 36px;
  padding: 6px 24px 6px 9px;
  font-size: 13px;
}
audio { width: 100%; height: 40px; }
@media (max-width: 900px) {
  .layout.has-results { grid-template-columns: 1fr; }
  .layout.has-results .results-card { grid-row: 1; }
  .layout.has-results .reader-card { grid-row: 2; }
  .results-card { position: static; max-height: none; }
  .player-bar { grid-template-columns: 1fr; gap: 8px; }
  .layout { padding-bottom: 178px; }
}
@media (max-width: 650px) {
  .app-header { align-items: stretch; flex-direction: column; gap: 12px; padding: 12px 14px; }
  .brand p, kbd { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .header-actions { width: 100%; }
  .search-box { min-width: 0; }
  .bookmarks-trigger { min-width: 48px; justify-content: center; padding-right: 9px; padding-left: 9px; }
  .bookmarks-trigger-label { display: none; }
  .layout { padding: 12px 10px 185px; }
  .reader-toolbar { flex-wrap: wrap; }
  .reader-toolbar .book-field { flex-basis: 100%; }
  .book-menu { max-height: 55vh; }
  .chapter-actions { margin-left: auto; }
  .chapter-header, .results-header { padding: 21px 18px 15px; }
  .verse-list { padding: 0 8px 12px; }
  .verse-row { grid-template-columns: 34px 28px minmax(0, 1fr); padding-right: 5px; }
  .vtext { font-size: 17px; }
  .verse-actions { gap: 1px; margin-left: 4px; vertical-align: -7px; }
  .verse-action-button { width: 34px; height: 34px; font-size: 14px; opacity: 0.48; }
  .bookmarks-header { align-items: stretch; flex-direction: column; padding: 21px 18px 17px; }
  .bookmarks-close { align-self: start; }
  .bookmark-list { padding: 10px; }
  .bookmark-item { grid-template-columns: minmax(0, 1fr) 44px; gap: 6px; }
  .bookmark-open { padding: 13px 14px; }
  .bookmark-text { font-size: 15px; }
  .player-bar { padding: 10px 14px; }
  .translation-item { grid-template-columns: 1fr; gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
