:root {
  --c-navy: #1e3a5f;
  --c-navy-2: #14283f;
  --c-gold: #b0894e;
  --c-gold-2: #8c6a2c;
  --c-bg: #f6f4ef;
  --c-surface: #fdfcf9;
  --c-surface-2: #eceadf;
  --c-border: #e2ddce;
  --c-text: #1a2438;
  --c-text-muted: #5a6478;
  --c-paper: #f1e7d2;
  --c-success: #1e9e6a;
  --font-heading: "Anuphan", system-ui, sans-serif;
  --font-body: "Sarabun", system-ui, sans-serif;
  --reader-size: 19px;
  --hero-from: #fbf8f1;
  --hero-to: #efe6d3;
  --hero-blob: #d8b25a;
  --hero-ink: #16233c;
  --hero-muted: #4a5468;
  --hero-emphasis: #8c6a2c;
  --step-number-bg: #1e3a5f;
  --step-number-text: #fffaf0;
  --step-number-border: #14283f;
  --header-height: 72px;
  --sidebar-width: 280px;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(14, 42, 71, 0.08), 0 14px 40px rgba(14, 42, 71, 0.08);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --c-navy: #7fa6d8;
  --c-navy-2: #a8c4e8;
  --c-gold: #d7b873;
  --c-gold-2: #d7b873;
  --c-bg: #0b0f1a;
  --c-surface: #131827;
  --c-surface-2: #161c2b;
  --c-border: #283043;
  --c-text: #eaecf2;
  --c-text-muted: #a2a9bc;
  --c-paper: #1a2236;
  --c-success: #34c98a;
  --hero-from: #101a30;
  --hero-to: #070d1c;
  --hero-blob: #b89240;
  --hero-ink: #f6f1e7;
  --hero-muted: rgba(244, 239, 228, .82);
  --hero-emphasis: #e7c87d;
  --step-number-bg: #d7b873;
  --step-number-text: #0b0f1a;
  --step-number-border: #e7c87d;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 24px);
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--c-bg);
}

h1, h2, h3, h4, .brand-copy strong, .eyebrow, button { font-family: var(--font-heading); }

body.no-scroll { overflow: hidden; }

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--c-gold);
  color: #1d1608;
  transform: translateY(-150%);
  transition: transform 0.15s;
}

.skip-link:focus { transform: translateY(0); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--c-gold) 72%, transparent);
  outline-offset: 3px;
}

.reading-progress {
  position: fixed;
  z-index: 200;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--c-gold);
  transition: width 0.08s linear;
}

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  display: grid;
  grid-template-columns: minmax(220px, var(--sidebar-width)) minmax(260px, 540px) 1fr auto;
  align-items: center;
  min-height: var(--header-height);
  padding: 10px 22px 10px 18px;
  border-bottom: 1px solid var(--c-border);
  background: color-mix(in srgb, var(--c-bg) 91%, transparent);
  color: var(--c-text);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--c-text) 8%, transparent);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--c-border);
  border-radius: 50%;
  background: var(--c-surface);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--c-gold) 5%, transparent);
}

.brand-mark b { color: var(--c-gold); font-size: 1.25rem; }
.brand-mark i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--c-gold); }
.brand-mark i:nth-of-type(1) { top: 4px; left: 18px; }
.brand-mark i:nth-of-type(2) { right: 4px; bottom: 11px; }
.brand-mark i:nth-of-type(3) { left: 5px; bottom: 9px; }

.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 1.07rem; letter-spacing: .01em; }
.brand-copy strong b { color: var(--c-gold); }
.brand-copy small { margin-top: 4px; color: var(--c-text-muted); font-size: .75rem; }

.header-actions {
  grid-column: 4;
  display: flex;
  gap: 8px;
}

.font-controls { display: flex; align-items: center; gap: 6px; }
.font-controls button { width: 40px; height: 40px; padding: 0; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); color: var(--c-text); font-weight: 700; cursor: pointer; }
.font-controls button:hover:not(:disabled) { border-color: var(--c-gold); background: var(--c-paper); }
.font-controls button:disabled { color: var(--c-text-muted); opacity: .45; cursor: not-allowed; }

