/* AI 编程闯关 · 样式（移动优先） */
:root {
  --navy-900: #0b2545;
  --navy-800: #102f57;
  --navy-700: #13315c;
  --navy-500: #1d4e89;
  --sky-50: #f4f9fd;
  --sky-100: #eaf4fb;
  --sky-200: #d6ecfa;
  --sky-300: #b6dcf3;
  --sky-400: #8ecae6;
  --sky-600: #2a7ab8;
  --sunset: #ff8c42;
  --sunset-soft: #ffe3cf;
  --gold: #ffc145;
  --coral: #f26b5b;
  --text: #10233f;
  --muted: #4a5d78;
  --line: #cfe0ee;
  --ok: #1d7a4b;
  --ok-bg: #e6f6ee;
  --bad: #a8361f;
  --bad-bg: #fdece7;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(11, 37, 69, .06), 0 6px 20px rgba(11, 37, 69, .07);
  --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Noto Sans Mono CJK SC", monospace;
  --top-h: 56px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.7; color: var(--text);
  background: linear-gradient(180deg, var(--sky-100) 0, var(--sky-50) 320px);
  min-height: 100vh;
}
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; color: var(--navy-900); }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--navy-500); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: .9em; background: var(--sky-100); border: 1px solid var(--line); border-radius: 6px; padding: .05em .35em; word-break: break-word; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--sunset); outline-offset: 2px; border-radius: 6px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--navy-900); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.tiny { font-size: .8rem; line-height: 1.5; margin-top: .5em; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
ul.compact, ol.compact { padding-left: 1.3em; margin: .3em 0 .9em; }
ul.compact li, ol.compact li { margin: .25em 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: linear-gradient(90deg, var(--navy-900), var(--navy-700)); color: #fff;
  box-shadow: 0 2px 10px rgba(11, 37, 69, .25);
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.05rem; margin-right: auto; white-space: nowrap; }
.brand-mark { width: 28px; height: 28px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.coin-pill { background: rgba(255, 193, 69, .18); color: #ffe2a3; }
.coin-ico { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3c4, var(--gold) 45%, #e8890c); box-shadow: inset 0 0 0 2px rgba(232, 137, 12, .6); }
.progress-pill { display: none; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px; background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: .9rem; cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .14); }
.sound-btn[aria-pressed="true"] { background: rgba(255, 140, 66, .25); border-color: var(--sunset); }
.sound-btn .label, .map-toggle-text { display: none; }
.banner { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin: 10px; padding: 10px 14px; border-radius: 12px; background: #fff4e5; border: 1px solid #f3c38f; color: #5a3410; }
.banner[hidden] { display: none; }
.link-btn { background: none; border: 0; color: var(--navy-500); text-decoration: underline; font: inherit; cursor: pointer; padding: 4px; }

/* ---------- 布局与侧栏 ---------- */
.layout { display: block; }
.main { padding: 14px 12px 40px; max-width: 980px; margin: 0 auto; outline: none; }
.sidebar {
  position: fixed; z-index: 40; top: var(--top-h); bottom: 0; left: 0; width: min(86vw, 320px);
  background: #fff; border-right: 1px solid var(--line); overflow-y: auto;
  transform: translateX(-105%); transition: transform .25s ease, visibility .25s; visibility: hidden;
}
.menu-open .sidebar { transform: none; visibility: visible; }
.backdrop { position: fixed; inset: var(--top-h) 0 0 0; z-index: 35; background: rgba(11, 37, 69, .4); display: none; }
.menu-open .backdrop { display: block; }
.sidebar-inner { padding: 14px 12px 30px; }
.home-link { display: block; padding: 8px 10px; border-radius: 10px; font-weight: 600; text-decoration: none; color: var(--navy-900); background: var(--sky-100); margin-bottom: 12px; }
.map-goal { margin-bottom: 14px; }
.map-goal h3 { display: flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--navy-700); margin: 0 0 6px; }
.goal-count { margin-left: auto; font-weight: 600; color: var(--muted); font-size: .8rem; }
.map-goal.complete .goal-count { color: var(--ok); }
.map-lessons { list-style: none; margin: 0; padding: 0 0 0 12px; border-left: 3px dashed var(--sky-300); }
.map-goal.complete .map-lessons { border-left-style: solid; border-left-color: var(--sunset); }
.map-link { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 2px 0; border-radius: 10px; text-decoration: none; color: var(--text); font-size: .92rem; line-height: 1.35; }
.map-link:hover { background: var(--sky-100); }
.map-link[aria-current="page"] { background: var(--sky-200); font-weight: 700; }
.map-link.locked { color: #7b8aa0; cursor: not-allowed; }
.node { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 700; background: #fff; border: 2px solid var(--sky-400); color: var(--navy-700); }
.node.done { background: var(--sunset); border-color: var(--sunset); color: var(--navy-900); }
.node.open { border-color: var(--navy-500); box-shadow: 0 0 0 3px var(--sky-200); }
.node.locked { border-color: #c9d3df; background: #f1f4f8; font-size: .7rem; }

/* ---------- 通用面板与按钮 ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; margin: 0 0 16px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 999px; border: 2px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.3; text-align: center; }
.btn.primary { background: var(--sunset); color: var(--navy-900); box-shadow: 0 3px 0 #d96a22; }
.btn.primary:hover { background: #ff9d5c; }
.btn.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #d96a22; }
.btn.big { min-height: 50px; padding: 10px 24px; font-size: 1.05rem; }
.btn.ghost { background: #fff; color: var(--navy-700); border-color: var(--sky-400); }
.btn.ghost:hover { background: var(--sky-100); }
.btn.run { background: var(--navy-700); color: #fff; }
.btn.run:hover { background: var(--navy-500); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger-ghost { background: #fff; color: var(--bad); border-color: #e8b2a6; }
.btn.disabled, .btn:disabled { background: #eef2f6; color: #66768c; border-color: #d5dde7; box-shadow: none; cursor: not-allowed; }
.small-btn { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.chip { min-height: 36px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--sky-400); background: #fff; color: var(--navy-700); font: inherit; font-size: .85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.eyebrow { font-size: .82rem; font-weight: 700; letter-spacing: .02em; color: var(--sky-600); margin: 0 0 .3em; }
.eyebrow.light { color: var(--sky-300); }

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 18px; margin-bottom: 16px; color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, rgba(255, 140, 66, .55), transparent 55%), radial-gradient(90% 80% at 0% 100%, rgba(142, 202, 230, .35), transparent 60%), linear-gradient(135deg, var(--navy-900), var(--navy-500));
}
.hero h1 { color: #fff; font-size: 1.7rem; max-width: 22em; }
.hero .lead { color: #dcebf7; max-width: 36em; font-size: 1.02rem; }
.hero-actions { margin: 16px 0 18px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; color: #cfe3f3; font-size: .95rem; }
.hero-stats strong { color: var(--gold); font-size: 1.25rem; margin-right: 2px; }
.how { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; counter-reset: how; }
.how li { counter-increment: how; display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; align-items: start; padding: 10px 12px; background: var(--sky-50); border-radius: 12px; }
.how li::before { content: counter(how); grid-row: span 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-700); color: #fff; font-weight: 700; }
.how strong { color: var(--navy-900); }
.how span { color: var(--muted); font-size: .93rem; }
.goal-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.goal-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--sky-50); }
.goal-card.complete { background: linear-gradient(180deg, #fff7ef, #fff); border-color: #f6c7a4; }
.goal-card h3 { margin: 0; }
.goal-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.goal-card-head .eyebrow { margin: 0; }
.goal-ico.big { font-size: 1.8rem; }
.bar { height: 10px; border-radius: 999px; background: var(--sky-200); overflow: hidden; margin: 6px 0; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--sunset), var(--gold)); border-radius: inherit; }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; text-align: center; gap: 2px; padding: 12px 8px; border-radius: 14px; border: 1px dashed #c3d3e3; background: #f7f9fb; color: #6a7a90; }
.badge.got { border: 1px solid #f6c7a4; background: linear-gradient(180deg, #fff3e6, #fff); color: var(--text); }
.badge-ico { font-size: 1.7rem; }
.badge-title { font-weight: 700; }
.badge-desc { font-size: .78rem; line-height: 1.4; }
.honest { border-left: 5px solid var(--sky-400); }
.locked-panel { text-align: center; padding: 34px 16px; }

/* ---------- 课程页 ---------- */
.lesson-head { padding: 6px 4px 12px; }
.lesson-head h1 { font-size: 1.55rem; margin-bottom: .25em; }
.lead-sm { color: var(--muted); font-size: 1.02rem; }
.review-note { display: inline-block; background: var(--ok-bg); color: var(--ok); border-radius: 10px; padding: 6px 12px; font-weight: 600; font-size: .92rem; }
.prose p:last-child { margin-bottom: 0; }
.intro .notice, .notice { background: #fff4e5; border: 1px solid #f3c38f; color: #5a3410; padding: 10px 12px; border-radius: 12px; }
.snippet { background: var(--navy-900); color: #e6f1fb; border-radius: 12px; padding: 12px 14px; overflow-x: auto; font-size: .88rem; line-height: 1.55; margin: .4em 0 1em; }
.snippet code { background: none; border: 0; padding: 0; color: inherit; word-break: normal; white-space: pre; }
.req-card { border: 2px dashed var(--sunset); background: #fffaf5; border-radius: 14px; padding: 12px 16px; margin-top: 10px; }
.req-card ul { margin: 0; padding-left: 1.2em; }
.req-title { font-weight: 700; margin-bottom: .4em; }
.terms { display: grid; gap: 10px; margin: 0; }
.term { padding: 10px 12px; border-radius: 12px; background: var(--sky-50); border-left: 4px solid var(--sky-400); }
.term dt { font-weight: 700; color: var(--navy-900); }
.term dfn { font-style: normal; }
.term dd { margin: 2px 0 0; color: #2d4260; font-size: .95rem; }
.steps { padding-left: 1.4em; margin: 0 0 12px; }
.steps li { margin: .45em 0; padding-left: .2em; }
.steps li::marker { font-weight: 700; color: var(--sunset); }
.criteria-box { background: var(--sky-50); border-radius: 12px; padding: 10px 14px; }
.criteria-box h3 { font-size: .95rem; margin-bottom: .3em; }
.criteria { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.criteria li { padding-left: 1.6em; position: relative; font-size: .95rem; }
.criteria li::before { content: "□"; position: absolute; left: .2em; color: var(--sky-600); }

/* ---------- 工作台 ---------- */
.wb-grid { display: grid; gap: 14px; }
.wb-editor, .wb-preview { min-width: 0; }
.wb-label { font-size: .82rem; font-weight: 700; color: var(--muted); margin: 0 0 6px; }
.wb-label-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.wb-label-row .wb-label { margin: 0; }
.width-switch { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--sky-100); color: var(--muted); font: inherit; font-size: .88rem; font-family: var(--mono); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.tab-tag { font-family: var(--font); font-size: .7rem; padding: 0 6px; border-radius: 999px; background: var(--sunset); color: var(--navy-900); font-weight: 700; }
.tab-tag.ro { background: #c9d6e3; color: #24364f; }
.code {
  display: block; width: 100%; height: 300px; resize: vertical; margin: 0; padding: 12px 14px;
  font-family: var(--mono); font-size: 14px; line-height: 1.6; tab-size: 2;
  color: #e6f1fb; background: var(--navy-900); border: 0; border-radius: 0 12px 12px 12px; white-space: pre; overflow: auto;
  caret-color: var(--sunset);
}
.code:focus-visible { outline: 3px solid var(--sunset); outline-offset: 0; }
.code.readonly { background: #1b3557; color: #c8d9ea; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.frame-wrap { position: relative; border: 2px solid var(--line); border-radius: 12px; background: #fff; overflow: auto; }
.frame-wrap.fixed-width { background: repeating-linear-gradient(45deg, #f2f6fa, #f2f6fa 8px, #e9f0f6 8px, #e9f0f6 16px); }
.preview { display: block; width: 100%; height: 300px; border: 0; background: #fff; margin: 0 auto; }
.stale-note { position: absolute; left: 8px; right: 8px; bottom: 8px; background: rgba(11, 37, 69, .9); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .85rem; text-align: center; }
.runlog { min-height: 52px; max-height: 160px; overflow: auto; background: #0e1f36; color: #d7e6f5; border-radius: 10px; padding: 8px 12px; font-family: var(--mono); font-size: .82rem; line-height: 1.5; }
.runlog .muted { color: #9fb6cc; font-family: var(--font); margin: 0; }
.log { margin: 0 0 4px; white-space: pre-wrap; word-break: break-word; }
.log.err { color: #ffb4a3; }
.log.nav { color: #ffd59a; }
.log-prefix { font-weight: 700; }
.check-frames { position: fixed; left: 0; top: 0; width: 0; height: 0; overflow: visible; opacity: 0; pointer-events: none; z-index: -1; }
.check-frames iframe { position: absolute; left: 0; top: 0; border: 0; }

/* ---------- 小测验与表单 ---------- */
.q { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 8px; margin: 0 0 12px; }
.q legend { display: flex; gap: 8px; align-items: flex-start; font-weight: 700; color: var(--navy-900); padding: 0 4px; }
.q-num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--sunset-soft); color: #8a3b12; display: grid; place-items: center; font-size: .85rem; }
.options { display: grid; gap: 6px; margin-top: 8px; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--sky-50); cursor: pointer; line-height: 1.5; }
.option:hover { border-color: var(--sky-400); }
.option input { margin-top: .3em; width: 18px; height: 18px; accent-color: var(--navy-500); flex: none; }
.option:has(input:checked) { border-color: var(--navy-500); background: var(--sky-200); }
.order-list { list-style: none; padding: 0; margin: 6px 0; display: grid; gap: 6px; }
.order-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); background: var(--sky-50); border-radius: 10px; }
.order-pos { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--navy-700); color: #fff; font-weight: 700; font-size: .85rem; }
.order-text { flex: 1; }
.order-btns { display: flex; gap: 4px; flex: none; }
.mini { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--sky-400); background: #fff; color: var(--navy-700); font-size: 1rem; cursor: pointer; }
.mini:disabled { opacity: .35; cursor: not-allowed; }
.q-feedback { margin: 8px 0 4px; font-size: .93rem; }
.q-feedback.ok { color: var(--ok); }
.q-feedback.bad { color: var(--bad); }
.field { margin: 0 0 12px; }
.field label { display: block; font-weight: 700; margin-bottom: 4px; color: var(--navy-900); }
.field input, .field textarea, .composed { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #9bb6cf; border-radius: 10px; background: #fff; color: var(--text); }
.field textarea { resize: vertical; min-height: 64px; }
.field [aria-invalid="true"] { border-color: var(--bad); background: #fffafa; }
.field-err { color: var(--bad); font-size: .88rem; margin: 4px 0 0; min-height: 0; }
.field-err:empty { display: none; }
.composed-wrap { margin-top: 10px; padding: 12px; border-radius: 12px; background: var(--ok-bg); }
.composed { font-family: var(--mono); font-size: .88rem; background: #fff; }

/* ---------- 检查与反馈 ---------- */
.check-sec { border-top: 4px solid var(--sunset); }
.hints { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.hints li { background: #fffaf2; border: 1px solid #f3d6b5; border-radius: 12px; padding: 10px 12px; outline: none; }
.hint-tag { display: inline-block; font-size: .78rem; font-weight: 700; color: #8a3b12; margin-bottom: 2px; }
.hint-text { white-space: pre-wrap; font-size: .93rem; }
.feedback { margin-top: 14px; outline: none; }
.fb-summary { font-weight: 700; padding: 10px 14px; border-radius: 12px; }
.fb-summary.ok { background: var(--ok-bg); color: var(--ok); }
.fb-summary.bad { background: var(--bad-bg); color: var(--bad); }
.fb-title { font-size: .9rem; color: var(--muted); margin: 12px 0 6px; }
.fb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fb-list li { display: grid; grid-template-columns: 26px 1fr; column-gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--sky-50); }
.fb-list li.bad { background: #fff6f3; }
.fb-ico { grid-row: span 2; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--ok); color: #fff; }
.fb-list li.bad .fb-ico { background: var(--bad); }
.fb-label { font-weight: 600; }
.fb-tip { grid-column: 2; color: #5e2a1d; font-size: .9rem; white-space: pre-wrap; }
.handoff { background: linear-gradient(180deg, #f7fbff, #fff); border-left: 5px solid var(--navy-500); }
.lesson-nav { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin: 20px 0 10px; }

/* ---------- 对话框 ---------- */
.dialog { border: 0; padding: 0; border-radius: 20px; width: min(92vw, 440px); box-shadow: 0 20px 60px rgba(11, 37, 69, .35); color: var(--text); }
.dialog::backdrop { background: rgba(11, 37, 69, .55); }
.dialog-body { position: relative; padding: 22px 20px 18px; overflow: hidden; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.celebrate .dialog-body { text-align: center; background: radial-gradient(100% 60% at 50% 0%, #fff1e3, #fff 70%); }
.celebrate .dialog-actions { justify-content: center; }
.coin-burst { height: 84px; display: grid; place-items: center; }
.big-coin { font-size: 64px; display: inline-block; animation: coin-pop .7s cubic-bezier(.2, 1.4, .4, 1) both, coin-spin 1.2s ease-in-out .2s; }
.celebrate-points { font-weight: 800; color: #b5520f; font-size: 1.1rem; }
.celebrate-badge { display: inline-block; background: var(--sky-100); border-radius: 999px; padding: 4px 14px; font-weight: 700; color: var(--navy-700); }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti span { position: absolute; top: -10px; width: 8px; height: 12px; border-radius: 2px; animation: fall 1.4s ease-in forwards; }
@keyframes coin-pop { from { transform: scale(.2) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes coin-spin { 50% { transform: rotateY(180deg); } }
@keyframes fall { to { transform: translate(var(--dx, 0), 360px) rotate(540deg); opacity: 0; } }

.site-footer { text-align: center; color: var(--muted); font-size: .82rem; padding: 10px 16px 28px; }

/* ---------- 更大的屏幕 ---------- */
@media (min-width: 560px) {
  .sound-btn .label, .map-toggle-text { display: inline; }
  .progress-pill { display: inline-flex; }
  .panel { padding: 22px 22px; }
  .hero { padding: 34px 30px; }
  .hero h1 { font-size: 2.1rem; }
  .how { grid-template-columns: 1fr 1fr; }
  .goal-cards { grid-template-columns: 1fr 1fr; }
  .terms { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .map-toggle { display: none; }
  .topbar { padding: 0 20px; }
  .layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); }
  .sidebar { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); transform: none; visibility: visible; transition: none; width: auto; z-index: 1; background: rgba(255, 255, 255, .7); }
  .backdrop, .menu-open .backdrop { display: none; }
  .main { padding: 24px 28px 48px; }
  .lesson-head h1 { font-size: 1.9rem; }
  .goal-cards { grid-template-columns: repeat(3, 1fr); }
  .site-footer { padding-left: 300px; }
}
@media (min-width: 1200px) {
  .main { max-width: 1120px; }
  .wb-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .code, .preview { height: 400px; }
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .confetti { display: none; }
}
/* 高对比模式 */
@media (forced-colors: active) {
  .btn, .chip, .tab, .mini, .icon-btn { border: 1px solid ButtonText; }
  .node { forced-color-adjust: none; }
}
