:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --border: #e3e8f2;
  --text: #0f172a;
  --muted: #5f6b7c;
  --primary: #0ea5e9;
  --primary-dark: #2563eb;
  --gradient: linear-gradient(120deg, #0ea5e9, #3b82f6);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --shadow-soft: 0 25px 80px rgba(15, 23, 42, 0.08);
  --shell-width: 1400px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.help-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.7);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.help-nav-inner {
  width: min(var(--shell-width), calc(100% - 64px));
  margin: 0 auto;
  padding: 18px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.help-nav a.brand {
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.help-nav a.primary-link {
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-left: auto;
  /* Push to right if header-menu is flex */
}

/* Header Menu */
.header-menu {
  display: flex;
  align-items: center;
  gap: 32px;
  margin: 0 48px;
  flex: 1;
}

.nav-item {
  position: relative;
  padding: 8px 0;
  cursor: pointer;
}

.nav-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.2s;
}

.nav-label::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #94a3b8;
  margin-top: 2px;
}

.nav-item:hover .nav-label,
.nav-item.active .nav-label {
  color: var(--primary);
}

.nav-item:hover .nav-label::after {
  border-top-color: var(--primary);
}

.nav-label.no-arrow::after {
  display: none;
}

a.nav-item {
  text-decoration: none;
  display: block;
}

/* Dropdown */
.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 100;
}

.nav-item:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  border-radius: 8px;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}

.nav-dropdown a:hover {
  background: #f1f5f9;
  color: var(--primary);
}

.nav-dropdown a.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.help-shell {
  width: min(var(--shell-width), calc(100% - 64px));
  margin: 48px auto 96px;
  display: grid;
  grid-template-columns: 240px 1fr 200px;
  gap: 40px;
}

.help-sidebar {
  /* background: var(--surface); Remove background for cleaner look */
  /* border: 1px solid var(--border); */
  /* padding: 28px; */
  /* box-shadow: var(--shadow-soft); */
  position: sticky;
  top: 100px;
  align-self: start;
  border-radius: var(--radius-xl);
}

.help-toc {
  position: sticky;
  top: 100px;
  align-self: start;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.toc-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8091a7;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.toc-link {
  display: block;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.2s;
  line-height: 1.5;
}

/* h2 级别 - 主标题，加粗 */
.toc-link.toc-level-2 {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  margin-top: 8px;
}

.toc-link.toc-level-2:first-child {
  margin-top: 0;
}

/* h3 级别 - 子标题，缩进 + 较浅颜色 */
.toc-link.toc-level-3 {
  padding-left: 24px;
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
  position: relative;
}

.toc-link.toc-level-3::before {
  content: "›";
  position: absolute;
  left: 12px;
  color: #cbd5e1;
}

.toc-link:hover {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary-dark);
  transform: translateX(2px);
}

.toc-link.active {
  background: rgba(14, 165, 233, 0.15);
  color: var(--primary-dark);
  font-weight: 600;
}

/* Clean up unused sidebar link styles if desired, or keep for safety */
.sidebar-support-card {
  margin-top: 0;
  /* Reset margin */
  padding: 20px;
  background: #fff;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.sidebar-support-card {
  margin-top: 24px;
  padding: 14px;
  background: rgba(14, 165, 233, 0.06);
  border-radius: 14px;
  border: 1px solid rgba(14, 165, 233, 0.15);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.support-card-title {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 13px;
  margin-bottom: 10px;
  text-align: center;
}

.support-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}

.support-card-qr img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(14, 165, 233, 0.12);
  background: #fff;
  display: block;
}

.support-card-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #0f172a;
  width: 100%;
}

.support-card-desc {
  color: #64748b;
  font-size: 11px;
  text-align: center;
}

.support-id-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: space-between;
  margin-top: 2px;
  background: #fff;
  padding: 4px 6px 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(14, 165, 233, 0.15);
}

.support-id-text {
  font-size: 12px;
  color: #334155;
  font-weight: 600;
}

.support-id-text strong {
  color: var(--primary-dark);
}

.support-copy-icon {
  min-width: unset;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  border: none;
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  white-space: nowrap;
}

