/* 腹膜透析護理 · Peritoneal Dialysis Notes for Nurses  v1.0.0
   Warm cream paper, dusty teal / sea-ink accents.
   Distinct from 傷口護理知識 (rose) and CNE 手帳.
   A phone-first digital handbook: cover, contents, chapter openers, paginated pages. */
:root {
  --paper: #F3EEE4;
  --paper-deep: #E7DFD1;
  --card: #FBF7EF;
  --ink: #24343A;
  --ink-soft: #4A5C63;
  --muted: #6A7A7C;
  --line: #D6CDBD;
  --teal: #3F6F71;
  --teal-deep: #2C5254;
  --teal-mid: #6A9394;
  --teal-soft: #E3EEEC;
  --rose: var(--teal);
  --rose-deep: var(--teal-deep);
  --rose-mid: var(--teal-mid);
  --rose-soft: var(--teal-soft);
  --sage: var(--teal);
  --sage-deep: var(--teal-deep);
  --sage-mid: var(--teal-mid);
  --sage-soft: var(--teal-soft);
  --peach: #C4A574;
  --peach-deep: #8A6A3A;
  --peach-soft: #F3EBD8;
  --gold: #8A6A3A;
  --gold-mid: #C4A574;
  --gold-soft: #F3EBD8;
  --lilac: #4E6570;
  --lilac-mid: #6E8790;
  --lilac-soft: #E6EEF0;
  --mint: #3F6F71;
  --mint-deep: #2C5254;
  --mint-mid: #6A9394;
  --mint-soft: #E3EEEC;
  --alert: #B5363B;
  --alert-bg: #FDECEE;
  --urgent: #A05F10;
  --urgent-bg: #FBF0DC;
  --prompt: #3F6F71;
  --prompt-bg: #E3EEEC;
  --care: var(--teal);
  --care-bg: var(--teal-soft);
  --shadow: 0 10px 28px rgba(44, 82, 84, 0.08);
  --shadow-soft: 0 4px 16px rgba(44, 82, 84, 0.06);
  --radius: 26px;
  --radius-sm: 18px;
  --header-h: 60px;
  --font-ui: "PingFang TC", "Noto Sans TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Heiti TC", system-ui, -apple-system, sans-serif;
  --font-display: ui-rounded, "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Yu Gothic", "PingFang TC", "Noto Sans TC", "Hiragino Sans CNS", "Microsoft JhengHei", "Heiti TC", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html {
  font-size: 18px; /* Medium default */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--paper);
}
html[data-font-size="sm"] { font-size: 16px; }
html[data-font-size="md"] { font-size: 18px; }
html[data-font-size="lg"] { font-size: 22px; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(63, 111, 113, 0.14) 0 120px, transparent 220px),
    radial-gradient(circle at 94% -2%, rgba(196, 165, 116, 0.18) 0 140px, transparent 240px),
    radial-gradient(circle at 86% 72%, rgba(44, 82, 84, 0.08) 0 160px, transparent 280px),
    radial-gradient(circle at 6% 88%, rgba(63, 111, 113, 0.10) 0 150px, transparent 260px),
    var(--paper);
  line-height: 1.75;
  min-height: 100dvh;
  overflow-x: clip;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(180, 77, 104, 0.11) 1.15px, transparent 1.3px);
  background-size: 18px 18px;
  opacity: 0.55;
}
.app-header, main { position: relative; z-index: 1; }
.app-header { z-index: 20; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--sage); }
button, input, select, textarea { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--peach);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip:focus {
  left: 12px;
  top: 12px;
  z-index: 50;
  background: var(--card);
  padding: 8px 12px;
  border-radius: 10px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--header-h);
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(248, 237, 232, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(232, 208, 200, 0.85);
  flex-wrap: wrap;
  row-gap: 4px;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}
@media (max-width: 400px) {
  .header-tools {
    flex-basis: 100%;
    width: 100%;
    margin-left: 0;
    justify-content: flex-end;
  }
  .brand {
    text-align: left;
    flex: 1 1 auto;
  }
  .brand-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
}
html[data-font-size="lg"] .app-header {
  row-gap: 6px;
}
.icon-btn, .lang-toggle, .back-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--sage);
  font: inherit;
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:active, .lang-toggle:active, .back-btn:active { background: var(--sage-soft); }
.back-btn[hidden] { visibility: hidden; pointer-events: none; }
.brand {
  flex: 1;
  min-width: 0;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sage-deep);
}
.brand-sub {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-top: 2px;
  text-transform: none;
  font-weight: 500;
}
.lang-toggle {
  font-weight: 700;
  font-size: 0.82rem;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-soft);
  padding: 0 12px;
  box-shadow: var(--shadow-soft);
}
.lang-toggle span[data-on="true"] { color: var(--sage); }
.font-size-toggle {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 2px;
  box-shadow: var(--shadow-soft);
  gap: 0;
}
.font-size-toggle button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 36px;
  min-height: 40px;
  padding: 0 6px;
  border-radius: 999px;
  cursor: pointer;
  line-height: 1.15;
  white-space: nowrap;
}
.font-size-toggle button.is-selected,
.font-size-toggle button[aria-checked="true"] {
  background: var(--sage-soft);
  color: var(--sage-deep);
}
.font-size-toggle button:active { background: var(--peach-soft); }

main {
  width: min(46rem, 100%);
  margin: 0 auto;
  padding: 20px 18px 56px;
  padding-bottom: max(56px, env(safe-area-inset-bottom));
}

/* Home hero */
.hero {
  padding: 12px 4px 8px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  line-height: 1.3;
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--rose-deep);
  padding-bottom: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='10' viewBox='0 0 200 10' fill='none'%3E%3Cpath d='M3 5C28 1.5 50 8.5 72 5S116 1.5 138 6 170 8.5 197 4.5' stroke='%23E88972' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: min(12.5rem, 88%) 10px;
}
.hero p.lead {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.75;
}

