/* Shared typography and semantic colours for the homepage, catalog and lessons.
   SVG teaching scenes retain their measured font and coordinates. */
@font-face {
  font-family: "Classroom Nunito";
  src: url("../fonts/Nunito-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  --classroom-font: "Classroom Nunito", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --type-body: 1rem;
  --type-support: .875rem;
  --type-meta: .8125rem;
  --type-label: 1rem;
  --page: #f7f6f1;
  --paper: #fffdf8;
  --ink: #29332f;
  --muted: #5c6258;
  --line: #dedfd5;
  --blue: #246aab;
  --blue-soft: #eaf2fa;
  --green: #3e744a;
  --rose: #b83276;
  --error: #a33229;
  --chalk: var(--ink);
  --dim: var(--muted);
  --task: var(--rose);
  --quiz: var(--blue);
  --good: var(--green);
  --bad: var(--error);
  --lesson-bg: var(--page);
  --lesson-paper: var(--paper);
  --lesson-ink: var(--ink);
  --lesson-muted: var(--muted);
  --lesson-line: var(--line);
  --lesson-blue: var(--blue);
  --lesson-blue-soft: var(--blue-soft);
  --lesson-green: var(--green);
  color-scheme: light;
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, body.lesson-page { font-family: var(--classroom-font); font-size: var(--type-body); line-height: 1.75; }
button, input, select, textarea { font-family: inherit; }
body, .lesson-page { caret-color: var(--blue); }
body ::selection { color: #163d61; background: #d9e9f5; }
h1, h2, h3 { text-wrap: balance; }
.brand, .lesson-brand { font-size: 1.25rem; font-weight: 700; line-height: 1.4; }
.brand small, .brand-sub { font-size: var(--type-meta); font-weight: 400; letter-spacing: .01em; }
.header-nav a, .home-nav, .back-to-book { font-size: .9375rem; font-weight: 600; }
.site-footer, .home-footer, .lesson-footer { font-size: var(--type-meta); line-height: 1.7; }

/* Homepage: a large invitation followed by readable, quiet explanations. */
.hero-copy h1 { font-size: clamp(2.25rem, 4.4vw, 3.75rem); font-weight: 700; line-height: 1.35; letter-spacing: -.015em; }
.hero-description { font-size: 1.125rem; line-height: 1.85; max-width: 31em; }
.hero-parent-note, .purpose-intro p, .home-start p { font-size: var(--type-body); line-height: 1.8; }
.how-link, .available-note, .listen-caption, .demo-status { font-size: var(--type-support); }
.demo-word { font-family: var(--classroom-font); font-size: 1.5rem; font-weight: 700; }
.demo-word small { font-size: var(--type-support); }
.purpose-intro h2 { font-size: 2rem; font-weight: 700; line-height: 1.5; letter-spacing: 0; }
.purpose-stories h3 { font-size: 1.25rem; font-weight: 700; line-height: 1.55; }
.purpose-stories p { font-size: var(--type-body); line-height: 1.9; max-width: 65ch; }
.purpose-stories .offline-state { font-size: var(--type-support); color: #4c5d4a; background: #edf1e6; }
.home-start h2 { font-size: 1.625rem; font-weight: 700; }
.featured-lesson strong { font-size: 1.75rem; font-weight: 700; line-height: 1.4; }
.featured-lesson small, .featured-lesson > span > span { font-size: var(--type-support); }
.demo-status.error { color: var(--error); }

/* Catalog and guide: the same type roles at every viewport size. */
.welcome h1, .guide-intro h1 { font-size: clamp(1.875rem, 3vw, 2.5rem); font-weight: 700; line-height: 1.45; letter-spacing: -.01em; }
.welcome p, .guide-intro > p { font-size: var(--type-body); line-height: 1.85; }
.section-heading h2 { font-size: 1.25rem; font-weight: 700; }
.section-heading > span { font-size: var(--type-meta); }
.course-copy h3 { font-family: var(--classroom-font); font-size: clamp(2rem, 3vw, 2.75rem); font-weight: 700; line-height: 1.12; letter-spacing: -.015em; }
.course-description { font-size: var(--type-body); line-height: 1.85; }
.course-topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.course-topics li { align-items: flex-start; font-size: .9375rem; line-height: 1.65; white-space: normal; }
.course-topics .icon { margin-top: 5px; flex-shrink: 0; color: var(--green); }
.course-part, .course-status, .course-meta, .course-position, .art-label { font-size: var(--type-support); }
.art-label > span:first-child { font-size: var(--type-label); font-weight: 700; }
.welcome-note p, .art-caption { font-family: var(--classroom-font); font-style: normal; }
.welcome-note p { font-size: 1.125rem; }
.welcome-note small, .art-caption { font-size: var(--type-support); }
.primary-button { font-size: var(--type-label); font-weight: 700; line-height: 1.5; min-height: 50px; }
.course-details summary, .details-count { font-size: var(--type-support); }
.lesson-links a { font-size: var(--type-label); line-height: 1.6; }
.lesson-links small, .lesson-number { font-size: var(--type-meta); }
.progress-summary p { font-size: var(--type-label); font-weight: 700; }
.progress-summary span, .progress-caption, .progress-total, .progress-note, .study-reminder p, .storage-note { font-size: var(--type-support); }
.progress-caption strong { font-size: 1.125rem; }
.study-reminder h3 { font-size: var(--type-label); font-weight: 700; }
.guide-invitation, .guide-link { font-size: var(--type-label); }
.guide-route h2 { font-size: 1.375rem; font-weight: 700; line-height: 1.45; }
.guide-route p, .study-steps p, .guide-answer p { font-size: var(--type-body); line-height: 1.85; }
.guide-method > h2, .parent-guide h2 { font-size: 1.25rem; font-weight: 700; }
.study-steps h3 { font-size: 1.0625rem; font-weight: 700; line-height: 1.6; }
.parent-guide > div > p, .guide-question summary, .guide-bottom p { font-size: var(--type-body); line-height: 1.75; }

/* Lesson shell: school content stays large enough to scan without zooming. */
.lesson-header { height: auto; min-height: 88px; padding-block: 12px; }
.title-line { flex-wrap: wrap; gap: 10px 16px; }
.title-line h1 { font-size: clamp(1.875rem, 3vw, 2.5rem); font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
.unit-label { font-size: var(--type-support); font-weight: 700; }
.lesson-heading p { font-size: var(--type-body); line-height: 1.8; }
.lesson-meta, .cover-footnote, #stepCounter { font-size: var(--type-meta); }
.cover-hello { font-size: 1rem; font-weight: 600; }
.cover-copy h2 { font-weight: 700; letter-spacing: -.01em; }
.cover-description { font-size: var(--type-body); line-height: 1.8; }
.cover-actions { flex-wrap: wrap; }
/* Keep the familiar cover proportions, but let enlarged text grow the cover.
   The invisible ratio spacer and the in-flow cover share one grid cell. */
:root:not(.full) .stage-area:has(.lesson-cover:not([hidden])) { display: grid; aspect-ratio: auto; }
:root:not(.full) .stage-area:has(.lesson-cover:not([hidden]))::before { content: ""; grid-area: 1 / 1; padding-top: 56.25%; }
:root:not(.full) .lesson-cover { position: relative; grid-area: 1 / 1; }
.start-lesson { font-size: var(--type-label); font-weight: 700; }
.start-over { font-size: var(--type-support); }
.lesson-page #bar .icon { font-size: .9375rem; font-weight: 600; }
.lesson-page #stepName { font-size: var(--type-meta); }
.learning-tip strong { font-size: var(--type-label); font-weight: 700; }
.learning-tip p { font-size: var(--type-support); line-height: 1.8; }
.keyboard-tip, .lesson-page .keyboard-tip kbd { font-size: var(--type-meta); }
.review-heading h2, .outline-heading h2 { font-size: 1.125rem; font-weight: 700; }
.review-heading > span, .outline-heading > span, .outline-intro { font-size: var(--type-meta); }
.review-heading { flex-wrap: wrap; gap: 8px 16px; }
.word-list { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.word-button { flex-direction: column; flex-wrap: nowrap; justify-content: center; min-height: 128px; padding: 12px 8px; text-align: center; gap: 6px; color: var(--ink); }
.word-picture { width: 48px; height: 52px; display: grid; place-items: center; }
.word-picture svg, .word-picture img { width: 100%; height: 100%; object-fit: contain; }
.word-name { max-width: 100%; font-size: 1.0625rem; font-weight: 700; line-height: 1.45; overflow-wrap: break-word; }
.word-name small { font-size: var(--type-meta); font-weight: 400; line-height: 1.5; }
.word-button > .ui-icon { display: none; }
.word-message { font-size: var(--type-support); color: var(--error); }
.section-row { min-height: 82px; }
.section-number { font-size: var(--type-meta); flex-shrink: 0; }
.section-name { font-size: .9375rem; font-weight: 700; line-height: 1.6; }
.section-name small { font-size: var(--type-meta); font-weight: 400; line-height: 1.5; }
.step-link { font-size: var(--type-support); min-height: 44px; line-height: 1.65; }
.step-link small { font-size: .75rem; }
.outline-note p, .outline-note p span { font-size: var(--type-support); }
.lesson-page #help h2 { font-size: 1.5rem; font-weight: 700; }
.lesson-page #help h3 { font-size: var(--type-label); }
.lesson-page #help dl, .lesson-page #help .help-close { font-size: var(--type-support); line-height: 1.7; }
.lesson-page #help kbd { font-size: var(--type-meta); }

/* Question geometry is engine-owned; typography and feedback share the shell. */
.lesson-page #ui .card { font-family: var(--classroom-font); color: var(--ink); }
.lesson-page #ui .card .prompt, .lesson-page #ui .card .btn, .lesson-page #ui .card .opt { font-family: var(--classroom-font); }
.lesson-page #ui .card.fin .prompt { font-weight: 700; }
.lesson-page #ui .card .opt.good { background: #edf5eb; border-color: var(--green); color: #2c5e39; }
.lesson-page #ui .card .opt.bad { background: #fff1eb; border-color: var(--error); color: var(--error); }
.lesson-page #ui .card .fb.ok { color: #2c5e39; }
.lesson-page #ui .card .fb.no, .lesson-page #ui .card .sound-status { color: var(--error); }
.mobile-questions #ui .card .kicker { font-size: var(--type-support); line-height: 1.6; }
.mobile-questions #ui .card .prompt { font-size: 1.125rem; font-weight: 600; line-height: 1.65; }
.mobile-questions #ui .card .opt { font-size: 1.125rem; line-height: 1.5; }
.mobile-questions #ui .card .fb { font-size: var(--type-body); line-height: 1.75; }
.mobile-questions #ui .card .btn, .mobile-questions #ui .card .btn.sound-replay { font-size: var(--type-label); }
.mobile-questions #ui .card .sound-status { font-size: var(--type-support); }
.mobile-questions #ui .card.fin .prompt { font-size: 1.75rem; }

@media (min-width: 961px) and (max-width: 1250px) {
  .course-topics { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .brand, .lesson-brand { font-size: 1.125rem; }
  .lesson-header { min-height: 76px; }
  .hero-copy h1 { font-size: clamp(2rem, 8.5vw, 2.75rem); }
  .hero-description { font-size: 1rem; }
  .hero-parent-note { font-size: var(--type-support); }
  .purpose-intro h2 { font-size: 1.625rem; }
  .purpose-stories h3 { font-size: 1.125rem; }
  .purpose-stories p, .guide-route p, .study-steps p, .guide-answer p { font-size: var(--type-body); }
  .home-nav { font-size: var(--type-support); gap: 14px; }
  .demo-word { font-size: 1.375rem; }
  .course-copy h3 { font-size: clamp(2rem, 8.2vw, 2.375rem); }
  .art-label > span:last-child { font-size: var(--type-meta); }
  .course-topics { column-gap: 14px; }
  .course-topics li { font-size: var(--type-support); }
  .course-details summary { flex-wrap: wrap; gap: 4px 12px; }
  .title-line h1 { font-size: clamp(1.75rem, 7.8vw, 2.125rem); }
  .cover-description { font-size: var(--type-support); }
  .cover-footnote { font-size: var(--type-meta); }
  .word-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .word-button { min-height: 126px; }
  .section-name { font-size: var(--type-label); }
  .lesson-footer { font-size: var(--type-meta); }
  .lesson-meta { white-space: normal; flex-wrap: wrap; }
  .lesson-page #bar #bPlay, .lesson-page #bar #bSpeed, .lesson-page #bar #bCC { font-size: var(--type-support); }
}
@media (max-width: 359px) {
  .course-topics { grid-template-columns: 1fr; }
  .lesson-page #bar .icon { font-size: var(--type-support); }
}
@media (max-width: 540px) {
  .site-header .header-inner { display: grid; grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; gap: 3px; padding: 6px 12px; }
  .site-header .brand { width: fit-content; min-height: 44px; gap: 8px; white-space: nowrap; }
  .site-header .brand > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
  .site-header .brand small { margin: 0; font-size: .75rem; }
  .home-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 4px; }
  .home-nav a { justify-content: center; border-radius: 9px; background: var(--paper); }
  .catalog-main, .lesson-main { padding: 20px 12px; }
  .welcome { margin-bottom: 18px; }
  .welcome h1 { font-size: clamp(1.5rem, 5.7vw, 1.875rem); }
  .welcome h1 span { display: inline; }
  .welcome .mobile-break { display: none; }
  .welcome p { margin-top: 6px; }
  .course-copy h3 { margin: 6px 0 8px; font-size: clamp(1.6rem, 6.6vw, 2rem); }
  .course-description { margin-bottom: 12px; }
  .lesson-heading { margin-bottom: 12px; }
  .lesson-header { min-height: 64px; height: auto; padding: 8px 14px; }
  :root:not(.full) .lesson-cover { padding: 12px 16px 16px; }
  :root:not(.full) .cover-art { width: min(48%, 160px); height: auto; aspect-ratio: 640 / 580; margin: 0; }
}
.mobile-questions .lesson-player > .caption { position: static; transform: none; width: 100%; max-width: none !important; flex: none; padding: 8px 14px; border-top: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font: 600 1rem/1.55 var(--classroom-font); text-align: start; overflow-wrap: anywhere; }
@media (max-width: 700px) {
  .mobile-questions #bar { display: grid; grid-template-columns: minmax(44px, 1.45fr) repeat(6, minmax(44px, 1fr)); gap: 0; padding-inline: 4px; }
  .mobile-questions #bar :is(#bPlay, #bCC, .icon, .volume) { width: 100%; min-width: 44px; height: 44px; }
  .mobile-questions .timeline, .mobile-questions #lessonSeek { height: 44px; }
  .mobile-questions #lessonSeek::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7px; }
  .mobile-questions #lessonSeek::-moz-range-thumb { width: 14px; height: 14px; }
}
@media (max-width: 359px) {
  :root:not(.full) .lesson-player { margin-inline: -12px; border-radius: 0; }
}
@media (pointer: coarse) {
  .mobile-questions #frame .paused-mark { display: none; }
}
