:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #4f46e5;
  --brand2: #6366f1;
  --ok: #16a34a;
  --ok-bg: #dcfce7;
  --no: #dc2626;
  --no-bg: #fee2e2;
  --gold: #f59e0b;
  --line: #e2e8f0;
  --shadow: 0 10px 30px rgba(2, 6, 23, .18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC",
               "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
  min-height: 100vh;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* Bilingual text blocks */
.bi .en { font-weight: 700; line-height: 1.25; }
.bi .zh { color: var(--muted); font-size: .92em; margin-top: 2px; }
.on-dark .bi .en { color: #f8fafc; }
.on-dark .bi .zh { color: #94a3b8; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  color: #e2e8f0; padding: 6px 4px 14px;
}
.topbar .who { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.topbar .who .av { font-size: 26px; }
.topbar .grow { flex: 1; }
.progress {
  height: 14px; border-radius: 999px; background: #334155;
  overflow: hidden; min-width: 160px; flex: 1; max-width: 340px;
}
.progress > i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand2), #22d3ee);
  transition: width .4s ease;
}
.progress-label { font-size: 13px; color: #cbd5e1; white-space: nowrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: 20px; padding: 22px;
  box-shadow: var(--shadow);
}
.hero { text-align: center; padding: 34px 22px; }
.hero h1 { margin: 0 0 4px; font-size: 30px; color: var(--brand); }
.hero p { color: var(--muted); margin: 4px 0 0; }

/* ---------- Login ---------- */
.field { margin: 18px 0; }
.field > label { font-weight: 700; display: block; margin-bottom: 8px; }
.field input[type=text] {
  width: 100%; padding: 14px 16px; font-size: 18px;
  border: 2px solid var(--line); border-radius: 12px;
}
.field input[type=text]:focus { outline: none; border-color: var(--brand); }

.avatars { display: flex; flex-wrap: wrap; gap: 10px; }
.avatars button {
  font-size: 30px; width: 58px; height: 58px; line-height: 1;
  border: 2px solid var(--line); border-radius: 14px; background: #f8fafc;
  cursor: pointer; transition: transform .1s;
}
.avatars button:hover { transform: scale(1.08); }
.avatars button.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }

.grades { display: flex; gap: 10px; flex-wrap: wrap; }
.grades button {
  flex: 1; min-width: 120px; padding: 14px; font-size: 16px; font-weight: 700;
  border: 2px solid var(--line); border-radius: 12px; background: #f8fafc; cursor: pointer;
}
.grades button.sel { border-color: var(--brand); background: #eef2ff; }
.grades small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 22px; font-size: 17px; font-weight: 700; cursor: pointer;
  border: none; border-radius: 14px; background: var(--brand); color: #fff;
  transition: filter .12s, transform .05s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.big { width: 100%; padding: 18px; font-size: 20px; }
.btn.ghost { background: #eef2ff; color: var(--brand); }
.btn.plain { background: #f1f5f9; color: var(--ink); }

/* ---------- Welcome back / roster ---------- */
.welcome { text-align: center; padding: 6px 0 4px; }
.welcome .wb-line { color: var(--muted); font-weight: 700; }
.welcome .wb-who { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 24px; font-weight: 800; margin: 10px 0 16px; }
.welcome .wb-who .av { font-size: 40px; }
.welcome .actions { flex-direction: column; }
.roster { display: flex; flex-wrap: wrap; gap: 10px; }
.roster-name {
  padding: 14px 18px; font-size: 18px; font-weight: 700; cursor: pointer;
  border: 2px solid var(--line); border-radius: 14px; background: #f8fafc; flex: 1 1 45%;
}
.roster-name.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }

/* ---------- Level map ---------- */
.map-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.map-head h2 { margin: 0; color: #f8fafc; }
.levels {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.node {
  position: relative; background: var(--card); border-radius: 18px; padding: 16px;
  box-shadow: var(--shadow); cursor: pointer; border: 3px solid transparent;
  transition: transform .1s;
}
.node:hover { transform: translateY(-3px); }
.node .n-idx {
  font-size: 13px; font-weight: 800; color: var(--brand); letter-spacing: .5px;
}
.node .n-title { margin-top: 4px; }
.node .n-badge { position: absolute; top: 10px; right: 12px; font-size: 22px; }
.node.locked { opacity: .55; cursor: not-allowed; filter: grayscale(.4); }
.node.cleared { border-color: var(--ok); }
.node.current { border-color: var(--brand); box-shadow: 0 0 0 4px #c7d2fe, var(--shadow); }
.node.boss { background: linear-gradient(160deg, #fff7ed, #ffedd5); }
.node.boss .n-idx { color: var(--gold); }
.node.optional .n-idx { color: #0891b2; }

/* ---------- Play screen ---------- */
.play-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: #e2e8f0; }
.play-head .lvl-tag { font-weight: 800; color: #a5b4fc; }
.q-prompt { font-size: 20px; margin: 4px 0 18px; }
.q-area { margin: 14px 0 8px; }

/* choice */
.opt {
  display: block; width: 100%; text-align: left; margin: 10px 0; padding: 14px 16px;
  border: 2px solid var(--line); border-radius: 14px; background: #f8fafc; cursor: pointer;
  font-size: 16px; transition: border-color .1s, background .1s;
}
.opt:hover { border-color: var(--brand2); }
.opt.sel { border-color: var(--brand); background: #eef2ff; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--no); background: var(--no-bg); }

/* chips (sort / order / match) */
.tray { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; min-height: 20px; }
.chip {
  padding: 10px 14px; border: 2px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font-size: 15px; user-select: none;
  transition: transform .08s, border-color .1s;
}
.chip:hover { transform: scale(1.04); }
.chip.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }
.chip.placed { opacity: .5; }
/* 反馈要准: the sort rung marks the chips that are in the wrong box */
.chip.bad { border-color: var(--no); background: #fef2f2; box-shadow: 0 0 0 3px #fecaca; }
.chip .seq { font-weight: 800; color: var(--brand); margin-right: 6px; }
.chip.c0 { border-color:#4f46e5; background:#eef2ff;} .chip.c1{border-color:#0891b2;background:#ecfeff;}
.chip.c2 { border-color:#16a34a; background:#dcfce7;} .chip.c3{border-color:#d946ef;background:#fdf4ff;}
.chip.c4 { border-color:#f59e0b; background:#fffbeb;}

.buckets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.bucket {
  border: 2px dashed var(--line); border-radius: 16px; padding: 12px; min-height: 96px; background: #fcfcfd;
}
.bucket.hot { border-color: var(--brand); background: #eef2ff; }
.bucket > .b-label { font-weight: 800; margin-bottom: 8px; text-align: center; }
.bucket .drop { display: flex; flex-wrap: wrap; gap: 8px; }

/* 第4关拖放：手指按在零件上时不要跟着滚页面，否则拖不动 */
#sortTray .chip, .bucket .chip { touch-action: none; }
/* 图片会被浏览器当成可原生拖拽的对象抢走手势；iOS 长按还会弹「存储图像」 */
#sortTray .chip img, .bucket .chip img { -webkit-user-drag: none; -webkit-touch-callout: none; }
/* 零件区也是个投放区（能把放错的拖回来），所以空了也得留住地方 */
.tray.tray-drop {
  min-height: 84px; padding: 10px; border: 2px dashed var(--line);
  border-radius: 16px; background: #fcfcfd; align-content: flex-start;
}
.tray.tray-drop.hot { border-color: var(--brand); background: #eef2ff; }
.chip.dragging { opacity: .3; }

/* 第6关组装也能拖：工作台与零件盒互为投放区。规则同上——手指按住零件时别滚页面，
   图片别被浏览器的原生拖拽/长按菜单抢走手势。 */
#craftBin .part, #benchSlots .slot { touch-action: none; }
#craftBin .part img, #benchSlots .slot img { -webkit-user-drag: none; -webkit-touch-callout: none; }
#benchSlots.hot { border-color: var(--brand); background: #eef2ff; }
#craftBin.hot { border-radius: 16px; box-shadow: 0 0 0 3px #c7d2fe; }
.slot.dragging, .part.dragging { opacity: .3; }

/* 第9关：应用软件卡能拖到系统软件底座上。底座本来就是虚线框，拖上去高亮即可。 */
#layerCards .sw-card { touch-action: none; }
#layerCards .sw-card img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.layer-base.hot { border-color: var(--brand); background: #eef2ff; }
.sw-card.dragging { opacity: .3; }
.chip-ghost {
  position: fixed; z-index: 999; margin: 0; pointer-events: none; transition: none;
  transform: scale(1.06) rotate(-2deg); box-shadow: 0 14px 28px rgba(15, 23, 42, .22);
}

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols .col-head { font-weight: 800; text-align: center; margin-bottom: 8px; color: var(--muted); }

/* report */
.report-box { background: #f8fafc; border: 2px solid var(--line); border-radius: 14px; padding: 16px; }
.report-box ol { margin: 8px 0 8px 18px; }
.report-box input[type=text] { width: 100%; padding: 12px 14px; font-size: 18px; border: 2px solid var(--line); border-radius: 10px; }

/* ---------- Scratch/MakeCode-style colored blocks (predict output) ---------- */
.blocks { background: #f1f5f9; border-radius: 16px; padding: 16px; margin: 4px 0 8px; }
.blocks .stage {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  color: var(--muted); font-size: 13px;
}
.blocks .stage .flag { font-size: 20px; }
.block {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 700; font-size: 15px;
  padding: 10px 14px; border-radius: 8px; margin: 3px 0;
  box-shadow: 0 2px 0 rgba(0,0,0,.18); white-space: nowrap;
}
.block .val {
  background: rgba(255,255,255,.95); color: #1e293b; border-radius: 999px;
  padding: 1px 10px; font-weight: 800;
}
.block-row { display: flex; }
.block-hat { border-top-left-radius: 16px; border-top-right-radius: 16px; }
.block.evt { background: #ca8a04; }      /* events - mustard */
.block.ctrl { background: #d97706; }     /* control (loops) - orange */
.block.var { background: #ea580c; }      /* variables - orange-red */
.block.look { background: #7c3aed; }     /* looks (say) - purple */
.block.snd { background: #db2777; }      /* sound - pink */
.c-wrap {                                 /* wrapper that holds a loop body, C-shape */
  border-left: 12px solid #d97706; border-radius: 0 0 0 10px;
  margin-left: 6px; padding: 4px 0 4px 10px;
}
.indent { margin-left: 22px; }

/* ---------- Picture-first options ---------- */
.vis { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vis-img { width: 72px; height: 72px; object-fit: contain; border-radius: 12px; }
.vis-cap { text-align: center; }
.vis-cap .en { font-size: 15px; }
.vis-cap .zh { font-size: 15px; font-weight: 600; }
.vis.noimg .vis-cap .en { font-size: 16px; }

.opt.opt-img { display: inline-flex; width: auto; text-align: center; }
#qArea:has(.opt-img) { display: flex; flex-wrap: wrap; gap: 12px; }
#qArea:has(.opt-img) .opt-img { flex: 1 1 130px; flex-direction: column; align-items: center; }
.chip.chip-img { border-radius: 16px; padding: 8px 10px; }
.chip.chip-img .vis-img { width: 56px; height: 56px; }
.chip.chip-img .vis-cap .en { font-size: 13px; }

/* ---------- operation hint line ---------- */
.op-hint {
  display: flex; flex-direction: column; gap: 1px; margin: 0 0 12px;
  background: #eff6ff; border-left: 4px solid var(--brand2);
  border-radius: 8px; padding: 8px 12px;
}
.op-hint-zh { font-weight: 700; color: #1e3a8a; font-size: 14px; }
.op-hint-en { color: #3b82f6; font-size: 12px; }

/* ---------- Feedback ---------- */
.feedback { margin-top: 16px; padding: 16px; border-radius: 14px; display: none; }
.feedback.show { display: block; animation: fade .2s; }
.feedback.ok { background: var(--ok-bg); border: 2px solid var(--ok); }
.feedback.no { background: var(--no-bg); border: 2px solid var(--no); }
.feedback .fb-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.no .fb-title { color: var(--no); }

.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.actions .grow { flex: 1; }

/* ---------- Result ---------- */
.result { text-align: center; padding: 30px 22px; }
.result .big-emoji { font-size: 64px; }
.result h2 { color: var(--brand); margin: 8px 0; }
.stars { font-size: 34px; letter-spacing: 6px; margin: 10px 0; }
.stat-row { display: flex; justify-content: center; gap: 26px; margin: 16px 0; }
.stat { text-align: center; }
.stat b { display: block; font-size: 26px; color: var(--ink); }
.stat span { color: var(--muted); font-size: 13px; }

.hint { color: var(--muted); font-size: 13px; margin-top: 10px; }
.center { text-align: center; }

/* ---------- teacher dashboard ---------- */
.dash-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; color: #f8fafc; }
.dash-meta { color: #cbd5e1; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dash-meta .dot { opacity: .5; }
.dash-auto { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.dash-table { width: 100%; border-collapse: collapse; }
.dash-table th, .dash-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.dash-table th { font-size: 12px; color: var(--muted); font-weight: 800; text-transform: none; white-space: nowrap; }
.dash-table td { font-size: 15px; }
.dash-av { font-size: 26px; }
.dash-name { font-weight: 700; }
.dash-prog { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.dash-bar { flex: 1; height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 80px; }
.dash-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand2), #22d3ee); transition: width .5s ease; }
.dash-bar-num { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dash-acc { color: var(--muted); }
.dash-ago { color: var(--muted); font-size: 13px; white-space: nowrap; }
.dash-ago.live { color: var(--ok); font-weight: 700; }
.dash-ago.live::before { content: "● "; }
.dash-report-btn { padding: 6px 10px; font-size: 13px; border-radius: 10px; }

/* 老师看板：备注名 / 隐藏与恢复 / 撤销提示 */
.dash-name-line { display: flex; align-items: center; gap: 6px; }
.dash-edit, .dash-del {
  background: none; border: none; cursor: pointer; font-size: 14px;
  padding: 2px 4px; border-radius: 6px; opacity: .45; transition: opacity .1s, background .1s;
}
.dash-edit:hover, .dash-del:hover { opacity: 1; background: #f1f5f9; }
.dash-realname { font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.dash-hidden-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.dash-hidden-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  border-top: 1px solid var(--line); flex-wrap: wrap;
}
.dash-purge { padding: 6px 10px; font-size: 13px; border-radius: 10px; background: #fef2f2; color: var(--no); }
.dash-purge:hover { background: #fee2e2; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px; max-width: 92vw;
  background: #0f172a; color: #f8fafc; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(15,23,42,.35); font-size: 15px; animation: fade .2s;
}
.toast-btn { padding: 4px 10px; font-size: 13px; border-radius: 9px; background: #334155; color: #f8fafc; }
.toast-btn:hover { background: #475569; }

/* ---------- teacher printable student report ---------- */
.rp-wrap { max-width: 820px; }
.rp-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 2px 14px; }
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rp-id { display: flex; align-items: center; gap: 14px; }
.rp-av { font-size: 46px; line-height: 1; }
.rp-name { font-size: 24px; font-weight: 800; }
.rp-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.rp-stats { display: flex; gap: 22px; }
.rp-stat { text-align: center; }
.rp-stat b { display: block; font-size: 24px; color: var(--brand); line-height: 1.15; }
.rp-stat span { color: var(--muted); font-size: 12px; }

.rp-section { margin-top: 16px; }
.rp-section > h2 { font-size: 18px; margin: 0 0 10px; color: #f8fafc; }

.rp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; border: 2px solid var(--line); background: #fff; }
.rp-chip.ok { border-color: var(--ok); background: var(--ok-bg); color: #166534; }
.rp-chip.warn { border-color: var(--gold); background: #fef3c7; color: #92400e; }
.rp-chip.todo { border-color: var(--line); background: #f1f5f9; color: var(--muted); }

.rp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rp-li { padding: 10px 12px; border-radius: 12px; background: #f8fafc; border: 1px solid var(--line); }
.rp-li-h { font-weight: 700; }
.rp-li-tag { color: var(--muted); font-weight: 400; font-size: 13px; }

.rp-note { padding: 12px 14px; border-radius: 12px; border-left: 5px solid var(--gold); background: #fffbeb; }
.rp-note.hard { border-left-color: var(--no); background: var(--no-bg); }
.rp-note-h { font-weight: 800; }
.rp-note-p { margin: 4px 0 0; color: #334155; font-size: 14px; }
.rp-note-tip { margin: 6px 0 0; color: #1e3a8a; font-size: 14px; }

.rp-muted { color: var(--muted); }
.card.rp-empty { text-align: center; color: var(--muted); margin-top: 14px; }

.rp-table { width: 100%; border-collapse: collapse; }
.rp-table th, .rp-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.rp-table th { font-size: 12px; color: var(--muted); font-weight: 800; white-space: nowrap; }
.rp-table td.rp-c { text-align: center; white-space: nowrap; }

.rp-foot { color: var(--muted); font-size: 12px; margin-top: 16px; text-align: center; }

@media print {
  html, body { background: #fff !important; }
  .rp-toolbar { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid var(--line); break-inside: avoid; }
  .rp-section, .rp-note, .rp-li { break-inside: avoid; }
  .rp-section > h2 { color: #0f172a; }
}

/* ---------- RPG: level, XP bar, character card ---------- */
.tb-level { display: inline-flex; align-items: center; gap: 6px; }
.tb-unit { color: #cbd5e1; font-weight: 700; font-size: 14px; margin-left: 10px; }
#tbXpWrap { display: inline-flex; align-items: center; gap: 8px; }
.lv-chip { background: #f59e0b; color: #fff; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.lv-title .en { font-size: 12px; color: #e2e8f0; } .lv-title .zh { font-size: 12px; color: #cbd5e1; }
.xpbar { display: inline-block; width: 120px; height: 10px; background: #334155; border-radius: 999px; overflow: hidden; vertical-align: middle; }
.xpbar.big { display: block; width: 100%; height: 14px; flex: 1; }
.xpbar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #f59e0b, #fde047); transition: width .5s ease; }

/* ---------- avatar picker (typed: human/machine/monster) ---------- */
.av-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.av-tab { flex: 1; padding: 8px; border: 2px solid var(--line); border-radius: 10px; background: #f8fafc; cursor: pointer; font-weight: 700; }
.av-tab.sel { border-color: var(--brand); background: #eef2ff; }
.av-tab .en { font-size: 12px; } .av-tab .zh { font-size: 13px; }
.av-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.av-pick { font-size: 30px; width: 56px; height: 56px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: transform .1s; }
.av-pick:hover { transform: scale(1.1); }
.av-pick.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }

/* ---------- 小助手 voice picker ---------- */
.voice-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.voice-pick { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; transition: transform .1s; }
.voice-pick:hover { transform: scale(1.05); }
.voice-pick.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }
.voice-pick .vp-name { font-size: 16px; font-weight: 700; }
.voice-pick .vp-play { font-size: 18px; }

/* ---------- world treasure map ---------- */
.treasure-map {
  position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 66vh;
  border-radius: 20px; overflow: hidden; box-shadow: var(--shadow);
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.10), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(255,255,255,.08), transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #2dd4bf 0%, #0ea5e9 55%, #0369a1 100%);
  border: 4px solid #f5e6c8;
}
.tm-route { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tm-path { fill: none; stroke: #fff7ed; stroke-width: 0.8; stroke-dasharray: 2 2.4; stroke-linecap: round; opacity: .85; }
.tm-islands { position: absolute; inset: 0; }
.island {
  position: absolute; transform: translate(-50%, -50%); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; width: 108px;
  transition: transform .12s;
}
.island:hover { transform: translate(-50%, -50%) scale(1.08); }
.island .island-emoji {
  font-size: 46px; line-height: 1;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,.35));
  background: radial-gradient(ellipse at 50% 78%, #fde68a 0 42%, transparent 46%);
}
.island .island-title { background: rgba(255,251,235,.92); border-radius: 8px; padding: 1px 8px; }
.island .island-title .en { font-size: 12px; font-weight: 800; color: #7c2d12; }
.island .island-title .zh { font-size: 16px; font-weight: 800; color: #7c2d12; }
/* 旗子插在岛的右肩：原来的 right:18px 会被居中偏上的头像挡掉一半（头像在 top:-30px
   left:50%，岛只有约 117px 宽）。往右挪到头像之外，两个都看得见。 */
.island .island-trophy {
  /* 居中靠 left:50% + 负 margin，不用 translateX(-50%)：bob / trophyland 的 keyframes
     是裸 transform，会把它覆盖掉。transform 留给动画。 */
  position: absolute; top: -12px; left: 50%; width: 30px; margin-left: -15px;
  text-align: center; font-size: 26px; line-height: 1; z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
  animation: bob 1.4s ease-in-out infinite;
}
/* 刚征服那一刻：奖杯落到山顶、沉一下定住，岛微震，金光扩散开。只播一次
   （见 renderWorldMap），播完回到常驻的 bob。按钮说「去领奖杯」，就得真的摆上去。 */
.island .island-trophy.landing { animation: trophyland .75s cubic-bezier(.34, 1.3, .64, 1) both, bob 1.4s ease-in-out .75s infinite; }
.island.just-won .island-emoji { animation: islandshake .36s ease-out .42s both; }
/* 金光：从奖杯落点扩散一圈，只放一次 */
.island.just-won .island-trophy::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px;
  margin: -20px 0 0 -20px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(252,211,77,.85) 0 35%, rgba(252,211,77,0) 70%);
  animation: trophyglow .9s ease-out .42s both;
}
@keyframes trophyland {
  0%   { opacity: 0; transform: translateY(-46px) scale(.8); }
  55%  { opacity: 1; transform: translateY(3px) scale(1.12); }
  75%  { transform: translateY(0) scale(.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes trophyglow {
  0%   { opacity: 0; transform: scale(.4); }
  35%  { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0; transform: scale(2.1); }
}
@keyframes islandshake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  60% { transform: translateX(2px); }
}
.island.current .island-emoji { animation: bob 1.6s ease-in-out infinite; }
.island.conquered .island-emoji { background: radial-gradient(ellipse at 50% 78%, #fcd34d 0 46%, transparent 50%); }
.island.fog { cursor: not-allowed; }
.island.fog .island-emoji.fogged { font-size: 40px; filter: blur(1px) grayscale(.3); background: radial-gradient(circle, rgba(226,232,240,.55) 0 60%, transparent 62%); }
/* 还没开发的单元：显示内容里的「敬请期待 / Coming soon」，不再是「迷雾 · ？？？」
   （那看着像加载失败）。双语同时呈现，和别处一致——英文小写、中文主色。 */
.island.fog .fog-txt { color: #e5e7eb; background: rgba(71,85,105,.45); border-radius: 8px; padding: 1px 8px; }
.island.fog .fog-txt .en { font-size: 11px; font-weight: 800; color: #e5e7eb; }
.island.fog .fog-txt .zh { font-size: 13px; font-weight: 800; color: #fff; }

.avatar-token {
  /* 站在山**旁边**（山脚左侧），不压在山顶上——山顶留给奖杯。
     水平位置用 left + 负 margin 固定，不用 translateX：bob 的 keyframes 是裸
     transform，会把它覆盖掉（头像原先就因此偏右了 17px）。transform 留给动画。 */
  position: absolute; top: 6px; left: 50%; width: 36px; margin-left: -56px;
  text-align: center; font-size: 30px; line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.4));
  animation: bob 1.2s ease-in-out infinite;
}
.avatar-token::after { content: ""; position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%); width: 20px; height: 6px; background: rgba(0,0,0,.25); border-radius: 50%; }

/* ---------- in-unit path map (the mountain as a route) ---------- */
.unit-map { aspect-ratio: 3 / 4; max-height: 72vh;
  background:
    radial-gradient(circle at 25% 20%, rgba(255,255,255,.10), transparent 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 10px, transparent 10px 20px),
    linear-gradient(160deg, #6ee7b7 0%, #34d399 45%, #0d9488 100%);
}
.stop { position: absolute; transform: translate(-50%, -50%); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 96px; text-align: center; transition: transform .12s; }
.stop:hover { transform: translate(-50%, -50%) scale(1.08); }
.stop .stop-dot {
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #065f46; background: #fff7ed;
  border: 3px solid #fbbf24; box-shadow: 0 3px 6px rgba(0,0,0,.3);
}
.stop.done .stop-dot { background: #dcfce7; border-color: var(--ok); }
.stop.current .stop-dot { border-color: var(--brand); box-shadow: 0 0 0 4px #c7d2fe, 0 3px 6px rgba(0,0,0,.3); animation: bob 1.5s ease-in-out infinite; }
.stop.boss .stop-dot { background: #fef3c7; border-color: #f59e0b; font-size: 22px; }
.stop .stop-title { background: rgba(255,251,235,.92); border-radius: 7px; padding: 1px 6px; }
.stop .stop-title .en { font-size: 11px; font-weight: 800; color: #7c2d12; } .stop .stop-title .zh { font-size: 14px; font-weight: 800; color: #7c2d12; }
.stop.fog { cursor: not-allowed; }
.stop.fog .stop-dot { background: rgba(226,232,240,.6); border-color: rgba(148,163,184,.7); color: #64748b; filter: blur(.3px); }
/* 山地图上的小人照旧浮在当前关卡点的正上方——「旁边站着」是寻宝地图上岛的规则，
   这里要把上面那条基础规则的水平偏移改回居中。 */
.unit-map .avatar-token { top: -26px; font-size: 26px; width: 32px; margin-left: -16px; }


.char-card { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.char-card .cc-av { font-size: 46px; }
.char-card .cc-main { flex: 1; }
.cc-line1 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.cc-title .zh { color: var(--muted); font-size: 13px; } .cc-title .en { font-size: 13px; color: var(--muted); }
.cc-xp { display: flex; align-items: center; gap: 10px; margin: 8px 0 4px; }
.cc-xp .progress-label { color: var(--muted); white-space: nowrap; }
.cc-stats { color: var(--muted); font-size: 13px; }

.reward-line { margin: 6px 0 2px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.xp-badge { background: #fef3c7; color: #92400e; font-weight: 800; padding: 4px 12px; border-radius: 999px; font-size: 15px; animation: pop .4s cubic-bezier(.2,1.3,.5,1); }
.levelup { background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; font-weight: 800; padding: 4px 14px; border-radius: 999px; font-size: 15px; animation: bob 1s ease-in-out infinite; }

/* ---------- Mountain map (ladder) ---------- */
.mountain { display: flex; flex-direction: column; gap: 10px; padding: 6px 2px; }
.rung {
  display: flex; align-items: center; gap: 12px; background: var(--card);
  border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow);
  border: 3px solid transparent; cursor: pointer; transition: transform .1s;
  max-width: 78%;
}
.rung:hover { transform: translateX(4px); }
.rung .rung-idx { font-size: 12px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.rung .rung-title { flex: 1; }
.rung .rung-title .en { font-size: 15px; } .rung .rung-title .zh { font-size: 13px; }
.rung .rung-badge { font-size: 22px; }
.rung.cleared { border-color: var(--ok); }
.rung.current { border-color: var(--brand); box-shadow: 0 0 0 4px #c7d2fe, var(--shadow); }
.rung.locked { opacity: .5; cursor: not-allowed; filter: grayscale(.5); }
.rung.soon { cursor: not-allowed; }
.rung.soon .rung-title .en::after { content: " 🚧"; }

/* ============================================================
   Computer Workshop (craft mode)
   ============================================================ */
.quest { display: flex; flex-direction: column; gap: 4px; border-left: 6px solid var(--brand); position: relative; }
.tts-btn {
  border: none; background: #eef2ff; color: var(--brand); cursor: pointer;
  font-size: 20px; line-height: 1; padding: 6px 10px; border-radius: 10px;
  position: absolute; top: 10px; right: 10px; transition: transform .1s, background .1s;
}
.tts-btn:hover { transform: scale(1.12); background: #c7d2fe; }
.tutorial .tts-btn { position: static; }
.quest-tag { font-size: 12px; font-weight: 800; color: var(--brand); letter-spacing: .5px; }
#questGoal .en { font-size: 18px; }
#questGoal .zh { font-size: 19px; font-weight: 700; color: #1e293b; }

.bench { margin-top: 14px; }
.bench-label { font-weight: 800; margin-bottom: 10px; }
.bench-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.bench-slots {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px;
  min-height: 120px; background: #f1f5f9; border-radius: 16px; padding: 14px;
  border: 3px dashed #cbd5e1;
}
.bench-empty { color: var(--muted); font-size: 14px; text-align: center; width: 100%; }
.slot {
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; cursor: pointer;
  transition: transform .1s, border-color .1s;
}
.slot:hover { transform: translateY(-3px) scale(1.03); border-color: var(--no); }
.slot .vis-img { width: 60px; height: 60px; }
.slot .vis-cap .en { font-size: 12px; }
.flow-arrow { font-size: 26px; color: var(--brand2); font-weight: 800; }
.flow-arrow.big { font-size: 34px; }
.flow-plus { font-size: 28px; color: var(--muted); font-weight: 800; }

.bench-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; align-items: center; }
/* 文案不能被挤成一列竖字：给个下限，挤不下就整行换到按钮上方 */
.bench-actions .bench-hint { flex: 1 1 120px; min-width: 120px; }
#buildBtn { flex: 1; background: linear-gradient(90deg, #f59e0b, #ef4444); font-size: 20px; }
#buildBtn[disabled] { background: #cbd5e1; }

.bench-feedback { display: none; margin-top: 12px; padding: 14px; border-radius: 14px; font-size: 16px; }
.bench-feedback.show { display: block; animation: fade .2s; }
.bench-feedback.no { background: #fef3c7; border: 2px solid #f59e0b; color: #92400e; }
.bench-feedback.warn { background: #fee2e2; border: 2px solid var(--no); color: #991b1b; }
.bench-feedback .en { font-weight: 700; } .bench-feedback .zh { color: inherit; opacity: .85; }

.bin { margin-top: 14px; }
.bin-label { font-weight: 800; margin-bottom: 10px; }
.bin-parts { display: flex; flex-wrap: wrap; gap: 10px; }
.part {
  background: #f8fafc; border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px; cursor: pointer;
  transition: transform .1s; flex: 0 0 auto; width: 92px;
}
.part:hover { transform: translateY(-4px) scale(1.05); border-color: var(--brand); }
.part.used { opacity: .32; pointer-events: none; filter: grayscale(.6); }
.part.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }

/* first-time onboarding tutorial banner */
.tutorial {
  display: flex; align-items: center; gap: 12px; margin: 10px 0 0;
  background: #fffbeb; border: 2px solid #fcd34d; border-radius: 14px; padding: 12px 14px;
  animation: fade .25s;
}
.tutorial .tut-icon { font-size: 28px; animation: bob 1s ease-in-out infinite; }
.tutorial .tut-txt { flex: 1; }
.tutorial .tut-zh { font-weight: 700; color: #92400e; font-size: 17px; }
.tutorial .tut-en { color: #b45309; font-size: 13px; }
.tutorial .tut-ok { flex: 0 0 auto; padding: 8px 14px; font-size: 14px; }

/* software rung */
.sw-task { text-align: center; margin: 4px 0 12px; }.sw-task-txt .en { font-size: 17px; font-weight: 700; } .sw-task-txt .zh { color: var(--muted); }
.sw-body { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #f1f5f9; border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.sw-machine { font-size: 52px; }
.sw-idle { color: var(--muted); font-size: 13px; }
.sw-cards { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.sw-card { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; text-align: center; width: 110px; transition: transform .1s; }
.sw-card:hover { transform: translateY(-4px) scale(1.05); border-color: var(--brand); }
.sw-icon { font-size: 34px; }
.sw-card-txt .en { font-size: 13px; } .sw-card-txt .zh { font-size: 12px; color: var(--muted); }

/* order / pipeline rung */
.order-tray { display: flex; flex-wrap: wrap; gap: 10px; }

/* 第7/10关：1→2→3(→4) 的格子，把步骤卡拖进去。顺序 = 空间位置，不再靠角上的数字。 */
.order-slots { display: flex; align-items: stretch; justify-content: center; flex-wrap: wrap; gap: 6px; max-width: 100%; }
.order-slot { max-width: 100%; }
.order-slot {
  position: relative; flex: 0 1 auto; min-width: 128px; min-height: 104px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 3px dashed #cbd5e1; border-radius: 16px; background: #f1f5f9; padding: 10px 8px 8px;
}
.order-slot.filled { border-style: solid; border-color: var(--brand2); background: #fff; }
.order-slot.hot { border-color: var(--brand); background: #eef2ff; }
.order-slot .slot-num {
  position: absolute; top: -10px; left: -8px; width: 24px; height: 24px; border-radius: 999px;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(15,23,42,.18);
}
.order-slot .slot-ph { color: #94a3b8; font-size: 26px; font-weight: 800; }
/* 答对的前缀：标 ✓ 并锁住——拖不动也点不掉，避免手滑把已经想对的一段拆了 */
.order-slot.ok { border-color: var(--ok); background: #ecfdf5; }
.order-slot.ok .slot-num { background: var(--ok); }
.order-slot.ok .slot-num::after { content: ""; }
.order-slot.ok::after {
  content: "✓"; position: absolute; top: -8px; right: -6px; font-size: 16px; font-weight: 800;
  color: var(--ok); background: #fff; border-radius: 999px; line-height: 1; padding: 2px 4px;
}
.order-slots .flow-arrow { align-self: center; font-size: 22px; }
.step-card {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 2px solid var(--line);
  border-radius: 14px; padding: 10px 14px; cursor: pointer; transition: transform .1s; position: relative;
}
.step-card:hover { transform: translateY(-2px); border-color: var(--brand); }
.step-card .step-icon { font-size: 24px; }
.step-card .step-txt .en { font-size: 13px; } .step-card .step-txt .zh { font-size: 12px; color: var(--muted); }
/* 格子里的步骤卡：外框交给格子，卡片自己不要再画一层框 */
.order-slot .step-card { border: none; background: transparent; padding: 0; }
.order-slot .step-card:hover { transform: none; }
.order-slot.ok .step-card { cursor: default; }
/* 可拖的步骤卡：手指按住别滚页面 */
#orderSlots .step-card, #orderTray .step-card { touch-action: none; }
#orderSlots .step-card img, #orderTray .step-card img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.step-card.dragging { opacity: .3; }
.step-anim { display: flex; flex-direction: column; align-items: center; }
.step-anim-icon { font-size: 40px; }

/* layer rung: system base with apps on top */
.layer-base {
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background: #e0e7ff; border: 2px dashed #6366f1; border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.layer-base.laid { border-style: solid; background: #c7d2fe; box-shadow: 0 0 0 3px #a5b4fc; }
.layer-base.laid::after { content: " ✓"; color: var(--ok); font-weight: 800; }
.sw-card.sel { border-color: var(--brand); background: #eef2ff; box-shadow: 0 0 0 3px #c7d2fe; }

.part .vis-img { width: 62px; height: 62px; }
.part .vis-cap .en { font-size: 12px; }
.part .vis-cap .zh { font-size: 11px; }

/* ---- success overlay + come-alive animation ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.72); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s;
}
.stage-card {
  background: #fff; border-radius: 24px; padding: 26px; max-width: 520px; width: 100%;
  text-align: center; box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.2,1.3,.5,1);
}
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stage-emoji { font-size: 56px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.stage-title { font-size: 20px; font-weight: 800; color: var(--brand); margin: 6px 0 4px; }
.stage-story .en { font-size: 16px; } .stage-story .zh { color: var(--muted); }

.machine-anim { margin: 16px 0; position: relative; }
.anim-flow { display: flex; align-items: center; justify-content: center; gap: 8px; }
.anim-part img { width: 68px; height: 68px; object-fit: contain; }
.anim-fallback { font-size: 12px; color: var(--muted); }
/* sequenced power-up glow */
.glow1 { animation: lightup 1.6s ease-in-out infinite; }
.glow2 { animation: lightup 1.6s ease-in-out .35s infinite; }
.glow3 { animation: lightup 1.6s ease-in-out .7s infinite; }
@keyframes lightup {
  0%,100% { filter: none; transform: scale(1); }
  30% { filter: drop-shadow(0 0 12px #fbbf24) brightness(1.15); transform: scale(1.12); }
}
.pulse1 { animation: arrowpulse 1.6s ease-in-out .2s infinite; }
.pulse2 { animation: arrowpulse 1.6s ease-in-out .55s infinite; }
@keyframes arrowpulse { 0%,100% { opacity:.35; transform: translateX(0);} 40% { opacity:1; transform: translateX(4px);} }

.fx-layer { position: absolute; inset: 0; pointer-events: none; }
/* sound: floating notes rising near the output (right side) */
.fx-sound .note { position: absolute; right: 12%; bottom: 20px; font-size: 24px; opacity: 0; animation: rise 1.6s ease-in infinite; }
.fx-sound .n1 { animation-delay: .5s; right: 18%; } .fx-sound .n2 { animation-delay: 1s; right: 8%; }
@keyframes rise { 0% { opacity:0; transform: translateY(0) scale(.7);} 25% { opacity:1;} 100% { opacity:0; transform: translateY(-70px) scale(1.1);} }
/* light: a warm beam flashing over the output */
.fx-light .beam { position: absolute; right: 10%; top: 6px; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, rgba(253,224,71,.9), rgba(253,224,71,0) 70%); animation: flash 1.3s ease-in-out infinite; }
@keyframes flash { 0%,100% { opacity:.15; transform: scale(.8);} 50% { opacity:1; transform: scale(1.15);} }
/* screen: little sparks popping over the output */
.fx-screen .spark { position: absolute; right: 14%; top: 10px; font-size: 22px; opacity: 0; animation: popspark 1.6s ease-out infinite; }
.fx-screen .s1 { animation-delay: .5s; right: 20%; top: 30px; } .fx-screen .s2 { animation-delay: 1s; right: 9%; top: 4px; }
@keyframes popspark { 0% { opacity:0; transform: scale(.4);} 30% { opacity:1; transform: scale(1.1);} 70% { opacity:1;} 100% { opacity:0; transform: scale(1);} }

.why-card { background: #eff6ff; border-radius: 14px; padding: 14px; margin: 14px 0; text-align: left; }
.why-tag { font-weight: 800; color: var(--brand); font-size: 13px; margin-bottom: 4px; }
.why-card .en { font-size: 14px; } .why-card .zh { font-size: 14px; color: #334155; }
.stage-card .actions { flex-direction: column; }

/* ---------- 存档码（仅线上博物馆版用到） ----------
   线上是纯静态站、不存任何用户数据，进度靠一串自包含的码带走。
   课堂局域网版这些元素都是 display:none，用不到这几条。 */
.tb-code { flex: 0 0 auto; padding: 7px 12px; font-size: 13px; }
.code-in { border-top: 1px dashed var(--line); padding-top: 16px; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-row input[type=text] {
  flex: 1; min-width: 0; padding: 12px 14px; font-size: 15px;
  border: 2px solid var(--line); border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.code-row input[type=text]:focus { outline: none; border-color: var(--brand); }
.code-row .btn { flex: 0 0 auto; }
.hint.good { color: var(--ok); font-weight: 700; }
.hint.bad { color: var(--no); font-weight: 700; }
.code-card textarea {
  width: 100%; margin-top: 10px; padding: 12px; resize: none;
  border: 2px solid var(--line); border-radius: 12px; background: #f8fafc;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

/* ---------- 登顶：征服一座山 ----------
   只在**第一次**把一座山全部通关时出现。关卡级庆祝是白卡，这张是金卡——
   两件事不该长一个样。 */
.stage-card.summit {
  position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fffdf5, #fff 42%);
  border: 2px solid var(--gold);
  box-shadow: 0 18px 50px rgba(245, 158, 11, .28);
}
.stage-card.summit .stage-title { color: #b45309; }
.summit-stats { display: flex; gap: 10px; justify-content: center; margin: 16px 0 4px; }
.summit-stat {
  flex: 1 1 0; min-width: 0; padding: 12px 8px; border-radius: 14px;
  background: #fffbeb; border: 1px solid #fde68a;
}
.ss-ico { font-size: 20px; line-height: 1; }
.ss-big { font-weight: 800; font-size: 17px; color: #b45309; margin-top: 4px; }
.ss-sub { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -14px; width: 8px; height: 13px; border-radius: 2px;
  opacity: 0; animation: confetti-fall 2.6s linear forwards;
}
@keyframes confetti-fall {
  0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
  8%   { opacity: 1; }
  100% { opacity: 0; transform: translateY(420px) rotate(520deg); }
}
/* 登顶卡上的两个动作：领奖杯是主动作（实心金），存档是次动作（描边）。
   .btn.plain 的浅灰底在这张近白色的卡上几乎看不见，必须改。 */
.stage-card.summit #toMapBtn {
  background: linear-gradient(180deg, #f59e0b, #d97706); color: #fff;
  font-weight: 800; box-shadow: 0 6px 18px rgba(217, 119, 6, .35);
}
.stage-card.summit #summitSaveBtn {
  background: #fffbeb; color: #b45309; border: 2px solid #fde68a; font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  /* 奖杯照样要「摆上」，只是不飞——奖杯直接在那儿，岛不震，也不放金光 */
  .island .island-trophy.landing { animation: none; }
  .island.just-won .island-emoji { animation: none; }
  .island.just-won .island-trophy::after { display: none; }
}
