/* ==========================================================================
   ESP32 开发者指南 · 样式表
   纯手写 CSS，无外部依赖。结构：变量 → 基础 → 布局 → 组件 → 响应式
   ========================================================================== */

:root {
  --bg:        #070a12;
  --bg-2:      #0a0f1c;
  --bg-veil:   rgba(7, 10, 18, 0.82);
  --bg-veil-2: rgba(7, 10, 18, 0.94);
  --surface:   rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.065);
  --line:      rgba(255, 255, 255, 0.09);
  --line-2:    rgba(255, 255, 255, 0.18);
  --text:      #e9eef8;
  --muted:     #98a6bd;
  --accent:    #ff4d2d;
  --accent-2:  #22d3ee;
  --accent-3:  #8b5cf6;
  --ok:        #34d399;
  --warn:      #fbbf24;
  --radius:    18px;
  --radius-sm: 12px;
  --shadow:    0 24px 60px -24px rgba(0, 0, 0, 0.7);
  --container: 1180px;
  --nav-h:     68px;
  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Menlo, Consolas,
          "Courier New", monospace;
}

html[data-theme="light"] {
  --bg:        #f4f6fb;
  --bg-2:      #ffffff;
  --bg-veil:   rgba(244, 246, 251, 0.86);
  --bg-veil-2: rgba(244, 246, 251, 0.95);
  --surface:   rgba(14, 22, 44, 0.035);
  --surface-2: rgba(14, 22, 44, 0.07);
  --line:      rgba(14, 22, 44, 0.10);
  --line-2:    rgba(14, 22, 44, 0.2);
  --text:      #101829;
  --muted:     #5b6b88;
  --shadow:    0 22px 50px -26px rgba(18, 30, 60, 0.35);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }

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

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; font-weight: 700; }
h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.06rem; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
code { font-family: var(--mono); font-size: 0.92em; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; top: 10px; left: 50%; transform: translate(-50%, -200%);
  z-index: 200; background: var(--accent); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 0.9rem; transition: transform 0.25s var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ============================ 顶部导航 ============================ */

.site-header {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--bg-veil);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: var(--bg-veil-2);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.header-inner {
  position: relative;
  display: flex; align-items: center; gap: 20px;
  height: var(--nav-h);
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; color: var(--accent);
  background: linear-gradient(150deg, rgba(255, 77, 45, 0.22), rgba(34, 211, 238, 0.16));
  border: 1px solid var(--line);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-core { fill: currentColor; stroke: none; opacity: 0.85; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: 0.02em; }
.brand-text small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.16em; }

.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  position: relative; padding: 8px 12px; border-radius: 999px;
  font-size: 0.9rem; color: var(--muted);
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.is-active { color: var(--text); background: var(--surface-2); }
.nav a.is-active::after {
  content: ""; position: absolute; left: 50%; bottom: 2px;
  width: 16px; height: 2px; border-radius: 2px; transform: translateX(-50%);
  background: var(--accent);
}

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid var(--line); cursor: pointer;
  background: var(--surface); color: var(--text);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }
.nav-toggle { display: none; }

html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="light"] .ico-moon { display: none; }

.scroll-progress {
  position: absolute; left: 24px; right: 24px; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  transform: scaleX(0); transform-origin: left; border-radius: 2px;
}

/* ============================== 首屏 ============================== */

.hero { position: relative; overflow: hidden; padding: 84px 0 96px; }
.hero-bg { position: absolute; inset: 0; overflow: hidden; }
.hero-bg .orb {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5;
}
.orb-1 {
  width: 520px; height: 520px; top: -180px; right: -80px;
  background: radial-gradient(circle, rgba(255, 77, 45, 0.55), transparent 70%);
}
.orb-2 {
  width: 460px; height: 460px; bottom: -220px; left: -120px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.42), transparent 70%);
}
.orb-3 {
  width: 380px; height: 380px; top: 40%; left: 45%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.35), transparent 70%);
}
.grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 78%);
  opacity: 0.7;
}

.hero-grid {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 56px; align-items: center;
}

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.82rem; color: var(--muted); letter-spacing: 0.02em;
}
.pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.16);
  animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: 0.35; } }