.header-search {
  grid-column: 2;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 0 5px 0 14px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: var(--c-surface);
}
.header-search:focus-within { border-color: var(--c-gold); box-shadow: 0 0 0 3px rgba(201,162,74,.2); }
.header-search svg { width: 21px; height: 21px; fill: none; stroke: var(--c-text-muted); stroke-width: 1.8; stroke-linecap: round; }
.header-search input { width: 100%; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; color: var(--c-text); font: inherit; }
.header-search input::placeholder { color: var(--c-text-muted); }
.header-search button { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--c-gold); color: #1d1608; font: inherit; font-size: .82rem; font-weight: 800; cursor: pointer; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
}

.icon-button:hover { border-color: var(--c-gold); background: var(--c-paper); }
.icon-button:active { transform: scale(.96); }
.icon-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.menu-button { display: none; }
.moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100vh - var(--header-height));
}

.sidebar {
  position: sticky;
  top: var(--header-height);
  align-self: start;
  height: calc(100vh - var(--header-height));
  padding: 28px 18px 22px;
  border-right: 1px solid var(--c-border);
  background: color-mix(in srgb, var(--c-surface) 91%, transparent);
  overflow-y: auto;
}

.eyebrow {
  display: inline-block;
  color: var(--c-gold-2);
  font-size: .76em;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

[data-theme="dark"] .eyebrow { color: var(--c-gold); }

.sidebar-intro { padding: 0 10px 18px; }
.sidebar, .chapter-drawer, .search-dialog { font-size: var(--reader-size); }
.sidebar-intro p { margin: 7px 0 0; color: var(--c-text-muted); font-size: .88em; line-height: 1.55; }

.chapter-nav { display: grid; gap: 5px; }
.chapter-nav a { text-decoration: none; }

.chapter-nav-home,
.chapter-nav-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: var(--c-text-muted);
  transition: background .15s, border-color .15s, color .15s;
}

.chapter-nav-home span,
.chapter-nav-item span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--c-surface-2);
  color: var(--c-navy-2);
  font-size: .83em;
  font-weight: 800;
}

[data-theme="dark"] .chapter-nav-home span,
[data-theme="dark"] .chapter-nav-item span { color: var(--c-gold); }

.chapter-nav a strong { font-size: .9em; font-weight: 600; line-height: 1.35; }
.chapter-nav a:hover { border-color: var(--c-border); background: var(--c-surface); color: var(--c-text); }
.chapter-nav-item.is-active { border-color: color-mix(in srgb, var(--c-gold) 45%, var(--c-border)); background: color-mix(in srgb, var(--c-gold) 11%, var(--c-surface)); color: var(--c-text); }
.chapter-nav-item.is-active span { background: var(--c-gold); color: #1d1608; }

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 24px 8px 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--c-gold) 30%, var(--c-border));
  border-radius: 12px;
  background: color-mix(in srgb, var(--c-paper) 86%, transparent);
}

.sidebar-note span { color: var(--c-gold-2); }
.sidebar-note p { margin: 0; color: var(--c-text-muted); font-size: .8em; }

main { min-width: 0; }
#app { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 52px 0 80px; }
.home-hero, .chapter-section, .how-it-works, .resource-links, .lesson { font-size: var(--reader-size); }

.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: center;
  gap: 48px;
  min-height: 410px;
  padding: 52px 56px;
  border: 1px solid var(--c-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at 88% 18%, color-mix(in srgb, var(--hero-blob) 32%, transparent), transparent 18rem),
    linear-gradient(120deg, var(--hero-from), var(--hero-to));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.home-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -130px;
  width: 360px;
  height: 360px;
  border: 1px solid color-mix(in srgb, var(--c-gold) 24%, transparent);
  border-radius: 50%;
}

.hero-copy { position: relative; z-index: 1; }
.hero-copy h1 { margin: 12px 0 18px; color: var(--hero-ink); font-size: clamp(2.2rem, calc(var(--reader-size) * 3), 4.8rem); line-height: 1.08; letter-spacing: -.035em; }
.hero-copy h1 em { color: var(--hero-emphasis); font-style: normal; }
.hero-copy > p { max-width: 650px; margin: 0; color: var(--hero-muted); font-size: 1.08em; line-height: 1.8; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--c-gold-2); background: var(--c-gold); color: #1d1608; box-shadow: 0 12px 26px color-mix(in srgb, var(--c-gold) 25%, transparent); }
.secondary-button { border: 1px solid var(--c-border); background: var(--c-surface); color: var(--c-text); }
.hero-points { display: flex; flex-wrap: wrap; gap: 18px; margin: 30px 0 0; padding: 20px 0 0; border-top: 1px solid var(--c-border); list-style: none; color: var(--c-text-muted); font-size: .9em; }
.hero-points li { display: flex; align-items: center; gap: 6px; }
.hero-points b { color: var(--c-gold-2); font-size: 1.1em; }

