:root {
  --ink: #17211f;
  --muted: #66706b;
  --paper: #f7f1e7;
  --paper-2: #fffaf0;
  --line: rgba(23, 33, 31, 0.14);
  --teal: #315f5a;
  --teal-dark: #153f3e;
  --red: #9c3b2e;
  --gold: #c79b54;
  --shadow: 0 20px 70px rgba(20, 31, 29, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
  line-height: 1.7;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.hero {
  min-height: 96vh;
  padding: 20px clamp(18px, 4vw, 64px) 54px;
  background:
    radial-gradient(circle at 10% 20%, rgba(199, 155, 84, 0.2), transparent 28%),
    linear-gradient(135deg, #fff8ec 0%, #efe2d0 52%, #d9e3dc 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  position: sticky;
  top: 14px;
  z-index: 10;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px rgba(32, 37, 34, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fffaf0;
  background: var(--teal-dark);
}

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

.nav-links a {
  padding: 8px 10px;
  border-radius: 8px;
}

.nav-links a:hover,
.filterbar button:hover {
  background: rgba(49, 95, 90, 0.12);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(360px, 1.14fr);
  gap: clamp(28px, 5vw, 74px);
  align-items: center;
  max-width: 1240px;
  margin: 58px auto 0;
}

.eyebrow,
.case-kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
h4,
p,
span,
b {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 12em;
  margin: 0;
  font-size: clamp(40px, 7vw, 78px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lead {
  max-width: 690px;
  margin: 22px 0 0;
  color: #3f4945;
  font-size: 18px;
}

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

.primary-btn,
.secondary-btn,
.filterbar button,
.prompt-box button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--teal-dark);
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-btn,
.filterbar button.active,
.prompt-box button {
  color: #fffaf0;
  background: var(--teal-dark);
}

.secondary-btn,
.filterbar button {
  color: var(--teal-dark);
  background: rgba(255, 250, 240, 0.64);
}

.hero-visual {
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #efe4d1;
}

.hero-visual img,
.case-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.section {
  max-width: 1220px;
  margin: 0 auto;
  padding: 76px clamp(18px, 4vw, 36px);
}

.section-head {
  margin-bottom: 26px;
}

h2 {
  margin: 0;
  font-size: clamp(30px, 4.8vw, 52px);
  line-height: 1.16;
}

.section-desc {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
}

.method {
  max-width: none;
  color: #fffaf0;
  background: #17211f;
}

.method .section-head,
.method-grid {
  max-width: 1220px;
  margin-inline: auto;
}

.method-grid,
.case-grid {
  display: grid;
  gap: 16px;
}

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

.method-grid article,
.formula-card,
.case-card,
.practice-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  box-shadow: 0 10px 34px rgba(24, 33, 31, 0.06);
}

.method-grid article {
  padding: 20px;
  color: #fffaf0;
  border-color: rgba(255, 250, 240, 0.16);
  background: rgba(255, 250, 240, 0.06);
}

.method-grid b,
.method-grid span {
  display: block;
}

.method-grid b {
  color: #f2d194;
  font-size: 20px;
}

.method-grid span {
  color: rgba(255, 250, 240, 0.78);
}

.formula {
  max-width: none;
  background: #e7eee8;
}

.formula .section-head,
.formula-card {
  max-width: 1220px;
  margin-inline: auto;
}

.formula-card {
  padding: clamp(20px, 4vw, 34px);
}

.definition {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 800;
}

pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  border-radius: 8px;
  color: #fffaf0;
  background: #17211f;
  white-space: pre-wrap;
}

code {
  font-family: "Microsoft YaHei", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  position: sticky;
  top: 76px;
  z-index: 8;
  padding: 12px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(247, 241, 231, 0.86);
  backdrop-filter: blur(12px);
}

.case-grid {
  grid-template-columns: 1fr;
}

.case-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(18px, 3vw, 34px);
  padding: clamp(16px, 3vw, 26px);
  scroll-margin-top: 120px;
}

.case-image {
  aspect-ratio: 1 / 1;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #ddd1bf;
}

.case-body {
  display: grid;
  align-content: center;
  gap: 12px;
}

.case-body h3 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.16;
}

.case-body p {
  margin: 0;
}

.prompt-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(49, 95, 90, 0.2);
  border-radius: 8px;
  background: rgba(49, 95, 90, 0.08);
}

.prompt-box > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-box button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 14px;
  flex: 0 0 auto;
}

.practice-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: clamp(18px, 3vw, 28px);
}

label {
  display: grid;
  gap: 8px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fffaf0;
}

.practice-panel .primary-btn {
  align-self: end;
}

.result {
  display: block;
  grid-column: 1 / -1;
  min-height: 90px;
  padding: 18px;
  border: 1px solid rgba(49, 95, 90, 0.26);
  border-radius: 8px;
  background: rgba(49, 95, 90, 0.08);
}

.footer {
  padding: 30px clamp(18px, 4vw, 54px) 44px;
  border-top: 1px solid var(--line);
  background: #17211f;
  color: rgba(255, 250, 240, 0.82);
  font-size: 14px;
}

.footer p {
  margin: 0 0 10px;
}

.footer div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer a {
  color: #f2d194;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 1040px) {
  .hero-grid,
  .case-card,
  .practice-panel {
    grid-template-columns: 1fr;
  }

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

  .filterbar {
    top: 0;
  }
}

@media (max-width: 640px) {
  .hero {
    min-height: auto;
  }

  .topbar {
    align-items: flex-start;
    position: static;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .hero-grid {
    margin-top: 34px;
  }

  h1 {
    font-size: 39px;
  }

  .lead {
    font-size: 16px;
  }

  .method-grid {
    grid-template-columns: 1fr;
  }

  .filterbar {
    position: static;
  }

  .case-card {
    padding: 14px;
  }

  .prompt-box > div {
    align-items: flex-start;
    flex-direction: column;
  }
}
