:root {
  --canvas: #f6f8fb;
  --paper: #ffffff;
  --ink: #172033;
  --muted: #5e6b82;
  --line: #d7deea;
  --line-strong: #b9c4d6;
  --accent: #1559c5;
  --accent-dark: #0d3d91;
  --answer: #14765d;
  --answer-soft: #f2faf7;
  --warm: #b75d16;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.58;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 62px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { color: var(--ink); font-size: 1.02rem; font-weight: 800; text-decoration: none; }
.brand:hover { color: var(--ink); text-decoration: none; }

.header-link { font-size: 0.92rem; font-weight: 700; }

.page { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 56px; }

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.breadcrumbs span::after { content: "/"; margin-left: 7px; color: #98a3b7; }
.breadcrumbs span:last-child::after { content: ""; margin: 0; }

.hero { padding: 32px 0 30px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 9px; color: var(--warm); font-size: 0.82rem; font-weight: 800; text-transform: uppercase; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: 0; }
h1 { max-width: 920px; font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { margin-bottom: 12px; font-size: 1.45rem; }
h3 { margin-bottom: 8px; font-size: 1.08rem; }
p { margin: 0 0 12px; }
.lede { max-width: 800px; margin-top: 14px; color: var(--muted); font-size: 1.07rem; }

.meta-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill { border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: #35425b; padding: 5px 10px; font-size: 0.83rem; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 34px; margin-top: 30px; }
.main { display: grid; gap: 34px; min-width: 0; }
.section { padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.section:last-child { padding-bottom: 0; border-bottom: 0; }
.section-intro { max-width: 760px; color: var(--muted); }

.spec-list, .answer-list, .question-type-list { margin: 14px 0 0; padding-left: 22px; }
.spec-list li, .answer-list li, .question-type-list li { margin: 9px 0; }
.spec-list li::marker { color: var(--accent); font-weight: 700; }

.example { display: grid; gap: 14px; margin-top: 30px; }
.example:first-of-type { margin-top: 20px; }
.example-header { display: flex; justify-content: space-between; gap: 16px; align-items: start; }

.question-box { overflow: hidden; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--paper); }
.question-box-title { margin: 0; padding: 10px 15px; border-bottom: 1px solid var(--line); background: #eef2f8; color: #33415a; font-weight: 800; }
.question-html { padding: 18px; overflow-x: auto; }
.question-html > :last-child { margin-bottom: 0; }
.question-html table, .solution table { width: 100%; margin: 14px 0; border-collapse: collapse; }
.question-html th, .question-html td, .solution th, .solution td { border: 1px solid #cbd4e2; padding: 8px; text-align: left; vertical-align: top; }
.question-html img { display: block; max-width: min(100%, 720px); max-height: 620px; width: auto; height: auto; margin: 18px auto; border: 1px solid #e1e6ef; border-radius: 5px; background: #fff; }
.question-html .mcq, .question-html .options { display: grid; gap: 7px; margin: 12px 0; }
.question-html .option { padding: 5px 8px; border-bottom: 1px solid #edf0f5; }
.question-html .equation, .question-html .working { margin: 12px 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.05rem; }

.solution { border-left: 4px solid var(--answer); border-radius: 0 7px 7px 0; background: var(--answer-soft); padding: 17px 18px; }
.solution-section { margin-top: 18px; }
.solution-section:first-child { margin-top: 0; }
.solution-section-title { color: #105441; }
.solution-list, .solution-steps { margin: 8px 0 0; padding-left: 21px; }
.solution-item { margin: 6px 0; }
.solution svg { display: block; max-width: 100%; height: auto; margin: 12px auto; }
.working { overflow-x: auto; border-radius: 5px; background: #142033; color: #f7f9fc; padding: 12px; }

.sidebar { display: grid; gap: 20px; align-content: start; }
.panel { border-top: 3px solid var(--line-strong); padding-top: 14px; }
.panel h2 { font-size: 1.08rem; }
.toc { position: sticky; top: 18px; }
.toc ul, .topic-links { margin: 0; padding: 0; list-style: none; }
.toc li, .topic-links li { border-bottom: 1px solid #e5e9f0; }
.toc li:last-child, .topic-links li:last-child { border-bottom: 0; }
.toc a, .topic-links a { display: block; padding: 8px 0; font-size: 0.92rem; }

.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent); color: #fff; padding: 9px 14px; font-weight: 800; text-decoration: none; }
.button:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.button.secondary { background: #fff; color: var(--accent); }
.button.secondary:hover { background: #f4f7fc; color: var(--accent-dark); }

.subtopic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; border-top: 1px solid var(--line); }
.subtopic-card { display: block; min-width: 0; border-bottom: 1px solid var(--line); padding: 17px 18px 17px 0; color: var(--ink); text-decoration: none; }
.subtopic-card:nth-child(odd) { border-right: 1px solid var(--line); }
.subtopic-card:nth-child(even) { padding-left: 18px; }
.subtopic-card:hover { background: #f9fbfe; color: var(--ink); text-decoration: none; }
.subtopic-card strong { display: block; margin-bottom: 6px; color: var(--accent-dark); }
.subtopic-card span { display: -webkit-box; overflow: hidden; color: var(--muted); font-size: 0.92rem; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }

.related-topics { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.related-topics a { font-size: 0.92rem; }

@media (max-width: 880px) {
  .content-grid { grid-template-columns: 1fr; }
  .toc { position: static; }
  .sidebar { border-top: 1px solid var(--line); padding-top: 24px; }
}

@media (max-width: 620px) {
  .site-header-inner, .page { width: min(100% - 28px, 1180px); }
  .site-header-inner { min-height: 56px; }
  .hero { padding: 25px 0; }
  h1 { font-size: 1.85rem; }
  .content-grid { gap: 28px; margin-top: 25px; }
  .main { gap: 28px; }
  .question-html { padding: 14px; }
  .subtopic-grid { grid-template-columns: 1fr; }
  .subtopic-card:nth-child(odd) { border-right: 0; }
  .subtopic-card:nth-child(even) { padding-left: 0; }
  .button { width: 100%; }
}
