:root {
  --bg: #f7f3e9;
  --paper: #fffdf7;
  --paper-soft: #fff9ee;
  --line: #ddcfb1;
  --line-strong: #c9b084;
  --text: #1d232c;
  --muted: #4f5a69;
  --accent: #8e6f3e;
  --accent-soft: #f2e5ca;
  --radius: 16px;
  --shadow: 0 10px 22px rgba(49, 35, 8, 0.10);
  --sticky-offset: 0px;
  --tabbar-height: 0px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.shell {
  width: min(980px, calc(100% - 24px));
  margin: 0 auto;
}

html {
  -webkit-text-size-adjust: 100%;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: #263447;
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  z-index: 99;
}
.skip-link:focus { left: 8px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: #fffdf8;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(37, 30, 16, 0.08);
}
.topbar__inner {
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(420px, 1fr);
  align-items: end;
  gap: 14px 16px;
  padding: 14px 0;
}

.brand {
  max-width: 680px;
}

.brand__eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}
.brand__title {
  margin: 6px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 3.8vw, 44px);
  line-height: 1.06;
  letter-spacing: .01em;
  color: #1f1e1b;
  text-wrap: balance;
}
.brand__hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  max-width: 58ch;
}

.topbar__actions {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "switch switch"
    "state home";
  align-items: center;
  gap: 8px 10px;
  width: 100%;
}

.mode-switch {
  grid-area: switch;
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 4px;
  width: 100%;
}

.mode-switch__label {
  font-size: 12px;
  color: #425265;
  font-weight: 700;
  padding: 0;
}

.mode-switch__group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff7e8;
  width: 100%;
}

.mode-btn {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #2b3440;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 10px;
  cursor: pointer;
}

.mode-btn:hover,
.mode-btn:focus-visible {
  outline: none;
  background: #f5ead5;
}

.mode-btn.is-active {
  border-color: var(--line-strong);
  background: #f4e3bf;
}

.a11y-state {
  grid-area: state;
  justify-self: start;
  font-size: 12px;
  color: #3e4d61;
  background: #f3ead8;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 700;
  white-space: nowrap;
}

.btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fffdfa;
  color: #1f2937;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  gap: 8px;
}