.search-box {
  display: flex;
  gap: 10px;
  margin: 22px 0 10px;
}
.search-box input {
  flex: 1;
  min-height: 52px;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
  font: inherit;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}
.search-box button {
  flex: 0 0 auto;
  min-width: 72px;
  min-height: 52px;
  padding: 0 18px;
  white-space: nowrap;
  border: 0;
  border-radius: 18px;
  background: var(--sage);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.search-box button:active { background: var(--sage-deep); }

/* Notes and callouts */
.disclaimer, .callout, .dont, .note, .flag {
  border-radius: 18px;
  padding: 16px 18px;
  margin: 18px 0;
  line-height: 1.75;
}
.disclaimer {
  background: var(--gold-soft);
  border: 1px solid #EAD4B0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.disclaimer strong {
  color: var(--gold);
  display: block;
  margin-bottom: 8px;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  font-weight: 750;
  text-transform: none;
}
.callout { background: var(--sage-soft); border-left: 5px solid var(--sage); }
.dont { background: var(--peach-soft); border-left: 5px solid var(--peach-deep); }
.note {
  background: var(--card);
  border: 1px dashed var(--line);
  color: var(--ink-soft);
}
.callout h3, .dont h3, .note h3, .flag h3 {
  margin: 0 0 10px;
  font-size: 1.02rem;
  line-height: 1.4;
}
.callout p, .dont p, .note p,
.callout ul, .dont ul, .note ul { margin: 0; }
.callout li, .dont li, .note li { margin: 0.55rem 0; }

/* Section / topic cards */
.section-grid, .topic-list, .search-results {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}
.card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 18px 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-soft);
  min-height: 84px;
}
@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform 0.16s ease, box-shadow 0.16s ease;
  }
  .card:active {
    transform: scale(0.985);
    box-shadow: none;
  }
}
.card:active { transform: scale(0.985); }

.section-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 16px 18px 16px;
}
.section-icon {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.section-icon svg { width: 30px; height: 30px; display: block; }
.icon-wound-types { background: var(--peach-soft); color: var(--peach-deep); }
.icon-care-steps { background: var(--mint-soft); color: var(--mint-deep); }
.icon-dressings { background: var(--lilac-soft); color: var(--lilac); }
.icon-infection { background: var(--alert-bg); color: var(--alert); }
.icon-frequency { background: var(--gold-soft); color: var(--gold); }
.icon-referral { background: var(--prompt-bg); color: var(--prompt); }
.icon-quick-ref { background: var(--rose-soft); color: var(--rose-deep); }

.card-body { flex: 1; min-width: 0; }
.card-kicker {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--sage);
  font-weight: 700;
  margin-bottom: 6px;
  display: inline-block;
  background: var(--sage-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.card h2, .card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 1.12rem;
  line-height: 1.4;
  font-weight: 800;
  color: var(--ink);
}
.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.65;
}
.card-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.chev {
  color: var(--sage-mid);
  font-size: 1.35rem;
  line-height: 1;
  margin-top: 14px;
  flex: 0 0 auto;
}
.section-card .chev { margin-top: 16px; }

.crumbs {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.6;
}
.crumbs a { color: var(--sage); text-decoration: none; font-weight: 600; }

/* Article typography — more air, clearer blocks */
article.topic h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  line-height: 1.35;
  margin: 0 0 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--rose-deep);
}
.summary {
  color: var(--ink-soft);
  margin: 0 0 8px;
  font-size: 1.02rem;
  line-height: 1.75;
}

.topic-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px 22px;
  margin: 20px 0;
  box-shadow: var(--shadow-soft);
}
.topic-block h2,
.topic h2 {
  font-family: var(--font-display);
  font-size: 1.18rem;
  margin: 0 0 14px;
  padding: 0 0 10px;
  line-height: 1.4;
  color: var(--rose-deep);
  font-weight: 800;
  border-bottom: 2px dashed var(--rose-soft);
}
.topic-block + .topic-block { margin-top: 20px; }

.topic p { margin: 0 0 1.05rem; line-height: 1.8; }
.topic p:last-child { margin-bottom: 0; }
.topic-block > p:last-child { margin-bottom: 0; }

.topic ul, .topic ol,
.topic-block ul, .topic-block ol {
  margin: 0.2rem 0 0.2rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}
.topic li, .topic-block li {
  margin: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem 0.95rem 1.05rem;
  line-height: 1.75;
  position: relative;
}
.topic ol { counter-reset: step; }
.topic ol li { padding-left: 2.4rem; }
.topic ol li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 0.85rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 0.75rem;
  font-weight: 750;
  display: grid;
  place-items: center;
  line-height: 1;
}
.topic ul li { padding-left: 1.7rem; }
.topic ul li::before {
  content: "";
  position: absolute;
  left: 0.75rem;
  top: 1.15rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--sage-mid);
}

.topic-block li.named-item .item-name,
.topic li.named-item .item-name {
  margin: 0 0 0.4rem;
  font-weight: 750;
  color: var(--sage-deep);
  line-height: 1.45;
  font-size: 1.02em;
}
.topic-block li.named-item .item-name + p,
.topic li.named-item .item-name + p {
  margin-top: 0;
}
.topic-block li.named-item p + p,
.topic li.named-item p + p {
  margin-top: 0.55rem;
}

.topic li::marker { content: none; }

