:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #fffdf8;
  --surface-2: #f0ece3;
  --text: #202124;
  --muted: #6d716f;
  --line: #ded8ca;
  --accent: #176b5b;
  --accent-2: #b75f2d;
  --accent-soft: #dff0e9;
  --danger: #a23b3b;
  --shadow: 0 18px 50px rgba(42, 38, 30, .09);
  --radius: 8px;
  --reader-size: 1.08rem;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #15171a;
  --surface: #202327;
  --surface-2: #2a2f34;
  --text: #f0eee8;
  --muted: #adb5b7;
  --line: #3d4449;
  --accent: #6fc6ad;
  --accent-2: #f0a15e;
  --accent-soft: #203a34;
  --danger: #ff8e8e;
  --shadow: 0 18px 50px rgba(0, 0, 0, .25);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 800;
}

.brand span,
.muted {
  color: var(--muted);
}

.brand span {
  display: block;
  margin-top: 3px;
  font-size: .82rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 14px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 10px;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.quick-search,
.search-form {
  display: flex;
  gap: 10px;
}

.quick-search {
  flex: 1;
  max-width: 620px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  background: var(--surface);
  color: var(--text);
  outline: 0;
}

textarea {
  resize: vertical;
  min-height: 150px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.primary-button,
.secondary-button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
  white-space: nowrap;
}

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

.secondary-button,
.icon-button {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.icon-button {
  width: 42px;
  padding: 0;
}

.danger {
  color: var(--danger);
}

.full {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.state-panel,
.panel,
.scripture-panel,
.daily-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.state-panel {
  padding: 20px;
  display: grid;
  gap: 5px;
}

.state-panel.hidden {
  display: none;
}

.reader-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}

.panel,
.scripture-panel {
  padding: 20px;
}

.controls-panel,
.study-panel {
  position: sticky;
  top: 24px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}

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

.progress-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.progress-summary div {
  padding: 13px;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.progress-summary span {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
}

.progress-summary small {
  color: var(--muted);
}

.chapter-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.chapter-heading h2 {
  margin-bottom: 0;
}

.verses {
  margin-top: 22px;
  display: grid;
  gap: 10px;
}

.verse {
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.verse:hover,
.verse.selected {
  background: var(--surface-2);
  border-color: var(--line);
}

.verse.favorite {
  background: color-mix(in srgb, var(--accent-2) 13%, var(--surface));
}

.verse-number {
  color: var(--accent-2);
  font-weight: 800;
}

.verse-text {
  font-family: Literata, Georgia, serif;
  font-size: var(--reader-size);
  line-height: 1.85;
}

.verse-tools {
  display: flex;
  gap: 6px;
}

.tiny-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.study-panel {
  display: grid;
  gap: 18px;
}

.compact-list,
.results-list,
.notes-list,
.book-progress-list {
  display: grid;
  gap: 10px;
}

.compact-item,
.result-item,
.note-item,
.book-progress {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
}

.compact-item button,
.result-item button,
.note-item button {
  margin-top: 9px;
}

.split-view {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.results-list {
  max-height: calc(100vh - 150px);
  overflow: auto;
}

.result-item mark {
  background: color-mix(in srgb, var(--accent-2) 30%, transparent);
  color: var(--text);
  border-radius: 4px;
}

.daily-card {
  min-height: 360px;
  padding: 34px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, transparent), transparent 48%),
    var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.daily-card h2 {
  font-size: clamp(1.5rem, 3vw, 2.6rem);
}

.daily-card p:not(.eyebrow) {
  font-family: Literata, Georgia, serif;
  font-size: 1.22rem;
  line-height: 1.8;
}

.big-progress {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 18px 0 22px;
}

.progress-ring {
  width: 132px;
  height: 132px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--accent) var(--progress-angle, 0deg), var(--surface-2) 0);
}

.progress-ring span {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  font-size: 1.5rem;
  font-weight: 800;
}

.book-progress {
  display: grid;
  grid-template-columns: minmax(120px, 210px) 1fr 58px;
  gap: 14px;
  align-items: center;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--accent);
}

.empty {
  color: var(--muted);
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
  }

  .reader-layout,
  .split-view {
    grid-template-columns: 1fr;
  }

  .controls-panel,
  .study-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .quick-search,
  .search-form,
  .big-progress {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-search {
    max-width: none;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  .nav-item {
    justify-content: flex-start;
  }

  .verse {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .verse-tools {
    grid-column: 2;
  }

  .book-progress {
    grid-template-columns: 1fr;
  }
}