.hero h1 { margin: 22px 0 18px; }
.grad {
  background: linear-gradient(100deg, var(--accent) 8%, var(--accent-2) 58%, var(--accent-3) 96%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { max-width: 34em; color: var(--muted); font-size: 1.06rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 40px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 22px; border-radius: 999px; border: 1px solid transparent;
  font-size: 0.95rem; font-weight: 600; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.2s var(--ease);
}
.btn svg { width: 17px; height: 17px; }
.btn-primary {
  background: linear-gradient(100deg, var(--accent), #ff7a45);
  color: #fff; box-shadow: 0 14px 30px -12px rgba(255, 77, 45, 0.75);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 38px -12px rgba(255, 77, 45, 0.85); }
.btn-ghost { border-color: var(--line-2); color: var(--text); background: var(--surface); }
.btn-ghost:hover { transform: translateY(-2px); background: var(--surface-2); }

.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin: 0; padding: 24px 0 0; list-style: none; border-top: 1px solid var(--line);
}
.hero-stats strong {
  display: block; font-size: 1.65rem; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.hero-stats span { display: block; font-size: 0.8rem; color: var(--muted); line-height: 1.4; }

.hero-visual { position: relative; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.board-wrap { width: min(100%, 400px); }
.board { width: 100%; height: auto; animation: float 7s ease-in-out infinite; }
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50%      { transform: translateY(-14px) rotate(0.4deg); }
}
.waves path { animation: ping 2.6s ease-out infinite; opacity: 0; }
.waves path:nth-child(2) { animation-delay: 0.25s; }
.waves path:nth-child(3) { animation-delay: 0.5s; }
@keyframes ping {
  0%   { opacity: 0; transform: translateX(-6px); }
  35%  { opacity: 0.9; }
  100% { opacity: 0; transform: translateX(6px); }
}
.led-blue { animation: pulseLed 1.2s steps(1, end) infinite; }
@keyframes pulseLed { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0.12; } }

.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mini-card {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface);
  font-size: 0.78rem; color: var(--muted); font-family: var(--mono);
}
.mini-card b { font-size: 0.86rem; color: var(--text); font-family: var(--font); }

/* ============================= 通用区块 ============================= */

.section { position: relative; padding: 96px 0; }
.section-alt { background: var(--bg-2); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section-head { max-width: 720px; margin-bottom: 48px; }
.eyebrow {
  display: inline-block; margin-bottom: 14px;
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.18em;
  color: var(--accent); text-transform: uppercase;
}
.section-sub { margin-top: 16px; color: var(--muted); font-size: 1.02rem; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; align-items: start; }
.prose p { color: var(--muted); }
.prose b { color: var(--text); }

.callout {
  display: flex; gap: 14px; margin-top: 28px; padding: 20px 22px;
  border-radius: var(--radius); border: 1px solid rgba(34, 211, 238, 0.3);
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.09), rgba(139, 92, 246, 0.07));
  color: var(--muted); font-size: 0.95rem;
}
.callout svg { flex: 0 0 auto; width: 22px; height: 22px; color: var(--accent-2); margin-top: 3px; }
.callout b { color: var(--text); }

.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.feature {
  padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.feature:hover { transform: translateY(-4px); border-color: var(--line-2); background: var(--surface-2); }
.feature h3 { margin-bottom: 7px; }
.feature p { color: var(--muted); font-size: 0.92rem; }
.feature-icon {
  display: grid; place-items: center; width: 42px; height: 42px;
  margin-bottom: 14px; border-radius: 12px; border: 1px solid var(--line);
}
.feature-icon svg { width: 21px; height: 21px; }
.i-wifi  { color: var(--accent-2); background: rgba(34, 211, 238, 0.11); }
.i-cpu   { color: var(--accent);   background: rgba(255, 77, 45, 0.11); }
.i-power { color: var(--warn);     background: rgba(251, 191, 36, 0.11); }
.i-pins  { color: var(--accent-3); background: rgba(139, 92, 246, 0.12); }
.i-sec   { color: var(--ok);       background: rgba(52, 211, 153, 0.11); }
.i-eco   { color: #60a5fa;         background: rgba(96, 165, 250, 0.12); }

/* ============================= 表格通用 ============================= */

.table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

.spec-table th[scope="row"] {
  width: 148px; text-align: left; vertical-align: top; white-space: nowrap;
  color: var(--muted); font-weight: 600;
}
.spec-table th, .spec-table td { padding: 13px 18px; border-bottom: 1px solid var(--line); }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-bottom: 0; }
.spec-table tr:hover th, .spec-table tr:hover td { background: var(--surface); }

.compare-table { min-width: 780px; }
.compare-table thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 14px 16px; text-align: left; font-size: 0.78rem;
  letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase;
  background: var(--bg-2); border-bottom: 1px solid var(--line-2);
  white-space: nowrap;
}
.compare-table td, .compare-table tbody th {
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  text-align: left; font-weight: 500; white-space: nowrap;
}
.compare-table tbody th { font-weight: 700; }
.compare-table tbody tr:last-child th, .compare-table tbody tr:last-child td { border-bottom: 0; }
.compare-table tbody tr { transition: background 0.25s var(--ease); }
.compare-table tbody tr:hover { background: var(--surface); }
.compare-table tbody tr.is-active {
  background: linear-gradient(90deg, rgba(255, 77, 45, 0.14), rgba(34, 211, 238, 0.07));
}
.compare-table tbody tr.is-active th { box-shadow: inset 3px 0 0 var(--accent); }

/* ============================== 规格区 ============================== */

.spec-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.spec-side { display: grid; gap: 20px; }

.card {
  padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
}
.card h3 { margin-bottom: 18px; font-size: 1rem; }
.note { color: var(--muted); font-size: 0.85rem; line-height: 1.65; }

.bar-list { display: grid; gap: 13px; margin-bottom: 18px; }
.bar-row { display: grid; grid-template-columns: 84px 1fr 68px; align-items: center; gap: 10px; font-size: 0.82rem; }
.bar-row > span { color: var(--muted); }
.bar-row > b { text-align: right; font-family: var(--mono); font-size: 0.78rem; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar i {
  display: block; height: 100%; width: var(--w); border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), #4f9dff);
  transform-origin: left; animation: grow 1.1s var(--ease) both;
}
.bar i.hot { background: linear-gradient(90deg, var(--accent), #ffb03a); }
@keyframes grow { from { transform: scaleX(0.02); } to { transform: scaleX(1); } }

.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.check-list li {
  position: relative; padding-left: 24px;
  color: var(--muted); font-size: 0.9rem; line-height: 1.65;
}
.check-list li::before {
  content: ""; position: absolute; left: 3px; top: 9px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(255, 77, 45, 0.15);
}
.check-list b { color: var(--text); }

/* ============================== 芯片家族 ============================== */

.chip-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.chip-card {
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding: 18px; border-radius: var(--radius); cursor: pointer; text-align: left;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-family: inherit; transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.chip-card:hover { transform: translateY(-3px); border-color: var(--line-2); background: var(--surface-2); }
.chip-card b { font-size: 1.02rem; letter-spacing: 0.01em; }
.chip-card small { color: var(--muted); font-size: 0.78rem; line-height: 1.5; }
.chip-card.is-active {
  border-color: var(--accent);
  background: linear-gradient(150deg, rgba(255, 77, 45, 0.14), rgba(34, 211, 238, 0.07));
  box-shadow: 0 16px 34px -22px rgba(255, 77, 45, 0.9);
}
.chip-tag {
  margin-bottom: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.7rem; letter-spacing: 0.05em;
}
.tag-orig   { color: var(--accent);  background: rgba(255, 77, 45, 0.13); }
.tag-ai     { color: #a78bfa;        background: rgba(139, 92, 246, 0.16); }
.tag-budget { color: var(--ok);      background: rgba(52, 211, 153, 0.14); }
.tag-matter { color: var(--accent-2);background: rgba(34, 211, 238, 0.14); }
.tag-band   { color: #60a5fa;        background: rgba(96, 165, 250, 0.14); }
.tag-thread { color: var(--warn);    background: rgba(251, 191, 36, 0.14); }
.tag-perf   { color: #f472b6;        background: rgba(244, 114, 182, 0.14); }

.chip-detail {
  padding: 28px; margin-bottom: 26px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 26px;
}
.chip-detail.is-swapping { animation: fadeSwap 0.45s var(--ease); }
@keyframes fadeSwap { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cd-main h3 { font-size: 1.35rem; margin-bottom: 8px; }
.cd-main .cd-sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }
.cd-pill {
  display: inline-flex; gap: 8px; align-items: center; margin: 0 8px 8px 0;
  padding: 6px 12px; border-radius: 999px; font-size: 0.78rem;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  font-family: var(--mono);
}
.cd-pill b { color: var(--text); font-family: var(--font); }
.cd-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cd-lists h4 { margin: 0 0 10px; font-size: 0.82rem; letter-spacing: 0.12em; color: var(--accent); text-transform: uppercase; }
.cd-lists ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.9rem; }
.cd-lists li { margin-bottom: 7px; }
.cd-lists .no-go li::marker { color: var(--warn); }

.tip-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 24px; }
.tip {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-2); background: var(--surface);
}
.tip b { font-size: 0.9rem; }
.tip span { color: var(--muted); font-size: 0.86rem; }

/* ============================== 开发板 ============================== */

.board-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.board-card {
  display: flex; flex-direction: column;
  padding: 26px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.board-card:hover { transform: translateY(-5px); border-color: var(--line-2); }
.board-card header { padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.board-chip {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
  color: var(--accent); background: rgba(255, 77, 45, 0.12);
}
.chip-s3 { color: #a78bfa; background: rgba(139, 92, 246, 0.15); }
.chip-c3 { color: var(--ok); background: rgba(52, 211, 153, 0.14); }
.chip-m5 { color: var(--accent-2); background: rgba(34, 211, 238, 0.14); }
.board-card h3 { font-size: 1.15rem; }
.board-sub { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }
.board-card ul { margin: 0 0 20px; padding-left: 20px; color: var(--muted); font-size: 0.9rem; }
.board-card li { margin-bottom: 8px; }
.board-card footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line);
}
.board-card footer b { font-family: var(--mono); font-size: 0.92rem; }
.pill-mini {
  padding: 4px 11px; border-radius: 999px; font-size: 0.74rem;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line);
}
.pill-mini.ok   { color: var(--ok);         background: rgba(52, 211, 153, 0.13); border-color: transparent; }
.pill-mini.warn { color: var(--warn);       background: rgba(251, 191, 36, 0.13); border-color: transparent; }

/* ============================== 开发环境 ============================== */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 20px; }
.tool-card {
  display: flex; flex-direction: column;
  padding: 26px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.tool-card:hover { transform: translateY(-5px); border-color: var(--line-2); }
.tool-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.tool-badge {
  align-self: flex-start; padding: 4px 11px; border-radius: 8px;
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em;
}
.tb-arduino { color: #4cc2ff; background: rgba(76, 194, 255, 0.14); }
.tb-idf     { color: var(--accent); background: rgba(255, 77, 45, 0.13); }
.tb-pio     { color: #f97316; background: rgba(249, 115, 22, 0.14); }
.tb-mpy     { color: var(--ok); background: rgba(52, 211, 153, 0.13); }
.tb-eco     { color: #a78bfa; background: rgba(139, 92, 246, 0.15); }
.tb-web     { color: var(--accent-2); background: rgba(34, 211, 238, 0.14); }
.tool-card h3 { font-size: 1.1rem; }
.tool-card > p { color: var(--muted); font-size: 0.93rem; }
.tool-card code {
  padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text);
}
.tool-meta {
  display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 6px 0 14px;
  padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: 0.82rem; color: var(--muted);
}
.tool-meta b { color: var(--text); margin-left: 4px; }
.tool-meta .lvl { font-family: var(--mono); letter-spacing: 1px; }
.l1 { color: var(--ok); }
.l2 { color: var(--warn); }
.l3 { color: var(--accent); }
.tool-note { color: var(--muted); font-size: 0.84rem; margin-top: auto; padding-top: 4px; opacity: 0.9; }

/* ============================== 代码区 ============================== */

.code-shell {
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line); background: #0b1020;
  box-shadow: var(--shadow);
}
html[data-theme="light"] .code-shell { background: #0e1428; }

.code-tabs {
  display: flex; gap: 4px; padding: 10px; overflow-x: auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.03);
  scrollbar-width: thin;
}
.code-tab {
  flex: 0 0 auto; padding: 9px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  color: #93a1bd; font-family: inherit; font-size: 0.87rem;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.code-tab:hover { color: #e9eef8; background: rgba(255, 255, 255, 0.06); }
.code-tab.is-active { color: #fff; background: rgba(255, 77, 45, 0.2); border-color: rgba(255, 77, 45, 0.45); }

.code-body { position: relative; }
.code-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--mono); font-size: 0.78rem; color: #93a1bd;
}
.code-file { color: #e9eef8; }
.code-lang { color: #6b7a99; }
.code-lang::before { content: "·"; margin-right: 8px; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 7px; margin-left: auto;
  padding: 7px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05);
  color: #cbd6ea; font-family: inherit; font-size: 0.78rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn.is-done { color: var(--ok); border-color: rgba(52, 211, 153, 0.5); }

.code-panes { position: relative; }
.code-pane { display: none; }
.code-pane.is-active { display: block; animation: fadeSwap 0.35s var(--ease); }
.code-pane pre {
  margin: 0; padding: 22px 18px 26px; overflow-x: auto;
  font-family: var(--mono); font-size: 0.85rem; line-height: 1.75;
  color: #cfd8ea; tab-size: 2;
}
.code-pane code { font-size: inherit; white-space: pre; }

.tok-c { color: #5f7590; font-style: italic; }
.tok-s { color: #7ee0b8; }
.tok-p { color: #d08bff; }
.tok-k { color: #ff8a70; }
.tok-n { color: #ffd479; }
.tok-f { color: #6fc6ff; }

/* ============================== 上手步骤 ============================== */

.timeline { position: relative; margin: 0; padding: 0 0 0 64px; list-style: none; }
.timeline::before {
  content: ""; position: absolute; left: 21px; top: 12px; bottom: 12px;
  width: 2px; border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2), transparent);
  opacity: 0.5;
}
.timeline li { position: relative; margin-bottom: 22px; }
.timeline li:last-child { margin-bottom: 0; }
.step-no {
  position: absolute; left: -64px; top: 2px;
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 14px; font-family: var(--mono); font-size: 1rem; font-weight: 700;
  color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2);
  box-shadow: 0 0 0 6px var(--bg);
}
.section-alt .step-no { box-shadow: 0 0 0 6px var(--bg-2); }
.step-card {
  padding: 22px 24px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}
.step-card:hover { transform: translateX(4px); border-color: var(--line-2); }
.step-card h3 { margin-bottom: 8px; }
.step-card p { color: var(--muted); font-size: 0.94rem; }
.step-card b { color: var(--text); }
.step-card code {
  padding: 2px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text);
}
.step-tip {
  margin-top: 14px; padding: 11px 14px; border-radius: 10px;
  background: rgba(34, 211, 238, 0.08); border-left: 3px solid var(--accent-2);
  color: var(--muted); font-size: 0.85rem;
}
.url-chip {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 14px 0; padding: 12px 14px; border-radius: 10px;
  border: 1px dashed var(--line-2); background: var(--surface-2);
}
.url-chip code {
  flex: 1 1 260px; word-break: break-all; background: none; padding: 0;
  font-size: 0.8rem; color: var(--accent-2);
}
.copy-mini {
  padding: 5px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font-family: inherit; font-size: 0.78rem;
}
.copy-mini:hover { background: var(--surface-2); }

/* ============================== 应用场景 ============================== */

.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); gap: 18px; }
.app-card {
  padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.app-card:hover { transform: translateY(-5px); border-color: var(--line-2); background: var(--surface-2); }
.app-card h3 { margin: 16px 0 8px; }
.app-card p { color: var(--muted); font-size: 0.9rem; }
.app-icon {
  display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 14px; color: var(--accent-2);
  background: linear-gradient(150deg, rgba(34, 211, 238, 0.16), rgba(139, 92, 246, 0.12));
  border: 1px solid var(--line);
}
.app-icon svg { width: 23px; height: 23px; }

/* ================================ FAQ ================================ */

.faq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.faq {
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); overflow: hidden;
  transition: border-color 0.25s var(--ease);
}
.faq[open] { border-color: var(--line-2); }
.faq summary {
  position: relative; padding: 18px 52px 18px 22px; cursor: pointer;
  font-weight: 600; font-size: 0.96rem; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 1.25rem; color: var(--accent);
  transition: transform 0.3s var(--ease);
}
.faq[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--accent-2); }
.faq-body { padding: 0 22px 20px; color: var(--muted); font-size: 0.9rem; }
.faq-body p { margin: 0; }
.faq-body b { color: var(--text); }

/* ============================== 资源链接 ============================== */

.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.res-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 24px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.res-card:hover {
  transform: translateY(-5px); border-color: rgba(255, 77, 45, 0.5);
  box-shadow: 0 20px 40px -26px rgba(255, 77, 45, 0.7);
}
.res-kind {
  align-self: flex-start; padding: 3px 10px; border-radius: 999px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em;
  color: var(--accent-2); background: rgba(34, 211, 238, 0.12);
}
.res-card h3 { font-size: 1.05rem; }
.res-card p { color: var(--muted); font-size: 0.89rem; }
.res-link { margin-top: auto; padding-top: 10px; font-family: var(--mono); font-size: 0.78rem; color: var(--accent); }

/* =============================== 页脚 =============================== */

.site-footer {
  padding: 60px 0 46px;
  border-top: 1px solid var(--line); background: var(--bg-2);
}
.footer-inner { display: grid; gap: 28px; }
.footer-brand { display: flex; gap: 16px; align-items: flex-start; }
.footer-brand strong { font-size: 1.05rem; }
.footer-brand p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; max-width: 46ch; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-nav a { color: var(--muted); font-size: 0.88rem; }
.footer-nav a:hover { color: var(--accent); }
.footer-note {
  margin: 0; padding-top: 24px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.8rem; line-height: 1.75; max-width: 88ch;
}

/* ========================= 回到顶部 / 提示 ========================= */

.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 90;
  display: grid; place-items: center; width: 46px; height: 46px;
  border-radius: 14px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--surface-2); }
.to-top svg { width: 20px; height: 20px; }

.toast {
  position: fixed; left: 50%; bottom: 30px; z-index: 200;
  padding: 12px 22px; border-radius: 999px;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-2); box-shadow: var(--shadow);
  font-size: 0.88rem;
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============================ 滚动显现 ============================ */

.reveal { opacity: 0; transform: translateY(20px); }
.reveal.is-visible {
  opacity: 1; transform: none;
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

/* ============================== 响应式 ============================== */

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 48px; }
  .hero-visual { order: -1; }
  .board-wrap { width: min(100%, 330px); }
  .split, .spec-layout, .chip-detail { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  :root { --nav-h: 62px; }
  .nav {
    position: fixed; inset: var(--nav-h) 0 auto; flex-direction: column; gap: 4px;
    margin: 0; padding: 16px 24px 26px;
    background: var(--bg-2); border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(-120%); transition: transform 0.35s var(--ease);
  }
  .nav.is-open { transform: none; }
  .nav a { padding: 12px 14px; border-radius: 12px; font-size: 1rem; }
  .nav a.is-active::after { display: none; }
  .nav-toggle { display: grid; }
  .header-actions { margin-left: auto; }
  .scroll-progress { left: 0; right: 0; }
}

@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .section { padding: 68px 0; }
  .hero { padding: 56px 0 68px; }
  /* 小屏上让标题先出现，芯片图放在文字之后 */
  .hero-visual { order: 0; }
  .board-wrap { width: min(100%, 300px); }
  .hero-actions { margin: 24px 0 32px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); gap: 20px 14px; }
  .hero-stats strong { font-size: 1.4rem; }
  .feature-grid, .cd-lists { grid-template-columns: 1fr; }
  .container { padding: 0 18px; }

  .timeline { padding-left: 50px; }
  .timeline::before { left: 15px; }
  .step-no { left: -50px; width: 34px; height: 34px; border-radius: 11px; font-size: 0.86rem; }
  .step-card { padding: 18px; }

  .spec-table th[scope="row"] { width: auto; white-space: normal; }
  .spec-table th, .spec-table td { padding: 11px 14px; }
  .bar-row { grid-template-columns: 72px 1fr 60px; font-size: 0.78rem; }
  .code-tab { padding: 8px 13px; font-size: 0.82rem; }
  .code-pane pre { padding: 18px 14px 22px; font-size: 0.78rem; }
  .to-top { right: 16px; bottom: 16px; }
}

@media (max-width: 420px) {
  .hero-badges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .mini-card { padding: 9px 10px; font-size: 0.72rem; }
  .mini-card b { font-size: 0.78rem; }
  .brand-text small { display: none; }
  .board-card, .tool-card, .app-card, .res-card, .card { padding: 20px; }
}

@media print {
  .site-header, .to-top, .toast, .hero-bg, .code-tabs, .copy-btn { display: none; }
  body { background: #fff; color: #000; }
  .reveal { opacity: 1; transform: none; }
  .code-pane { display: block !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
