/* ================================================================
   Arduino 造物实验室 · 板块样式
   配色与首页 duming.work 完全对齐（S61）：
   浅色：奶油底 #fff7e8 / 面板 #ffffff / 强调橙 #f0811b / 暖金 #a85b08
   深色：深紫底 #1b1622 / 面板 #2a2236 / 强调金 #ffc65c
   动效借鉴旧 OJ（/oj/）：hero 轨道环、卡片悬浮抬升+暖光、进度环、
   骨架 shimmer、按钮按压回弹、tab 下划线、quiz 反馈弹跳、串口运行脉冲、
   页面入场错峰。顶栏由 dm-shell.js 统一注入。
   ================================================================ */
:root {
  --a-bg: #fff7e8; --a-bg2: #fffdf8; --a-panel: #ffffff;
  --a-ink: #2c2118; --a-ink2: #6e5a43; --a-ink3: #9c876d;
  --a-line: #f0dfc4; --a-line2: #e2c99f;
  --a-acc: #f0811b; --a-acc2: #ff6535; --a-gold: #a85b08;
  --a-teal: #1f8a6a; --a-soft: #fff2dc;
  --a-chip: #fff2dc;
  --a-blob-o: rgba(255,150,60,.22);
  --a-blob-g: rgba(40,200,160,.18);
  --a-dot: rgba(180,140,90,.14);
  --a-glow: 0 12px 30px rgba(126,84,34,.16), 0 2px 8px rgba(126,84,34,.06);
  --a-glow-acc: 0 14px 34px rgba(240,129,27,.22), 0 4px 12px rgba(240,129,27,.12);
  --a-r: 12px; --a-r-sm: 8px; --a-r-lg: 16px;
  --a-shadow: 0 1px 2px rgba(126,84,34,.06), 0 6px 18px rgba(126,84,34,.06);
  --a-shadow2: 0 2px 6px rgba(126,84,34,.08), 0 12px 30px rgba(126,84,34,.12);
  --a-code-bg: #fbf3e4; --a-code-ink: #3a2f1e;
  --a-side-bg: #fff7e8;
  --a-nav-h: 54px;
}
html[data-dm-theme="dark"] {
  --a-bg: #1b1622; --a-bg2: #241d2e; --a-panel: #2a2236;
  --a-ink: #fdf3e6; --a-ink2: #d3c1a8; --a-ink3: #a08f79;
  --a-line: #413650; --a-line2: #5c4b6f;
  --a-acc: #ffc65c; --a-acc2: #ff8a3d; --a-gold: #ffc65c;
  --a-teal: #7fd49a; --a-soft: #33283f;
  --a-chip: #33283f;
  --a-blob-o: rgba(255,150,60,.20);
  --a-blob-g: rgba(40,200,160,.16);
  --a-dot: rgba(255,220,170,.08);
  --a-glow: 0 12px 32px rgba(0,0,0,.40), 0 2px 10px rgba(0,0,0,.28);
  --a-glow-acc: 0 14px 36px rgba(255,198,92,.18), 0 4px 14px rgba(0,0,0,.32);
  --a-shadow: 0 1px 2px rgba(0,0,0,.30), 0 6px 18px rgba(0,0,0,.26);
  --a-shadow2: 0 2px 6px rgba(0,0,0,.36), 0 14px 34px rgba(0,0,0,.40);
  --a-code-bg: #241d2e; --a-code-ink: #ffe1a8;
  --a-side-bg: #1b1622;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--a-bg); color: var(--a-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65; -webkit-font-smoothing: antialiased;
  /* 对齐首页：细腻点阵 + 边缘暖光 */
  background-image:
    radial-gradient(var(--a-dot, rgba(180,140,90,.14)) 1px, transparent 1px),
    radial-gradient(var(--a-blob-o) 0, transparent 42%),
    radial-gradient(var(--a-blob-g) 0, transparent 46%);
  background-size: 22px 22px, 100% 100%, 100% 100%;
  background-position: 0 0, -20% -10%, 120% 110%;
  background-attachment: fixed;
}
html[data-dm-theme="dark"] body {
  background-image:
    radial-gradient(var(--a-dot, rgba(255,220,170,.08)) 1px, transparent 1px),
    radial-gradient(var(--a-blob-o) 0, transparent 42%),
    radial-gradient(var(--a-blob-g) 0, transparent 46%);
  background-size: 24px 24px, 100% 100%, 100% 100%;
}
a { color: var(--a-gold); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* dm-shell 注入固定顶栏后，body 已由 dm-shell.css 加 padding-top；
   本板块用「左侧课程目录 + 右侧主区」两栏，与编程课一致。 */
.ard-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: calc(100vh - var(--a-nav-h)); align-items: start; }

/* ---------- 左侧课程目录（对齐编程课侧栏） ---------- */
.ard-side { position: sticky; top: var(--a-nav-h); height: calc(100vh - var(--a-nav-h)); overflow-y: auto;
  background: var(--a-side-bg); border-right: 1px solid var(--a-line); padding: 14px 12px 26px;
  backdrop-filter: blur(6px); }
.ard-side-head { padding: 4px 8px 12px; border-bottom: 1px solid var(--a-line); margin-bottom: 10px; }
.ard-side-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; color: var(--a-ink); }
.ard-side-title .ard-side-ico { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--a-acc), var(--a-acc2)); color: #fff; flex: none;
  box-shadow: 0 3px 8px rgba(240,129,27,.28); }
html[data-dm-theme="dark"] .ard-side-title .ard-side-ico { color: #2c2118; }
.ard-side-title b { color: var(--a-gold); }
.ard-side-sub { font-size: 11.5px; color: var(--a-ink3); margin: 6px 0 0 38px; }
.ard-side-prog { display: flex; align-items: center; gap: 7px; margin: 10px 0 0 38px; }
.ard-pill { font-size: 11.5px; font-weight: 700; color: var(--a-acc); background: var(--a-chip);
  border: 1px solid var(--a-line2); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.ard-side-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.ard-side-nav a { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: var(--a-r-sm);
  font-size: 13px; font-weight: 600; color: var(--a-ink2); transition: background .16s, color .16s, transform .16s; }
.ard-side-nav a:hover { background: var(--a-soft); color: var(--a-acc); text-decoration: none; transform: translateX(2px); }
.ard-side-nav a.cur { background: var(--a-soft); color: var(--a-acc); box-shadow: inset 2px 0 0 var(--a-acc); }
.ard-side-nav a .ico { width: 16px; text-align: center; opacity: .85; }

.ard-side-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; font-weight: 800; letter-spacing: 1px;
  color: var(--a-ink3); display: flex; align-items: center; gap: 6px; }
.ard-side-group .dot { width: 8px; height: 8px; border-radius: 3px; background: var(--sc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 18%, transparent); }
.ard-side-group .cnt { margin-left: auto; font-weight: 700; opacity: .8; }
.ard-lv { position: relative; display: block; padding: 8px 10px 8px 34px; border-radius: var(--a-r-sm);
  color: var(--a-ink2); border: 1px solid transparent; transition: background .16s, transform .16s, border-color .16s; }
.ard-lv:hover { background: var(--a-soft); text-decoration: none; transform: translateX(2px); }
.ard-lv.cur { background: var(--a-soft); border-color: var(--a-line2); color: var(--a-ink); box-shadow: inset 2px 0 0 var(--a-acc); }
.ard-lv-no { position: absolute; left: 8px; top: 9px; font-size: 11px; font-weight: 800; color: var(--a-ink3); width: 20px; text-align: center; }
.ard-lv.cur .ard-lv-no { color: var(--a-acc); }
.ard-lv-body b { display: block; font-size: 13px; font-weight: 700; line-height: 1.35; }
.ard-lv-body small { display: block; font-size: 11px; color: var(--a-ink3); line-height: 1.35; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ard-lv-done { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--a-teal); font-size: 12px; font-weight: 800;
  animation: ardPopIn .25s ease; }
.ard-lv.cur .ard-lv-done { color: var(--a-teal); }

.ard-side-foot { margin-top: 16px; padding: 10px 8px 0; border-top: 1px solid var(--a-line); }
.ard-side-foot a { font-size: 12px; color: var(--a-ink3); transition: color .16s; }
.ard-side-foot a:hover { color: var(--a-acc); }

/* ---------- 右侧主区 ---------- */
.ard-main { min-width: 0; }
#app { max-width: 1120px; margin: 0 auto; padding: clamp(16px, 3vw, 30px) clamp(14px, 3vw, 30px) 50px; }
.ard-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 14.5px; font-weight: 700; padding: 11px 20px; border-radius: 12px; border: 1px solid transparent;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s; }
.ard-btn:hover { text-decoration: none; transform: translateY(-2px); }
.ard-btn:active { transform: translateY(0) scale(.98); }
.ard-btn.primary { color: #fff; background: linear-gradient(135deg, var(--a-acc), var(--a-acc2)); box-shadow: var(--a-glow-acc); }
html[data-dm-theme="dark"] .ard-btn.primary { color: #2c2118; }
.ard-btn.primary:hover { box-shadow: 0 18px 40px rgba(240,129,27,.34); }
.ard-btn.ghost { color: var(--a-ink2); background: var(--a-panel); border-color: var(--a-line2); }
.ard-btn.ghost:hover { color: var(--a-acc); border-color: var(--a-acc); box-shadow: var(--a-shadow); }
.ard-btn.sm { padding: 8px 14px; font-size: 13px; }
.ard-crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--a-ink3); margin-bottom: 16px; }
.ard-crumb b { color: var(--a-ink); }
.ard-page-head { margin-bottom: 24px; }
.ard-page-head h1 { font-size: clamp(26px, 4vw, 36px); margin: 0 0 6px; }
.ard-page-head p { color: var(--a-ink2); margin: 0; }
.ard-empty { padding: 60px 0; text-align: center; color: var(--a-ink2); }
.ard-panel { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: var(--a-r-lg);
  box-shadow: var(--a-shadow); overflow: hidden; transition: box-shadow .2s, border-color .2s; }
