/* ============================================================
   薪火 · 交互组件统一样式（三个版本共用）
   ix-sandbox    HTML/CSS/JS 内嵌沙盒
   ix-py         Python (Pyodide) 沙盒
   ix-quiz       多选/单选小测验
   ix-reveal     可展开的参考答案
   ix-prompt     prompt 练习（写 + 复制 + 对照参考）
   ix-step       分步引导练习
   ============================================================ */

.ix {
  margin: 1.6rem 0;
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper-warm);
  box-shadow: var(--stamp-ink);
  overflow: hidden;
}
.ix-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0.8rem 1.2rem;
  background: var(--ink);
  color: var(--paper-warm);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}
.ix-head .ix-tag {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  background: var(--taste);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: var(--radius-pill);
  letter-spacing: 0.08em;
}
.ix-head .ix-title { flex: 1; }
.ix-body { padding: 1.1rem 1.3rem; line-height: 1.75; }
.ix-body > p:first-child { margin-top: 0; }
.ix-body > p:last-child  { margin-bottom: 0; }

.ix-task {
  background: var(--paper);
  border-left: 4px solid var(--passion);
  padding: 0.85rem 1.1rem;
  margin: 0 0 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.97rem;
}
.ix-task strong { color: var(--passion-deep); }

.ix-hint {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0.6rem 0 0.9rem;
  font-style: italic;
}

/* ----- 沙盒 ----- */
.ix-editor {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.65;
  width: 100%;
  min-height: 140px;
  padding: 0.85rem 1rem;
  background: #1f2230;
  color: #f4eccb;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  resize: vertical;
  outline: none;
  tab-size: 2;
  box-sizing: border-box;
}
.ix-editor:focus { box-shadow: 0 0 0 3px var(--taste-soft); }
.ix-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0.7rem 0; }
.ix-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.55rem 1.05rem;
  background: var(--taste);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.ix-btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.ix-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--ink); }
.ix-btn.ghost { background: var(--paper-warm); }
.ix-btn.passion { background: var(--passion); color: var(--paper-warm); }
.ix-btn.empathy { background: var(--empathy); color: var(--paper-warm); }

.ix-output {
  margin-top: 0.6rem;
  padding: 0.85rem 1rem;
  background: var(--paper);
  border: 2px dashed var(--ink-faint);
  border-radius: var(--radius-sm);
  min-height: 60px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ix-output:empty::before {
  content: "（点击"运行"看输出）";
  color: var(--ink-faint);
  font-family: var(--font-body);
  font-style: italic;
}
/* When an iframe is present, drop padding so the iframe fills the box. */
.ix-output:has(iframe) {
  padding: 0;
  background: transparent;
  border-style: solid;
  border-color: rgba(0,0,0,0.12);
}
.ix-output iframe {
  width: 100%;
  min-height: 220px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  display: block;
}
.ix-output .err {
  color: var(--passion-deep);
  font-weight: 700;
}

/* ----- 测验 ----- */
.ix-quiz .q { font-weight: 700; margin-bottom: 0.6rem; }
.ix-quiz ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.ix-quiz li {
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.95rem;
  background: var(--paper);
  cursor: pointer;
  font-size: 0.96rem;
  transition: background 0.15s, transform 0.15s;
}
.ix-quiz li:hover { background: var(--paper-warm); transform: translateX(2px); }
.ix-quiz li.correct { background: #d6efd6; border-color: #5e8c5e; }
.ix-quiz li.wrong   { background: #f6d6cf; border-color: var(--passion-deep); }
.ix-quiz li.disabled { cursor: default; }
.ix-quiz .ix-explain {
  margin-top: 0.85rem;
  padding: 0.7rem 1rem;
  background: var(--empathy-soft);
  border-left: 4px solid var(--empathy-deep);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.94rem;
  display: none;
}
.ix-quiz .ix-explain.show { display: block; }

/* ----- 揭示参考答案 ----- */
.ix-reveal {
  margin: 0.9rem 0 0;
  border: 2px dashed var(--taste);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}
.ix-reveal summary {
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  font-weight: 700;
  background: var(--taste-soft);
  color: var(--taste-deep);
  list-style: none;
  user-select: none;
  font-size: 0.95rem;
}
.ix-reveal summary::-webkit-details-marker { display: none; }
.ix-reveal summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.2s;
}
.ix-reveal[open] summary::before { content: "▾ "; }
.ix-reveal .ix-reveal-body {
  padding: 1rem 1.2rem;
  border-top: 2px dashed var(--taste);
  background: var(--paper-warm);
  line-height: 1.85;
  font-size: 0.96rem;
}
.ix-reveal pre {
  background: #1f2230;
  color: #f4eccb;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  overflow-x: auto;
  margin: 0.7rem 0;
}
.ix-reveal code {
  background: var(--paper-deep);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

/* ----- prompt 练习 ----- */
.ix-prompt textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.85rem 1rem;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.97rem;
  line-height: 1.7;
  background: var(--paper-warm);
  color: var(--ink);
  resize: vertical;
  box-sizing: border-box;
}
.ix-prompt textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--taste-soft);
}
.ix-prompt .ix-go {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.6rem 1.1rem;
  background: var(--passion);
  color: var(--paper-warm);
  border: 2px solid var(--ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
  box-shadow: 2px 2px 0 var(--ink);
}
.ix-prompt .ix-go:hover { background: var(--passion-deep); }

/* ----- 步骤 ----- */
.ix-step ol.ix-steps {
  counter-reset: ixstep;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}
.ix-step ol.ix-steps > li {
  counter-increment: ixstep;
  background: var(--paper);
  border-left: 3px solid var(--ink);
  padding: 0.85rem 1rem 0.85rem 2.6rem;
  position: relative;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  line-height: 1.75;
  font-size: 0.97rem;
}
.ix-step ol.ix-steps > li::before {
  content: counter(ixstep);
  position: absolute;
  left: 0.7rem; top: 0.85rem;
  width: 1.6rem; height: 1.6rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-warm);
  font-family: var(--font-body); font-weight: 800;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}

