/* datum — design system and layout. One file, no build step.
   Tokens first, then base elements, components, pages, the editor. */

:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", ui-monospace, Consolas, monospace;

  --bg: #0b0d11;
  --panel: #11141a;
  --raised: #171b23;
  --hover: #1d222c;
  --active: #252b37;
  --line: #20252f;
  --line-2: #2d3442;
  --text: #e8eaef;
  --text-2: #a2a9b8;
  --text-3: #6b7384;

  --accent: #7c8cff;
  --accent-hover: #93a0ff;
  --accent-ink: #0a0c1c;
  --accent-soft: rgba(124, 140, 255, .13);
  --accent-line: rgba(124, 140, 255, .42);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, .13);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, .13);
  --danger: #f0506e;
  --danger-soft: rgba(240, 80, 110, .13);
  --info: #38bdf8;
  --sel: #ffb224;

  --r-s: 5px;
  --r: 7px;
  --r-l: 10px;
  --r-xl: 14px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-s: 0 4px 14px rgba(0, 0, 0, .35);
  --viewport: #14171d;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --raised: #ffffff;
  --hover: #eff1f5;
  --active: #e4e7ee;
  --line: #e3e6ec;
  --line-2: #cfd4de;
  --text: #171a21;
  --text-2: #535b6c;
  --text-3: #8a92a3;
  --accent: #4f5fe6;
  --accent-hover: #3f4fd6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 95, 230, .1);
  --accent-line: rgba(79, 95, 230, .4);
  --ok: #12a26a;
  --ok-soft: rgba(18, 162, 106, .11);
  --warn: #c97c05;
  --warn-soft: rgba(201, 124, 5, .11);
  --danger: #d63355;
  --danger-soft: rgba(214, 51, 85, .1);
  --info: #0b89c9;
  --sel: #e08a00;
  --shadow: 0 12px 32px rgba(20, 25, 40, .16), 0 2px 8px rgba(20, 25, 40, .1);
  --shadow-s: 0 4px 14px rgba(20, 25, 40, .1);
  --viewport: #e9ecf1;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 640; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 640; }
