:root {
  color-scheme: light;
  --bg: #e9f0df;
  --bg-deep: #d8e8cf;
  --surface: #fffaf2;
  --surface-2: #f2eadc;
  --ink: #22301d;
  --muted: #64725d;
  --line: rgba(34, 48, 29, 0.12);
  --accent: #b95c3c;
  --accent-2: #2f7d55;
  --gold: #d69d3e;
  --blue: #377f94;
  --white: #fffdf8;
  --shadow: 0 16px 32px rgba(39, 56, 31, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.app {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 255, 255, 0.76), transparent 28%),
    linear-gradient(180deg, var(--bg), #f4ecdf 100%);
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.scroll::-webkit-scrollbar {
  display: none;
}

.screen {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
  animation: rise 180ms ease-out;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero {
  position: relative;
  min-height: 270px;
  margin: 0 -16px;
  padding: 54px 20px 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #55b7bf, #a9ded4 58%, #82b875 59%, #5d9d66 100%);
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
  color: #18321e;
}

.hero-small {
  min-height: 204px;
}

.hero-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(30px, 7vw, 54px);
  line-height: 0.98;
  letter-spacing: 0;
  font-weight: 900;
}

h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0;
}

.sub {
  max-width: 620px;
  margin: 10px 0 0;
  color: rgba(24, 50, 30, 0.76);
  font-size: 15px;
  line-height: 1.42;
  font-weight: 700;
  overflow-wrap: break-word;
}

.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.identity-pill,
.tiny-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(38, 68, 35, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.92);
  font-weight: 900;
  cursor: pointer;
}

.identity-pill {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 9px 13px;
  font-size: 13px;
}

.tiny-pill {
  min-height: 34px;
  padding: 7px 11px;
  font-size: 12px;
}

.section {
  margin-top: 18px;
}

.section-label {
  margin: 0 2px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lesson-card {
  padding: 15px;
}

.lesson-title {
  display: flex;
  gap: 13px;
  align-items: center;
}

.lesson-number {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 23px;
  font-weight: 900;
}

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

.primary,
.secondary,
.nav-btn,
.bottom-tab,
.name-card,
.step-chip,
.dot-btn,
.bank-word,
.match-word,
.match-picture,
.sound-button,
.quote-listen-button,
.quote-word {
  border: 0;
  cursor: pointer;
}

.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #d86943, #b84e31);
  color: white;
  box-shadow: 0 8px 16px rgba(184, 78, 49, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  font-size: 15px;
  font-weight: 900;
}

.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(34, 48, 29, 0.08);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.grid {
  display: grid;
  gap: 12px;
}

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

.kid-card {
  padding: 15px;
}

.prayer-activity:empty {
  display: none;
}

.activity-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(40, 70, 30, 0.1);
  padding: 14px;
}

.activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.activity-head .section-label {
  margin-bottom: 0;
}

.mini-reset {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(34, 48, 29, 0.08);
  color: var(--ink);
  padding: 7px 11px;
  font-size: 12.5px;
  font-weight: 900;
  cursor: pointer;
}