.ix-copied {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #d6efd6;
  color: #2c5e2c;
  font-size: 0.78rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  margin-left: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}
.ix-copied.show { opacity: 1; }

/* ============================================================
   小词典 / 名词解释 — 内联弹卡（hover + click 都行）
   用法：<span class="gloss" data-term="prompt">prompt</span>
        然后整个页面的 <script src="…/interactive.js"> 自动激活
        词条内容来自 window.GLOSS（在 glossary-data.js 里集中定义）
   ============================================================ */
.gloss {
  position: relative;
  cursor: help;
  border-bottom: 2px dotted var(--taste-deep);
  background: linear-gradient(to bottom, transparent 80%, var(--taste-soft) 80%);
  padding: 0 2px;
  font-weight: inherit;
  color: inherit;
  transition: background 0.15s;
  outline: none;
}
.gloss:hover, .gloss:focus { background: var(--taste-soft); }
.gloss::after {
  content: "ⓘ";
  font-size: 0.7em;
  color: var(--taste-deep);
  margin-left: 2px;
  opacity: 0.7;
  vertical-align: super;
}

.gloss-pop {
  position: absolute;
  z-index: 100;
  width: min(320px, 86vw);
  background: var(--paper-warm);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.95rem 1.15rem 0.85rem;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--ink);
  text-align: left;
  font-weight: 400;
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.gloss-pop.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.gloss-pop .gp-term {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--passion-deep);
  margin: 0 0 0.4rem;
  line-height: 1.4;
}
.gloss-pop .gp-en {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-left: 6px;
  font-weight: 500;
}
.gloss-pop .gp-def { margin: 0 0 0.5rem; }
.gloss-pop .gp-eg {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  background: var(--paper);
  border-left: 3px solid var(--taste);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.gloss-pop .gp-more {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--passion-deep);
  border-bottom: 1.5px solid var(--passion);
}
.gloss-pop .gp-close {
  position: absolute;
  top: 6px; right: 8px;
  background: none;
  border: none;
  font-size: 1.05rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.gloss-pop .gp-close:hover { color: var(--passion-deep); }

/* ============================================================
   折叠详细解释 — <details class="ix-explain-card">
   ============================================================ */
.ix-explain-card {
  margin: 1.2rem 0;
  border: 2px solid var(--empathy-deep);
  border-radius: var(--radius);
  background: var(--empathy-soft);
  overflow: hidden;
}
.ix-explain-card > summary {
  padding: 0.85rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  color: var(--empathy-deep);
  list-style: none;
  user-select: none;
  font-size: 0.98rem;
  background: var(--empathy-soft);
}
.ix-explain-card > summary::-webkit-details-marker { display: none; }
.ix-explain-card > summary::before {
  content: "💡 ";
  margin-right: 4px;
}
.ix-explain-card > summary::after {
  content: " ▸";
  display: inline-block;
  transition: transform 0.2s;
  margin-left: 6px;
}
.ix-explain-card[open] > summary::after { transform: rotate(90deg); }
.ix-explain-card .ec-body {
  padding: 1rem 1.3rem 1.1rem;
  background: var(--paper-warm);
  line-height: 1.85;
  font-size: 0.96rem;
  border-top: 1.5px dashed var(--empathy-deep);
}
.ix-explain-card .ec-body p:first-child { margin-top: 0; }
.ix-explain-card .ec-body p:last-child  { margin-bottom: 0; }

/* ============================================================
   引导/指南卡片 — 学院页面之间的"现在做什么"过渡
   ============================================================ */
.guide-card {
  margin: 2rem 0;
  padding: 1.6rem 1.9rem;
  background: var(--paper-warm);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--stamp-ink-lg);
  position: relative;
}
.guide-card::before {
  content: "";
  position: absolute;
  top: -1px; left: -1px;
  width: 8px;
  height: calc(100% + 2px);
  background: var(--passion);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}
