:root {
  --bg: #0b1020;
  --panel: #121a2f;
  --card: #172238;
  --line: #2a3a5c;
  --text: #e8eefc;
  --muted: #93a0bf;
  --accent: #4cc9f0;
  --ok: #3dd68c;
  --warn: #f4c95d;
  --bad: #ff6b7a;
  --wheel: #7aa2ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: "Segoe UI", "PingFang SC", sans-serif; }
.app { max-width: 1280px; margin: 0 auto; padding: 20px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: conic-gradient(from 40deg, #4cc9f0, #7aa2ff, #3dd68c, #4cc9f0); }
h1 { margin: 0; font-size: 22px; }
.brand p, .hint { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { padding: 6px 10px; border-radius: 999px; background: #1c2944; font-size: 12px; }
.pill.ok { color: var(--ok); }
.pill.bad { color: var(--bad); }
.pill.dim { color: var(--muted); }

.layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.stage-wrap { position: relative; background: radial-gradient(circle at 50% 40%, #1a2744, #0d1426 70%); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; min-height: 640px; }
canvas { width: 100%; height: 100%; display: block; }
.hud { position: absolute; left: 12px; top: 12px; background: rgba(8,12,24,.72); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 260px; }
.hud-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 4px; }
.hud-row span { color: var(--muted); }
.reset-btn { margin-top: 8px; width: 100%; background: #243352; font-size: 12px; padding: 6px 10px; }
.key-hints { position: absolute; right: 12px; bottom: 12px; text-align: right; color: var(--muted); font-size: 12px; }
.keys { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-bottom: 6px; }
.wasd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wasd > div { display: flex; gap: 4px; }
kbd { display: inline-flex; min-width: 28px; height: 28px; padding: 0 7px; align-items: center; justify-content: center; border-radius: 6px; border: 1px solid #3a4d77; background: #15203a; color: #d7e3ff; font-weight: 700; }
kbd.on { background: #2a6dff; border-color: #7aa2ff; }

.panel { display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card h2, .catalog h2 { margin: 0 0 10px; font-size: 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, textarea, button { font: inherit; }
input, textarea { background: #0f172b; color: var(--text); border: 1px solid #31456f; border-radius: 8px; padding: 8px 10px; }
.grid-2, .grid-3 { display: grid; gap: 8px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.actions { display: flex; gap: 8px; margin-top: 10px; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 8px 12px; background: #2b74ff; color: white; }
button.ghost { background: #243352; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { background: #22314e; }
.tab.active { background: #2b74ff; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 6px 4px; border-bottom: 1px solid #2a3b5c; }
.proto-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; font-size: 12px; color: var(--muted); }
.proto-line code { background: #0f172b; color: #4cc9f0; padding: 4px 8px; border-radius: 6px; letter-spacing: 0.6px; }
.slider-block { margin-top: 12px; padding-top: 10px; border-top: 1px solid #2a3b5c; }
.slider-head { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.slider-row { display: grid; grid-template-columns: 64px 1fr 52px; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.slider-row output { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; padding: 0; border: 0; border-radius: 99px; background: #0f172b; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #4cc9f0; cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #4cc9f0; cursor: pointer; }
.validate { margin-top: 12px; padding: 10px; border-radius: 10px; background: #102033; border: 1px solid #2a4a3b; }
.validate.ok { border-color: #2f6a4e; }
.validate.warn { border-color: #7a6a2f; }
.validate.bad { border-color: #7a3340; }
.v-title { font-weight: 700; margin-bottom: 4px; }
.v-body { color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.catalog { margin-top: 16px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.mode { background: #152238; border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; text-align: left; }
.mode:hover, .mode.active { border-color: var(--accent); }
.mode b { display: block; margin-bottom: 4px; }
.mode span { color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .stage-wrap { min-height: 480px; }
}
