:root {
  --ink: #292538;
  --muted: #655e72;
  --accent: #60428c;
  --wash: #f6f4f9;
  --line: #e3dfe9;
  --night: #34294c;
  --mono: 'IBM Plex Mono', Consolas, monospace;
  font: 16px/1.75 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; cursor: pointer; color: var(--ink); }
a { color: var(--accent); text-underline-offset: .2em; }
:focus-visible { outline: 3px solid #8c55bf; outline-offset: 3px; }
.skip { position: fixed; left: 12px; top: -80px; padding: 10px 16px; background: white; z-index: 5; }
.skip:focus { top: 10px; }
header { height: 70px; padding: 0 clamp(22px, 4vw, 76px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: white; }
.brand, .official { display: inline-flex; align-items: center; text-decoration: none; }
.brand { gap: 10px; font-weight: 750; font-size: 19px; color: var(--ink); }
.brand span { border-left: 1px solid var(--line); padding-left: 12px; margin-left: 2px; font-weight: 500; font-size: 15px; color: var(--muted); }
.book { width: 31px; height: 27px; display: inline-block; position: relative; }
.book::before, .book::after { content: ''; position: absolute; top: 3px; width: 14px; height: 21px; border-radius: 1px 7px 1px 1px; background: var(--accent); transform: skewY(15deg); }
.book::after { right: 0; transform: scaleX(-1) skewY(15deg); background: #9673b0; }
.official { gap: 6px; font-size: 14px; color: var(--muted); }
.official:hover { color: var(--accent); text-decoration: underline; }
.layout { display: grid; grid-template-columns: clamp(240px, 22vw, 314px) minmax(0,1fr); min-height: calc(100vh - 70px); }
aside { position: sticky; top: 0; align-self: start; height: 100vh; overflow: auto; background: var(--wash); border-right: 1px solid var(--line); padding: 30px clamp(15px, 2vw, 32px); }
.nav-head, .folio { display: flex; align-items: center; justify-content: space-between; }
.nav-head { font-size: 14px; font-weight: 650; padding: 0 8px 18px; color: var(--muted); }
.version, .progress, summary small, .edition { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.version { font-size: 11px; font-weight: 500; }
.mobile-toggle { display: none; }
summary { display: flex; align-items: center; min-height: 45px; gap: 11px; padding: 7px 8px; cursor: pointer; font-size: 15px; font-weight: 650; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before { content: ''; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(-45deg); }
details[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
summary small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
aside ul { list-style: none; margin: 0 0 8px 10px; padding: 0 0 0 8px; border-left: 1px solid #d9d2e2; }
aside li a { display: block; padding: 7px 10px; color: var(--muted); line-height: 1.55; font-size: 14px; text-decoration: none; border-radius: 4px; }
aside a:hover, summary:hover { background: #ede9f2; }
aside a[aria-current] { background: #e7dff2; color: #4c316f; font-weight: 700; box-shadow: inset 3px 0 #745499; }
main { width: 100%; max-width: 1020px; margin-inline: auto; padding: 36px clamp(22px, 5.5vw, 88px) 72px; min-width: 0; overflow-wrap: anywhere; }
.folio { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.progress { font-size: 12px; letter-spacing: .05em; }
.lesson { display: flow-root; scroll-margin-top: 18px; }
.lesson + .lesson { border-top: 1px solid var(--line); margin-top: 42px; padding-top: 28px; }
h1, h2, h3 { line-height: 1.35; }
h2, h3 { font-size: 23px; margin: 36px 0 16px; }
h1, .lesson-title { margin: 12px 0 25px; font-size: clamp(29px, 3.4vw, 46px); letter-spacing: -.035em; }
article p { margin: 14px 0; }
.cover { position: relative; isolation: isolate; overflow: hidden; color: white; background: var(--night); padding: clamp(24px, 3vw, 42px); border-radius: 9px; margin-bottom: 24px; }
.cover::before, .cover::after { position: absolute; content: ''; z-index: -1; width: 42%; height: 140%; right: -12%; bottom: -73%; transform: rotate(-32deg); border-radius: 18%; background: #594371; box-shadow: 12px -12px 0 #725789, 24px -24px 0 #9275a7; }
.cover::after { right: -22%; bottom: -58%; transform: rotate(32deg); background: #4b385f; box-shadow: 10px -10px 0 #67507d, 20px -20px 0 #846699; }
.edition { font-size: 13px; color: #e6d9f1; }
.cover h1 { font-family: 'STIX Two Text', 'Songti SC', SimSun, serif; font-size: clamp(32px, 3.8vw, 53px); margin: 12px 0 8px; }
.cover p { color: #eee4f4; font-size: 15px; margin: 0; }
article ol { list-style: decimal-leading-zero; padding-left: 2.5em; }
article li { padding: 6px 0 10px 8px; }
article li::marker { font: 600 14px var(--mono); color: var(--accent); }
article li strong { font-size: 17px; }
article blockquote { border-left: 3px solid #9273af; background: var(--wash); margin: 24px 0; padding: 12px 19px; }
article blockquote p { margin: 0; }
article img { max-width: 100%; height: auto; }
article figure { margin: 16px 0; }
figure > a { display: block; position: relative; border: 1px solid var(--line); padding: 5px; border-radius: 7px; cursor: zoom-in; }
figure img { display: block; margin-inline: auto; }
.zoom { position: absolute; right: 8px; bottom: 8px; padding: 3px 9px; color: white; background: var(--night); border-radius: 4px; font-size: 12px; }
figcaption { color: var(--muted); font-size: 13px; margin-top: 9px; }
article table { width: 100%; border-collapse: collapse; margin: 20px 0; }
td, th { padding: 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: var(--wash); }
td:first-child { width: 30%; }
pre { background: var(--wash); border-radius: 5px; padding: 16px; overflow: auto; }
code { font-family: var(--mono); }
@media (max-width: 760px) {
  header { height: 58px; }
  .layout { display: block; }
  aside { height: auto; overflow: visible; border: 0; border-bottom: 1px solid var(--line); padding: 0 19px; z-index: 2; }
  .nav-head { display: none; }
  .mobile-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent; min-height: 46px; font-weight: 650; text-align: left; }
  .mobile-toggle[aria-expanded=true] span { transform: rotate(180deg); }
  #mobile-chapter { margin: 0 10px 0 auto; font-size: 13px; font-weight: 500; color: var(--muted); }
  #chapters { position: absolute; inset: 100% 0 auto; max-height: min(65vh, calc(100dvh - 58px)); overflow: auto; overscroll-behavior: contain; padding: 4px 19px 10px; background: var(--wash); border-bottom: 1px solid var(--line); }
  .lesson { scroll-margin-top: 54px; }
  main { padding: 24px 19px 48px; }
  h2:not(.lesson-title), h3 { font-size: 21px; }
  .cover::before, .cover::after { opacity: .5; }
  td, th { font-size: 14px; padding: 8px; }
}