.callout ul, .dont ul, .note ul {
  display: grid;
  gap: 0.55rem;
  padding-left: 1.15rem;
  list-style: disc;
}
.callout li, .dont li, .note li {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.callout li::before, .dont li::before, .note li::before { content: none; }

.sources {
  margin-top: 2rem;
  padding: 20px 18px 8px;
  border-top: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.sources h2 {
  color: var(--gold);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold-soft);
  font-size: 1.1rem;
}
.sources ol {
  padding-left: 1.4rem;
  display: block;
  list-style: decimal;
}
.sources li {
  background: none;
  border: 0;
  padding: 0.35rem 0;
  margin: 0.35rem 0;
  color: var(--ink-soft);
  line-height: 1.65;
}
.sources li::before { content: none; }
.sources a { word-break: break-word; font-size: 0.95rem; }

/* Figures */
.figure-band {
  margin: 8px 0 6px;
}
.figure-note {
  background: var(--sage-soft);
  color: var(--ink-soft);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.7;
  margin: 0 0 14px;
}
.example-fig {
  margin: 0 0 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 10px 14px;
  overflow: hidden;
}
.example-fig img {
  width: 100%;
  border-radius: 12px;
  background: #fff;
}
.example-fig figcaption {
  padding: 10px 6px 0;
}
.example-fig figcaption p {
  margin: 0 0 6px;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.fig-credit {
  display: block;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--muted);
}

/* Quick-reference rows */
.qr-group { margin: 1.25rem 0 1.6rem; }
.qr-group h2 {
  font-size: 1.12rem;
  margin: 0 0 12px;
  padding-bottom: 0;
  border-bottom: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.4;
}
.qr-group > p {
  margin: 0 0 12px;
  color: var(--ink-soft);
}
.pill {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: none;
  padding: 4px 10px;
  border-radius: 999px;
}
.pill-emergency { background: var(--alert); color: #fff; }
.pill-urgent { background: var(--urgent); color: #fff; }
.pill-prompt { background: var(--prompt); color: #fff; }
.pill-care { background: var(--care); color: #fff; }

.qr-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin: 10px 0;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-soft);
}
.qr-item.emergency {
  background: var(--alert-bg);
  border-color: #F0C4C4;
  border-left: 6px solid var(--alert);
}
.qr-item.urgent {
  background: var(--urgent-bg);
  border-color: #E8D09A;
  border-left: 6px solid var(--urgent);
}
.qr-item.prompt {
  background: var(--prompt-bg);
  border-color: #C9CDE8;
  border-left: 6px solid var(--prompt);
}
.qr-item.care {
  border-left: 6px solid var(--care);
}
.qr-sign { font-weight: 750; line-height: 1.55; }
.qr-action { color: var(--ink-soft); font-size: 0.98rem; line-height: 1.7; }

.footer-note {
  margin-top: 32px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  line-height: 1.7;
}
.footer-note a { color: var(--sage); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.2rem 1rem;
  line-height: 1.75;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}


/* Hero kicker and numbered section plates */
.hero-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--sage-deep);
  background: var(--sage-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 0 10px;
  line-height: 1.35;
}
.section-card.unit-plate {
  align-items: flex-start;
  gap: 12px;
  padding: 18px 16px;
  border-top: 4px solid var(--sage-soft);
}
.unit-num {
  flex: 0 0 auto;
  min-width: 1.7em;
  margin-top: 4px;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--sage);
  font-variant-numeric: tabular-nums;
}
.section-card.unit-plate .section-icon { margin-top: 0; }
.section-card.unit-plate .chev { margin-top: 8px; }

/* Visual plates */
.plate {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  margin: 18px 0 20px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  min-width: 0;
}
.plate-head {
  padding: 16px 16px 12px;
  background: linear-gradient(180deg, var(--peach-soft) 0%, var(--card) 72%);
  border-bottom: 1px solid var(--line);
}
.plate-kicker {
  margin: 0 0 8px;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  color: var(--sage);
  background: var(--sage-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.plate-head h3 {
  font-family: var(--font-display);
  margin: 0 0 6px;
  font-size: 1.12rem;
  line-height: 1.4;
  font-weight: 800;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}
.plate-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.65;
}
.plate-body {
  padding: 14px 14px 8px;
  min-width: 0;
}
.plate-takeaway {
  margin: 0;
  padding: 12px 16px 14px;
  background: var(--mint-soft);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.7;
  border-top: 1px solid #C5E3DA;
}
.plate-takeaway strong {
  display: inline-block;
  margin-right: 6px;
  color: var(--mint-deep);
  font-weight: 750;
}
.plate-footnote {
  margin: 0;
  padding: 10px 16px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.7;
}
.plate-footnote-link { padding-top: 0; }
.plate-footnote a { font-weight: 650; }

.plate-panel { min-width: 0; }
.plate-panel-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  color: var(--gold);
}
.plate-pair {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}
.plate-figures .example-fig {
  margin-bottom: 8px;
  box-shadow: none;
}
.plate-figures .example-fig:last-child { margin-bottom: 0; }

/* Comparison columns (stack on phones) */
.compare-cols,
.goal-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
.compare-col,
.goal-cell {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px 14px;
  min-width: 0;
}
.compare-col > h3,
.goal-cell > h4 {
  margin: 0 0 10px;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--sage-deep);
  font-weight: 750;
}
.compare-row { margin: 0 0 10px; }
.compare-row:last-child { margin-bottom: 0; }
.compare-row h4 {
  margin: 0 0 4px;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  color: var(--sage);
}
.compare-row p,
.goal-cell p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.goal-cell.tone-gold { background: var(--gold-soft); border-color: #EAD4B0; }
.goal-cell.tone-gold > h4 { color: var(--gold); }
.goal-cell.tone-sage { background: var(--mint-soft); border-color: #C5E3DA; }
.goal-cell.tone-sage > h4 { color: var(--mint-deep); }
.goal-cell.tone-peach { background: var(--peach-soft); border-color: #F3C9B8; }
.goal-cell.tone-peach > h4 { color: var(--peach-deep); }

/* Dressing lookup: stacked cards first */
.lookup-grid { display: grid; gap: 12px; min-width: 0; }
.lookup-head { display: none; }
.lookup-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px 14px;
  display: grid;
  gap: 10px;
  min-width: 0;
}
.lookup-name {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.lookup-name h4 {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--sage-deep);
  font-weight: 750;
  overflow-wrap: anywhere;
}
.lookup-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  display: grid;
  place-items: center;
}
.lookup-icon svg { width: 28px; height: 28px; display: block; }
.lookup-cell h5 {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  color: var(--sage);
}
.lookup-cell p,
.lookup-span-text,
.lookup-row-note {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.lookup-cell.is-empty p { color: var(--muted); }
.lookup-row-note { color: var(--ink-soft); }
.lookup-span-text { color: var(--ink); }

/* Infection continuum */
.continuum {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: none;
}
.continuum li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0;
}
.continuum li::before { content: none; }
.step-num {
  flex: 0 0 auto;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 0.8rem;
  font-weight: 750;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.continuum h4 {
  margin: 0 0 4px;
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--sage-deep);
}
.continuum p { margin: 0; font-size: 0.95rem; line-height: 1.65; }

@media (min-width: 700px) {
  .plate-pair { grid-template-columns: 1fr 1fr; align-items: start; }
  .compare-cols { grid-template-columns: 1fr 1fr 1fr; }
  .goal-grid { grid-template-columns: 1fr 1fr 1fr; }
  .lookup-head {
    display: grid;
    grid-template-columns: minmax(7rem, 1.15fr) 1fr 1fr 1fr;
    gap: 8px;
    padding: 0 6px 4px;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    color: var(--sage);
  }
  .lookup-row {
    grid-template-columns: minmax(7rem, 1.15fr) 1fr 1fr 1fr;
    align-items: start;
  }
  .lookup-row h5 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .lookup-span-text { grid-column: 2 / -1; }
  .lookup-row-note { grid-column: 1 / -1; }
  .lookup-row.lookup-span { align-items: center; }
}

@media (max-width: 360px) {
  .section-card.unit-plate { gap: 10px; padding: 22px 12px 16px; }
  .unit-num { font-size: 1.1rem; }
  .plate-head, .plate-body { padding-left: 12px; padding-right: 12px; }
  .plate-takeaway, .plate-footnote { padding-left: 12px; padding-right: 12px; }
}

@media (min-width: 720px) {
  .section-grid { grid-template-columns: 1fr 1fr; }
}

/* Playful chrome — stickers, soft tape, rounded type */
.hero-kicker {
  font-family: var(--font-display);
  background: var(--peach-soft);
  color: var(--peach-deep);
  border: 1.5px solid #F3C9B8;
  box-shadow: 2px 3px 0 rgba(227, 137, 114, 0.18);
  transform: rotate(-2deg);
  padding: 5px 12px;
}
.section-icon {
  border-radius: 20px;
  box-shadow: 0 2px 0 rgba(142, 58, 82, 0.06);
}
.section-card.unit-plate {
  position: relative;
  border-top: 0;
  overflow: hidden;
  padding-top: 22px;
}
.section-card.unit-plate::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 16px;
  width: 44px;
  height: 8px;
  border-radius: 999px;
  background: var(--peach);
  transform: rotate(-8deg);
  box-shadow: 1px 1px 0 rgba(163, 69, 53, 0.12);
}
.section-grid a:nth-child(1).unit-plate::before { background: var(--peach); }
.section-grid a:nth-child(2).unit-plate::before { background: var(--mint-mid); }
.section-grid a:nth-child(3).unit-plate::before { background: var(--lilac-mid); }
.section-grid a:nth-child(4).unit-plate::before { background: var(--rose-mid); }
.section-grid a:nth-child(5).unit-plate::before { background: var(--gold-mid); }
.section-grid a:nth-child(6).unit-plate::before { background: var(--prompt); }
.section-grid a:nth-child(7).unit-plate::before { background: var(--rose); }

