* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1220; font-family: "Noto Sans SC", "PingFang SC", sans-serif; color: #e2e8f0; }
canvas#c { display: block; width: 100%; height: 100%; }

/* ID 选择器的 display 会盖过原生 [hidden]，必须显式尊重 hidden，否则结算层会常驻遮罩 */
#boot[hidden],
#hud[hidden],
#result[hidden],
#howto[hidden],
#actions[hidden],
.hud-actions[hidden],
.hud-xr[hidden] {
  display: none !important;
}

#boot {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse 70% 50% at 20% 0%, rgba(59,130,246,.25), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(234,88,12,.2), transparent 50%),
    #0b1220;
  padding: 16px;
  overflow: auto;
}
.boot-card {
  width: min(780px, 100%);
  background: rgba(15,23,42,.9);
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 20px;
  padding: 28px 24px;
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  margin: auto;
}
.boot-hero { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.logo {
  width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff;
  font-family: Sora, sans-serif; font-weight: 700;
  box-shadow: 0 8px 24px rgba(59,130,246,.35);
}
.boot-card h1 { font-family: Sora, "Noto Sans SC", sans-serif; font-size: 24px; color: #fff; margin-bottom: 4px; }
.boot-sub { font-size: 14px; color: #94a3b8; line-height: 1.6; }
.boot-badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.boot-badge {
  font-size: 11px; padding: 5px 12px; border-radius: 999px;
  background: rgba(59,130,246,.15); color: #93c5fd; border: 1px solid rgba(59,130,246,.25);
}

.scene-group { margin-bottom: 16px; }
.scene-group-title {
  font-size: 12px; font-weight: 700; letter-spacing: .08em;
  color: #93c5fd; margin-bottom: 8px; text-transform: uppercase;
}
.scene-group:nth-of-type(2) .scene-group-title { color: #6ee7b7; }

.scene-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) {
  .scene-pick { grid-template-columns: 1fr; }
}
.scene-btn {
  text-align: left; border: 1.5px solid rgba(148,163,184,.25);
  background: linear-gradient(145deg, rgba(30,41,59,.85), rgba(15,23,42,.75));
  color: inherit; border-radius: 14px;
  padding: 14px 16px; cursor: pointer; display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px;
  transition: border-color .15s, transform .15s, background .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.scene-btn::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(59,130,246,.12), transparent 55%);
  pointer-events: none;
}
.scene-btn.care::before {
  background: radial-gradient(circle at 0% 0%, rgba(16,185,129,.12), transparent 55%);
}
.scene-btn:hover {
  border-color: #3b82f6; background: rgba(37,99,235,.18);
  transform: translateY(-2px); box-shadow: 0 10px 28px rgba(37,99,235,.2);
}
.scene-btn.care:hover { border-color: #34d399; background: rgba(16,185,129,.14); box-shadow: 0 10px 28px rgba(16,185,129,.18); }
.scene-btn .emoji { grid-row: span 2; font-size: 26px; align-self: center; position: relative; }
.scene-btn strong { font-size: 14px; color: #fff; position: relative; }
.scene-btn small { font-size: 12px; color: #94a3b8; grid-column: 2; position: relative; }

.boot-tips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.boot-tips span {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(16,185,129,.18); color: #a7f3d0;
}
.boot-tips span.optional {
  background: rgba(255,255,255,.06); color: #94a3b8;
}
.boot-foot {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  letter-spacing: .02em;
}

/* 开场教学 */
#howto {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: rgba(2,6,23,.78); backdrop-filter: blur(8px); padding: 20px;
}
.howto-card {
  width: min(440px, 100%);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a; border-radius: 22px; padding: 28px 24px;
  border: 1px solid rgba(148,163,184,.22);
  box-shadow: 0 28px 64px rgba(0,0,0,.42);
}
.howto-card h2 { font-size: 22px; margin-bottom: 14px; letter-spacing: -.01em; }
.howto-card ol { padding-left: 20px; margin-bottom: 14px; line-height: 1.75; font-size: 15px; color: #334155; }
.howto-card li { margin-bottom: 8px; }
.howto-note { font-size: 13px; color: #64748b; margin-bottom: 18px; line-height: 1.6; }
.howto-card .btn { width: 100%; min-height: 48px; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud .hud-exit, #hud .hud-xr, #hud .hud-actions button { pointer-events: auto; }
.hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(0,0,0,.6), transparent);
}
.hud-brand { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: #93c5fd; }
.hud-mission { flex: 1; font-size: 13px; font-weight: 600; color: #fff; }
.hud-score { font-size: 13px; color: #cbd5e1; }
.hud-score strong { color: #fb923c; font-family: Sora, sans-serif; font-size: 18px; }

/* 当前步骤大字提示 */
.hud-now {
  position: absolute; left: 50%; top: 56px; transform: translateX(-50%);
  width: min(640px, 94%);
  padding: 14px 20px; border-radius: 16px;
  background: linear-gradient(145deg, rgba(15,23,42,.82), rgba(15,23,42,.68));
  border: 1px solid rgba(56,189,248,.55);
  font-size: 18px; font-weight: 700; color: #fff; text-align: center;
  line-height: 1.45;
  box-shadow:
    0 1px 0 rgba(255,255,255,.08) inset,
    0 14px 36px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
}

.crosshair {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px;
  margin: -7px 0 0 -7px; border: 2px solid rgba(255,255,255,.35); border-radius: 50%;
  opacity: .45;
}
.crosshair.hot { border-color: #fb923c; background: rgba(249,115,22,.25); opacity: 1; }
.optional-ui::after {
  content: "可选";
  position: absolute; left: 50%; top: 18px; transform: translateX(-50%);
  font-size: 9px; color: rgba(255,255,255,.45); white-space: nowrap; font-weight: 600;
}

.hud-hint {
  position: absolute; left: 50%; bottom: 128px; transform: translateX(-50%);
  max-width: 92%; padding: 9px 16px; border-radius: 999px;
  background: rgba(15,23,42,.62);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px; color: #cbd5e1; text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}

.hud-objectives {
  position: absolute; left: 14px; top: 130px;
  width: min(240px, 38vw); padding: 12px 14px; border-radius: 14px;
  background: rgba(15,23,42,.72);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 12px; line-height: 1.55;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 28px rgba(0,0,0,.25);
}
.hud-objectives h4 { font-size: 11px; color: #94a3b8; margin-bottom: 8px; letter-spacing: .06em; }
.hud-objectives li { list-style: none; margin-bottom: 6px; color: #94a3b8; padding: 4px 6px; border-radius: 6px; }
.hud-objectives li.done { color: #34d399; text-decoration: line-through; background: transparent; }
.hud-objectives li.fail { color: #f87171; }
.hud-objectives li.current {
  color: #fff; background: rgba(56,189,248,.22); font-weight: 700;
  border: 1px solid rgba(56,189,248,.45);
}

/* 大按钮向导区 */
.hud-actions {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  width: min(560px, 96%); max-width: 96%;
  pointer-events: auto;
}
.hud-actions .act-primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 18px;
  padding: 16px 22px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  cursor: pointer;
  line-height: 1.3;
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 42%),
    linear-gradient(135deg, #34d399 0%, #10b981 48%, #059669 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,.35) inset,
    0 14px 36px rgba(16,185,129,.38),
    0 4px 14px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hud-actions .act-primary .act-ico {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset;
}
.hud-actions .act-primary .act-txt { text-align: center; }
.hud-actions .act-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.4);
  box-shadow:
    0 1px 0 rgba(255,255,255,.4) inset,
    0 18px 40px rgba(16,185,129,.45),
    0 6px 16px rgba(0,0,0,.24);
}
.hud-actions .act-primary:active {
  transform: translateY(1px) scale(.985);
  filter: brightness(.98);
  box-shadow:
    0 1px 0 rgba(255,255,255,.2) inset,
    0 8px 20px rgba(16,185,129,.3),
    0 2px 8px rgba(0,0,0,.2);
}
.hud-actions .act-primary:disabled,
.hud-actions .act-primary.done {
  opacity: .45; cursor: default; filter: grayscale(.35);
  transform: none; box-shadow: 0 4px 12px rgba(0,0,0,.18);
}
.hud-actions .act-row {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; width: 100%;
}
.hud-actions .act-secondary,
.hud-actions .act-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1.5px solid rgba(148,163,184,.35);
  border-radius: 14px;
  padding: 10px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .01em;
  color: #e2e8f0;
  cursor: pointer;
  background: rgba(15,23,42,.48);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  transition: transform .12s ease, background .12s ease, border-color .12s ease, color .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hud-actions .act-secondary:hover,
.hud-actions .act-row button:hover {
  background: rgba(30,41,59,.62);
  border-color: rgba(148,163,184,.5);
  transform: translateY(-1px);
}
.hud-actions .act-secondary:active,
.hud-actions .act-row button:active {
  transform: translateY(1px) scale(.98);
}
.hud-actions .act-secondary.danger,
.hud-actions .act-row button.danger {
  background: rgba(127,29,29,.22);
  border-color: rgba(248,113,113,.42);
  color: #fecaca;
}
.hud-actions .act-secondary.danger:hover,
.hud-actions .act-row button.danger:hover {
  background: rgba(153,27,27,.32);
  border-color: rgba(252,165,165,.55);
  color: #fee2e2;
}
.hud-actions .act-secondary.warn,
.hud-actions .act-row button.warn {
  background: rgba(154,52,18,.2);
  border-color: rgba(251,146,60,.4);
  color: #fdba74;
}
.hud-actions .act-secondary.warn:hover,
.hud-actions .act-row button.warn:hover {
  background: rgba(194,65,12,.28);
  border-color: rgba(253,186,116,.55);
  color: #ffedd5;
}
.hud-actions .act-secondary:disabled,
.hud-actions .act-row button:disabled {
  opacity: .4; cursor: default; transform: none;
}

.hud-exit, .hud-xr {
  position: absolute; top: 12px; right: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(15,23,42,.55);
  color: #e2e8f0;
  border-radius: 12px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px rgba(0,0,0,.22);
  transition: background .12s ease, border-color .12s ease, transform .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hud-exit:hover, .hud-xr:hover {
  background: rgba(30,41,59,.72);
  border-color: rgba(255,255,255,.3);
  transform: translateY(-1px);
}
.hud-exit:active, .hud-xr:active { transform: translateY(1px); }
.hud-xr {
  right: 76px;
  background: rgba(37,99,235,.42);
  border-color: rgba(147,197,253,.35);
  color: #dbeafe;
}
.hud-xr:hover {
  background: rgba(37,99,235,.58);
  border-color: rgba(191,219,254,.5);
}

#result {
  position: fixed; inset: 0; z-index: 30;
  display: grid; place-items: center;
  background: rgba(2,6,23,.72); backdrop-filter: blur(8px); padding: 20px;
}
.result-card {
  position: relative; width: min(420px, 100%);
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  color: #0f172a; border-radius: 22px; padding: 28px 24px;
  text-align: center;
  border: 1px solid rgba(148,163,184,.2);
  box-shadow: 0 28px 64px rgba(0,0,0,.38);
}
.result-stamp {
  position: absolute; right: 20px; top: 20px;
  width: 64px; height: 64px; border-radius: 50%; border: 3px solid #10b981; color: #10b981;
  display: grid; place-items: center; font-weight: 800; transform: rotate(12deg); font-size: 14px;
}
.result-stamp.fail { border-color: #ef4444; color: #ef4444; }
.result-card h2 { font-size: 22px; margin-bottom: 8px; letter-spacing: -.01em; }
.result-card > p { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.result-score { font-family: Sora, sans-serif; font-size: 48px; font-weight: 700; color: #ea580c; line-height: 1; margin-bottom: 14px; }
.result-score small { font-size: 16px; color: #94a3b8; margin-left: 4px; }
.result-list { text-align: left; font-size: 13px; color: #475569; margin: 0 0 18px; padding-left: 18px; line-height: 1.7; }
.result-btns { display: flex; flex-direction: column; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px;
  padding: 12px 18px; border-radius: 14px;
  font-weight: 600; font-size: 14px; letter-spacing: .01em;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease, background .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn.primary {
  background:
    linear-gradient(180deg, rgba(255,255,255,.2), transparent 40%),
    linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border-color: rgba(255,255,255,.22);
  box-shadow:
    0 1px 0 rgba(255,255,255,.28) inset,
    0 10px 24px rgba(37,99,235,.32);
}
.btn.primary:hover {
  filter: brightness(1.05);
  box-shadow:
    0 1px 0 rgba(255,255,255,.32) inset,
    0 14px 28px rgba(37,99,235,.4);
}
.btn.ghost {
  background: rgba(241,245,249,.95);
  color: #1e3a8a;
  border-color: rgba(148,163,184,.35);
  box-shadow: 0 4px 14px rgba(15,23,42,.06);
}
.btn.ghost:hover {
  background: #fff;
  border-color: rgba(59,130,246,.35);
}
.btn.soft {
  background: transparent;
  color: #64748b;
  border-color: rgba(148,163,184,.35);
  font-weight: 600;
}
.btn.soft:hover {
  color: #334155;
  background: rgba(241,245,249,.7);
  border-color: rgba(100,116,139,.45);
}

.vr-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  z-index: 50; max-width: min(480px, 92vw); padding: 12px 16px; border-radius: 14px;
  background: rgba(15, 23, 42, 0.9); border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e2e8f0; font-size: 13px; line-height: 1.45; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.vr-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  .boot-card { padding: 20px 14px; }
  .hud-objectives { display: none; }
  .hud-now { font-size: 16px; top: 52px; padding: 12px 14px; }
  .hud-actions .act-primary { font-size: 16px; padding: 15px 18px; min-height: 52px; }
  .hud-actions .act-secondary,
  .hud-actions .act-row button { min-height: 40px; }
  .hud-hint { bottom: 136px; }
}