h4 { font-size: 11px; font-weight: 640; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-line); }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 12px; }
.small { font-size: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1 1 auto; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.col.tight { gap: 6px; }
.right { margin-left: auto; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; border: 2px solid transparent; }
*::-webkit-scrollbar-corner { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

svg.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.ico.s { width: 14px; height: 14px; }
svg.ico.l { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--raised); color: var(--text);
  font-weight: 520; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn:hover { background: var(--hover); border-color: var(--text-3); }
.btn:active { background: var(--active); }
.btn:focus-visible, .input:focus-visible, .tab:focus-visible, .tool:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 620; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; border-radius: var(--r-s); }
.btn.lg { height: 36px; padding: 0 16px; font-size: 14px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn .kbd { margin-left: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 520; }
.link:hover { text-decoration: underline; }

.kbd {
  display: inline-flex; align-items: center; height: 18px; min-width: 18px; padding: 0 5px; justify-content: center;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px;
  font: 600 10.5px var(--mono); color: var(--text-2); background: var(--panel);
}

/* ---------------------------------------------------------------- inputs */

.input, select.input, textarea.input {
  width: 100%; height: 30px; padding: 0 9px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--bg); color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 62px; padding: 7px 9px; resize: vertical; line-height: 1.45; }
.input:hover { border-color: var(--text-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[disabled] { opacity: .55; }
.input.sm { height: 26px; font-size: 12px; padding: 0 7px; border-radius: var(--r-s); }
.input.mono { font-family: var(--mono); font-size: 12px; }
.input::placeholder { color: var(--text-3); }
select.input { padding-right: 26px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%238a92a3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; }
input[type="color"].input { padding: 2px; width: 34px; flex: none; cursor: pointer; }
input[type="number"].input { font-family: var(--mono); font-size: 12px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span, .field > label, .label { font-size: 12px; font-weight: 560; color: var(--text-2); }
.field .help { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline > span:first-child { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid3 .axis, .axis { position: relative; }
.axis > i { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); font: 600 10.5px var(--mono); font-style: normal; pointer-events: none; }
.axis > .input { padding-left: 22px; }
.axis.x > i { color: #f0506e; } .axis.y > i { color: #3ecf8e; } .axis.z > i { color: #5aa9ff; }

.search { position: relative; }
.search > svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search > .input { padding-left: 30px; }

.switch { position: relative; width: 30px; height: 18px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 9px; background: var(--line-2); transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(12px); }

.seg { display: inline-flex; padding: 2px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line-2); gap: 2px; }
.seg button { height: 24px; padding: 0 10px; border: 0; border-radius: 5px; background: none; color: var(--text-2); font-weight: 560; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--active); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }

/* ---------------------------------------------------------------- small things */

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: 11px; font-weight: 620; background: var(--hover); color: var(--text-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.mono { font-family: var(--mono); font-weight: 500; }
.badge.outline { background: none; border: 1px solid var(--line-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.danger { background: var(--danger); } .dot.accent { background: var(--accent); }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.swatch.round { border-radius: 50%; }
.keycap {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 5px; flex: none;
  font: 700 10.5px var(--mono); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22);
}
.gt-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; font: 700 10px var(--mono); letter-spacing: .04em; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line-2);
  background: transparent; color: var(--text-2); font-weight: 540; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip .n { color: var(--text-3); font-weight: 500; }
.tag { display: inline-flex; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--hover); color: var(--text-2); font-size: 11px; align-items: center; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .2s; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); }
.card.pad { padding: 16px; }
.note { padding: 10px 12px; border-radius: var(--r); background: var(--raised); border: 1px solid var(--line); color: var(--text-2); font-size: 12.5px; }
.note.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.note.danger { background: var(--danger-soft); border-color: transparent; color: var(--text); }
.note.accent { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.divider { height: 1px; background: var(--line); margin: 4px 0; flex: none; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px 24px; text-align: center; color: var(--text-2); }
.empty .mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line); color: var(--text-3); }
.empty h2 { color: var(--text); }
.empty p { max-width: 420px; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 640; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--raised); }

/* ---------------------------------------------------------------- menus, dialogs, toasts */

.menu {
  position: fixed; z-index: 400; min-width: 190px; max-width: 340px; max-height: 70vh; overflow: auto; padding: 5px;
  background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow);
  animation: pop .1s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-3px) scale(.985); } }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 30px; padding: 0 9px; border: 0; border-radius: var(--r-s); background: none; text-align: left; cursor: pointer; color: var(--text); }
