:root {
  color-scheme: light;
  --bg: #fcfcfa;
  --surface: #fff;
  --text: #243041;
  --muted: #6c7784;
  --line: #e6e9e9;
  --soft: #f2f5f4;
  --accent: #246c59;
  --tint: #edf5f0;
  --code: #16232b;
  --code-text: #dce8ea;
  --body-size: 16px;
  --shadow: 0 24px 80px #10282026;
}
:root[data-font='small'] {
  --body-size: 15px;
}
:root[data-font='large'] {
  --body-size: 18px;
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #151b1c;
  --surface: #1b2325;
  --text: #e0e7e6;
  --muted: #99aaa8;
  --line: #303c3d;
  --soft: #222d2e;
  --accent: #91d5b4;
  --tint: #243b31;
  --code: #101719;
  --code-text: #dce8ea;
  --shadow: 0 24px 80px #0007;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #151b1c;
    --surface: #1b2325;
    --text: #e0e7e6;
    --muted: #99aaa8;
    --line: #303c3d;
    --soft: #222d2e;
    --accent: #91d5b4;
    --tint: #243b31;
    --code: #101719;
    --code-text: #dce8ea;
    --shadow: 0 24px 80px #0007;
  }
}
* {
  box-sizing: border-box;
}
html {
  scroll-padding-top: 100px;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    14px/1.65 -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    'PingFang SC',
    'Microsoft YaHei',
    sans-serif;
}
button,
input {
  font: inherit;
}
button,
a,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
}
.topbar {
  height: 76px;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  gap: 16px;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.5px;
}
.brand-icon {
  background: var(--accent);
  color: var(--bg);
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-size: 23px;
}
.brand-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  border-left: 1px solid var(--line);
  padding-left: 12px;
  margin-left: 4px;
  letter-spacing: 1px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: left;
}
.search-trigger > span {
  font-size: 22px;
  line-height: 1;
}
kbd {
  font-size: 10px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.icon-button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 11px;
  min-height: 38px;
  font-weight: 600;
}
.mobile-menu {
  display: none;
}
.layout {
  max-width: 1600px;
  margin: auto;
  display: grid;
  grid-template-columns: 262px minmax(0, 1fr) 224px;
}
.sidebar,
.toc-panel {
  position: sticky;
  top: 76px;
  height: calc(100dvh - 76px);
  overflow: auto;
  padding: 36px 24px;
}
.sidebar {
  border-right: 1px solid var(--line);
}
.sidebar-label {
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: 650;
  margin-bottom: 22px;
}
.chapter-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  margin: 5px -8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.chapter-number {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}
.chapter-link.active {
  background: var(--tint);
  color: var(--accent);
  font-weight: 650;
}
.chapter-link:hover {
  background: var(--soft);
  color: var(--text);
}
.chapter-check {
  margin-left: auto;
  color: var(--accent);
}
.learning-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 16px;
  margin-top: 36px;
  background: var(--surface);
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
}
.learning-card p {
  margin: 10px 0;
}
.learning-card strong {
  font-size: 24px;
  font-weight: 550;
  color: var(--accent);
}
progress {
  width: 100%;
  height: 5px;
  accent-color: var(--accent);
  display: block;
  margin: 12px 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--line);
}
progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 8px;
}
progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 8px;
}
.learning-card small,
.sidebar-footer {
  font-size: 11px;
  color: var(--muted);
}
.sidebar-footer {
  margin-top: 35px;
  line-height: 2;
}
.sidebar-footer span {
  opacity: 0.7;
}
.resume-link {
  font-size: 11px;
  color: var(--accent);
  padding: 8px 0;
  display: block;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.resume-link[hidden] {
  display: none;
}
main {
  padding: 48px clamp(28px, 4vw, 68px) 24px;
  min-width: 0;
  max-width: 1000px;
  width: 100%;
  margin: auto;
}
.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.pill {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--accent);
  background: var(--tint);
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
}
.prose {
  font-size: var(--body-size);
  line-height: 1.95;
  overflow-wrap: anywhere;
}
.prose h1 {
  font-size: clamp(28px, 2.7vw, 38px);
  font-weight: 720;
  line-height: 1.5;
  letter-spacing: -1px;
  margin: 0 0 30px;
  text-wrap: balance;
  color: var(--text);
}
.prose h2 {
  font-size: 1.4em;
  line-height: 1.6;
  margin: 52px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 680;
  letter-spacing: -0.4px;
}
.prose h3 {
  font-size: 1.13em;
  margin: 32px 0 14px;
  font-weight: 650;
}
.prose p {
  margin: 16px 0 22px;
}
.prose > p:first-of-type {
  color: var(--muted);
  font-size: 1.04em;
}
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent), transparent 65%);
  text-underline-offset: 4px;
}
.prose a:hover {
  text-decoration-color: var(--accent);
}
.prose strong {
  font-weight: 650;
}
.prose ul,
.prose ol {
  padding-left: 24px;
  margin: 18px 0 24px;
}
.prose li {
  padding-left: 4px;
  margin: 8px 0;
}
.prose li::marker {
  color: var(--accent);
}
.prose li p {
  margin: 8px 0;
}
.prose code {
  font:
    0.84em/1.6 'SFMono-Regular',
    Consolas,
    'Liberation Mono',
    monospace;
  background: var(--soft);
  padding: 3px 6px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
.code-block {
  margin: 24px 0 28px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--code);
  color: var(--code-text);
  border: 1px solid #ffffff12;
}
.code-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #ffffff16;
  font: 11px/1.5 monospace;
  color: #a6babd;
  letter-spacing: 0.5px;
}
.copy-code {
  font: 11px/1.5 inherit;
  color: #c5d6d8;
  background: transparent;
  border: 1px solid #ffffff30;
  border-radius: 4px;
  padding: 3px 8px;
}
.copy-code:hover {
  background: #ffffff12;
}
.code-block pre {
  overflow: auto;
  padding: 20px;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  tab-size: 2;
}
.prose pre code {
  padding: 0;
  background: none;
  font: inherit;
  color: inherit;
  white-space: pre;
  overflow-wrap: normal;
}
.table-scroll {
  overflow: auto;
  margin: 24px 0 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 0.85em;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  line-height: 1.8;
}
th {
  background: var(--soft);
  font-weight: 600;
  white-space: nowrap;
}
th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  min-width: 110px;
  vertical-align: top;
}
tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: var(--soft);
}
.prose blockquote {
  margin: 24px 0;
  padding: 4px 22px;
  border-left: 3px solid var(--accent);
  background: var(--tint);
  border-radius: 0 8px 8px 0;
}
.heading-anchor {
  font-size: 0.7em;
  margin-left: 10px;
  opacity: 0;
  text-decoration: none !important;
}
.prose h1:hover .heading-anchor,
.prose h2:hover .heading-anchor,
.prose h3:hover .heading-anchor,
.heading-anchor:focus-visible {
  opacity: 0.7;
}
.knowledge {
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin: 26px 0;
  background: var(--surface);
}
.knowledge summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.9em;
  padding: 16px 22px 16px 0;
  position: relative;
  font-weight: 600;
}
.knowledge summary::-webkit-details-marker {
  display: none;
}
.knowledge summary:after {
  content: '+';
  position: absolute;
  right: 0;
  color: var(--accent);
  font-size: 20px;
}
.knowledge[open] summary:after {
  content: '−';
}
.knowledge summary span {
  font-size: 10px;
  display: block;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 3px;
}
.knowledge[open] summary {
  border-bottom: 1px solid var(--line);
}
.knowledge > p {
  font-size: 0.95em;
}
.toc-panel {
  padding: 40px 24px 24px 12px;
  font-size: 12px;
}
.toc-panel nav {
  border-left: 1px solid var(--line);
}
.toc-link {
  display: block;
  color: var(--muted);
  padding: 7px 0 7px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  line-height: 1.6;
}
.toc-link.depth-3 {
  padding-left: 27px;
  font-size: 11px;
}
.toc-link.active {
  border-left-color: var(--accent);
  color: var(--accent);
}
.toc-link:hover {
  color: var(--text);
}
.back-top {
  display: inline-block;
  color: var(--muted);
  margin-top: 28px;
  font-size: 11px;
}
.finish-card {
  margin: 48px 0 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  background: var(--tint);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.finish-card strong {
  font-size: 15px;
}
.finish-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0;
}
.primary-button {
  background: var(--accent);
  color: var(--bg);
  border: 0;
  padding: 11px 16px;
  border-radius: 7px;
  font-size: 12px;
  display: inline-block;
  font-weight: 600;
  white-space: nowrap;
}
.primary-button:hover {
  filter: brightness(1.1);
}
.start-button {
  margin: 25px 0;
}
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}
.pager a {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.pager a:last-child {
  text-align: right;
}
.pager a:hover {
  border-color: var(--accent);
}
.pager small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 8px;
}
.pager strong {
  font-size: 14px;
  font-weight: 600;
}
.article-footer {
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.6px;
  border-top: 1px solid var(--line);
  padding: 24px 0 10px;
  margin-top: 48px;
}
.skip-link {
  position: fixed;
  top: -100px;
  left: 20px;
  z-index: 100;
  background: var(--accent);
  color: var(--bg);
  padding: 12px;
}
.skip-link:focus {
  top: 10px;
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  padding: 24px;
  width: min(640px, calc(100% - 32px));
  max-height: 80dvh;
  margin: 12dvh auto 0;
  overflow: auto;
}
dialog::backdrop {
  background: #101e2866;
  backdrop-filter: blur(4px);
}
body:has(dialog[open]) {
  overflow: hidden;
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 15px;
}
.dialog-heading h2 {
  margin: 0;
  font-size: 18px;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
.search-field span {
  font-size: 26px;
}
.search-field input {
  width: 100%;
  background: none;
  border: 0;
  color: var(--text);
  outline-offset: 8px;
  min-width: 0;
}
#search-status {
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0;
}
#search-results {
  max-height: 44dvh;
  overflow: auto;
}
.search-result {
  display: block;
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
}
.search-result:hover,
.search-result.selected {
  background: var(--tint);
  border-color: var(--line);
}
.search-result small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}
.search-result strong {
  font-size: 14px;
  display: block;
}
.search-result p {
  font-size: 12px;
  color: var(--muted);
  margin: 5px 0 0;
  line-height: 1.7;
}
mark {
  background: #ffe3a0;
  color: #383222;
  border-radius: 2px;
  padding: 0 1px;
}
.dialog-footer {
  font-size: 10px;
  color: var(--muted);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#settings-dialog {
  max-width: 420px;
}
fieldset {
  padding: 0;
  border: 0;
  margin: 24px 0;
}
legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}
.setting-options {
  display: flex;
  gap: 8px;
}
.setting-options button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  border-radius: 7px;
  font-size: 12px;
}
.setting-options button[aria-pressed='true'] {
  background: var(--tint);
  color: var(--accent);
  border-color: var(--accent);
}
.settings-preview {
  font-size: var(--body-size);
  padding: 18px;
  background: var(--soft);
  border-radius: 8px;
  line-height: 1.9;
}
.muted,
#settings-status {
  color: var(--muted);
  font-size: 12px;
}
.text-button {
  border: 0;
  background: none;
  color: var(--accent);
  padding: 8px 0;
  font-size: 12px;
}
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 10px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 8px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: 0.15s;
  max-width: 90vw;
  font-size: 13px;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
