:root {
  color-scheme: light;
  --ink: #251e1a;
  --muted: #625b54;
  --gold: #efbd00;
  --yellow: #ffda27;
  --paper: #fff;
  --soft: #fff9dd;
  --line: #e8e2d6;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; line-height: 1.7; }
a { color: inherit; }
a:focus-visible, summary:focus-visible { outline: 3px solid #966e00; outline-offset: 4px; }
.skip { position: absolute; top: -100px; left: 1rem; z-index: 10; background: white; padding: .5rem; }
.skip:focus { top: .5rem; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { width: min(1120px, calc(100% - 48px)); min-height: 82px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 800; line-height: 1.3; }
.brand img { width: 58px; height: 58px; object-fit: contain; }
.brand small { display: block; margin-top: 3px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.back { font-size: .9rem; font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 5px; white-space: nowrap; }
.container { width: min(1120px, calc(100% - 48px)); margin: auto; }
.hero { position: relative; overflow: hidden; background: var(--soft); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); align-items: center; gap: 40px; min-height: 375px; padding-top: 48px; padding-bottom: 48px; }
.eyebrow { margin: 0 0 10px; color: #756018; font-weight: 800; font-size: .88rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(2.4rem, 5vw, 4.2rem); line-height: 1.2; letter-spacing: .01em; }
.hero p.intro { max-width: 34em; color: #554d41; font-size: 1.05rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 10px 22px; background: var(--ink); color: white; text-decoration: none; font-weight: 700; border: 1px solid var(--ink); border-radius: 5px; }
.button.secondary { color: var(--ink); background: white; }
.button:hover { background: #44372c; }
.button.secondary:hover { background: #fff4c0; }
.hero-art { justify-self: center; width: min(285px, 100%); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--yellow); position: relative; }
.hero-art::before, .hero-art::after { content: ""; position: absolute; border: 2px solid rgba(37,30,26,.18); border-radius: 50%; inset: 18px; }
.hero-art::after { inset: 33px; }
.hero-art img { position: relative; z-index: 1; width: 60%; border-radius: 50%; mix-blend-mode: multiply; }
.section { padding: 64px 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.section-heading h2 { margin-bottom: 3px; font-size: clamp(1.5rem, 3vw, 2rem); }
.section-heading p { margin: 0; color: var(--muted); }
.resource-note { max-width: 46em; color: var(--muted); font-size: .94rem; }
.resource-list { border-top: 2px solid var(--ink); }
.unit { border-bottom: 1px solid var(--line); }
.unit summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 18px; padding: 18px 8px; font-weight: 800; }
.unit summary::-webkit-details-marker { display: none; }
.unit summary::after { content: "+"; margin-left: auto; color: #8a6b00; font-size: 1.5rem; font-weight: 400; line-height: 1; }
.unit[open] summary::after { content: "−"; }
.unit-number { color: #8b6a00; font-size: .9rem; flex: 0 0 4.5rem; }
.unit-files { margin: 0 0 20px 5.6rem; padding: 0; list-style: none; }
.unit-files li + li { margin-top: 8px; }
.unit-files a { text-decoration-color: #c49c00; text-underline-offset: 4px; overflow-wrap: anywhere; }
.preview { background: #f7f6f2; padding: 27px 30px; display: flex; justify-content: space-between; gap: 20px; align-items: center; }
.preview h2 { margin-bottom: 5px; font-size: 1.3rem; }
.preview p { margin-bottom: 0; color: var(--muted); }
.footer { margin-top: 64px; padding: 24px 0; color: var(--muted); border-top: 1px solid var(--line); font-size: .85rem; }
.lesson-title { background: var(--soft); padding: 48px 0; }
.lesson-title h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 10px; }
.lesson-title p { margin: 0; color: var(--muted); }
.lesson-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 60px; padding-top: 48px; }
.lesson-nav { align-self: start; position: sticky; top: 24px; }
.lesson-nav strong { display: block; margin-bottom: 10px; }
.lesson-nav a { display: block; padding: 7px 0; color: var(--muted); text-decoration: none; }
.lesson-nav a:hover { color: var(--ink); text-decoration: underline; }
.lesson-block { padding-bottom: 35px; margin-bottom: 35px; border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.lesson-block h2 { font-size: 1.5rem; margin-bottom: 12px; }
.placeholder { background: #f8f7f4; padding: 22px; color: var(--muted); border-radius: 4px; }
.answer { margin-top: 16px; border: 1px solid #e1d8b9; border-radius: 4px; }
.answer summary { cursor: pointer; padding: 12px 16px; font-weight: 700; color: #604800; }
.answer p { border-top: 1px solid #e1d8b9; margin: 0; padding: 15px 16px; }

/* Shared controls and textbook navigation. */
::selection { color: var(--ink); background: #ffe171; }
.header-nav { display: flex; align-items: center; gap: 28px; }
.header-nav a { font-size: .9rem; font-weight: 700; text-decoration: none; }
.header-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
.hero-inner { min-height: 355px; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); }
.hero-guide { position: relative; overflow: hidden; justify-self: end; width: min(100%, 380px); padding: 31px; background: var(--ink); color: #fff; border-radius: 14px; }
.hero-guide::after { content: ""; position: absolute; right: -58px; top: -64px; width: 190px; height: 190px; border: 30px solid #e6b900; border-radius: 50%; opacity: .96; pointer-events: none; }
.guide-label { position: relative; z-index: 1; color: #ffe16a; font-size: .88rem; font-weight: 700; }
.hero-guide > p { position: relative; z-index: 1; margin: 26px 0 36px; font-size: clamp(1.3rem, 2.4vw, 1.75rem); font-weight: 800; line-height: 1.5; }
.guide-meta { position: relative; z-index: 1; display: flex; gap: 20px; padding-top: 15px; border-top: 1px solid #65594c; color: #f7f1e2; font-size: .88rem; }
.button { border-radius: 8px; transition: background-color .15s ease, border-color .15s ease; }
.button:active { transform: translateY(1px); }
.section-heading { margin-bottom: 12px; }
.materials-toolbar:not([hidden]) { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 28px 0 20px; }
.search-field { flex: 1; max-width: 440px; }
.search-field label { display: block; margin-bottom: 7px; font-size: .88rem; font-weight: 700; }
.search-wrap { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 14px; border: 1px solid #cfc7b8; border-radius: 8px; background: #fff; }
.search-wrap:focus-within { border-color: #826000; outline: 3px solid #f9df83; }
.search-wrap svg { width: 19px; height: 19px; flex: none; stroke: #655b4b; stroke-width: 1.8; stroke-linecap: round; }
.search-wrap input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; }
.search-wrap input::placeholder { color: #6d655d; }
.result-count { margin: 0 0 10px; color: var(--muted); font-size: .88rem; white-space: nowrap; }
.resource-list { overflow: hidden; border: 1px solid #ded9cf; border-radius: 12px; }
.unit:last-child { border-bottom: 0; }
.unit summary { min-height: 70px; padding: 17px 20px; transition: background-color .15s ease; }
.unit summary:hover, .unit[open] summary { background: #fffbec; }
.unit summary::after { content: ""; flex: 0 0 8px; width: 8px; height: 8px; border-right: 2px solid #6d5a2a; border-bottom: 2px solid #6d5a2a; transform: rotate(45deg) translateY(-2px); transition: transform .15s ease; }
.unit[open] summary::after { content: ""; transform: rotate(225deg) translate(-2px, -1px); }
.unit-number { display: inline-flex; justify-content: center; align-items: center; flex: 0 0 4.3rem; min-height: 32px; color: #624b00; background: #fff2b6; border-radius: 6px; font-size: .84rem; }
.unit-count { margin-left: auto; color: var(--muted); font-size: .82rem; font-weight: 500; white-space: nowrap; }
.unit summary::after { margin-left: 2px; }
.unit-files { margin: 0; padding: 8px 20px 20px 7.6rem; }
.unit-files li + li { margin-top: 3px; }
.unit-files a { display: inline-block; padding: 7px 0; line-height: 1.55; }
.empty-results:not([hidden]) { margin: 16px 0 0; padding: 18px; color: var(--muted); background: #f7f6f2; border-radius: 8px; }
.resource-folder { margin-top: 20px; }
.preview { border: 1px solid #e6e1d6; border-radius: 12px; background: #faf9f5; }
.lesson-nav a { min-height: 40px; }
.placeholder, .answer { border-radius: 8px; }
.answer summary { min-height: 48px; padding: 12px 16px; }
.interactive-link a { font-weight: 800; color: #604900; }
.unit-kicker { margin-bottom: 10px !important; color: #705500 !important; font-size: .9rem; font-weight: 700; }
.unit-jumps { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.unit-jumps a { display: inline-flex; align-items: center; min-height: 42px; padding: 7px 14px; border: 1px solid #ddcb8c; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 700; text-decoration: none; }
.unit-jumps a:hover { background: #fff3c3; }
.unit-main { max-width: 960px; padding-top: 12px; }
.unit-section { padding: 40px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 20px; }
.unit-section h2 { margin-bottom: 10px; font-size: clamp(1.45rem, 2.5vw, 1.9rem); }
.unit-section > p { max-width: 68ch; }
.concept-box { margin-top: 22px; padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; }
.concept-box h3 { margin-bottom: 12px; }
.concept-box p:last-child { margin-bottom: 0; }
.graph-panel { margin-top: 22px; padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.graph-type { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-weight: 700; }
.graph-type select { min-height: 44px; padding: 8px 12px; border: 1px solid #cfc7b8; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.graph-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.graph-controls label { font-weight: 700; }
.graph-controls output { float: right; color: #795900; }
.graph-controls input { display: block; width: 100%; margin: 12px 0 0; accent-color: #9b7300; }
.explore-panel .jxgbox { display: block; width: 100%; height: auto; margin: 20px 0 0; background: #fcfbf7; border-radius: 8px; }
.graph-grid { stroke: #d6d0c4; stroke-width: 1.5; }
.graph-point { fill: #8b6700; stroke: #fff; stroke-width: 2; }
.graph-label { fill: #534b41; font-size: 16px; }
.graph-values { margin: 12px 0 0; font-weight: 700; overflow-wrap: anywhere; }
.graph-hint { margin: 6px 0 0; color: var(--muted); font-size: .88rem; }
.page-jumps:not([hidden]) { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 24px 0; }
.page-jumps label { font-weight: 700; }
.page-jumps select { min-height: 44px; padding: 8px 12px; border: 1px solid #cfc7b8; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.worksheet-page { margin: 12px 0; scroll-margin-top: 20px; }
.worksheet-disclosure { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.worksheet-disclosure > summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; min-height: 54px; padding: 14px 18px; cursor: pointer; font-weight: 800; background: #fff; }
.worksheet-disclosure > summary span + span { color: var(--muted); font-size: .88rem; font-weight: 500; }
.worksheet-disclosure > summary:hover { background: #fffbec; }
.worksheet-content { padding: 16px; border-top: 1px solid var(--line); }
.worksheet-scroll { max-width: 100%; overflow-x: auto; border: 1px solid #e6e1d6; background: #fff; }
.worksheet-scroll img { display: block; width: 100%; min-width: 620px; height: auto; }
.worksheet-answers { display: grid; gap: 8px; margin-top: 14px; }
.source-answer { border: 1px solid #ded6bf; border-radius: 8px; }
.source-answer summary { min-height: 44px; padding: 10px 14px; cursor: pointer; color: #604800; font-weight: 700; }
.source-answer img { display: block; max-width: 100%; height: auto; margin: 0 0 12px; }
@media (max-width: 650px) {
  .header-inner, .container { width: min(100% - 32px, 1120px); }
  .header-inner { min-height: 72px; }
  .brand img { width: 48px; height: 48px; }
  .brand { font-size: .9rem; }
  .back { font-size: .8rem; }
  .header-nav { gap: 14px; }
  .hero-inner { grid-template-columns: 1fr; min-height: auto; gap: 26px; padding-top: 38px; padding-bottom: 36px; }
  .hero-guide { justify-self: stretch; width: 100%; padding: 22px; }
  .hero-guide > p { margin: 18px 0 22px; font-size: 1.25rem; }
  .hero-guide::after { right: -36px; top: -58px; width: 150px; height: 150px; border-width: 24px; }
  .section { padding: 42px 0; }
  .section-heading, .preview { align-items: flex-start; flex-direction: column; }
  .materials-toolbar:not([hidden]) { display: block; margin-top: 24px; }
  .result-count { margin: 10px 0 0; }
  .unit summary { gap: 10px; padding: 14px 12px; }
  .unit-number { flex-basis: 3.9rem; }
  .unit-count { font-size: .75rem; }
  .unit-files { margin: 0; padding: 4px 16px 16px; }
  .lesson-layout { grid-template-columns: 1fr; gap: 24px; padding-top: 30px; }
  .lesson-nav { position: static; display: flex; flex-wrap: wrap; gap: 0 18px; }
  .lesson-nav strong { width: 100%; }
  .graph-panel { padding: 16px; }
  .graph-controls { gap: 16px; }
  .graph-label { font-size: 27px; }
  .worksheet-content { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition-duration: 0s !important; } }
/* 第一單元：內容優先的閱讀介面。 */
.lesson-v2 { background: #fff; }
.lesson-v2 .chapter-hero { background: #fff9df; border-bottom: 1px solid #eee5c8; }
.lesson-v2 .chapter-hero .container { padding-top: 48px; padding-bottom: 46px; }
.lesson-v2 .chapter-eyebrow { margin: 0 0 13px; color: #6c5200; font-size: .88rem; font-weight: 700; }
.lesson-v2 .chapter-eyebrow span { padding: 0 6px; color: #aa8a32; }
.lesson-v2 h1 { margin: 0; max-width: 16ch; font-size: clamp(2.1rem, 4.3vw, 3.6rem); line-height: 1.25; }
.lesson-v2 .chapter-intro { max-width: 39em; margin: 16px 0 0; color: #554e44; font-size: 1.04rem; }
.lesson-v2 .chapter-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.lesson-v2 .chapter-facts span { padding: 4px 11px; border: 1px solid #e6d598; border-radius: 6px; background: #fff; color: #5c490e; font-size: .82rem; font-weight: 700; }
.lesson-v2 .review-notice { margin: 18px 0 0; color: #6b5b30; font-size: .88rem; }
.lesson-v2 .chapter-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 66px; align-items: start; padding-top: 52px; }
.lesson-v2 .chapter-nav { position: sticky; top: 24px; font-size: .9rem; }
.lesson-v2 .chapter-nav strong { display: block; margin: 0 0 13px 12px; }
.lesson-v2 .chapter-nav div { display: grid; gap: 2px; }
.lesson-v2 .chapter-nav a { display: flex; gap: 10px; align-items: center; min-height: 42px; padding: 8px 12px; border-radius: 7px; color: #554d41; font-weight: 700; text-decoration: none; }
.lesson-v2 .chapter-nav a:hover { background: #fff7dc; color: #3f3000; }
.lesson-v2 .chapter-nav a span { color: #8a6a08; font-size: .77rem; font-variant-numeric: tabular-nums; }
.lesson-v2 .chapter-content { min-width: 0; max-width: 780px; }
.lesson-v2 .chapter-welcome { padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.lesson-v2 .chapter-welcome h2 { margin-bottom: 5px; font-size: 1.5rem; }
.lesson-v2 .chapter-welcome p { margin: 0; color: var(--muted); }
.lesson-v2 .learning-topic { padding: 48px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 24px; }
.lesson-v2 .topic-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.lesson-v2 .topic-number { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 10px; background: #ffedaa; color: #5f4800; font-weight: 800; font-variant-numeric: tabular-nums; }
.lesson-v2 .topic-label { margin: 0; color: #776c5c; font-size: .8rem; font-weight: 700; }
.lesson-v2 .topic-heading h2 { margin: 0; font-size: clamp(1.5rem, 2.7vw, 2rem); line-height: 1.3; }
.lesson-v2 .concept-reveal { border: 1px solid #e2d5aa; border-radius: 9px; background: #fffdf5; }
.lesson-v2 .concept-reveal summary { min-height: 48px; padding: 12px 16px; color: #604800; cursor: pointer; font-weight: 700; }
.lesson-v2 .concept-reveal summary:hover { background: #fff7dc; }
.lesson-v2 .concept-content { padding: 20px; border-top: 1px solid #e9dfc4; background: #fff; }
.lesson-v2 .topic-lead { margin-bottom: 18px; font-size: 1.12rem; font-weight: 700; }
.lesson-v2 .concept-copy { max-width: 68ch; }
.lesson-v2 .concept-copy p { margin-bottom: 11px; }
.lesson-v2 .key-formula { margin-top: 22px; padding: 17px 20px; border-radius: 9px; background: #fff8df; }
.lesson-v2 .key-formula > span { display: block; color: #735700; font-size: .85rem; font-weight: 800; }
.lesson-v2 .key-formula p { margin: 6px 0 0; overflow-x: auto; }
.lesson-v2 .common-mistake { margin-top: 14px; padding: 16px 20px; border: 1px solid #e6e1d6; border-radius: 9px; background: #faf9f6; }
.lesson-v2 .common-mistake strong { color: #594300; font-size: .9rem; }
.lesson-v2 .common-mistake p { margin: 5px 0 0; }
.lesson-v2 .concept-source { margin: 12px 0 0; color: #71695e; font-size: .82rem; }
.lesson-v2 .practice-heading { margin-top: 30px; }
.lesson-v2 .practice-heading h3 { margin: 0; font-size: 1.2rem; }
.lesson-v2 .practice-heading p { margin: 4px 0 14px; color: var(--muted); font-size: .92rem; }
.lesson-v2 .practice-list { overflow: hidden; border: 1px solid #e5dfd3; border-radius: 11px; }
.lesson-v2 .practice-question { padding: 20px 22px; background: #fff; }
.lesson-v2 .practice-question + .practice-question { border-top: 1px solid #e9e4da; }
.lesson-v2 .question-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: #70685c; font-size: .8rem; }
.lesson-v2 .question-number { padding: 2px 8px; border-radius: 5px; background: #fff0b7; color: #604800; font-weight: 800; }
.lesson-v2 .question-text { margin: 14px 0 16px; line-height: 1.9; overflow-wrap: anywhere; }
.lesson-v2 .practice-answer { border: 1px solid #ded7c7; border-radius: 8px; }
.lesson-v2 .practice-answer summary { min-height: 46px; padding: 10px 14px; color: #604800; cursor: pointer; font-weight: 700; }
.lesson-v2 .practice-answer summary:hover { background: #fffaf0; }
.lesson-v2 .answer-content { padding: 13px 16px; border-top: 1px solid #e8e1d3; }
.lesson-v2 .answer-content p { margin: 0; overflow-wrap: anywhere; }
.lesson-v2 .explore-panel { margin-top: 26px; padding: 22px; border: 1px solid #e5dfd3; border-radius: 11px; background: #fff; }
.lesson-v2 .explore-heading { display: flex; justify-content: space-between; gap: 12px; }
.lesson-v2 .explore-heading h3 { margin: 0; font-size: 1.1rem; }
.lesson-v2 .explore-heading p { margin: 4px 0 0; color: var(--muted); font-size: .91rem; }
.lesson-v2 .explore-tag { align-self: start; padding: 3px 9px; border-radius: 6px; background: #fff1b9; color: #654d00; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.lesson-v2 .graph-controls { margin-top: 22px; }
.lesson-v2 .explore-panel .jxgbox { width: 100%; height: 290px; margin-top: 20px; border: 1px solid #eee8dc; background: #fcfbf8; }
.lesson-v2 .graph-values { line-height: 1.7; }
.lesson-v2 .chapter-end { padding: 48px 0 0; }
.lesson-v2 .chapter-end h2 { margin-bottom: 6px; font-size: 1.35rem; }
.lesson-v2 .chapter-end p { color: var(--muted); }
@media (max-width: 720px) {
  .lesson-v2 .chapter-hero .container { padding-top: 34px; padding-bottom: 32px; }
  .lesson-v2 .chapter-layout { grid-template-columns: 1fr; gap: 30px; padding-top: 26px; }
  .lesson-v2 .chapter-nav { position: static; padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
  .lesson-v2 .chapter-nav strong { margin-left: 2px; }
  .lesson-v2 .chapter-nav div { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; }
  .lesson-v2 .chapter-nav a { padding-left: 3px; }
  .lesson-v2 .learning-topic { padding: 36px 0; }
  .lesson-v2 .practice-question { padding: 17px; }
  .lesson-v2 .explore-panel { padding: 16px; }
  .lesson-v2 .explore-panel .jxgbox { height: 240px; }
}
@media (max-width: 360px) {
  .lesson-v2 .chapter-nav div { grid-template-columns: 1fr; }
  .lesson-v2 .chapter-facts { gap: 6px; }
}

/* Catalog pages: books and unit lists. */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-top: 22px; }
.book-card { display: grid; gap: 4px; padding: 20px; border: 1px solid #ded9cf; border-radius: 12px; background: #fff; text-decoration: none; }
.book-card:hover { background: #fffbec; border-color: #d9c477; }
.book-card strong { font-size: 1.15rem; }
.book-card span { color: var(--muted); font-size: .88rem; }
.book-card em { justify-self: start; margin-top: 8px; padding: 2px 10px; border-radius: 6px; background: #f3f1ec; color: #6b645b; font-size: .8rem; font-style: normal; font-weight: 700; }
.book-card.ready em { background: #fff0b0; color: #5c4600; }
.unit-list { margin: 0 0 24px; padding: 0; list-style: none; border: 1px solid #ded9cf; border-radius: 12px; overflow: hidden; }
.unit-row { display: flex; align-items: center; gap: 16px; min-height: 70px; padding: 14px 20px; }
.unit-row + .unit-row { border-top: 1px solid var(--line); }
.unit-row > div { flex: 1; min-width: 0; }
.unit-links { margin: 2px 0 0; font-size: .85rem; }
.unit-links a { margin-right: 14px; color: #5f4a00; text-underline-offset: 4px; }
.unit-go { flex: none; padding: 8px 16px; border-radius: 8px; background: var(--ink); color: #fff; font-size: .9rem; font-weight: 700; text-decoration: none; }
.unit-go:hover { background: #44372c; }
.unit-soon { flex: none; color: #857d72; font-size: .85rem; }

/* Lesson blocks: concept map, flip cards, tap-to-reveal blanks. Child selectors only, so KaTeX's own spans stay untouched. */
.unit-map { padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.unit-map h2 { margin-bottom: 5px; font-size: 1.5rem; }
.unit-map > p { margin: 0 0 20px; color: var(--muted); }
.map-root { position: relative; width: fit-content; margin: 0 auto 26px; padding: 10px 22px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 800; }
.map-root::after { content: ""; position: absolute; left: 50%; top: 100%; height: 26px; border-left: 2px solid #cdbb7a; }
.map-nodes { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 0; padding: 14px 0 0; list-style: none; border-top: 2px solid #cdbb7a; }
.map-nodes > li > a { display: grid; gap: 3px; height: 100%; padding: 12px; border: 1px solid #e2d5aa; border-radius: 10px; background: #fffdf5; text-decoration: none; }
.map-nodes > li > a:hover { background: #fff3c3; }
.map-nodes > li > a > span { color: #8a6a08; font-size: .77rem; font-weight: 800; }
.map-nodes > li > a > small { color: var(--muted); font-size: .8rem; line-height: 1.45; }
.flip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.flip { position: relative; display: block; min-height: 128px; cursor: pointer; perspective: 900px; }
.flip > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.flip > .flip-inner { display: grid; height: 100%; min-height: 128px; transition: transform .45s ease; transform-style: preserve-3d; }
.flip > .flip-inner > span { grid-area: 1 / 1; display: grid; place-items: center; padding: 18px; border-radius: 11px; text-align: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow-wrap: anywhere; }
.flip > .flip-inner > .flip-front { border: 1px solid #e2d5aa; background: #fff8df; font-weight: 700; }
.flip > .flip-inner > .flip-back { border: 1px solid var(--ink); background: var(--ink); color: #fff; transform: rotateY(180deg); }
.flip > input:checked + .flip-inner { transform: rotateY(180deg); }
.flip:focus-within > .flip-inner > span { outline: 3px solid #966e00; outline-offset: 3px; }
.blank { position: relative; display: inline-block; min-width: 2.6em; margin: 0 2px; padding: 0 7px; border-bottom: 2px solid #b08900; border-radius: 5px 5px 0 0; background: #fff3c0; text-align: center; cursor: pointer; }
.blank > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.blank > .blank-a { visibility: hidden; color: #9a3d00; font-weight: 700; }
.blank > input:checked + .blank-a { visibility: visible; }
.blank:has(> input:checked) { background: #fff; }
.blank:focus-within { outline: 3px solid #966e00; outline-offset: 2px; }
@media (max-width: 650px) {
  .unit-row { flex-wrap: wrap; gap: 8px 12px; padding: 14px; }
  .unit-row > div { flex-basis: 60%; }
}
