:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #657083;
  --line: #dfe5ee;
  --line-strong: #cbd5e1;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --green: #16803c;
  --green-soft: #ecfdf3;
  --orange: #b45309;
  --orange-soft: #fff7ed;
  --purple: #6d28d9;
  --purple-soft: #f5f3ff;
  --red: #c2410c;
  --shadow: 0 10px 30px rgba(23, 32, 51, .06);
  --radius: 16px;
  --shell: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { color: inherit; }
.shell { width: min(calc(100% - 32px), var(--shell)); margin-inline: auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 246, 249, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(203, 213, 225, .72);
}
.nav-row { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: white; background: var(--ink); border-radius: 11px;
  font-family: Georgia, serif; font-weight: 800; font-size: 22px;
}
.brand strong, .brand small { display: block; line-height: 1.2; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .04em; }
.top-nav { display: flex; align-items: center; gap: 6px; }
.top-nav a { padding: 8px 11px; border-radius: 9px; color: var(--muted); font-size: 14px; }
.top-nav a:hover, .top-nav a.active { color: var(--ink); background: var(--surface); }

.hero { padding: 64px 0 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: end; }
.eyebrow, .section-kicker {
  margin: 0 0 8px; color: var(--blue); font-size: 12px; font-weight: 800; letter-spacing: .14em;
}
.hero h1 { max-width: 760px; margin: 0; font-size: clamp(32px, 4vw, 54px); line-height: 1.12; letter-spacing: -.035em; }
.hero-copy { max-width: 720px; margin: 20px 0 0; color: var(--muted); font-size: 17px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); gap: 10px; }
.stat { min-width: 92px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.stat strong, .stat span { display: block; }
.stat strong { font-size: 28px; line-height: 1; }
.stat span { margin-top: 7px; color: var(--muted); font-size: 12px; }

.catalog { padding: 20px 0 70px; }
.catalog-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.catalog-head h2 { margin: 0; font-size: 27px; }
.catalog-tools { min-width: min(100%, 360px); }
.search-box { display: flex; align-items: center; gap: 8px; padding: 0 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; }
.search-box:focus-within { border-color: #93b4ff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .08); }
.search-box span { color: var(--muted); font-size: 19px; }
.search-box input { width: 100%; height: 44px; border: 0; outline: 0; background: transparent; color: var(--ink); }
.filter-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 18px; }
.filter-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 11px; cursor: pointer; color: var(--muted); font-size: 13px; }
.filter-chip:hover, .filter-chip.active { border-color: #9db8ff; color: var(--blue); background: var(--blue-soft); }
.problem-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.problem-card {
  position: relative; display: flex; flex-direction: column; min-height: 230px; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.problem-card:hover { transform: translateY(-2px); border-color: #b7c8e8; box-shadow: 0 14px 36px rgba(23, 32, 51, .09); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.problem-code { font-size: 12px; font-weight: 800; letter-spacing: .1em; color: var(--blue); }
.mastery-dot { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.mastery-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.mastery-dot.done { color: var(--green); }
.mastery-dot.done::before { background: #22c55e; }
.problem-card h3 { margin: 16px 0 9px; font-size: 22px; line-height: 1.35; }
.problem-card p { margin: 0; color: var(--muted); font-size: 14px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 18px; }
.tag { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 8px; border-radius: 7px; background: var(--surface-soft); border: 1px solid var(--line); color: #526076; font-size: 12px; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; margin-top: 14px; border-top: 1px solid #edf0f5; color: var(--muted); font-size: 12px; }
.empty-state { padding: 40px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.problem-shell { padding: 38px 0 72px; }
.loading-card, .error-card { padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.error-card h1 { margin-top: 0; }
.problem-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; align-items: start; margin-bottom: 18px; }
.problem-heading { min-width: 0; }
.problem-heading h1 { margin: 8px 0 10px; font-size: clamp(30px, 4vw, 46px); line-height: 1.16; letter-spacing: -.025em; }
.problem-subline { color: var(--muted); }
.problem-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 8px 13px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); cursor: pointer; font-weight: 700; font-size: 14px;
}
.btn:hover { background: var(--surface-soft); }
.btn.primary { color: white; background: var(--ink); border-color: var(--ink); }
.btn.primary:hover { background: #273247; }
.btn.mastered { color: var(--green); background: var(--green-soft); border-color: #a7e7bb; }
.problem-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stack { display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-inner { padding: 23px; }
.panel-title { margin: 0 0 12px; font-size: 18px; }
.statement { font-size: 17px; }
.statement p { margin: 0 0 12px; }
.goal { margin-top: 14px; padding: 12px 14px; background: var(--green-soft); border: 1px solid #bde9ca; border-radius: 10px; }
.figure-wrap { padding: 14px; }
.figure-link { display: block; border-radius: 12px; overflow: hidden; }
.figure-link:hover img { opacity: .97; }
.figure-wrap img { display: block; width: 100%; height: auto; border-radius: 12px; background: white; }
.figure-zoom-hint { white-space: nowrap; }
.figure-caption { padding: 0 16px 14px; color: var(--muted); font-size: 12px; text-align: center; }
.side-card { padding: 18px; }
.meta-list { display: grid; gap: 12px; }
.meta-item { display: grid; gap: 3px; }
.meta-item span:first-child { color: var(--muted); font-size: 12px; }
.meta-item strong { font-size: 14px; }
.solution-switch { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 13px; }
.solution-tab { flex: 1 1 200px; min-height: 48px; padding: 8px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.solution-tab strong, .solution-tab span { display: block; }
.solution-tab span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.solution-tab.active { background: var(--surface); border-color: var(--line); box-shadow: 0 4px 14px rgba(23,32,51,.06); }
.solution-head { display: flex; align-items: start; justify-content: space-between; gap: 18px; padding: 24px 24px 18px; border-bottom: 1px solid var(--line); }
.solution-head h2 { margin: 0 0 6px; font-size: 24px; }
.solution-head p { margin: 0; color: var(--muted); }
.solution-body { padding: 24px; }
.step-list { display: grid; gap: 14px; }
.step-card { position: relative; padding: 18px 18px 18px 56px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.step-number { position: absolute; left: 17px; top: 18px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 12px; font-weight: 800; }
.step-card h3 { margin: 1px 0 9px; font-size: 17px; }
.step-card p { margin: 8px 0; }
.formula { margin: 10px 0; padding: 10px 12px; overflow-x: auto; background: var(--surface-soft); border-left: 3px solid #94a3b8; border-radius: 7px; font: 18px/1.55 Georgia, "Times New Roman", "Noto Serif SC", serif; text-align: center; }
.formula.key { background: var(--blue-soft); border-left-color: var(--blue); font-weight: 700; }
.theorem-box { margin: 10px 0; padding: 10px 12px; background: var(--orange-soft); border: 1px solid #fed7aa; border-radius: 9px; }
.note-box { margin: 10px 0; padding: 10px 12px; background: var(--purple-soft); border: 1px solid #ddd6fe; border-radius: 9px; }
.solution-end { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--green-soft); border: 1px solid #bde9ca; text-align: center; font-size: 18px; font-weight: 800; }
.compare-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.compare-table th, .compare-table td { padding: 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.compare-table th { color: var(--muted); font-size: 12px; }
.demo-card { padding: 18px; }
.demo-card p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); }
.footer-row { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 13px; }
.footer-row a:hover { color: var(--ink); }

@media (max-width: 920px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 44px; }
  .hero-stats { width: 100%; }
  .problem-grid { grid-template-columns: 1fr; }
  .problem-layout { grid-template-columns: 1fr; }
  .problem-layout > aside { order: -1; }
  .problem-hero { grid-template-columns: 1fr; }
  .problem-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .shell { width: min(calc(100% - 20px), var(--shell)); }
  .nav-row { min-height: 64px; }
  .brand small { display: none; }
  .top-nav a { padding-inline: 7px; }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: 34px; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .stat { min-width: 0; padding: 12px; }
  .stat strong { font-size: 23px; }
  .catalog-head { align-items: stretch; flex-direction: column; }
  .catalog-tools { min-width: 0; width: 100%; }
  .problem-shell { padding-top: 24px; }
  .panel-inner, .solution-body { padding: 17px; }
  .solution-head { padding: 18px 17px 15px; flex-direction: column; }
  .step-card { padding-left: 48px; }
  .step-number { left: 13px; }
  .footer-row { align-items: flex-start; flex-direction: column; justify-content: center; gap: 4px; padding-block: 16px; }
}
