:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b1020;
  color: #e5e7eb;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #0b1020; overflow: hidden; }
header {
  height: 74px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, .22);
  background: linear-gradient(180deg, #111827, #0d1426);
}
h1 { margin: 0 0 5px; font-size: clamp(22px, 2.3vw, 34px); letter-spacing: 0; }
.subline { display: flex; flex-wrap: wrap; gap: 10px; color: #a7b3c7; font-size: 12px; }
.statusbar { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.pill { border: 1px solid rgba(148, 163, 184, .34); border-radius: 999px; padding: 6px 9px; color: #dbeafe; background: rgba(30, 41, 59, .92); font-size: 12px; white-space: nowrap; }
main { display: grid; grid-template-columns: 306px minmax(0, 1fr) 360px; height: calc(100vh - 74px); }
.controlsPanel, .inspector { padding: 14px; overflow: auto; background: rgba(15, 23, 42, .88); }
.controlsPanel { border-right: 1px solid rgba(148, 163, 184, .2); }
.inspector { border-left: 1px solid rgba(148, 163, 184, .2); }
#scene { position: relative; min-width: 0; min-height: 0; background: #0b1020; }
#scene canvas { display: block; width: 100%; height: 100%; }
label { display: grid; gap: 6px; margin-bottom: 12px; color: #cbd5e1; font-size: 12px; }
select, input[type="text"], input:not([type]) { width: 100%; }
select, input { background: #111827; color: #f8fafc; border: 1px solid rgba(148, 163, 184, .34); border-radius: 6px; padding: 8px; font-size: 13px; }
input[type="range"] { padding: 0; accent-color: #60a5fa; }
.checks, .toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 8px 0 14px; }
.checks label, .toggles label { display: flex; align-items: center; gap: 8px; margin: 0; }
.checks input, .toggles input { width: auto; }
button { width: 100%; border: 1px solid rgba(148, 163, 184, .34); background: #1f2937; color: #e5e7eb; border-radius: 6px; padding: 9px 10px; cursor: pointer; font-weight: 700; }
button:hover { background: #2b384d; }
.sectionTitle { margin: 16px 0 8px; color: #f8fafc; font-size: 13px; font-weight: 800; }
.statsGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.statsGrid div { border: 1px solid rgba(148, 163, 184, .22); border-radius: 8px; padding: 9px; background: rgba(17, 24, 39, .78); }
.statsGrid b { display: block; font-size: 19px; overflow-wrap: anywhere; }
.statsGrid span { color: #94a3b8; font-size: 11px; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; color: #cbd5e1; font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 7px; min-width: 0; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.list { display: grid; gap: 9px; }
.entity, .edgeRow, .listButton { text-align: left; border: 1px solid rgba(148, 163, 184, .2); border-radius: 8px; padding: 10px; color: #cbd5e1; background: rgba(17, 24, 39, .72); }
.listButton { width: 100%; cursor: pointer; }
.entity b, .edgeRow b, .listButton b { display: block; color: #f8fafc; overflow-wrap: anywhere; }
.entity small, .edgeRow small, .listButton small { display: block; color: #94a3b8; margin-top: 4px; line-height: 1.38; overflow-wrap: anywhere; }
.loadError { position: absolute; inset: 24px; display: grid; align-content: center; justify-items: center; gap: 8px; color: #f8fafc; }
@media (max-width: 1120px) {
  body { overflow: auto; }
  main { grid-template-columns: 280px minmax(0, 1fr); height: auto; min-height: calc(100vh - 74px); }
  #scene { min-height: 72vh; }
  .inspector { grid-column: 1 / -1; border-left: 0; border-top: 1px solid rgba(148, 163, 184, .2); max-height: 40vh; }
}
@media (max-width: 760px) {
  header { height: auto; grid-template-columns: 1fr; align-items: start; }
  .statusbar { justify-content: flex-start; }
  main { grid-template-columns: 1fr; height: auto; }
  #scene { min-height: 66vh; order: -1; }
  .controlsPanel, .inspector { border: 0; border-top: 1px solid rgba(148, 163, 184, .2); }
  .statsGrid { grid-template-columns: 1fr 1fr; }
}
