:root {
  --topic-bg: #fffafc;
  --topic-surface: #ffffff;
  --topic-text: #241b2c;
  --topic-muted: #685c70;
  --topic-border: #eadde4;
  --topic-accent: #a50920;
  --topic-accent-hover: #810719;
  --topic-soft: #f9e9ef;
  --topic-link: #8f1634;
}

html[data-theme="dark"] {
  --topic-bg: #171319;
  --topic-surface: #211b22;
  --topic-text: #fff5f8;
  --topic-muted: #cbbdc5;
  --topic-border: #4a3943;
  --topic-accent: #ef6578;
  --topic-accent-hover: #ff8292;
  --topic-soft: #30232a;
  --topic-link: #ff9aaa;
}

* { box-sizing: border-box; }

html { background: var(--topic-bg); }

body.topic-page {
  margin: 0;
  background: var(--topic-bg);
  color: var(--topic-text);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a { color: var(--topic-link); }

.topic-header,
.topic-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topic-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--topic-border);
}

.topic-brand {
  display: inline-flex;
  align-items: center;
}

.topic-brand img {
  display: block;
  width: 176px;
  height: 48px;
  object-fit: contain;
  object-position: left center;
}

.topic-header nav,
.topic-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.topic-header nav a,
.topic-footer nav a {
  color: var(--topic-text);
  text-decoration: none;
}

.topic-header nav a:hover,
.topic-footer nav a:hover {
  color: var(--topic-accent);
}

.topic-theme-toggle {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--topic-border);
  border-radius: 6px;
  background: var(--topic-surface);
  color: var(--topic-text);
  cursor: pointer;
  font-size: 20px;
}

.topic-theme-toggle:focus-visible,
.topic-cta:focus-visible,
.topic-header a:focus-visible,
.topic-footer a:focus-visible {
  outline: 2px solid var(--topic-accent);
  outline-offset: 3px;
}

.topic-hero {
  border-bottom: 1px solid var(--topic-border);
  background: var(--topic-surface);
}

.topic-hero__inner {
  width: min(1120px, calc(100% - 40px));
  min-height: 430px;
  margin: 0 auto;
  padding: 76px 0 64px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.topic-kicker {
  margin: 0 0 12px;
  color: var(--topic-accent);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.topic-hero h1 {
  max-width: 850px;
  margin: 0;
  font-size: 60px;
  line-height: 1.08;
  letter-spacing: 0;
}

.topic-intro {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--topic-muted);
  font-size: 19px;
}

.topic-cta {
  display: inline-flex;
  min-height: 46px;
  margin-top: 30px;
  padding: 11px 20px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--topic-accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.topic-cta:hover {
  background: var(--topic-accent-hover);
  color: #fff;
}

.topic-cta-note {
  margin: 10px 0 0;
  color: var(--topic-muted);
  font-size: 14px;
}

.topic-content {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 70px;
}

.topic-section,
.topic-faq,
.topic-related {
  padding: 40px 0;
  border-bottom: 1px solid var(--topic-border);
}

.topic-section h2,
.topic-faq h2,
.topic-related h2 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.25;
}

.topic-section p,
.topic-faq p {
  margin: 0;
  color: var(--topic-muted);
}

.topic-faq details {
  padding: 18px 0;
  border-top: 1px solid var(--topic-border);
}

.topic-faq summary {
  cursor: pointer;
  font-weight: 800;
}

.topic-faq details p { margin-top: 10px; }

.topic-related > div {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.topic-related a { font-weight: 700; }

.topic-footer {
  min-height: 86px;
  padding: 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--topic-muted);
  border-top: 1px solid var(--topic-border);
  font-size: 14px;
}

@media (max-width: 760px) {
  .topic-header,
  .topic-footer,
  .topic-hero__inner,
  .topic-content {
    width: min(100% - 28px, 1120px);
  }

  .topic-header {
    padding: 14px 0;
    align-items: flex-start;
  }

  .topic-brand img { width: 142px; height: 40px; }

  .topic-header nav {
    justify-content: flex-end;
    gap: 8px 12px;
    font-size: 14px;
  }

  .topic-hero__inner {
    min-height: 0;
    padding: 54px 0 48px;
  }

  .topic-hero h1 { font-size: 40px; }
  .topic-intro { font-size: 17px; }

  .topic-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topic-header { display: block; }
  .topic-header nav { margin-top: 12px; justify-content: flex-start; }
  .topic-hero h1 { font-size: 34px; }
}

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