/* =========================================================================
 * 氨基酸闯关游戏 — 样式
 * 设计方向：「暗室荧光成像 · 分子代码」
 *   - 视觉叙事：凝胶电泳成像仪里，被荧光标记的分子在暗室中发光
 *   - 分类色 = 荧光标记色；氨基酸字母/缩写/密码子 = 分子代码（等宽字体）
 *   - Signature：结构式 SVG 的荧光发光
 * ========================================================================= */

:root {
  /* 暗室背景 */
  --lab: #070a14;
  --gel: #0e1425;        /* 凝胶面板 */
  --plate: #121a2f;      /* 卡片 */
  --plate-2: #17203a;    /* 次级面板/选项 */
  --line: #233050;       /* 描边 */
  --line-hi: #33507a;    /* 高亮描边 */

  /* 文字 */
  --text: #eef2fc;
  --muted: #a3afc8;

  /* 主强调色（正确 / 确认 / 主按钮，青绿，饱和 <80%） */
  --fluor: #4ade9b;
  --fluor-dim: #1fa97c;
  --fluor-tint: rgba(74, 222, 155, 0.12);
  --gold: #eec25f;
  --danger: #ef6478;

  /* 分类标记色（内容语义色，降饱和） */
  --np: #93a5c4;   /* 非极性 */
  --ar: #e9bd54;   /* 芳香 */
  --po: #57bfee;   /* 极性 */
  --ac: #e96a7e;   /* 酸性 */
  --ba: #aa8cf0;   /* 碱性 */

  /* 字体：Outfit 标题 + JetBrains Mono 分子代码 */
  --font-body: "Outfit", "PingFang SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 12px;
  --shadow: 0 10px 32px rgba(0, 0, 0, 0.45);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  /* 推广视觉反哺：HUD 玻璃面板 */
  --panel-glass: rgba(10, 16, 32, 0.78);
  --panel-border: rgba(74, 222, 155, 0.22);
  --panel-glow: 0 0 32px rgba(74, 222, 155, 0.07);
  --hud-accent: rgba(74, 222, 155, 0.55);
}

:where(#app, #app *) { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: clip; }
html, body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font-body);
  background: var(--lab);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
body { padding-bottom: 28px; }