.blank-controls {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.activity-center {
  place-items: center;
  text-align: center;
}

.sound-button {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(180deg, #d86943, #b84e31);
  color: white;
  box-shadow: 0 10px 20px rgba(184, 78, 49, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  font-size: 28px;
  line-height: 1;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bank-word {
  min-height: 42px;
  border-radius: 999px;
  background: rgba(47, 125, 85, 0.12);
  color: var(--ink);
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 900;
}

.bank-word.phrase {
  border-radius: 8px;
  text-align: left;
}

.bank-word.correct {
  background: rgba(47, 125, 85, 0.16);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 2px rgba(47, 125, 85, 0.3);
}

.bank-word.wrong-choice {
  background: rgba(185, 92, 60, 0.16);
  color: #9f3f28;
  box-shadow: inset 0 0 0 2px rgba(185, 92, 60, 0.36);
}

.bank-word.used {
  opacity: 0.42;
  text-decoration: line-through;
}

.wrong {
  animation: shake 180ms ease-out;
  outline: 2px solid rgba(185, 92, 60, 0.6);
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-3px);
  }
  70% {
    transform: translateX(3px);
  }
}

.match-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.match-column {
  display: grid;
  gap: 8px;
}

.match-word,
.match-picture {
  min-height: 54px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  padding: 10px;
  font-weight: 900;
}

.match-word.selected {
  background: rgba(185, 92, 60, 0.13);
  box-shadow: inset 0 0 0 2px rgba(185, 92, 60, 0.38);
}

.match-word.matched,
.match-picture.matched {
  background: rgba(47, 125, 85, 0.13);
  color: var(--accent-2);
}

.match-picture {
  display: grid;
  place-items: center;
  gap: 0;
  min-height: 118px;
  padding: 8px;
}

.match-picture.with-scenarios {
  gap: 8px;
  align-content: start;
  text-align: left;
}

.match-scenarios {
  display: grid;
  gap: 5px;
  width: 100%;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.22;
}

.match-scenarios span {
  display: block;
}

.match-art {
  width: min(104px, 100%);
  height: 104px;
  display: block;
}

.definition-list {
  display: grid;
  gap: 10px;
}

.definition-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 11px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.definition-play {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  box-shadow: 0 6px 12px rgba(184, 78, 49, 0.22);
  font-size: 12px;
  cursor: pointer;
}

.definition-card h3 {
  margin: 0 0 5px;
  font-size: 17px;
}

.definition-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  font-weight: 800;
  white-space: pre-line;
}

.memory-line {
  margin: 0;
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
  font-family: "Spectral", Georgia, serif;
  font-size: 20px;
  line-height: 1.65;
  font-weight: 600;
}

.blank-line {
  margin: 0;
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
  font-family: "Spectral", Georgia, serif;
  font-size: 20px;
  line-height: 1.75;
  font-weight: 600;
}

.blank-token {
  display: inline-block;
  min-width: 42px;
  min-height: 32px;
  margin: 0 2px;
  border: 0;
  border-radius: 8px;
  background: rgba(47, 125, 85, 0.14);
  color: var(--accent-2);
  padding: 1px 7px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 900;
  line-height: 1.3;
  cursor: pointer;
}

.blank-token.revealed {
  background: transparent;
  color: var(--ink);
  padding-left: 2px;
  padding-right: 2px;
}

.blank-word {
  color: var(--muted);
  letter-spacing: 0.03em;
}

.activity-message {
  min-height: 20px;
  margin: 0;
  font-size: 13px;
  font-weight: 850;
}

.kid-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 900;
}

.shaafi {
  background: var(--blue);
}

.bina {
  background: var(--gold);
}

.name-screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 18px;
  padding: calc(30px + env(safe-area-inset-top)) 18px 38px;
}

.name-panel {
  width: calc(100vw - 36px);
  min-width: 0;
  max-width: 720px;
  margin: 0 auto;
}

.name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.name-card {
  min-width: 0;
  min-height: 76px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.name-initial {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--accent-2);
  color: white;
  font-weight: 900;
}

.name-card:nth-child(2n) .name-initial {
  background: var(--accent);
}

.name-card:nth-child(3n) .name-initial {
  background: var(--blue);
}

.name-card span:last-child {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.nav-icon {
  width: 24px;
  height: 24px;
}

.lesson-list {
  display: grid;
  gap: 10px;
}

.lesson-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 6px 16px rgba(39, 56, 31, 0.08);
}

.lesson-row[disabled] {
  opacity: 0.56;
  cursor: default;
}

.lesson-badge {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 900;
}

.lesson-row.available .lesson-badge {
  background: var(--accent);
  color: white;
}

.bottom-tabs {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 8px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.bottom-tab {
  min-width: 0;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 8px;
  background: rgba(34, 48, 29, 0.07);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.bottom-tab.active {
  background: rgba(185, 92, 60, 0.14);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(185, 92, 60, 0.24);
}

.bottom-tab .nav-icon {
  flex: 0 0 auto;
}

.bottom-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-flow {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.flow-top {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(var(--bg), var(--bg) 72%, rgba(233, 240, 223, 0));
}

.flow-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}

.steps {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 0;
  scrollbar-width: none;
}

.steps::-webkit-scrollbar {
  display: none;
}

.lesson-tools {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  flex-wrap: wrap;
}

.lesson-tools .tiny-pill {
  flex: 1 1 0;
  justify-content: center;
  min-width: 0;
  white-space: nowrap;
}

.lesson-tools .nav-icon {
  width: 16px;
  height: 16px;
}

.step-chip {
  flex: 0 0 auto;
  padding: 9px 13px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13px;
  font-weight: 900;
}

.step-chip.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 16px rgba(184, 78, 49, 0.24);
}

.flow-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 6px 14px 114px;
}

.flow-card {
  max-width: 860px;
  margin: 0 auto;
  overflow: hidden;
}

