:root {
  color-scheme: light;
  --header-height: 88px;
  --sidebar-width: 338px;
  --page-max: 1180px;
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans", sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --ink: #183238;
  --ink-soft: #53696e;
  --paper: #f5f3eb;
  --surface: #fffefa;
  --surface-soft: #ebece3;
  --line: #d9ddd3;
  --primary: #147b78;
  --primary-dark: #123c45;
  --primary-soft: #d8eddf;
  --accent: #e1a632;
  --accent-soft: #f8e8b9;
  --coral: #d96e53;
  --success: #2f8a57;
  --success-dark: #236a43;
  --success-soft: #dff2e7;
  --shadow-sm: 0 8px 24px rgb(24 50 56 / 8%);
  --shadow-md: 0 22px 60px rgb(24 50 56 / 12%);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 30px;
  --reading-size: 1.125rem;
  --reading-leading: 1.82;
  --transition: 180ms ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, color-mix(in srgb, var(--accent-soft) 50%, transparent), transparent 27rem),
    var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background-color 300ms ease, color 300ms ease;
}

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

button,
select {
  cursor: pointer;
}

button {
  border: 0;
}

a {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--primary-dark);
  background: var(--accent-soft);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: white;
  background: var(--primary-dark);
  border-radius: 8px;
  transform: translateY(-150%);
  transition: transform var(--transition);
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow,
.card-label {
  margin: 0;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* Header */

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 14px clamp(20px, 3vw, 48px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  box-shadow: 0 8px 30px rgb(23 50 56 / 5%);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  color: var(--surface);
  background: var(--primary-dark);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}

.brand-mark svg {
  width: 32px;
  overflow: visible;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.brand-mark .brand-spark {
  color: var(--accent);
  fill: var(--accent);
  stroke: none;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 1.16rem;
  letter-spacing: -0.02em;
}

.brand-copy i {
  color: var(--accent);
  font-weight: 400;
}

.brand-copy small {
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(14px, 2vw, 28px);
}

.age-control,
.language-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  color: var(--ink-soft);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.segmented-control {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  border-radius: 999px;
}

.segmented-control button {
  min-width: 57px;
  padding: 8px 12px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 999px;
  font-size: 0.79rem;
  font-weight: 800;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition);
}

.segmented-control button:hover {
  color: var(--ink);
}

.segmented-control button[aria-pressed="true"] {
  color: white;
  background: var(--primary-dark);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-dark) 25%, transparent);
}

.select-wrap {
  position: relative;
  display: flex;
  min-width: 132px;
  align-items: center;
}

.age-select-wrap {
  min-width: 112px;
}

.select-wrap > svg {
  position: absolute;
  z-index: 1;
  left: 13px;
  width: 18px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  pointer-events: none;
}

.select-wrap::after {
  position: absolute;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 1.7px solid var(--ink);
  border-bottom: 1.7px solid var(--ink);
  content: "";
  pointer-events: none;
  transform: translateY(-2px) rotate(45deg);
}

.select-wrap select {
  width: 100%;
  min-height: 42px;
  padding: 0 34px 0 40px;
  color: var(--ink);
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.library-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  color: white;
  background: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.library-toggle svg {
  width: 17px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 2;
}

/* Main shell and library */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
}

.library-panel {
  position: sticky;
  top: var(--header-height);
  display: flex;
  height: calc(100vh - var(--header-height));
  flex-direction: column;
  padding: 30px 24px 22px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 94%, var(--primary-soft));
  border-right: 1px solid var(--line);
}

.library-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.library-top h2 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: 1.58rem;
  letter-spacing: -0.03em;
}

.library-close {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  background: var(--surface-soft);
  border-radius: 50%;
}

.library-close svg {
  width: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field {
  position: relative;
  display: flex;
  margin-top: 22px;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 14px;
  width: 18px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-field input::placeholder {
  color: color-mix(in srgb, var(--ink-soft) 75%, white);
}

.search-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-soft) 76%, transparent);
}

.testament-filter {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 14px 0 16px;
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 10px;
}

.testament-filter button {
  padding: 7px;
  color: var(--ink-soft);
  background: transparent;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 800;
}

.testament-filter button[aria-pressed="true"] {
  color: var(--primary-dark);
  background: var(--surface);
  box-shadow: 0 2px 8px rgb(24 50 56 / 8%);
}

