/* ============================================================
   tunnel_proxy_rs 官网样式
   程序员友好暗色：GitHub Dark / VS Code Dark+ 风格
   中性深灰（非蓝青、非紫粉、非亮白），低饱和、专业、护眼
   强调色：克制绿 #42b883
   ============================================================ */
:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --bg-soft: #161b22;
  --code-bg: #010409;
  --code-text: #c9d1d9;
  --code-keyword: #ff7b72;
  --code-string: #a5d6ff;
  --code-comment: #8b949e;
  --code-fn: #d2a8ff;
  --border: #21262d;
  --border-strong: #30363d;
  --text: #e6edf3;
  --text-dim: #9da7b3;
  --text-faint: #6e7681;
  --brand: #42b883;
  --brand-dark: #3fb950;
  --brand-soft: rgba(66, 184, 131, 0.14);
  --green: #3fb950;
  --amber: #d29922;
  --pink: #db61a2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 4px 14px rgba(0,0,0,0.25);
  --shadow-hover: 0 2px 4px rgba(0,0,0,0.4), 0 10px 26px rgba(66, 184, 131, 0.12);
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: #5cd699; }
code, kbd {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--brand-soft);
  color: #7ee2b8;
  padding: 0.12em 0.4em;
  border-radius: 5px;
}
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 14px 0 6px;
  position: relative;
}
pre code { background: none; border: none; padding: 0; color: var(--code-text); font-size: 0.8rem; line-height: 1.7; display: block; }
.c-dim { color: var(--code-comment); }
.c-key { color: var(--code-keyword); }
.c-str { color: var(--code-string); }
.c-fn { color: var(--code-fn); }
.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }

/* ============ 导航 ============ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.nav.scrolled { border-bottom-color: var(--border); box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
.nav-inner {
  max-width: 1160px; margin: 0 auto; padding: 0 24px;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.02rem; }
.brand:hover { color: var(--text); }
.brand-logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
  color: #0d1117; font-size: 0.9rem; font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--text-dim); font-size: 0.92rem; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  background: var(--brand); color: #0d1117 !important;
  padding: 7px 16px; border-radius: 8px; font-weight: 700;
  transition: background 0.2s, transform 0.15s;
}
.nav-cta:hover { background: #5cd699; color: #0d1117 !important; transform: translateY(-1px); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 1.15rem; }

/* ============ Hero（克制暗色，无花哨光晕） ============ */
.hero {
  position: relative;
  padding: 140px 0 80px;
  background:
    radial-gradient(ellipse 60% 45% at 50% -10%, rgba(66, 184, 131, 0.07), transparent),
    var(--bg);
  border-bottom: 1px solid var(--border);
}
.hero-inner { text-align: center; }
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--brand); font-size: 0.82rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  border: 1px solid rgba(66, 184, 131, 0.3);
  background: var(--brand-soft);
  padding: 5px 14px; border-radius: 999px;
  margin-bottom: 24px;
}
.hero-eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.hero-title {
  font-size: clamp(2.3rem, 5.5vw, 3.8rem);
  font-weight: 800; line-height: 1.2; letter-spacing: -1px;
  color: var(--text);
}
.gradient-text {
  background: linear-gradient(120deg, #3fb950, #42b883);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub {
  max-width: 720px; margin: 22px auto 0;
  color: var(--text-dim); font-size: 1.08rem;
  overflow-wrap: anywhere;
}
.hero-sub strong { color: var(--text); }
.hero-actions { margin-top: 32px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 12px 28px;
  border-radius: 9px; font-weight: 600; font-size: 0.95rem;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  cursor: pointer; border: 1px solid transparent;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--brand); color: #0d1117; font-weight: 700; }
.btn-primary:hover { background: #5cd699; }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }

.hero-window {
  max-width: 680px; margin: 44px auto 0; text-align: left;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--bg-alt);
}
.window-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.window-dot { width: 11px; height: 11px; border-radius: 50%; }
.window-dot.r { background: #f85149; }
.window-dot.y { background: #d29922; }
.window-dot.g { background: #3fb950; }
.window-title { margin-left: 8px; color: var(--text-faint); font-size: 0.78rem; font-family: var(--mono); }
.window-body { padding: 0; }
.window-body pre { border-radius: 0; margin: 0; border: none; }
.window-body pre code { font-size: 0.83rem; }

.hero-stats {
  margin-top: 48px;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  max-width: 860px; margin-left: auto; margin-right: auto;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-alt);
  overflow: hidden;
}
.stat { padding: 22px 10px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat b { display: block; font-size: 2rem; font-weight: 800; line-height: 1.2; color: var(--brand); }
.stat span { color: var(--text-faint); font-size: 0.84rem; }

/* ============ Section ============ */
.section { padding: 92px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 760px; margin: 0 auto 52px; }
.eyebrow {
  color: var(--brand); font-size: 0.8rem; letter-spacing: 2px;
  text-transform: uppercase; font-weight: 700; margin-bottom: 12px;
}
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.4rem); font-weight: 800; letter-spacing: -0.5px; line-height: 1.3; color: var(--text); }
.section-desc { color: var(--text-dim); margin-top: 14px; }

.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
/* 网格子项允许收缩：避免长代码行（pre 不换行）把列撑破容器 */
.feature-grid > *, .pf-grid > *, .tutorial-grid > *, .compare-grid > * { min-width: 0; }
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(66, 184, 131, 0.5);
  box-shadow: var(--shadow-hover);
}
.card-icon {
  width: 46px; height: 46px; border-radius: 11px;
  background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 16px;
}
.card h3 { font-size: 1.12rem; margin-bottom: 9px; font-weight: 700; color: var(--text); }
.card p { color: var(--text-dim); font-size: 0.92rem; overflow-wrap: anywhere; }

.badge-cloud { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; max-width: 1000px; margin: 0 auto; }
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text);
  font-size: 0.92rem; font-weight: 500;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.badge:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: 0 4px 14px rgba(66, 184, 131, 0.12); }
