/* ============================================================
 * Brahmi Lipi Praveshika — Children's book styling
 * Based on the colorful Jain praveshika layout
 * ============================================================ */

/* ---- Fonts ---- */
/* Primary: custom JinShashan Brahmi (PDF-style geometric) */
@font-face {
  font-family: 'JinShashan Brahmi';
  src: url('fonts/JinShashanBrahmi-Regular.ttf') format('truetype');
  font-display: swap;
  unicode-range: U+11000-1107F;
}
/* Fallback: Google Noto Sans Brahmi */
@font-face {
  font-family: 'Noto Sans Brahmi Local';
  src: url('fonts/NotoSansBrahmi-Regular.ttf') format('truetype');
  font-display: swap;
  unicode-range: U+11000-1107F;
}

/* Local Devanagari fallback — only fetched for Vedic signs (ᳵ ᳶ) */
@font-face {
  font-family: 'Noto Serif Devanagari Local';
  src: url('fonts/VedicSigns.ttf') format('truetype');
  font-display: swap;
  unicode-range: U+1CD0-1CFF;
}

/* The 5 other Indian scripts of the 9-language tiles — self-hosted so
 * they are always ready when the book is printed. */
@font-face { font-family: 'Noto Sans Gujarati'; src: url('fonts/web/notosans-gujarati.woff2') format('woff2'); font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0A80-0AFF, U+200C-200D, U+20B9, U+25CC, U+A830-A839; }
@font-face { font-family: 'Noto Sans Kannada';  src: url('fonts/web/notosans-kannada.woff2')  format('woff2'); font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0C80-0CF3, U+1CD0, U+1CD2-1CD3, U+1CDA, U+1CF2, U+1CF4, U+200C-200D, U+20B9, U+25CC, U+A830-A835; }
@font-face { font-family: 'Noto Sans Tamil';    src: url('fonts/web/notosans-tamil.woff2')    format('woff2'); font-display: swap; unicode-range: U+0964-0965, U+0B82-0BFA, U+200C-200D, U+20B9, U+25CC; }
@font-face { font-family: 'Noto Sans Gurmukhi'; src: url('fonts/web/notosans-gurmukhi.woff2') format('woff2'); font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0A01-0A76, U+200C-200D, U+20B9, U+25CC, U+262C, U+A830-A839; }
@font-face { font-family: 'Noto Sans Bengali';  src: url('fonts/web/notosans-bengali.woff2')  format('woff2'); font-display: swap; unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0, U+1CD2, U+1CD5-1CD6, U+1CD8, U+1CE1, U+1CEA, U+1CED, U+1CF2, U+1CF5-1CF7, U+200C-200D, U+20B9, U+25CC, U+A8F1; }

/* Page background, base font, nav and motion come from kids.css */

.fs-brahmi { font-family: 'JinShashan Brahmi', 'Noto Sans Brahmi Local', 'Noto Sans Brahmi', serif; }
.fs-deva   { font-family: var(--font-fun); }
.fs-eng    { font-family: 'Baloo 2', 'Inter', sans-serif; font-weight: 700; }
.fs-gujr   { font-family: 'Noto Sans Gujarati', serif; }
.fs-knda   { font-family: 'Noto Sans Kannada', serif; }
.fs-taml   { font-family: 'Noto Sans Tamil', serif; }
.fs-guru   { font-family: 'Noto Sans Gurmukhi', serif; }
.fs-beng   { font-family: 'Noto Sans Bengali', serif; }
/* Brahmi numerals/signs: Noto has the full block (number signs, jihvamuliya…) */
.fs-bnum   { font-family: 'Noto Sans Brahmi Local', 'Noto Sans Brahmi', serif; }

/* ============ Book Page ============ */
.book-page {
  max-width: 960px;
  margin: 30px auto;
  background: #ffffff;
  border: 3px solid var(--line, #F2E3C2);
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(43, 33, 64, .06),
              0 26px 50px -28px rgba(180, 83, 9, .45);
  position: relative;
  overflow: hidden;
  padding: 0 28px 40px;
  scroll-margin-top: calc(var(--nav-h, 60px) + 64px);
  /* Only lay out / paint pages near the screen. The book is ~10 000 elements;
   * laying all of it out at once froze phones for many seconds on open. */
  content-visibility: auto;
  contain-intrinsic-size: auto 1500px;
}

/* Decorative rainbow top border — PDF style colored circles */
.page-decor {
  display: flex;
  height: 40px;
  margin: 0 -28px 20px;
  background: #ffffff;
  position: relative;
}
.page-decor::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    #f97316 0 8.33%,
    #84cc16 8.33% 16.66%,
    #06b6d4 16.66% 25%,
    #ec4899 25% 33.33%,
    #fbbf24 33.33% 41.66%,
    #14b8a6 41.66% 50%,
    #ef4444 50% 58.33%,
    #22c55e 58.33% 66.66%,
    #a3a3a3 66.66% 75%,
    #a855f7 75% 83.33%,
    #3b82f6 83.33% 91.66%,
    #78716c 91.66% 100%
  );
  mask-image: radial-gradient(circle 28px at 4.16% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 12.5% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 20.83% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 29.16% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 37.5% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 45.83% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 54.16% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 62.5% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 70.83% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 79.16% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 87.5% 0, #000 99%, transparent 100%),
              radial-gradient(circle 28px at 95.83% 0, #000 99%, transparent 100%);
  -webkit-mask-image: var(--mask, none);
}

/* Bottom copy of same decoration, mirrored */
.page-decor-bottom {
  display: flex;
  height: 40px;
  margin: 20px -28px -40px;
  transform: rotate(180deg);
}
.page-decor-bottom::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
}

/* ---- Section title bar (like PDF "स्वर वर्ण") ---- */
.section-title-bar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(90deg, #fff7ed, #fef3c7);
  border-left: 6px solid #f97316;
  border-right: 6px solid #fbbf24;
  padding: 8px 18px;
  border-radius: 10px;
  margin: 0 auto 18px;
  font-family: var(--font-fun);
  font-weight: 700;
  color: #9a3412;
  font-size: 1.2rem;
}
.section-title-wrap {
  text-align: center;
  margin-bottom: 10px;
}

/* ---- Column headers row (9 scripts) ---- */
.col-headers {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.col-headers > div {
  text-align: center;
  padding: 6px 2px;
  border-radius: 8px;
  font-family: var(--font-fun);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
}

/* ---- Character row frame — hero image + 9-script grid ---- */
.char-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  border: 2px solid #bae6fd;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 50%, #fff7ed 100%);
}
.char-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 2px solid #fcd34d;
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  box-shadow: inset 0 2px 6px rgba(251, 191, 36, 0.15);
}
.hero-icon {
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 4px;
}
.hero-icon .jain-svg {
  width: 64px;
  height: 64px;
}
.hero-icon .jain-svg svg { width: 100%; height: 100%; }
.hero-icon .jain-emoji {
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}
.hero-icon .jain-emoji-sub {
  position: absolute;
  bottom: -4px;
  right: -4px;
  font-size: 1rem;
  background: #fff;
  border-radius: 50%;
  padding: 1px 3px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.hero-letter {
  font-size: 2rem;
  font-weight: 700;
  color: #16a34a;
  line-height: 1;
  margin-top: 2px;
}
.hero-hindi {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #fde68a;
  width: 100%;
}
.hero-hindi .hindi-label {
  font-size: 0.62rem;
  color: #a16207;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.hero-hindi .hindi-word {
  font-size: 0.95rem;
  color: #78350f;
  font-weight: 700;
  line-height: 1.2;
}
.char-scripts {
  min-width: 0;
}
.char-row .circles,
.char-row .words {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  align-items: center;
}
.char-row .words {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
}

/* ---- Circle letter ---- */
.circle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  color: #ffffff;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 700;
  box-shadow: 0 4px 10px -2px rgba(0,0,0,0.25);
  text-align: center;
  padding: 4px;
  overflow: hidden;
}
.circle.small { font-size: 1.3rem; }
.circle.tiny  { font-size: 1rem; letter-spacing: -1px; }

