:root {
  color-scheme: light;
  --ink: #16212f;
  --muted: #627184;
  --soft-ink: #344457;
  --line: #d9e2ec;
  --line-strong: #c6d3df;
  --paper: #f3f6fa;
  --panel: #fffdf9;
  --panel-cool: #f8fbff;
  --accent: #0f766e;
  --accent-ink: #0b5f59;
  --accent-soft: #e5f4f2;
  --mark: #fff5cc;
  --mark-line: #e5c453;
  --answer-bg: #e8f7ee;
  --answer-ink: #135c3a;
  --analysis-bg: #eef2ff;
  --analysis-ink: #37346f;
  --warn-bg: #fff4e5;
  --warn-ink: #814813;
  --shadow: 0 16px 40px rgba(22, 33, 47, .08);
  --radius: 8px;
  --radius-sm: 6px;
  --content-width: 900px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

::selection {
  background: rgba(15, 118, 110, .18);
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .34);
  outline-offset: 3px;
}

.hero,
.topbar {
  background: #12343b;
  color: #f8fbff;
}

.hero {
  padding: 42px min(7vw, 72px) 34px;
  border-bottom: 4px solid rgba(15, 118, 110, .42);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 24px min(5vw, 54px);
  border-bottom: 4px solid rgba(15, 118, 110, .42);
}

.top-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: var(--radius-sm);
  color: #f8fbff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.home-link:hover {
  background: rgba(255, 255, 255, .11);
  border-color: rgba(255, 255, 255, .74);
}

.home-link:active {
  transform: translateY(1px);
}

.course {
  margin-bottom: 4px;
  color: rgba(248, 251, 255, .78);
  font-size: 14px;
  font-weight: 700;
}

h1 {
  margin: 4px 0 8px;
  max-width: 22em;
  font-size: 32px;
  line-height: 1.22;
  letter-spacing: 0;
}

.hero p,
.topbar p {
  max-width: 68ch;
  margin: 0;
  color: rgba(248, 251, 255, .84);
  font-size: 16px;
  line-height: 1.72;
}

.index {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px min(5vw, 48px) 72px;
}

.intro {
  margin-bottom: 28px;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.intro p {
  max-width: 76ch;
}

.intro p:last-child {
  margin-top: 18px;
  color: var(--line-strong);
  font-size: 13px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(236px, 1fr));
  gap: 14px;
}

.grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(206px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 112px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(22, 33, 47, .05);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.card:hover {
  border-color: rgba(15, 118, 110, .62);
  box-shadow: 0 14px 30px rgba(22, 33, 47, .1);
  transform: translateY(-2px);
}

.card:active {
  transform: translateY(0);
}

.card.featured {
  border-color: rgba(15, 118, 110, .46);
  background: var(--accent-soft);
}

.card span {
  color: var(--ink);
  font-weight: 800;
  line-height: 1.45;
}

.card small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.layout {
  display: grid;
  grid-template-columns: minmax(238px, 300px) minmax(0, var(--content-width));
  gap: 22px;
  justify-content: center;
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px min(4vw, 46px) 76px;
}

.toc {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 12px;
  background: rgba(255, 253, 249, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(22, 33, 47, .06);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.toc-title {
  position: sticky;
  top: -12px;
  z-index: 1;
  margin: -12px -12px 8px;
  padding: 12px;
  background: rgba(255, 253, 249, .98);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.toc a,
.toc-empty {
  display: block;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.5;
}

.toc a:hover {
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.toc-section {
  margin-top: 8px;
  color: var(--ink) !important;
  font-weight: 900;
}

.toc-question {
  padding-left: 17px !important;
}

.content {
  min-width: 0;
  padding: 22px min(5vw, 46px) 46px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.content h2,
.index h2 {
  margin: 34px 0 14px;
  padding: 0 0 0 12px;
  border: 0;
  border-left: 4px solid var(--accent);
  color: var(--ink);
  font-size: 23px;
  line-height: 1.36;
  letter-spacing: 0;
}

.index h2 {
  margin-top: 30px;
}

.content h2:first-child,
.index h2:first-child {
  margin-top: 0;
}

.content h2[id] {
  scroll-margin-top: 22px;
}

.content h2:target {
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.content p,
.index p {
  max-width: 74ch;
  margin: 9px 0;
}

.label {
  margin-top: 22px !important;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}

.formula {
  max-width: 100% !important;
  overflow-x: auto;
  padding: 9px 12px;
  background: #f3f7fb;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  color: #203044;
  font-family: Consolas, "SFMono-Regular", "Microsoft YaHei UI", monospace;
  font-size: 15.5px;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.emphasis {
  max-width: 100% !important;
  padding: 10px 12px;
  background: var(--mark);
  border: 1px solid rgba(229, 196, 83, .64);
  border-left: 4px solid var(--mark-line);
  border-radius: var(--radius-sm);
  color: #59420b;
  font-weight: 700;
}

.figure-gallery {
  margin: 4px 0 28px;
}

.figure-gallery h2 {
  margin-top: 0;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.figure-grid figure {
  margin: 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(22, 33, 47, .05);
}

.figure-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f7fafc;
  border-bottom: 1px solid var(--line);
}

.figure-grid figcaption {
  min-height: 52px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.count-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 4px 0 12px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 900;
}

.question {
  margin: 16px 0;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 7px 20px rgba(22, 33, 47, .05);
  scroll-margin-top: 22px;
}

.question:target {
  border-color: rgba(15, 118, 110, .72);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, .12), 0 12px 28px rgba(22, 33, 47, .08);
}

.question-body {
  padding: 15px 16px 16px;
}

.question-title {
  max-width: none !important;
  margin: -15px -16px 13px !important;
  padding: 13px 16px;
  background: var(--panel-cool);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 900;
  line-height: 1.58;
}

.option {
  max-width: none !important;
  margin: 7px 0 !important;
  padding: 7px 10px 7px 14px;
  background: #fbfdff;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--soft-ink);
}

.answer-details {
  margin-top: 13px;
  border-top: 1px solid var(--line);
}

.answer-details summary {
  cursor: pointer;
  padding: 11px 0;
  color: var(--accent-ink);
  font-weight: 900;
  line-height: 1.55;
}

.answer-details summary:hover {
  color: var(--accent);
}

.answer-details[open] summary {
  margin-bottom: 8px;
}

.answer-panel {
  display: grid;
  gap: 8px;
  padding-bottom: 2px;
}

.qbank-object {
  display: inline-block;
  max-width: min(100%, 560px);
  max-height: 160px;
  margin: 3px 4px;
  padding: 3px;
  vertical-align: middle;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.missing-object {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 4px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-ink);
  border: 1px solid #ffd7a8;
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.answer,
.analysis,
.difficulty,
.knowledge {
  max-width: none !important;
  margin: 0 !important;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
}

.answer {
  background: var(--answer-bg);
  color: var(--answer-ink);
  border-left: 4px solid #2f9c61;
  font-weight: 900;
}

.analysis {
  background: var(--analysis-bg);
  color: var(--analysis-ink);
  border-left: 4px solid #6260b7;
}

.difficulty,
.knowledge {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-left: 4px solid #d98324;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

@media (min-width: 920px) {
  h1 {
    font-size: 40px;
  }
}

@media (max-width: 860px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding: 32px 18px 28px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 20px 18px;
  }

  .top-links {
    flex-direction: row;
    flex-wrap: wrap;
  }

  h1 {
    font-size: 29px;
  }

  .index,
  .layout {
    padding-right: 14px;
    padding-left: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .toc {
    position: static;
    max-height: min(420px, 44dvh);
  }

  .content {
    padding: 18px 16px 34px;
  }

  .content h2,
  .index h2 {
    font-size: 21px;
  }

  .grid,
  .grid.compact,
  .figure-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .home-link {
    width: 100%;
  }

  .card {
    min-height: auto;
  }

  .question-body {
    padding: 13px 13px 14px;
  }

  .question-title {
    margin: -13px -13px 12px !important;
    padding: 12px 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
    font-size: 12pt;
  }

  .hero,
  .topbar,
  .toc {
    box-shadow: none;
  }

  .layout,
  .index {
    display: block;
    max-width: none;
    padding: 0;
  }

  .content,
  .intro,
  .card,
  .question {
    box-shadow: none;
    break-inside: avoid;
  }
}