/* ---------- 推广视觉反哺：暗室荧光场景层 ---------- */
.lab-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.lab-grid {
  position: absolute;
  inset: -20% -10%;
  background-image:
    linear-gradient(rgba(74, 222, 155, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(74, 222, 155, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 42%, #000 20%, transparent 72%);
  transform: perspective(600px) rotateX(58deg) scale(1.15);
  transform-origin: 50% 100%;
  opacity: 0.55;
}
.lab-glow {
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: min(520px, 90vw);
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(74, 222, 155, 0.18) 0%, rgba(74, 222, 155, 0.06) 38%, transparent 68%);
  filter: blur(8px);
}
.lab-gel-lanes {
  position: absolute;
  inset: 12% 6%;
  background:
    repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), rgba(74, 222, 155, 0.04) calc(25% - 1px), rgba(74, 222, 155, 0.04) 25%),
    linear-gradient(180deg, transparent 0%, rgba(74, 222, 155, 0.03) 50%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, #000 10%, transparent 75%);
  opacity: 0.7;
}
.lab-frame {
  position: absolute;
  width: 56px;
  height: 56px;
  border: 2px solid var(--hud-accent);
  opacity: 0.35;
}
.lab-frame--tl { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.lab-frame--tr { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.lab-frame--bl { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.lab-frame--br { bottom: 12px; right: 12px; border-left: none; border-top: none; }

#app {
  position: relative; z-index: 1;
  max-width: 760px; margin: 0 auto;
  padding: 0 16px 20px;
}

:where(#app) button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

:focus-visible { outline: 2px solid var(--fluor); outline-offset: 2px; border-radius: 4px; }

.code, .build-btn .c3, .build-btn .c1, .build-chip .c1, .build-chip .c3,
.spell-letter, .build-target b, .opt .code {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- SVG 图标统一规格 ---------- */
.stat .ico { display: flex; align-items: center; }
.stat .ico svg { width: 13px; height: 13px; }
.combo-badge { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.combo-badge svg { width: 13px; height: 13px; }
.hearts .h { display: flex; align-items: center; }
.hearts .h svg { width: 17px; height: 17px; color: var(--danger); }
.fb-ico { display: flex; align-items: center; }
.fb-ico svg { width: 19px; height: 19px; }
.feedback.correct .fb-ico { color: var(--fluor); }
.feedback.wrong .fb-ico { color: var(--danger); }
.result-xp .ico { display: flex; align-items: center; }
.result-xp .ico svg { width: 16px; height: 16px; color: var(--gold); }
/* 锁定角标：挂在 node 上（气泡右上角），不与序号重叠、不受气泡 40% 透明度影响 */
.node .lock {
  position: absolute; top: -5px; left: calc(50% + 15px);
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--plate-2); border: 1.5px solid var(--line-hi);
  z-index: 2;
}
.node .lock svg { width: 12px; height: 12px; color: #7e8db0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; margin: 0 -16px 10px; padding-left: 16px; padding-right: 16px;
  background: var(--panel-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: var(--panel-glow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: .5px; }
.brand .logo {
  font-size: 22px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: rgba(74, 222, 155, 0.08); border: 1px solid var(--panel-border);
  box-shadow: 0 0 16px rgba(74, 222, 155, 0.12);
}
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.stat-row { display: flex; gap: 8px; }
.stat {
  display: flex; align-items: center; gap: 6px;
  background: var(--plate); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px;
}
.stat .ico { font-size: 14px; }
.stat.xp .ico { color: var(--gold); }
.stat.streak .ico { color: #ff9600; animation: breathe 2.4s ease-in-out infinite; }
.sfx-toggle {
  cursor: pointer;
  color: var(--text);
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
}
.sfx-toggle .ico { display: flex; align-items: center; color: #38bdf8; }
.sfx-toggle .ico svg { width: 14px; height: 14px; }
.sfx-toggle.is-muted .ico { color: var(--muted); }
.sfx-toggle:hover { border-color: var(--line-hi); }
@keyframes breathe { 50% { transform: scale(1.14); } }

/* ---------- 首页 ---------- */
.home-hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px;
  padding: 22px 18px; text-align: left;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--panel-glow);
  position: relative;
  overflow: hidden;
}
.home-hero::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--hud-accent), var(--hud-accent)) 0 0 / 28px 2px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 0 0 / 2px 28px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 100% 0 / 28px 2px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 100% 0 / 2px 28px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 0 100% / 28px 2px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 0 100% / 2px 28px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 100% 100% / 28px 2px no-repeat,
    linear-gradient(var(--hud-accent), var(--hud-accent)) 100% 100% / 2px 28px no-repeat;
  opacity: 0.45;
}
.home-hero .hero-text { position: relative; z-index: 1; }
.home-hero .hero-progress {
  margin-top: 14px;
  display: grid; gap: 6px;
  max-width: 220px;
}
.home-hero .hero-progress .hp-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted);
}
.home-hero .hero-progress .hp-val {
  font-family: var(--font-mono); font-weight: 800; color: var(--fluor); font-size: 13px;
}
.home-hero .hero-progress-bar {
  height: 6px; border-radius: 999px; background: rgba(74, 222, 155, 0.1);
  border: 1px solid rgba(74, 222, 155, 0.2); overflow: hidden;
}
.home-hero .hero-progress-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--fluor-dim), var(--fluor));
  box-shadow: 0 0 10px rgba(74, 222, 155, 0.45);
  transition: width .5s var(--spring);
}
.home-hero .hero-text h1 {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 4.2vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.home-hero .hero-text h1 .accent { color: var(--fluor); }
.home-hero .hero-text p { color: var(--muted); margin-top: 8px; font-size: 14px; line-height: 1.65; max-width: 34ch; }
.home-hero .hero-orb {
  width: 96px; height: 96px; flex: none; position: relative; z-index: 1;
  border-radius: 22px; background: rgba(8, 14, 28, 0.6); border: 1px solid rgba(74, 222, 155, 0.4);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 36px rgba(74, 222, 155, 0.2), inset 0 0 24px rgba(74, 222, 155, 0.1);
}
.home-hero .hero-orb::after {
  content: '';
  position: absolute; left: 50%; bottom: -10px;
  width: 88px; height: 18px;
  transform: translateX(-50%) perspective(60px) rotateX(72deg);
  border: 2px solid rgba(74, 222, 155, 0.35);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(74, 222, 155, 0.25);
}
.home-hero .hero-orb .structure-svg {
  filter: drop-shadow(0 0 8px rgba(74, 222, 155, 0.45));
}

.unit { margin-top: 22px; }
.unit-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }
.unit-head .u-icon {
  width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 800; letter-spacing: 1px;
  font-family: var(--font-mono); color: var(--text);
  background: rgba(74, 222, 155, 0.06); border: 1px solid var(--panel-border);
}
.unit-head .u-title { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.unit-head .u-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.path {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
  padding: 16px 14px;
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--panel-glow);
}
.node {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 86px;
  animation: node-in .45s var(--spring) backwards;
  animation-delay: calc(var(--i, 0) * 55ms);
}
@keyframes node-in { from { opacity: 0; transform: translateY(14px) scale(.85); } }
.node .bubble {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; color: #fff; font-family: var(--font-mono);
  background: var(--plate); border: 2px solid var(--line-hi);
  transition: transform .2s var(--spring), box-shadow .2s ease, border-color .2s ease;
  position: relative;
}
.node .bubble .d3 { font-size: 13px; font-weight: 900; letter-spacing: .5px; color: var(--ba); }
.node .bubble .check {
  position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--fluor); color: #04251a; display: none; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 900; border: 2px solid var(--lab);
}
.node.done .bubble .check { display: flex; }
.node.unlocked .bubble { cursor: pointer; border-color: #2c4770; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.node.unlocked .bubble:hover { transform: translateY(-3px) scale(1.05); border-color: var(--fluor); }
.node.locked .bubble { opacity: .4; border-color: var(--line); }
.node .stars { display: flex; gap: 2px; height: 14px; }
.node .stars .s { color: #33405e; font-size: 12px; }
.node .stars .s.on { color: var(--gold); }
.node .lbl { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.3; max-width: 88px; }

.node.glow .bubble { border-color: var(--fluor); box-shadow: 0 0 0 1px rgba(74, 222, 155, 0.35); }
.node.current .bubble { animation: pulse 1.8s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 155, .35); }
  50% { box-shadow: 0 0 0 10px rgba(74, 222, 155, 0); }
}

