:root {
  color-scheme: light;
  --ink: #1e2929;
  --muted: #5c6964;
  --paper: #fffefa;
  --canvas: #f1f0e9;
  --line: #dedfd4;
  --green: #164e43;
  --green-dark: #103c34;
  --orange: #c8753c;
  --reader-size: 1.14rem;
  --shadow: 0 14px 46px rgba(32, 44, 39, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, "Segoe UI", Arial, sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--orange); }
.progress-track { position: fixed; z-index: 20; inset: 0 0 auto; height: 3px; background: transparent; }
.progress-bar { display: block; width: 0; height: 100%; background: var(--orange); }
.topbar { position: sticky; top: 3px; z-index: 15; background: rgba(255,254,250,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.topbar-inner { max-width: 1440px; min-height: 70px; padding: 0 34px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -.025em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--green); color: #fffefa; font-family: Georgia,serif; font-size: 21px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .14em; text-transform: uppercase; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.button { min-height: 42px; padding: 0 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.button:hover { border-color: #9fb5a8; color: var(--green); }
.button-primary { border-color: var(--green); background: var(--green); color: #fffefa; }
.button-primary:hover { background: var(--green-dark); color: #fffefa; }
.button-icon { width: 42px; padding: 0; font-size: 18px; }
.layout { width: min(1440px, 100%); margin: 0 auto; padding: 30px 34px 80px; display: grid; grid-template-columns: 250px minmax(0, 880px); justify-content: center; gap: 34px; align-items: start; }
.sidebar { position: sticky; top: 94px; max-height: calc(100vh - 118px); overflow: auto; padding: 19px 15px 20px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,254,250,.8); }
.sidebar-title { margin: 0 0 9px; padding: 0 8px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.toc-list { margin: 0; padding: 0; list-style: none; }
.toc-list li { margin: 2px 0; }
.toc-list a { display: block; padding: 7px 9px; border-radius: 6px; color: #46534e; font-size: 12px; line-height: 1.35; text-decoration: none; }
.toc-list a:hover, .toc-list a.active { background: #e9eee6; color: var(--green-dark); }
.mobile-toc { display: none; }
.content-column { min-width: 0; }
.hero { position: relative; isolation: isolate; overflow: hidden; min-height: 350px; padding: 50px 52px 44px; border: 1px solid #d8d9cc; border-radius: 15px; background: linear-gradient(118deg, #fffefa 0%, #f6f1e4 66%, #ecebdd 100%); box-shadow: var(--shadow); }
.hero:after { content: ""; position: absolute; z-index: -1; width: 330px; height: 330px; right: -16px; top: 10px; border: 1px solid rgba(22,78,67,.16); border-radius: 45% 55% 51% 49%; box-shadow: 0 0 0 22px rgba(22,78,67,.035), 0 0 0 48px rgba(22,78,67,.025); transform: rotate(-17deg); }
.eyebrow { margin: 0 0 17px; color: var(--orange); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { max-width: 650px; margin: 0; color: #183d35; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 5.4vw, 4rem); font-weight: 500; letter-spacing: -.045em; line-height: 1.06; }
.hero-deck { max-width: 570px; margin: 20px 0 0; color: #485952; font-family: Georgia,serif; font-size: clamp(1.12rem,2vw,1.36rem); line-height: 1.55; }
.hero-byline { margin: 19px 0 0; color: var(--muted); font-size: 13px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 27px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 27px; color: #69736b; font-size: 11px; font-weight: 700; }
.book-meta span:before { content: "✦"; margin-right: 7px; color: var(--orange); }
.reader-tools { position: sticky; top: 73px; z-index: 10; margin: 20px 0 0; padding: 10px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,254,250,.96); box-shadow: 0 6px 24px rgba(32,44,39,.05); }
.search-wrap { position: relative; flex: 1; }
.search-wrap input { width: 100%; height: 42px; padding: 0 15px 0 40px; border: 1px solid transparent; border-radius: 7px; outline: 0; background: #f3f2eb; color: var(--ink); font-size: 13px; }
.search-wrap input:focus { border-color: #9db6a8; background: white; box-shadow: 0 0 0 3px rgba(22,78,67,.08); }
.search-icon { position: absolute; top: 10px; left: 14px; color: #68776d; }
.tool-separator { width: 1px; height: 26px; background: var(--line); }
.tool-button { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #42554b; font-size: 14px; font-weight: 750; cursor: pointer; }
.tool-button:hover { background: #e9eee6; }
.search-results { position: absolute; z-index: 18; top: calc(100% + 9px); left: 0; right: 0; max-height: min(55vh, 480px); overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); box-shadow: 0 16px 42px rgba(25,43,35,.18); }
.search-results[hidden] { display: none; }
.search-result { display: block; padding: 11px 12px; border-radius: 7px; color: var(--ink); text-decoration: none; }
.search-result:hover { background: #f0f2ec; color: var(--ink); }
.search-result strong { display: block; margin-bottom: 4px; color: var(--green); font-size: 13px; }
.search-result span, .search-empty { color: var(--muted); font-size: 12px; line-height: 1.45; }
.search-empty { padding: 12px; }
.book-content { margin-top: 20px; padding: clamp(26px,5vw,64px); border: 1px solid var(--line); border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
.book-content h2, .book-content h3, .book-content h4 { scroll-margin-top: 116px; color: #183d35; font-family: Georgia,"Times New Roman",serif; font-weight: 500; line-height: 1.23; }
.book-content h2 { margin: 2.6em 0 .9em; padding-bottom: .45em; border-bottom: 1px solid var(--line); font-size: clamp(1.7rem,3.8vw,2.24rem); letter-spacing: -.027em; }
.book-content h2:first-child { margin-top: 0; }
.book-content h3 { margin: 2em 0 .65em; font-size: clamp(1.32rem,2.8vw,1.65rem); }
.book-content h4 { margin: 1.8em 0 .6em; font-family: Inter,"Segoe UI",Arial,sans-serif; font-size: 1rem; font-weight: 750; }
.book-content p, .book-content li { color: #303d38; font-family: Georgia,"Times New Roman",serif; font-size: var(--reader-size); line-height: 1.82; }
.book-content p { margin: 0 0 1.1em; }
.book-content ul, .book-content ol { padding-left: 1.45em; margin: .45em 0 1.4em; }
.book-content li { padding-left: .2em; margin: .36em 0; }
.book-content strong { color: #213c33; }
.book-content blockquote { margin: 1.5em 0; padding: 16px 20px; border-left: 3px solid var(--orange); border-radius: 0 7px 7px 0; background: #f6f3eb; }
.book-content blockquote p { margin: 0; color: #4e5b54; font-size: 1rem; }
.table-scroll { max-width: 100%; overflow-x: auto; margin: 1.5em 0 1.8em; border: 1px solid var(--line); border-radius: 8px; }
.book-content table { width: 100%; min-width: 560px; border-collapse: collapse; font-family: Inter,"Segoe UI",Arial,sans-serif; font-size: 13px; line-height: 1.55; }
.book-content th { background: #edf1e9; color: #183d35; text-align: left; font-size: 11px; letter-spacing: .045em; text-transform: uppercase; }
.book-content th, .book-content td { padding: 12px 13px; border-bottom: 1px solid #e4e5db; border-right: 1px solid #e4e5db; vertical-align: top; }
.book-content td { color: #3d4943; }
.book-content tr:last-child td { border-bottom: 0; }
.book-content th:last-child, .book-content td:last-child { border-right: 0; }
.book-content hr { height: 1px; margin: 2em 0; border: 0; background: var(--line); }
.book-content code { padding: .15em .38em; border-radius: 4px; background: #f0f1eb; font: .82em Consolas,monospace; }
.site-footer { max-width: 1000px; margin: 35px auto 0; padding: 26px 30px 10px; display: flex; justify-content: space-between; gap: 18px; color: #69736b; font-size: 12px; }
.site-footer a { color: #385f52; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
[data-theme="night"] { --ink: #e5ece7; --muted: #a9b9af; --paper: #1e2926; --canvas: #141c19; --line: #394740; --green: #90c7af; --green-dark: #abd8c5; --orange: #efaa70; --shadow: 0 14px 46px rgba(0,0,0,.2); }
[data-theme="night"] .topbar, [data-theme="night"] .sidebar, [data-theme="night"] .reader-tools { background: rgba(30,41,38,.96); }
[data-theme="night"] .brand, [data-theme="night"] .hero h1, [data-theme="night"] .book-content h2, [data-theme="night"] .book-content h3, [data-theme="night"] .book-content h4 { color: #c7e5d7; }
[data-theme="night"] .hero { background: linear-gradient(118deg,#222c28,#2c3027); border-color: var(--line); }
[data-theme="night"] .hero-deck, [data-theme="night"] .book-content p, [data-theme="night"] .book-content li, [data-theme="night"] .book-content td { color: #d4ddd7; }
[data-theme="night"] .book-content th { color: #d6eee2; background: #293b33; }
[data-theme="night"] .search-wrap input { color: var(--ink); background: #29342f; }

@media (max-width: 960px) {
  .topbar-inner { min-height: 64px; padding: 0 18px; }
  .layout { display: block; padding: 20px 18px 54px; }
  .sidebar { display: none; }
  .hero { min-height: 0; padding: 38px 30px; }
  .hero:after { right: -170px; top: -70px; }
  .mobile-toc { display: block; margin-top: 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
  .mobile-toc summary { padding: 13px 16px; color: var(--green); font-size: 13px; font-weight: 750; cursor: pointer; }
  .mobile-toc .toc-list { padding: 0 10px 12px; }
  .reader-tools { top: 67px; }
  .book-content { padding: 30px 28px; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand { gap: 8px; font-size: 13px; }
  .brand-mark { width: 33px; height: 33px; }
  .brand small { font-size: 8px; }
  .top-actions { gap: 5px; }
  .top-actions .button { min-height: 37px; padding: 0 9px; font-size: 11px; }
  .top-actions .button-icon { width: 36px; padding: 0; }
  .layout { padding: 12px 10px 36px; }
  .hero { padding: 30px 23px; border-radius: 10px; }
  .hero h1 { font-size: 2.55rem; }
  .hero-deck { font-size: 1.08rem; }
  .book-meta { gap: 10px 15px; }
  .reader-tools { padding: 7px; gap: 4px; }
  .tool-separator { display: none; }
  .tool-button { width: 32px; }
  .book-content { margin-top: 12px; padding: 25px 20px; border-radius: 9px; }
  .book-content p, .book-content li { line-height: 1.75; }
  .site-footer { padding: 20px 14px 4px; flex-direction: column; }
}
@media print {
  @page { size: A4; margin: 18mm 18mm 20mm; }
  body { background: white; color: #17212b; }
  .progress-track, .topbar, .sidebar, .mobile-toc, .reader-tools, .site-footer, .hero-actions { display: none !important; }
  .layout { display: block; width: auto; padding: 0; }
  .hero { min-height: 240mm; display: flex; flex-direction: column; justify-content: center; padding: 25mm 15mm; border: 0; border-radius: 0; background: #f6f3eb !important; box-shadow: none; break-after: page; }
  .hero:after { width: 250px; height: 250px; right: -20px; top: 20px; }
  .hero h1 { max-width: 145mm; font-size: 31pt; }
  .hero-deck { font-size: 17pt; }
  .book-content { margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .book-content h2 { break-before: page; font-size: 20pt; }
  .book-content h2:first-child { break-before: auto; }
  .book-content h3 { font-size: 15pt; }
  .book-content p, .book-content li { font-size: 11pt; line-height: 1.58; }
  .table-scroll { overflow: visible; break-inside: auto; }
  .book-content table { min-width: 0; font-size: 8pt; }
  .book-content th, .book-content td { padding: 5pt; }
  a { color: inherit; }
}
