:root {
  color-scheme: light;
  font-family: "Aptos", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --ink: #202020;
  --muted: #555555;
  --bg: #f6f6f6;
  --paper: #fff;
  --rule: #dedede;
  --accent: #222222;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.6; }
a { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, summary:focus-visible { outline: 3px solid #242424; outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { line-height: 1.15; letter-spacing: -.045em; }
h1 { font-size: clamp(2.65rem, 7vw, 5rem); margin-bottom: .35em; }
.top { padding: 1rem max(5vw, 1.25rem); border-bottom: 1px solid var(--rule); background: var(--paper); }
.brand { display: inline-flex; gap: .65rem; align-items: center; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand-mark { width: 1rem; height: 1rem; border: 2px solid var(--accent); border-radius: 2px 5px 2px 5px; box-shadow: inset 0 0 0 2px white; background: var(--accent); }
.home, .simple { width: min(68rem, 90vw); margin: clamp(3rem, 10vh, 7rem) auto; }
.home-title { margin-bottom: 2.3rem; }
.subtitle { color: var(--muted); font-size: 1.1rem; }
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.35rem; }
.course-card { overflow: hidden; background: white; border: 1px solid var(--rule); border-radius: 1rem; color: var(--ink); text-decoration: none; transition: border-color .18s, transform .18s; }
.course-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.card-art { height: clamp(8.5rem, 21vw, 14rem); position: relative; overflow: hidden; isolation: isolate; background-size: 32px 32px; background-image: linear-gradient(to right, #ffffff26 1px, transparent 1px), linear-gradient(to bottom, #ffffff26 1px, transparent 1px); }
.econ-art { background-color: #404040; }
.econ-art span { position: absolute; left: 16%; top: 49%; width: 68%; height: 2px; background: #c8c8c8; transform: rotate(-20deg); }
.econ-art span:nth-child(2) { transform: rotate(20deg); background: #f9f9f9; }
.econ-art span:nth-child(3) { width: .8rem; height: .8rem; left: 50%; top: 49%; border-radius: 50%; transform: translate(-50%, -50%); }
.inference-art { display: flex; justify-content: center; align-items: end; padding-bottom: 16%; gap: 5%; background-color: #333; }
.inference-art span { width: 8%; height: 23%; background: #f4f4f4; border-radius: 2px 2px 0 0; }
.inference-art span:nth-child(2), .inference-art span:nth-child(4) { height: 45%; }
.inference-art span:nth-child(3) { height: 72%; }
.card-body { padding: 1.35rem 1.6rem 1.55rem; }
.card-body h2 { font-size: clamp(2.05rem, 4vw, 3.3rem); margin: .15em 0 .25em; }
.card-body p { margin-bottom: 0; color: var(--muted); }
.course-area { font-weight: 700; color: var(--accent); }
.econ .course-area { color: #333333; }
.back { display: inline-block; margin-bottom: 1rem; }
.study { width: min(78rem, 92vw); margin: 2.5rem auto 5rem; }
.study-heading { margin-bottom: 1.5rem; }
.study-heading h1 { font-size: clamp(2.7rem, 7vw, 4.3rem); }
.study-heading .subtitle { margin-bottom: 0; }
.study-grid { display: grid; grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.sidebar { position: sticky; top: 1rem; display: grid; gap: .65rem; }
.exam-link, .sidebar details, .study-content { border-radius: .9rem; border: 1px solid var(--rule); background: var(--paper); }
.exam-link { padding: 1rem 1.1rem; color: var(--ink); text-decoration: none; font-weight: 750; }
.exam-link:hover, .exam-link[aria-current] { background: #ececec; }
.sidebar summary { cursor: pointer; padding: 1rem 1.1rem; font-weight: 750; }
.sidebar details[open] summary { border-bottom: 1px solid var(--rule); }
.chapter-links { padding: .5rem; display: grid; gap: .15rem; }
.chapter-links a { display: grid; grid-template-columns: 3.1rem minmax(0, 1fr); align-items: baseline; gap: .35rem; padding: .48rem .52rem; border-radius: .4rem; color: var(--ink); text-decoration: none; }
.chapter-links a span:first-child { font-size: .875rem; color: var(--muted); font-weight: 650; }
.chapter-links a:hover, .chapter-links a[aria-current] { background: #ececec; color: #1c1c1c; }
.chapter-links a[aria-current] { font-weight: 750; }
.study-content { padding: clamp(1rem, 3.4vw, 2.65rem); }
.exam:not([hidden]) + .chapter:not([hidden]) { margin-top: 2rem; }
.exam h2, .chapter h2 { font-size: clamp(1.65rem, 4vw, 2.55rem); margin: 0 0 .45em; }
.exam p { margin-bottom: .6rem; }
.exam-format { display: flex; flex-wrap: wrap; gap: .45rem; padding: 0; list-style: none; margin: .75rem 0; }
.exam-format li { background: #eeeeee; border-radius: .35rem; padding: .3rem .65rem; }
.source { font-size: .9rem; }
.chapter + .chapter { margin-top: 2rem; }
.chapter-code { margin-bottom: .3rem; color: var(--accent); font-weight: 750; }
.chapter-title-en { color: var(--muted); margin-bottom: 1rem; }
.view-switch { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.15rem; }
.view-switch button { padding: .52rem .8rem; border-radius: .4rem; border: 1px solid var(--rule); background: white; color: var(--ink); font: inherit; font-weight: 680; cursor: pointer; }
.view-switch button[aria-pressed="true"] { background: #222; border-color: #222; color: white; }
.view-switch button:focus-visible { outline: 3px solid #242424; outline-offset: 3px; }
.study-topic { margin: 1rem 0 .45rem; }
.view-switch:not([hidden]) ~ .chapter-section > .study-topic { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.chapter-section h3 { font-size: 1.12rem; }
.chapter-section .points h4 { font-size: 1rem; margin: 0 0 .18rem; }
.chapter-section .points { margin-top: .55rem; }
.formula { display: block; overflow-x: auto; margin: .65rem 0; padding: .65rem .5rem; border: 1px solid #ececec; border-radius: .4rem; text-align: center; background: #fafafa; font-size: 1.12rem; }
.formula p { margin: 0; }
.study-diagram { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.study-diagram li { display: flex; align-items: center; gap: .45rem; }
.study-diagram li + li::before { content: "→"; color: #5b5b5b; }
.study-diagram span { padding: .25rem .65rem; border: 1px solid #bdbdbd; border-radius: .35rem; background: white; font-weight: 650; }
.points { padding-left: 1.55rem; margin: 1.2rem 0 0; }
.points li { padding: .55rem 0 .55rem .25rem; border-bottom: 1px solid #ededed; }
.points li::marker { color: var(--accent); font-weight: 750; }
.points li:last-child { border-bottom: 0; }
.points h3 { font-size: 1rem; margin: 0 0 .15rem; }
.points p { margin: 0; }
figure { margin: 1.2rem 0; background: #f5f5f5; border-radius: .7rem; padding: 1rem; }
figure:has(canvas[hidden]) { display: none; }
canvas { width: 100%; height: 235px; display: block; }
figcaption { color: var(--muted); font-size: .925rem; margin-top: .45rem; }
[hidden] { display: none !important; }
@media (max-width: 720px) {
  .study-grid { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
  .sidebar { position: static; }
  .chapter-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study { margin-top: 1.5rem; }
}
@media (max-width: 530px) {
  .course-grid { grid-template-columns: minmax(0, 1fr); }
  .home { margin-top: 2.65rem; }
}
@media (prefers-reduced-motion: reduce) {
  .course-card { transition: none; }
}