.btn--primary {
  grid-area: home;
  justify-self: end;
  background: linear-gradient(180deg, #fbf2df, #f4e6c9);
  gap: 8px;
  min-width: 132px;
}
.btn--primary:hover {
  background: linear-gradient(180deg, #f9edcf, #f2deb3);
}

.btn--a11y {
  border-color: var(--line-strong);
  background: #fff8eb;
  gap: 8px;
}

.btn--a11y:hover {
  background: #f8ecd5;
}

.btn--a11y[aria-pressed="true"] {
  background: #1f2a38;
  border-color: #1f2a38;
  color: #ffffff;
}

.page {
  display: grid;
  gap: 14px;
  padding: 14px 0 calc(32px + env(safe-area-inset-bottom));
}

.card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(49, 35, 8, 0.07);
  padding: 14px;
}

.lead {
  margin: 0;
  color: #2e3743;
  font-size: 18px;
  line-height: 1.72;
  max-width: 68ch;
}
.intro__scope {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.a11y-help {
  margin: 10px 0 0;
  color: #2f3d4e;
  font-size: 15px;
  line-height: 1.68;
  max-width: 70ch;
}
.meta {
  margin: 10px 0 0;
  font-size: 12px;
  color: #6c7784;
}

.nav-hint {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: #2c3642;
  font-size: 13px;
  font-weight: 600;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  position: sticky;
  top: var(--sticky-offset);
  z-index: 25;
  background: var(--bg);
  padding: 8px 0 2px;
  border-bottom: 1px solid rgba(201, 176, 132, 0.4);
}
.tab-btn {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 10px 12px;
  cursor: pointer;
}
.tab-btn:hover,
.tab-btn:focus-visible {
  outline: none;
  background: #fff5df;
}
.tab-btn.is-active {
  border-color: var(--line-strong);
  background: #f3e4c6;
  color: #1e2024;
  box-shadow: inset 0 0 0 1px rgba(201, 176, 132, 0.48);
}

.accordion {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.stage {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  scroll-margin-top: calc(var(--sticky-offset) + var(--tabbar-height) + 14px);
}
.stage__summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  min-height: 52px;
}
.stage__summary::-webkit-details-marker { display: none; }
.stage[open] .stage__summary {
  background: #f9f2e3;
  border-bottom: 1px solid var(--line);
}

.stage[open] {
  border-color: var(--line-strong);
  background: #fffefb;
  box-shadow: 0 0 0 2px rgba(201, 176, 132, 0.22), 0 8px 18px rgba(58, 43, 18, 0.10);
}

.stage.is-flash {
  animation: stageFlash 1.1s ease;
}

.stage__summary::after {
  content: "▾";
  font-size: 14px;
  color: #5f6670;
  transition: transform .2s ease, color .2s ease;
}
.stage[open] .stage__summary::after {
  transform: rotate(180deg);
  color: var(--accent);
}

.stage__index {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  background: #fff6e2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.stage__title-wrap {
  display: grid;
  gap: 3px;
}
.stage__title {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(18px, 4.2vw, 24px);
  line-height: 1.15;
  color: #1f2329;
}
.stage__subtitle {
  color: #68727f;
  font-size: 12px;
}
.stage[open] .stage__subtitle {
  color: #394554;
}

.stage__content {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.detail {
  border: 1px solid #d8cfbf;
  border-radius: 12px;
  background: #ffffff;
  overflow: clip;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.detail summary {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  cursor: pointer;
  padding: 12px;
  min-height: 50px;
  font-weight: 700;
  font-size: 15px;
  color: #222a33;
}
.detail summary::-webkit-details-marker { display: none; }
.detail summary::after {
  content: "▾";
  font-size: 12px;
  color: #5a6370;
  transition: transform .2s ease, color .2s ease;
}

.detail[open] summary {
  border-bottom: 1px solid #dac8a7;
  background: #f9f2e3;
}
.detail[open] {
  border-color: #cdb58a;
  background: #fffefb;
  box-shadow: inset 4px 0 0 #caa76b;
}

.detail.is-flash {
  animation: detailFlash .95s ease;
}

.detail[open] summary::after {
  transform: rotate(180deg);
  color: var(--accent);
}

.detail p,
.detail ul,
.detail ol,
.detail .links,
.detail .note {
  margin: 0;
  padding: 12px;
}

.detail p,
.detail li,
.detail .note,
.contact-list li {
  max-width: 72ch;
}
.detail ul,
.detail ol {
  padding-left: 30px;
  color: #2f3a47;
}
.detail li {
  margin-bottom: 9px;
}
.detail .note {
  font-size: 13px;
  color: #5d6773;
  border-top: 1px dashed #d2c2a7;
}

.contact-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.contact-list li {
  border: 1px solid #d8cfbf;
  border-radius: 10px;
  padding: 10px;
  background: #fffdf7;
  font-size: 14px;
  color: #25303b;
}

.links {
  display: grid;
  gap: 8px;
}
.links a {
  border: 1px solid #d7ccb8;
  border-radius: 10px;
  padding: 9px 10px;
  color: #243140;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  font-size: 13px;
  background: #fffdf8;
}
.links a:hover {
  background: #fff4dd;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid #0f4d99;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.95);
}

.footer-note {
  color: #5e6977;
  font-size: 12px;
  padding: 4px 4px 2px;
}

@keyframes stageFlash {
  0% {
    box-shadow: 0 0 0 2px rgba(201, 176, 132, 0.34), 0 0 0 0 rgba(201, 176, 132, 0.30);
  }
  45% {
    box-shadow: 0 0 0 2px rgba(201, 176, 132, 0.38), 0 0 0 9px rgba(201, 176, 132, 0.20);
  }
  100% {
    box-shadow: 0 0 0 2px rgba(201, 176, 132, 0.30), 0 10px 24px rgba(58, 43, 18, 0.14);
  }
}

@keyframes detailFlash {
  0% {
    background: #f8e9ca;
  }
  100% {
    background: #fffdf7;
  }
}

@media (min-width: 860px) {
  .tabbar {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1080px) {
  .topbar__inner {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    padding: 10px 0;
  }

  .brand {
    max-width: 100%;
  }

  .brand__title {
    font-size: clamp(24px, 6vw, 36px);
  }

  .topbar__actions {
    grid-template-columns: 1fr;
    grid-template-areas:
      "switch"
      "state"
      "home";
    gap: 8px;
  }

  .a11y-state,
  .btn--primary {
    justify-self: stretch;
    text-align: center;
  }
}

@media (max-width: 920px) {
  .shell {
    width: min(980px, calc(100% - 18px));
  }

  .topbar__inner {
    align-items: stretch;
    gap: 10px;
    padding: 10px 0;
  }

  .topbar__actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "switch"
      "state"
      "home";
    gap: 8px;
  }

  .mode-switch,
  .a11y-state,
  .btn--primary {
    width: 100%;
  }

  .btn--primary {
    justify-content: center;
  }
}

@media (max-width: 760px) {
  .topbar__inner {
    align-items: stretch;
    gap: 8px;
    padding: 8px 0;
  }

  .brand {
    display: grid;
    gap: 4px;
  }

  .topbar__actions {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-switch__group {
    width: 100%;
    justify-content: stretch;
    gap: 4px;
    padding: 3px;
  }

  .mode-btn {
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    padding: 8px 5px;
    font-size: 12px;
    line-height: 1.2;
    min-height: 42px;
  }

  .a11y-state {
    width: 100%;
    text-align: center;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .brand__title {
    font-size: clamp(20px, 7vw, 30px);
    line-height: 1.08;
    margin-top: 2px;
  }

  .brand__hint {
    font-size: 12px;
  }

  .btn--primary {
    min-width: 0;
    padding: 10px;
    font-size: 13px;
    min-height: 44px;
  }

  .tabbar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    margin-bottom: 2px;
  }

  .tab-btn {
    scroll-snap-align: start;
    white-space: nowrap;
    line-height: 1.25;
    min-height: 48px;
    font-size: 12px;
    padding: 9px 12px;
  }

  .card {
    padding: 12px;
    border-radius: 14px;
    box-shadow: 0 6px 14px rgba(49, 35, 8, 0.08);
  }

  .accordion,
  .stage__content {
    padding: 8px;
  }

  .stage__summary {
    grid-template-columns: 24px 1fr auto;
    gap: 8px;
    padding: 10px;
  }

  .stage__index {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .stage__title {
    font-size: clamp(16px, 4.8vw, 20px);
  }

  .stage__subtitle {
    font-size: 10px;
  }

  .detail summary {
    padding: 10px;
    font-size: 15px;
    line-height: 1.3;
  }

  .detail p,
  .detail ul,
  .detail ol,
  .detail .links,
  .detail .note {
    padding: 10px;
  }

  .detail ul,
  .detail ol {
    padding-left: 24px;
  }

  .lead {
    font-size: 17px;
  }

  .a11y-help {
    font-size: 15px;
  }

  .detail summary {
    font-size: 14px;
  }

  .detail ul,
  .detail ol,
  .detail p {
    font-size: 15px;
    line-height: 1.62;
  }
}

@media (max-width: 560px) {
  .shell {
    width: calc(100% - 14px);
  }

  .brand__eyebrow {
    font-size: 10px;
  }

  .brand__title {
    font-size: clamp(19px, 7vw, 25px);
    max-width: 18ch;
  }

  .brand__hint {
    display: none;
  }

  .mode-switch__label {
    font-size: 11px;
  }

  .mode-btn {
    font-size: 11px;
    padding: 8px 4px;
  }

  .a11y-state {
    font-size: 11px;
    padding: 6px 8px;
  }

  .tabbar {
    grid-auto-columns: minmax(138px, 1fr);
    gap: 6px;
  }

  .tab-btn {
    font-size: 11px;
    padding: 9px;
  }

  .lead {
    font-size: 16px;
    line-height: 1.68;
  }

  .a11y-help {
    font-size: 14px;
    line-height: 1.6;
  }

  .intro__scope,
  .meta {
    font-size: 12px;
  }

  .nav-hint {
    font-size: 12px;
    padding: 7px 9px;
  }
}

@media (max-width: 380px) {
  .brand__title {
    font-size: clamp(18px, 6.7vw, 22px);
  }

  .stage__summary {
    grid-template-columns: 20px 1fr auto;
    gap: 6px;
  }

  .stage__index {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .stage__title {
    font-size: 16px;
  }

  .detail summary {
    font-size: 13px;
  }

  .detail ul,
  .detail ol,
  .detail p {
    font-size: 14px;
    line-height: 1.56;
  }
}

/* Mode: low vision */
body.mode-lowvision {
  --bg: #f4f1e8;
  --paper: #ffffff;
  --paper-soft: #fcfaf4;
  --line: #6f7a88;
  --line-strong: #1d2f46;
  --text: #0d1622;
  --muted: #1f3042;
  --accent: #0057cc;
  --accent-soft: #dce8ff;
}

body.mode-lowvision .lead,
body.mode-lowvision .detail ul,
body.mode-lowvision .detail ol,
body.mode-lowvision .detail p,
body.mode-lowvision .contact-list li,
body.mode-lowvision .links a {
  font-size: 19px;
  line-height: 1.85;
  letter-spacing: 0.015em;
  word-spacing: 0.04em;
}

body.mode-lowvision .stage,
body.mode-lowvision .detail,
body.mode-lowvision .tab-btn,
body.mode-lowvision .btn,
body.mode-lowvision .mode-switch__group,
body.mode-lowvision .mode-btn {
  border-width: 2px;
}

body.mode-lowvision .stage[open] {
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.30), 0 8px 18px rgba(21, 34, 51, 0.18);
}

body.mode-lowvision .stage[open] .stage__summary,
body.mode-lowvision .detail[open] summary {
  background: linear-gradient(90deg, #dce8ff, #f5f9ff);
}

body.mode-lowvision .stage[open] .stage__summary .stage__title::after,
body.mode-lowvision .detail[open] summary::before {
  color: #123766;
}

body.mode-lowvision .detail[open] {
  box-shadow: inset 6px 0 0 #0b57d0;
}

body.mode-lowvision .links a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

body.mode-lowvision .tab-btn.is-active {
  background: #dce8ff;
  color: #0d223f;
}

body.mode-lowvision .a11y-state {
  background: #0f2238;
  border-color: #0f2238;
  color: #ffffff;
}

body.mode-lowvision .stage__summary::after,
body.mode-lowvision .detail summary::after {
  color: #0b57d0;
}

body.mode-lowvision .mode-btn.is-active {
  background: #dce8ff;
  border-color: #0057cc;
  color: #0b284d;
}

body.mode-lowvision .tab-btn,
body.mode-lowvision .mode-btn,
body.mode-lowvision .btn {
  min-height: 48px;
}

body.mode-lowvision .stage__title {
  font-size: clamp(20px, 4.8vw, 28px);
  line-height: 1.2;
}

/* Mode: color-blind friendly (non-color cues + safer palette) */
body.mode-colorblind {
  --bg: #f6f6f7;
  --paper: #ffffff;
  --paper-soft: #f9fafb;
  --line: #9aa3af;
  --line-strong: #1f4e79;
  --text: #111827;
  --muted: #334155;
  --accent: #0f4c81;
  --accent-soft: #e6eef6;
}

body.mode-colorblind .stage[open] .stage__summary,
body.mode-colorblind .detail[open] summary {
  background: repeating-linear-gradient(
    -45deg,
    #e8f1fb,
    #e8f1fb 8px,
    #f7fbff 8px,
    #f7fbff 16px
  );
}

body.mode-colorblind .stage[open] {
  box-shadow: 0 0 0 2px rgba(15, 76, 129, 0.28), 0 8px 18px rgba(17, 24, 39, 0.14);
}

body.mode-colorblind .detail[open] {
  box-shadow: inset 6px 0 0 #0f4c81;
}

body.mode-colorblind .stage__summary::after,
body.mode-colorblind .detail summary::after {
  color: #0f4c81;
  font-weight: 800;
}

body.mode-colorblind .stage[open] .stage__summary .stage__title::after,
body.mode-colorblind .detail[open] summary::before {
  color: #0f4c81;
}

body.mode-colorblind .links a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

body.mode-colorblind .tab-btn.is-active,
body.mode-colorblind .mode-btn.is-active {
  background: #dbeafe;
  border-color: #0f4c81;
  color: #0f3b63;
}

body.mode-colorblind .stage[open],
body.mode-colorblind .detail[open] {
  border-style: dashed;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Book layout: simplified linear reading mode */
body.book-layout {
  background: #f8f6f1;
  scroll-behavior: smooth;
}

body.book-layout .topbar {
  position: static;
  box-shadow: none;
  border-bottom: 1px solid #d9c9a8;
}

body.book-layout .topbar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  padding: 14px 0;
}

body.book-layout .topbar__actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

body.book-layout .mode-switch,
body.book-layout .a11y-state,
body.book-layout .btn--primary {
  width: 100%;
}

body.book-layout .btn--primary {
  justify-self: stretch;
}

body.book-layout .page {
  display: grid;
  gap: 12px;
  padding: 14px 0 26px;
}

body.book-layout .card {
  background: #ffffff;
  border: 1px solid #d9c9a8;
  box-shadow: none;
  border-radius: 14px;
}

body.book-layout .book-intro .lead {
  font-size: 18px;
  line-height: 1.72;
}

body.book-layout .bookmarks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

body.book-layout .bookmark {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9c9a8;
  border-radius: 999px;
  text-decoration: none;
  color: #1f2937;
  font-weight: 700;
  font-size: 13px;
  background: #fffdf7;
  padding: 8px 10px;
}

body.book-layout .bookmark.is-active,
body.book-layout .bookmark[aria-current="true"] {
  background: #f1e4c8;
  border-color: #b99f6f;
}

body.book-layout .book-content {
  display: grid;
  gap: 12px;
}

body.book-layout .chapter {
  padding: 16px;
  scroll-margin-top: 14px;
}

body.book-layout .chapter h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.08;
  color: #1f2329;
}

body.book-layout .chapter-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #efe3cb;
}

body.book-layout .chapter-block h3 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.2;
  color: #1f2937;
}

body.book-layout .chapter p,
body.book-layout .chapter li,
body.book-layout .chapter .links a,
body.book-layout .chapter .contact-list li {
  font-size: 18px;
  line-height: 1.76;
  color: #2b3440;
}

body.book-layout .chapter ul,
body.book-layout .chapter ol {
  margin: 0;
  padding-left: 26px;
}

body.book-layout .chapter li {
  margin-bottom: 8px;
}

body.book-layout .chapter .links {
  display: grid;
  gap: 8px;
}

body.book-layout .chapter .links a {
  display: block;
  text-decoration: underline;
  text-underline-offset: 2px;
  border: 1px solid #e3d4b6;
  border-radius: 10px;
  background: #fffcf5;
  padding: 10px 12px;
}

body.book-layout .chapter .contact-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}

body.book-layout .chapter .contact-list li {
  margin: 0;
  border: 1px solid #e3d4b6;
  border-radius: 10px;
  background: #fffcf5;
  padding: 10px 12px;
}

body.book-layout .footer-note {
  font-size: 14px;
  line-height: 1.6;
}

body.book-layout.mode-lowvision .chapter p,
body.book-layout.mode-lowvision .chapter li,
body.book-layout.mode-lowvision .chapter .links a,
body.book-layout.mode-lowvision .chapter .contact-list li {
  font-size: 20px;
  line-height: 1.9;
}

body.book-layout.mode-colorblind .chapter .chapter-block {
  border-top: 2px dashed #2f5578;
}

body.book-layout.mode-colorblind {
  --bg: #f1ecfb;
  --paper: #ffffff;
  --paper-soft: #f7f2ff;
  --line: #8d79ac;
  --line-strong: #5b3d86;
  --text: #1d1230;
  --muted: #423457;
  --accent: #5b3d86;
  --accent-soft: #e4d8f5;
  position: relative;
}

body.book-layout.mode-colorblind::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: rgba(108, 72, 158, 0.09);
  mix-blend-mode: multiply;
}

body.book-layout.mode-colorblind .topbar {
  background: #f7f2ff;
  border-bottom: 2px solid #8d79ac;
}

body.book-layout.mode-colorblind .card {
  border: 2px solid #8d79ac;
  background: #ffffff;
  position: relative;
  z-index: 2;
}

body.book-layout.mode-colorblind .bookmarks {
  background: #f7f2ff;
}

body.book-layout.mode-colorblind .bookmark {
  border: 2px solid #5b3d86;
  background: #ffffff;
  color: #2a1842;
}

body.book-layout.mode-colorblind .bookmark::before {
  content: "▸ ";
  font-weight: 800;
}

body.book-layout.mode-colorblind .bookmark.is-active,
body.book-layout.mode-colorblind .bookmark[aria-current="true"] {
  border-color: #4a2f6f;
  background: repeating-linear-gradient(
    -45deg,
    #e9def9,
    #e9def9 8px,
    #f8f3ff 8px,
    #f8f3ff 16px
  );
}

body.book-layout.mode-colorblind .chapter h2 {
  color: #2b1746;
}

body.book-layout.mode-colorblind .chapter-block h3 {
  color: #3b245f;
}

body.book-layout.mode-colorblind .chapter-block h3::before {
  content: "◆ ";
  font-weight: 800;
}

body.book-layout.mode-colorblind .chapter .links a {
  border: 2px solid #8d79ac;
  border-left: 6px solid #5b3d86;
  background: #fcf9ff;
}

body.book-layout.mode-colorblind .chapter .contact-list li {
  border: 2px solid #8d79ac;
  border-left: 6px solid #5b3d86;
  background: #fcf9ff;
}

@media (max-width: 900px) {
  body.book-layout .topbar__inner {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.book-layout .brand__title {
    font-size: clamp(24px, 8vw, 34px);
  }
}

@media (max-width: 760px) {
  body.book-layout .page {
    gap: 10px;
  }

  body.book-layout .bookmarks {
    grid-auto-flow: column;
    grid-template-columns: none;
    grid-auto-columns: minmax(140px, 1fr);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }

  body.book-layout .bookmark {
    scroll-snap-align: start;
    white-space: nowrap;
    font-size: 12px;
  }

  body.book-layout .chapter {
    padding: 12px;
  }

  body.book-layout .chapter h2 {
    font-size: clamp(30px, 8vw, 44px);
  }

  body.book-layout .chapter-block h3 {
    font-size: 20px;
  }

  body.book-layout .chapter p,
  body.book-layout .chapter li,
  body.book-layout .chapter .links a,
  body.book-layout .chapter .contact-list li {
    font-size: 17px;
    line-height: 1.68;
  }
}

@media (max-width: 420px) {
  body.book-layout .brand__title {
    font-size: clamp(21px, 8vw, 28px);
  }

  body.book-layout .mode-btn {
    font-size: 11px;
    padding: 8px 4px;
  }

  body.book-layout .chapter h2 {
    font-size: clamp(30px, 10vw, 40px);
  }

  body.book-layout .chapter-block h3 {
    font-size: 18px;
  }
}