.ard-panel:hover { box-shadow: var(--a-shadow2); }
.ard-panel-h { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 17px; border-bottom: 1px solid var(--a-line); }
.ard-panel-h h2 { font-size: 15px; margin: 0; font-weight: 800; }
.ard-panel-tag { font-size: 11.5px; color: var(--a-ink3); }

/* ---------- 首页 Hero（对齐首页质感 + OJ 轨道环动效） ---------- */
.ard-home { animation: ardFadeUp .4s ease both; }
@keyframes ardFadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes ardShimmer { 100% { transform: translateX(100%); } }
@keyframes ardSpin { to { transform: rotate(360deg); } }
@keyframes ardOrbit { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes ardPulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes ardPopIn { 0% { opacity: 0; transform: scale(.92); } 60% { transform: scale(1.03); } 100% { opacity: 1; transform: scale(1); } }
@keyframes ardRowIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.ard-hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 28px; align-items: center;
  background:
    radial-gradient(circle at 90% 12%, var(--a-blob-o), transparent 45%),
    radial-gradient(circle at 8% 100%, var(--a-blob-g), transparent 50%),
    linear-gradient(135deg, var(--a-soft), var(--a-panel));
  border: 1px solid var(--a-line2); border-radius: 22px; padding: clamp(24px, 4vw, 46px);
  box-shadow: var(--a-glow); position: relative; overflow: hidden; }
.ard-kicker { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 2px; color: var(--a-acc);
  background: var(--a-panel); border: 1px solid var(--a-line2); padding: 5px 12px; border-radius: 999px;
  box-shadow: 0 1px 3px rgba(126,84,34,.06); }
.ard-hero-txt h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.15; margin: 16px 0 14px; letter-spacing: -1px;
  animation: ardRowIn .5s ease .05s both; }
.ard-hero-txt h1 em { font-style: normal; color: var(--a-acc); }
.ard-hero-txt > p { color: var(--a-ink2); font-size: 15.5px; max-width: 520px; margin: 0 0 22px;
  animation: ardRowIn .5s ease .1s both; }
.ard-hero-cta { display: flex; gap: 12px; flex-wrap: wrap; animation: ardRowIn .5s ease .15s both; }
.ard-hero-stats { display: flex; gap: 22px; margin-top: 26px; flex-wrap: wrap; animation: ardRowIn .5s ease .2s both; }
.ard-hero-stats span { font-size: 13px; color: var(--a-ink2); }
.ard-hero-stats b { font-size: 22px; color: var(--a-ink); margin-right: 3px; }
.ard-hero-art { display: grid; place-items: center; animation: ardPopIn .6s ease .1s both; position: relative; }
.ard-hero-orbit { position: relative; width: 100%; max-width: 320px; display: grid; place-items: center; }
.ard-hero-orbit i { position: absolute; left: 50%; top: 50%; border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--a-acc) 28%, transparent); transform: translate(-50%, -50%); pointer-events: none; }
.ard-hero-orbit i:nth-child(1) { width: 92%; height: 92%; animation: ardOrbit 18s linear infinite; }
.ard-hero-orbit i:nth-child(2) { width: 62%; height: 62%; border-color: color-mix(in srgb, var(--a-acc2) 34%, transparent); animation: ardOrbit 12s linear infinite reverse; }
.ard-hero-orbit i:nth-child(3) { width: 12px; height: 12px; background: var(--a-acc); border: none;
  box-shadow: 0 0 16px var(--a-acc); top: 4%; left: 80%; }
.ard-hero-orbit i:nth-child(1)::after, .ard-hero-orbit i:nth-child(2)::after {
  content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--a-acc2); transform: translateX(-50%); }
.ard-hero-svg { width: 100%; max-width: 320px; filter: drop-shadow(0 14px 22px rgba(240,129,27,.18)); }
.hg-bg { fill: var(--a-soft); }
html[data-dm-theme="dark"] .hg-bg { fill: #3a2d4a; }
.hg-led { animation: ledPulse 1.6s ease-in-out infinite; }
@keyframes ledPulse { 0%,100% { opacity: .5; } 50% { opacity: 1; filter: drop-shadow(0 0 10px #ffd76a); } }

/* 快捷入口 */
.ard-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0 32px; }
.ard-quick a { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: var(--a-panel);
  border: 1px solid var(--a-line); border-radius: 16px; box-shadow: var(--a-shadow); color: var(--a-ink);
  transition: transform .18s, border-color .18s, box-shadow .18s; position: relative; overflow: hidden; }
.ard-quick a::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent, color-mix(in srgb, var(--a-acc) 8%, transparent), transparent);
  opacity: 0; transition: opacity .2s; }
.ard-quick a:hover { transform: translateY(-3px); border-color: var(--a-acc); box-shadow: var(--a-glow-acc); text-decoration: none; }
.ard-quick a:hover::before { opacity: 1; }
.ard-quick a span { font-size: 26px; transition: transform .2s; }
.ard-quick a:hover span { transform: scale(1.12) rotate(-4deg); }
.ard-quick a b { display: block; font-size: 14px; }
.ard-quick a small { color: var(--a-ink3); font-size: 11.5px; }
.ard-learn-head { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 18px; }
.ard-learn-head h2 { font-size: 22px; margin: 0; }
.ard-learn-head span { color: var(--a-ink3); font-size: 13px; }

/* 阶段 + 卡片 */
.ard-stage-block { margin-bottom: 30px; }
.ard-stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.ard-stage-dot { width: 11px; height: 11px; border-radius: 4px; background: var(--sc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 18%, transparent);
  animation: ardPulse 2.4s ease-in-out infinite; }
.ard-stage-head h2 { font-size: 18px; margin: 0; }
.ard-stage-desc { font-size: 12.5px; color: var(--a-ink3); }
.ard-stage-count { margin-left: auto; font-size: 12.5px; font-weight: 700; color: var(--a-acc); }
.ard-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.ard-card { position: relative; display: flex; align-items: center; gap: 12px; min-height: 88px;
  padding: 14px 16px; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 16px;
  box-shadow: var(--a-shadow); color: var(--a-ink);
  transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s, border-color .18s;
  overflow: hidden; }
.ard-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 20%, color-mix(in srgb, var(--a-acc) 10%, transparent), transparent 55%); opacity: 0; transition: opacity .2s; }
.ard-card:hover { transform: translateY(-3px); box-shadow: var(--a-glow-acc); border-color: var(--a-acc); text-decoration: none; }
.ard-card:hover::before { opacity: 1; }
.ard-card-ico { flex: none; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center;
  font-size: 23px; background: linear-gradient(135deg, var(--a-soft), transparent); border: 1px solid var(--a-line);
  transition: transform .2s; }
