/* TCA 循环闯关 — 线粒体能量主题 */
:root {
  --lab: #0a0e12;
  --gel: #121820;
  --plate: #161e28;
  --plate-2: #1c2632;
  --line: #2a3544;
  --line-hi: #3d4f66;
  --text: #f0f4f8;
  --muted: #9aa8bc;
  --accent: #e8b84a;
  --accent-dim: #b8862a;
  --accent-tint: rgba(232, 184, 74, 0.12);
  --gold: #eec25f;
  --danger: #ef6478;
  --entry: #66bb6a;
  --hub: #ffb74d;
  --inter: #64b5f6;
  --font-body: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 12px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --panel-glass: rgba(12, 16, 24, 0.82);
  --panel-border: rgba(232, 184, 74, 0.22);
  --panel-glow: 0 0 32px rgba(232, 184, 74, 0.06);
  --hud-accent: rgba(232, 184, 74, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--lab);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.mito-scene {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.mito-grid {
  position: absolute; inset: -20% -10%;
  background-image:
    linear-gradient(rgba(232, 184, 74, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 184, 74, 0.05) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 42%, #000 20%, transparent 72%);
  opacity: 0.5;
}
.mito-glow {
  position: absolute; left: 50%; bottom: 6%; width: min(560px, 92vw); height: 300px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(232, 184, 74, 0.14) 0%, transparent 65%);
  filter: blur(10px);
}
.mito-crisae {
  position: absolute; inset: 8% 4%;
  background: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 40px, rgba(232, 184, 74, 0.03) 41px, transparent 42px);
  mask-image: radial-gradient(ellipse 90% 80% at 50% 50%, #000 10%, transparent 75%);
}
.mito-frame {
  position: absolute; width: 52px; height: 52px; border: 2px solid var(--hud-accent); opacity: 0.3;
}
.mito-frame--tl { top: 12px; left: 12px; border-right: none; border-bottom: none; }
.mito-frame--tr { top: 12px; right: 12px; border-left: none; border-bottom: none; }
.mito-frame--bl { bottom: 12px; left: 12px; border-right: none; border-top: none; }
.mito-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; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; margin: 0 -16px 10px;
  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; }
.brand .logo {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border-radius: 10px; background: rgba(232, 184, 74, 0.08); border: 1px solid var(--panel-border);
  color: var(--accent);
}
.brand .logo svg { width: 22px; height: 22px; }
.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 svg { width: 13px; height: 13px; }
.stat.xp .ico { color: var(--gold); }
.stat.streak .ico { color: #ff9600; }
.sfx-toggle .ico svg { width: 14px; height: 14px; color: #57bfee; }
.sfx-toggle.is-muted .ico { color: var(--muted); }

.home-hero {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 20px;
  padding: 22px 18px; background: var(--panel-glass);
  border: 1px solid var(--panel-border); border-radius: 16px; box-shadow: var(--panel-glow);
}
.home-hero h1 { font-size: clamp(1.5rem, 4.2vw, 2rem); font-weight: 900; line-height: 1.2; }
.home-hero h1 .accent { color: var(--accent); }
.home-hero p { color: var(--muted); margin-top: 8px; font-size: 14px; line-height: 1.65; max-width: 34ch; }
.hero-progress { margin-top: 14px; display: grid; gap: 6px; max-width: 220px; }
.hero-progress .hp-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.hero-progress .hp-val { font-family: var(--font-mono); font-weight: 800; color: var(--accent); }
.hero-progress-bar { height: 6px; border-radius: 999px; background: rgba(232, 184, 74, 0.1); border: 1px solid rgba(232, 184, 74, 0.2); overflow: hidden; }
.hero-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .5s var(--spring); }
.hero-orb {
  width: 96px; height: 96px; border-radius: 22px;
  background: rgba(8, 12, 20, 0.6); border: 1px solid var(--panel-border);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}

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

.path {
  display: flex; flex-wrap: wrap; gap: 14px; padding: 16px 14px;
  background: var(--panel-glass); border: 1px solid var(--panel-border); border-radius: 16px;
}
.node { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 86px; }
.node .bubble {
  width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 800; font-family: var(--font-mono);
  background: var(--plate); border: 2px solid var(--line-hi); position: relative;
}
.node .bubble .check {
  position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #1a1204; display: none; align-items: center; justify-content: center; font-size: 12px; font-weight: 900;
}
.node.done .bubble .check { display: flex; }
.node.unlocked .bubble { cursor: pointer; }
.node.unlocked .bubble:hover { transform: translateY(-3px); border-color: var(--accent); }
.node.locked .bubble { opacity: .4; }
.node .lock { position: absolute; top: -5px; left: calc(50% + 15px); width: 22px; height: 22px; border-radius: 50%; background: var(--plate-2); border: 1.5px solid var(--line-hi); display: flex; align-items: center; justify-content: center; }
.node .lock svg { width: 12px; height: 12px; color: #7e8db0; }
.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(--accent); }
.node.current .bubble { animation: pulse 1.8s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(232, 184, 74, 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); flex: none; color: var(--muted); }
.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%; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); transition: width .4s var(--spring); }
.progress-label { font-size: 11px; color: var(--muted); margin-top: 4px; }
.hearts .h svg { width: 17px; height: 17px; color: var(--danger); }
.hearts .h.lost { opacity: .18; filter: grayscale(1); }
.combo-badge { font-size: 12px; font-weight: 800; color: #ff9600; min-width: 40px; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.combo-badge svg { width: 13px; height: 13px; }

.card {
  background: var(--panel-glass); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 18px 20px; margin-top: 10px; backdrop-filter: blur(10px);
}
.q-prompt { font-size: 19px; font-weight: 700; line-height: 1.55; text-align: center; }
.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; }

