:root {
  --paper: #fffdf7;
  --paper-2: #f7f1e6;
  --ink: #25211c;
  --muted: #6f675c;
  --line: #e6d9c8;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #16803c;
  --green-soft: #eaf8ee;
  --red: #c24132;
  --red-soft: #fff0ed;
  --yellow: #9a6a00;
  --yellow-soft: #fff6d8;
  --purple: #6d43b8;
  --purple-soft: #f3edff;
  --code-bg: #f4f7fb;
  --code-line: #dbe5f2;
  --shadow: 0 18px 48px rgba(73, 55, 30, 0.12);
  --radius: 18px;
  --max: 1120px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.12), transparent 34rem),
    linear-gradient(180deg, #fffaf0 0%, var(--paper) 36%, #f8efe1 100%);
  font-family: var(--sans);
  line-height: 1.75;
  max-width: 100%;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.site-shell {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  max-width: 100%;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(255, 253, 247, 0.84);
  border-bottom: 1px solid rgba(230, 217, 200, 0.8);
}

.topbar-inner {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--ink);
  color: #fffaf0;
  box-shadow: 0 10px 24px rgba(37, 33, 28, 0.18);
}

.brand small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.74rem;
  margin-top: -4px;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
}

.nav a[aria-current="page"],
.nav a:hover {
  color: var(--ink);
  background: var(--yellow-soft);
  border-color: #e7c366;
}

.hero {
  padding: 56px 0 30px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 28px;
  align-items: stretch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #174ea6;
  font-weight: 900;
  font-size: 0.88rem;
}

h1,
h2,
h3 {
  line-height: 1.18;
  margin: 0;
  letter-spacing: 0;
}

h1 {
  margin-top: 18px;
  max-width: 800px;
  font-size: clamp(2.35rem, 6vw, 5.2rem);
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
}

h3 {
  font-size: 1.28rem;
}

p {
  margin: 0;
}

.lead {
  max-width: 760px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 1.12rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fffdf7;
  text-decoration: none;
  font-weight: 900;
}