.menu-item:hover, .menu-item.on { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item[disabled] { opacity: .45; pointer-events: none; }
.menu-item .kbd { margin-left: auto; }
.menu-item > svg { color: var(--text-3); }
.menu-item.danger > svg { color: inherit; }
.menu-sep { height: 1px; background: var(--line); margin: 5px 2px; }
.menu-label { padding: 6px 9px 3px; font-size: 11px; font-weight: 640; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.menu-body { padding: 8px; display: flex; flex-direction: column; gap: 10px; }

.backdrop { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: rgba(5, 7, 10, .62); backdrop-filter: blur(3px); animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow); animation: rise .14s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.modal.md { max-width: 620px; } .modal.lg { max-width: 860px; } .modal.xl { max-width: 1120px; height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.modal-head h2 { flex: 1; }
.modal-head .sub { color: var(--text-2); font-size: 12.5px; }
.modal-body { padding: 4px 18px 16px; overflow: auto; display: flex; flex-direction: column; gap: 14px; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 600; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; max-width: 420px; padding: 10px 13px; border-radius: var(--r-l); background: var(--raised); border: 1px solid var(--line-2); box-shadow: var(--shadow-s); animation: rise .16s ease-out; pointer-events: auto; }
.toast svg { margin-top: 1px; color: var(--text-3); }
.toast.ok svg { color: var(--ok); } .toast.error svg { color: var(--danger); } .toast.warn svg { color: var(--warn); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 6px; flex: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; background: none; color: var(--text-2); font-weight: 560; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.tab .count { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; }
.tab .count.warn { background: var(--warn); color: #201400; }

/* ---------------------------------------------------------------- app shell */

#app { height: 100%; display: flex; flex-direction: column; }
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; padding: 0 6px 0 2px; font-weight: 700; font-size: 15px; letter-spacing: -.02em; color: var(--text); cursor: pointer; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; }
.nav { display: flex; gap: 2px; margin-left: 8px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 10px; border-radius: var(--r); color: var(--text-2); font-weight: 560; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--active); color: var(--text); }
.cmdk { display: flex; align-items: center; gap: 8px; height: 30px; width: 240px; padding: 0 9px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); color: var(--text-3); cursor: pointer; }
.cmdk:hover { border-color: var(--text-3); color: var(--text-2); }
.cmdk span { flex: 1; text-align: left; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; border: 1px solid var(--accent-line); cursor: pointer; text-transform: uppercase; }

.view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.page { flex: 1 1 auto; overflow: auto; }
.page-inner { max-width: 1240px; margin: 0 auto; padding: 28px 28px 56px; display: flex; flex-direction: column; gap: 20px; }
.page-inner.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; }
.page-head .sub { color: var(--text-2); margin-top: 3px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section { display: flex; flex-direction: column; gap: 10px; }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head p { color: var(--text-2); font-size: 12.5px; }

/* ---------------------------------------------------------------- login */

.auth { flex: 1; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.auth-card .brand { font-size: 19px; padding: 0; cursor: default; }
.auth-card .brand svg { width: 28px; height: 28px; }

/* ---------------------------------------------------------------- maps page */

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.map-card { display: flex; flex-direction: column; overflow: hidden; cursor: pointer; transition: border-color .12s, transform .12s, box-shadow .12s; position: relative; }
.map-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow-s); }
.map-card:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }
.map-thumb { position: relative; aspect-ratio: 16 / 10; background: var(--viewport); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.map-thumb::before { content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 16px 16px; }
.map-thumb img { position: relative; max-width: 86%; max-height: 86%; image-rendering: pixelated; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .35)); }
.map-thumb .gt-badge { position: absolute; left: 10px; top: 10px; }
.map-thumb .more { position: absolute; right: 8px; top: 8px; opacity: 0; transition: opacity .12s; background: var(--raised); }
.map-card:hover .more, .map-thumb .more:focus-visible { opacity: 1; }
.map-meta { padding: 11px 13px 12px; display: flex; flex-direction: column; gap: 6px; }
.map-meta .name { font-size: 14px; font-weight: 620; letter-spacing: -.01em; }
.map-meta .line { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; min-height: 18px; }
.map-meta .line .sep { color: var(--text-3); }
.drop-hint { position: fixed; inset: 12px; z-index: 250; border: 2px dashed var(--accent); border-radius: var(--r-xl); background: var(--accent-soft); display: grid; place-items: center; font-size: 16px; font-weight: 620; color: var(--accent); backdrop-filter: blur(2px); pointer-events: none; }