/* Column-specific circle colors (9 scripts) */
.col-0 .circle { background: #ef4444; }  /* Brahmi   */
.col-1 .circle { background: #16a34a; }  /* Sanskrit */
.col-2 .circle { background: #f97316; }  /* Hindi    */
.col-3 .circle { background: #ec4899; }  /* English  */
.col-4 .circle { background: #6366f1; }  /* Gujarati */
.col-5 .circle { background: #0d9488; }  /* Kannada  */
.col-6 .circle { background: #991b1b; }  /* Tamil    */
.col-7 .circle { background: #0ea5e9; }  /* Punjabi  */
.col-8 .circle { background: #a855f7; }  /* Bengali  */

/* Column header colors match circles */
.col-headers { grid-template-columns: repeat(9, 1fr); }
.col-headers > div.h-0 { background: #ef4444; }
.col-headers > div.h-1 { background: #16a34a; }
.col-headers > div.h-2 { background: #f97316; }
.col-headers > div.h-3 { background: #ec4899; }
.col-headers > div.h-4 { background: #6366f1; }
.col-headers > div.h-5 { background: #0d9488; }
.col-headers > div.h-6 { background: #991b1b; }
.col-headers > div.h-7 { background: #0ea5e9; }
.col-headers > div.h-8 { background: #a855f7; }

/* Matching word colors */
.col-0 .wordcell { color: #b91c1c; }
.col-1 .wordcell { color: #15803d; }
.col-2 .wordcell { color: #c2410c; }
.col-3 .wordcell { color: #be185d; }
.col-4 .wordcell { color: #4338ca; }
.col-5 .wordcell { color: #0f766e; }
.col-6 .wordcell { color: #7f1d1d; }
.col-7 .wordcell { color: #0369a1; }
.col-8 .wordcell { color: #7e22ce; }

/* Shift headers to align with scripts side (skip hero column) */
.col-headers {
  margin-left: 132px;
}

/* ---- Word labels below circles ---- */
.wordcell {
  text-align: center;
  font-size: 0.85rem;
  line-height: 1.25;
  min-height: 38px;
  padding: 2px 3px;
  word-wrap: break-word;
  hyphens: auto;
}
/* (9-column wordcell colors are defined earlier in the file) */

/* ---- Page footer ---- */
.page-footer {
  margin-top: 24px;
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #78350f;
  font-family: var(--font-fun);
  font-size: 0.85rem;
}
.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  border: 2px solid #f59e0b;
  border-radius: 50%;
  color: #78350f;
  font-weight: 700;
  background: #fef3c7;
}

/* ============ Cover page ============ */
.cover-page {
  text-align: center;
  padding-top: 60px;
  padding-bottom: 60px;
}
.cover-page .brahmi-title {
  font-family: 'Noto Sans Brahmi Local', serif;
  font-size: 3.2rem;
  color: #b91c1c;
  margin: 14px 0 8px;
}
.cover-page .cheer {
  font-family: var(--font-fun);
  font-size: 2.6rem;
  color: #78350f;
  margin: 6px 0;
}
.cover-page .subtitle {
  color: #b45309;
  font-size: 1.1rem;
  margin-top: 10px;
}
.cover-page .tagline {
  margin-top: 30px;
  background: #fef3c7;
  border: 2px dashed #f59e0b;
  border-radius: 12px;
  padding: 14px 22px;
  display: inline-block;
  color: #78350f;
  font-size: 0.95rem;
}
.cover-page .kids-badge {
  display: inline-block;
  background: #f97316;
  color: white;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 14px;
}

/* ============ Barahkhadi section ============ */
.barah-block {
  border: 2px solid #fde68a;
  background: #fffbeb;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}
.barah-block h3 {
  font-family: var(--font-fun);
  font-size: 1.3rem;
  color: #9a3412;
  margin: 0 0 12px;
  text-align: center;
}
.barah-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.barah-cell {
  background: white;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 4px;
  text-align: center;
}
.barah-cell .b {
  font-family: 'Noto Sans Brahmi Local', serif;
  font-size: 1.8rem;
  color: #b45309;
  line-height: 1;
  display: block;
}
.barah-cell .d {
  font-family: var(--font-fun);
  font-size: 1.05rem;
  color: #1f2937;
  margin-top: 4px;
  display: block;
}

/* ============ Digits section ============ */
.digits-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.digit-card {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 2px solid #fcd34d;
  border-radius: 14px;
  padding: 16px 8px;
  text-align: center;
}
.digit-card .b {
  font-family: 'Noto Sans Brahmi Local', serif;
  font-size: 2.4rem;
  color: #b91c1c;
  display: block;
  line-height: 1;
}
.digit-card .d {
  font-family: var(--font-fun);
  font-size: 1.4rem;
  color: #78350f;
  margin-top: 6px;
  display: block;
}
.digit-card .e {
  font-weight: 700;
  color: #b45309;
  font-size: 0.85rem;
  margin-top: 2px;
  display: block;
}

/* ============================================================
 * EXPANDED SECTIONS — picture cards, intro, steps, practice
 * ============================================================ */

/* ---- Cover page enhancements ---- */
.cover-page .mascot-circle {
  width: 140px;
  height: 140px;
  margin: 20px auto 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fef3c7, #fde68a 60%, #fbbf24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  box-shadow: 0 12px 32px -8px rgba(245, 158, 11, 0.5),
              inset 0 4px 8px rgba(255,255,255,0.5);
  animation: wiggle 3s ease-in-out infinite;
}
@keyframes wiggle {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}
.mascot-books {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: 10px;
  letter-spacing: 4px;
}
.cover-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 520px;
  margin: 24px auto 20px;
}
.cover-grid .feat {
  background: white;
  border: 3px solid #fcd34d;
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
  font-size: 0.85rem;
  color: #78350f;
  font-family: var(--font-fun);
  box-shadow: 0 4px 10px -4px rgba(245, 158, 11, 0.35);
}
.cover-grid .feat strong {
  display: block;
  font-size: 1.5rem;
  color: #b45309;
  margin: 4px 0;
}
.lang-list {
  display: block;
  font-size: 0.78rem;
  color: #a16207;
  margin-top: 6px;
}
.cover-badge {
  margin-top: 24px;
  display: inline-block;
  background: linear-gradient(90deg, #f97316, #ef4444, #ec4899);
  color: white;
  padding: 10px 24px;
  border-radius: 30px;
  font-weight: 700;
  font-family: var(--font-fun);
  box-shadow: 0 6px 16px -4px rgba(236, 72, 153, 0.4);
}
.learned-list {
  background: white;
  border: 3px dashed #22c55e;
  border-radius: 14px;
  padding: 20px 28px;
  max-width: 440px;
  margin: 20px auto;
  text-align: left;
  color: #14532d;
  font-family: var(--font-fun);
  line-height: 2;
}
.section-sub {
  font-size: 0.85rem;
  color: #a16207;
  font-family: var(--font-fun);
  margin-top: 4px;
  font-weight: 500;
}

/* ---- Intro box ---- */
.intro-box {
  background: linear-gradient(135deg, #fff7ed 0%, #fef3c7 100%);
  border: 3px solid #fcd34d;
  border-radius: 18px;
  padding: 22px;
  margin-top: 10px;
}
.intro-row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 2px dashed #fde68a;
}
.intro-row:last-child { border-bottom: none; }
.intro-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 4px 10px -2px rgba(0,0,0,0.12);
}
.intro-row h3 {
  margin: 0 0 4px;
  color: #9a3412;
  font-family: var(--font-fun);
  font-size: 1.1rem;
}
.intro-row p {
  margin: 0;
  color: #44403c;
  font-family: var(--font-fun);
  line-height: 1.6;
  font-size: 0.95rem;
}

/* ---- How-to-learn steps ---- */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 10px 0 20px;
}
.step-card {
  background: white;
  border: 3px solid #bae6fd;
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  position: relative;
}
.step-num {
  position: absolute;
  top: -12px;
  right: -10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f59e0b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 8px -2px rgba(0,0,0,0.3);
}
.step-icon { font-size: 2.4rem; line-height: 1; }
.step-card h4 {
  margin: 8px 0 4px;
  font-family: var(--font-fun);
  color: #0369a1;
  font-size: 1.05rem;
}
.step-card p {
  margin: 0;
  font-size: 0.78rem;
  color: #475569;
  font-family: var(--font-fun);
  line-height: 1.45;
}
.example-strip {
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border: 2px solid #fcd34d;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}
.ex-label {
  font-size: 0.85rem;
  color: #78350f;
  font-family: var(--font-fun);
  margin-bottom: 8px;
  font-weight: 600;
}
.ex-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ex-deva { font-size: 2rem; color: #16a34a; font-family: var(--font-fun); font-weight: 700; }
.ex-emoji { font-size: 2.2rem; }
.ex-word { font-size: 1.3rem; color: #b45309; font-family: var(--font-fun); font-weight: 700; }
.ex-brahmi { font-size: 2rem; color: #dc2626; }
.ex-arrow { color: #9a3412; font-size: 1.4rem; font-weight: 700; }

/* ---- Picture cards ---- */
.pic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.pic-card {
  background: white;
  border: 3px solid #e5e7eb;
  border-radius: 18px;
  padding: 16px 10px 14px;
  text-align: center;
  box-shadow: 0 6px 18px -6px rgba(0,0,0,0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}
.pic-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 70%;
  opacity: 0.15;
  pointer-events: none;
}
.pic-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -8px rgba(0,0,0,0.25);
}
.theme-c1 { border-color: #fca5a5; background: linear-gradient(180deg, #fff1f2 0%, #ffffff 60%); }
.theme-c2 { border-color: #fdba74; background: linear-gradient(180deg, #fff7ed 0%, #ffffff 60%); }
.theme-c3 { border-color: #fde047; background: linear-gradient(180deg, #fefce8 0%, #ffffff 60%); }
.theme-c4 { border-color: #86efac; background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%); }
.theme-c5 { border-color: #67e8f9; background: linear-gradient(180deg, #ecfeff 0%, #ffffff 60%); }
.theme-c6 { border-color: #93c5fd; background: linear-gradient(180deg, #eff6ff 0%, #ffffff 60%); }
.theme-c7 { border-color: #c4b5fd; background: linear-gradient(180deg, #f5f3ff 0%, #ffffff 60%); }
.theme-c8 { border-color: #f9a8d4; background: linear-gradient(180deg, #fdf2f8 0%, #ffffff 60%); }
.pic-emoji {
  font-size: 3.8rem;
  line-height: 1;
  margin-bottom: 6px;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.15));
}
.pic-letters {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 6px 4px;
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
}
.pic-brahmi {
  font-size: 1.8rem;
  color: #dc2626;
  line-height: 1;
}
.pic-deva {
  font-size: 1.9rem;
  color: #16a34a;
  font-family: var(--font-fun);
  font-weight: 700;
  line-height: 1;
}
.pic-eng {
  font-size: 1.2rem;
  color: #be185d;
  font-family: 'Baloo 2', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1;
}
.pic-word {
  font-size: 1.1rem;
  color: #78350f;
  font-weight: 600;
  margin-top: 4px;
}
.pic-eng-word {
  font-size: 0.78rem;
  color: #78716c;
  font-family: 'Baloo 2', 'Inter', sans-serif;
  margin-top: 2px;
}

/* ---- Matras detailed grid ---- */
.matra-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.matra-cell {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 3px solid #fbbf24;
  border-radius: 14px;
  padding: 14px 4px;
  text-align: center;
  box-shadow: 0 4px 10px -3px rgba(245, 158, 11, 0.3);
}
.matra-label {
  background: #f59e0b;
  color: white;
  border-radius: 8px;
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-fun);
  margin-bottom: 8px;
}
.matra-brahmi {
  font-size: 2.2rem;
  color: #b91c1c;
  display: block;
  line-height: 1;
}
.matra-deva {
  font-size: 1.35rem;
  color: #1f2937;
  font-family: var(--font-fun);
  font-weight: 600;
  margin-top: 6px;
  display: block;
}

/* ---- Info note ---- */
.info-note {
  background: linear-gradient(90deg, #dbeafe, #bfdbfe);
  border-left: 6px solid #3b82f6;
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 16px;
  color: #1e3a8a;
  font-family: var(--font-fun);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ---- Digits — add hindi name ---- */
.digit-card .h {
  font-family: var(--font-fun);
  color: #9a3412;
  font-size: 0.95rem;
  display: block;
  margin-top: 2px;
}

/* ---- Fun facts ---- */
.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.fact-card {
  background: white;
  border: 3px solid;
  border-image: linear-gradient(135deg, #f472b6, #a78bfa) 1;
  border-radius: 16px;
  padding: 14px 16px;
  position: relative;
}
.fact-card:nth-child(4n+1) { border-color: #f472b6; background: linear-gradient(135deg, #fdf2f8, #fff); }
.fact-card:nth-child(4n+2) { border-color: #a78bfa; background: linear-gradient(135deg, #f5f3ff, #fff); }
.fact-card:nth-child(4n+3) { border-color: #34d399; background: linear-gradient(135deg, #ecfdf5, #fff); }
.fact-card:nth-child(4n+4) { border-color: #60a5fa; background: linear-gradient(135deg, #eff6ff, #fff); }
.fact-icon {
  font-size: 2.4rem;
  line-height: 1;
  margin-bottom: 6px;
}
.fact-card h4 {
  margin: 0 0 6px;
  font-family: var(--font-fun);
  color: #1f2937;
  font-size: 1.05rem;
}
.fact-card p {
  margin: 0;
  font-size: 0.85rem;
  color: #475569;
  font-family: var(--font-fun);
  line-height: 1.55;
}

/* ---- Practice boxes ---- */
.practice-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.practice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 12px;
  padding: 10px 14px;
}
.practice-hint {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #f59e0b;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
}
.practice-boxes {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.pbox {
  aspect-ratio: 1 / 1;
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #d1d5db;
  font-family: var(--font-fun);
  font-weight: 600;
}
.pbox.ghost {
  color: #e5e7eb;
}

/* ============================================================
 * संख्याएँ 1–100 (9 languages)
 * ============================================================ */
.c-0 { --c: #ef4444; --cd: #b91c1c; }   /* Brahmi   */
.c-1 { --c: #16a34a; --cd: #15803d; }   /* Sanskrit */
.c-2 { --c: #f97316; --cd: #c2410c; }   /* Hindi    */
.c-3 { --c: #ec4899; --cd: #be185d; }   /* English  */
.c-4 { --c: #6366f1; --cd: #4338ca; }   /* Gujarati */
.c-5 { --c: #0d9488; --cd: #0f766e; }   /* Kannada  */
.c-6 { --c: #991b1b; --cd: #7f1d1d; }   /* Tamil    */
.c-7 { --c: #0ea5e9; --cd: #0369a1; }   /* Punjabi  */
.c-8 { --c: #a855f7; --cd: #7e22ce; }   /* Bengali  */

.anc-inline { font-size: 1.25em; color: #b91c1c; }
.anc-key {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.anc-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  background: #fffbeb;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 10px;
}
.anc-label {
  font-weight: 700;
  color: #9a3412;
  text-align: center;
}
.anc-cells {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}
.anc-cell {
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 8px 2px 6px;
  text-align: center;
}
.anc-sign { display: block; font-size: 1.7rem; line-height: 1.2; color: #b91c1c; }
.anc-val  { display: block; font-size: 0.8rem; font-weight: 700; color: #78350f; font-family: 'Baloo 2', sans-serif; }

.num-headers,
.num-row {
  display: grid;
  grid-template-columns: 64px repeat(9, minmax(0, 1fr));
  gap: 4px;
}
.num-headers { margin-bottom: 6px; }
.num-headers > div {
  text-align: center;
  padding: 6px 2px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: var(--c);
}
.num-headers > .nh-num { background: #78350f; }
.num-row {
  padding: 5px 0;
  border-bottom: 1px dashed #e7e5e4;
}
.num-row:last-child { border-bottom: none; }
.num-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: #fef3c7;
  border: 2px solid #fcd34d;
  border-radius: 12px;
}
.nb-int { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 1.3rem; color: #78350f; line-height: 1; }
.nb-anc { font-size: 1.05rem; color: #b91c1c; line-height: 1.2; }
.num-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #fff;
  border: 1px solid #f1f5f9;
  border-top: 3px solid var(--c);
  border-radius: 10px;
  padding: 5px 2px;
  min-width: 0;
}
.nc-lang  { display: none; }
.nc-digit { font-size: 1.35rem; font-weight: 700; color: var(--c); line-height: 1.25; }
.nc-word  { font-size: 0.72rem; color: var(--cd); line-height: 1.25; overflow-wrap: anywhere; }
.num-cell.c-0 .nc-word { font-size: 0.8rem; }

/* ============================================================
 * सुन्दरी-लिपि (अङ्क-लिपि) — 64 मूल वर्ण chart
 * ============================================================ */
.sundari-intro {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 2px solid #fcd34d;
  border-radius: 14px;
  padding: 12px 18px;
  color: #44403c;
  line-height: 1.65;
  font-size: 0.95rem;
}
.sundari-intro p { margin: 4px 0; }
.sundari-quote {
  text-align: center;
  color: #9a3412;
  font-weight: 600;
}
.sd-block {
  margin-top: 16px;
  border: 2px solid #fde68a;
  border-radius: 14px;
  padding: 12px;
  background: #fffdf7;
}
.sd-block-title {
  font-weight: 700;
  color: #9a3412;
  font-size: 1.1rem;
  margin-bottom: 10px;
}
.sd-block-title span {
  font-size: 0.78rem;
  font-weight: 500;
  color: #a16207;
  margin-left: 8px;
}
.sd-note {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #78716c;
  line-height: 1.5;
}
.svar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.svar-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  background: #fef3c7;
  border-radius: 12px;
  padding: 4px;
}
.varna-cell {
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 4px 4px 6px;
  text-align: center;
  min-width: 0;
}
.vc-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.vn {
  background: #b45309;
  color: #fff;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Baloo 2', sans-serif;
  line-height: 1.5;
}
.vnb { font-size: 0.7rem; color: #a16207; }
.vc-main {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}
.vd {
  font-family: 'Noto Serif Devanagari', 'Noto Serif Devanagari Local', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.3;
}
.vbr { font-size: 1.35rem; color: #b91c1c; line-height: 1.3; }
.vl {
  font-size: 0.66rem;
  color: #78716c;
  margin-top: 1px;
}
.vy-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.vy-row:last-of-type { margin-bottom: 0; }
.vy-label {
  font-weight: 700;
  color: #c2410c;
  font-size: 0.95rem;
}
.vy-cells {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.samyukt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.samyukt-chip {
  background: #fff;
  border: 2px solid #fcd34d;
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}
.sc-deva   { font-size: 1.25rem; color: #1f2937; }
.sc-deva strong { color: #b45309; }
.sc-brahmi { font-size: 1.1rem; color: #b91c1c; margin-top: 2px; }
.sundari-total {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 8px;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 600;
  color: #78350f;
}
.sundari-total b { color: #b45309; }
.sundari-total .st-sum {
  background: #b45309;
  color: #fff;
  border-radius: 20px;
  padding: 2px 14px;
}
.sundari-example { margin-top: 16px; }
.sundari-example .ex-label .fs-bnum { color: #b91c1c; font-size: 1.15rem; margin-left: 6px; }
.sx-parts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.sx-part {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  padding: 4px 10px;
  min-width: 44px;
}
.sx-v { font-size: 1.3rem; font-weight: 700; color: #1f2937; }
.sx-n { font-size: 0.85rem; font-weight: 700; color: #b45309; font-family: 'Baloo 2', sans-serif; }
.sx-result {
  margin-top: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #9a3412;
  letter-spacing: 0.02em;
}
.sundari-source {
  margin: 14px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: #a8a29e;
}

/* ---- Responsive ---- */
@media screen and (max-width: 820px) {
  /* Numbers: each number becomes a card — badge on top, 3 × 3 language grid */
  .num-headers { display: none; }
  .num-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 10px 0;
  }
  .num-badge {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 14px;
    padding: 4px;
  }
  .nc-lang  { display: block; font-size: 0.62rem; color: #78716c; }
  .nc-word  { font-size: 0.8rem; }
  .anc-row  { grid-template-columns: 1fr; }
  .anc-cells { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  /* Sundari chart */
  .svar-grid { grid-template-columns: 1fr; }
  .vy-row { grid-template-columns: 1fr; gap: 4px; }
  .vy-cells { gap: 4px; }
  .vd  { font-size: 1.3rem; }
  .vbr { font-size: 1.1rem; }
  .vc-main { gap: 5px; }
  .samyukt-grid { grid-template-columns: 1fr; }
  .sd-block-title span { display: block; margin: 2px 0 0; }
}

@media screen and (max-width: 820px) {
  .book-page { padding: 0 14px 24px; margin: 16px auto; border-radius: 14px; }
  .page-decor, .page-decor-bottom { margin-left: -14px; margin-right: -14px; }
  .char-row { grid-template-columns: 1fr; gap: 10px; }
  .char-hero { flex-direction: row; gap: 12px; padding: 8px; }
  .hero-icon { width: 54px; height: 54px; margin-bottom: 0; }
  .hero-icon .jain-svg { width: 50px; height: 50px; }
  .hero-icon .jain-emoji { font-size: 2.2rem; }
  .hero-letter { font-size: 1.6rem; margin-top: 0; }
  .hero-hindi { margin-top: 0; padding-top: 0; border-top: none; border-left: 1px dashed #fde68a; padding-left: 12px; flex: 1; text-align: left; }
  .hero-hindi .hindi-word { font-size: 1rem; }
  .col-headers { margin-left: 0; grid-template-columns: repeat(9, 1fr); }
  .circle { width: 36px; height: 36px; font-size: 0.95rem; padding: 2px; }
  .circle.small { font-size: 0.7rem; }
  .circle.tiny  { font-size: 0.55rem; }
  .wordcell { font-size: 0.52rem; min-height: 22px; }
  .col-headers > div { font-size: 0.5rem; padding: 3px 1px; }
  .char-row .circles, .char-row .words { gap: 2px; }
  .cover-page .brahmi-title { font-size: 2rem; }
  .cover-page .cheer { font-size: 1.6rem; }
  .cover-page .mascot-circle { width: 100px; height: 100px; font-size: 3.4rem; }
  .cover-grid { grid-template-columns: repeat(2, 1fr); }
  .digits-grid { grid-template-columns: repeat(5, 1fr); }
  .barah-grid { grid-template-columns: repeat(4, 1fr); }
  .pic-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .pic-emoji { font-size: 3rem; }
  .pic-deva, .pic-brahmi { font-size: 1.4rem; }
  .pic-eng { font-size: 0.95rem; }
  .pic-word { font-size: 0.95rem; }
  .steps-grid { grid-template-columns: repeat(2, 1fr); }
  .matra-grid { grid-template-columns: repeat(4, 1fr); }
  .facts-grid { grid-template-columns: 1fr; }
  .practice-hint { width: 42px; height: 42px; font-size: 1.5rem; }
  .practice-boxes { grid-template-columns: repeat(4, 1fr); }
  .pbox { font-size: 1.3rem; }
  .intro-row { flex-direction: column; text-align: center; }
  .intro-icon { margin: 0 auto; }
  .ex-flow { gap: 8px; }
  .ex-deva, .ex-brahmi { font-size: 1.6rem; }
  .ex-word { font-size: 1.05rem; }
  .ex-emoji { font-size: 1.8rem; }
}

/* ============================================================
 * KIDS EDITION — playful look + motion (tokens from kids.css)
 * ============================================================ */

/* Letters and words stay in the clear reading font */
.fs-deva, .hero-letter, .hindi-word, .barah-cell .d, .digit-card .d, .digit-card .h,
.matra-deva, .pic-deva, .ex-deva, .ex-word, .pbox, .practice-hint.fs-deva,
.sc-deva, .sx-v {
  font-family: 'Noto Serif Devanagari', serif;
}

/* ---- Sticky chapter strip ---- */
.chapter-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 35;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 8px 16px 10px;
  background: rgba(255, 248, 231, .92);
  border-bottom: 2px dashed var(--line);
}
.chapter-bar::-webkit-scrollbar { display: none; }
.chap-chip {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: .92rem;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 0 0 2px var(--line), 0 3px 0 var(--line);
  transition: transform .2s var(--ease-bounce), background .2s ease, color .2s ease, box-shadow .2s ease;
}
.chap-chip:hover { transform: translateY(-2px); }
.chap-chip.on {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 3px 0 var(--orange-d);
  transform: scale(1.06);
}

/* ---- Pages & titles ---- */
.section-title-bar {
  font-size: 1.4rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 24px;
  box-shadow: 0 5px 0 #FCD9A8;
}
html.motion .book-page.in .section-title-bar { animation: kidDrop .8s var(--ease-bounce) .1s both; }
.section-sub { font-size: .95rem; font-weight: 600; }
.page-number { font-family: 'Baloo 2', sans-serif; transition: transform .3s var(--ease-bounce); }
.book-page:hover .page-number { transform: rotate(-12deg) scale(1.1); }

/* ---- Character rows ---- */
.char-row {
  border-radius: 22px;
  transition: transform .25s var(--ease-bounce), box-shadow .25s ease, border-color .25s ease;
}
.char-row:hover {
  transform: translateY(-3px);
  border-color: #7DD3FC;
  box-shadow: 0 10px 22px -14px rgba(14, 165, 233, .6);
}
.char-hero {
  position: relative;
  cursor: pointer;
  border-radius: 18px;
  transition: transform .2s var(--ease-bounce), background .2s ease;
}
.char-hero:hover { transform: rotate(-2deg) scale(1.03); background: #FFFBEA; }
.char-hero:hover .hero-letter { animation: kidWiggle .5s ease; }
.speak-hint {
  display: none;
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: .85rem;
}
html.can-speak .speak-hint { display: block; }
.circle { transition: transform .25s var(--ease-bounce), box-shadow .25s ease; cursor: default; }
.circle:hover { transform: translateY(-4px) scale(1.12) rotate(-6deg); box-shadow: 0 10px 16px -6px rgba(0, 0, 0, .35); }
.col-headers > div { font-family: var(--font-fun); font-weight: 700; }
.wordcell { font-weight: 600; }

/* ---- Tap-to-hear cells ---- */
[data-say] { cursor: pointer; }
.matra-cell, .barah-cell, .digit-card, .fact-card, .step-card, .feat, .varna-cell, .anc-cell, .samyukt-chip, .sx-part {
  transition: transform .22s var(--ease-bounce), box-shadow .22s ease;
}
.matra-cell:hover, .barah-cell:hover, .digit-card:hover, .anc-cell:hover, .sx-part:hover {
  transform: translateY(-4px) scale(1.06) rotate(-2deg);
  box-shadow: 0 10px 18px -10px rgba(180, 83, 9, .55);
}
.fact-card:hover, .step-card:hover, .samyukt-chip:hover { transform: translateY(-4px) rotate(-1deg); }
.feat:hover { transform: translateY(-4px) scale(1.05) rotate(2deg); }
.varna-cell:hover { transform: translateY(-3px) scale(1.06); box-shadow: 0 8px 14px -8px rgba(180, 83, 9, .5); }
.fact-card:hover .fact-icon, .step-card:hover .step-icon { animation: kidWiggle .5s ease; }
.barah-block h3 { font-family: var(--font-fun); font-weight: 800; }
.num-row { transition: background .2s ease; border-radius: 14px; }
.num-row:hover { background: #FFFBEA; }
.num-badge { transition: transform .2s var(--ease-bounce); }
.num-badge:hover { transform: scale(1.08) rotate(-3deg); }

/* ---- Cover pages ---- */
.cover-page .cheer { font-family: var(--font-fun); font-weight: 800; }
html.motion .cover-page.in .cheer { animation: kidDrop .9s var(--ease-bounce) .15s both; }
html.motion .cover-page.in .brahmi-title { animation: kidPop .8s var(--ease-bounce) .35s both; }
html.motion .cover-page.in .subtitle,
html.motion .cover-page.in .tagline { animation: kidPop .7s var(--ease-bounce) .55s both; }
.cover-page .mascot-circle { animation: kidBob 3s ease-in-out infinite; }
.cover-page .mascot-circle:hover { animation: kidWiggle .5s ease infinite; }
.mascot-books { animation: kidBob 3s ease-in-out .4s infinite; }
.cover-badge {
  background-size: 200% 100%;
  background-image: linear-gradient(90deg, #f97316, #ef4444, #ec4899, #8B5CF6, #f97316);
  animation: kidShine 3s linear 1;   /* one shine, not a forever-repaint */
}
.back-cover .learned-list > div { padding: 2px 0; }
.learned-list { font-family: var(--font-fun); font-weight: 600; font-size: 1.05rem; }

/* ---- Practice ---- */
.pbox { transition: border-color .2s ease, transform .2s var(--ease-bounce); }
.pbox:hover { border-color: var(--sun); transform: scale(1.05); }

/* ---- Mobile tweaks for the new chrome ---- */
@media screen and (max-width: 820px) {
  .chapter-bar { padding: 6px 10px 8px; }
  .chap-chip { font-size: .85rem; padding: 4px 12px; }
  .book-page { border-radius: 22px; }
  .section-title-bar { font-size: 1.15rem; padding: 6px 16px; }
}
@media screen and (max-width: 720px) {
  .print-btn { display: none; }
}

/* ============================================================
 * CARTOON-WORLD BOOK — big picture cards, flip cards, गजू tips
 * ============================================================ */
.chapter-bar {
  top: calc(var(--nav-h) + 5px);
  background: rgba(255, 255, 255, .92);
  border-bottom: 0;
  box-shadow: 0 4px 0 rgba(43, 33, 64, .06);
  padding-top: 10px;
}
.chap-chip { font-size: 1rem; padding: 6px 16px; box-shadow: inset 0 0 0 3px #FFE3A3, 0 4px 0 #F2C76B; }
.chap-chip.on { background: var(--pink); box-shadow: 0 4px 0 var(--pink-d); }

/* Pages float on the sky like big storybook sheets */
.book-page { border-width: 5px; border-radius: 34px; box-shadow: 0 12px 0 rgba(43, 33, 64, .10); }
.book-page:nth-of-type(5n+1) { border-color: #FFD27A; }
.book-page:nth-of-type(5n+2) { border-color: #9EDCF8; }
.book-page:nth-of-type(5n+3) { border-color: #FFB3C9; }
.book-page:nth-of-type(5n+4) { border-color: #A7E8B9; }
.book-page:nth-of-type(5n+5) { border-color: #C9B8FF; }
.section-title-bar { font-size: 1.6rem; border: 4px solid #FDBA74; box-shadow: 0 6px 0 #FDBA74; }

/* गजू's chapter tip */
.chapter-say { margin: 4px 0 18px; }
.chapter-say .say-bubble { font-size: 1.1rem; }

/* Cover: गजू greets */
.cover-say { justify-content: center; max-width: 520px; margin: 0 auto 6px; text-align: left; }
.cover-say .say-mascot { width: 170px; height: 160px; }
.cover-say .say-bubble { flex: 0 1 auto; font-size: 1.2rem; }
.cover-page .brahmi-title { font-size: 3.6rem; }
.cover-page .cheer { font-size: 2.9rem; color: var(--orange-d); }

/* ---- Letter cards: picture | BIG Brahmi | 8 script chips ---- */
.char-row {
  display: grid;
  grid-template-columns: 140px 190px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 14px;
  border: 4px solid #BAE6FD;
  border-radius: 28px;
  background: #F4FBFF;
  margin-bottom: 18px;
}
.char-hero {
  justify-content: center;
  border: 4px solid #FCD34D;
  border-radius: 22px;
  box-shadow: 0 5px 0 #F2C76B;
  padding: 10px 6px;
}
.hero-icon { width: 76px; height: 76px; }
.hero-icon .jain-svg { width: 72px; height: 72px; }
.hero-letter { font-size: 2.6rem; color: var(--leaf-d); }
.hero-hindi .hindi-label { font-size: .7rem; }
.hero-hindi .hindi-word { font-size: 1.05rem; }

.brahmi-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 8px;
  text-align: center;
  background: #FFF1F3;
  border: 4px dashed #FB7185;
  border-radius: 22px;
  min-width: 0;
  transition: transform .22s var(--ease-bounce);
}
.brahmi-feature:hover { transform: scale(1.04) rotate(-2deg); }
.bf-label {
  font-size: .85rem;
  font-weight: 800;
  color: #fff;
  background: #F43F5E;
  border-radius: 999px;
  padding: 1px 12px;
}
.bf-letter { font-size: 4.4rem; line-height: 1.15; color: #E11D48; }
.brahmi-feature:hover .bf-letter { animation: kidWiggle .5s ease; }
.bf-word { font-size: 1.2rem; color: #9F1239; overflow-wrap: anywhere; }

.script-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-content: center;
}
.script-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 6px 4px 8px;
  text-align: center;
  background: #fff;
  border: 3px solid var(--c);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--cd);
  transition: transform .22s var(--ease-bounce);
}
.script-chip:hover { transform: translateY(-4px) rotate(-2deg); }
.sc-name {
  font-family: var(--font-fun);
  font-size: .75rem;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
  padding: 0 10px;
  white-space: nowrap;
}
.sc-letter { font-size: 1.9rem; font-weight: 700; line-height: 1.25; color: var(--cd); }
.sc-word { font-size: .85rem; font-weight: 600; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; }

/* ---- Counting flip cards ---- */
.num-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.num-card {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  perspective: 900px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.num-card:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 22px; }
.flip-inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform .65s var(--ease-bounce);
}
.num-card.flipped .flip-inner { transform: rotateY(180deg); }
.num-card:hover:not(.flipped) .flip-inner { transform: rotateY(-12deg) translateY(-3px); }
.face {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 10px 6px;
  border: 4px solid var(--c);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 6px 0 var(--cd);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.face.back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  padding: 8px 8px;
  background: #FFFDF5;
}
.nf-int { font-family: 'Baloo 2', sans-serif; font-size: 2.8rem; font-weight: 800; line-height: 1; color: var(--cd); }
.nf-brahmi { font-size: 2rem; line-height: 1.2; color: #E11D48; }
.nf-hindi { font-family: 'Noto Serif Devanagari', serif; font-size: 1.15rem; font-weight: 700; color: var(--ink); }
.nf-anc { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.nf-anc .fs-bnum { font-size: 1.05rem; color: #B91C1C; }
.nf-hint {
  margin-top: 5px;
  font-size: .78rem;
  font-weight: 800;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
  padding: 0 10px;
}
.nb-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 2px 0;
  border-bottom: 1.5px dashed #F1E7CF;
  text-align: left;
  font-size: .78rem;
  line-height: 1.25;
}
.nb-line:last-child { border-bottom: 0; }
.nbl-name { flex: 0 0 3.6em; font-family: var(--font-fun); font-size: .68rem; font-weight: 800; color: var(--cd); }
.nbl-digit { flex: 0 0 auto; font-weight: 700; color: var(--c); }
.nbl-word { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.nb-line.c-0 .nbl-word, .nb-line.c-0 .nbl-digit { font-size: .95rem; }

/* Bigger, friendlier cells elsewhere */
.barah-cell { border-width: 3px; border-radius: 16px; box-shadow: 0 4px 0 #F2C76B; }
.barah-cell .b { font-size: 2.1rem; }
.digit-card { border-width: 4px; border-radius: 22px; box-shadow: 0 5px 0 #F2C76B; }
.matra-cell { border-radius: 20px; box-shadow: 0 5px 0 #E0A100; }
.fact-card { border-width: 4px; border-radius: 22px; }
.info-note { border-radius: 18px; border-left-width: 8px; font-size: 1rem; }

@media screen and (max-width: 960px) {
  .char-row { grid-template-columns: 130px 170px minmax(0, 1fr); }
  .script-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .num-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media screen and (max-width: 820px) {
  .char-row { grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
  .char-hero { flex-direction: column; gap: 0; }
  .hero-icon { width: 60px; height: 60px; }
  .hero-icon .jain-svg { width: 56px; height: 56px; }
  .hero-letter { font-size: 2.2rem; }
  .hero-hindi { margin-top: 4px; padding: 4px 0 0; border-left: 0; border-top: 1px dashed #fde68a; text-align: center; }
  .bf-letter { font-size: 3.4rem; }
  .script-chips { grid-column: 1 / -1; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .sc-letter { font-size: 1.5rem; }
  .sc-word { font-size: .72rem; }
  .sc-name { font-size: .64rem; padding: 0 6px; }
  .num-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .cover-say .say-mascot { width: 120px; height: 112px; }
  .cover-page .brahmi-title { font-size: 2.4rem; }
  .cover-page .cheer { font-size: 1.9rem; }
  .section-title-bar { font-size: 1.25rem; }
  .chapter-say .say-bubble { font-size: 1rem; }
}

/* ============================================================
 * LETTER ICONS — every icon sits in the same round badge.
 * --icon-size is set from the admin panel (data/icons.json).
 * ============================================================ */
:root { --icon-size: 76px; }
.hero-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #FFF1C2 75%);
  border: 3px solid #FCD34D;
  box-shadow: 0 3px 0 #F2C76B;
  overflow: hidden;
}
.ji { display: grid; place-items: center; width: 100%; height: 100%; line-height: 1; }
.ji-svg svg { width: 86%; height: 86%; display: block; }
.ji-emoji { font-size: calc(var(--icon-size) * .55); }
.ji-img { width: 82%; height: 82%; object-fit: contain; display: block; }
@media screen and (max-width: 820px) {
  .hero-icon { width: calc(var(--icon-size) * .8); height: calc(var(--icon-size) * .8); }
  .ji-emoji { font-size: calc(var(--icon-size) * .44); }
}

/* ---- Print dialog ---- */
.print-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(43, 33, 64, .45);
}
.print-dialog[hidden] { display: none; }
.pd-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-sizing: border-box;
  padding: 18px;
  background: #fff;
  border: 5px solid #C9B8FF;
  border-radius: 30px;
  box-shadow: 0 10px 0 rgba(43, 33, 64, .2);
  animation: kidPop .35s var(--ease-bounce);
}
.pd-card .say-mascot { width: 90px; height: 84px; }
.pd-card .say-bubble { font-size: 1.25rem; font-weight: 800; margin-bottom: 18px; }
.pd-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 6px 0 12px; }
.pd-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 14px 10px;
  border: 0;
  cursor: pointer;
  border-radius: 22px;
  color: #fff;
  background: var(--c);
  box-shadow: 0 7px 0 var(--cd);
  font-family: var(--font-fun);
  text-align: center;
  transition: transform .2s var(--ease-bounce), box-shadow .2s ease;
}
.pd-opt:hover { transform: translateY(-4px); box-shadow: 0 11px 0 var(--cd); }
.pd-opt:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--cd); }
.pd-opt:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.pd-pic { font-size: 2.6rem; line-height: 1.1; }
.pd-name { font-size: 1.3rem; font-weight: 800; }
.pd-sub { font-size: .85rem; font-weight: 600; line-height: 1.35; opacity: .95; }
.pd-tip { margin: 4px 0 12px; font-weight: 600; color: var(--ink-soft); }
.pd-close { display: block; margin: 0 auto; }
@media screen and (max-width: 520px) {
  .pd-options { grid-template-columns: 1fr; }
}

/* ============================================================
 * STORYBOOK EDITION — every page is a picture-book page:
 * bunting on top, grassy hills at the bottom, a coloured frame,
 * a ribbon title, big flash cards. Same look on screen and paper.
 * ============================================================ */
.tone-0 { --t: #FF5C8A; --td: #D63A68; --tl: #FFE6EE; }
.tone-1 { --t: #3EC1F3; --td: #1C93C4; --tl: #E2F6FF; }
.tone-2 { --t: #FF8A3D; --td: #D9631A; --tl: #FFEDE0; }
.tone-3 { --t: #3DC46F; --td: #239A50; --tl: #E3F8EA; }
.tone-4 { --t: #8B5CF6; --td: #6A3BD6; --tl: #EFE8FF; }
.tone-5 { --t: #F5B400; --td: #C98F00; --tl: #FFF5D6; }

.book-page {
  --page-c: #FFD27A; --rib: #FF8A3D; --rib-d: #C9581A;
  max-width: 1080px;
  border: 6px solid var(--page-c) !important;
  border-radius: 36px;
  padding: 0 34px 92px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 90' preserveAspectRatio='none'%3E%3Cpath d='M0 46 C 180 6, 380 6, 600 40 S 1010 86, 1200 30 L1200 90 L0 90Z' fill='%23A6E58C'/%3E%3Cpath d='M0 66 C 260 30, 520 44, 760 70 S 1100 52, 1200 60 L1200 90 L0 90Z' fill='%236CCB5F'/%3E%3Cg fill='%23fff'%3E%3Ccircle cx='140' cy='74' r='5'/%3E%3Ccircle cx='430' cy='70' r='4'/%3E%3Ccircle cx='820' cy='80' r='5'/%3E%3Ccircle cx='1080' cy='72' r='4'/%3E%3C/g%3E%3Cg fill='%23FFC93C'%3E%3Ccircle cx='140' cy='74' r='2'/%3E%3Ccircle cx='430' cy='70' r='1.6'/%3E%3Ccircle cx='820' cy='80' r='2'/%3E%3Ccircle cx='1080' cy='72' r='1.6'/%3E%3C/g%3E%3C/svg%3E") bottom center / 100% 78px no-repeat,
    linear-gradient(180deg, #EEF9FF 0%, #FFFFFF 30%, #FFFFFF 80%, #F3FFF0 100%);
}
.book-page:nth-of-type(6n+1) { --page-c: #FFD27A; --rib: #FF8A3D; --rib-d: #C9581A; }
.book-page:nth-of-type(6n+2) { --page-c: #9EDCF8; --rib: #2BA8E0; --rib-d: #1A7DAA; }
.book-page:nth-of-type(6n+3) { --page-c: #FFB3C9; --rib: #F2507F; --rib-d: #B8305A; }
.book-page:nth-of-type(6n+4) { --page-c: #A7E8B9; --rib: #2FB862; --rib-d: #1E8545; }
.book-page:nth-of-type(6n+5) { --page-c: #C9B8FF; --rib: #8257F0; --rib-d: #5B36C4; }
.book-page:nth-of-type(6n+6) { --page-c: #FFE08A; --rib: #E8A500; --rib-d: #A97800; }

/* bunting garland instead of the plain rainbow strip */
.page-decor {
  height: 48px;
  margin: 0 -34px 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='48' viewBox='0 0 240 48'%3E%3Cpath d='M0 4 Q120 30 240 4' fill='none' stroke='%237A5C3E' stroke-width='2'/%3E%3Cpolygon points='6,10 34,12 20,38' fill='%23FF5C8A'/%3E%3Cpolygon points='46,18 74,21 60,46' fill='%23FFC93C'/%3E%3Cpolygon points='86,23 114,24 100,48' fill='%233DC46F'/%3E%3Cpolygon points='126,24 154,23 140,48' fill='%233EC1F3'/%3E%3Cpolygon points='166,21 194,18 180,46' fill='%238B5CF6'/%3E%3Cpolygon points='206,12 234,10 220,38' fill='%23FF8A3D'/%3E%3C/svg%3E") repeat-x 0 0 / 240px 48px;
}
.page-decor::before { display: none; }
.page-decor-bottom { display: none; }

/* ribbon title */
.section-title-wrap { margin: 2px 0 12px; }
.section-title-bar {
  position: relative;
  display: inline-block;
  padding: 8px 36px !important;
  border: 0 !important;
  border-radius: 12px !important;
  background: var(--rib) !important;
  color: #fff !important;
  font-size: 1.75rem !important;
  font-weight: 800;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  box-shadow: 0 6px 0 var(--rib-d) !important;
}
.section-title-bar::before,
.section-title-bar::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 34px;
  height: 100%;
  background: var(--rib-d);
  z-index: -1;
}
.section-title-bar::before { left: -24px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 32% 50%); }
.section-title-bar::after  { right: -24px; clip-path: polygon(0 0, 100% 0, 68% 50%, 100% 100%, 0 100%); }
.section-sub {
  display: table;                 /* own line, centred under the ribbon */
  margin: 12px auto 0 !important;
  padding: 2px 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--page-c);
  color: var(--ink-soft) !important;
  font-weight: 700 !important;
}

/* page number = a little sun sitting on the grass */
.page-footer {
  position: absolute;
  left: 34px;
  right: 34px;
  bottom: 14px;
  margin: 0 !important;
  padding: 0 !important;
  color: #1E6B35 !important;
  font-weight: 800;
  z-index: 2;
}
.page-number {
  min-width: 42px !important;
  height: 42px !important;
  border: 3px solid #fff !important;
  background: radial-gradient(circle at 35% 30%, #FFE680, #FFC93C) !important;
  color: #7A4B00 !important;
  font-size: 1.05rem;
  box-shadow: 0 0 0 4px rgba(255, 201, 60, .45);
}

/* ---- Letter flash cards ---- */
.letter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 20px;
  margin-top: 8px;
}
.letter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 16px 14px;
  background: #fff radial-gradient(circle at 100% 0, var(--tl) 0 86px, transparent 87px);
  border: 4px solid var(--t);
  border-radius: 30px;
  box-shadow: 0 7px 0 var(--td);
  cursor: pointer;
  transition: transform .22s var(--ease-bounce), box-shadow .22s ease;
}
.letter-card:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 11px 0 var(--td); }
.letter-grid > .letter-card:nth-child(even):hover { transform: translateY(-4px) rotate(1deg); }
.letter-card .speak-hint { top: 10px; right: 14px; }
.lc-sound {
  position: absolute;
  top: -14px;
  left: 20px;
  padding: 1px 14px;
  border-radius: 999px;
  background: var(--t);
  color: #fff;
  font-family: 'Baloo 2', sans-serif;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: 0 3px 0 var(--td);
}
.lc-top { display: flex; align-items: center; gap: 14px; }
.lc-top .hero-icon { margin: 0; border-color: var(--t); box-shadow: 0 4px 0 var(--td); }
.lc-pair { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; min-width: 0; }
.lc-bubble {
  position: relative;
  flex: 0 0 auto;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.lc-d { background: var(--t); color: #fff; box-shadow: inset 0 -7px 0 rgba(0, 0, 0, .13), 0 5px 0 var(--td); }
.lc-b { background: #fff; border: 4px dashed var(--t); }
.lc-deva { font-family: 'Noto Serif Devanagari', serif; font-size: 3.5rem; font-weight: 700; line-height: 1; text-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.lc-brahmi { font-size: 3.7rem; color: #E11D48; line-height: 1; }
.lc-cap {
  position: absolute;
  bottom: -13px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 10px;
  border-radius: 999px;
  background: #fff;
  color: var(--td);
  box-shadow: inset 0 0 0 2px var(--t);
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: none;
}
.lc-arrow { font-size: 2.1rem; font-weight: 800; color: var(--td); }
.letter-card:hover .lc-arrow { animation: kidWiggle .5s ease; }
.lc-word {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 10px;
  padding: 8px 12px;
  border-radius: 18px;
  background: var(--tl);
}
.lc-hindi { font-family: 'Noto Serif Devanagari', serif; font-size: 1.35rem; font-weight: 700; color: var(--ink); }
.lc-bword { font-size: 1.35rem; color: #B91C1C; }
.lc-eng { font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--td); }
.lc-dot { color: var(--t); font-size: .8rem; }
.ji-svg svg { width: 96%; height: 96%; }

/* the letter in all 9 languages */
.lang-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.lang-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
  padding: 3px 4px 6px;
  text-align: center;
  background: #fff;
  border: 2.5px solid var(--c);
  border-radius: 14px;
  box-shadow: 0 3px 0 var(--cd);
  transition: transform .2s var(--ease-bounce);
}
.lang-tile:hover { transform: translateY(-3px) rotate(-2deg); }
.lt-name {
  font-family: var(--font-fun);
  font-size: .7rem;
  font-weight: 800;
  line-height: 1.55;
  color: #fff;
  background: var(--c);
  border-radius: 999px;
  padding: 0 9px;
  white-space: nowrap;
}
.lt-letter { font-size: 1.6rem; font-weight: 700; line-height: 1.25; color: var(--cd); }
.lt-word { font-size: .8rem; font-weight: 600; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.cover-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; max-width: 640px !important; }
@media screen and (max-width: 820px) {
  .cover-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .lt-letter { font-size: 1.35rem; }
  .lt-word { font-size: .74rem; }
}

/* print-only watermark image — loaded with the page, shown only on paper */
.page-mark { display: none; }
/* while getting ready to print, lay out every page so its fonts load */
html.print-prep .book-page { content-visibility: visible !important; }

/* ---- अनुक्रमणिका ---- */
.toc {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}
.toc-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 20px;
  background: #fff;
  border: 3px solid var(--t);
  box-shadow: 0 4px 0 var(--td);
  color: var(--ink);
  text-decoration: none;
  transition: transform .2s var(--ease-bounce);
}
.toc-item a:hover { transform: translateX(5px); }
.toc-emoji {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--tl);
  font-size: 1.6rem;
}
.toc-text { display: flex; flex-direction: column; min-width: 0; }
.toc-name { font-weight: 800; font-size: 1.15rem; line-height: 1.2; }
.toc-desc { font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.toc-dots { flex: 1; min-width: 16px; border-bottom: 3px dotted var(--t); margin: 0 4px; }
.toc-page {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--t);
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
}

/* ---- wider pages: roomier grids ---- */
.intro-box { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.intro-row:nth-last-child(2) { border-bottom: none; }
.practice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
.sd-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.sd-cols .sd-block { margin-top: 12px; }
.sd-cols .samyukt-grid { grid-template-columns: 1fr; }
.sd-pair { display: grid; grid-template-columns: 1fr 1.3fr; gap: 14px; align-items: stretch; }
.sd-pair > * { margin-top: 14px !important; }
.sd-pair .sundari-total { align-content: center; }

/* back cover: cheer on the left, what-you-learned on the right */
@media screen and (min-width: 900px) {
  .back-cover { display: grid; grid-template-columns: 1fr 1fr; column-gap: 26px; align-content: start; }
}
.back-cover > .page-decor { grid-column: 1 / -1; }
.back-cover > .cover-say    { grid-column: 1; grid-row: 2; }
.back-cover > .cheer           { grid-column: 1; grid-row: 3; }
.back-cover > .subtitle     { grid-column: 1; grid-row: 4; }
.back-cover > .cover-badge  { grid-column: 1; grid-row: 5; justify-self: center; align-self: start; }
.back-cover > .learned-list { grid-column: 2; grid-row: 2 / span 2; margin: 10px 0 !important; max-width: none; }
.back-cover > .tagline      { grid-column: 2; grid-row: 4 / span 2; margin-top: 6px !important; }
@media screen and (min-width: 900px) {
  .barah-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
  .barah-cell { padding: 8px 2px; }
}

@media screen and (max-width: 820px) {
  .book-page { padding: 0 14px 74px; border-width: 5px !important; border-radius: 26px; }
  .page-decor { margin: 0 -14px 4px; height: 40px; background-size: 200px 40px; }
  .page-footer { left: 14px; right: 14px; bottom: 10px; }
  .section-title-bar { font-size: 1.3rem !important; padding: 6px 24px !important; }
  .letter-grid { grid-template-columns: 1fr; gap: 22px; }
  .lc-bubble { width: 86px; height: 86px; }
  .lc-deva { font-size: 2.7rem; }
  .lc-brahmi { font-size: 2.8rem; }
  .lc-arrow { font-size: 1.6rem; }
  .lc-top { gap: 10px; }
  .lc-hindi, .lc-bword { font-size: 1.15rem; }
  .toc { grid-template-columns: 1fr; gap: 10px; }
  .intro-box, .practice-grid, .sd-cols, .sd-pair { grid-template-columns: 1fr; }
  .intro-row:nth-last-child(2) { border-bottom: 2px dashed #fde68a; }
}
@media screen and (max-width: 420px) {
  .digits-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aa-input-wrap { display: flex; flex-wrap: wrap; justify-content: center; }
  .aa-input { width: 100%; box-sizing: border-box; }
}
@media screen and (max-width: 400px) {
  .lc-top { flex-direction: column; }
  .lc-top .hero-icon { width: calc(var(--icon-size) * .7); height: calc(var(--icon-size) * .7); }
}

/* ============================================================
 * PRINT — landscape picture book, one page per sheet,
 * full colour, Kundkund Kahan Welfare Society watermark.
 * A4 landscape by default; html.print-a5 = the same pages × 1/√2.
 * Screen-only layout rules are `@media screen`, so print always
 * starts from the wide layout.
 * ============================================================ */
@page { size: A4 landscape; margin: 7mm; }

@media print {
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    animation: none !important;
    transition: none !important;
  }
  html, body.kids { background: #fff !important; }
  body.kids { padding: 0 !important; }
  .kid-footer, .print-dialog, .speak-hint, .nf-hint { display: none !important; }

  .book-page {
    content-visibility: visible !important;
    contain: none !important;
    max-width: none !important;
    width: auto !important;
    min-height: 195mm;
    box-sizing: border-box;
    margin: 0 !important;
    padding: 0 9mm 21mm !important;
    border-width: 5px !important;
    border-radius: 22px !important;
    box-shadow: none !important;
    overflow: visible !important;
    break-before: page;
    break-inside: auto;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
  }
  .book-page:first-child { break-before: auto; }
  html.print-a5 .book-page { zoom: .707; }

  /* watermark: the society's logo, faint, in the middle of every sheet */
  .page-mark {
    display: block !important;
    position: absolute;
    /* centred with margins, not transform — a translated box still counts
     * at its original place, which pushed a blank sheet after the last page */
    top: 21%;
    left: 0;
    right: 0;
    margin: 0 auto;
    height: 62%;
    width: auto;
    opacity: .09;
    pointer-events: none;
    z-index: 30;
  }

  /* ---- fill every sheet: the main block of each page grows into the
   *      free space and its cards stretch, instead of leaving the bottom
   *      third of the paper empty ---- */
  .book-page.letters-page, .book-page.num-page, .book-page.barah-page,
  #suchi, #parichay, #kaise, #matra, #ank, #tathya {
    display: flex !important;
    flex-direction: column;
  }
  .letters-page > .letter-grid, .num-page > .num-cards, #suchi > .toc, #kaise > .steps-grid,
  #matra > .matra-grid, #ank > .digits-grid, #tathya > .facts-grid, #parichay > .intro-box {
    flex: 1 1 auto;
    grid-auto-rows: 1fr;
    align-content: stretch;
  }
  .barah-page > .barah-block { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
  .barah-page > .barah-block > .barah-grid { flex: 1 1 auto; }
  .barah-cell, .matra-cell, .digit-card, .step-card, .fact-card {
    display: flex !important; flex-direction: column; justify-content: center; align-items: center;
  }
  .fact-card { align-items: flex-start; }
  #parichay > .intro-box { align-content: space-evenly; }

  /* letter pages: 4 tall cards per row, centred when a page has 3 */
  .letters-page > .letter-grid { display: flex !important; justify-content: center; align-items: stretch; }
  /* border-box: 4 cards + 3 gaps must add up to exactly the page width —
   * a card 13 px too wide made Chrome shrink the WHOLE printout to 96 % */
  .letters-page .letter-card { flex: 0 0 calc((100% - 12mm) / 4); box-sizing: border-box; min-width: 0; display: flex; flex-direction: column; }
  .letters-page .lang-tiles { flex: 1 1 auto; grid-auto-rows: 1fr; }
  .letters-page .lang-tile { justify-content: center; }

  /* counting cards stretch to fill both rows */
  .num-card { display: flex !important; }
  .num-card .flip-inner { flex: 1 1 auto; }
  .num-card .face.back { flex: 1 1 auto; justify-content: space-evenly !important; }

  /* index rows share the sheet */
  #suchi > .toc .toc-item, #suchi > .toc .toc-item a { height: 100%; box-sizing: border-box; }

  .page-decor { margin: 0 -9mm 4px !important; height: 40px; background-size: 200px 40px; }
  .page-footer { left: 9mm; right: 9mm; bottom: 3mm; font-size: .8rem; }
  .page-number { min-width: 34px !important; height: 34px !important; }
  .section-title-wrap { margin: 0 0 6px !important; break-after: avoid; }
  .section-title-bar { font-size: 1.4rem !important; padding: 5px 30px !important; }
  .section-sub { margin-top: 8px !important; font-size: .8rem !important; }
  .chapter-say { margin: 0 0 8px !important; break-after: avoid; }
  .chapter-say .say-mascot, .cover-say .say-mascot { width: 62px !important; height: 58px !important; }
  .say-bubble { font-size: .9rem !important; padding: 5px 12px !important; margin-bottom: 14px !important; box-shadow: none !important; border-width: 3px !important; }

  /* never cut one of these in half */
  .letter-card, .num-card, .barah-block, .digit-card, .matra-cell, .fact-card, .step-card,
  .say, .intro-row, .practice-row, .anc-row, .sd-block, .samyukt-chip, .sundari-total,
  .example-strip, .info-note, .feat, .cover-grid, .learned-list, .tagline, .varna-cell,
  .svar-group, .vy-row, .barah-cell, .toc-item { break-inside: avoid; }

  /* landscape: four tall flash cards side by side, 9 languages in each */
  .letter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 4mm !important; margin-top: 3mm !important; }
  .letter-card { box-shadow: none !important; padding: 14px 9px 9px !important; gap: 7px !important; }
  .lc-top { flex-direction: column !important; gap: 4px !important; }
  .lc-top .hero-icon { box-shadow: none !important; width: 54px !important; height: 54px !important; }
  .lc-top .ji-emoji { font-size: 30px !important; }
  .lc-d { box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .13) !important; }
  .lc-bubble { width: 72px !important; height: 72px !important; }
  .lc-deva { font-size: 2.55rem !important; }
  .lc-brahmi { font-size: 2.65rem !important; }
  .lc-arrow { font-size: 1.5rem !important; }
  .lc-pair { gap: 8px !important; }
  .lc-cap { font-size: .6rem !important; bottom: -11px !important; }
  .lc-word { margin-top: 6px; padding: 2px 6px !important; gap: 0 6px !important; line-height: 1.25; }
  .lc-hindi, .lc-bword { font-size: 1rem !important; }
  .lc-eng { font-size: .78rem !important; }
  .lang-tiles { gap: 3px !important; }
  .lang-tile { padding: 1px 2px 2px !important; border-width: 1.5px !important; border-radius: 10px !important; box-shadow: none !important; }
  .lt-name { font-size: .5rem !important; padding: 0 6px !important; line-height: 1.45 !important; }
  .lt-letter { font-size: 1.15rem !important; line-height: 1.15 !important; }
  .lt-word { font-size: .56rem !important; line-height: 1.12 !important; }
  .cover-grid { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; max-width: 700px !important; }
  .chapter-say .say-bubble { font-size: .85rem !important; padding: 4px 12px !important; }

  .toc-item a { box-shadow: none !important; padding: 4px 10px !important; }
  .toc { gap: 6px 22px !important; }
  .toc-emoji { width: 40px !important; height: 40px !important; }
  .anc-key { margin: 8px 0 !important; gap: 6px !important; }
  .anc-row { padding: 6px !important; }
  .anc-cell { padding: 4px 2px 3px !important; }

  .barah-block { padding: 6px 10px !important; margin-bottom: 6px !important; }
  .barah-block h3 { font-size: 1.05rem !important; margin-bottom: 4px !important; }
  .barah-grid { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; gap: 4px !important; }
  .barah-cell { padding: 5px 2px !important; box-shadow: none !important; }
  .barah-cell .b { font-size: 1.6rem !important; }
  .barah-cell .d { font-size: .9rem !important; }

  /* counting cards: 5 × 3, number on top and all 9 languages underneath */
  .num-cards { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 2.5mm !important; }
  .num-card .flip-inner { transform: none !important; display: flex !important; flex-direction: column; }
  .num-card .face {
    position: static !important;
    transform: none !important;
    -webkit-backface-visibility: visible !important;
    backface-visibility: visible !important;
    box-shadow: none !important;
  }
  .num-card .face.front {
    flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: baseline;
    column-gap: 6px; padding: 3px 4px 1px; border-bottom-width: 0; border-radius: 16px 16px 0 0;
  }
  .num-card .face.back { padding: 2px 6px 4px; border-top: 2px dashed var(--c); border-radius: 0 0 16px 16px; }
  .num-page .section-sub { display: none !important; }   /* "touch to flip" means nothing on paper */
  .num-cards { gap: 3mm 4mm !important; margin-top: 2mm !important; }
  .nf-int { font-size: 1.8rem !important; }
  .nf-brahmi { font-size: 1.4rem !important; }
  .nf-hindi { display: none !important; }
  .nf-anc { width: 100%; font-size: .72rem !important; }
  .nb-line { font-size: .74rem !important; line-height: 1.18 !important; padding: 1px 0 !important; }
  .nbl-name { font-size: .6rem !important; flex-basis: 3.5em !important; }
  .nb-line.c-0 .nbl-word, .nb-line.c-0 .nbl-digit { font-size: .86rem !important; }

  .barah-cell, .digit-card, .matra-cell, .fact-card, .step-card, .feat, .varna-cell,
  .samyukt-chip, .anc-cell, .sx-part, .toc-item a { box-shadow: none !important; }
  .facts-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 8px !important; }
  .fact-card { padding: 10px 12px !important; }
  .steps-grid { margin-bottom: 10px !important; }
  .intro-box { padding: 10px 16px !important; }
  .intro-row { padding: 8px 0 !important; }
  .practice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 8px 12px !important; }
  .practice-row { padding: 6px 8px !important; gap: 8px !important; }
  .practice-boxes { gap: 5px !important; }
  .pbox { aspect-ratio: auto !important; height: 16mm !important; font-size: 1.5rem !important; }
  .practice-hint { width: 14mm !important; height: 14mm !important; }
  .info-note { padding: 6px 12px !important; margin-top: 8px !important; font-size: .85rem !important; }

  /* cover: big and bold across the landscape sheet */
  .cover-page:not(.back-cover) .cover-say { max-width: none !important; }
  .cover-page:not(.back-cover) .cover-say .say-mascot { width: 118px !important; height: 110px !important; }
  .cover-page:not(.back-cover) .cover-say .say-bubble { font-size: 1.15rem !important; }
  .cover-page:not(.back-cover) .brahmi-title { font-size: 4rem !important; margin: 0 !important; line-height: 1.15; }
  .cover-page:not(.back-cover) h1 { font-size: 3.2rem !important; margin: 0 !important; line-height: 1.2; }
  .cover-page:not(.back-cover) .subtitle { font-size: 1.2rem !important; margin-top: 4px !important; }
  .cover-grid { margin: 12px auto !important; max-width: 640px !important; }
  .cover-grid .feat { font-size: 1rem !important; }
  .cover-grid .feat strong { font-size: 2rem !important; }
  .cover-page .tagline { margin-top: 8px !important; font-size: 1rem !important; }
  .cover-badge { margin-top: 12px !important; font-size: 1.1rem !important; }

  /* back cover: two columns */
  .back-cover { display: grid !important; grid-template-columns: 1fr 1fr; column-gap: 24px; align-content: start; padding-top: 0 !important; }
  .back-cover > .cheer{ font-size: 2.8rem !important; margin: 4px 0 !important; }
  .back-cover > .learned-list { line-height: 1.7 !important; padding: 12px 20px !important; font-size: .95rem !important; }
  .back-cover > .tagline { font-size: .82rem !important; padding: 10px 16px !important; }

  .sundari-intro { padding: 8px 14px !important; }
  .sd-block { padding: 8px !important; }
  .vd { font-size: 1.3rem !important; }
  .vbr { font-size: 1.15rem !important; }
  .varna-cell { padding: 2px 3px 3px !important; }
  .sd-cols { grid-template-columns: 1.4fr 1fr !important; }
  .sd-pair { grid-template-columns: 1fr 1.3fr !important; }
  .vy-row { margin-bottom: 3px !important; }
  .sundari-source { margin-top: 4px !important; }
  .sundari-intro { font-size: .8rem !important; line-height: 1.4 !important; padding: 5px 12px !important; }
  .sundari-intro p { margin: 2px 0 !important; }
  .sd-svar .svar-grid { gap: 4px 8px !important; }
  .sd-svar .svar-group { padding: 3px !important; gap: 3px !important; }
  .sd-svar .vd { font-size: 1.15rem !important; }
  .sd-svar .vbr { font-size: 1rem !important; }
  .sd-svar .vl { font-size: .55rem !important; margin-top: 0 !important; }
  .vn { font-size: .62rem !important; }
  .sd-note { margin-top: 3px !important; font-size: .7rem !important; }
  .sundari-total { margin-top: 6px !important; padding: 4px 10px !important; font-size: .9rem !important; }
  .aa-blank-row:nth-child(n+3) { display: none !important; }
  .anka-activity { margin-top: 10px !important; padding: 10px 14px !important; }
  .aa-blank i { height: 12mm !important; }
  .aa-blank i + i { height: 8mm !important; }
  .barah-block { margin-bottom: 3px !important; padding: 5px 10px !important; }
  .barah-cell { padding: 3px 2px !important; }

  /* "write your name" page: the live typing box becomes blank boxes */
  .aa-input-wrap, .aa-out { display: none !important; }
  .aa-print { display: block !important; }
}

/* ---- अङ्क-लिपि activity ("write your name") ---- */
.anka-activity {
  margin-top: 16px;
  padding: 14px 16px 16px;
  border: 4px dashed #C9B8FF;
  border-radius: 26px;
  background: #F7F3FF;
  text-align: center;
}
.aa-head { font-size: 1.15rem; font-weight: 800; color: var(--grape-d); margin-bottom: 10px; }
.aa-input-wrap { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.aa-label { font-weight: 800; font-size: 1.1rem; }
.aa-input {
  width: min(320px, 70vw);
  padding: 8px 16px;
  border: 3px solid var(--grape);
  border-radius: 16px;
  font-family: 'Noto Serif Devanagari', serif;
  font-size: 1.5rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  box-shadow: 0 4px 0 var(--grape-d);
}
.aa-input:focus { box-shadow: 0 4px 0 var(--grape-d), 0 0 0 5px rgba(139, 92, 246, .25); }
.aa-empty { color: var(--ink-soft); font-weight: 600; }
.aa-print { display: none; }
.aa-print-hint { font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; }
.aa-blank-row { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.aa-blank { display: flex; flex-direction: column; gap: 3px; }
.aa-blank i { display: block; width: 15mm; height: 13mm; border: 2px dashed #A78BFA; border-radius: 8px; background: #fff; }
.aa-blank i + i { height: 9mm; border-color: #F59E0B; background: #FFFBEA; }
/* ============================================================
 * PRINT — final sizing, tuned page by page from measured heights
 * (sheet = 196 mm, every page kept ≥ 6 mm under it)
 * ============================================================ */
@media print {
  /* letter pages without the chapter title have ~50 mm to spare → bigger cards */
  .letters-page:not(:has(> .section-title-wrap)) .lc-top .hero-icon { width: 58px !important; height: 58px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-top .ji-emoji { font-size: 32px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-bubble { width: 84px !important; height: 84px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-deva { font-size: 3rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-brahmi { font-size: 3.1rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-arrow { font-size: 1.5rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-pair { gap: 6px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-cap { font-size: .7rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-hindi,
  .letters-page:not(:has(> .section-title-wrap)) .lc-bword { font-size: 1.1rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lc-eng { font-size: .88rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lang-tiles { gap: 4px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lang-tile { border-width: 2px !important; border-radius: 12px !important; padding: 2px 3px 3px !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lt-name { font-size: .6rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lt-letter { font-size: 1.5rem !important; }
  .letters-page:not(:has(> .section-title-wrap)) .lt-word { font-size: .72rem !important; line-height: 1.18 !important; }

  /* letter pages: a little less air so 4 cards fit at full (100 %) size */
  .letter-card { padding: 12px 8px 8px !important; gap: 5px !important; }
  .letters-page > .chapter-say .say-mascot { width: 52px !important; height: 48px !important; }
  .letters-page > .chapter-say .say-bubble { margin-bottom: 8px !important; }
  .letters-page > .letter-grid { margin-top: 1mm !important; }
  #prakashkiya .fl-body p { font-size: 1.05rem !important; line-height: 1.75 !important; }

  /* बारहखड़ी: bigger letters in the boxes */
  .barah-cell .b { font-size: 1.7rem !important; }
  .barah-cell .d { font-size: .95rem !important; }

  /* मात्राएँ: less padding, bigger letters */
  .matra-cell { padding: 6px 4px !important; }
  .matra-brahmi { font-size: 2.8rem !important; }
  .matra-deva { font-size: 1.6rem !important; }
  .matra-label { font-size: .95rem !important; }

  /* कैसे सीखें */
  .step-icon { font-size: 3.2rem !important; }
  .step-card h4 { font-size: 1.4rem !important; }
  .step-card p { font-size: .98rem !important; line-height: 1.5 !important; }
  .ex-deva, .ex-brahmi { font-size: 2.5rem !important; }
  .ex-word { font-size: 1.6rem !important; }

  /* परिचय */
  .intro-icon { width: 72px !important; height: 72px !important; font-size: 2.3rem !important; }
  .intro-row h3 { font-size: 1.3rem !important; }
  .intro-row p { font-size: 1.05rem !important; line-height: 1.6 !important; }

  /* रोचक तथ्य */
  .fact-card h4 { font-size: 1.15rem !important; }
  .fact-card p { font-size: .92rem !important; }

  /* cover: a little smaller so it keeps a safe margin */
  .cover-page:not(.back-cover) .cover-say .say-mascot { width: 100px !important; height: 94px !important; }
  .cover-page:not(.back-cover) .brahmi-title { font-size: 3.7rem !important; }

  /* बधाई: tighter list on the right, bigger cheer on the left */
  .back-cover > .learned-list { line-height: 1.5 !important; padding: 10px 18px !important; }
  .back-cover > .tagline { font-size: .78rem !important; line-height: 1.45 !important; }
  .back-cover > .cover-say .say-mascot { width: 110px !important; height: 104px !important; }
  .back-cover > .cover-say .say-bubble { font-size: 1.05rem !important; }
  .back-cover > .cheer{ font-size: 3.4rem !important; }
  .back-cover > .subtitle { font-size: 1.25rem !important; }
  .back-cover > .cover-badge { font-size: 1.15rem !important; }

  /* सुन्दरी-लिपि page 2: tighter */
  .sd-cols .sd-block { margin-top: 6px !important; }
  .sd-cols .vy-row { margin-bottom: 2px !important; }
  .samyukt-chip { padding: 4px 6px !important; }

  /* अपना नाम लिखो: bigger boxes to write in */
  .aa-blank i { width: 17mm !important; height: 15mm !important; }
  .aa-blank i + i { height: 10mm !important; }
  .sundari-example .sx-part { padding: 4px 12px !important; }
  .sundari-example .sx-v { font-size: 1.5rem !important; }
}

/* ============================================================
 * FRONT MATTER — मंगलाचरण · प्रकाशकीय संदेश · मेरी भावना
 * ============================================================ */
.c-9 { --c: #d97706; --cd: #b45309; }   /* Sundari */

/* ---- मंगलाचरण: the mantra on a golden tablet ---- */
.mangal {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}
.mangal-tablet {
  display: flex;
  flex-direction: column;
  padding: 14px 18px 16px;
  border-radius: 26px;
  background: radial-gradient(ellipse at 50% 0%, #FFFDF5 0%, #FFF3D1 62%, #FFE7A8 100%);
  border: 4px solid #E3B341;
  box-shadow: inset 0 0 0 5px #FFF8E1, inset 0 0 0 7px #F2C94C, 0 6px 0 rgba(180, 120, 0, .25);
}
.mt-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  margin-bottom: 8px;
}
.jain-mark { width: 40px; height: 48px; flex: 0 0 auto; }
.mt-title { font-family: var(--font-fun); font-weight: 800; font-size: 1.6rem; line-height: 1.2; color: #9A3412; }
.mt-sub { font-size: 1.15rem; line-height: 1.3; color: #B45309; }
.mt-lines {
  flex: 1 1 auto;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}
.mt-line {
  display: grid;
  grid-template-columns: 36px minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  border: 2px solid #F6D58A;
  cursor: pointer;
  transition: transform .2s var(--ease-bounce), background .2s ease;
}
.mt-line:hover { transform: translateX(4px); background: #fff; }
.mt-n {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #F97316;
  color: #fff;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 3px 0 #C2410C;
}
.mt-text { display: flex; flex-direction: column; min-width: 0; }
.mt-b { font-size: 1.85rem; line-height: 1.3; color: #8B1E1E; }
.mt-d { font-family: 'Noto Serif Devanagari', serif; font-weight: 700; font-size: 1.3rem; line-height: 1.35; color: #4A2511; }
.mt-m {
  font-family: var(--font-fun);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.35;
  color: #7C5A12;
  padding-left: 12px;
  border-left: 3px dotted #E8B44A;
}

.mangal-side { display: flex; flex-direction: column; gap: 14px; }
.mangal-chulika {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(160deg, #FFF1E6, #FFE1CC);
  border: 3px solid #FDBA8C;
  box-shadow: 0 5px 0 #F59E62;
}
.mc-head { font-family: var(--font-fun); font-weight: 800; font-size: 1.25rem; color: #C2410C; }
.mc-line { display: flex; flex-direction: column; cursor: pointer; }
.mc-b { font-size: 1.3rem; line-height: 1.35; color: #8B1E1E; }
.mc-d { font-family: 'Noto Serif Devanagari', serif; font-weight: 700; font-size: 1.12rem; line-height: 1.4; color: #4A2511; }
.mc-m { margin: 2px 0 0; font-size: .92rem; font-weight: 600; line-height: 1.5; color: #7C2D12; }
.mangal-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: 20px;
  background: #EAF7FF;
  border: 3px dashed #7CC8EE;
  color: #134E6F;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.55;
}
.mangal-note p { margin: 0; }
.mn-icon { font-size: 1.9rem; line-height: 1; }
.mn-b { display: block; margin: 4px 0 2px; font-size: 1.25rem; font-weight: 400; color: #8B1E1E; }

/* ---- प्रकाशकीय संदेश + मेरी भावना: a letter on cream paper ---- */
.front-letter {
  padding: 16px 26px 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, #FFFDF6, #FFF6DD);
  border: 3px solid #F2D58C;
  box-shadow: 0 6px 0 rgba(212, 160, 23, .28);
  color: #3B2A14;
}
.fl-lead {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px dashed #F2C94C;
  text-align: center;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.3rem;
  color: #B45309;
}
.fl-body { columns: 2; column-gap: 34px; column-rule: 2px dotted #F2D58C; }
.fl-body p {
  margin: 0 0 10px;
  font-size: 1.02rem;
  line-height: 1.75;
  text-align: justify;
  orphans: 2;
  widows: 2;
}
.fl-body b { color: #9A3412; }
.fl-close { font-weight: 700; color: #9A3412; }
.fl-sign {
  margin-top: 4px;
  text-align: right;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.15rem;
  color: #9A3412;
}

.bhavna {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 2fr);
  gap: 18px;
  align-items: stretch;
}
.bh-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 24px;
  background: #F3EEFF;
  border: 3px solid #C9B8FF;
  box-shadow: 0 6px 0 #A78BFA;
  text-align: center;
}
.bh-head { font-family: var(--font-fun); font-weight: 800; font-size: 1.2rem; color: #5B36C4; }
.bh-tiles {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 8px;
}
.bh-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 2px 4px 5px;
  background: #fff;
  border: 2.5px solid var(--c);
  border-radius: 16px;
  box-shadow: 0 3px 0 var(--cd);
}
.bh-ch { font-size: 2rem; font-weight: 700; line-height: 1.25; color: var(--cd); }
.bh-name {
  padding: 0 9px;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-family: var(--font-fun);
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.bh-foot { font-family: var(--font-fun); font-size: .88rem; font-weight: 700; line-height: 1.4; color: #5B36C4; }
.bh-letter { display: flex; flex-direction: column; }
.bh-letter .fl-body { flex: 1 1 auto; }
.bh-wish {
  width: fit-content;
  margin: 4px auto 0;
  padding: 5px 18px;
  border-radius: 999px;
  background: #FFF1D6;
  border: 2px solid #F59E0B;
  color: #9A3412;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.1rem;
}

@media screen and (max-width: 820px) {
  .mangal, .bhavna { grid-template-columns: 1fr; }
  .mt-line { grid-template-columns: 32px minmax(0, 1fr); gap: 4px 10px; }
  .mt-m { grid-column: 2; padding-left: 0; border-left: 0; font-size: .88rem; }
  .mt-b { font-size: 1.6rem; }
  .mt-d { font-size: 1.15rem; }
  .front-letter { padding: 14px 16px 12px; }
  .fl-body { columns: 1; }
  .fl-body p { text-align: left; }
  .bh-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bh-name { padding: 0 6px; font-size: .66rem; }
}
@media screen and (max-width: 560px) {
  .bh-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mt-head { gap: 10px; }
  .jain-mark { width: 30px; height: 36px; }
  .mt-title { font-size: 1.35rem; }
}

@media print {
  /* the front pages fill the sheet like the rest of the book */
  .front-page { display: flex !important; flex-direction: column; }
  .front-page > .mangal, .front-page > .front-letter, .front-page > .bhavna { flex: 1 1 auto; }
  .front-page > .front-letter { display: flex; flex-direction: column; justify-content: center; }
  .mt-lines { grid-auto-rows: 1fr; }
  .mangal-tablet, .mangal-chulika, .front-letter, .bh-side, .bh-tile, .mt-n { box-shadow: none !important; }
  .mt-line, .mc-line, .mangal-note, .bh-tile, .fl-sign, .bh-wish { break-inside: avoid; }

  /* मंगलाचरण on one sheet: "touch to hear" means nothing on paper */
  #mangal > .chapter-say { display: none !important; }
  #mangal .section-title-wrap { margin-bottom: 8px !important; }
  .mangal { gap: 5mm; }
  .mangal-tablet { padding: 8px 14px 10px; }
  .mt-head { margin-bottom: 4px; }
  .jain-mark { width: 34px; height: 41px; }
  .mt-title { font-size: 1.45rem; }
  .mt-sub { font-size: 1.05rem; }
  .mt-lines { gap: 5px; }
  .mt-line { padding: 3px 12px; }
  .mt-b { font-size: 1.7rem; line-height: 1.25; }
  .mt-d { font-size: 1.2rem; line-height: 1.3; }
  .mt-m { font-size: .95rem; }
  .mangal-side { gap: 4mm; }
  .mangal-chulika { padding: 8px 14px; gap: 6px; }
  .mc-b { font-size: 1.3rem; }
  .mc-d { font-size: 1.1rem; }
  .mangal-note { padding: 6px 12px; font-size: .82rem; line-height: 1.45; }
  .mn-b { font-size: 1.1rem; }

  /* the two letters: text sized to fill the sheet */
  #prakashkiya .fl-body p { font-size: 1.1rem; line-height: 1.8; }
  #prakashkiya .fl-lead { font-size: 1.4rem; }
  .bh-letter .fl-body p { font-size: 1rem; line-height: 1.7; margin-bottom: 8px; }
  .bh-foot { font-size: .8rem; }
}

/* ============================================================
 * COVER — ब्राह्मी लिपि वर्णाक्षर · डॉ. सुरभि जैन
 * title on the left, a wheel of the letter अ in every script on
 * the right, the society's credit along the bottom
 * ============================================================ */
.book-page.book-cover { --page-c: #FFC93C; --navy: #233C8C; --navy-d: #172A66; }

.bc-series { text-align: center; margin: 0 0 10px; }
.bc-series span {
  display: inline-block;
  padding: 5px 24px;
  border-radius: 999px;
  background: var(--navy);
  color: #FFE08A;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.5;
  box-shadow: 0 4px 0 var(--navy-d);
}

.bc-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.bc-left { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.bc-brahmi { font-size: 2.1rem; line-height: 1.2; color: #B91C1C; word-spacing: .35em; }
.bc-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
  font-family: var(--font-fun);
  font-weight: 800;
  line-height: 1.1;
}
.bc-t1 { font-size: 2.7rem; color: var(--navy); }
.bc-t2 { font-size: 5.6rem; line-height: 1.12; }
.bc-a {
  text-shadow: 3px 0 #fff, -3px 0 #fff, 0 3px #fff, 0 -3px #fff,
               2px 2px #fff, -2px -2px #fff, 2px -2px #fff, -2px 2px #fff,
               0 8px 0 rgba(43, 33, 64, .18);
}
.bc-a0 { color: #E8590C; }
.bc-a1 { color: #D63A68; }
.bc-a2 { color: #239A50; }
.bc-a3 { color: #1C93C4; }

.bc-ribbon {
  position: relative;
  z-index: 0;
  display: inline-block;
  padding: 7px 30px;
  border-radius: 12px;
  background: var(--grape);
  color: #fff;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 1.35rem;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  box-shadow: 0 5px 0 var(--grape-d);
}
.bc-ribbon::before,
.bc-ribbon::after {
  content: "";
  position: absolute;
  top: 10px;
  width: 30px;
  height: 100%;
  background: var(--grape-d);
  z-index: -1;
}
.bc-ribbon::before { left: -20px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 32% 50%); }
.bc-ribbon::after  { right: -20px; clip-path: polygon(0 0, 100% 0, 68% 50%, 100% 100%, 0 100%); }

.bc-feats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 540px; margin-top: 4px; }
.bc-feat {
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--tl);
  border: 2.5px solid var(--t);
  color: var(--td);
  font-weight: 800;
  font-size: .95rem;
}
.bc-feat b { font-size: 1.1rem; }

.bc-author {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 7px 24px 7px 9px;
  border-radius: 22px;
  background: #fff;
  border: 3px solid var(--sun);
  box-shadow: 0 5px 0 var(--sun-d);
}
.bc-pen {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #FFF4C7;
  font-size: 1.6rem;
}
.bc-author-txt, .bc-credit-txt { display: flex; flex-direction: column; text-align: left; line-height: 1.2; }
.bc-author-txt small, .bc-credit-txt small { font-size: .85rem; font-weight: 700; color: var(--ink-soft); }
.bc-author-txt b { font-size: 1.65rem; font-weight: 800; color: #9A3412; }

/* the wheel: Brahmi अ in the middle, its 8 sister forms around it */
.bc-right { display: flex; flex-direction: column; align-items: center; }
.cover-wheel {
  position: relative;
  width: min(100%, 390px);
  aspect-ratio: 1;
  container-type: inline-size;
}
.cw-rays {
  position: absolute;
  inset: -4%;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 201, 60, .45) 0 9deg, rgba(255, 201, 60, 0) 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 38%, transparent 70%);
  mask-image: radial-gradient(circle, #000 38%, transparent 70%);
}
.cw-ring { position: absolute; inset: 11%; border-radius: 50%; border: 4px dashed #F2C94C; }
.cw-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40%;
  height: 40%;
  margin: -20% 0 0 -20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #FFF1C9);
  border: 6px solid #EF4444;
  box-shadow: 0 7px 0 #B91C1C, 0 0 0 9px rgba(255, 255, 255, .75);
}
.cw-big { font-size: 17cqw; line-height: 1; color: #B91C1C; }
.cw-cap {
  margin-top: 1cqw;
  padding: 0 2.4cqw;
  border-radius: 999px;
  background: #EF4444;
  color: #fff;
  font-family: var(--font-fun);
  font-weight: 800;
  font-size: 3.4cqw;
  line-height: 1.5;
}
.cw-b {
  position: absolute;
  left: calc(50% + var(--x));
  top: calc(50% + var(--y));
  width: 21%;
  height: 21%;
  margin: -10.5% 0 0 -10.5%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--c);
  box-shadow: 0 4px 0 var(--cd);
}
.cw-ch { font-size: 8.4cqw; font-weight: 700; line-height: 1.1; color: var(--cd); }
.cw-n {
  padding: 0 1.6cqw;
  border-radius: 999px;
  background: var(--c);
  color: #fff;
  font-family: var(--font-fun);
  font-size: 3.1cqw;
  font-weight: 800;
  line-height: 1.45;
  white-space: nowrap;
}
html.motion .book-cover.in .cw-b { animation: kidBob 3s ease-in-out var(--d) infinite; }
html.motion .book-cover.in .cw-rays { animation: kidSpin 80s linear infinite; }
html.motion .book-cover.in .bc-t2 { animation: kidDrop .9s var(--ease-bounce) .1s both; }
html.motion .book-cover.in .cw-center { animation: kidPop .8s var(--ease-bounce) .3s both; }

.bc-say { margin-top: 2px; }
.bc-say .say-mascot { width: 82px; height: 76px; }
.bc-say .say-bubble { font-size: 1rem; padding: 8px 14px; margin-bottom: 16px; }

.bc-credit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;
  margin: 16px auto 0;
  padding: 6px 24px 6px 8px;
  border-radius: 999px;
  background: #fff;
  border: 3px solid var(--navy);
  box-shadow: 0 5px 0 rgba(35, 60, 140, .3);
}
.bc-logo { width: 68px; height: auto; flex: 0 0 auto; }
.bc-credit-txt b { font-size: 1.3rem; font-weight: 800; color: var(--navy); }
.bc-namo {
  padding-left: 14px;
  border-left: 2px dashed #C9D3F0;
  font-weight: 800;
  font-size: 1rem;
  color: #9A3412;
  white-space: nowrap;
}

@media screen and (max-width: 820px) {
  .bc-series span { font-size: .9rem; padding: 4px 16px; }
  .bc-main { grid-template-columns: 1fr; gap: 10px; }
  .bc-brahmi { font-size: 1.6rem; }
  .bc-t1 { font-size: 2.1rem; }
  .bc-t2 { font-size: 4.2rem; }
  .bc-ribbon { font-size: 1.1rem; padding: 6px 20px; }
  .cover-wheel { width: min(100%, 330px); }
  .cw-rays { inset: 0; }
  .bc-credit { flex-wrap: wrap; border-radius: 26px; padding: 10px 14px; text-align: center; }
  .bc-credit-txt { text-align: center; }
  .bc-namo { flex-basis: 100%; padding: 6px 0 0; border-left: 0; border-top: 2px dashed #C9D3F0; text-align: center; }
}
@media screen and (max-width: 420px) {
  .bc-series span { font-size: .8rem; }
  .bc-t2 { font-size: 3.4rem; }
  .bc-t1 { font-size: 1.8rem; }
  .bc-ribbon { font-size: .95rem; padding: 5px 14px; }
  .bc-author-txt b { font-size: 1.35rem; }
  .bc-credit-txt b { font-size: 1.05rem; }
  .cw-b { border-width: 3px; }
}

@media print {
  /* the logo is on the cover itself — no faint copy behind it */
  .book-cover .page-mark { display: none !important; }
  .book-cover { display: flex !important; flex-direction: column; }
  .book-cover > .bc-main { flex: 1 1 auto; }
  .bc-series span, .bc-ribbon, .bc-author, .bc-credit, .cw-b { box-shadow: none !important; }
  .cw-center { box-shadow: 0 0 0 9px rgba(255, 255, 255, .75) !important; }
  .bc-series { margin-bottom: 4px; }
  .cover-wheel { width: 100mm; }
  .bc-say .say-mascot { width: 64px; height: 60px; }
  .bc-say .say-bubble { font-size: .9rem; margin-bottom: 12px; box-shadow: none !important; }
  .bc-credit { margin-top: 6px; }
}

/* ---- cover art: warm golden page, royal frame, corner mandalas,
 *      faint Brahmi letters; on paper it runs edge to edge ---- */
.book-page.book-cover {
  border: 0 !important;
  border-radius: 30px;
  isolation: isolate;
  padding: 12px 46px 100px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 90' preserveAspectRatio='none'%3E%3Cpath d='M0 46 C 180 6, 380 6, 600 40 S 1010 86, 1200 30 L1200 90 L0 90Z' fill='%23A6E58C'/%3E%3Cpath d='M0 66 C 260 30, 520 44, 760 70 S 1100 52, 1200 60 L1200 90 L0 90Z' fill='%236CCB5F'/%3E%3Cg fill='%23fff'%3E%3Ccircle cx='140' cy='74' r='5'/%3E%3Ccircle cx='430' cy='70' r='4'/%3E%3Ccircle cx='820' cy='80' r='5'/%3E%3Ccircle cx='1080' cy='72' r='4'/%3E%3C/g%3E%3Cg fill='%23FFC93C'%3E%3Ccircle cx='140' cy='74' r='2'/%3E%3Ccircle cx='430' cy='70' r='1.6'/%3E%3Ccircle cx='820' cy='80' r='2'/%3E%3Ccircle cx='1080' cy='72' r='1.6'/%3E%3C/g%3E%3C/svg%3E") bottom center / 100% 86px no-repeat,
    radial-gradient(ellipse 34% 44% at 30% 46%, rgba(255, 255, 255, .8), rgba(255, 255, 255, 0)),
    radial-gradient(rgba(214, 120, 20, .16) 1.6px, transparent 2.2px) 0 0 / 24px 24px,
    linear-gradient(180deg, #FFF4CF 0%, #FFE8B0 58%, #FFDE9C 100%);
}
.book-cover > .page-decor { margin: 0 -46px 4px; }
.book-cover > .page-footer { display: none; }   /* no page number on a cover */

.bc-orn, .bc-corners {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}
.bc-orn { z-index: -1; }               /* above the page colour, under the words */
.bc-ghost {
  position: absolute;
  font-size: var(--s);
  line-height: 1;
  color: var(--g);
  opacity: .14;
  transform: rotate(var(--r));
}
.bc-frame {
  position: absolute;
  inset: 0;
  z-index: 5;
  border: 10px solid var(--navy);
  border-radius: inherit;
  box-shadow: inset 0 0 0 3px #F5C542, inset 0 0 0 7px #FFF6D8, inset 0 0 0 9px #E8A33C;
  pointer-events: none;
}
.bc-corners { z-index: 6; }
.bc-corner { position: absolute; width: 150px; height: 150px; }
.bc-corner svg { display: block; width: 100%; height: 100%; }
.bc-c-tl { left: -75px; top: -75px; }
.bc-c-tr { right: -75px; top: -75px; }
.bc-c-bl { left: -75px; bottom: -75px; }
.bc-c-br { right: -75px; bottom: -75px; }
html.motion .book-cover.in .bc-corner svg { animation: kidSpin 50s linear infinite; }

@media screen and (max-width: 820px) {
  .book-page.book-cover { padding: 10px 20px 86px; border-radius: 24px; }
  .book-cover > .page-decor { margin: 0 -20px 4px; }
  .bc-frame { border-width: 7px; box-shadow: inset 0 0 0 2px #F5C542, inset 0 0 0 5px #FFF6D8, inset 0 0 0 6px #E8A33C; }
  .bc-corner { width: 96px; height: 96px; }
  .bc-c-tl, .bc-c-bl { left: -48px; }
  .bc-c-tr, .bc-c-br { right: -48px; }
  .bc-c-tl, .bc-c-tr { top: -48px; }
  .bc-c-bl, .bc-c-br { bottom: -48px; }
  .bc-ghost { opacity: .1; }
}

/* paper: the first sheet has no margin and the cover fills it exactly
 * (a hair under the sheet height, so it can never spill onto a 2nd sheet) */
@page :first { margin: 0; }
@media print {
  .book-page.book-cover {
    height: 209.4mm;
    min-height: 0 !important;
    border-radius: 0 !important;
    padding: 6mm 17mm 0 !important;
    overflow: hidden !important;
    justify-content: flex-start;
  }
  html.print-a5 .book-page.book-cover { height: 209mm; }   /* × 0.707 ≤ 148 mm */
  .book-cover > .page-decor { margin: 0 -17mm 3mm !important; }
  .bc-frame { border-width: 5mm; box-shadow: inset 0 0 0 1mm #F5C542, inset 0 0 0 2.2mm #FFF6D8, inset 0 0 0 2.8mm #E8A33C !important; }
  .bc-corner { width: 46mm; height: 46mm; }
  .bc-c-tl, .bc-c-bl { left: -23mm; }
  .bc-c-tr, .bc-c-br { right: -23mm; }
  .bc-c-tl, .bc-c-tr { top: -23mm; }
  .bc-c-bl, .bc-c-br { bottom: -23mm; }
  .book-cover > .bc-main { flex: 1 1 auto; }
  .bc-credit { margin: 3mm auto 25mm; }          /* sits just above the hills */
}
/* ---- each page swings into view like a page being turned (screen only;
 *      print resets every .reveal to its final state) ---- */
html.motion .book-page.reveal {
  transform-origin: 50% 0;
  /* negative: the lower edge tips AWAY, so the page never looks wider than
   * the screen (tipping it towards us widened phones by 70 px) */
  transform: perspective(1600px) rotateX(-12deg) translateY(40px);
  transition: opacity .6s ease, transform .9s var(--ease-bounce);
}
@media screen { #book { overflow-x: clip; } }
html.motion .book-page.reveal.in { transform: none; }
/* the page's cards pop in once it has arrived */
html.motion .book-page.in .letter-card,
html.motion .book-page.in .num-card,
html.motion .book-page.in .mt-line,
html.motion .book-page.in .bh-tile,
html.motion .book-page.in .toc-item {
  animation: kidPop .55s var(--ease-bounce) backwards;
  animation-delay: .25s;
}
html.motion .book-page.in .letter-card:nth-child(2), html.motion .book-page.in .mt-line:nth-child(2),
html.motion .book-page.in .bh-tile:nth-child(2) { animation-delay: .33s; }
html.motion .book-page.in .letter-card:nth-child(3), html.motion .book-page.in .mt-line:nth-child(3),
html.motion .book-page.in .bh-tile:nth-child(3) { animation-delay: .41s; }
html.motion .book-page.in .letter-card:nth-child(4), html.motion .book-page.in .mt-line:nth-child(4),
html.motion .book-page.in .bh-tile:nth-child(4) { animation-delay: .49s; }
html.motion .book-page.in .mt-line:nth-child(5), html.motion .book-page.in .bh-tile:nth-child(n+5) { animation-delay: .57s; }

/* ---- 3D depth while a card leans toward the mouse (jain3d.js tilt; screen only) ---- */
@media screen {
  .letter-card.j3-tilting, .letter-card.j3-tilting .lc-top, .letter-card.j3-tilting .lc-pair { transform-style: preserve-3d; }
  .letter-card .lc-b, .letter-card .hero-icon { transition: translate .35s var(--ease-bounce); }
  .letter-card.j3-tilting .lc-b { translate: 0 0 40px; }
  .letter-card.j3-tilting .hero-icon { translate: 0 0 24px; }
  /* the cover wheel: its bubbles float off the page */
  .cover-wheel.j3-tilting { transform-style: preserve-3d; }
  .cover-wheel > .j3-glare { border-radius: 50%; }
  .cover-wheel .cw-b, .cover-wheel .cw-center { transition: translate .45s var(--ease-bounce); }
  .cover-wheel.j3-tilting .cw-b { translate: 0 0 36px; }
  .cover-wheel.j3-tilting .cw-center { translate: 0 0 64px; }
}