/* ---------- 关卡进行中 ---------- */
.level-top { display: flex; align-items: center; gap: 12px; padding: 8px 0 4px; }
.btn-back {
  width: 38px; height: 38px; border-radius: 10px; background: var(--plate);
  border: 1px solid var(--line); font-size: 15px; flex: none; color: var(--muted);
}
.btn-back:hover { color: var(--text); border-color: var(--line-hi); }
.progress-wrap { flex: 1; }
.progress-bar { height: 10px; background: var(--gel); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, var(--fluor-dim), var(--fluor));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: width .4s var(--spring);
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.28) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer { 55%, 100% { transform: translateX(100%); } }
.progress-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.hearts { display: flex; gap: 3px; font-size: 16px; }
.hearts .h { transition: transform .2s, opacity .2s, filter .2s; }
.hearts .h.lost { opacity: .18; filter: grayscale(1); }
.combo-badge { font-size: 12px; font-weight: 800; color: #ff9600; min-width: 40px; text-align: right; }

.card {
  background: var(--panel-glass);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-top: 10px;
  box-shadow: var(--panel-glow);
  backdrop-filter: blur(10px);
  position: relative;
}
.card::before {
  content: '';
  position: absolute; inset: 6px; pointer-events: none; border-radius: calc(var(--radius) - 4px);
  border: 1px solid rgba(74, 222, 155, 0.08);
}
.q-prompt { font-size: 19px; font-weight: 700; line-height: 1.55; text-align: center; }
.q-prompt .prompt-html { margin-top: 12px; }
.q-tag {
  display: inline-block; font-size: 12px; color: var(--muted);
  background: var(--plate-2); border: 1px solid var(--line);
  padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}

/* ---------- 结构式（Signature：荧光发光） ---------- */
.struct-big { display: flex; justify-content: center; padding: 12px 0; }
.structure-svg { filter: drop-shadow(0 0 5px rgba(150, 200, 255, 0.22)); }
.structure-svg .bond { stroke: #e3e9f7; stroke-width: 3; stroke-linecap: round; }
.structure-svg .bond.db { stroke-width: 2.4; }
.structure-svg path { stroke: #e3e9f7; }
.structure-svg text { fill: #a3afc8; }
.structure-svg rect[fill="none"] { display: none; }
.structure-svg .atom { stroke: none; }
.structure-svg .atom-label {
  font-weight: 900; text-anchor: middle; dominant-baseline: central;
  font-family: var(--font-mono);
}
.structure-svg .atom-label[data-el="N"] { filter: drop-shadow(0 0 4px rgba(80,140,255,.55)); }
.structure-svg .atom-label[data-el="O"] { filter: drop-shadow(0 0 4px rgba(255,90,70,.55)); }
.structure-svg .atom-label[data-el="S"] { filter: drop-shadow(0 0 4px rgba(255,214,10,.5)); }
.structure-svg .aromatic-ring { fill: none; stroke: #c8d4f0; stroke-width: 1.8; stroke-dasharray: 3 2; }
.structure-svg .backbone-label { font-size: 15px; fill: #ffd60a; font-weight: 800; }
.structure-svg .backbone-label.r-label { fill: #3fc9ff; }

/* 教学用骨架大图 */
.backbone-svg { overflow: visible; display: block; }
.backbone-svg .bond { stroke: #eef2fc; stroke-width: 4; stroke-linecap: round; }
.backbone-svg .atom-label { font-weight: 900; }
.backbone-svg .backbone-label { font-size: 16px; font-weight: 800; fill: #ffd60a; filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.backbone-svg .backbone-label.r-label { fill: #3fc9ff; }

/* ---------- 选项 ---------- */
.options { display: grid; gap: 10px; margin-top: 18px; }
.options.cols-2 { grid-template-columns: 1fr 1fr; }
.options.cols-4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.opt {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  background: var(--plate-2); border: 2px solid var(--line); border-radius: 13px;
  font-size: 16px; font-weight: 600; text-align: left;
  transition: transform .18s var(--spring), border-color .18s ease, background .18s ease;
}
.opt:hover { border-color: var(--line-hi); background: #1b2644; }
.opt:active { transform: scale(0.98); }
.opt .opt-key { color: var(--muted); font-weight: 700; margin-right: 2px; font-family: var(--font-mono); font-size: 14px; }
.opt .opt-svg { display: flex; justify-content: center; flex: none; }
.opt.correct { border-color: var(--fluor); background: var(--fluor-tint); box-shadow: inset 0 0 0 1px rgba(74, 222, 155, 0.35); animation: pop .3s; }
.opt.wrong { border-color: var(--danger); background: rgba(239, 100, 120, 0.12); animation: shake .4s; }
.opt.disabled { pointer-events: none; }
.opt.dim { opacity: .4; }
@keyframes pop { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- 配对 ---------- */
.match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.match-side { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  padding: 12px 14px; background: var(--plate-2); border: 2px solid var(--line);
  border-radius: 12px; font-size: 15px; font-weight: 600; text-align: center;
  transition: transform .18s var(--spring), border-color .18s ease, background .18s ease;
}
.match-item.sel { border-color: var(--po); background: rgba(63,201,255,.12); }
.match-item.done { opacity: .32; pointer-events: none; }
.match-item:hover:not(.done) { border-color: var(--line-hi); }
.match-item .m-code { font-family: var(--font-mono); color: var(--po); font-size: 18px; font-weight: 800; }

/* ---------- 分类桶 ---------- */
.sort-buckets { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.sort-bucket {
  flex: 1; min-width: 120px; padding: 10px; border-radius: 14px; text-align: center;
  background: var(--plate-2); border: 2px dashed var(--line-hi); min-height: 72px;
  transition: all .15s;
}
.sort-bucket .b-name { font-size: 13px; font-weight: 700; }
.sort-bucket .b-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.sort-bucket.hover { border-color: var(--fluor); background: var(--fluor-tint); }
.sort-bucket.correct { border-color: var(--fluor); box-shadow: inset 0 0 0 1px rgba(74, 222, 155, 0.35); }
.sort-bucket.wrong { border-color: var(--danger); }
.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.sort-item {
  padding: 10px 14px; background: var(--plate-2); border: 2px solid var(--line);
  border-radius: 12px; font-weight: 600; cursor: pointer;
  transition: transform .18s var(--spring), border-color .18s ease;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sort-item:hover { border-color: var(--line-hi); }
.sort-item:active { transform: scale(0.97); }
.sort-item.sel { border-color: var(--po); box-shadow: inset 0 0 0 1px rgba(87, 191, 238, 0.4); }
.sort-item.placed { cursor: grab; }
.sort-item.dragging { opacity: 0.55; transform: scale(1.04); border-color: var(--fluor); }
.sort-item .si-svg { pointer-events: none; }
.sort-actions { text-align: center; margin-top: 16px; }
.sort-hint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 10px; }

/* ---------- 输入 ---------- */
.type-box { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.type-box input {
  background: var(--gel); border: 2px solid var(--line); border-radius: 12px;
  padding: 13px 16px; font-size: 20px; font-weight: 800; color: var(--text);
  text-align: center; width: 180px; letter-spacing: 3px; text-transform: uppercase; outline: none;
  font-family: var(--font-mono);
}
.type-box input:focus { border-color: var(--po); box-shadow: inset 0 0 0 1px rgba(87, 191, 238, 0.4); }
.btn-primary {
  background: var(--fluor); color: #04251a; font-weight: 800; font-size: 15px;
  padding: 13px 22px; border-radius: 12px;
  box-shadow: 0 3px 0 var(--fluor-dim), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: all .1s ease;
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--fluor-dim), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-primary:disabled { opacity: .4; box-shadow: none; }

/* ---------- 反馈条 ---------- */
.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 12px; font-size: 14px; display: none; }
.feedback.show { display: flex; }
.feedback.correct { background: var(--fluor-tint); border: 1px solid rgba(74, 222, 155, 0.4); }
.feedback.wrong { background: rgba(239, 100, 120, 0.12); border: 1px solid rgba(239, 100, 120, 0.4); }
.feedback .fb-ico { margin-right: 10px; font-size: 20px; }
.feedback .fb-txt b { color: var(--text); }
.feedback .fb-txt .fb-key { color: var(--fluor); white-space: nowrap; font-weight: 800; }
.feedback.wrong .fb-hint {
  display: block; margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed rgba(239, 100, 120, 0.35);
  line-height: 1.65; color: var(--muted); font-size: 13px;
}
.feedback.wrong .fb-hint strong { color: #ffd60a; font-weight: 700; }
.continue-row { margin-top: 16px; display: flex; justify-content: center; }

/* ---------- 3D 宿主 ---------- */
.three3d-host {
  width: 100%; height: 300px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #1a2545, #0a1122 72%);
  border: 1px solid var(--line); margin-top: 14px;
  box-shadow: inset 0 0 30px rgba(0,0,0,.4);
}
.three3d-host canvas { display: block; touch-action: none; }
.three3d-fallback { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }
.three3d-tip { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }
.reaction-stage {
  text-align: center; margin-top: 10px; min-height: 1.4em;
  font-size: 14px; font-weight: 700; color: var(--fluor);
  letter-spacing: 0.02em;
}
.reaction-timeline {
  display: flex; align-items: center; gap: 10px;
  justify-content: center; margin-top: 10px; padding: 0 4px;
}
.reaction-timeline .btn-ghost {
  color: #c8d4f0; border-color: rgba(74, 222, 155, 0.35);
  min-width: 44px; padding: 6px 10px; flex-shrink: 0;
}
.reaction-play-btn { font-size: 14px; line-height: 1; }
.reaction-scrub {
  flex: 1; max-width: 320px; height: 6px; appearance: none;
  background: linear-gradient(90deg, rgba(74,222,155,.25), rgba(167,139,250,.35));
  border-radius: 999px; outline: none; cursor: pointer;
}
.reaction-scrub::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--fluor); border: 2px solid #0a1122;
  box-shadow: 0 0 8px rgba(74, 222, 155, 0.55);
}
.reaction-scrub::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--fluor); border: 2px solid #0a1122;
}
.reaction-hint {
  text-align: center; color: var(--muted); font-size: 12px;
  margin-top: 6px; margin-bottom: 2px;
}

/* ---------- 拼单词 ---------- */
.spell-letters { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.spell-letter {
  display: flex; flex-direction: column; align-items: center;
  background: var(--plate-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 4px; min-width: 54px;
}
.spell-letter { font-size: 24px; font-weight: 900; color: var(--po); }
.spell-letter small { font-size: 10px; color: var(--muted); font-weight: 500; font-family: var(--font-body); }

/* ---------- 多肽构建 ---------- */
.build-target { text-align: center; font-size: 15px; color: var(--muted); margin-top: 8px; }
.build-target b { color: var(--gold); font-size: 20px; letter-spacing: 3px; }
.build-seq { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 46px; margin-top: 12px; }
.build-chip { padding: 8px 13px; background: var(--plate-2); border: 2px solid var(--line); border-radius: 10px; font-weight: 800; font-size: 15px; animation: pop .25s; }
.build-chip .c1 { color: var(--po); font-size: 11px; display: block; font-weight: 700; font-family: var(--font-mono); }
.build-chip .c3 { font-family: var(--font-mono); }
.build-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.build-btn { padding: 9px 12px; background: var(--plate-2); border: 2px solid var(--line); border-radius: 10px; font-weight: 700; font-size: 14px; transition: transform .18s var(--spring), border-color .18s ease; }
.build-btn:hover { border-color: var(--line-hi); transform: translateY(-2px); }
.build-btn:active { transform: translateY(0) scale(0.96); }
.build-btn .c3 { color: var(--po); font-weight: 800; }
.build-btn .c1 { color: var(--muted); font-size: 11px; margin-left: 4px; }
.build-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.btn-ghost { padding: 8px 16px; background: var(--plate-2); border: 1px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13px; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-hi); }

/* ---------- 结果页 ---------- */
.result-wrap { text-align: center; padding: 16px 0 4px; }
.result-stars { font-size: 48px; letter-spacing: 6px; }
.result-stars .s { opacity: .18; filter: grayscale(1); }
.result-stars .s.on { opacity: 1; filter: none; color: var(--gold); animation: star-pop .5s var(--spring); }
@keyframes star-pop { 0% { transform: scale(0); } 70% { transform: scale(1.4); } 100% { transform: scale(1); } }
.result-title { font-size: 24px; font-weight: 900; margin-top: 10px; }
.result-sub { color: var(--muted); margin-top: 4px; font-size: 14px; }
.result-xp {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 20px; font-weight: 900; color: var(--gold); font-family: var(--font-mono);
  background: var(--plate); border: 1px solid var(--line); padding: 10px 22px; border-radius: 999px;
}
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

.confetti { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 99; overflow: hidden; }
.confetti span { position: absolute; width: 10px; height: 10px; top: -20px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: .6; } }

/* 提示 / 文本教学页 */
.hint-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; line-height: 1.65; }

.codon-board { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; text-align: left; }
.codon-aid {
  margin: 12px 0 2px;
  padding: 10px 12px;
  background: var(--gel);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
}
.codon-board .codon-aid { margin: 0; }
.codon-aid-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--fluor);
  margin-bottom: 4px;
}
.codon-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-top: 1px solid rgba(35, 48, 80, 0.9);
}
.codon-row:first-of-type { border-top: 0; }
.codon-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.codon-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--plate-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.codon-chip.on {
  color: #04251a;
  background: var(--fluor);
  border-color: var(--fluor);
}
.codon-lab { color: var(--muted); font-size: 13px; line-height: 1.4; }
.codon-aid-note { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
@media (max-width: 720px) {
  .codon-board { grid-template-columns: 1fr; }
}
.text-body { font-size: 16px; line-height: 1.8; color: var(--text); text-align: center; }
.text-body p { margin-bottom: 8px; }
.text-body strong { color: var(--fluor); }
.text-svg { display: flex; justify-content: center; margin-top: 16px; }

@media (prefers-reduced-motion: reduce) {
  .lab-grid { transform: none; opacity: 0.25; }
  #app, #app * { animation: none !important; transition: none !important; }
}

/* 响应式 */
@media (max-width: 560px) {
  .options.cols-2 { grid-template-columns: 1fr; }
  .q-prompt { font-size: 17px; }
  .three3d-host { height: 240px; }
  .node { width: 72px; }
  .node .bubble { width: 50px; height: 50px; font-size: 17px; }
  /* hero 单列坍缩：结构式 orb 置顶，文字左对齐 */
  .home-hero { grid-template-columns: 1fr; gap: 14px; }
  .home-hero .hero-orb { order: -1; }
}

/* ---------- 页脚：demo-nav 暗室主题（本页不引入 light 的 main.css） ---------- */
#demo-nav-mount {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 16px 48px;
  font-family: var(--font-body);
  color: var(--muted);
}

#demo-nav-mount a {
  color: var(--fluor);
  text-decoration: none;
  font-weight: 600;
}

#demo-nav-mount a:hover {
  color: #7aefb5;
  text-decoration: underline;
}

#demo-nav-mount .demo-site-links,
#demo-nav-mount .demo-breadcrumb,
#demo-nav-mount .demo-path-nav {
  margin: 0 0 12px;
  padding: 12px 14px;
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  color: var(--muted);
}

#demo-nav-mount .demo-site-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 13px;
  background: linear-gradient(135deg, rgba(74, 222, 155, 0.08), rgba(63, 201, 255, 0.06));
  border-color: rgba(74, 222, 155, 0.22);
}

#demo-nav-mount .demo-site-links-brand {
  color: var(--text) !important;
  font-weight: 700 !important;
}

