:root {
  --bg: #0d1b2a;
  --panel: rgba(20, 32, 48, 0.82);
  --panel-b: rgba(120, 170, 220, 0.25);
  --text: #e8eef5;
  --dim: #8ea3b8;
  --accent: #4db6e6;
  --warn: #ff6b5e;
  --ok: #6fd08c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text); -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; }
#scene { display: block; width: 100%; height: 100%; touch-action: none; }

/* 顶部：标题 + 目标 */
#topbar { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; }
#level-title { font-size: 18px; font-weight: 700; letter-spacing: 1px;
  background: var(--panel); border: 1px solid var(--panel-b); border-radius: 10px;
  padding: 8px 14px; backdrop-filter: blur(8px); width: fit-content; }
#objectives { background: var(--panel); border: 1px solid var(--panel-b); border-radius: 10px;
  padding: 10px 14px; backdrop-filter: blur(8px); font-size: 13px; line-height: 1.9; width: fit-content; max-width: 340px; }
.obj { color: var(--dim); }
.obj.done { color: var(--ok); }
.obj b { color: var(--text); font-weight: 600; }
.obj b.warn { color: var(--warn); }
.obj .dim { color: var(--dim); font-weight: 400; }

/* 左下：指标 */
#stats { position: absolute; left: 14px; bottom: 96px; display: flex; flex-direction: column; gap: 6px; }
.stat { background: var(--panel); border: 1px solid var(--panel-b); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; display: flex; justify-content: space-between; gap: 16px;
  min-width: 160px; backdrop-filter: blur(8px); }
.stat span { color: var(--dim); }
.stat b { font-weight: 700; }
.stat b.warn { color: var(--warn); }

/* 底部工具栏 */
#toolbar { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 18px; align-items: center; }
.tool-group { display: flex; gap: 8px; background: var(--panel); border: 1px solid var(--panel-b);
  border-radius: 12px; padding: 8px; backdrop-filter: blur(8px); }
.tool-btn, .action-btn { display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255,255,255,0.04); border: 1px solid transparent; border-radius: 8px;
  color: var(--text); font-size: 13px; font-weight: 600; padding: 8px 14px; cursor: pointer;
  transition: all 0.12s; font-family: inherit; }
.tool-btn small { color: var(--dim); font-size: 10px; font-weight: 400; }
.tool-btn .swatch { width: 20px; height: 6px; border-radius: 3px; margin-bottom: 2px; }
.tool-btn:hover, .action-btn:hover { background: rgba(255,255,255,0.10); }
.tool-btn.active { border-color: var(--accent); background: rgba(77,182,230,0.18); }
.action-btn { justify-content: center; }
.action-btn.flood { color: #ffd27a; }
.action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 中央横幅 */
#banner { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; padding: 28px 46px; border-radius: 16px; backdrop-filter: blur(10px);
  border: 1px solid var(--panel-b); }
#banner.win { background: rgba(30,70,45,0.9); }
#banner.lose { background: rgba(80,30,30,0.9); }
#banner .b-title { font-size: 30px; font-weight: 800; margin-bottom: 8px; }
#banner .b-sub { font-size: 14px; color: var(--text); opacity: 0.9; }

/* 帮助面板 */
#help { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(440px, 88vw); background: var(--panel); border: 1px solid var(--panel-b);
  border-radius: 16px; padding: 22px 24px; backdrop-filter: blur(12px); }
.help-title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.help-body { font-size: 13.5px; line-height: 1.9; color: #cdd8e6; }
.help-body b { color: var(--accent); }
#help button { margin-top: 16px; width: 100%; padding: 10px; border-radius: 8px; border: none;
  background: var(--accent); color: #06121f; font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit; }

.hidden { display: none !important; }

@media (max-width: 640px) {
  #toolbar { flex-direction: column; gap: 8px; bottom: 10px; }
  #stats { bottom: 150px; }
  #objectives { max-width: 260px; font-size: 12px; }
}