.unit-num {
  width: 2.15rem;
  height: 2.15rem;
  min-width: 2.15rem;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  background: var(--rose-soft);
  color: var(--rose-deep);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 2px 0 rgba(142, 58, 82, 0.08);
  transform: rotate(-6deg);
}
.section-grid a:nth-child(1) .unit-num { background: var(--peach-soft); color: var(--peach-deep); }
.section-grid a:nth-child(2) .unit-num { background: var(--mint-soft); color: var(--mint-deep); }
.section-grid a:nth-child(3) .unit-num { background: var(--lilac-soft); color: var(--lilac); }
.section-grid a:nth-child(4) .unit-num { background: var(--alert-bg); color: var(--alert); }
.section-grid a:nth-child(5) .unit-num { background: var(--gold-soft); color: var(--gold); }
.section-grid a:nth-child(6) .unit-num { background: var(--prompt-bg); color: var(--prompt); }
.section-grid a:nth-child(7) .unit-num { background: var(--rose-soft); color: var(--rose-deep); }

.plate-kicker, .card-kicker {
  font-family: var(--font-display);
  box-shadow: 1px 2px 0 rgba(142, 58, 82, 0.08);
}
.plate-kicker {
  background: var(--peach-soft);
  color: var(--peach-deep);
  border: 1px solid #F3C9B8;
  transform: rotate(-1.5deg);
}
.plate {
  box-shadow: var(--shadow);
}
.font-size-toggle button.is-selected,
.font-size-toggle button[aria-checked="true"] {
  background: var(--rose-soft);
  color: var(--rose-deep);
}
.lang-toggle {
  border-color: var(--line);
}
.search-box input {
  border-radius: 999px;
}
.search-box button {
  border-radius: 999px;
  background: var(--rose);
}
.search-box button:active { background: var(--rose-deep); }
.step-num, .topic ol li::before {
  font-family: var(--font-display);
  box-shadow: 0 1px 0 rgba(142, 58, 82, 0.08);
}
.lookup-icon {
  background: var(--peach-soft);
  color: var(--peach-deep);
  border-radius: 14px;
}
.card, .topic-block, .sources, .qr-item, .plate {
  border-color: var(--line);
}
@media (prefers-reduced-motion: reduce) {
  .hero-kicker, .unit-num, .plate-kicker,
  .section-card.unit-plate::before { transform: none; }
}