#demo-nav-mount .demo-site-links-sep {
  color: var(--line-hi);
}

#demo-nav-mount .demo-breadcrumb {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

#demo-nav-mount .demo-breadcrumb-sep {
  margin: 0 8px;
  color: var(--line-hi);
}

#demo-nav-mount .demo-breadcrumb-current {
  color: var(--text);
  font-weight: 600;
}

#demo-nav-mount .demo-path-nav-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}

#demo-nav-mount .demo-nav-home,
#demo-nav-mount .demo-nav-path-link {
  color: var(--fluor);
}

#demo-nav-mount .demo-nav-progress {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--fluor-tint);
  color: var(--fluor);
  font-size: 12px;
  font-weight: 600;
}

#demo-nav-mount .demo-nav-progress-bar {
  height: 6px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: var(--gel);
  overflow: hidden;
}

#demo-nav-mount .demo-nav-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--fluor-dim), var(--fluor));
}

#demo-nav-mount .demo-nav-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

#demo-nav-mount .demo-nav-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--gel);
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

#demo-nav-mount .demo-nav-step:hover {
  border-color: var(--fluor);
  color: var(--fluor);
  text-decoration: none;
}

#demo-nav-mount .demo-nav-step--active {
  background: var(--fluor-tint);
  border-color: var(--fluor);
  color: var(--fluor);
}