.badge-hot { border-color: rgba(66, 184, 131, 0.45); color: #7ee2b8; background: var(--brand-soft); }
.badge-sub { color: var(--text-faint); font-size: 0.72rem; }
.proto-note, .transport-note { max-width: 780px; margin: 36px auto 0; text-align: left; }
.proto-note h3, .transport-note h3 { margin-bottom: 8px; }

.section-pf { position: relative; }
.pf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.pf-card h3 { margin-bottom: 8px; }
.pf-card pre { margin-top: 16px; }
.pf-card-highlight { border-color: rgba(219, 97, 162, 0.4); background: linear-gradient(180deg, rgba(219, 97, 162, 0.06), var(--bg-alt)); }
.pf-card-highlight h3 { color: #f778ba; }

.tutorial-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.tutorial-step { position: relative; overflow: hidden; }
.step-num {
  position: absolute; top: 22px; right: 26px;
  font-size: 2.4rem; font-weight: 800; line-height: 1;
  color: rgba(66, 184, 131, 0.35);
}
.tutorial-step h3 { margin-bottom: 12px; }

.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; max-width: 920px; margin: 0 auto; }
.compare-card h3 { margin-bottom: 18px; font-size: 1.2rem; }
.compare-card ul { list-style: none; }
.compare-card li { padding: 9px 0; color: var(--text-dim); font-size: 0.95rem; border-bottom: 1px dashed var(--border); }
.compare-card li:last-child { border-bottom: none; }
.ok { color: var(--green); font-weight: 700; margin-right: 9px; }
.plus { color: var(--pink); font-weight: 700; margin-right: 9px; }

.install-box { max-width: 780px; margin: 0 auto; text-align: left; }
.install-links { margin-top: 24px; display: flex; gap: 14px; }

.footer { border-top: 1px solid var(--border); padding: 48px 0; background: var(--bg-alt); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-brand { font-weight: 700; color: var(--brand); }
.footer-desc { color: var(--text-faint); font-size: 0.85rem; margin-top: 4px; }
.footer-meta { color: var(--text-faint); font-size: 0.82rem; }

/* ============ 教程页 ============ */
.tutorial-layout { display: grid; grid-template-columns: 250px 1fr; gap: 48px; max-width: 1160px; margin: 0 auto; padding: 104px 24px 80px; }
.toc {
  position: sticky; top: 88px; align-self: start;
  max-height: calc(100vh - 110px); overflow-y: auto;
  border-right: 1px solid var(--border);
  padding-right: 20px;
}
.toc-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-faint); font-weight: 700; margin-bottom: 14px; }
.toc a {
  display: block; padding: 6px 12px; border-radius: 7px;
  color: var(--text-dim); font-size: 0.9rem;
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toc a:hover { color: var(--brand); background: var(--bg-soft); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }
.toc a.toc-sub { padding-left: 26px; font-size: 0.84rem; }
.toc a.toc-grp { color: var(--text); font-weight: 700; font-size: 0.92rem; margin-top: 8px; }

.doc { min-width: 0; }
.doc h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 8px; color: var(--text); }
.doc .doc-sub { color: var(--text-dim); margin-bottom: 34px; }
.doc h2 {
  font-size: 1.45rem; font-weight: 700; margin: 46px 0 6px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.doc h3 { font-size: 1.1rem; font-weight: 700; margin: 28px 0 6px; color: var(--text); }
.doc p { color: var(--text-dim); margin: 10px 0; overflow-wrap: anywhere; }
.doc ol { padding-left: 22px; color: var(--text-dim); }
.doc li { margin: 6px 0; }
.doc .hint {
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  padding: 12px 18px; border-radius: 0 10px 10px 0;
  color: var(--text-dim); font-size: 0.92rem; margin: 16px 0;
}
.doc .cmd-group { margin: 16px 0; }
/* 表格始终支持横向滚动：内容（长命令 code）超宽时在内部滚动，不撑破文档布局 */
.doc table { display: block; overflow-x: auto; max-width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.9rem; }
.doc th, .doc td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.doc th { color: var(--text); font-weight: 600; background: var(--bg-soft); }
.doc td { color: var(--text-dim); }
.doc td code, .doc th code { white-space: nowrap; }
.doc a.inline { border-bottom: 1px dashed; }
.doc kbd { background: var(--bg-soft); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; padding: 2px 8px; font-size: 0.8em; color: var(--text); }
.badge-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.badge-mini {
  padding: 4px 12px; border-radius: 999px; font-size: 0.78rem;
  border: 1px solid var(--border); color: var(--text-dim);
  font-family: var(--mono);
}
.badge-mini.hot { border-color: rgba(66, 184, 131, 0.45); color: #7ee2b8; background: var(--brand-soft); }

.copy-btn {
  position: absolute; top: 10px; right: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-strong);
  color: var(--text-faint);
  border-radius: 7px; padding: 3px 11px;
  font-size: 0.72rem; cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  z-index: 2;
}
.copy-btn:hover { color: var(--brand); border-color: var(--brand); }
.copy-btn.copied { color: var(--green); border-color: var(--green); }

@media (max-width: 1180px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 0.84rem; }
  .nav-inner { padding: 0 16px; }
}
@media (max-width: 1000px) {
  .feature-grid, .tutorial-grid, .pf-grid, .compare-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tutorial-layout { grid-template-columns: 1fr; }
  .toc { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 8px; }
}
@media (max-width: 760px) {
  .nav-links { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--bg); border-bottom: 1px solid var(--border); flex-direction: column; padding: 16px 24px; gap: 14px; }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .hero { padding: 110px 0 56px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-right: none; border-bottom: 1px solid var(--border); }
  .stat:nth-child(5) { grid-column: span 2; }
  .feature-grid, .tutorial-grid, .pf-grid, .compare-grid { grid-template-columns: minmax(0, 1fr); }
  .section { padding: 60px 0; }
  .doc h1 { font-size: 1.65rem; }
  .doc { padding: 0 4px; }
}

.reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.55s ease, transform 0.55s ease; }
.reveal.visible { opacity: 1; transform: none; }
