:root {
  color-scheme: light;
  --paper: #f6f1e8;
  --paper-deep: #eee5d6;
  --ink: #17130f;
  --ink-soft: #4b4037;
  --muted: #85776b;
  --rule: rgba(40, 31, 23, 0.18);
  --gold: #a76f28;
  --gold-soft: rgba(167, 111, 40, 0.14);
  --site-gutter: clamp(48px, 9vw, 176px);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.28), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.26)),
    repeating-linear-gradient(0deg, rgba(32, 24, 17, 0.018) 0 1px, transparent 1px 12px),
    var(--paper);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100vw - var(--site-gutter)));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 72px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(30px, 5vw, 70px);
}

.topbar {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
}

.wall-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.wall-link:hover {
  color: var(--ink);
}

.eyebrow,
.panel-label,
.reference,
.step-count,
.doctrine-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1 {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.1rem, 5.4vw + 1rem, 8rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: 0;
}

.tulip-nav {
  display: grid;
  grid-template-columns: repeat(5, 34px);
  gap: 8px;
}

.tulip-letter,
.icon-button,
.dot {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.tulip-letter {
  width: 34px;
  aspect-ratio: 1;
  padding: 0;
  color: rgba(23, 19, 15, 0.28);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.tulip-letter:disabled {
  color: rgba(23, 19, 15, 0.18);
  cursor: not-allowed;
}

.tulip-letter.active {
  color: var(--gold);
}

.lesson-stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.82fr);
  gap: clamp(34px, 6vw, 86px);
  align-items: start;
}

.scripture-panel,
.teaching-panel {
  min-width: 0;
}

.scripture-panel {
  display: grid;
  gap: clamp(22px, 3vw, 40px);
}

.teaching-panel {
  display: grid;
  gap: clamp(22px, 3vw, 36px);
}

.panel-label-row {
  min-height: 0;
  padding: 0 0 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--rule);
}

.reference,
.step-count {
  color: var(--gold);
  text-align: right;
  line-height: 1.35;
  max-width: 70%;
}

.scripture-scroll {
  min-height: 0;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 0 2px 24px 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.1rem, 2.6vw + 1rem, 5.2rem);
  line-height: 1.08;
  transition: opacity 420ms cubic-bezier(0.19, 1, 0.22, 1);
}

.scripture-scroll p {
  margin: 0 0 clamp(30px, 4vw, 54px);
}

.scripture-scroll p:last-child {
  margin-bottom: 0;
}

.scripture-ref {
  display: block;
  margin-bottom: 14px;
  color: var(--gold);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

mark {
  color: inherit;
  background: linear-gradient(180deg, transparent 52%, var(--gold-soft) 52%);
  padding: 0 0.04em;
}

.teaching-copy {
  min-height: 0;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 0 2px 24px 0;
  display: flex;
  flex-direction: column;
  transition: opacity 420ms cubic-bezier(0.19, 1, 0.22, 1);
}

.doctrine-tag {
  color: var(--gold);
}

h2 {
  margin: 16px 0 22px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 1.9vw + 1rem, 3.4rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: 0;
}

.teaching-copy p {
  margin: 0 0 17px;
  color: var(--ink-soft);
  font-size: clamp(1.03rem, 0.34vw + 0.95rem, 1.24rem);
  line-height: 1.68;
}

.teaching-copy p:last-child {
  margin-bottom: 0;
}

#lessonBody {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.mini-heading {
  margin: 26px 0 9px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.language-note {
  margin: auto 0 0;
  padding-top: clamp(22px, 3vw, 36px);
  border-top: 1px solid var(--rule);
}

.language-note p {
  margin: 0;
}

.language-note .mini-heading {
  margin: 0 0 9px;
}

.greek {
  display: inline-block;
  margin-right: 6px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.18em;
}

.transliteration {
  color: var(--gold);
  font-weight: 850;
}

.quote-chip {
  display: inline;
  color: var(--ink);
  background: linear-gradient(180deg, transparent 54%, var(--gold-soft) 54%);
}

.fade-out {
  opacity: 0;
}

.controls {
  min-height: 42px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 18px;
  align-items: center;
}

.icon-button {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 800;
}

.icon-button:hover,
.icon-button.primary {
  color: var(--gold);
}

.icon-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.progress-group {
  display: grid;
  gap: 14px;
}

.progress-track {
  height: 1px;
  overflow: hidden;
  background: var(--rule);
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 420ms cubic-bezier(0.19, 1, 0.22, 1);
}

.dot-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.dot {
  width: 7px;
  aspect-ratio: 1;
  border-radius: 999px;
  padding: 0;
  background: rgba(23, 19, 15, 0.24);
}

.dot.active {
  background: var(--gold);
}

@media (max-width: 820px) {
  :root {
    --site-gutter: 24px;
  }

  .app-shell {
    width: min(100vw - var(--site-gutter), 620px);
    padding: 18px 0 54px;
    gap: 36px;
  }

  .topbar {
    flex-direction: column;
    gap: 22px;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  h1 {
    font-size: clamp(2.55rem, 11vw, 4.4rem);
  }

  .tulip-nav {
    grid-template-columns: repeat(5, 28px);
  }

  .tulip-letter {
    width: 28px;
    font-size: 1.18rem;
  }

  .lesson-stage {
    grid-template-columns: 1fr;
    gap: 44px;
  }

  .scripture-scroll,
  .teaching-copy {
    max-height: none;
    overflow: visible;
  }

  .scripture-scroll {
    font-size: clamp(1.8rem, 7vw, 3.1rem);
  }

  .controls {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 12px;
  }

  .icon-button {
    width: 38px;
  }
}

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