.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--r-l); padding: 26px 18px; text-align: center; color: var(--text-2); cursor: pointer; transition: border-color .12s, background .12s; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone strong { color: var(--text); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.choice button { text-align: left; padding: 10px 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.choice button:hover { border-color: var(--text-3); }
.choice button.on { border-color: var(--accent); background: var(--accent-soft); }
.choice button b { font-weight: 620; }
.choice button span { color: var(--text-2); font-size: 12px; }
.choice.list { grid-template-columns: 1fr; max-height: 280px; overflow: auto; gap: 6px; }
pre.report { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); font: 11.5px/1.5 var(--mono); color: var(--text-2); white-space: pre-wrap; overflow: auto; max-height: 220px; }

/* ---------------------------------------------------------------- editor */

.editor { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 44px var(--left, 264px) minmax(0, 1fr) var(--right, 316px); grid-template-rows: minmax(0, 1fr) 26px; }
.editor.no-left { --left: 0px; } .editor.no-right { --right: 0px; }
.editor.no-left .left, .editor.no-right .inspector { display: none; }

.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; }
.crumb > * { flex: none; }
.crumb > .name { flex: 0 1 auto; }
.crumb .name { font-weight: 640; font-size: 14px; letter-spacing: -.01em; max-width: 340px; }
.crumb .rev { color: var(--text-3); font-family: var(--mono); font-size: 11.5px; }
.save-state { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; white-space: nowrap; }