#demo-nav-mount .demo-nav-step--done {
  background: rgba(74, 222, 155, 0.18);
  border-color: rgba(74, 222, 155, 0.45);
  color: var(--fluor);
}

#demo-nav-mount .demo-path-nav-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#demo-nav-mount .demo-nav-btn {
  display: inline-block;
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--fluor-tint);
  border: 1px solid rgba(74, 222, 155, 0.35);
  color: var(--fluor);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

#demo-nav-mount .demo-nav-btn:hover {
  background: rgba(74, 222, 155, 0.2);
  color: #7aefb5;
  text-decoration: none;
}

#demo-nav-mount .demo-nav-prev {
  background: var(--gel);
  border-color: var(--line);
  color: var(--muted);
}

#demo-nav-mount .demo-nav-prev:hover {
  border-color: var(--line-hi);
  color: var(--text);
}

#demo-nav-mount .demo-nav-btn--disabled {
  background: var(--gel);
  border: 1px solid var(--line);
  color: #5b6a88;
  pointer-events: none;
}

@media (max-width: 560px) {
  #demo-nav-mount .demo-nav-progress {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
  #demo-nav-mount .demo-path-nav-actions {
    flex-direction: column;
  }
  #demo-nav-mount .demo-nav-btn {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .node,
  .node.current .bubble,
  .stat.streak .ico {
    animation: none !important;
  }
  .node .bubble,
  .btn-back,
  .progress-fill {
    transition: none !important;
  }
}