.ard-card:hover .ard-card-ico { transform: scale(1.08) rotate(-3deg); }
.ard-card-no { position: absolute; top: 9px; right: 13px; font-size: 11px; font-weight: 800; color: var(--a-ink3); opacity: .6; }
.ard-card-body { min-width: 0; position: relative; z-index: 1; }
.ard-card-body b { display: block; font-size: 14.5px; }
.ard-card-body small { display: block; font-size: 11.5px; color: var(--a-ink3); line-height: 1.4; margin-top: 2px; }
.ard-card-arrow { margin-left: auto; color: var(--a-acc); font-weight: 800; opacity: 0; transform: translateX(-4px); transition: opacity .18s, transform .18s; position: relative; z-index: 1; }
.ard-card:hover .ard-card-arrow { opacity: 1; transform: translateX(0); }
.ard-card-done { position: absolute; top: -6px; left: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--a-teal); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(31,138,106,.4); animation: ardPopIn .3s ease; }

/* ---------- 课程页 ---------- */
.ard-lhead { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap;
  animation: ardFadeUp .4s ease both; }
.ard-lno { display: inline-block; font-size: 12px; font-weight: 800; color: var(--a-acc); letter-spacing: 1px;
  background: var(--a-chip); padding: 3px 10px; border-radius: 999px; border: 1px solid var(--a-line2); }