.rail { grid-row: 1 / 3; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0; }
.tool { position: relative; width: 32px; height: 32px; border: 0; border-radius: var(--r); background: none; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.tool:hover { background: var(--hover); color: var(--text); }
.tool.on { background: var(--accent-soft); color: var(--accent); }
.tool.on::before { content: ""; position: absolute; left: -6px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 2px 2px 0; background: var(--accent); }
.tool[disabled] { opacity: .35; pointer-events: none; }
.rail .sep { width: 20px; height: 1px; background: var(--line); margin: 4px 0; }

[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; z-index: 500; white-space: nowrap; pointer-events: none;
  padding: 4px 8px; border-radius: var(--r-s); background: var(--text); color: var(--bg); font: 560 11.5px var(--font);
  left: 50%; top: calc(100% + 6px); transform: translateX(-50%); animation: fade .1s .35s backwards; text-transform: none; letter-spacing: 0;
}
.rail [data-tip]:hover::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
[data-tip].tip-left:hover::after { left: auto; right: 0; transform: none; }

.left, .inspector { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.left { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; flex: none; }
.panel-head h4 { flex: 1; }
.panel-scroll { flex: 1 1 auto; overflow: auto; min-height: 0; }
.panel-body { padding: 12px; display: flex; flex-direction: column; gap: 14px; }
.panel-foot { padding: 10px 12px; border-top: 1px solid var(--line); flex: none; }

/* outline */
.grp { border-top: 1px solid var(--line); }
.grp:first-child { border-top: 0; }
.grp-head { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 8px; cursor: pointer; user-select: none; }
.grp-head:hover { background: var(--raised); }
.grp-head .chev { color: var(--text-3); transition: transform .12s; }
.grp.open > .grp-head .chev { transform: rotate(90deg); }
.grp-head .title { flex: 1; font-weight: 580; min-width: 0; }
.grp-head .count { font: 500 11.5px var(--mono); color: var(--text-3); }
.grp-head .count.bad { color: var(--danger); } .grp-head .count.good { color: var(--ok); }
.grp-head .acts { display: flex; gap: 1px; }
.grp-head .acts .btn { opacity: 0; }
.grp-head:hover .acts .btn, .grp-head .acts .btn.on, .grp-head .acts .btn.off { opacity: 1; }
.grp-head .acts .btn.off { color: var(--text-3); }
.grp.placing > .grp-head { background: var(--accent-soft); }
.grp.dim > .grp-head .title, .grp.dim .item { opacity: .5; }
.item { display: flex; align-items: center; gap: 8px; height: 27px; padding: 0 8px 0 31px; cursor: pointer; color: var(--text-2); }
.item:hover { background: var(--raised); color: var(--text); }
.item.on { background: var(--accent-soft); color: var(--text); }
.item .pos { font: 400 11px var(--mono); color: var(--text-3); }
.item .warn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex: none; }
.grp-empty { padding: 4px 12px 8px 31px; color: var(--text-3); font-size: 12px; }

/* viewport */
.stage { position: relative; min-width: 0; min-height: 0; background: var(--viewport); overflow: hidden; }
.viewport { position: absolute; inset: 0; outline: none; }
.viewport canvas { display: block; width: 100%; height: 100%; }
.viewport.flying { cursor: none; }
.overlay { position: absolute; z-index: 5; display: flex; gap: 6px; align-items: center; pointer-events: none; }
.overlay > * { pointer-events: auto; }
.overlay.tl { left: 10px; top: 10px; } .overlay.tr { right: 10px; top: 10px; } .overlay.bl { left: 10px; bottom: 10px; } .overlay.br { right: 10px; bottom: 10px; }
.overlay.tc { left: 50%; top: 10px; transform: translateX(-50%); }
.glass { background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line-2); border-radius: var(--r-l); box-shadow: var(--shadow-s); backdrop-filter: blur(8px); }
.toolopts { display: flex; align-items: center; gap: 8px; padding: 5px 8px; min-height: 38px; }
.toolopts .label { white-space: nowrap; }
.hint { padding: 6px 10px; color: var(--text-2); font-size: 12px; max-width: 520px; }
.hint b { color: var(--text); font-weight: 600; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; pointer-events: none; z-index: 4; opacity: 0; }
.crosshair::before, .crosshair::after { content: ""; position: absolute; background: #fff; mix-blend-mode: difference; }
.crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; } .crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
.viewport.flying .crosshair { opacity: .9; }
.box-select { position: absolute; z-index: 6; border: 1px solid var(--sel); background: rgba(255, 178, 36, .12); pointer-events: none; }
.label3d { padding: 2px 7px; border-radius: 10px; background: rgba(10, 12, 16, .78); color: #fff; font: 560 11px var(--font); white-space: nowrap; border: 1px solid rgba(255, 255, 255, .1); transform: translateY(-4px); }
.label3d.sel { background: var(--sel); color: #1d1300; border-color: transparent; }
.label3d.measure { background: #fff; color: #111; font-family: var(--mono); }
.fly-banner { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 6; padding: 7px 12px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.fly-banner b { color: var(--text); }
.loading { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 7; padding: 14px 18px; display: flex; align-items: center; gap: 12px; min-width: 240px; }
.loading .col { gap: 6px; flex: 1; }

.status { grid-column: 2 / 5; display: flex; align-items: center; gap: 14px; padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); color: var(--text-3); font: 400 11.5px var(--mono); white-space: nowrap; overflow: hidden; }
.status b { font-weight: 500; color: var(--text-2); }
.status .sep { width: 1px; height: 12px; background: var(--line-2); }

/* inspector */
.insp-title { display: flex; align-items: center; gap: 9px; }
.insp-title h3 { flex: 1; font-size: 14px; min-width: 0; }
.subhead { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.subhead h4 { flex: 1; }
.issue { display: flex; gap: 9px; padding: 9px 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--raised); cursor: pointer; align-items: flex-start; }
.issue:hover { border-color: var(--line-2); }
.issue svg { margin-top: 1px; }
.issue.error svg { color: var(--danger); } .issue.warning svg { color: var(--warn); } .issue.info svg { color: var(--ok); }
.issue.info { cursor: default; }
.rev { display: flex; flex-direction: column; gap: 4px; padding: 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--raised); }
.rev.current { border-color: var(--accent-line); }
.team-card { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r); border: 1px solid var(--line); background: var(--raised); }
.team-card.on { border-color: var(--accent-line); }
.stat { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.stat span:first-child { color: var(--text-2); }
.stat span:last-child { font-family: var(--mono); font-size: 12px; text-align: right; }
.profile { position: relative; height: 150px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); overflow: hidden; cursor: ns-resize; }
.profile canvas { width: 100%; height: 100%; display: block; }

.yaw { display: flex; gap: 12px; align-items: center; }
.yaw svg { width: 92px; height: 92px; flex: none; cursor: grab; touch-action: none; }
.yaw svg .ring { fill: var(--bg); stroke: var(--line-2); stroke-width: 1.5; }
.yaw svg .tick { stroke: var(--text-3); stroke-width: 1.2; }
.yaw svg .dir { fill: var(--text-3); font: 600 9px var(--font); text-anchor: middle; }
.yaw svg .arrow { stroke: var(--sel); stroke-width: 2.4; fill: var(--sel); stroke-linecap: round; stroke-linejoin: round; }
.yaw svg .knob { fill: var(--sel); stroke: var(--bg); stroke-width: 2; }
.yaw .side { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }

/* block picker, command palette */
.blocks { display: flex; flex-direction: column; width: 300px; max-height: 420px; }
.blocks .list { overflow: auto; padding: 4px; }
.block-row { display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 8px; border-radius: var(--r-s); cursor: pointer; }
.block-row:hover, .block-row.on { background: var(--hover); }
.block-row canvas, .block-swatch { width: 16px; height: 16px; border-radius: 3px; image-rendering: pixelated; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }

.palette { width: 100%; max-width: 560px; margin-top: -18vh; background: var(--raised); border: 1px solid var(--line-2); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden; animation: rise .12s ease-out; }
.palette input { width: 100%; height: 46px; padding: 0 16px; border: 0; border-bottom: 1px solid var(--line); background: none; font-size: 15px; outline: none; }
.palette .results { max-height: 380px; overflow: auto; padding: 6px; }
.palette .menu-item { height: 34px; }
.palette .menu-item .where { margin-left: auto; color: var(--text-3); font-size: 11.5px; }

/* game types, databases, settings */
.split { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.split > .side { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.split > .main { display: flex; flex-direction: column; min-height: 0; }
.side-item { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; border-left: 2px solid transparent; }
.side-item:hover { background: var(--raised); }
.side-item.on { background: var(--raised); border-left-color: var(--accent); }
.side-item .t { font-weight: 580; }
.rows { display: flex; flex-direction: column; gap: 8px; }
.rowcard { border: 1px solid var(--line); border-radius: var(--r); background: var(--raised); }
.rowcard > .head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.rowcard > .body { padding: 2px 10px 12px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; align-items: start; }
.self-start { align-self: flex-start; }
.db-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.db-card .title { display: flex; align-items: center; gap: 10px; }
.db-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.code { font: 12px/1.6 var(--mono); padding: 12px 14px; border-radius: var(--r); background: var(--bg); border: 1px solid var(--line); overflow: auto; white-space: pre; color: var(--text-2); margin: 0; }
.method { display: inline-block; min-width: 52px; text-align: center; padding: 1px 6px; border-radius: 4px; font: 700 10.5px var(--mono); }
.method.GET { background: var(--ok-soft); color: var(--ok); } .method.POST { background: var(--accent-soft); color: var(--accent); }
.method.PUT { background: var(--warn-soft); color: var(--warn); } .method.DELETE { background: var(--danger-soft); color: var(--danger); }
.keybox { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r); background: var(--ok-soft); font-family: var(--mono); font-size: 12.5px; word-break: break-all; }

.boot-error { position: fixed; left: 50%; top: 40px; transform: translateX(-50%); z-index: 9999; max-width: 760px; width: calc(100% - 32px); background: #2a1416; color: #ffd7d7; border: 1px solid #ef5b5b; border-radius: 8px; padding: 14px 16px; font: 13px/1.5 system-ui, sans-serif; white-space: pre-wrap; }

@media (max-width: 1100px) {
  .editor { --left: 228px; --right: 286px; }
  .cmdk { width: auto; }
  .cmdk span:not(.kbd), .save-state { display: none; }
}
@media (max-width: 860px) {
  .nav a { padding: 0 8px; }
  .nav a svg, .cmdk .kbd { display: none; }
}