.guide-card .gc-eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--passion-deep);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
}
.guide-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.7rem;
  line-height: 1.5;
  font-weight: 700;
}
.guide-card p { margin: 0 0 0.8rem; line-height: 1.85; }
.guide-card .gc-row {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  margin-top: 0.8rem;
}
.guide-card .gc-row .btn,
.guide-card .gc-row .btn-ghost { padding: 0.55rem 1.05rem; font-size: 0.9rem; }

/* ============================================================
   学习路径图 — 视觉化 step list
   ============================================================ */
.path-map {
  margin: 2rem 0;
  display: grid;
  gap: 0.9rem;
}
.path-step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 18px;
  align-items: stretch;
  padding: 1.1rem 1.3rem;
  background: var(--paper-warm);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--stamp-ink);
  position: relative;
}
.path-step .ps-num {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper-warm);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.path-step .ps-num.s1 { background: var(--sprouts); }
.path-step .ps-num.s2 { background: var(--empathy); }
.path-step .ps-num.s3 { background: var(--taste); color: var(--ink); }
.path-step .ps-num.s4 { background: var(--passion); }
.path-step .ps-num.s5 { background: var(--builders); }
.path-step h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.4rem;
  font-weight: 700;
  line-height: 1.45;
}
.path-step p { margin: 0 0 0.5rem; line-height: 1.7; font-size: 0.96rem; color: var(--ink-soft); }
.path-step .ps-link {
  display: inline-block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--passion-deep);
  border-bottom: 1.5px solid var(--passion);
  margin-top: 0.3rem;
}
.path-step::after {
  content: "↓";
  position: absolute;
  bottom: -22px; left: 27px;
  font-size: 1.2rem;
  color: var(--ink-faint);
  font-weight: 700;
}
.path-step:last-child::after { display: none; }
@media (max-width: 600px) {
  .path-step { grid-template-columns: 44px 1fr; gap: 12px; padding: 0.9rem; }
  .path-step .ps-num { width: 44px; height: 44px; font-size: 1.2rem; }
  .path-step::after { left: 21px; bottom: -20px; }
}

/* ============================================================
   入门小测验 — 互动推荐
   ============================================================ */
.start-quiz {
  margin: 2rem 0;
  padding: 2rem 2.2rem;
  background: var(--paper-warm);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--stamp-ink-lg);
}
.start-quiz .sq-eyebrow {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--passion-deep);
  text-transform: uppercase;
  margin-bottom: 0.7rem;
  text-align: center;
}
.start-quiz h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  margin: 0 0 1.2rem;
  text-align: center;
  font-weight: 700;
  line-height: 1.5;
}
.start-quiz .sq-progress {
  display: flex; gap: 6px; justify-content: center; margin-bottom: 1.4rem;
}
.start-quiz .sq-progress .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: background 0.2s;
}
.start-quiz .sq-progress .dot.active { background: var(--passion); }
.start-quiz .sq-progress .dot.done   { background: var(--sprouts); }

.start-quiz .sq-q {
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0 0 1rem;
  text-align: center;
  line-height: 1.55;
}
.start-quiz .sq-options {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.start-quiz .sq-options button {
  width: 100%;
  padding: 0.9rem 1.2rem;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, background 0.15s, box-shadow 0.12s;
  font-weight: 500;
}
.start-quiz .sq-options button:hover {
  background: var(--paper-warm);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}
.start-quiz .sq-result {
  display: none;
  padding: 1.4rem 1.6rem;
  background: var(--taste-soft);
  border: 2px solid var(--taste-deep);
  border-radius: var(--radius);
}
.start-quiz .sq-result.show { display: block; }
.start-quiz .sq-result h4 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--taste-deep);
  line-height: 1.5;
}
.start-quiz .sq-result p { margin: 0 0 0.8rem; line-height: 1.85; }
.start-quiz .sq-result .sq-restart {
  display: inline-block;
  margin-top: 0.6rem;
  margin-right: 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--ink-faint);
  cursor: pointer;
}