.button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.exam-card,
.panel,
.mini-card,
.question-card,
.flow-card {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.exam-card {
  padding: 22px;
}

.exam-card h2 {
  font-size: 1.25rem;
}

.exam-card ul {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.exam-card li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  background: var(--blue);
}

.badge.red { background: var(--red); }
.badge.green { background: var(--green); }
.badge.yellow { background: var(--yellow); }
.badge.purple { background: var(--purple); }

.section {
  padding: 34px 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head p {
  color: var(--muted);
  max-width: 620px;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mini-card,
.panel {
  padding: 20px;
}

.mini-card h3,
.panel h3 {
  margin-bottom: 10px;
}

.mini-card p,
.panel p,
.mini-card li,
.panel li {
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
}

.tag.hot {
  background: var(--red-soft);
  color: var(--red);
}

.tag.pass {
  background: var(--green-soft);
  color: var(--green);
}

.callout {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--yellow-soft);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.callout.blue { background: var(--blue-soft); }
.callout.green { background: var(--green-soft); }
.callout.red { background: var(--red-soft); }
.callout.purple { background: var(--purple-soft); }

.callout strong {
  display: block;
  margin-bottom: 6px;
}

.map {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.map a,
.map span {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  text-decoration: none;
  font-weight: 900;
}

.map .now {
  background: var(--blue-soft);
  color: var(--blue);
  border-color: #a8c2ff;
}

.chapter-hero {
  padding: 44px 0 20px;
}

.chapter-hero h1 {
  font-size: clamp(2rem, 4.6vw, 4rem);
}

.study-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 20px;
  align-items: start;
}

.sticky-note {
  position: sticky;
  top: 92px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid #e3c66d;
  background: #fff8d7;
  box-shadow: var(--shadow);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sticky-note h3 {
  margin-bottom: 10px;
}

.sticky-note ol {
  padding-left: 22px;
  margin: 8px 0 0;
}

.question-card {
  padding: 22px;
  margin-bottom: 18px;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.question-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
}

.question-title h2 {
  flex: 1 1 320px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 900;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 0.84rem;
  flex: 0 0 auto;
}

.pill.red { background: var(--red-soft); color: var(--red); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.yellow { background: var(--yellow-soft); color: var(--yellow); }

pre {
  margin: 14px 0;
  padding: 16px;
  overflow: auto;
  max-width: 100%;
  width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  color: #1f2937;
  font-family: var(--mono);
  font-size: 0.92rem;
  line-height: 1.58;
}

code {
  font-family: var(--mono);
}

:not(pre) > code {
  padding: 2px 6px;
  border-radius: 7px;
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  color: #1f3a5f;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.answer-box {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  margin: 16px 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid #c9dfcd;
  background: var(--green-soft);
  max-width: 100%;
  min-width: 0;
}

.answer-box .label {
  display: grid;
  place-items: center;
  padding: 14px;
  background: var(--green);
  color: #fff;
  font-weight: 900;
}

.answer-box .content {
  padding: 14px 16px;
}

.two-col-code {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.two-col-code > * {
  min-width: 0;
}

.translation {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.translation h4 {
  margin: 0 0 8px;
}

.translation ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.output-table td:nth-child(3) {
  min-width: 120px;
}

.output-line {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 9px;
  background: var(--code-bg);
  border: 1px solid var(--code-line);
  color: #1f3a5f;
  font-family: var(--mono);
  font-weight: 800;
  white-space: nowrap;
}

.output-line.no-output {
  color: var(--muted);
  background: var(--paper-2);
}

.change-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  background: var(--paper-2);
  font-weight: 900;
}

tr:last-child td {
  border-bottom: 0;
}

.mindmap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.mindmap .node {
  padding: 16px;
  border-radius: 18px;
  border: 2px solid var(--line);
  background: #fff;
}

.mindmap .center {
  grid-column: 1 / -1;
  text-align: center;
  background: var(--ink);
  color: #fffdf7;
  border-color: var(--ink);
  font-size: 1.15rem;
  font-weight: 900;
}

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.flow-card {
  padding: 16px;
  min-height: 150px;
}

.flow-card .num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  margin-bottom: 10px;
}

.do-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.do-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.do-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.do-item h3 {
  margin-bottom: 4px;
  font-size: 1.05rem;
}

.do-item p {
  color: var(--muted);
}

.exam-script {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.script-line {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--code-line);
  background: var(--code-bg);
}

.script-line strong {
  color: var(--blue);
}

.rule-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.rule-item {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.rule-item strong {
  color: var(--blue);
}

.question-bank {
  display: grid;
  gap: 14px;
}

.qa-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #fff;
}

.qa-card h3 {
  margin-bottom: 10px;
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 900;
}

.wrong-list {
  margin: 10px 0 0;
  padding-left: 22px;
  color: var(--muted);
}

.question-stem {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-weight: 800;
}

.options {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.choice {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.choice .letter {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--muted);
  font-weight: 900;
}

.choice.correct {
  border-color: #a9d9b5;
  background: var(--green-soft);
}

.choice.correct .letter {
  background: var(--green);
  color: #fff;
}

.choice.wrong {
  background: #fff;
}

.answer-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.explain-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.explain-box {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.explain-box strong {
  display: block;
  margin-bottom: 4px;
}

.syntax-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.syntax-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--blue-soft);
  border: 1px solid #c8d8ff;
}

.change-table td:first-child {
  font-weight: 900;
  color: var(--blue);
}

.template-note {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 12px 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.template-note strong {
  color: var(--red);
}

.footer {
  padding: 44px 0 56px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 0;
  }

  .hero-grid,
  .grid-2,
  .grid-3,
  .study-layout,
  .two-col-code,
  .flow,
  .mindmap {
    grid-template-columns: 1fr;
  }

  .sticky-note {
    position: static;
    order: -1;
  }

  .map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