/* Shared 重點 / Takeaway block and educational figure plates (v1.0.0) */
.edition-link {
  margin: 8px 0 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted);
}
.edition-link a {
  color: var(--rose-deep);
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px dashed var(--rose-mid);
}
.edition-link a:hover,
.edition-link a:focus-visible {
  border-bottom-style: solid;
}
.edition-link-hint { color: var(--muted); font-weight: 400; }

.topic-keypoints {
  background: var(--mint-soft);
  border: 1px solid #C5E3DA;
  border-radius: var(--radius);
  padding: 16px 16px 8px;
  margin: 18px 0 20px;
  box-shadow: var(--shadow-soft);
}
.keypoints-kicker {
  margin: 0 0 10px;
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  color: var(--mint-deep);
  background: #fff;
  padding: 2px 8px;
  border-radius: 999px;
}
.keypoints-card {
  margin: 0 0 14px;
}
.keypoints-card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 1.05rem;
  line-height: 1.4;
  font-weight: 800;
  color: var(--mint-deep);
  overflow-wrap: anywhere;
}
.keypoints-card > p,
.keypoints-card > ul { margin: 0 0 10px; }
.keypoints-card li { margin: 0.4rem 0; }
.topic-keypoints .callout,
.topic-keypoints .dont,
.topic-keypoints .note {
  margin: 10px 0;
}

body.edition-cards .brand-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}
body.edition-cards .brand {
  text-align: left;
}

.cue-stack {
  display: grid;
  gap: 18px;
  margin: 18px 0 8px;
}
.cue-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 0;
  transform: rotate(-0.35deg);
}
.cue-stack .cue-card:nth-child(even) {
  transform: rotate(0.4deg);
}
.cue-card::before {
  content: "";
  position: absolute;
  top: 10px;
  right: 18px;
  width: 52px;
  height: 14px;
  background: rgba(47, 122, 107, 0.28);
  border-radius: 3px;
  transform: rotate(8deg);
  pointer-events: none;
}
.cue-card::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 16px;
  width: 42px;
  height: 10px;
  background: rgba(232, 137, 114, 0.32);
  border-radius: 3px;
  transform: rotate(-12deg);
  pointer-events: none;
}
.cue-head {
  padding: 22px 16px 10px;
  background: linear-gradient(180deg, var(--peach-soft) 0%, var(--card) 80%);
  border-bottom: 1px solid var(--line);
}
.cue-kicker {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.05em;
  color: var(--mint-deep);
  background: var(--mint-soft);
  padding: 2px 8px;
  border-radius: 999px;
}
.cue-count {
  font-variant-numeric: tabular-nums;
  color: var(--mint);
}
.cue-head h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.4;
  font-weight: 800;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}
.cue-body {
  padding: 14px 16px 16px;
  min-width: 0;
}
.cue-lead {
  margin: 0 0 12px;
  color: var(--ink-soft);
  line-height: 1.65;
}
.cue-bullets {
  margin: 0 0 8px;
  padding-left: 1.15em;
}
.cue-bullets li {
  margin: 0.45rem 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.cue-bullets li.official-name {
  font-weight: 650;
}
.cue-card .callout,
.cue-card .dont,
.cue-card .note,
.cue-flags,
.cue-donts,
.cue-note {
  margin: 12px 0 0;
}
.cue-flags,
.cue-card .callout {
  background: var(--alert-bg);
  border-left: 5px solid var(--alert);
}
.cue-flags h3,
.cue-card .callout h3 {
  color: var(--alert);
}
.cue-visual {
  margin: 0 0 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
}
.cue-visual img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  background: #fff;
}

@media (max-width: 360px) {
  .cue-head, .cue-body, .topic-keypoints { padding-left: 12px; padding-right: 12px; }
  .edition-link { overflow-wrap: anywhere; }
}
html[data-font-size="lg"] .cue-head h2,
html[data-font-size="lg"] .brand-title,
html[data-font-size="lg"] .topic h1 {
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .cue-card,
  .cue-stack .cue-card:nth-child(even),
  .cue-card::before,
  .cue-card::after {
    transform: none;
  }
}