.hero-orbit {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 260px;
  height: 260px;
  margin: auto;
  border: 1px solid color-mix(in srgb, var(--c-navy) 22%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 26px color-mix(in srgb, var(--c-navy) 3%, transparent);
}
.hero-orbit::before, .hero-orbit::after { content: ""; position: absolute; border: 1px solid color-mix(in srgb, var(--c-gold) 35%, transparent); border-radius: 50%; }
.hero-orbit::before { inset: 32px; }
.hero-orbit::after { inset: 72px; background: var(--c-navy); box-shadow: 0 18px 45px rgba(14,42,71,.24); }
.hero-orbit span { position: relative; z-index: 2; color: var(--c-gold); font-size: 3.8rem; font-weight: 800; }
.hero-orbit i { position: absolute; z-index: 3; width: 13px; height: 13px; border: 3px solid var(--c-surface); border-radius: 50%; background: var(--c-gold); box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.hero-orbit i:nth-of-type(1) { top: 16px; left: 123px; }
.hero-orbit i:nth-of-type(2) { top: 74px; right: 10px; }
.hero-orbit i:nth-of-type(3) { bottom: 25px; right: 48px; }
.hero-orbit i:nth-of-type(4) { bottom: 58px; left: 17px; }

.chapter-section { margin-top: 72px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 26px; }
.section-heading h2 { margin: 5px 0 0; font-size: clamp(1.8em, 3vw, 2.5em); }
.section-heading > p { max-width: 480px; margin: 0; color: var(--c-text-muted); line-height: 1.7; }
.chapter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }

.chapter-card {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 18px;
  min-height: 210px;
  padding: 26px;
  border: 1px solid var(--c-border);
  border-radius: 18px;
  background: var(--c-surface);
  text-decoration: none;
  box-shadow: 0 3px 16px color-mix(in srgb, var(--c-navy) 5%, transparent);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}
.chapter-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c-gold) 60%, var(--c-border)); box-shadow: var(--shadow); }
.chapter-card-icon { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 17px; background: color-mix(in srgb, var(--c-navy) 8%, var(--c-surface)); color: var(--c-navy); }
[data-theme="dark"] .chapter-card-icon { color: var(--c-gold); }
.chapter-card-icon svg { width: 31px; height: 31px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chapter-number { color: var(--c-gold-2); font-size: .76em; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.chapter-card h2 { margin: 7px 0 8px; font-size: 1.25em; line-height: 1.35; }
.chapter-card p { margin: 0; color: var(--c-text-muted); font-size: .92em; line-height: 1.65; }
.chapter-open { display: inline-flex; gap: 8px; margin-top: 18px; color: var(--c-navy-2); font-size: .88em; font-weight: 700; }
[data-theme="dark"] .chapter-open { color: var(--c-gold); }

.how-it-works { margin-top: 72px; padding: 38px; border: 1px solid color-mix(in srgb, var(--c-gold) 28%, var(--c-border)); border-radius: 20px; background: var(--c-paper); }
.three-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 18px; }
.three-steps > div { position: relative; padding-left: 54px; }
.three-steps b { position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--c-gold); color: #1d1608; }
.three-steps h3 { margin: 0 0 4px; }
.three-steps p { margin: 0; color: var(--c-text-muted); font-size: .9em; line-height: 1.6; }

.resource-links {
  margin-top: 48px;
  padding: 30px;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  background: var(--c-surface);
  box-shadow: 0 3px 16px color-mix(in srgb, var(--c-navy) 5%, transparent);
}
.resource-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.resource-heading h2 { margin: 5px 0 0; font-size: 1.45em; }
.resource-heading > p { max-width: 430px; margin: 0; color: var(--c-text-muted); font-size: .88em; line-height: 1.65; }
.resource-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.resource-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 150px;
  padding: 19px;
  border: 1px solid var(--c-border);
  border-radius: 14px;
  background: var(--c-bg);
  color: var(--c-text);
  text-decoration: none;
  transition: transform .16s, border-color .16s, background .16s;
}
.resource-card:hover { transform: translateY(-2px); border-color: var(--c-gold); background: var(--c-paper); }
.resource-card strong { padding-right: 28px; font-family: var(--font-heading); font-size: 1.04em; line-height: 1.35; }
.resource-card p { margin: 8px 0 16px; color: var(--c-text-muted); font-size: .82em; line-height: 1.55; }
.resource-footer { display: flex; align-items: end; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 11px; border-top: 1px solid var(--c-border); }
.resource-card small { min-width: 0; color: var(--c-text-muted); font-size: .66em; overflow-wrap: anywhere; }
.resource-footer > span { flex: 0 0 auto; color: var(--c-gold-2); font-size: .68em; font-weight: 800; white-space: nowrap; }
.resource-external { position: absolute; top: 14px; right: 15px; color: var(--c-gold-2); font-size: 1.1em; font-weight: 800; }