/* ============================================================
   小词典 / 名词页 — 字母/分类排版
   ============================================================ */
.glossary-page { max-width: 880px; margin: 0 auto; padding: 2.5rem 1.5rem 5rem; }
.glossary-search {
  width: 100%;
  padding: 1rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  background: var(--paper-warm);
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-pill);
  box-shadow: var(--stamp-ink);
  color: var(--ink);
  margin: 1rem 0 2rem;
  box-sizing: border-box;
}
.glossary-search:focus {
  outline: none;
  box-shadow: 5px 5px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.gloss-cat {
  margin: 2.2rem 0;
}
.gloss-cat-head {
  display: flex; align-items: baseline; gap: 12px; margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2.5px solid var(--ink);
}
.gloss-cat-head h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.4;
}
.gloss-cat-head .count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-faint);
}

.gloss-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.gloss-item {
  background: var(--paper-warm);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 0.9rem;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.gloss-item:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--ink);
}
.gloss-item h3 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--passion-deep);
  font-weight: 700;
  line-height: 1.4;
}
.gloss-item .en {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-left: 6px;
  font-weight: 500;
}
.gloss-item .def { margin: 0 0 0.5rem; font-size: 0.92rem; line-height: 1.65; color: var(--ink); }
.gloss-item .eg {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
  border-left: 3px solid var(--taste);
  padding: 0.4rem 0.65rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0;
}
.gloss-item.hidden { display: none; }
.gloss-empty {
  text-align: center;
  font-style: italic;
  color: var(--ink-faint);
  padding: 2rem;
  display: none;
}
.gloss-empty.show { display: block; }

/* ============================================================
   代码走读 · code walkthrough
   把代码切成多块，每一块都有"这段干啥"的儿童语言解释。
   用法：
     <div class="code-walk" data-lang="html">
       <div class="cw-step">
         <div class="cw-code"><pre><code>...</code></pre></div>
         <div class="cw-note">
           <h4>第 1 块：HTML 文档的"出生证明"</h4>
           <p>...解释...</p>
           <p class="cw-try"><strong>👉 试试改：</strong>...</p>
         </div>
       </div>
       ...
     </div>
   ============================================================ */
.code-walk {
  margin: 1.6rem 0;
  border: 2.5px solid var(--ink);
  border-radius: var(--radius-lg);
  background: var(--paper-warm);
  box-shadow: var(--stamp-ink-lg);
  overflow: hidden;
}
.code-walk .cw-toolbar {
  padding: 0.8rem 1.2rem;
  background: var(--ink); color: var(--paper-warm);
  font-family: var(--font-body);
  font-weight: 700; font-size: 0.92rem;
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.code-walk .cw-toolbar .cw-icon { font-size: 1rem; }
.code-walk .cw-toolbar .cw-tag {
  display: inline-block;
  padding: 0.18rem 0.6rem;
  background: var(--taste);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: var(--radius-pill);
  letter-spacing: 0.06em;
}
.code-walk .cw-toolbar .cw-help {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.85;
}

.code-walk .cw-controls {
  padding: 0.6rem 1.1rem;
  background: var(--paper-deep);
  display: flex; gap: 8px; flex-wrap: wrap;
  border-bottom: 1.5px solid var(--line);
}
.code-walk .cw-controls button {
  padding: 0.35rem 0.8rem;
  background: var(--paper-warm);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: 700;
  font-size: 0.82rem; color: var(--ink);
  cursor: pointer;
  transition: background 0.15s;
}
.code-walk .cw-controls button:hover { background: var(--taste-soft); }
.code-walk .cw-controls .cw-progress {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--ink-soft);
  align-self: center;
  font-family: var(--font-mono);
}

