* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
}

.help-page {
  min-height: 100vh;
  color: var(--ink);
  background: var(--layout-bg);
  font-size: var(--fs-body);
  line-height: 1.75;
}

.help-page a {
  color: inherit;
  text-decoration: none;
}

.help-header {
  position: sticky;
  top: 0;
  z-index: var(--z-topbar);
  height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.help-header__inner,
.help-hero__inner,
.help-doc-shell,
.help-footer__inner,
.help-footer__legal {
  width: calc(100% - 40px);
  max-width: 1200px;
  margin: 0 auto;
}

.help-header__inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--space-6);
}

.help-brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.help-brand img,
.help-footer__brand img {
  display: block;
  width: auto;
  height: 30px;
}

.help-header__nav {
  display: flex;
  align-items: center;
  height: 100%;
  gap: var(--space-5);
}

.help-header__nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 100%;
  color: var(--ink-secondary);
  font-weight: 600;
}

.help-header__nav a:hover,
.help-header__nav a.is-active {
  color: var(--brand-dark);
}

.help-header__nav a.is-active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--brand);
}

.help-header__action,
.help-cta__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-h-lg);
  padding: 0 var(--space-5);
  border: 1px solid var(--brand);
  border-radius: var(--radius-md);
  color: #fff;
  background: var(--brand);
  font-weight: 700;
  gap: var(--space-2);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.help-header__action {
  min-height: var(--control-h);
  margin-left: auto;
  padding: 0 var(--space-4);
}

.help-header__action:hover,
.help-cta__button:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.help-hero {
  padding: calc(var(--space-8) + var(--space-2)) 0;
  border-bottom: 1px solid var(--brand-line);
  background: var(--brand-soft);
}

.help-hero__inner {
  text-align: center;
}

.help-eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--brand-dark);
  font-size: var(--fs-caption);
  font-weight: 800;
  letter-spacing: 0.14em;
}

.help-hero h1 {
  margin: 0;
  font-size: var(--fs-h1);
  line-height: 1.3;
}

.help-hero p:last-child {
  margin: var(--space-3) 0 0;
  color: var(--ink-secondary);
  font-size: var(--fs-h2);
}

.help-doc-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 180px;
  align-items: start;
  gap: var(--space-6);
  padding-top: var(--space-8);
  padding-bottom: calc(var(--space-8) + var(--space-4));
}

.help-doc-shell--index {
  grid-template-columns: 220px minmax(0, 1fr);
}

.help-doc-shell--index .help-toc {
  display: none;
}

/* 合规文本页（/terms、/privacy）：没有教程侧栏，正文 + 本页目录两栏。 */
.help-doc-shell--legal {
  grid-template-columns: minmax(0, 1fr) 200px;
}

.help-sidebar,
.help-toc {
  position: sticky;
  top: calc(var(--topbar-height) + var(--space-6));
}

.help-sidebar {
  display: grid;
  gap: var(--space-6);
}

.help-sidebar__section {
  display: grid;
  gap: var(--space-1);
}

.help-sidebar__label,
.help-toc__label {
  margin: 0 0 var(--space-2);
  color: var(--muted);
  font-size: var(--fs-caption);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.help-sidebar a {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--ink-secondary);
  font-weight: 600;
  gap: var(--space-3);
}

.help-sidebar a i {
  width: 16px;
  color: var(--muted);
  text-align: center;
}

.help-sidebar a:hover {
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.help-sidebar a.is-active {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.help-sidebar a.is-active i {
  color: var(--brand);
}

.help-main {
  min-width: 0;
  padding: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.help-main h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--fs-h1);
  line-height: 1.3;
}

.help-main h2 {
  scroll-margin-top: calc(var(--topbar-height) + var(--space-5));
  margin: calc(var(--space-8) + var(--space-1)) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-h2);
  line-height: 1.4;
}

.help-main h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--fs-body);
  font-weight: 800;
}

.help-main p,
.help-main li {
  color: var(--ink-secondary);
}

.help-main ol,
.help-main ul {
  padding-left: var(--space-6);
}

.help-main li + li {
  margin-top: var(--space-2);
}

