[hidden] { display: none !important; }
:root {
  --bg: #16191d;
  --panel: #1f2328;
  --line: #333a42;
  --text: #d8dde3;
  --muted: #8a949e;
  --accent: #3d8bfd;
  --danger: #e5534b;
  font: 13px/1.4 system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template: "toolbar toolbar toolbar" auto "left view right" 1fr "status status status" auto / 260px 1fr 340px;
  overflow: hidden;
}
#toolbar { grid-area: toolbar; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 6px 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
#area-name { font-weight: 600; margin-right: 8px; }
.group { display: flex; gap: 4px; align-items: center; padding-left: 12px; border-left: 1px solid var(--line); }
button { background: #2a3038; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px;
  font: inherit; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary { border-color: var(--accent); }
button.dirty { background: var(--accent); color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }
label { display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
input, select { background: #12151a; color: var(--text); border: 1px solid var(--line); border-radius: 4px; padding: 3px 6px;
  font: inherit; }
input[type=search] { width: 100%; }
aside { background: var(--panel); overflow: hidden; display: flex; flex-direction: column; }
#left { grid-area: left; border-right: 1px solid var(--line); }
#right { grid-area: right; border-left: 1px solid var(--line); }
section { padding: 8px 10px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-height: 0; }
section.grow, .tab { flex: 1; }
.tab { overflow: auto; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0; }
h3 { font-size: 13px; margin: 8px 0 2px; }
p { margin: 0 0 6px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 6px; }
.hint { color: var(--muted); font-size: 12px; }
#rooms { list-style: none; margin: 0; padding: 0; max-height: 34vh; overflow: auto; }
#rooms li { display: flex; gap: 6px; align-items: center; }
#rooms li span { flex: 1; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
#rooms li span.filtered { color: var(--accent); }
#rooms li small { color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.list li { padding: 3px 4px; border-radius: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list li:hover { background: #2a3038; }
.list li.active { background: #24426e; }
.list li small { color: var(--muted); margin-left: 4px; }
.kind { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }
#viewport { grid-area: view; position: relative; overflow: hidden; }
#viewport canvas { display: block; width: 100%; height: 100%; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); font-size: 16px; }
#terrain-panel, #placing { position: absolute; top: 8px; left: 8px; background: rgba(31, 35, 40, 0.92); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
#placing { left: auto; right: 8px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; background: transparent; }
.tabs button.active { background: #2a3038; color: var(--text); box-shadow: inset 0 -2px var(--accent); }
#selection-title { font-weight: 600; word-break: break-all; }
#selection-meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 6px 0; font-size: 12px; }
#selection-meta dt { color: var(--muted); }
#selection-meta dd { margin: 0; word-break: break-all; }
.transform { display: grid; grid-template-columns: 60px 1fr; gap: 4px 6px; align-items: center; margin-bottom: 8px; }
.vec { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.vec input { width: 100%; min-width: 0; }
#properties { width: 100%; border-collapse: collapse; font-size: 12px; }
#properties td { padding: 1px 2px; border-bottom: 1px solid #262b31; }
#properties td:first-child { color: var(--muted); width: 45%; word-break: break-all; }
#properties td.changed:first-child { color: var(--accent); }
#properties input { width: 100%; padding: 1px 4px; }
#status { grid-area: status; display: flex; gap: 18px; padding: 4px 10px; background: var(--panel); border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; }
#message.error { color: var(--danger); }
code { font-size: 12px; }