.code-walk .cw-steps {
  list-style: none;
  margin: 0; padding: 0;
  counter-reset: cwstep;
}
.code-walk .cw-step {
  counter-increment: cwstep;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1.5px dashed var(--ink-faint);
  position: relative;
}
.code-walk .cw-step:last-child { border-bottom: none; }
@media (max-width: 760px) {
  .code-walk .cw-step { grid-template-columns: 1fr; }
}
.code-walk .cw-step::before {
  content: counter(cwstep);
  position: absolute;
  top: 0.6rem; left: 0.7rem;
  width: 1.7rem; height: 1.7rem;
  border-radius: 50%;
  background: var(--passion);
  color: var(--paper-warm);
  font-family: var(--font-display);
  font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
}
.code-walk .cw-code {
  padding: 1rem 1.2rem 1rem 3rem;
  background: var(--ink);
  color: var(--paper-warm);
  border-right: 1.5px solid var(--ink);
  overflow: auto;
}
@media (max-width: 760px) {
  .code-walk .cw-code { border-right: none; border-bottom: 1.5px solid var(--ink); }
}
.code-walk .cw-code pre {
  margin: 0; background: transparent;
  padding: 0; border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: inherit;
}
.code-walk .cw-code code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
/* 关键字着色 */
.code-walk .cw-code .k { color: #f8b352; }   /* keyword */
.code-walk .cw-code .s { color: #a8d97e; }   /* string */
.code-walk .cw-code .c { color: #8a8fa3; font-style: italic; }   /* comment */
.code-walk .cw-code .t { color: #5fb6d6; }   /* tag */
.code-walk .cw-code .v { color: #f4c2a3; }   /* variable */

.code-walk .cw-note {
  padding: 1rem 1.3rem;
  background: var(--paper-warm);
  line-height: 1.75;
  font-size: 0.93rem;
}
.code-walk .cw-note h4 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: var(--passion-deep);
  line-height: 1.45;
  font-weight: 700;
}
.code-walk .cw-note p { margin: 0 0 0.6rem; }
.code-walk .cw-note p:last-child { margin: 0; }
.code-walk .cw-note .cw-try {
  margin-top: 0.7rem;
  padding: 0.55rem 0.8rem;
  background: var(--passion-soft);
  border-left: 3px solid var(--passion-deep);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
}
.code-walk .cw-note .cw-try strong { color: var(--passion-deep); }
.code-walk .cw-note .cw-aha {
  margin-top: 0.7rem;
  padding: 0.55rem 0.8rem;
  background: var(--taste-soft);
  border-left: 3px solid var(--taste-deep);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
}
.code-walk .cw-note .cw-aha strong { color: var(--taste-deep); }
.code-walk .cw-note code,
.code-walk .cw-note .cw-try code,
.code-walk .cw-note .cw-aha code {
  background: var(--paper-deep);
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
}

/* "聚光灯" 模式：只显示当前一步，其他变灰隐藏 */
.code-walk.spotlight .cw-step:not(.active) { display: none; }
.code-walk.spotlight .cw-step.active { display: grid; }
@media (max-width: 760px) {
  .code-walk.spotlight .cw-step.active { display: grid; grid-template-columns: 1fr; }
}

/* 折叠模式：默认每一步只看代码，点击展开解释 */
.code-walk.collapsed .cw-note {
  display: none;
}
.code-walk.collapsed .cw-step.open .cw-note {
  display: block;
}
.code-walk.collapsed .cw-step .cw-code {
  cursor: pointer;
  position: relative;
}
.code-walk.collapsed .cw-step .cw-code::after {
  content: "👈 点这段看解释";
  position: absolute;
  top: 0.5rem; right: 0.7rem;
  font-family: var(--font-body);
  font-size: 0.72rem;
  background: var(--taste);
  color: var(--ink);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  opacity: 0.9;
  pointer-events: none;
}
.code-walk.collapsed .cw-step.open .cw-code::after {
  content: "✓ 解释已展开";
  background: var(--sprouts-soft);
}

/* "完整代码" 折叠区，给写完之后整段 copy 用 */
.code-walk .cw-full {
  border-top: 2.5px solid var(--ink);
  background: var(--paper-deep);
}
.code-walk .cw-full summary {
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  list-style: none;
  user-select: none;
}
.code-walk .cw-full summary::-webkit-details-marker { display: none; }
.code-walk .cw-full summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.2s;
  margin-right: 4px;
}
.code-walk .cw-full[open] summary::before { transform: rotate(90deg); }
.code-walk .cw-full pre {
  background: var(--ink);
  color: var(--paper-warm);
  padding: 1.2rem;
  margin: 0;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.code-walk .cw-full .cw-copy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.4rem 0.9rem;
  background: var(--taste);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-weight: 700; font-size: 0.82rem;
  cursor: pointer; margin: 0.7rem 1.2rem;
  box-shadow: 2px 2px 0 var(--ink);
}
.code-walk .cw-full .cw-copy:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 var(--ink); }