.lesson { width: min(900px, 100%); margin: 0 auto; }
.lesson-hero { margin-bottom: 28px; }
.back-home { display: inline-flex; min-height: 44px; align-items: center; color: var(--c-text-muted); font-size: .9em; font-weight: 700; text-decoration: none; }
.back-home:hover { color: var(--c-text); }
.lesson-identity { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 24px; margin-top: 18px; }
.lesson-icon { display: grid; place-items: center; width: 88px; height: 88px; border: 1px solid color-mix(in srgb, var(--c-gold) 38%, var(--c-border)); border-radius: 24px; background: var(--c-paper); color: var(--c-navy); box-shadow: var(--shadow); }
[data-theme="dark"] .lesson-icon { color: var(--c-gold); }
.lesson-icon svg { width: 42px; height: 42px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lesson-identity h1 { margin: 7px 0 8px; font-size: clamp(2em, 5vw, 3.4em); line-height: 1.15; letter-spacing: -.025em; }
.lesson-identity p { margin: 0; color: var(--c-text-muted); line-height: 1.75; }

.quick-guide {
  margin-top: 32px;
  padding: 34px;
  border: 1px solid color-mix(in srgb, var(--c-gold) 42%, var(--c-border));
  border-radius: 20px;
  background: linear-gradient(145deg, var(--c-paper), color-mix(in srgb, var(--c-surface) 92%, var(--c-paper)));
  box-shadow: var(--shadow);
}
.quick-guide-heading h2 { margin: 6px 0 6px; font-size: 1.55em; }
.quick-guide-heading p { margin: 0; color: var(--c-text-muted); line-height: 1.7; }
.quick-steps { display: grid; gap: 12px; margin: 24px 0; padding: 0; list-style: none; counter-reset: none; }
.quick-steps li { display: grid; grid-template-columns: 42px 1fr; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px 10px 10px; border: 1px solid var(--c-border); border-radius: 13px; background: var(--c-surface); }
.quick-steps li > span { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--step-number-border); border-radius: 10px; background: var(--step-number-bg); color: var(--step-number-text); font-weight: 800; box-shadow: 0 2px 8px color-mix(in srgb, var(--step-number-bg) 24%, transparent); }
.quick-steps p { margin: 0; line-height: 1.55; }
.done-check { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; padding-top: 20px; border-top: 1px solid var(--c-border); }
.done-check > span { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--c-success) 15%, transparent); color: var(--c-success); font-weight: 900; }
.done-check p { margin: 3px 0 0; color: var(--c-text-muted); }

.in-page-toc { margin-top: 24px; padding: 22px; border: 1px solid var(--c-border); border-radius: 16px; background: var(--c-surface); }
.in-page-toc > strong { display: block; margin-bottom: 12px; }
.in-page-toc > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.in-page-toc a { display: grid; grid-template-columns: auto 1fr; gap: 8px; min-height: 44px; align-items: center; padding: 7px 9px; border-radius: 9px; color: var(--c-text-muted); font-size: .88em; line-height: 1.4; text-decoration: none; }
.in-page-toc a:hover { background: var(--c-surface-2); color: var(--c-text); }
.in-page-toc a span { color: var(--c-gold-2); font-weight: 800; }

.full-guide { margin-top: 24px; border: 1px solid var(--c-border); border-radius: 18px; background: var(--c-surface); box-shadow: 0 3px 16px color-mix(in srgb, var(--c-navy) 5%, transparent); overflow: clip; }
.full-guide summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 82px; padding: 18px 24px; cursor: pointer; list-style: none; }
.full-guide summary::-webkit-details-marker { display: none; }
.full-guide summary span { display: flex; flex-direction: column; }
.full-guide summary b { font-size: 1.05em; }
.full-guide summary small { margin-top: 3px; color: var(--c-text-muted); }
.full-guide summary i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--c-surface-2); font-style: normal; font-size: 1.4rem; transition: transform .18s; }
.full-guide[open] summary { border-bottom: 1px solid var(--c-border); }
.full-guide[open] summary i { transform: rotate(180deg); }

