* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e13;
  --panel: rgba(12, 16, 23, 0.86);
  --line: rgba(120, 180, 255, 0.18);
  --accent: #38bdf8;
  --accent-dim: #0ea5e9;
  --text: #d7e3f4;
  --text-dim: #7e8aa0;
}

html, body { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }

body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  user-select: none;
}

#app { position: fixed; inset: 0; }
canvas { display: block; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 256px;
  padding: 16px 16px 14px;
  background: var(--panel);
  border: 1px solid rgba(120, 205, 255, 0.2);
  border-radius: 14px;
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55), inset 0 1px rgba(255,255,255,0.035);
  z-index: 10;
}

.hud-title {
  font-size: 13px;
  letter-spacing: 3px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
}

.hud-section { margin-bottom: 14px; }
.hud-label {
  font-size: 10.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.btn-row { display: flex; flex-wrap: wrap; gap: 7px; }

.btn-row button {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 8px 6px;
  font-size: 12px;
  color: var(--text);
  background: rgba(56, 189, 248, 0.06);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-row button:hover { background: rgba(56, 189, 248, 0.16); }
.btn-row button.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: #06121c;
  font-weight: 600;
}
.btn-row button.mini { flex: 1 1 0; font-size: 11px; padding: 6px 4px; }
.btn-row button.mini.active { background: rgba(56,189,248,0.28); color: var(--text); }

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.slider-row span { width: 30px; flex: none; }
.slider-row em { width: 34px; flex: none; text-align: right; color: var(--text); font-style: normal; }
.slider-row input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 3px;
  background: var(--line);
  border-radius: 3px;
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.hud-hint {
  margin-top: 4px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-dim);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.balance-legend {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 10px;
}
.balance-legend span { width: 7px; height: 7px; border-radius: 50%; margin-left: 4px; }
.balance-legend span:first-child { margin-left: 0; }
.support-dot { background: #34d399; }
.com-dot { background: #fbbf24; }
.zmp-dot { background: #38bdf8; }

#state-readout {
  position: fixed;
  bottom: 16px;
  left: 18px;
  font-size: 11px;
  font-family: "Cascadia Code", "Consolas", monospace;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  z-index: 10;
}
#state-readout b { color: var(--accent); font-weight: 600; }
#state-readout[data-stability="stable"] .stability-status { color: #34d399; }
#state-readout[data-stability="warning"] .stability-status { color: #fbbf24; }
#state-readout[data-stability="unstable"] .stability-status { color: #fb7185; }
