:root {
  --bg: #02030a;
  --ink: #eaf0ff;
  --muted: #8b93b8;
  --accent: #ffd24a;
  --panel: rgba(10, 12, 24, 0.86);
  --line: rgba(130, 140, 200, 0.16);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#stage { position: fixed; inset: 0; display: block; cursor: crosshair; touch-action: none; }

.hud { position: fixed; top: 20px; left: 24px; pointer-events: none; text-shadow: 0 2px 18px #000; }
.hud h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.hud .tag { color: var(--muted); font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }

.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: 300px;
  padding: 22px 20px 18px; background: var(--panel);
  backdrop-filter: blur(14px); border-left: 1px solid var(--line);
  overflow-y: auto; transition: transform 0.32s cubic-bezier(.4,.1,.2,1);
}
.panel.hidden { transform: translateX(100%); }
.collapse {
  position: absolute; left: -34px; top: 18px; width: 34px; height: 44px;
  border: 1px solid var(--line); border-right: none; border-radius: 10px 0 0 10px;
  background: var(--panel); color: var(--ink); font-size: 18px; cursor: pointer;
}
.panel.hidden .collapse { transform: rotate(180deg); border-radius: 0 10px 10px 0; }
.panel section { padding: 12px 0; border-bottom: 1px solid var(--line); }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--accent); margin-bottom: 10px; }
label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
label span { color: var(--ink); }
select {
  width: 100%; padding: 9px 10px; border-radius: 9px; cursor: pointer;
  background: #11142a; color: var(--ink); border: 1px solid var(--line); font: inherit; font-size: 13.5px;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), #3a3520); outline: none; margin-top: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%;
  background: #fff; cursor: pointer; box-shadow: 0 0 10px var(--accent);
}
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: #fff; cursor: pointer; }

.timebar { display: flex; gap: 8px; }
.timebar button {
  flex: 1; padding: 10px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 13px;
  background: transparent; border: 1px solid var(--line); color: var(--ink); transition: .15s;
}
.timebar button:hover { border-color: var(--accent); color: var(--accent); }

.toggles { display: flex; flex-direction: column; gap: 10px; }
.chk { display: flex; align-items: center; gap: 9px; color: var(--ink); cursor: pointer; margin: 0; }
.chk input { accent-color: var(--accent); width: 15px; height: 15px; }

.inspector .row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; color: var(--muted); }
.inspector .row b { color: var(--ink); font-variant-numeric: tabular-nums; }
.inspector label { margin-top: 12px; }
.inspector.hidden { display: none; }
.del {
  width: 100%; margin-top: 12px; padding: 9px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 13px;
  background: transparent; border: 1px solid rgba(255,93,122,.4); color: #ff8095; transition: .15s;
}
.del:hover { background: rgba(255,93,122,.12); }

.log { list-style: none; max-height: 180px; overflow-y: auto; font-size: 12px; }
.log li { padding: 5px 0; border-bottom: 1px solid rgba(130,140,200,.08); color: #c7cdec; }
.log li.empty { color: var(--muted); }
.log em { color: var(--muted); font-style: normal; }
.log span { display: inline-block; min-width: 64px; text-transform: uppercase; font-size: 10px; letter-spacing: .5px; }
.log .collision { color: #ff5d7a; } .log .ejection { color: #ff9d5c; }
.log .close { color: #6ad7ff; } .log .spawn, .log .removed { color: #4cff9e; }

.hint { font-size: 11.5px; color: var(--muted); margin-top: 14px; }
.hint em { color: var(--accent); font-style: normal; }
@media (max-width: 640px) { .panel { width: 86vw; } .hud h1 { font-size: 22px; } }