.article-body { padding: 38px clamp(22px, 6vw, 64px) 56px; font-size: var(--reader-size); line-height: 1.85; }
.article-body h2, .article-body h3, .article-body h4 { position: relative; scroll-margin-top: calc(var(--header-height) + 24px); color: var(--c-text); }
.article-body h2 { margin: 2.4em 0 .8em; font-size: 1.55em; line-height: 1.35; }
.article-body h3 { margin: 2em 0 .7em; font-size: 1.28em; line-height: 1.4; }
.article-body h4 { margin: 1.8em 0 .6em; font-size: 1.08em; line-height: 1.45; }
.article-body h2:first-child, .article-body h3:first-child { margin-top: 0; }
.article-body h2 > span, .article-body h3 > span, .article-body h4 > span { display: inline-flex; margin-right: .55em; color: var(--c-gold-2); font-size: .78em; font-weight: 800; }
.heading-link { margin-left: .45em; color: var(--c-text-muted); opacity: 0; text-decoration: none; }
.article-body h2:hover .heading-link, .article-body h3:hover .heading-link, .article-body h4:hover .heading-link, .heading-link:focus { opacity: .65; }
.article-body p { margin: .8em 0; color: color-mix(in srgb, var(--c-text) 91%, var(--c-text-muted)); }
.article-body strong { color: var(--c-text); }
.article-body a { color: color-mix(in srgb, var(--c-navy-2) 88%, var(--c-gold)); text-underline-offset: 3px; }
[data-theme="dark"] .article-body a { color: var(--c-gold); }
.article-body code { padding: .15em .42em; border: 1px solid var(--c-border); border-radius: 6px; background: var(--c-surface-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
.article-body ul, .article-body ol { padding-left: 1.35em; }
.article-body li { margin: .45em 0; padding-left: .25em; }

.collapsible-section {
  border-top: 1px solid var(--c-border);
}
.collapsible-section:first-child { border-top: 0; }
.collapsible-section > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 1.2em 0 .85em;
  cursor: pointer;
  list-style: none;
}
.collapsible-section > summary::-webkit-details-marker { display: none; }
.collapsible-section > summary h2 { margin: 0; }
.collapsible-section > summary:hover h2 { color: var(--c-navy-2); }
.section-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-text-muted);
}
.section-toggle i { font-size: 1.4em; font-style: normal; transition: transform .18s; }
.collapsible-section:not([open]) .section-toggle i { transform: rotate(-90deg); }
.collapsible-section-content { padding-bottom: 1.1em; }
.collapsible-section-content > :first-child { margin-top: .7em; }

.section-back-to-toc {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  margin: 1.35em 0 .35em;
  padding: 7px 14px 7px 8px;
  border: 1px solid color-mix(in srgb, var(--c-gold) 48%, var(--c-border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--c-gold) 9%, var(--c-surface));
  color: var(--c-text) !important;
  font-size: .74em;
  text-decoration: none;
}
.section-back-to-toc > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--step-number-bg);
  color: var(--step-number-text);
  font-weight: 900;
}
.section-back-to-toc:hover { border-color: var(--c-gold); background: color-mix(in srgb, var(--c-gold) 15%, var(--c-surface)); }

.back-to-toc {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  margin-top: 24px;
  padding: 12px 18px;
  border: 1px solid color-mix(in srgb, var(--c-gold) 50%, var(--c-border));
  border-radius: 14px;
  background: color-mix(in srgb, var(--c-gold) 9%, var(--c-surface));
  color: var(--c-text);
  text-align: left;
  text-decoration: none;
}
.back-to-toc > span:first-child { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c-navy); color: var(--c-gold); font-size: 1.15rem; font-weight: 900; }
.back-to-toc > span:last-child { display: flex; flex-direction: column; }
.back-to-toc small { color: var(--c-text-muted); font-size: .76em; }
.back-to-toc strong { margin-top: 2px; font-size: .98em; }
.back-to-toc:hover { border-color: var(--c-gold); background: color-mix(in srgb, var(--c-gold) 15%, var(--c-surface)); }
.back-to-toc:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-gold) 65%, transparent); outline-offset: 3px; }