.ard-lhead h1 { font-size: clamp(24px, 4vw, 34px); margin: 4px 0 6px; }
.ard-lhead p { color: var(--a-ink2); margin: 0; }
.ard-lnav { display: flex; gap: 8px; }
.ard-workspace { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.ard-leftcol, .ard-rightcol { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 课程页：完整接线图跨满整行（板卡可放大、排针孔拉开），信息+代码在下方左右排 */
.lesson-ws { grid-template-columns: 1fr 1fr; align-items: stretch; }
.lesson-ws .wiring-panel { grid-column: 1 / -1; }
/* 两栏等高、底部对齐：信息栏用 tabbody 填充剩余高度；代码栏编辑器固定高度、串口区自然堆叠 */
.lesson-ws .info-panel, .lesson-ws .code-panel { display: flex; flex-direction: column; }
.lesson-ws .info-panel .ard-tabbody { flex: 1; }

/* 3D 板卡舞台 */
.board-panel .ard-panel-h { position: relative; z-index: 2; }
.ard-stage { position: relative; height: 340px; overflow: hidden; perspective: 1000px;
  background: radial-gradient(circle at 50% 55%, var(--a-soft), transparent 68%); cursor: grab; outline: none; }
.ard-stage:active { cursor: grabbing; }
.ard-stage:focus-visible { box-shadow: inset 0 0 0 3px var(--a-acc); }
.ard-board3d { position: absolute; top: 52%; left: 50%; width: 90%; transform-style: preserve-3d;
  transform-origin: center; will-change: transform; }
/* Wokwi 真实板卡容器：内含 <wokwi-arduino-uno> 与按百分比定位的热点 */
.ard-wokwi-board { position: relative; width: 100%; height: 230px;
  display: flex; align-items: center; justify-content: center; }
.ard-wokwi-board wokwi-arduino-uno { width: 100%; max-width: 430px; height: auto;
  display: block; pointer-events: none; filter: drop-shadow(0 10px 14px rgba(0,0,0,.18)); }
html[data-dm-theme="dark"] .ard-wokwi-board wokwi-arduino-uno { filter: drop-shadow(0 10px 16px rgba(0,0,0,.5)); }
.ard-wokwi-board.current-on { box-shadow: 0 0 0 3px rgba(255,206,92,.55), 0 0 26px 6px rgba(255,206,92,.45);
  border-radius: 18px; transition: box-shadow .25s; }
/* 热点（div + 百分比定位，随 3D 视角一起转） */
.hs { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; cursor: pointer; z-index: 4; }
.hs-ring, .hs-dot { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); border-radius: 50%; }
.hs-ring { width: 22px; height: 22px; background: rgba(255,198,92,.16); border: 2px solid var(--a-acc); transition: background .2s; }
.hs-dot { width: 8px; height: 8px; background: var(--a-acc); }
.hs-label { position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; font-weight: 700; color: var(--a-ink); white-space: nowrap;
  background: color-mix(in srgb, var(--a-panel) 80%, transparent); padding: 1px 5px; border-radius: 5px; }
html[data-dm-theme="dark"] .hs-label { color: #f4e9d8; background: #2a2234; }
.hs:hover .hs-ring, .hs:focus .hs-ring, .hs:focus-visible .hs-ring { background: rgba(255,198,92,.4); }
.ard-view-tools { position: absolute; right: 10px; top: 10px; z-index: 3; display: flex; gap: 4px; flex-wrap: wrap; max-width: 120px; justify-content: flex-end; }
.ard-view-tools button { border: 1px solid var(--a-line2); background: color-mix(in srgb, var(--a-panel) 88%, transparent);
  color: var(--a-ink); border-radius: 8px; min-width: 26px; height: 26px; font-size: 13px; padding: 0 6px; }
.ard-view-tools button:hover { background: var(--a-acc); color: #fff; border-color: var(--a-acc); }
.ard-stage-hint { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px;
  color: var(--a-ink3); margin: 0; pointer-events: none; }
.ard-hotspot-card { position: absolute; z-index: 5; width: 200px; padding: 11px 13px; background: var(--a-panel);
  border: 1px solid var(--a-acc); border-radius: 12px; box-shadow: var(--a-shadow2); }
.ard-hotspot-card b { display: block; font-size: 13px; color: var(--a-gold); }
.ard-hotspot-card span { font-size: 11.5px; color: var(--a-ink2); line-height: 1.5; }

/* 完整接线图（真实大主板 + 真实元件 + 连线） */
.wiring-panel { padding: 14px 16px 16px; }
.wiring-panel .ard-panel-h { padding: 0 0 10px; }
.wiring-stage { position: relative; background: var(--a-bg2); border: 1px solid var(--a-line);
  border-radius: 12px; padding: 16px; overflow: hidden;
  display: flex; align-items: stretch; gap: 0; min-height: 440px; }
/* 左侧：真实 Wokwi 大主板（放大，让学生看清排针/芯片/丝印） */
.wiring-board { flex: 0 0 auto; width: 46%; display: flex; align-items: center; justify-content: center;
  align-self: stretch; position: relative; z-index: 1; padding: 0 4px; }
.wiring-board .wiring-uno { width: 100%; max-width: 500px; height: auto; display: block;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,.22)); }
html[data-dm-theme="dark"] .wiring-board .wiring-uno { filter: drop-shadow(0 12px 22px rgba(0,0,0,.5)); }
/* 中间：导线通道（让彩色跳线有空间铺开、彼此分开，看清接法） */
.wiring-channel { flex: 0 0 150px; position: relative; z-index: 0;
  background: radial-gradient(circle at 50% 50%, rgba(126,84,34,.05), transparent 70%); }
/* 右侧：真实元件区（bench，含交互控件；元件放大以便看清） */
.wiring-elzone { flex: 1 1 0; min-width: 200px; position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: center; }
.wiring-elzone .bk-head { display: none; }
.wiring-elzone .bk-body { min-height: 0; padding: 6px 4px; }
.wiring-elzone .bk-wokwi { flex-direction: column; align-items: flex-start; gap: 22px; }
.wiring-elzone .bk-ctl { width: 100%; margin-top: 6px; }
.wiring-elzone .bk-cap { max-width: 210px; }
/* 接线图区：真实元件放大（仅此处生效，不影响自由实验室） */
.wiring-elzone .bk-wokwi wokwi-led { width: 68px; height: 68px; }
.wiring-elzone .bk-wokwi wokwi-rgb-led { width: 108px; height: 108px; }
.wiring-elzone .bk-wokwi wokwi-potentiometer { width: 184px; height: 184px; }
.wiring-elzone .bk-wokwi wokwi-servo { width: 210px; height: 210px; }
.wiring-elzone .bk-wokwi wokwi-buzzer { width: 112px; height: 112px; }
.wiring-elzone .bk-wokwi wokwi-stepper-motor { width: 184px; height: 184px; }
.wiring-elzone .bk-wokwi wokwi-pushbutton { width: 92px; height: 92px; }
.wiring-elzone .bk-wokwi wokwi-photoresistor-sensor { width: 200px; height: 150px; }
.wiring-elzone .bk-wokwi wokwi-ntc-temperature-sensor { width: 200px; height: 150px; }
/* 导线叠层：绝对定位铺满整个 stage，按实测像素画（线走中间通道） */
.wiring-wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; overflow: visible; }
.w-wire { fill: none; stroke-width: 2.8; stroke-linecap: round; opacity: .92; }
.w-wire-hit { fill: none; stroke: transparent; stroke-width: 16; stroke-linecap: round; pointer-events: stroke; }
.w-wire-dot { stroke: var(--a-bg2); stroke-width: 1.4; }
.w-label rect { opacity: .97; }
/* 精确接线：主板侧彩色引脚标签 + 支路限流电阻 + 元件侧端子极性标签 */
.w-pinlabel rect { opacity: .97; }
.w-pinlabel-t { fill: #fff; font-size: 10px; font-weight: 700; font-family: ui-monospace, monospace; }
/* 脚号标签引线（同排多脚分车道，斜线连接，避免标签重叠） */
.w-pin-lead { stroke-width: 1.4; opacity: .8; stroke-linecap: round; }
.w-res-zig { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.w-res-val { font-size: 9px; font-weight: 700; fill: var(--a-ink2); font-family: ui-monospace, monospace; }
.w-res-box { fill: var(--a-panel); stroke-width: 1.2; }
.w-term-label-t { font-size: 10.5px; font-weight: 700; fill: var(--a-ink); paint-order: stroke; stroke: var(--a-bg2); stroke-width: 3px; }
/* 为什么 220Ω 说明 */
.wiring-res-why { font-size: 11px; color: var(--a-ink3); line-height: 1.5; max-width: 520px; }
/* 接线桩（主板针座 / 元件端子座）：让导线端点落在实物边缘的明确点上 */
.w-socket { fill: color-mix(in srgb, var(--a-ink) 16%, transparent); stroke: var(--a-line2); stroke-width: 1.2; }
.w-socket-cap { fill: color-mix(in srgb, var(--a-ink) 6%, transparent); }
/* ② 电流流动：在导线之上叠一层虚线，dashoffset 循环前进，跑起来"有电流" */
.w-flow { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; opacity: 0; pointer-events: none;
  stroke-dasharray: 4 10; }
.wiring-stage.flow-on .w-flow { opacity: .9; animation: wflow 0.9s linear infinite; }
.wiring-stage.flow-on .w-wire { opacity: .55; }
@keyframes wflow { to { stroke-dashoffset: -14; } }
html[data-dm-theme="dark"] .w-flow { stroke: #fff7d6; }
/* ④ callout 小标注框（真实元件旁一句话解释） */
.w-callout { position: absolute; z-index: 4; max-width: 150px; background: color-mix(in srgb, var(--a-panel) 92%, transparent);
  border: 1px solid var(--a-acc); border-left: 3px solid var(--a-acc); border-radius: 8px; padding: 6px 9px;
  font-size: 11px; line-height: 1.45; color: var(--a-ink2); box-shadow: 0 4px 12px rgba(0,0,0,.14);
  opacity: 0; transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.w-callout b { display: block; color: var(--a-gold); font-size: 11.5px; margin-bottom: 2px; }
.wiring-elzone .bk-wokwi > *:hover ~ .w-callout { opacity: 1; }
.w-callout.show { opacity: 1; }
html[data-dm-theme="dark"] .w-callout { box-shadow: 0 4px 14px rgba(0,0,0,.5); }
/* ③ 工具栏：选元件 / 选模块 两个下拉菜单（按手头硬件快速跳课；电流固定常开） */
.wiring-viewbar { display: flex; gap: 8px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.wv-partmenu { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--a-line2);
  background: color-mix(in srgb, var(--a-panel) 88%, transparent); border-radius: 8px; padding: 3px 6px 3px 9px; }
.wv-pm-lab { font-size: 11px; font-weight: 800; color: var(--a-gold); white-space: nowrap; }
html[data-dm-theme="dark"] .wv-pm-lab { color: var(--a-gold); }
.wv-pm-sel { border: none; background: transparent; color: var(--a-ink); font-size: 12px; font-weight: 700;
  padding: 4px 4px; cursor: pointer; max-width: 220px; }
.wv-pm-sel:focus { outline: none; }
.wv-pm-sel option { color: #000; background: #fff; }
/* ⑥ 成品模块壳（3 脚模块 PCB，青少年初学多见） */
.w-modshell-rect { fill: color-mix(in srgb, #1f8a70 20%, var(--a-panel)); stroke: #1f8a70; stroke-width: 1.4; }
.w-modshell-name { fill: var(--a-ink); font-size: 11px; font-weight: 800; }
.w-modshell-term { fill: var(--a-bg2); stroke: var(--a-ink2); stroke-width: 1.2; }
/* ⑥ 元件名标注（裸件态每个元件旁标名称） */
.w-comp-name-t { fill: var(--a-ink2); font-size: 11px; font-weight: 700; paint-order: stroke; stroke: var(--a-bg2); stroke-width: 3px; }
/* ⑥ 裸件/模块切换按钮区（与工具栏按钮统一尺寸样式，仅加分隔线） */
.wiring-mode-sep { width: 1px; height: 18px; background: var(--a-line2); margin: 0 2px; }
/* 模块态 callout（绿色调，突出"成品模块"） */
.w-callout.mod { border-left-color: #1f8a70; border-color: color-mix(in srgb, #1f8a70 40%, var(--a-line)); }
.w-callout.mod b { color: #1f8a70; }
/* 接线清单 + 图例 */
.wiring-list { margin-top: 12px; }
.wiring-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.wiring-legend span { font-size: 11px; color: var(--a-ink2); display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.wiring-legend i { width: 14px; height: 4px; border-radius: 3px; display: inline-block; }
.wiring-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.wiring-list li { display: flex; align-items: center; gap: 7px; font-size: 12px;
  background: var(--a-bg2); border: 1px solid var(--a-line); border-radius: 8px; padding: 6px 10px; }
.wl-pin { font-family: ui-monospace, monospace; font-weight: 700; min-width: 34px; }
.wl-arrow { color: var(--a-acc); font-weight: 700; }
.wl-term { color: var(--a-ink); }
.wiring-note { margin: 10px 0 0; font-size: 11.5px; color: var(--a-ink2); line-height: 1.5;
  background: color-mix(in srgb, var(--a-acc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--a-acc) 28%, transparent);
  border-radius: 8px; padding: 8px 11px; }
@media (max-width: 900px) {
  .wiring-stage { flex-direction: column; }
  .wiring-board, .wiring-elzone { flex: 1 1 auto; width: 100%; }
  .wiring-channel { flex: 1 1 auto; width: 100%; min-height: 90px; }
  .wiring-board .wiring-uno { max-width: 320px; }
}
/* S45：平面整板 UNO 主板（USB/芯片/晶振/复位/L灯/PWR/电源孔/螺丝孔/双排针） */
.w-pcb { fill: #3a7d54; stroke: #274f38; stroke-width: 2; }
.w-pcb-inner { fill: none; stroke: rgba(255,255,255,.28); stroke-width: 1; }
.w-pcb-title { font-size: 12px; font-weight: 800; fill: #fff; letter-spacing: 1px; }
.w-pcb-sub { font-size: 8px; font-weight: 600; fill: rgba(255,255,255,.65); letter-spacing: .5px; }
.w-pcb-label { font-size: 8px; font-weight: 700; fill: #fff; }
.w-pcb-tiny { font-size: 7.5px; font-weight: 700; fill: rgba(255,255,255,.85); }
.w-chip { fill: #2a2f38; stroke: #15181d; stroke-width: 1; }
.w-chip-text { font-size: 9px; font-weight: 700; fill: #cbd5e1; font-family: ui-monospace, monospace; }
.w-chip-dot { fill: #cbd5e1; }
.w-usb { fill: #98a1ad; stroke: #6b7280; stroke-width: 1; }
.w-xtal { fill: #c9ced6; stroke: #8b93a1; stroke-width: 1; }
.w-reset { fill: #b9832f; stroke: #7a5416; stroke-width: 1; }
.w-screw { fill: none; stroke: rgba(255,255,255,.55); stroke-width: 1.2; }   /* 主板四角螺丝孔 */
.w-jack { fill: #2a2f38; stroke: #15181d; stroke-width: 1; }                 /* 电源插座 */
.w-jack2 { fill: #6b7280; }
.w-header { fill: rgba(0,0,0,.22); stroke: rgba(255,255,255,.25); stroke-width: .8; } /* 排针条 */
.w-pin { fill: var(--a-panel); stroke: var(--a-gold); stroke-width: 1.5; }
.w-pin-ana { stroke: #2f6df6; }
.w-pin-tick { font-size: 7px; font-weight: 700; fill: rgba(255,255,255,.78); font-family: ui-monospace, monospace; }
.w-pin-label { font-size: 10px; font-weight: 700; font-family: ui-monospace, monospace; }
.led13 { fill: #ffd76a; stroke: #c98a1a; stroke-width: 1; }
.pwr-led { fill: #6ee7a8; stroke: #2f8f5b; stroke-width: 1; }
/* S45：器件形象（每类画得像实物，导线接在器件左缘端子） */
.w-comp-mat { fill: color-mix(in srgb, var(--a-acc) 5%, transparent); stroke: var(--a-line); stroke-width: 1; }
/* LED 灯珠 */
.led-glow { fill: rgba(255,120,90,.16); }
.led-body { fill: #ff8a6b; stroke: #c2452a; stroke-width: 1.5; }
.rgb-body { fill: #3a3f4a; }
.led-lens { fill: #ffe9c8; }
.led-shine { fill: none; stroke: rgba(255,255,255,.8); stroke-width: 2; stroke-linecap: round; }
.led-leg { fill: #b9c2cc; }
.rgb-r { fill: #ff5a5a; stroke: #7a1d1d; stroke-width: 1; }
.rgb-g { fill: #4ade80; stroke: #1d6b3a; stroke-width: 1; }
.rgb-b { fill: #60a5fa; stroke: #1d4a8a; stroke-width: 1; }
.rgb-c { fill: #cbd5e1; stroke: #64748b; stroke-width: 1; }
/* 轻触按键 */
.btn-base { fill: #1c2530; stroke: #0c1218; stroke-width: 1.5; }
.btn-cap { fill: #8f9aab; stroke: #5b6572; stroke-width: 1.5; }
.btn-cap2 { fill: #c7d1dc; }
.btn-metal { fill: #9aa4b0; }
/* 电位器（旋钮） */
.pot-base { fill: #2b3644; stroke: #151c25; stroke-width: 1.5; }
.pot-cap { fill: #eef2f7; stroke: #93a1b1; stroke-width: 1.5; }
.pot-pointer { stroke: #334155; stroke-width: 3; stroke-linecap: round; }
.pot-hub { fill: #64748b; }
.pot-metal { fill: #b9c2cc; }
/* 光敏 / 传感器模块 */
.ldr-body { fill: #d9a441; stroke: #8a6420; stroke-width: 1.5; }
.ldr-zig { fill: none; stroke: #5c4315; stroke-width: 2.5; stroke-linecap: round; }
.ldr-ray { stroke: #f6c453; stroke-width: 2; stroke-linecap: round; }
.ldr-sun { fill: #ffd97a; stroke: #d99a2b; stroke-width: 1; }
.ldr-leg { fill: #b9c2cc; }
.mod-pcb { fill: #2f6b47; stroke: #1f4530; stroke-width: 1.5; }
.mod-chip { fill: #2a2f38; stroke: #15181d; stroke-width: 1; }
.mod-dot { fill: #6ee7a8; }
.soil-plate { fill: none; stroke: #7c5a2e; stroke-width: 2.5; }
/* 压敏垫 */
.fsr-pad { fill: #d7cfc2; stroke: #8f8676; stroke-width: 1.5; }
.fsr-circle { fill: #f0ebe2; stroke: #b7ad9d; stroke-width: 1; }
.fsr-core { fill: #8f8676; }
/* 蜂鸣器 */
.buz-body { fill: #1c2124; stroke: #0b0e10; stroke-width: 1.5; }
.buz-inner { fill: #3a4147; }
.buz-hole { fill: #0b0e10; }
.buz-wave { fill: none; stroke: var(--a-acc); stroke-width: 2; stroke-linecap: round; opacity: .8; }
.buz-leg { fill: #b9c2cc; }
/* 驱动板 / 水泵 */
.drv-pcb { fill: #334155; }
.drv-hole { fill: #0b0e10; }
.drv-leg { fill: #b9c2cc; }
/* 电机 */
.mot-body { fill: #4b5563; stroke: #273040; stroke-width: 1.5; }
.mot-face { fill: #9aa4b0; }
.mot-shaft { fill: #e5e9ef; stroke: #6b7280; stroke-width: 1; }
.mot-hole { fill: #273040; }
.mot-leg { fill: #b9c2cc; }
/* LM35 温度探头 */
.tmp-body { fill: #2a2f38; stroke: #15181d; stroke-width: 1.5; }
.tmp-line { stroke: #6ee7a8; stroke-width: 2; stroke-linecap: round; }
.tmp-text { font-size: 9px; font-weight: 700; fill: #cbd5e1; font-family: ui-monospace, monospace; }
.tmp-leg { fill: #b9c2cc; }
/* 舵机 */
.sv-body { fill: #d9a441; stroke: #8a6420; stroke-width: 1.5; }
.sv-label { fill: #fff3d6; }
.sv-shaft { fill: #f0f4f8; stroke: #9aa4b0; stroke-width: 1.5; }
.sv-horn { fill: #ffd76a; stroke: #c98a1a; stroke-width: 1.5; }
.sv-leg { fill: #b9c2cc; }
/* 器件名 + 端子 + 说明（引线标注在最右方，不压器件） */
.w-comp-name { font-size: 13px; font-weight: 800; fill: var(--a-ink); }
.w-comp-terms { font-size: 10.5px; font-weight: 700; fill: var(--a-ink2); }
.w-comp-note { font-size: 10px; font-weight: 600; fill: var(--a-ink3); }
.w-leader { stroke: var(--a-ink3); stroke-width: 1; opacity: .65; }
.w-leader-dot { fill: var(--a-ink2); }
.w-term { fill: var(--a-panel); stroke: var(--a-ink2); stroke-width: 1.5; }
html[data-dm-theme="dark"] .led-glow { fill: rgba(255,120,90,.22); }
html[data-dm-theme="dark"] .sv-body { fill: #b5842f; }
html[data-dm-theme="dark"] .ldr-body { fill: #c78f35; }
html[data-dm-theme="dark"] .fsr-pad { fill: #5c5648; stroke: #3a3428; }
html[data-dm-theme="dark"] .fsr-circle { fill: #6b6455; stroke: #4a4335; }
html[data-dm-theme="dark"] .fsr-core { fill: #c9c2b4; }
/* 导线 */
.w-wire { fill: none; stroke-width: 2.4; stroke-linecap: round; opacity: .92; }
.w-label rect { opacity: .95; }
html[data-dm-theme="dark"] .w-comp-box { fill: #241d2e; }
html[data-dm-theme="dark"] .w-pin { fill: #241d2e; }
html[data-dm-theme="dark"] .w-pcb { fill: #2f6b47; stroke: #1c3a28; }  /* S44：暗色下绿色 PCB 调深一档 */
/* 接线清单 + 图例 */
.wiring-list { margin-top: 12px; }
.wiring-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.wiring-legend span { font-size: 11px; color: var(--a-ink2); display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.wiring-legend i { width: 14px; height: 4px; border-radius: 3px; display: inline-block; }
.wiring-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.wiring-list li { display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  background: var(--a-bg2); border: 1px solid var(--a-line); border-radius: 8px; padding: 7px 11px; }
.wl-pin { font-family: ui-monospace, monospace; font-weight: 700; color: var(--a-gold); min-width: 40px; }
.wl-arrow { color: var(--a-acc); font-weight: 700; }
.wl-term { color: var(--a-ink); }
.wiring-note { margin: 10px 0 0; font-size: 11.5px; color: var(--a-ink2); line-height: 1.5;
  background: color-mix(in srgb, var(--a-acc) 10%, transparent); border: 1px solid color-mix(in srgb, var(--a-acc) 28%, transparent);
  border-radius: 8px; padding: 8px 11px; }

/* 工作台元件 */
.bench-panel { min-height: 210px; }
.bk-head { display: flex; align-items: center; gap: 8px; padding: 11px 15px; border-bottom: 1px solid var(--a-line); }
.bk-head b { font-size: 13.5px; }
.bk-head-tag { margin-left: auto; font-size: 10.5px; color: var(--a-teal); background: color-mix(in srgb, var(--a-teal) 12%, transparent);
  padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.bk-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--a-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a-teal) 20%, transparent); }
.bk-body { min-height: 150px; padding: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
/* Wokwi 真实元件容器：多个自定义元件横向排布，居中、自适应 */
.bk-wokwi { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  min-height: 96px; width: 100%; }
.bk-wokwi wokwi-led { width: 34px; height: 34px; }
.bk-wokwi wokwi-rgb-led { width: 56px; height: 56px; }
.bk-wokwi wokwi-potentiometer { width: 96px; height: 96px; }
.bk-wokwi wokwi-servo { width: 120px; height: 120px; }
.bk-wokwi wokwi-buzzer { width: 60px; height: 60px; }
.bk-wokwi wokwi-stepper-motor { width: 110px; height: 110px; }
.bk-wokwi wokwi-pushbutton { width: 54px; height: 54px; cursor: pointer; }
.bk-wokwi wokwi-photoresistor-sensor { width: 110px; height: 80px; }
.bk-wokwi wokwi-ntc-temperature-sensor { width: 110px; height: 80px; }
.bk-ctl { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* bench 数值读数标签 */
.bk-analog-val, .bk-lux-val, .bk-force-val, .bk-moist-val, .bk-temp-val { margin: 0; font-family: monospace;
  font-weight: 800; font-size: 12.5px; color: var(--a-gold); }
/* 引擎加载失败兜底 */
.ard-fallback { padding: 16px; font-size: 13px; line-height: 1.6; color: var(--a-ink2); text-align: center; }
.ard-fallback b { color: var(--a-acc); }
.bk-cap { font-size: 11.5px; color: var(--a-ink3); margin: 0; text-align: center; }
.bk-led-wrap { position: relative; width: 76px; height: 76px; display: grid; place-items: center; }
.bk-led-wrap.small { width: 46px; height: 46px; }
.bk-led { width: 46px; height: 46px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff8c0, #ffcf4a 55%, #d98b00);
  opacity: .25; box-shadow: 0 0 0 6px rgba(0,0,0,.06); transition: opacity .15s, box-shadow .15s; }
.bk-led-wrap.small .bk-led { width: 30px; height: 30px; }
.bk-led.on { box-shadow: 0 0 24px 6px rgba(255,207,74,.7), 0 0 0 6px rgba(255,207,74,.12); }
.bk-button { width: 120px; height: 54px; border-radius: 14px; border: 2px solid var(--a-line2);
  background: linear-gradient(#fff, var(--a-soft)); color: var(--a-ink); font-weight: 800; box-shadow: 0 5px 0 var(--a-line2); }
html[data-dm-theme="dark"] .bk-button { background: linear-gradient(#3a3048, #2a2234); }
.bk-button:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--a-line2); background: var(--a-acc); color: #fff; }
.bk-pot { width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--a-line2) 0 25%, var(--a-ink3) 0 50%, var(--a-line2) 0 75%, var(--a-ink3) 0);
  display: grid; place-items: center; }
.bk-pot-knob { width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d8cbb4);
  box-shadow: 0 3px 8px rgba(0,0,0,.3); position: relative; }
.bk-pot-knob::after { content: ''; position: absolute; top: 8px; left: 50%; width: 3px; height: 18px; background: var(--a-acc); transform: translateX(-50%); border-radius: 2px; }
.bk-slider-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 320px; }
.bk-slider { flex: 1; accent-color: var(--a-acc); }
.bk-slider-val { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13px; color: var(--a-gold); min-width: 42px; text-align: right; }
.bk-rgb { width: 90px; height: 90px; border-radius: 24px; background: #222; display: grid; place-items: center; }
.bk-rgb-core { width: 54px; height: 54px; border-radius: 50%; background: #f00; transition: background .3s, box-shadow .3s; }
.bk-sensor-icon { font-size: 54px; line-height: 1; }
.bk-buzz { position: relative; font-size: 46px; display: flex; align-items: center; gap: 6px; }
.bk-wave { width: 90px; height: 44px; color: var(--a-acc); opacity: .18; transition: opacity .15s; }
.bk-note { margin: 0; font-family: monospace; font-weight: 800; color: var(--a-gold); font-size: 14px; min-height: 18px; }
.bk-piano { display: flex; gap: 5px; }
.bk-piano button { width: 50px; height: 84px; border-radius: 8px; border: 1px solid var(--a-line2); background: var(--a-panel);
  color: var(--a-ink); font-weight: 700; }
.bk-piano button:active { background: var(--a-acc); color: #fff; transform: translateY(3px); }
.bk-fan { position: relative; width: 110px; height: 110px; }
.bk-fan-blades { position: absolute; inset: 0; animation: spin calc(1.4s / max(.15, var(--spin))) linear infinite; animation-play-state: paused; }
.bk-fan-blades i { position: absolute; top: 50%; left: 50%; width: 42px; height: 42px; margin: -21px;
  background: linear-gradient(135deg, var(--a-teal), transparent 70%); border-radius: 50% 0 50% 0; transform-origin: center; }
.bk-fan-blades i:nth-child(1) { transform: rotate(0deg); }
.bk-fan-blades i:nth-child(2) { transform: rotate(90deg); }
.bk-fan-blades i:nth-child(3) { transform: rotate(180deg); }
.bk-fan-blades i:nth-child(4) { transform: rotate(270deg); }
.bk-fan-hub { position: absolute; top: 50%; left: 50%; width: 22px; height: 22px; margin: -11px; border-radius: 50%;
  background: var(--a-acc); border: 3px solid var(--a-panel); }
html[data-dm-theme="dark"] .bk-fan-blades { animation-play-state: running; }
html[data-ard-motion="on"] .bk-fan-blades { animation-play-state: running; }
html[data-ard-motion="off"] .bk-fan-blades { animation: none; }
.bk-pwm-val, .bk-servo-val, .bk-dial-val, .bk-moist-val { margin: 0; font-family: monospace; font-weight: 800; color: var(--a-gold); font-size: 13px; }
.bk-temp { font-size: 22px; display: flex; align-items: center; gap: 8px; }
.bk-plot { max-width: 100%; border: 1px solid var(--a-line); border-radius: 8px; background: var(--a-bg2); }
.bk-servo { position: relative; width: 120px; height: 100px; display: grid; place-items: center; }
.bk-servo-base { width: 70px; height: 34px; border-radius: 8px; background: var(--a-teal); }
.bk-servo-arm { position: absolute; bottom: 33px; width: 8px; height: 52px; background: var(--a-acc); border-radius: 4px; transform-origin: bottom center; transition: transform .5s ease; }
.bk-dial { position: relative; width: 120px; height: 120px; }
.bk-dial-face { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, var(--a-panel) 60%, var(--a-line2)); border: 3px solid var(--a-line2); }
.bk-dial-face::before { content: ''; position: absolute; inset: 10px; border-radius: 50%; border: 2px dashed var(--a-line2); }
.bk-dial-needle { position: absolute; bottom: 50%; left: 50%; width: 4px; height: 46px; background: var(--a-acc);
  transform-origin: bottom center; transform: translateX(-50%) rotate(0deg); border-radius: 3px; transition: transform .3s ease; }
.bk-dial-center { position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; background: var(--a-ink); }
.bk-plant { position: relative; font-size: 48px; display: flex; flex-direction: column; align-items: center; }
.bk-pump { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--a-line); color: var(--a-ink2); margin-top: 4px; transition: all .2s; }
.bk-pump.on { background: var(--a-teal); color: #fff; box-shadow: 0 0 12px var(--a-teal); }
.bk-pressure { width: 140px; height: 56px; border-radius: 12px; border: 2px dashed var(--a-line2); background: var(--a-soft); color: var(--a-ink2); font-weight: 700; }
.bk-pressure:active { background: var(--a-acc); color: #fff; border-color: var(--a-acc); }
.bk-mode-label { margin: 0; font-weight: 800; color: var(--a-gold); }

/* 概览 / Tab */
.ard-tabs { display: flex; gap: 2px; padding: 8px 12px 0; border-bottom: 1px solid var(--a-line); background: var(--a-bg2); }
.ard-tabs button { position: relative; border: none; background: none; color: var(--a-ink3); font-size: 13.5px; font-weight: 700;
  padding: 9px 15px; border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent; transition: color .16s, background .16s; }
.ard-tabs button:hover { color: var(--a-ink); }
.ard-tabs button.on { color: var(--a-acc); border-bottom-color: var(--a-acc); background: var(--a-panel); }
.ard-tabbody { padding: 17px 19px; min-height: 190px; animation: ardFadeUp .25s ease both; }
.ard-intro { margin: 0 0 14px; color: var(--a-ink2); font-size: 14px; line-height: 1.85; }
.ard-points { display: flex; flex-direction: column; gap: 11px; }
.ard-point { display: flex; gap: 11px; align-items: flex-start; }
.ard-point-n { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center;
  background: var(--a-soft); color: var(--a-gold); font-size: 12px; font-weight: 800; }
.ard-point b { font-size: 13.5px; }
.ard-point p { margin: 1px 0 0; font-size: 12.5px; color: var(--a-ink2); line-height: 1.6; }
.ard-tb-title { font-size: 14px; margin: 0 0 12px; }
.ard-kv { display: flex; flex-direction: column; border: 1px solid var(--a-line); border-radius: 12px; overflow: hidden; }
.ard-kv > div { display: flex; gap: 12px; padding: 9px 13px; font-size: 12.5px; border-bottom: 1px solid var(--a-line); }
.ard-kv > div:last-child { border-bottom: none; }
.ard-kv > div:nth-child(odd) { background: var(--a-bg2); }
.ard-kv span { color: var(--a-ink3); min-width: 110px; }
.ard-kv b { color: var(--a-ink); font-weight: 600; }
.ard-note { font-size: 11.5px; color: var(--a-ink3); margin: 12px 0 0; }
.ard-code-snippet { background: var(--a-code-bg); color: var(--a-code-ink); padding: 13px 15px; border-radius: 10px;
  font-size: 12px; overflow-x: auto; line-height: 1.6; margin: 0; }

/* 代码编辑器 + 串口 */
.ard-code-actions { display: flex; gap: 6px; }
.mini { font-size: 11.5px; font-weight: 700; padding: 6px 11px; border-radius: 8px; border: 1px solid var(--a-line2);
  background: var(--a-bg2); color: var(--a-ink2); transition: transform .14s, border-color .14s, background .14s, color .14s, box-shadow .14s; }
.mini:hover { border-color: var(--a-acc); color: var(--a-acc); background: var(--a-panel); box-shadow: var(--a-shadow); }
.mini:active { transform: scale(.96); }
.mini.primary { background: var(--a-acc); color: #fff; border-color: var(--a-acc); box-shadow: var(--a-glow-acc); }
html[data-dm-theme="dark"] .mini.primary { color: #2c2118; }
.mini:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
/* 编辑器：固定高度、禁 resize（高度不随内容/等高变化），行号列定宽、左侧不留空，代码区铺满 */
.ard-editor { display: flex; background: var(--a-code-bg); overflow: hidden; }
.ard-editor.short { height: 220px; }
.code-panel .ard-editor { height: 250px; }
.ard-lines { flex: none; width: 46px; padding: 12px 8px; box-sizing: border-box; text-align: right; color: #5d7075;
  font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre; overflow: hidden; user-select: none; background: color-mix(in srgb, var(--a-bg) 40%, transparent); }
.ard-editor textarea { flex: 1; height: 100%; border: none; outline: none; resize: none; padding: 12px 14px;
  background: transparent; color: var(--a-code-ink); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  tab-size: 2; white-space: pre; overflow: auto; }
/* 三档关卡示例：横向选项卡（顶部一排关卡标签 + 下方共享编辑区，方便快速切换） */
.ard-examples { padding: 12px; display: flex; flex-direction: column; gap: 0; }
.ard-xtabs { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--a-line); }
.ard-xtab { flex: 1 1 200px; min-width: 180px; display: flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-bg2); padding: 9px 11px;
  transition: border-color .16s, background .16s, box-shadow .16s; text-align: left; }
.ard-xtab:hover { border-color: var(--a-acc); }
.ard-xtab.on { background: var(--a-panel); border-color: var(--a-acc);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--a-acc) 22%, transparent); }
.ard-xtab.running { border-color: var(--a-acc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--a-acc) 30%, transparent), var(--a-glow-acc);
  animation: ardPulse 1.4s ease-in-out infinite; }
.ard-xtab .ard-xtag { flex: none; }
.ard-xtab-d { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--a-ink2);
  line-height: 1.35; }
.ard-xtab.on .ard-xtab-d { color: var(--a-ink); font-weight: 600; }
/* 标签配色（关卡 1/2/3 = 绿/蓝/橙） */
.ard-xtab[data-x="0"] .ard-xtag { background: #12b886; }
.ard-xtab[data-x="1"] .ard-xtag { background: #3f83e8; }
.ard-xtab[data-x="2"] .ard-xtag { background: #a85b08; }
html[data-dm-theme="dark"] .ard-xtab[data-x="2"] .ard-xtag { color: #2c2118; background: var(--a-acc); }
/* 关卡标签徽章（横向选项卡内复用） */
.ard-xtab .ard-xtag { font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 20px; color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.12); }
/* 共享编辑区：当前关卡标题 + 运行/复制 + 代码框 */
.ard-xbody { margin-top: 12px; }
.ard-xcode { display: block; width: 100%; box-sizing: border-box; border: 1px solid var(--a-line); border-radius: 10px;
  outline: none; resize: vertical; min-height: 150px; padding: 10px 12px; background: var(--a-code-bg);
  color: var(--a-code-ink); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; tab-size: 2;
  white-space: pre; overflow: auto; transition: background .16s, border-color .16s; }
.ard-xcode:focus { border-color: var(--a-acc);
  background: color-mix(in srgb, var(--a-code-bg) 90%, var(--a-acc-soft, var(--a-soft))); }
.ard-xbar { display: flex; align-items: center; gap: 8px; padding: 6px 2px 10px; }
.ard-xcur { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 700; color: var(--a-gold);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ard-xbody .mini { flex: none; }
.ard-xbody .ard-xcode { min-height: 150px; }
@media (max-width: 560px) {
  .ard-xtab { flex: 1 1 100%; }
}
.ard-serial { border-top: 1px solid var(--a-line); }
.ard-serial-h { display: flex; align-items: center; gap: 10px; padding: 8px 13px; background: var(--a-bg2); border-bottom: 1px solid var(--a-line); }
.ard-serial-h b { font-size: 12.5px; }
.ard-serial-state { font-size: 11px; color: var(--a-ink3); display: inline-flex; align-items: center; gap: 5px; }
.ard-serial-state.live { color: var(--a-teal); font-weight: 800; }
.ard-serial-state.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--a-teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--a-teal) 22%, transparent); animation: ardPulse 1.2s ease-in-out infinite; }
.ard-serial-state.live { color: #1db954; font-weight: 800; }
.ard-serial-h .mini { margin-left: auto; }
.ard-serial-out { height: 92px; overflow-y: auto; padding: 8px 13px; font: 12px/1.7 ui-monospace, monospace; color: var(--a-ink2); background: var(--a-panel); }
.ard-serial-line { white-space: pre-wrap; word-break: break-all; }
.ard-serial-line .ts { color: var(--a-ink3); margin-right: 10px; }
.ard-plot { display: block; width: 100%; height: auto; border-top: 1px solid var(--a-line); background: var(--a-bg2); }

/* 测验 */
.quiz-panel { margin-top: 18px; padding-bottom: 16px; }
.ard-quiz-list { padding: 6px 17px 0; }
.ard-quiz-q { padding: 13px 0; border-bottom: 1px dashed var(--a-line); }
.ard-quiz-q:last-child { border-bottom: none; }
.ard-quiz-q > b { font-size: 13.5px; }
.ard-quiz-opts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ard-quiz-opts button { border: 1px solid var(--a-line2); background: var(--a-bg2); color: var(--a-ink);
  border-radius: 9px; padding: 7px 14px; font-size: 12.5px; font-weight: 600;
  transition: transform .15s, border-color .15s, background .15s, color .15s; }
.ard-quiz-opts button:hover:not(:disabled) { border-color: var(--a-acc); color: var(--a-acc); transform: translateY(-1px); }
.ard-quiz-opts button:active:not(:disabled) { transform: scale(.97); }
.ard-quiz-opts button.correct { background: #1db954; color: #fff; border-color: #1db954; animation: ardPopIn .3s ease; }
html[data-dm-theme="dark"] .ard-quiz-opts button.correct { color: #fff; }
.ard-quiz-opts button.wrong { background: #e0518b; color: #fff; border-color: #e0518b; animation: ardPopIn .3s ease; }
.ard-quiz-why { font-size: 12px; color: var(--a-ink2); margin: 9px 0 0;
  padding: 9px 12px; border-radius: 8px; background: var(--a-soft); border-left: 3px solid var(--a-acc);
  animation: ardFadeUp .25s ease both; }
.ard-challenge-result { margin: 12px 17px 0; padding: 12px 15px; border-radius: 12px; font-size: 13px; animation: ardPopIn .3s ease both; }
.ard-challenge-result.ok { background: color-mix(in srgb, #1db954 12%, transparent); border: 1px solid #1db954; }
.ard-challenge-result.warn { background: var(--a-soft); border: 1px solid var(--a-line2); }
.ard-challenge-result b { display: block; }
.ard-challenge-result span { display: block; color: var(--a-ink2); font-size: 12px; }
.ard-lesson-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* 元件图鉴 */
.ard-part-group { margin-bottom: 26px; }
.ard-part-group h2 { font-size: 18px; margin: 0 0 13px; }
.ard-part-group h2 small { font-size: 12px; color: var(--a-ink3); font-weight: 500; margin-left: 8px; }
.ard-part-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.ard-part { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 16px; padding: 16px; box-shadow: var(--a-shadow); }
.ard-part-top { display: flex; align-items: center; gap: 11px; }
.ard-part-emoji { font-size: 30px; }
.ard-part-top b { display: block; font-size: 14px; }
.ard-part-top small { font-size: 11px; color: var(--a-ink3); }
.ard-part > p { font-size: 12.5px; color: var(--a-ink2); line-height: 1.65; margin: 11px 0; }
.ard-part-tip { font-size: 11.5px; color: var(--a-gold); background: var(--a-soft); padding: 8px 10px; border-radius: 9px; }

/* 实验室 */
.ard-lab-modes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.ard-lab-modes button { border: 1px solid var(--a-line2); background: var(--a-panel); color: var(--a-ink2);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; }
.ard-lab-modes button:hover { border-color: var(--a-acc); }
.ard-lab-modes button.on { background: var(--a-acc); color: #fff; border-color: var(--a-acc); }
html[data-dm-theme="dark"] .ard-lab-modes button.on { color: #2c2118; }
.ard-lab-intro { padding: 16px; }
.ard-lab-intro p { margin: 0 0 12px; color: var(--a-ink2); font-size: 13px; }

/* 设置 */
.ard-set-card { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 16px; padding: 20px 22px; margin-bottom: 14px; box-shadow: var(--a-shadow); }
.ard-set-card h2 { font-size: 16px; margin: 0 0 4px; }
.ard-set-card p { font-size: 12.5px; color: var(--a-ink2); margin: 0 0 14px; }
.ard-set-opts { display: flex; gap: 9px; flex-wrap: wrap; }
.ard-set-opts button { border: 1px solid var(--a-line2); background: var(--a-bg2); color: var(--a-ink2);
  padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.ard-set-opts button.on { background: var(--a-soft); border-color: var(--a-acc); color: var(--a-gold); }

/* 页脚 */
.ard-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px clamp(14px, 3vw, 32px); border-top: 1px solid var(--a-line); color: var(--a-ink3); font-size: 11.5px;
  background: color-mix(in srgb, var(--a-panel) 70%, transparent); backdrop-filter: blur(4px); }

/* ---------- 首页课程说明卡（对齐首页糖果卡风） ---------- */
.ard-home { animation: ardFadeUp .35s ease both; }
.ard-intro-card { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 20px;
  box-shadow: var(--a-glow); padding: clamp(20px, 3vw, 32px); position: relative; overflow: hidden;
  background-image: radial-gradient(circle at 92% 0%, var(--a-blob-o), transparent 40%),
                    radial-gradient(circle at 0% 100%, var(--a-blob-g), transparent 42%); }
.ard-intro-head { display: flex; align-items: center; gap: 14px; padding-bottom: 20px; border-bottom: 1px solid var(--a-line); }
.ard-intro-badge { position: relative; width: 54px; height: 54px; flex: none; border-radius: 14px; display: grid; place-items: center;
  margin: 8px 10px 8px 4px; font-size: 26px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--a-acc), var(--a-acc2));
  box-shadow: var(--a-glow-acc); }
/* OJ 轨道环签名：徽章外两圈缓慢旋转的描边环 */
.ard-intro-badge::before { content: ""; position: absolute; inset: -9px; border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--a-acc) 30%, transparent); animation: ardSpin 14s linear infinite; }
.ard-intro-badge::after { content: ""; position: absolute; inset: -16px; border-radius: 24px;
  border: 1px dashed color-mix(in srgb, var(--a-acc2) 34%, transparent); animation: ardSpin 22s linear infinite reverse; }
html[data-dm-theme="dark"] .ard-intro-badge { color: #2c2118; }
.ard-intro-head h1 { font-size: clamp(22px, 3vw, 30px); margin: 0 0 4px; }
.ard-intro-head p { margin: 0; color: var(--a-ink2); font-size: 13.5px; }
.ard-intro-stats { margin-left: auto; display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; justify-content: flex-end; }
.ard-intro-stats b { font-size: 24px; color: var(--a-acc); }
.ard-intro-stats span { font-size: 12px; color: var(--a-ink3); margin-right: 10px; }
.ard-intro-body { padding-top: 20px; display: flex; flex-direction: column; gap: 20px; }
.ard-intro-sec h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 0 0 8px; }
.ard-intro-sec h3 .ic { font-size: 16px; transition: transform .2s; }
.ard-intro-sec:hover h3 .ic { transform: scale(1.15) rotate(-5deg); }
.ard-intro-sec p { margin: 0; color: var(--a-ink2); font-size: 13.5px; line-height: 1.85; }
.ard-intro-sec ul { margin: 0; padding-left: 4px; list-style: none; }
.ard-intro-sec li { position: relative; padding-left: 18px; color: var(--a-ink2); font-size: 13px; line-height: 1.9; transition: transform .15s, color .15s; }
.ard-intro-sec li:hover { transform: translateX(3px); color: var(--a-ink); }
.ard-intro-sec li::before { content: '•'; position: absolute; left: 4px; color: var(--a-acc); font-weight: 800; }
.ard-intro-cta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; padding-top: 18px; border-top: 1px solid var(--a-line); }
.ard-intro-hint { font-size: 12px; color: var(--a-ink3); }
.ard-home-foot { text-align: center; color: var(--a-ink3); font-size: 12px; margin: 20px 0 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 1024px) {
  .ard-shell { grid-template-columns: 1fr; }
  .ard-side { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--a-line);
    padding: 12px 14px; }
  .ard-side-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 8px; }
  .ard-side-group { grid-column: 1 / -1; }
}
@media (max-width: 980px) {
  .ard-workspace { grid-template-columns: 1fr; }
  .ard-card-grid, .ard-part-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ard-intro-head { flex-wrap: wrap; }
  .ard-intro-stats { margin-left: 0; width: 100%; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .ard-card-grid, .ard-part-grid { grid-template-columns: 1fr; }
  .ard-stage { height: 280px; }
  .ard-view-tools { max-width: 100px; }
  .ard-lnav { width: 100%; }
  .ard-lnav > * { flex: 1; text-align: center; }
  .ard-lno { display: block; }
  .ard-side-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