.help-lead {
  margin: 0 0 var(--space-6);
  color: var(--ink-secondary);
  font-size: var(--fs-h2);
}

.help-note {
  margin: var(--space-5) 0;
  padding: var(--space-4);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  background: var(--brand-soft);
}

.help-note strong {
  color: var(--brand-dark);
}

.help-shot {
  margin-top: var(--space-4);
  padding: var(--space-6) var(--space-4);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: var(--fs-caption);
  text-align: center;
}

.help-sample-table {
  width: 100%;
  margin-top: var(--space-4);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: var(--fs-caption);
}

.help-sample-table th,
.help-sample-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.help-sample-table th {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.help-sample-table tr:last-child td {
  border-bottom: 0;
}

.help-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.help-card {
  display: flex;
  flex-direction: column;
  min-height: 188px;
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.help-card:hover {
  border-color: var(--brand-line);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}

.help-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: var(--brand-dark);
  background: var(--brand-soft);
  font-size: var(--fs-h2);
}

.help-card h2 {
  margin: var(--space-4) 0 var(--space-2);
  padding: 0;
  border: 0;
  font-size: var(--fs-h3);
}

.help-card p {
  flex: 1;
  margin: 0;
  color: var(--ink-secondary);
}

.help-card__link {
  margin-top: var(--space-4);
  color: var(--brand-dark);
  font-weight: 700;
}

.help-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: calc(var(--space-8) + var(--space-1));
  padding: var(--space-5);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-lg);
  background: var(--brand-soft);
  gap: var(--space-5);
}

.help-cta strong {
  display: block;
  font-size: var(--fs-h2);
}

.help-cta p {
  margin: var(--space-1) 0 0;
}

.help-cta__button {
  flex: 0 0 auto;
}

.help-next {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  gap: var(--space-3);
}

.help-next a {
  color: var(--brand-dark);
  font-weight: 700;
}

.help-toc {
  display: grid;
  gap: var(--space-1);
  padding-left: var(--space-4);
  border-left: 1px solid var(--border);
}

.help-toc a {
  padding: var(--space-1) 0;
  color: var(--muted);
  font-size: var(--fs-caption);
}

.help-toc a:hover {
  color: var(--brand-dark);
}

.help-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.help-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
  gap: var(--space-8);
}

.help-footer__brand p {
  margin: var(--space-2) 0 0;
  color: var(--muted);
}

.help-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.help-footer__links a,
.help-footer__legal,
.help-footer__legal a {
  color: var(--muted);
}

.help-footer__links a:hover,
.help-footer__legal a:hover {
  color: var(--brand-dark);
}

.help-footer__legal {
  display: flex;
  justify-content: space-between;
  padding-top: var(--space-4);
  padding-bottom: var(--space-5);
  border-top: 1px solid var(--border);
  font-size: var(--fs-caption);
}

@media (max-width: 1024px) {
  .help-doc-shell,
  .help-doc-shell--index {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  /* 目录在此断点已隐藏，法律页只剩正文一栏。 */
  .help-doc-shell--legal {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-toc {
    display: none;
  }

  .help-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .help-header__inner,
  .help-hero__inner,
  .help-doc-shell,
  .help-footer__inner,
  .help-footer__legal {
    width: calc(100% - 24px);
  }

  .help-header__nav {
    display: none;
  }

  .help-hero {
    padding: var(--space-8) 0;
  }

  .help-hero h1 {
    font-size: var(--fs-h1);
  }

  .help-doc-shell,
  .help-doc-shell--index {
    grid-template-columns: minmax(0, 1fr);
    padding-top: var(--space-5);
  }

  .help-sidebar {
    position: static;
    display: flex;
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }

  .help-sidebar__section {
    display: flex;
    flex: 0 0 auto;
  }

  .help-sidebar__label,
  .help-sidebar__section:last-child {
    display: none;
  }

  .help-sidebar a {
    white-space: nowrap;
  }

  .help-main {
    padding: var(--space-5);
  }

  .help-cta,
  .help-footer__inner,
  .help-footer__legal {
    align-items: flex-start;
    flex-direction: column;
  }

  .help-cta__button {
    width: 100%;
  }
}