.book-list {
  min-height: 160px;
  flex: 1;
  padding: 0 4px 28px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

.book-group {
  margin-bottom: 5px;
  border-radius: 12px;
}

.book-group.is-current {
  background: color-mix(in srgb, var(--primary-soft) 55%, transparent);
}

.book-heading {
  display: grid;
  width: 100%;
  grid-template-columns: 31px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  padding: 11px 10px;
  text-align: left;
  background: transparent;
  border-radius: 11px;
}

.book-heading:hover {
  background: color-mix(in srgb, var(--surface-soft) 80%, transparent);
}

.book-order {
  color: color-mix(in srgb, var(--ink-soft) 68%, white);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-style: italic;
}

.book-order.is-complete {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: white;
  background: var(--success);
  border-radius: 50%;
}

.book-order.is-complete svg {
  width: 17px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.book-name {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.book-name strong {
  overflow: hidden;
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-name small {
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.book-heading > svg {
  width: 17px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform var(--transition);
}

.book-heading[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.chapter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 1px 10px 12px 50px;
}

.chapter-list button {
  display: inline-flex;
  min-width: 48px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0;
  transition: color var(--transition), background var(--transition), transform var(--transition);
}

.chapter-list button span {
  display: none;
}

.chapter-list button strong {
  font-size: 0.74rem;
}

.chapter-list button:hover {
  color: var(--primary-dark);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.chapter-list button.is-active {
  color: white;
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.chapter-list button.is-complete {
  border-color: var(--success);
}

.chapter-list .completion-check {
  width: 16px;
  fill: none;
  stroke: var(--success);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.chapter-list button.is-active .completion-check {
  stroke: white;
}

.book-list-empty {
  display: grid;
  padding: 44px 18px;
  place-items: center;
  color: var(--ink-soft);
  text-align: center;
}

.book-list-empty svg {
  width: 52px;
  fill: none;
  stroke: var(--line);
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.book-list-empty p {
  font-size: 0.82rem;
}

.library-note {
  display: flex;
  gap: 9px;
  padding-top: 15px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

.library-note svg {
  width: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-width: 1.6;
}

.library-note p {
  margin: 0;
  font-size: 0.65rem;
  line-height: 1.45;
}

.panel-scrim {
  display: none;
}

/* Reader */

.reader {
  width: min(100%, calc(var(--page-max) + 96px));
  min-height: calc(100vh - var(--header-height));
  margin: 0 auto;
  padding: clamp(28px, 4vw, 58px) clamp(24px, 5vw, 72px) 24px;
  outline: 0;
}

.reader-loading {
  display: grid;
  min-height: 60vh;
  place-content: center;
  place-items: center;
  color: var(--ink-soft);
}

.loading-mark {
  position: relative;
  width: 52px;
  height: 40px;
  margin-bottom: 14px;
}

.loading-mark::before,
.loading-mark::after {
  position: absolute;
  top: 4px;
  width: 24px;
  height: 32px;
  background: var(--primary-soft);
  border: 2px solid var(--primary);
  content: "";
  animation: page-breathe 1.2s ease-in-out infinite alternate;
}

.loading-mark::before {
  left: 2px;
  border-radius: 5px 0 0 5px;
  transform: skewY(8deg);
  transform-origin: right bottom;
}

.loading-mark::after {
  right: 2px;
  border-radius: 0 5px 5px 0;
  transform: skewY(-8deg);
  transform-origin: left bottom;
  animation-delay: 160ms;
}

.reader-loading p {
  font-size: 0.82rem;
  font-weight: 700;
}

@keyframes page-breathe {
  to {
    transform: skewY(0deg) translateY(-3px);
  }
}

.reader-state {
  max-width: 620px;
  margin: 8vh auto;
  text-align: center;
}

.state-illustration svg {
  width: 140px;
  margin: 0 auto 24px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.reader-state h1 {
  margin: 10px 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.reader-state > p:not(.eyebrow) {
  color: var(--ink-soft);
  line-height: 1.7;
}

.primary-button {
  margin-top: 18px;
  padding: 12px 20px;
  color: white;
  background: var(--primary-dark);
  border-radius: 999px;
  font-weight: 800;
}

/* Chapter hero */

.chapter-hero {
  position: relative;
  display: grid;
  min-height: 440px;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.65fr);
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 78% 12%, rgb(255 255 255 / 11%) 0 2px, transparent 3px),
    linear-gradient(135deg, var(--primary-dark), color-mix(in srgb, var(--primary-dark) 72%, var(--primary)));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.chapter-hero::after {
  position: absolute;
  right: -110px;
  bottom: -180px;
  width: 390px;
  height: 390px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 50%;
  box-shadow:
    0 0 0 38px rgb(255 255 255 / 3%),
    0 0 0 78px rgb(255 255 255 / 2%);
  content: "";
}

.hero-main {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(40px, 6vw, 76px);
}

.chapter-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 34px;
  color: rgb(255 255 255 / 68%);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chapter-hero h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(3rem, 6vw, 5.6rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.95;
}

html[lang="te"] .chapter-hero h1,
html[lang="hi"] .chapter-hero h1 {
  font-size: clamp(2.75rem, 5vw, 4.7rem);
  line-height: 1.08;
}

.chapter-bridge {
  max-width: 680px;
  margin: 25px 0 0;
  color: rgb(255 255 255 / 82%);
  font-size: clamp(0.98rem, 1.4vw, 1.12rem);
  line-height: 1.65;
}

.chapter-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px 28px;
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid rgb(255 255 255 / 15%);
}

.chapter-meta > div {
  display: flex;
  min-width: 130px;
  max-width: 210px;
  align-items: center;
  gap: 10px;
}

.chapter-meta svg {
  width: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.chapter-meta span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.chapter-meta small {
  color: rgb(255 255 255 / 54%);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chapter-meta strong {
  overflow: hidden;
  font-size: 0.73rem;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
}

.hero-context {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 44px 38px;
  background: rgb(255 255 255 / 7%);
  border-left: 1px solid rgb(255 255 255 / 10%);
  backdrop-filter: blur(4px);
}

.context-number {
  position: absolute;
  top: 28px;
  right: 28px;
  color: rgb(255 255 255 / 9%);
  font-family: var(--font-display);
  font-size: clamp(6rem, 11vw, 10rem);
  font-style: italic;
  line-height: 1;
}

.hero-context .eyebrow {
  color: var(--accent);
}

.hero-context p:last-child {
  margin: 12px 0 0;
  color: rgb(255 255 255 / 76%);
  font-size: 0.9rem;
  line-height: 1.7;
}

.hero-pattern {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.hero-pattern span {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.65;
}

.hero-pattern span:nth-child(1) {
  top: 18%;
  left: 5%;
}

.hero-pattern span:nth-child(2) {
  top: 11%;
  left: 53%;
}

.hero-pattern span:nth-child(3) {
  right: 26%;
  bottom: 16%;
}

.hero-pattern span:nth-child(4) {
  bottom: 9%;
  left: 37%;
}

/* Reading toolbar and units */

.reading-toolbar {
  position: sticky;
  z-index: 15;
  top: calc(var(--header-height) + 12px);
  display: flex;
  margin: 26px 0 10px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 20px;
  background: color-mix(in srgb, var(--surface) 91%, transparent);
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(16px);
}

.reading-toolbar > div:first-child {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.unit-navigation {
  display: flex;
  gap: 7px;
}

.unit-navigation button {
  position: relative;
  display: grid;
  width: 43px;
  height: 43px;
  padding: 0;
  place-content: center;
  place-items: center;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: 50%;
  transition: color var(--transition), border var(--transition), transform var(--transition);
}

.unit-navigation button:not(:disabled):hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.unit-navigation button span {
  font-size: 0.69rem;
  font-weight: 850;
  line-height: 1;
}

.unit-navigation button small {
  display: none;
}

.unit-navigation button svg {
  width: 20px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.unit-navigation button.is-complete {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.unit-navigation button.is-complete {
  background: var(--success);
  border-color: var(--success);
}

.unit-navigation button.is-active {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--primary);
}

.unit-navigation button.is-complete.is-active {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--success);
}

.unit-navigation button.is-locked {
  cursor: not-allowed;
  opacity: 0.42;
}

.reading-progress {
  display: grid;
  width: 150px;
  flex: 0 0 auto;
  gap: 7px;
}

.reading-progress > span {
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 700;
  text-align: right;
}

.reading-progress strong {
  color: var(--primary);
  font-size: 0.82rem;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: inherit;
  transition: width 350ms ease;
}

.chapter-units {
  padding-top: 24px;
}

.reading-unit {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  scroll-margin-top: calc(var(--header-height) + 100px);
}

.unit-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unit-rail span {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.73rem;
  font-style: italic;
  font-weight: 700;
}

.unit-rail i {
  width: 1px;
  height: 100%;
  min-height: 100px;
  background: linear-gradient(var(--line), transparent);
}

.reading-unit:last-child .unit-rail i {
  display: none;
}

.unit-content {
  padding: 4px 0 clamp(70px, 9vw, 112px) clamp(18px, 3vw, 40px);
}

.unit-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.unit-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.verse-range,
.unit-type {
  padding-left: 9px;
  color: var(--ink-soft);
  border-left: 1px solid var(--line);
}

.unit-type {
  font-weight: 650;
}

.unit-header h2 {
  max-width: 790px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.2vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.mark-read {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
  transition: color var(--transition), background var(--transition), border var(--transition);
}

.mark-read svg {
  width: 15px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.mark-read:hover,
.mark-read.is-active {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.reading-unit.is-complete .unit-rail span {
  color: white;
  background: var(--primary);
}

.story-copy {
  max-width: 830px;
  margin: clamp(28px, 5vw, 48px) auto 0;
  color: color-mix(in srgb, var(--ink) 91%, white);
  font-family: var(--font-display);
  font-size: var(--reading-size);
  line-height: var(--reading-leading);
}

.story-copy p {
  margin: 0 0 1.25em;
}

.story-copy p:first-child::first-letter {
  float: left;
  margin: 0.08em 0.09em 0 0;
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 4.1em;
  font-weight: 500;
  line-height: 0.76;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 38px;
}

.insight-card {
  position: relative;
  display: grid;
  min-height: 180px;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 15px;
  padding: 24px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 9px 25px rgb(24 50 56 / 5%);
}

.insight-card::after {
  position: absolute;
  top: -28px;
  right: -25px;
  width: 85px;
  height: 85px;
  background: color-mix(in srgb, var(--primary-soft) 65%, transparent);
  border-radius: 50%;
  content: "";
}

.insight-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 12px;
}

.insight-icon svg {
  width: 22px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.insight-card > div {
  position: relative;
  z-index: 1;
}

.insight-card h4 {
  margin: 9px 0 4px;
  font-family: var(--font-display);
  font-size: 1.24rem;
}

.insight-card p {
  margin: 9px 0 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.67;
}

.insight-card .lead {
  color: var(--ink);
  font-weight: 750;
}

.insight-card blockquote {
  margin: 10px 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.65;
}

.insight-card small {
  display: block;
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.55;
}

.truth-card {
  background: color-mix(in srgb, var(--primary-soft) 40%, var(--surface));
}

.connection-card .insight-icon {
  color: #b25e48;
  background: #f5ded5;
}

.application-card .insight-icon {
  color: #89651b;
  background: var(--accent-soft);
}

.prayer-card {
  color: white;
  background: var(--primary-dark);
  border-color: transparent;
}

.prayer-card::after {
  background: rgb(255 255 255 / 5%);
}

.prayer-card .insight-icon {
  color: var(--accent);
  background: rgb(255 255 255 / 10%);
}

.prayer-card .card-label {
  color: var(--accent);
}

.prayer-card blockquote,
.prayer-card small {
  color: rgb(255 255 255 / 83%);
}

.action-line {
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* Life scenarios */

.life-section {
  margin-top: 46px;
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(20px, 1fr) auto minmax(20px, 1fr);
  align-items: center;
  gap: 14px;
}

.section-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.heading-line {
  height: 1px;
  background: var(--line);
}

.life-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.life-card {
  position: relative;
  padding: 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.life-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--primary);
  content: "";
}

.life-card[data-life-type="school"]::before {
  background: #4d83bd;
}

.life-card[data-life-type="friends"]::before {
  background: #c67b49;
}

.life-card[data-life-type="family"]::before {
  background: #8d68af;
}

.life-type {
  color: var(--primary);
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.life-card h4 {
  margin: 10px 0;
  font-family: var(--font-display);
  font-size: 1.06rem;
  line-height: 1.35;
}

.life-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.79rem;
  line-height: 1.6;
}

.life-card blockquote {
  position: relative;
  margin: 16px 0 10px;
  padding: 13px 14px 13px 28px;
  color: var(--ink);
  background: var(--surface-soft);
  border-radius: 9px;
  font-size: 0.76rem;
  font-weight: 650;
  line-height: 1.55;
}

.life-card blockquote span {
  position: absolute;
  top: 7px;
  left: 10px;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1.6rem;
}

.life-card small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.5;
}

/* Deep dive */

.deep-dive {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.deep-dive summary {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 20px;
  list-style: none;
  font-size: 0.77rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.deep-dive summary::-webkit-details-marker {
  display: none;
}

.deep-dive summary > span {
  display: flex;
  align-items: center;
  gap: 11px;
}

.deep-dive summary > span svg {
  width: 22px;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.summary-chevron {
  width: 18px;
  fill: none;
  stroke: var(--ink-soft);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform var(--transition);
}

.deep-dive[open] .summary-chevron {
  transform: rotate(180deg);
}

.deep-dive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 12px 12px;
}

.deep-dive-grid .insight-card {
  min-height: 140px;
  box-shadow: none;
}

.definition-list {
  margin: 10px 0 0;
}

.definition-list > div {
  margin-bottom: 9px;
}

.definition-list dt {
  color: var(--ink);
  font-size: 0.77rem;
  font-weight: 800;
}

.definition-list dd {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.5;
}

.pronunciation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.pronunciation-list span {
  padding: 7px 9px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border-radius: 7px;
  font-size: 0.7rem;
}

.pronunciation-list strong {
  color: var(--ink);
}

/* Quiz and review */

.quiz-card {
  margin-top: 28px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 50%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 22%, var(--line));
  border-radius: var(--radius-md);
}

.quiz-heading {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 15px;
}

.quiz-heading > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: white;
  background: var(--primary);
  border-radius: 50%;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-style: italic;
}

.quiz-heading h4 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2vw, 1.42rem);
  line-height: 1.4;
}

.quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 22px;
}

.quiz-options label {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.77rem;
  line-height: 1.45;
  transition: border-color var(--transition), background var(--transition);
}

.quiz-options label:has(input:checked) {
  background: color-mix(in srgb, var(--primary-soft) 55%, var(--surface));
  border-color: var(--primary);
}

.quiz-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.option-letter {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 850;
}

.quiz-footer {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
}

.quiz-submit {
  flex: 0 0 auto;
  padding: 10px 16px;
  color: white;
  background: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.quiz-feedback {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
}

.quiz-card.is-correct {
  border-color: #3a9561;
}

.quiz-card.is-correct .quiz-feedback {
  color: #247245;
}

.quiz-card.is-incorrect {
  border-color: #c46c55;
}

.quiz-card.is-incorrect .quiz-feedback {
  color: #a44d3b;
}

.review-note {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 14px;
  margin-top: 18px;
  padding: 18px 20px;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--accent-soft) 30%, var(--surface));
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.review-note > svg {
  width: 27px;
  fill: none;
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.review-note strong {
  display: block;
  margin-top: 7px;
  color: var(--ink);
  font-family: var(--font-display);
}

.review-note p:last-child {
  margin: 5px 0 0;
  font-size: 0.77rem;
  line-height: 1.55;
}

.unit-completion {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 18px;
  margin-top: 34px;
  padding: clamp(22px, 4vw, 32px);
  align-items: center;
  background: linear-gradient(135deg, var(--success-soft), var(--surface));
  border: 1px solid color-mix(in srgb, var(--success) 42%, var(--line));
  border-radius: var(--radius-md);
}

.unit-completion-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: white;
  background: var(--success);
  border-radius: 50%;
}

.unit-completion-icon svg {
  width: 27px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
}

.unit-completion h3 {
  margin: 7px 0 5px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.unit-completion p:last-child {
  max-width: 620px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.unit-completion button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 18px;
  color: white;
  background: var(--success);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 800;
  white-space: nowrap;
}

.unit-completion button:hover {
  background: var(--success-dark);
}

.unit-completion button svg {
  width: 19px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.chapter-completion {
  display: grid;
  min-height: 480px;
  margin: 28px 0 72px 64px;
  padding: clamp(38px, 8vw, 90px);
  place-content: center;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--success-soft) 85%, transparent), transparent 18rem),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--success) 30%, var(--line));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.chapter-completion-mark {
  display: grid;
  width: 84px;
  height: 84px;
  margin-bottom: 22px;
  place-items: center;
  color: white;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 12px var(--success-soft);
}

.chapter-completion-mark svg {
  width: 44px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.1;
}

.chapter-completion .eyebrow {
  color: var(--success-dark);
}

.chapter-completion h2 {
  max-width: 720px;
  margin: 12px 0;
  font-family: var(--font-display);
  font-size: clamp(2.3rem, 6vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.chapter-completion > p:not(.eyebrow) {
  max-width: 620px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.7;
}

.chapter-completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.chapter-completion-actions .primary-button,
.chapter-completion-actions .secondary-button {
  min-height: 48px;
  margin: 0;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 800;
}

.chapter-completion-actions .primary-button {
  background: var(--success);
}

.chapter-completion-actions .primary-button:hover {
  background: var(--success-dark);
}

.secondary-button {
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

/* Pager and footer */

.chapter-pager {
  display: block;
  max-width: 480px;
  margin: 10px 0 60px 64px;
  padding-left: clamp(18px, 3vw, 40px);
}

.chapter-pager button {
  display: flex;
  width: 100%;
  min-height: 82px;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.chapter-pager button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.chapter-pager svg {
  width: 22px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.chapter-pager span {
  display: grid;
  gap: 4px;
}

.chapter-pager small {
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.chapter-pager strong {
  font-family: var(--font-display);
  font-size: 1.03rem;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-style: italic;
  text-align: center;
}

.footer-mark {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 10px 0 0 var(--primary), -10px 0 0 var(--coral);
}

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 48px));
  padding: 13px 18px;
  color: white;
  background: var(--primary-dark);
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity var(--transition), transform var(--transition);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Readability floor
   Visible interface text never drops below 14px. Supporting copy and
   navigation sit at 15–16px so the site remains comfortable at a glance. */

.eyebrow,
.card-label,
.brand-copy small,
.control-label,
.chapter-crumbs,
.hero-kicker,
.chapter-meta small,
.unit-kicker,
.section-heading p,
.life-type,
.chapter-pager small {
  font-size: 0.875rem;
  line-height: 1.35;
}

.segmented-control button,
.select-wrap select,
.library-toggle,
.testament-filter button,
.book-order,
.book-name small,
.chapter-list button strong,
.library-note p,
.reader-loading p,
.chapter-meta strong,
.unit-navigation button span,
.reading-progress > span,
.unit-rail span,
.mark-read,
.insight-card small,
.life-card blockquote,
.life-card small,
.deep-dive summary,
.definition-list dt,
.definition-list dd,
.pronunciation-list span,
.quiz-heading > span,
.quiz-options label,
.option-letter,
.quiz-submit,
.quiz-feedback,
.review-note p:last-child,
.toast {
  font-size: 0.875rem;
}

.book-name strong,
.book-list-empty p,
.reading-progress strong,
.insight-card p,
.life-card p,
.site-footer {
  font-size: 0.9375rem;
}

.hero-context p:last-child,
.chapter-bridge {
  font-size: 1rem;
}

.search-field input {
  min-height: 48px;
  font-size: 1rem;
}

.chapter-list button {
  min-width: 52px;
  height: 40px;
}

.mark-read,
.quiz-submit {
  min-height: 42px;
  padding-inline: 16px;
}

/* Ages 5–8: warm, generous, playful */

body[data-age="5-8"] {
  --font-display: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", var(--font-body);
  --ink: #2f3151;
  --ink-soft: #666582;
  --paper: #fff7e9;
  --surface: #fffdf8;
  --surface-soft: #f3e8df;
  --line: #e8d9ce;
  --primary: #7554c4;
  --primary-dark: #5b3fa3;
  --primary-soft: #e8defb;
  --accent: #f2a23d;
  --accent-soft: #ffedbf;
  --coral: #ec745c;
  --radius-sm: 14px;
  --radius-md: 24px;
  --radius-lg: 38px;
  --reading-size: 1.1875rem;
  --reading-leading: 1.9;
}

body[data-age="5-8"] .brand-mark {
  border-radius: 16px 16px 20px 20px;
  transform: rotate(-2deg);
}

body[data-age="5-8"] .chapter-hero {
  background:
    radial-gradient(circle at 15% 22%, rgb(255 255 255 / 13%) 0 4px, transparent 5px),
    linear-gradient(135deg, #6b4bc3 0%, #8a63d4 58%, #d96f82 140%);
}

body[data-age="5-8"] .chapter-hero::before {
  position: absolute;
  z-index: 1;
  top: -38px;
  right: 22%;
  width: 92px;
  height: 92px;
  background: var(--accent);
  border-radius: 42% 58% 50% 50%;
  content: "";
  opacity: 0.18;
  transform: rotate(18deg);
}

body[data-age="5-8"] .chapter-hero h1 {
  max-width: 650px;
  font-size: clamp(2.8rem, 6vw, 5.2rem);
  font-weight: 850;
  letter-spacing: -0.05em;
  line-height: 1;
}

body[data-age="5-8"] .hero-context {
  background: rgb(255 255 255 / 10%);
}

body[data-age="5-8"] .unit-rail span {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-style: normal;
  transform: rotate(-2deg);
}

body[data-age="5-8"] .reading-unit:nth-child(even) .unit-rail span {
  transform: rotate(2deg);
}

body[data-age="5-8"] .unit-header h2 {
  font-weight: 850;
  line-height: 1.12;
}

body[data-age="5-8"] .story-copy {
  font-family: var(--font-body);
  font-weight: 520;
}

body[data-age="5-8"] .story-copy p:first-child::first-letter {
  padding: 0.04em 0.11em;
  color: white;
  background: var(--coral);
  border-radius: 12px;
  font-family: var(--font-display);
  font-size: 2.8em;
  line-height: 0.9;
  transform: rotate(-2deg);
}

body[data-age="5-8"] .insight-card {
  border-width: 2px;
  box-shadow: 0 8px 0 color-mix(in srgb, var(--line) 55%, transparent);
}

body[data-age="5-8"] .insight-icon {
  border-radius: 14px;
  transform: rotate(-3deg);
}

body[data-age="5-8"] .life-card {
  border-width: 2px;
}

body[data-age="5-8"] .option-letter,
body[data-age="5-8"] .quiz-heading > span {
  border-radius: 12px;
}

body[data-age="5-8"] .mark-read,
body[data-age="5-8"] .quiz-submit {
  padding-block: 11px;
}

/* Ages 13–15: editorial, focused, restrained */

body[data-age="13-15"] {
  --font-display: "Iowan Old Style", "Baskerville", Georgia, "Times New Roman", serif;
  --ink: #17253b;
  --ink-soft: #617083;
  --paper: #f2efe8;
  --surface: #fbfaf6;
  --surface-soft: #e8e6df;
  --line: #d3d2cb;
  --primary: #9a6b24;
  --primary-dark: #17253b;
  --primary-soft: #e9dfc9;
  --accent: #d2a044;
  --accent-soft: #eee0bb;
  --coral: #9d5547;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 4px;
  --reading-size: 1.1875rem;
  --reading-leading: 1.88;
}

body[data-age="13-15"] {
  background:
    linear-gradient(90deg, transparent 0 49.9%, rgb(23 37 59 / 2%) 50%, transparent 50.1%),
    var(--paper);
  background-size: 44px 44px;
}

body[data-age="13-15"] .brand-mark {
  border-radius: 3px;
}

body[data-age="13-15"] .chapter-hero {
  min-height: 480px;
  background:
    linear-gradient(100deg, rgb(255 255 255 / 2%) 1px, transparent 1px),
    linear-gradient(135deg, #17253b, #243957);
  background-size: 45px 45px, auto;
  border-top: 5px solid var(--accent);
}

body[data-age="13-15"] .chapter-hero::after {
  border-radius: 0;
  transform: rotate(30deg);
}

body[data-age="13-15"] .chapter-hero h1 {
  font-size: clamp(3.3rem, 7vw, 6.5rem);
  font-weight: 400;
  letter-spacing: -0.06em;
}

body[data-age="13-15"] .hero-context {
  border-left-color: rgb(255 255 255 / 18%);
}

body[data-age="13-15"] .context-number {
  font-style: normal;
}

body[data-age="13-15"] .segmented-control,
body[data-age="13-15"] .segmented-control button,
body[data-age="13-15"] .select-wrap select {
  border-radius: 3px;
}

body[data-age="13-15"] .reading-toolbar {
  border-top: 2px solid var(--primary);
}

body[data-age="13-15"] .unit-navigation button,
body[data-age="13-15"] .unit-rail span {
  border-radius: 2px;
}

body[data-age="13-15"] .unit-header h2 {
  font-size: clamp(2.3rem, 4.4vw, 4rem);
  font-weight: 400;
}

body[data-age="13-15"] .story-copy {
  max-width: 760px;
}

body[data-age="13-15"] .story-copy p:first-child::first-letter {
  color: var(--primary);
  font-size: 4.8em;
}

body[data-age="13-15"] .insight-card {
  box-shadow: none;
}

body[data-age="13-15"] .insight-card::after {
  display: none;
}

body[data-age="13-15"] .insight-icon,
body[data-age="13-15"] .option-letter,
body[data-age="13-15"] .quiz-heading > span {
  border-radius: 2px;
}

body[data-age="13-15"] .life-card::before {
  width: 4px;
  height: auto;
  right: auto;
  bottom: 0;
}

/* Responsive */

@media (max-width: 1120px) {
  :root {
    --sidebar-width: 286px;
  }

  .control-label {
    display: none;
  }

  .chapter-hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(230px, 0.6fr);
  }

  .hero-main {
    padding: 48px;
  }

  .hero-context {
    padding: 36px 28px;
  }

  .reading-toolbar .eyebrow {
    display: none;
  }
}

@media (max-width: 920px) {
  :root {
    --header-height: 78px;
  }

  .site-header {
    padding: 12px 20px;
  }

  .brand-copy small {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .library-toggle {
    display: inline-flex;
  }

  .library-panel {
    position: fixed;
    z-index: 70;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(350px, 88vw);
    height: 100vh;
    padding-top: 28px;
    box-shadow: 20px 0 70px rgb(0 0 0 / 20%);
    transform: translateX(-105%);
    transition: transform 240ms ease;
  }

  .library-is-open .library-panel {
    transform: translateX(0);
  }

  .library-close {
    display: grid;
  }

  .panel-scrim {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: block;
    visibility: hidden;
    background: rgb(11 24 30 / 45%);
    opacity: 0;
    transition: opacity 240ms ease, visibility 240ms ease;
  }

  .library-is-open {
    overflow: hidden;
  }

  .library-is-open .panel-scrim {
    visibility: visible;
    opacity: 1;
  }

  .reader {
    width: min(100%, 1120px);
  }
}

@media (max-width: 760px) {
  :root {
    --header-height: 68px;
  }

  .site-header {
    gap: 12px;
    padding: 9px 14px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-mark svg {
    width: 27px;
  }

  .brand-copy strong {
    font-size: 0.96rem;
  }

  .header-controls {
    gap: 8px;
  }

  .age-select-wrap {
    min-width: 92px;
  }

  .age-select-wrap > svg {
    left: 10px;
    width: 16px;
  }

  .age-select-wrap select {
    min-height: 42px;
    padding: 0 22px 0 31px;
    font-size: 0.875rem;
  }

  .language-control .select-wrap {
    min-width: 108px;
  }

  .language-control .select-wrap > svg {
    left: 10px;
    width: 15px;
  }

  .language-control .select-wrap::after {
    right: 9px;
  }

  .language-control .select-wrap select {
    min-height: 42px;
    padding: 0 23px 0 30px;
    font-size: 0.875rem;
  }

  .library-toggle {
    width: 42px;
    height: 42px;
    justify-content: center;
    padding: 0;
  }

  .library-toggle span {
    display: none;
  }

  .reader {
    padding: 20px 14px;
  }

  .chapter-hero {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .hero-main {
    padding: 38px 25px;
  }

  .chapter-crumbs {
    margin-bottom: 28px;
  }

  .chapter-bridge {
    font-size: 1rem;
  }

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

  .chapter-meta > div {
    min-width: 0;
  }

  .hero-context {
    display: block;
    padding: 26px 25px 30px;
    border-top: 1px solid rgb(255 255 255 / 10%);
    border-left: 0;
  }

  .context-number {
    top: 10px;
    font-size: 6rem;
  }

  .reading-toolbar {
    top: calc(var(--header-height) + 7px);
    gap: 10px;
    padding: 11px 12px;
  }

  .unit-navigation {
    gap: 5px;
  }

  .unit-navigation button {
    width: 36px;
    height: 36px;
  }

  .reading-progress {
    width: 86px;
  }

  .reading-unit {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .unit-rail span,
  body[data-age="5-8"] .unit-rail span {
    width: 36px;
    height: 36px;
    border-radius: 50%;
  }

  .unit-content {
    padding-left: 13px;
  }

  .unit-header {
    display: block;
  }

  .unit-header h2 {
    font-size: clamp(1.8rem, 9vw, 2.7rem);
  }

  .story-copy {
    font-size: 1.0625rem;
  }

  .insight-grid,
  .deep-dive-grid {
    grid-template-columns: 1fr;
  }

  .insight-card {
    min-height: 0;
    padding: 20px;
  }

  .quiz-options {
    grid-template-columns: 1fr;
  }

  .quiz-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .unit-completion {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .unit-completion-icon {
    width: 44px;
    height: 44px;
  }

  .unit-completion button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .chapter-completion {
    margin-left: 42px;
    padding: 48px 24px;
  }

  .chapter-pager {
    margin-left: 42px;
    padding-left: 13px;
  }
}

@media (max-width: 520px) {
  .site-header {
    justify-content: center;
  }

  .brand {
    display: none;
  }

  .header-controls {
    width: 100%;
    justify-content: space-between;
  }

  .brand-copy {
    display: none;
  }

  .chapter-meta {
    grid-template-columns: 1fr;
  }

  .chapter-meta > div {
    max-width: none;
  }

  .reading-toolbar {
    align-items: flex-start;
  }

  .reading-toolbar > div:first-child {
    max-width: calc(100% - 78px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .reading-progress {
    width: 68px;
  }

  .reading-progress > span {
    white-space: nowrap;
  }

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

  .chapter-completion {
    min-height: 420px;
    margin-left: 0;
  }
}

@media (max-width: 360px) {
  .site-header {
    gap: 6px;
    padding-inline: 10px;
  }

  .brand-mark {
    display: none;
  }

  .age-select-wrap {
    min-width: 86px;
  }

  .language-control .select-wrap {
    min-width: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