@media (min-width: 1600px) {
  .layout {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 235px minmax(0, 1fr);
  }
  .toc-panel {
    display: none;
  }
  main {
    max-width: 850px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 64px;
    padding: 0 18px;
  }
  .brand {
    font-size: 17px;
  }
  .brand-sub {
    display: none;
  }
  .top-actions {
    gap: 8px;
  }
  .search-trigger {
    min-width: 0;
    font-size: 0;
    padding: 5px 10px;
  }
  .search-trigger > span {
    font-size: 24px;
  }
  .search-trigger kbd {
    display: none;
  }
  .mobile-menu {
    display: inline-block;
  }
  .layout {
    display: block;
  }
  .sidebar {
    display: none;
  }
  main {
    padding: 30px 22px 18px;
  }
  .prose h1 {
    font-size: 29px;
  }
  .prose h2 {
    margin-top: 38px;
  }
  .prose {
    line-height: 1.9;
  }
  .finish-card {
    flex-direction: column;
    align-items: stretch;
  }
  .finish-card button {
    width: 100%;
  }
  .pager {
    gap: 10px;
  }
  .pager a {
    padding: 15px;
  }
  .pager strong {
    font-size: 12px;
  }
  .article-meta {
    font-size: 10px;
    gap: 10px;
  }
  .code-block pre {
    font-size: 12px;
    padding: 16px;
  }
  .article-footer {
    letter-spacing: 0.5px;
    font-size: 8px;
  }
  dialog {
    padding: 20px;
    margin-top: 8dvh;
  }
  #menu-dialog .chapter-link {
    font-size: 15px;
    padding: 15px;
  }
  .heading-anchor {
    opacity: 0.4;
  }
  html {
    scroll-padding-top: 85px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
@media print {
  .topbar,
  .sidebar,
  .toc-panel,
  .finish-card,
  .pager,
  .copy-code,
  .article-footer,
  dialog {
    display: none !important;
  }
  .layout {
    display: block;
  }
  main {
    max-width: none;
    padding: 0;
  }
  .prose {
    font-size: 11pt;
  }
  .code-block {
    break-inside: avoid;
  }
  .knowledge {
    display: block;
  }
  .knowledge::details-content {
    content-visibility: visible;
  }
  body {
    background: white;
    color: black;
  }
}
.inline-toc {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 28px;
  font-size: 12px;
}
.inline-toc summary {
  cursor: pointer;
  padding: 12px 16px;
  color: var(--accent);
  font-weight: 600;
}
.inline-toc summary span {
  float: right;
  font-size: 10px;
  color: var(--muted);
  font-weight: 400;
}
.inline-toc nav {
  padding: 0 16px 14px;
}
.inline-toc .toc-link {
  border-left: 1px solid var(--line);
}
@media (max-width: 1200px) {
  .inline-toc {
    display: block;
  }
}
@media print {
  .inline-toc {
    display: none;
  }
}

.chapter-group-label {
  margin: 24px 0 10px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.6px;
}