.options { display: grid; gap: 10px; margin-top: 18px; }
.options.cols-2 { grid-template-columns: 1fr 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: 15px; font-weight: 600; text-align: left; transition: border-color .18s;
}
.opt:hover { border-color: var(--line-hi); }
.opt .opt-key { color: var(--muted); font-family: var(--font-mono); font-size: 14px; }
.opt.correct { border-color: var(--accent); background: var(--accent-tint); }
.opt.wrong { border-color: var(--danger); background: rgba(239, 100, 120, 0.12); }
.opt.disabled { pointer-events: none; }

.match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.match-item { padding: 12px 14px; background: var(--plate-2); border: 2px solid var(--line); border-radius: 12px; font-size: 14px; font-weight: 600; text-align: center; }
.match-item.sel { border-color: var(--inter); background: rgba(100, 181, 246, 0.12); }
.match-item.done { opacity: .32; pointer-events: none; }
.match-item .m-code { font-family: var(--font-mono); color: var(--accent); font-size: 13px; }

.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: 18px; font-weight: 800; color: var(--text); text-align: center; width: 200px; outline: none; font-family: var(--font-mono);
}
.btn-primary {
  background: var(--accent); color: #1a1204; font-weight: 800; font-size: 15px;
  padding: 13px 22px; border-radius: 12px; box-shadow: 0 3px 0 var(--accent-dim);
}
.btn-primary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-dim); }
.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); }

.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 12px; font-size: 14px; display: none; }
.feedback.show { display: flex; }
.feedback.correct { background: var(--accent-tint); border: 1px solid rgba(232, 184, 74, 0.4); }
.feedback.wrong { background: rgba(239, 100, 120, 0.12); border: 1px solid rgba(239, 100, 120, 0.4); }
.feedback .fb-ico svg { width: 19px; height: 19px; margin-right: 10px; }
.feedback.correct .fb-ico { color: var(--accent); }
.feedback.wrong .fb-ico { color: var(--danger); }
.continue-row { margin-top: 16px; display: flex; justify-content: center; }

.text-body { font-size: 16px; line-height: 1.8; text-align: center; }
.text-body strong { color: var(--accent); }
.text-svg, .cycle-wrap { display: flex; justify-content: center; margin-top: 16px; }
.hint-note { text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; line-height: 1.65; }

.build-target { text-align: center; font-size: 14px; color: var(--muted); margin-top: 8px; }
.build-target b { color: var(--gold); font-size: 13px; font-family: var(--font-mono); }
.build-seq { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 40px; margin-top: 12px; }
.build-chip { padding: 8px 12px; background: var(--plate-2); border: 2px solid var(--line); border-radius: 10px; font-weight: 700; font-size: 13px; }
.build-chip .c1 { color: var(--accent); font-size: 10px; display: block; 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: 13px; }
.build-btn .c3 { color: var(--inter); font-family: var(--font-mono); }
.build-btn .c1 { color: var(--muted); font-size: 11px; margin-left: 4px; }
.build-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

.result-wrap { text-align: center; padding: 16px 0; }
.result-stars { font-size: 48px; letter-spacing: 6px; }
.result-stars .s { opacity: .18; }
.result-stars .s.on { opacity: 1; color: var(--gold); }
.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); padding: 10px 22px; border-radius: 999px; background: var(--plate); border: 1px solid var(--line); }
.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

.confetti { position: fixed; inset: 0; 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; } }

.cycle-svg { border-radius: 12px; max-width: 100%; height: auto; }

.game-related {
  position: relative; z-index: 1; max-width: 760px; margin: 0 auto;
  padding: 0 16px 8px; text-align: center; font-size: 13px; color: var(--muted);
}
.game-related a { color: var(--accent); text-decoration: none; font-weight: 600; }
.game-related a:hover { text-decoration: underline; }

#demo-nav-mount { max-width: 760px; margin: 0 auto; padding: 4px 16px 24px; color: var(--muted); font-size: 13px; }
#demo-nav-mount a { color: var(--accent); text-decoration: none; font-weight: 600; }

@media (max-width: 560px) {
  .options.cols-2, .match-cols { grid-template-columns: 1fr; }
  .home-hero { grid-template-columns: 1fr; }
  .home-hero .hero-orb { order: -1; justify-self: center; }
  .node { width: 72px; }
  .node .bubble { width: 50px; height: 50px; font-size: 17px; }
}