/* ------------------------------------------------------------------
   Digital handbook shell (full notes only: body.book-app)
   Cards edition keeps the previous scrolling layout.
   ------------------------------------------------------------------ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.book-app {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 0%, rgba(63, 111, 113, 0.12) 0 120px, transparent 220px),
    radial-gradient(circle at 94% -2%, rgba(196, 165, 116, 0.16) 0 140px, transparent 240px),
    linear-gradient(180deg, #E8E0D2 0%, var(--paper-deep) 40%, var(--paper) 100%);
  line-height: 1.75;
}
body.book-app::before {
  opacity: 0.35;
}
body.book-app .skip { z-index: 40; }

body.book-app main#main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

body.book-app .app-header.book-tools {
  position: relative;
  top: auto;
  flex: 0 0 auto;
  z-index: 20;
  min-height: 0;
  gap: 6px;
  padding: 6px 10px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  padding-top: 6px;
  background: #EDE6D8;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 0;
  border-top: 1px solid #D6CDBD;
  box-shadow: inset 0 1px 0 rgba(251, 247, 239, 0.85);
  flex-wrap: wrap;
  row-gap: 4px;
}
body.book-app .brand {
  text-align: left;
  flex: 1 1 auto;
  min-width: 0;
}
body.book-app .brand-title {
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}
body.book-app .brand-sub {
  display: none;
}
body.book-app .header-tools {
  margin-left: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 4px;
}
body.book-app .back-btn,
body.book-app .contents-btn,
body.book-app .search-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--rose-deep);
  font-size: 0.75rem;
  font-weight: 750;
  box-shadow: none;
}
body.book-app .search-btn { padding: 0; }
body.book-app .back-btn.is-idle,
body.book-app .back-btn[hidden] {
  visibility: hidden;
  display: inline-flex;
  pointer-events: none;
}
body.book-app .font-size-toggle button {
  min-width: 34px;
  min-height: 38px;
  font-size: 0.68rem;
  padding: 0 5px;
}
body.book-app .lang-toggle {
  min-width: 52px;
  min-height: 40px;
  font-size: 0.75rem;
  padding: 0 8px;
  box-shadow: none;
}
@media (max-width: 400px) {
  body.book-app .header-tools {
    flex-basis: auto;
    width: auto;
    flex: 1 1 auto;
  }
  body.book-app .brand-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
html[data-font-size="lg"] body.book-app .brand-title {
  overflow-wrap: anywhere;
  white-space: normal;
  line-height: 1.2;
  font-size: 0.78rem;
}
html[data-font-size="lg"] body.book-app .font-size-toggle button {
  min-width: 32px;
  font-size: 0.62rem;
}

/* Book stage */
.book-stage {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px 10px 6px;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  position: relative;
}
.book {
  flex: 1 1 auto;
  min-height: 0;
  width: min(40rem, 100%);
  margin: 0 auto;
  position: relative;
  perspective: 1400px;
}
.book-shadow {
  pointer-events: none;
  position: absolute;
  inset: 6px -4px -6px 8px;
  border-radius: 0 12px 12px 0;
  background: #E4D0C8;
  box-shadow: 2px 3px 0 #D9C0B6;
  z-index: 0;
}
.book-page {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(90deg, rgba(58, 42, 48, 0.07) 0 10px, transparent 28px),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.0) 0 27px,
      rgba(180, 77, 104, 0.03) 27px 28px
    ),
    var(--card);
  border: 1px solid #EAD8D0;
  border-left: 1px solid #D9C3BA;
  border-radius: 2px 14px 14px 2px;
  box-shadow:
    inset 10px 0 18px -16px rgba(58, 42, 48, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55),
    0 10px 28px rgba(142, 58, 82, 0.10);
  overflow: hidden;
  transform-origin: left center;
  color: var(--ink);
}
.book-running-head {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 16px 6px 22px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--rose);
  border-bottom: 1px solid #F0DDD4;
  min-height: 1.8em;
  line-height: 1.35;
}
.book-running-head .rh-left,
.book-running-head .rh-right {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-running-head .rh-right {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--muted);
  flex: 0 1 auto;
}
.book-page-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 12px 18px 8px 22px;
  overflow-wrap: anywhere;
}
.book-page.is-overflow .book-page-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.book-folio {
  flex: 0 0 auto;
  text-align: center;
  padding: 4px 16px 8px;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.book-edge {
  appearance: none;
  border: 0;
  background: transparent;
  position: absolute;
  top: 12%;
  bottom: 12%;
  width: 18%;
  min-width: 44px;
  z-index: 3;
  cursor: pointer;
  color: var(--rose-deep);
  padding: 0;
}
.book-edge-prev { left: 0; }
.book-edge-next { right: 0; }
.book-edge .edge-chev {
  position: absolute;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 248, 244, 0.72);
  border: 1px solid #E8D0C8;
  color: var(--rose-deep);
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
}
.book-edge-prev .edge-chev { left: 4px; }
.book-edge-next .edge-chev { right: 4px; }
.book-edge:hover .edge-chev,
.book-edge:focus-visible .edge-chev {
  opacity: 1;
}
.book-edge:disabled {
  cursor: default;
}
.book-edge:disabled .edge-chev { display: none; }
.book-edge:focus-visible {
  outline: none;
}
@media (hover: none) {
  .book-edge .edge-chev { opacity: 0.35; }
}
@media (max-width: 400px) {
  .book-edge { width: 14%; min-width: 36px; }
  .book-edge .edge-chev {
    top: auto;
    bottom: 10px;
    margin-top: 0;
    width: 24px;
    height: 24px;
    opacity: 0.4;
    background: rgba(255, 248, 244, 0.88);
  }
}

.book-page.is-cover .book-running-head { visibility: hidden; }
.book-page.is-cover .book-folio { opacity: 0.7; }
.book-page.is-leaving {
  z-index: 4;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .book-page.is-leaving.turn-next {
    animation: book-turn-next 0.42s ease forwards;
  }
  .book-page.is-leaving.turn-prev {
    animation: book-turn-prev 0.42s ease forwards;
  }
  .book-page.is-entering.turn-next,
  .book-page.is-entering.turn-prev {
    animation: book-fade-in 0.36s ease;
  }
}
@keyframes book-turn-next {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-18%); opacity: 0; }
}
@keyframes book-turn-prev {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(18%); opacity: 0; }
}
@keyframes book-fade-in {
  from { opacity: 0.35; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .book-page.is-leaving.turn-next,
  .book-page.is-leaving.turn-prev {
    animation: book-fade-out 0.16s ease forwards;
  }
  .book-page.is-entering {
    animation: book-fade-in 0.16s ease;
  }
}
@keyframes book-fade-out {
  to { opacity: 0; }
}

.book-measure {
  position: absolute;
  left: -10080px;
  top: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  background: var(--card);
}

/* Cover */
.book-cover {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 4px 6px 2px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 18%, rgba(232, 137, 114, 0.18) 0 90px, transparent 160px),
    transparent;
}
.book-cover::before,
.book-cover::after {
  content: "";
  flex: 1 0 0;
  min-height: 0;
}
.book-cover-kicker {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  color: var(--rose);
}
.book-cover h1 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  line-height: 1.25;
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}
.book-cover .book-subtitle {
  margin: 0 0 16px;
  font-size: 1rem;
  letter-spacing: 0.04em;
  color: var(--gold);
  font-weight: 600;
}
.book-cover-plate {
  width: min(200px, 62%);
  margin: 0 auto 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  box-shadow: var(--shadow-soft);
  flex: 0 1 auto;
  min-height: 0;
  max-height: 32%;
}
.book-cover-plate img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.book-cover-lead {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.7;
}
.book-cover-hint {
  margin: 10px 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}