.flow-head {
  padding: 17px 17px 13px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.flow-content {
  padding: 18px;
}

.quote {
  margin: 0;
  font-family: "Spectral", Georgia, serif;
  font-size: 22px;
  line-height: 1.45;
  font-weight: 600;
}

.prayer-quote {
  display: block;
}

.quote-listen-button {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  margin: 0 5px 2px 0;
  vertical-align: baseline;
  border-radius: 999px;
  background: linear-gradient(180deg, #d86943, #b84e31);
  color: white;
  box-shadow: 0 5px 10px rgba(184, 78, 49, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.36);
  font-size: 10px;
  line-height: 1;
}

.quote-word {
  display: inline;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  padding: 1px 2px;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
}

.quote-word:active {
  background: rgba(185, 92, 60, 0.14);
  color: var(--accent);
}

.quote-word-static {
  color: var(--muted);
}

.quote-mark {
  color: var(--muted);
}

.body-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.55;
  font-weight: 700;
}

.serif-text {
  font-family: "Spectral", Georgia, serif;
  font-size: 18px;
  line-height: 1.58;
  font-weight: 500;
}

.stack {
  display: grid;
  gap: 14px;
}

.soft-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 14px;
}

.audio-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 10px 24px rgba(40, 70, 30, 0.1);
  padding: 14px;
}

.song-audio {
  width: 100%;
  display: block;
}

.branch-song-list {
  display: grid;
  gap: 12px;
}

.choice-grid {
  display: grid;
  gap: 9px;
}

.choice {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
  font-weight: 900;
}

.choice-symbol {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(47, 125, 85, 0.14);
  color: var(--accent-2);
  font-size: 20px;
}

.picture-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.picture-tile {
  min-height: 104px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  padding: 9px;
  text-align: center;
  font-weight: 900;
}

.big-symbol {
  font-size: 38px;
  line-height: 1;
}

.lyrics {
  white-space: pre-line;
}

.coloring {
  width: 100%;
  max-width: 520px;
  display: block;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 14px 30px rgba(30, 45, 24, 0.12);
}

.flow-actions {
  position: fixed;
  z-index: 12;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.flow-actions .primary {
  flex: 1;
}

@media (min-width: 520px) {
  .name-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 680px) {
  .screen {
    padding: 0 22px;
  }

  .hero {
    margin: 0 -22px;
    padding-left: 34px;
    padding-right: 34px;
  }

  .kid-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-content {
    padding: 24px;
  }
}

.toast {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

#print-root {
  display: none;
}

#print-root.measuring {
  display: block;
  position: fixed;
  left: -10000px;
  top: 0;
  visibility: hidden;
}

/*
 * The sheet's fixed size and type rules are defined unconditionally (not just
 * inside @media print) so the off-screen "measuring" pass in fitSheetToPage()
 * has a real clientHeight to compare scrollHeight against. #print-root stays
 * display:none outside of measuring/printing, so this never shows on screen.
 */
.print-sheet {
  width: 7.27in;
  height: 9.9in;
  display: flex;
  flex-direction: column;
  font-size: var(--sheet-font, 11pt);
  font-family: "Hanken Grotesk", system-ui, sans-serif;
  color: #000;
  break-inside: avoid;
  page-break-inside: avoid;
  overflow: hidden;
}

.print-sheet h1,
.print-sheet h2 {
  font-family: "Spectral", Georgia, serif;
  margin: 0 0 0.08in;
  font-size: 1.3em;
}

.sheet-eyebrow {
  margin: 0;
  font-size: 0.72em;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #444;
}

.sheet-label {
  margin: 0.12in 0 0.02in;
  font-size: 0.72em;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sheet-passage {
  font-family: "Spectral", Georgia, serif;
  font-size: 1em;
}

.sheet-passage p {
  margin: 0 0 0.06in;
}

.sheet-source,
.sheet-line {
  margin: 0;
  font-size: 0.92em;
}

.sheet-source {
  font-style: italic;
}

.sheet-teacher {
  flex: 1 1 auto;
}

.cut-line {
  border-top: 1.5px dashed #000;
  margin: 0.18in 0;
  position: relative;
  text-align: center;
}

.sheet-family {
  flex: 0 0 auto;
  min-height: 3.4in;
}

#print-root[data-mode="coloring"] img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 9.9in;
  margin: 0 auto;
  object-fit: contain;
  break-inside: avoid;
}

@media print {
  @page {
    size: auto;
    margin: 0.5in;
  }

  html, body {
    background: #fff !important;
    height: auto !important;
    overflow: visible !important;
  }

  body > *:not(#print-root) {
    display: none !important;
  }

  .toast {
    display: none !important;
  }

  #print-root {
    display: block !important;
    position: static;
    visibility: visible;
  }
}
