/* game.css — 试车台（叠加在 style.css、machine.css 之上，只用它们的变量） */
body.game { --bad: #e03131; --bad-bg: #fff0f0; --meh: #e8590c; --gold: #f59f00; }
.game .brand { text-decoration: none; color: inherit; }
.game .logo { background: var(--ink); }
.gtopic { border: 0; font: inherit; color: var(--ink); cursor: pointer; }
.gtopic b { font-size: 15px; }
.gtopic:hover { box-shadow: 0 0 0 2px #c5ced7, var(--shadow); }

/* ---------- 左侧面板（开局 / 决策站 / 结果） ---------- */
.gpanel {
  position: fixed; left: 16px; top: 76px; max-height: calc(100vh - 76px - 98px); width: 380px; z-index: 11; overflow-y: auto;
  background: var(--panel); backdrop-filter: blur(8px); border-radius: 18px; box-shadow: var(--shadow);
  padding: 18px 20px 16px; scrollbar-width: thin; animation: slideIn .25s ease;
}
.gpanel.start { max-height: calc(100vh - 92px); }
.start h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: 1px; }
.start .lead { margin: 0 0 16px; color: var(--muted); }
.topics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.tp {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 6px 2px 4px; display: flex; flex-direction: column;
  align-items: center; gap: 0; color: var(--ink); line-height: 1.25;
}
.tp b { font-size: 18px; }
.tp small { font-size: 10.5px; color: var(--muted); text-align: center; }
.tp i { font-style: normal; color: var(--gold); font-size: 10px; min-height: 13px; }
.tp:hover { border-color: #c5ced7; }
.tp.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.tp.on small { color: #cfd6dd; }
.task { background: #f4f6f8; border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; }
.task-given { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; color: var(--muted); }
.task-given b { color: var(--ink); }
.goals { margin: 0; padding-left: 20px; color: #3c4855; }
.goals li { margin: 2px 0; }
.rule { margin: 8px 0 0; color: var(--gold); font-weight: 600; font-size: 13px; }
.btn.big { width: 100%; padding: 12px; font-size: 16px; }
.btn.sm { padding: 4px 12px; font-size: 13px; }

/* 决策站 */
.st-head { display: flex; align-items: baseline; gap: 10px; }
.st-no { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1; }
.st-no i { font-style: normal; font-size: 13px; color: var(--faint); font-weight: 600; }
.st-head h2 { margin: 0; font-size: 22px; }
.st-q { margin: 6px 0 10px; font-size: 16px; font-weight: 600; color: #2b3744; }
.st-known { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.st-pick .row { margin-bottom: 12px; }
.st-pick label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 6px 12px;
  font: 600 14px var(--font); font-variant-numeric: tabular-nums; min-width: 48px;
}
.ch:hover { border-color: #9aa6b2; }
.ch.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips.small .ch { padding: 4px 8px; min-width: 40px; font-size: 13px; }
.chips.big .ch { padding: 10px 14px; font-size: 15px; }
.calc-note { display: block; margin-top: 4px; color: var(--faint); font-size: 12px; }
.st-info { margin: 2px 0 12px; font-size: 13px; color: #1864ab; background: #edf4ff; border-radius: 8px; padding: 6px 10px; }
.st-hint { margin: 0 0 12px; font-size: 13px; color: #44505c; background: #fff8e6; border-radius: 10px; padding: 8px 11px; line-height: 1.7; }
.st-tools { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.tool {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 5px 12px; font-size: 13px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px; line-height: 1.4; font-family: var(--font); cursor: pointer;
}
.tool:hover { border-color: #9aa6b2; }
.tool.on { background: #fff3bf; border-color: #ffd43b; }
a.tool { color: #1864ab; border-color: #a5d8ff; }
.st-nav { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; }

/* 传动比滑块 */
.ratio-read { display: flex; align-items: baseline; justify-content: center; gap: 12px; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.ratio-read b { font-size: 28px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ratio-read .x { color: var(--faint); }
.ratio input { width: 100%; accent-color: var(--ink); }
.ratio-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--faint); }

/* ---------- 底部：决策站进度 + 试车 ---------- */
.steps {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 12; display: flex; align-items: center; gap: 8px;
  background: var(--panel); backdrop-filter: blur(8px); border-radius: 18px; box-shadow: var(--shadow); padding: 6px 8px; max-width: calc(100vw - 32px);
}
.step-list { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.sp {
  border: 0; background: transparent; border-radius: 12px; padding: 4px 10px 4px 8px; display: grid; grid-template-columns: auto auto;
  column-gap: 6px; align-items: center; text-align: left; color: var(--ink); min-width: 96px; flex: none;
}
.sp i { grid-row: span 2; width: 22px; height: 22px; border-radius: 50%; background: #e9edf1; color: var(--muted); display: grid; place-items: center; font: 700 12px var(--font); }
.sp b { font-size: 13px; line-height: 1.2; }
.sp small { font-size: 11.5px; color: var(--faint); line-height: 1.2; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp:hover { background: #f1f4f7; }
.sp.on { background: #e9edf1; }
.sp.done i { background: var(--brand); color: #fff; }
.sp.done small { color: var(--muted); }
.sp.bad i { background: var(--bad); color: #fff; }
.sp.bad small { color: var(--bad); }
.sp.meh i { background: var(--gold); color: #fff; }
.sp.locked { opacity: .45; cursor: default; }
.btn.run { padding: 11px 20px; font-size: 15px; white-space: nowrap; border-radius: 14px; flex: none; }

/* ---------- 右侧表盘 ---------- */
.dials {
  position: fixed; right: 16px; top: 76px; width: 250px; z-index: 11; display: flex; flex-direction: column; gap: 8px;
  animation: slideIn .25s ease;
}
.g { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); padding: 6px 12px 6px 6px; display: flex; align-items: center; gap: 6px; }
.g svg { width: 104px; flex: none; }
.g-bg { fill: none; stroke: #e9edf1; stroke-width: 9; stroke-linecap: round; }
.g-ok { fill: none; stroke: #8ce99a; stroke-width: 9; }
.g-needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.g-hub { fill: var(--ink); }
.g.bad .g-needle { stroke: var(--bad); } .g.bad .g-hub { fill: var(--bad); }
.g-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.g-name { font-size: 12px; color: var(--muted); font-weight: 600; }
.g-val { font-size: 19px; font-variant-numeric: tabular-nums; }
.g.bad .g-val { color: var(--bad); }
.g-sub { font-size: 11.5px; color: var(--faint); }
.verdict {
  align-self: center; margin-top: 4px; font-size: 26px; font-weight: 800; letter-spacing: 6px; padding: 2px 16px 2px 22px;
  border: 3px solid; border-radius: 10px; transform: rotate(-6deg); animation: stamp .35s cubic-bezier(.2, 1.6, .5, 1);
  background: rgba(255,255,255,.85);
}
.verdict.good { color: var(--brand); } .verdict.bad { color: var(--bad); }
@keyframes stamp { from { opacity: 0; transform: rotate(-6deg) scale(1.8); } to { opacity: 1; transform: rotate(-6deg) scale(1); } }

/* ---------- 结果 ---------- */
.res-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.res-head span { font-size: 24px; font-weight: 800; }
.res-head small { color: var(--faint); }
.res-head.bad span { color: var(--bad); }
.res-head.good span { color: var(--brand); }
.res-lead { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #2b3744; }
.res-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.res-list li { border: 1px solid #ffc9c9; background: var(--bad-bg); border-radius: 12px; padding: 9px 11px; }
.res-name b { display: block; color: var(--bad); }
.res-name span { display: block; font-size: 13.5px; }
.res-name em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }
.res-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.pg-chip { border: 0; background: #edf4ff; color: #1864ab; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.pg-chip:hover { background: #dbe9ff; }
.res-foot { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.stars { text-align: center; font-size: 44px; line-height: 1; margin: 4px 0 8px; letter-spacing: 6px; }
.stars span { color: #dee2e6; display: inline-block; }
.stars span.on { color: var(--gold); animation: pop3 .5s ease backwards; }
.stars span.on:nth-child(2) { animation-delay: .15s; } .stars span.on:nth-child(3) { animation-delay: .3s; }
@keyframes pop3 { from { transform: scale(0); } 70% { transform: scale(1.25); } to { transform: scale(1); } }
.res-head.good { justify-content: center; }
.star-why { list-style: none; margin: 0 0 12px; padding: 0; font-size: 13.5px; color: var(--faint); }
.star-why li { padding: 2px 0; }
.star-why li.on { color: #2b3744; }
.star-why li:not(.on)::first-letter { color: #dee2e6; }
.star-why li.on::first-letter { color: var(--gold); }
.link { border: 0; background: none; padding: 0; color: var(--meh); font: inherit; text-decoration: underline; cursor: pointer; text-align: left; }
.res-table-wrap summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.res-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.res-table th { text-align: left; color: var(--faint); font-weight: 600; border-bottom: 1px solid var(--line); padding: 4px 4px; }
.res-table td { border-bottom: 1px dashed var(--line); padding: 5px 4px; vertical-align: top; }
.res-table td:first-child { white-space: nowrap; font-weight: 600; }
.res-table .pg-chip { padding: 1px 7px; font-size: 11.5px; }
.res-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* 手册弹窗：页签 */
.game .modal-cap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.pg-tabs { display: flex; gap: 4px; }
.pg-tabs button { border: 0; border-radius: 999px; padding: 3px 10px; background: rgba(255,255,255,.14); color: #e9edf1; font-size: 12.5px; }
.pg-tabs button.on { background: #fff; color: var(--ink); font-weight: 600; }

/* ---------- 三维里的故障标注、烟、火花 ---------- */
.label3d.gfault.bad { background: rgba(224, 49, 49, .94); }
.label3d.gfault.bad::after { border-top-color: rgba(224, 49, 49, .94); }
.label3d.gfault.bad.below::after { border-top-color: transparent; border-bottom-color: rgba(224, 49, 49, .94); }
.label3d.gfault.warm { background: rgba(232, 89, 12, .94); }
.label3d.gfault.warm::after { border-top-color: rgba(232, 89, 12, .94); }
.label3d.gfault b { display: block; color: #fff; margin: 0; font-size: 13px; }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 6; overflow: hidden; }   /* 在三维标注（z 7）下面：烟不盖住字 */
.puff {
  position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: radial-gradient(circle, rgba(60, 62, 68, .8) 0, rgba(95, 98, 105, .55) 40%, rgba(120, 122, 128, 0) 70%);
  animation: rise 1.7s ease-out forwards;
}
.puff.b { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.puff.light { background: radial-gradient(circle, rgba(150, 150, 150, .45), rgba(150, 150, 150, 0) 70%); width: 24px; height: 24px; }
.puff.spark { width: 10px; height: 10px; margin: -5px 0 0 -5px; background: radial-gradient(circle, #fff3bf, #ff922b 60%, rgba(255,146,43,0) 75%); animation: spark .7s ease-out forwards; }
@keyframes rise { from { opacity: .95; transform: translate(0, 0) scale(.45); } 30% { opacity: .9; } to { opacity: 0; transform: translate(var(--dx, 0), -150px) scale(3.2); } }
@keyframes spark { from { opacity: 1; transform: translate(0, 0); } to { opacity: 0; transform: translate(var(--dx, 0), 40px); } }

/* ---------- 手机 ---------- */
@media (max-width: 820px) {
  body.game { padding-bottom: 76px; }
  .game #stage { position: sticky; top: 0; z-index: 5; height: 40vh; order: 0; background: linear-gradient(var(--bg1), #eef1f4); }
  .gpanel, .dials { scroll-margin-top: calc(40vh + 8px); }
  .game .topbar { z-index: 12; }
  .game .brand-text small { display: block; }
  .gtopic em { display: none; }
  .dials { order: 1; position: static; width: auto; margin: 8px 10px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; animation: none; }
  .dials[hidden] { display: none; }
  .g { flex-direction: column; align-items: stretch; padding: 4px 8px 6px; gap: 0; }
  .g svg { width: 92px; align-self: center; }
  .g-txt { align-items: center; text-align: center; }
  .g-val { font-size: 16px; }
  .verdict { grid-column: span 2; justify-self: center; font-size: 20px; margin: 4px 0; }
  .gpanel { order: 2; position: static; width: auto; margin: 8px 10px; max-height: none; overflow: visible; padding: 14px 14px 12px; animation: none; }
  .start h1 { font-size: 24px; }
  .topics { gap: 5px; }
  .tp small { font-size: 9.5px; }
  .steps {
    position: fixed; left: 0; right: 0; bottom: 0; transform: none; max-width: none; border-radius: 16px 16px 0 0; padding: 6px 8px 8px;
  }
  .step-list { flex: 1; min-width: 0; }
  .sp { min-width: 0; padding: 3px 6px; grid-template-columns: auto; justify-items: center; row-gap: 1px; }
  .sp i { grid-row: auto; width: 20px; height: 20px; font-size: 11px; }
  .sp b { font-size: 11px; }
  .sp small { display: none; }
  .btn.run { padding: 10px 12px; font-size: 14px; }
  .res-table { font-size: 12px; }
  .res-table td:first-child { white-space: normal; }
}