.book-cover .edition-link,
.book-cover .print-cue-link {
  margin: 8px 0 0;
}
.book-cover .print-cue-link a,
.book-page-body .print-cue-link a,
.book-page-body .edition-link a {
  color: var(--rose-deep);
  font-weight: 650;
}

/* Verso / colophon / chapter opener */
.book-verso,
.book-colophon,
.book-chapter {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.book-chapter {
  text-align: left;
  justify-content: flex-end;
  padding: 8px 2px 18px;
}
.chapter-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--rose);
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}
.book-chapter h1,
.book-search h1,
.contents-title,
.verso-title,
.colophon-title {
  font-family: var(--font-display);
  font-size: 1.55rem;
  line-height: 1.3;
  margin: 0 0 12px;
  font-weight: 800;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}
.book-chapter .chapter-blurb {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.75;
  font-size: 1.02rem;
}
.book-chapter .chapter-icon-wrap {
  margin-bottom: 18px;
}
.book-chapter .section-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.book-verso .disclaimer,
.book-colophon .disclaimer,
.book-page-body .disclaimer {
  margin: 0 0 14px;
}
.book-page-body .note {
  margin: 0 0 12px;
}
.colophon-meta,
.verso-continue {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

/* Contents */
.book-contents .contents-title {
  margin-bottom: 4px;
}
.contents-sub {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.88rem;
  letter-spacing: 0.08em;
  font-weight: 650;
}
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-chapter,
.toc-topic {
  display: flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  padding: 5px 0;
  min-height: 0;
  background: none;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}
.toc-chapter.unit-plate {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 0;
  align-items: baseline;
  gap: 8px;
}
.toc-chapter:first-child,
.toc li:first-child .toc-chapter { margin-top: 0; }
.toc-num {
  flex: 0 0 auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--rose);
  min-width: 1.7em;
  letter-spacing: 0.02em;
}
.toc-chapter .toc-title {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.4;
  flex: 1;
  overflow-wrap: anywhere;
}
.toc-topic {
  padding: 3px 0 3px 1.9em;
  color: var(--ink-soft);
  font-size: 0.95em;
  line-height: 1.5;
}
.toc-topic .toc-title { flex: 1; overflow-wrap: anywhere; }
.toc-dots {
  flex: 1 1 auto;
  border-bottom: 1px dotted #D9C3BA;
  min-width: 12px;
  height: 0.7em;
  opacity: 0.7;
}
.toc-tools {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid #F0DDD4;
}

/* Topic typography on paper (not website cards) */
.book-page-body .topic-heading {
  font-family: var(--font-display);
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 0 0 8px;
  font-weight: 800;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}
.book-page-body .summary,
.book-page-body .topic-lead {
  margin: 0 0 10px;
  color: var(--ink-soft);
  line-height: 1.75;
}
.book-page-body .topic-block,
.book-page-body .sources {
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  margin: 0 0 8px;
}
.book-page-body h2,
.book-page-body .topic-block h2,
.book-page-body .sources h2,
.book-page-body .qr-group h2 {
  font-family: var(--font-display);
  font-size: 1.08rem;
  margin: 0 0 8px;
  padding: 0 0 4px;
  line-height: 1.35;
  color: var(--rose-deep);
  font-weight: 800;
  border-bottom: 1px solid #F0DDD4;
}
.book-page-body p {
  margin: 0 0 0.85rem;
  line-height: 1.8;
}
.book-page-body p:last-child { margin-bottom: 0; }
.book-page-body ul,
.book-page-body ol {
  margin: 0 0 0.6rem;
  padding: 0;
  list-style: none;
  display: block;
}
.book-page-body li {
  margin: 0 0 0.65rem;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0 0 0 1.15rem;
  line-height: 1.7;
  position: relative;
}
.book-page-body ol {
  list-style: decimal;
  padding-left: 1.5rem;
  counter-reset: none;
}
.book-page-body ol li { padding-left: 0.15rem; }
.book-page-body ol li::before { content: none; display: none; }
.book-page-body ul li { padding-left: 1.15rem; }
.book-page-body ul li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  background: none;
  border-radius: 0;
  color: var(--rose-mid);
  font-weight: 700;
}
.book-page-body li.named-item {
  padding: 0 0 0.2rem;
  margin-bottom: 0.85rem;
}
.book-page-body li.named-item::before { content: none; }
.book-page-body li.named-item .item-name {
  margin: 0 0 0.25rem;
  font-weight: 750;
  color: var(--rose-deep);
  line-height: 1.45;
}

.book-page-body .callout,
.book-page-body .dont,
.book-page-body .note,
.book-page-body .disclaimer {
  border-radius: 12px;
  padding: 10px 12px;
  margin: 0 0 10px;
}
.book-page-body .callout ul,
.book-page-body .dont ul,
.book-page-body .note ul {
  display: block;
  padding-left: 1.1rem;
  list-style: disc;
  margin: 0;
}
.book-page-body .callout li,
.book-page-body .dont li,
.book-page-body .note li {
  background: none;
  border: 0;
  padding: 0;
  margin: 0.35rem 0;
}
.book-page-body .callout li::before,
.book-page-body .dont li::before,
.book-page-body .note li::before { content: none; }

