:root {
  --bg: #101216;
  --panel: rgba(19, 21, 27, 0.88);
  --ink: #e8e2d2;
  --ink-dim: #9a917d;
  --brass: #c9973f;
  --brass-soft: rgba(201, 151, 63, 0.28);
  --chip: rgba(255, 255, 255, 0.06);
  --chip-hi: rgba(201, 151, 63, 0.22);
  --line: rgba(255, 255, 255, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

#app { position: fixed; inset: 0; }

#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- control panel ---------- */
#panel {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 292px;
  max-height: calc(100% - 32px);
  overflow-y: auto;
  padding: 16px 16px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#panel h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin: 0 0 10px;
  color: var(--brass);
}
#panel h1 span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-dim);
  margin-top: 2px;
}

#panel section {
  border-top: 1px solid var(--line);
  padding: 10px 0 12px;
  margin-top: 4px;
}
#panel section:first-of-type { border-top: 0; padding-top: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}
.row label { flex: 0 0 auto; color: var(--ink-dim); font-size: 12.5px; }
.row output { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 13px; }

input[type="range"] {
  width: 100%;
  margin: 6px 0 2px;
  accent-color: var(--brass);
}

.chips { flex-wrap: wrap; }

button.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--chip);
  color: var(--ink);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
button.chip:hover { background: var(--chip-hi); border-color: var(--brass-soft); }
button.chip:active { transform: translateY(1px); }
button.chip.wide { flex: 1; }

.toggles { flex-wrap: wrap; gap: 4px 12px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}
.toggle input { accent-color: var(--brass); margin: 0; }

.hint {
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--ink-dim);
}
kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10px;
  font-family: inherit;
}

#train-list { list-style: none; margin: 6px 0 0; padding: 0; }
#train-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 3px 6px;
  border-radius: 6px;
  cursor: default;
}
#train-list li span { color: var(--ink-dim); font-variant-numeric: tabular-nums; }
#train-list li:hover { background: var(--chip-hi); }
#train-list li.on { background: var(--chip-hi); }

/* ---------- inspector ---------- */
#inspector {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 16px;
  background: var(--panel);
  border: 1px solid var(--brass-soft);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  white-space: nowrap;
}
#insp-name { color: var(--brass); font-size: 13.5px; }
#insp-sub { color: var(--ink-dim); font-size: 12.5px; }

/* ---------- toast ---------- */
#toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  padding: 10px 18px;
  background: rgba(90, 22, 22, 0.92);
  border: 1px solid rgba(255, 80, 80, 0.5);
  border-radius: 10px;
  color: #ffd7d7;
  font-size: 13px;
  z-index: 10;
}

@media (max-width: 720px) {
  #panel { width: calc(100% - 32px); }
}