.code-block { position: relative; margin: 1.2em 0; border-radius: 14px; background: #0b1622; color: #e6ecf3; overflow: hidden; }
.code-block > span { display: block; padding: 9px 14px; border-bottom: 1px solid #26384e; color: #93a4bb; font-size: .72em; }
.code-block pre { margin: 0; padding: 18px; overflow-x: auto; }
.code-block code { padding: 0; border: 0; background: transparent; color: inherit; }
.copy-code { position: absolute; top: 8px; right: 8px; min-height: 36px; padding: 0 11px; border: 1px solid #40546c; border-radius: 8px; background: #18283a; color: #e6ecf3; font-size: .75em; cursor: pointer; }

.lesson-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 30px; }
.pagination-link { display: flex; flex-direction: column; justify-content: center; min-height: 92px; padding: 16px 18px; border: 1px solid var(--c-border); border-radius: 14px; background: var(--c-surface); text-decoration: none; }
.pagination-link.next { text-align: right; }
.pagination-link span { color: var(--c-gold-2); font-size: .78em; font-weight: 800; }
.pagination-link strong { margin-top: 5px; line-height: 1.4; }
.pagination-link:hover { border-color: var(--c-gold); }

.drawer-backdrop { position: fixed; z-index: 299; inset: 0; background: rgba(4,12,22,.55); backdrop-filter: blur(2px); }
.chapter-drawer { position: fixed; z-index: 300; top: 0; bottom: 0; left: 0; width: min(88vw, 360px); padding: 22px 18px; background: var(--c-surface); transform: translateX(-105%); transition: transform .2s ease; overflow-y: auto; }
.chapter-drawer.is-open { transform: translateX(0); }
.drawer-header { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 18px; padding: 4px 4px 18px; border-bottom: 1px solid var(--c-border); }
.drawer-header h2 { margin: 4px 0 0; font-size: 1.35em; }
.drawer-header .icon-button { border-color: var(--c-border); background: var(--c-surface-2); color: var(--c-text); }

.search-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  margin: auto;
  padding: 26px;
  border: 1px solid var(--c-border);
  border-radius: 20px;
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: 0 26px 90px rgba(4,14,26,.32);
}
.search-dialog::backdrop { background: rgba(4,12,22,.62); backdrop-filter: blur(5px); }
.search-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.search-header h2 { margin: 4px 0 0; font-size: 1.45em; }
.search-header .icon-button { border-color: var(--c-border); background: var(--c-surface-2); color: var(--c-text); }
.search-field { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 9px; margin-top: 22px; padding: 0 14px; border: 2px solid var(--c-gold); border-radius: 13px; background: var(--c-bg); }
.search-field svg { width: 22px; height: 22px; fill: none; stroke: var(--c-text-muted); stroke-width: 1.8; stroke-linecap: round; }
.search-field input { width: 100%; min-height: 52px; border: 0; outline: 0; background: transparent; color: var(--c-text); }
.search-status { margin: 12px 2px; color: var(--c-text-muted); font-size: .86em; }
.search-results { display: grid; gap: 8px; max-height: 470px; overflow-y: auto; }
.search-results a { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; padding: 13px; border: 1px solid var(--c-border); border-radius: 11px; text-decoration: none; }
.search-results a:hover { border-color: var(--c-gold); background: var(--c-paper); }
.search-results span { grid-row: 1 / span 2; align-self: center; padding: 4px 8px; border-radius: 999px; background: var(--c-navy); color: var(--c-gold); font-size: .7em; font-weight: 800; }
.search-results strong { line-height: 1.4; }
.search-results small { color: var(--c-text-muted); }

.line-contact {
  position: fixed;
  z-index: 90;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 7px 13px 7px 9px;
  border: 1px solid color-mix(in srgb, #06c755 70%, #ffffff);
  border-radius: 999px;
  background: #06c755;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 61, 25, .25);
  font-family: var(--font-body);
  text-decoration: none;
  transition: transform .15s, box-shadow .15s;
}
.line-contact:hover { transform: translateY(-2px); box-shadow: 0 11px 30px rgba(0, 61, 25, .32); }
.line-contact svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.line-contact span { display: flex; flex-direction: column; line-height: 1.1; }
.line-contact small { font-size: 11px; opacity: .9; }
.line-contact strong { margin-top: 3px; font-family: var(--font-heading); font-size: 14px; }

@media (max-width: 1050px) {
  :root { --sidebar-width: 250px; }
  #app { width: min(100% - 38px, 960px); }
  .home-hero { grid-template-columns: 1fr 220px; gap: 30px; padding: 42px; }
  .hero-orbit { width: 210px; height: 210px; }
  .hero-orbit::after { inset: 58px; }
  .hero-orbit::before { inset: 26px; }
  .hero-orbit i:nth-of-type(1) { left: 99px; }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  :root { --header-height: 118px; }
  .site-header { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: 46px 48px; gap: 8px 10px; min-height: var(--header-height); padding: 8px 12px; }
  .menu-button { display: inline-grid; grid-column: 1; grid-row: 1; }
  .brand { grid-column: 2; grid-row: 1; justify-self: start; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-copy small { display: none; }
  .header-actions { grid-column: 3; grid-row: 1; }
  .header-search { grid-column: 1 / -1; grid-row: 2; }
  #search-button { display: none; }
  .sidebar { display: none; }
  .app-shell { display: block; }
  #app { width: min(100% - 30px, 760px); padding: 28px 0 68px; }
  .home-hero { grid-template-columns: 1fr; min-height: 0; padding: 34px; }
  .hero-orbit { display: none; }
  .hero-copy h1 { font-size: calc(var(--reader-size) * 2); }
  .chapter-section, .how-it-works { margin-top: 48px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 10px; }
  .chapter-grid { grid-template-columns: 1fr; }
  .three-steps { grid-template-columns: 1fr; }
  .resource-heading { display: block; }
  .resource-heading > p { margin-top: 9px; }
}

@media (max-width: 560px) {
  .site-header { gap: 7px; }
  .brand-copy strong { font-size: .96rem; }
  .brand-mark { display: none; }
  .header-actions { gap: 5px; }
  .font-controls { gap: 5px; }
  .font-controls button { width: 38px; height: 38px; }
  .icon-button { min-width: 42px; height: 42px; padding: 0 8px; }
  #app { width: min(100% - 22px, 520px); padding-top: 18px; }
  .home-hero { padding: 27px 22px; border-radius: 18px; }
  .hero-copy h1 { margin-top: 9px; }
  .hero-copy > p { font-size: 1em; }
  .hero-actions { display: grid; }
  .primary-button, .secondary-button { width: 100%; }
  .hero-points { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .chapter-card { grid-template-columns: 52px 1fr; min-height: 0; padding: 20px 17px; gap: 13px; }
  .chapter-card-icon { width: 50px; height: 50px; border-radius: 14px; }
  .chapter-card-icon svg { width: 26px; height: 26px; }
  .chapter-card h2 { font-size: 1.13em; }
  .chapter-card p { font-size: .88em; }
  .how-it-works { padding: 27px 20px; }
  .resource-links { padding: 23px 17px; border-radius: 17px; }
  .resource-grid { grid-template-columns: 1fr; }
  .resource-card { min-height: 0; }
  .lesson-identity { grid-template-columns: 60px 1fr; gap: 14px; }
  .lesson-icon { width: 58px; height: 58px; border-radius: 16px; }
  .lesson-icon svg { width: 29px; height: 29px; }
  .lesson-identity h1 { margin-top: 4px; font-size: 1.85em; }
  .lesson-identity p { grid-column: 1 / -1; }
  .quick-guide { padding: 24px 18px; border-radius: 17px; }
  .quick-steps li { grid-template-columns: 38px 1fr; padding-right: 10px; }
  .in-page-toc { padding: 18px 14px; }
  .in-page-toc > div { grid-template-columns: 1fr; }
  .full-guide summary { min-height: 76px; padding: 15px 16px; }
  .full-guide summary small { font-size: .74em; }
  .article-body { padding: 28px 18px 42px; line-height: 1.78; }
  .collapsible-section > summary { gap: 10px; }
  .section-back-to-toc { width: 100%; justify-content: center; }
  .heading-link { opacity: .45; }
  .lesson-pagination { grid-template-columns: 1fr; }
  .pagination-link.next { text-align: left; }
  .search-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); padding: 20px 16px; border-radius: 16px; }
  .search-header h2 { font-size: 1.2em; }
  .line-contact { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); min-height: 44px; padding: 6px 11px 6px 8px; }
  .line-contact svg { width: 26px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