.book-page-body .keypoints-kicker,
.kp-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  color: var(--mint-deep);
}
.book-page-body .keypoints-card {
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0;
  margin: 0;
}
.book-page-body .keypoints-card h3 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 1.08rem;
  color: var(--rose-deep);
  overflow-wrap: anywhere;
}

.book-page-body .qr-group { margin: 0 0 8px; }
.book-page-body .qr-item {
  margin: 0 0 8px;
  box-shadow: none;
}

.book-page-body .sources ol {
  padding-left: 1.3rem;
  list-style: decimal;
  display: block;
}
.book-page-body .sources li {
  padding: 0.2rem 0;
  margin: 0.2rem 0;
}
.book-page-body .sources li::before { content: none; }

/* Atlas plates as full book pages */
.book-page.is-plate .book-page-body {
  display: flex;
  flex-direction: column;
  padding: 8px 12px 6px 16px;
}
.book-page.is-plate .figure-note {
  flex: 0 0 auto;
  margin: 0 0 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
}
.book-page.is-plate .plate {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}
.book-page.is-plate .plate-head { flex: 0 0 auto; padding: 10px 12px 8px; }
.book-page.is-plate .plate-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.book-page.is-plate .plate-pair,
.book-page.is-plate .plate-panel,
.book-page.is-plate .example-fig {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  justify-content: center;
}
.book-page.is-plate .example-fig img {
  flex: 0 1 auto;
  min-height: 0;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
}
.book-page.is-plate .example-fig figcaption { flex: 0 0 auto; padding: 6px 4px 0; }
.book-page.is-plate .plate-takeaway,
.book-page.is-plate .plate-footnote { flex: 0 0 auto; }
.book-page.is-plate .compare-cols,
.book-page.is-plate .goal-grid,
.book-page.is-plate .lookup-grid,
.book-page.is-plate .continuum {
  overflow: auto;
  min-height: 0;
  flex: 1 1 auto;
}


/* Give the diagram more of the page when type is large or the screen is short. */
html[data-font-size="lg"] .book-page.is-plate .plate-kicker,
html[data-font-size="lg"] .book-page.is-plate .plate-sub {
  display: none;
}
html[data-font-size="lg"] .book-page.is-plate .plate-head {
  padding: 4px 10px;
}
html[data-font-size="lg"] .book-page.is-plate .plate-head h3 {
  font-size: 0.98rem;
  line-height: 1.25;
  margin: 0;
}
@media (max-height: 700px) {
  .book-page.is-plate .plate-kicker,
  .book-page.is-plate .plate-sub { display: none; }
  .book-page.is-plate .plate-head { padding: 4px 10px; }
  .book-page.is-plate .plate-head h3 {
    font-size: 1.05rem;
    line-height: 1.25;
    margin: 0;
  }
}


/* Search as a book index page */
.book-search .search-box {
  margin: 8px 0 12px;
}
.book-search .search-box input,
.book-search .search-box button {
  min-height: 44px;
  border-radius: 12px;
  box-shadow: none;
}
.book-search .index-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.book-search .index-list a {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 8px 0;
  border-bottom: 1px dotted #E8D0C8;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.book-search .index-list a strong {
  color: var(--rose-deep);
  font-weight: 750;
}
.book-search .index-list p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9em;
}

.book-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 360px) {
  .book-page-body { padding-left: 16px; padding-right: 14px; }
  .book-running-head { padding-left: 16px; padding-right: 12px; }
  .book-cover h1 { font-size: 1.55rem; }
  .chapter-num { font-size: 2.4rem; }
}
html[data-font-size="lg"] .book-cover h1,
html[data-font-size="lg"] .book-chapter h1,
html[data-font-size="lg"] .contents-title {
  overflow-wrap: anywhere;
}
html[data-font-size="lg"] .book-running-head {
  white-space: normal;
  font-size: 0.62rem;
}

@media (max-width: 360px) {
  html[data-font-size="lg"] .book-cover {
    justify-content: flex-start;
    padding-top: 6px;
  }
  html[data-font-size="lg"] .book-cover::before,
  html[data-font-size="lg"] .book-cover::after {
    content: none;
    flex: 0 0 0;
  }
  html[data-font-size="lg"] .book-cover-plate,
  html[data-font-size="lg"] .book-cover-kicker,
  html[data-font-size="lg"] .book-cover-hint { display: none; }
  html[data-font-size="lg"] .book-cover h1 { font-size: 1.4rem; margin-bottom: 6px; }
  html[data-font-size="lg"] .book-cover-lead { margin-bottom: 8px; line-height: 1.6; }
  html[data-font-size="lg"] .book-cover .print-cue-link { margin-top: 4px; }
}


/* Compact atlas plate titles so diagrams stay readable on narrow or large-font screens */
html[data-font-size="lg"] .plate-head h3,
html[data-font-size="lg"] .plate-kicker {
  font-size: 0.92rem;
  line-height: 1.25;
}
html[data-font-size="lg"] .plate-sub {
  font-size: 0.72rem;
  line-height: 1.35;
}
@media (max-width: 360px) {
  .plate-head h3 { font-size: 0.98rem; line-height: 1.25; }
  .plate-sub { font-size: 0.78rem; line-height: 1.35; }
  .plate-kicker { font-size: 0.68rem; }
}

html[data-font-size="lg"] .example-fig figcaption,
html[data-font-size="lg"] .plate-footnote,
html[data-font-size="lg"] .fig-credit {
  font-size: 0.72rem;
  line-height: 1.4;
}
@media (max-width: 360px) {
  .example-fig figcaption { font-size: 0.78rem; line-height: 1.4; }
  html[data-font-size="lg"] .example-fig figcaption { font-size: 0.68rem; }
  .plate-body img, .example-fig img { max-height: 42vh; width: auto; margin-inline: auto; }
}