.support-copy-icon:hover {
  background: var(--primary);
  color: #fff;
}

.support-copy-icon:active {
  transform: translateY(1px);
}

.help-main {
  width: 100%;
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 56px;
  box-shadow: var(--shadow-soft);
  line-height: 1.8;
  counter-reset: section;
}

.article-meta {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.article-card h1 {
  margin: 0;
  font-size: clamp(34px, 4vw, 42px);
  line-height: 1.2;
}

.article-card h2,
.article-card h3 {
  position: relative;
  padding-top: 32px;
  margin-top: 72px;
  margin-bottom: 22px;
  border-top: 1px solid rgba(226, 232, 240, 0.9);
  scroll-margin-top: 140px;
}

.article-card h2 {
  font-size: clamp(30px, 3.6vw, 36px);
}

.article-card h3 {
  font-size: 24px;
  margin-top: 48px;
}

.article-card h4,
.article-card h5 {
  margin-top: 32px;
  margin-bottom: 12px;
}

.article-card p {
  margin: 18px 0;
  color: #1f2933;
}

.article-card a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.article-card a:hover {
  text-decoration: underline;
}

.article-card ul,
.article-card ol {
  margin: 18px 0 18px 24px;
}

.article-card li+li {
  margin-top: 6px;
}

.article-card pre {
  position: relative;
  background: linear-gradient(to bottom, #1e293b, #0f172a);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  padding: 68px 36px 32px;
  color: #e2e8f0;
  line-height: 1.8;
  overflow-x: auto;
  white-space: pre-wrap;
}

.article-card pre::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 46px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  padding-left: 16px;
  background-image:
    radial-gradient(circle at 18px 23px, #ff5f56 5px, transparent 5px),
    radial-gradient(circle at 34px 23px, #ffbd2e 5px, transparent 5px),
    radial-gradient(circle at 50px 23px, #27c93f 5px, transparent 5px);
  background-color: rgba(255, 255, 255, 0.05);
}

/* 代码块包装容器 */
.article-card .code-block-wrapper {
  position: relative;
  margin: 1.5em 0;
}

/* 代码块本身 */
.article-card .code-block-wrapper pre {
  margin: 0;
}

/* 复制按钮样式 */
.article-card .code-copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(139, 155, 181, 0.3);
  border-radius: 6px;
  color: #8b9bb5;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.article-card .code-copy-btn:hover {
  background: rgba(74, 144, 226, 0.15);
  border-color: #4a90e2;
  color: #4a90e2;
}

.article-card .code-copy-btn:active {
  transform: scale(0.95);
}

/* 复制图标和勾选图标切换 */
.article-card .code-copy-btn svg {
  transition: all 0.2s ease;
}

.article-card .code-copy-btn .check-icon {
  position: absolute;
  opacity: 0;
  transform: scale(0);
}

/* 复制成功状态 */
.article-card .code-copy-btn.copied {
  background: rgba(82, 196, 26, 0.15);
  border-color: #52c41a;
}

.article-card .code-copy-btn.copied svg:first-child {
  opacity: 0;
  transform: scale(0);
}

.article-card .code-copy-btn.copied .check-icon {
  opacity: 1;
  transform: scale(1);
}

.article-card code {
  font-family: 'JetBrains Mono', Consolas, monospace;
  font-size: 14px;
  background: rgba(37, 99, 235, 0.08);
  padding: 3px 7px;
  border-radius: 6px;
}

.article-card pre code {
  background: transparent;
  padding: 0;
}

/* 代码语法高亮 */
.article-card pre .comment,
.article-card pre .hljs-comment {
  color: #64748b;
}

.article-card pre .keyword,
.article-card pre .hljs-keyword,
.article-card pre .hljs-built_in,
.article-card pre .hljs-selector-tag {
  color: #60a5fa;
}

.article-card pre .string,
.article-card pre .hljs-string,
.article-card pre .hljs-attr {
  color: #34d399;
}

.article-card pre .variable,
.article-card pre .hljs-variable,
.article-card pre .hljs-title,
.article-card pre .hljs-params {
  color: #a78bfa;
}

.article-card table {
  width: 100%;
  border-collapse: collapse;
  margin: 26px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.article-card th,
.article-card td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 15px;
}

.article-card tr:nth-child(even) td {
  background: #f9fbff;
}

.article-card blockquote {
  margin: 28px 0;
  padding: 18px 26px;
  border-left: 5px solid var(--primary);
  background: rgba(14, 165, 233, 0.08);
  border-radius: var(--radius-lg);
  color: #0f172a;
}

dl.faq-list {
  margin: 24px 0;
  padding: 22px 28px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #f8fbff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.09);
}

dl.faq-list+dl.faq-list {
  margin-top: 20px;
}

dl.faq-list dt {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

dl.faq-list dt::before {
  content: "Q";
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(14, 165, 233, 0.18);
  color: var(--primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
}

dl.faq-list dd {
  margin: 0;
  color: #1f2635;
  line-height: 1.75;
}

dl.faq-list dd p {
  margin: 0 0 10px;
}

dl.faq-list dd p:last-child,
dl.faq-list dd ul:last-child,
dl.faq-list dd ol:last-child,
dl.faq-list dd pre:last-child {
  margin-bottom: 0;
}

.article-card hr {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 36px 0;
}

.article-card img {
  max-width: 100%;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.15);
}

/* 旧的移动端块已合并到文件末尾的统一 @media 块中 */

/* Mobile hamburger button - hidden on desktop */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
}

.mobile-menu-btn svg {
  display: block;
}

/* Mobile overlay menu */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.mobile-menu-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-menu-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(300px, 80vw);
  height: 100%;
  background: var(--surface);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.1);
  padding: 20px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.mobile-menu-overlay.open .mobile-menu-panel {
  transform: translateX(0);
}

.mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.mobile-menu-close button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.mobile-menu-panel .mobile-nav-group {
  margin-bottom: 16px;
}

.mobile-menu-panel .mobile-nav-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  padding: 0 8px;
}

.mobile-menu-panel .mobile-nav-link {
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  border-radius: 8px;
  transition: background 0.15s;
}

.mobile-menu-panel .mobile-nav-link:hover,
.mobile-menu-panel .mobile-nav-link.active {
  background: rgba(14, 165, 233, 0.1);
  color: var(--primary);
}

.mobile-menu-panel .mobile-nav-link.active {
  font-weight: 600;
}

.mobile-menu-panel .mobile-home-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  padding: 12px;
  background: rgba(14, 165, 233, 0.08);
  border-radius: 10px;
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

@media (max-width: 1024px) {

  /* 防止任何元素撑破视口宽度 */
  html {
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
    min-width: 0;
  }

  /* 所有直接子容器限制在视口内 */
  .help-nav-inner {
    width: calc(100% - 32px);
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .help-shell {
    width: calc(100% - 32px);
    max-width: 100%;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .help-sidebar,
  .help-toc {
    position: static;
    display: none;
  }

  .help-main {
    min-width: 0;
    max-width: 100%;
  }

  /* Hide desktop menu, show hamburger */
  .header-menu,
  .help-nav a.primary-link {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  /* overlay 默认不可见不可交互，.open 时才激活 */
  .mobile-menu-overlay {
    display: block;
  }

  .article-card {
    padding: 24px 16px;
    border-radius: 16px;
    max-width: 100%;
    min-width: 0;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .article-card h1 {
    font-size: 26px;
    word-break: break-word;
  }

  .article-card h2 {
    font-size: 22px;
  }

  .article-card h3 {
    font-size: 18px;
  }

  .article-card pre {
    padding: 52px 14px 18px;
    font-size: 12px;
    border-radius: 10px;
    max-width: 100%;
  }

  .article-card code {
    font-size: 13px;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  .article-card table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }

  .article-card img {
    border-radius: 12px;
    max-width: 100%;
    height: auto;
  }

  .article-card blockquote {
    margin: 18px 0;
    padding: 14px 18px;
  }

  .article-card ul,
  .article-card ol {
    padding-left: 20px;
    margin-left: 0;
  }
}
