/* The admin area. The look is the mockup's (mockups/admin/css/app.css): the same colour tokens,
   light and dark, the same shell and components. What the real pages add is at the end. */
:root {
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
  --radius-lg: 10px;
  --nav-w: 216px;
  --top-h: 48px;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e6e9ed;
  --border: #dde1e6;
  --border-strong: #c5cbd3;
  --text: #191c20;
  --text-2: #4f5762;
  --text-3: #7a838f;
  --accent: #3355d1;
  --accent-hover: #2947b8;
  --accent-weak: #e7ecfb;
  --accent-text: #2a48b5;
  --on-accent: #ffffff;
  --ok: #18794a;
  --ok-weak: #e1f3e8;
  --warn: #8f5a00;
  --warn-weak: #fcefd2;
  --bad: #bd3328;
  --bad-weak: #fce6e3;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .10);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--accent) 55%, transparent);

  /* thing kinds, shared by the map, lists and legends */
  --k-player: #3f6fe8;
  --k-enemy: #d9443f;
  --k-npc: #1f9a63;
  --k-wildlife: #b8851f;
  --k-item: #8a5cd6;
  --k-portal: #1a9fb5;

  --map-sea: #dfe7ef;
  --map-land: #f3f1ea;
  --map-high: #e6e2d6;
  --map-line: #c3c7cc;
  --map-road: #ffffff;
  --map-built: #d5d2c8;
  --map-label: #5c6570;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d0f12;
  --surface: #14171b;
  --surface-2: #1a1e23;
  --surface-3: #242930;
  --border: #262b32;
  --border-strong: #3a414b;
  --text: #e8eaed;
  --text-2: #a6aeb9;
  --text-3: #747d89;
  --accent: #7f9cff;
  --accent-hover: #97afff;
  --accent-weak: #1b2440;
  --accent-text: #adc0ff;
  --on-accent: #0b1020;
  --ok: #4fc48c;
  --ok-weak: #11281d;
  --warn: #e3b25a;
  --warn-weak: #2c2210;
  --bad: #f07b70;
  --bad-weak: #331a19;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);

  --k-player: #6f95ff;
  --k-enemy: #f0685f;
  --k-npc: #45c389;
  --k-wildlife: #d9a94a;
  --k-item: #b08cf0;
  --k-portal: #45c4d9;

  --map-sea: #10161d;
  --map-land: #1c2025;
  --map-high: #23272d;
  --map-line: #343a43;
  --map-road: #2c323a;
  --map-built: #2f343c;
  --map-label: #8b94a0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 13px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv05" 1;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 13px; font-weight: 650; }
h3 { font-size: 12px; font-weight: 650; color: var(--text-2); }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.hidden { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: var(--top-h) minmax(0, 1fr); height: 100vh; }
.app.nav-min { --nav-w: 52px; }

.side { grid-row: 1 / 3; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; z-index: 30; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 9px; padding: 0 14px; border-bottom: 1px solid var(--border); flex: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--text); color: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.brand-name { font-weight: 650; white-space: nowrap; }
.brand-env { margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 8px 8px 12px; }
.nav-group { margin-top: 12px; }
.nav-group:first-child { margin-top: 2px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 4px 8px; white-space: nowrap; }
.nav a { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--accent-weak); color: var(--accent-text); }
.nav a .count { margin-left: auto; font-size: 11px; color: var(--text-3); font-weight: 500; }
.nav a.on .count { color: inherit; }
.side-foot { border-top: 1px solid var(--border); padding: 8px; display: flex; flex-direction: column; gap: 2px; flex: none; }
.side-foot .who { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: var(--radius); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-weak); color: var(--accent-text); display: grid; place-items: center; font-size: 11px; font-weight: 650; flex: none; }
.who-name { font-weight: 600; line-height: 1.2; }
.who-role { font-size: 11px; color: var(--text-3); line-height: 1.2; }
.app.nav-min .brand-name, .app.nav-min .brand-env, .app.nav-min .nav-label, .app.nav-min .nav a span, .app.nav-min .nav a .count, .app.nav-min .who-text, .app.nav-min .side-foot .btn span { display: none; }
.app.nav-min .brand { padding: 0; justify-content: center; }
.app.nav-min .nav a { justify-content: center; padding: 0; }
.app.nav-min .nav-group { margin-top: 6px; border-top: 1px solid var(--border); padding-top: 6px; }
.app.nav-min .nav-group:first-child { border-top: 0; }
.app.nav-min .side-foot .who { padding: 6px 0; justify-content: center; }

.top { grid-column: 2; display: flex; align-items: center; gap: 10px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; z-index: 20; }
.top .crumbs { display: flex; align-items: center; gap: 6px; color: var(--text-3); min-width: 0; white-space: nowrap; }
.top .crumbs b { color: var(--text); font-weight: 600; }
.search-btn { display: flex; align-items: center; gap: 8px; height: 30px; width: min(320px, 30vw); padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text-3); cursor: pointer; }
.search-btn:hover { border-color: var(--border-strong); }
.search-btn span { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd { font: 11px var(--mono); padding: 1px 5px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--surface); color: var(--text-2); }
.realm-pick { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); cursor: pointer; white-space: nowrap; }
.realm-pick:hover { border-color: var(--border-strong); }
.realm-pick .lbl { color: var(--text-3); }
.realm-pick b { font-weight: 600; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: var(--ok); white-space: nowrap; }
.live-pill.off { color: var(--text-3); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0; animation: pulse 2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.5); opacity: 0; } }
.live-pill.off .pulse::after { animation: none; }

.main { grid-column: 2; overflow: auto; min-width: 0; position: relative; }
.page { padding: 18px 20px 40px; max-width: 1560px; margin: 0 auto; }
.page.flush { padding: 0; max-width: none; height: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.scope { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--border); color: var(--text-2); background: var(--surface); vertical-align: 2px; margin-left: 8px; white-space: nowrap; }
.scope.gw { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { background: var(--surface-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-weak); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { height: 24px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 24px; }
.btn.on { background: var(--accent-weak); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn[data-nw]::after, .tab[data-nw]::after { content: "mock"; font: 600 9px var(--font); letter-spacing: .03em; padding: 1px 4px; border-radius: 3px; background: var(--surface-3); color: var(--text-3); margin-left: 2px; }

.input, .select, .textarea { height: 30px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); min-width: 0; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.input.sm, .select.sm { height: 24px; font-size: 12px; padding: 0 6px; }
.textarea { height: auto; padding: 8px 9px; resize: vertical; line-height: 1.5; width: 100%; }
.select { padding-right: 24px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 13px) 13px, calc(100% - 9px) 13px; background-size: 4px 4px; background-repeat: no-repeat; }
.select.sm { background-position: calc(100% - 12px) 10px, calc(100% - 8px) 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .label { font-size: 11px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--text-3); }
.with-icon { position: relative; display: flex; align-items: center; }
.with-icon svg { position: absolute; left: 8px; color: var(--text-3); pointer-events: none; }
.with-icon .input { padding-left: 28px; width: 100%; }
input[type=range] { accent-color: var(--accent); height: 16px; margin: 0; }
input[type=checkbox] { accent-color: var(--accent); margin: 0; }

.seg { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); gap: 2px; }
.seg button { height: 24px; padding: 0 9px; border: 0; background: transparent; border-radius: 4px; color: var(--text-2); font-weight: 550; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
:root[data-theme="dark"] .seg button.on { background: var(--surface-3); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 12px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--accent-weak); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.chip .n { color: var(--text-3); font-weight: 500; }
.chip.on .n { color: inherit; opacity: .75; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); font-size: 11px; font-weight: 550; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 7px; border-radius: 99px; font-size: 11px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.bad { background: var(--bad-weak); color: var(--bad); }
.badge.info { background: var(--accent-weak); color: var(--accent-text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); min-height: 42px; }
.card-head h2 { white-space: nowrap; }
.card-head .sp { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 12px; }
.card-foot { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab { height: 34px; padding: 0 12px; border: 0; background: none; color: var(--text-2); font-weight: 550; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { font-size: 11px; color: var(--text-3); background: var(--surface-2); border-radius: 99px; padding: 0 6px; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); padding: 7px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; z-index: 1; }
.tbl td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover, .tbl tbody tr.sel { background: var(--surface-2); }
.tbl tbody tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.tbl td.wrap { white-space: normal; }
.tbl th.right, .tbl td.right { text-align: right; }
.tbl tr.new td { animation: rowin 1.6s ease-out; }
@keyframes rowin { from { background: var(--accent-weak); } to { background: transparent; } }
.kdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--text-3)); margin-right: 6px; vertical-align: 0; }
.kdot.sq { border-radius: 2px; }

.kv { display: grid; grid-template-columns: minmax(96px, 38%) minmax(0, 1fr); }
.kv > div { padding: 5px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { color: var(--text-2); padding-right: 10px; }
.kv .v { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }

.bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }

.stat { padding: 11px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .lbl { font-size: 11px; font-weight: 600; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .val { font-size: 20px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; white-space: nowrap; }
.stat .val small { font-size: 12px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.stat .sub { font-size: 11px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat canvas { width: 100%; height: 28px; margin-top: 4px; display: block; }

.banner { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.banner.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.banner.info { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-text); }
.banner.bad { background: var(--bad-weak); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: var(--bad); }
.banner svg { margin-top: 1px; }
.empty { padding: 40px 16px; text-align: center; color: var(--text-3); }
.empty b { display: block; color: var(--text-2); margin-bottom: 4px; font-weight: 600; }

.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; }
.list-item.click:hover, .list-item.sel { background: var(--surface-2); }
.list-item .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .s { font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-3); }
.sev.warn { background: var(--warn); } .sev.bad { background: var(--bad); } .sev.ok { background: var(--ok); } .sev.info { background: var(--accent); }

/* ---------- overlays ---------- */
.menu { position: fixed; z-index: 200; min-width: 200px; max-width: 360px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 4px; max-height: 70vh; overflow: auto; }
.menu .mi { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 5px; cursor: pointer; color: var(--text); white-space: nowrap; border: 0; background: none; width: 100%; text-align: left; }
.menu .mi:hover, .menu .mi.on { background: var(--surface-2); }
.menu .mi .r { margin-left: auto; color: var(--text-3); font-size: 12px; padding-left: 16px; }
.menu .mh { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 6px 8px 3px; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

.scrim { position: fixed; inset: 0; background: rgba(10, 12, 16, .45); z-index: 300; display: grid; place-items: start center; padding: 10vh 16px 16px; overflow: auto; }
.modal { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); gap: 8px; }
.modal-head h2 { font-size: 14px; }
.modal-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }

.palette { width: min(600px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.palette input { width: 100%; height: 46px; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 0 14px; font-size: 15px; outline: none; }
.palette .results { max-height: 52vh; overflow: auto; padding: 4px; }
.palette .res { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.palette .res.on { background: var(--accent-weak); }
.palette .res .t { font-weight: 550; }
.palette .res .s { color: var(--text-3); font-size: 12px; margin-left: auto; white-space: nowrap; }
.palette .grp { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 8px 10px 3px; }
.palette .foot { display: flex; gap: 14px; padding: 8px 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 11px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 500; max-width: 420px; animation: toastin .18s ease-out; display: flex; gap: 8px; align-items: center; }
.toast.bad { background: var(--bad); color: #fff; }
.toast .sub { opacity: .7; font-weight: 400; }
@keyframes toastin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); z-index: 100; display: flex; flex-direction: column; transform: translateX(105%); transition: transform .18s ease-out; }
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); flex: none; }
.drawer-body { flex: 1; overflow: auto; min-height: 0; }

/* ---------- inspector ---------- */
.insp-title { font-size: 15px; font-weight: 650; line-height: 1.25; }
.insp-sec { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.insp-sec > h3 { margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.insp-sec > h3 .sp { margin-left: auto; font-weight: 500; color: var(--text-3); font-size: 11px; }
.prop { display: grid; grid-template-columns: 118px minmax(0, 1fr) 24px; align-items: center; min-height: 26px; border-bottom: 1px solid var(--border); }
.prop:last-child { border-bottom: 0; }
.prop .k { color: var(--text-2); }
.prop .v { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 3px; padding: 1px 3px; margin-left: -3px; }
.prop .v.flash { animation: flash .8s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--accent) 28%, transparent); } to { background: transparent; } }
.prop .ed { opacity: .45; border: 0; background: none; color: var(--text-3); cursor: pointer; width: 24px; height: 22px; display: grid; place-items: center; border-radius: 4px; padding: 0; }
.prop:hover .ed, .prop .ed:focus-visible { opacity: 1; }
.prop .ed:hover { background: var(--surface-2); color: var(--text); }
.prop .lock { color: var(--text-3); opacity: .45; display: grid; place-items: center; }
.prop .lock svg { width: 12px; height: 12px; }
.prop input.input, .prop select.select { height: 22px; font: 12px var(--mono); padding: 0 5px; width: 100%; }
.slots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.slot { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); display: grid; place-items: center; font-size: 10px; color: var(--text-3); position: relative; cursor: default; min-width: 0; }
.slot.full { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); cursor: pointer; font-weight: 650; }
.slot.full:hover { border-color: var(--accent); }
.slot .q { position: absolute; right: 2px; bottom: 0; font: 9px var(--mono); color: var(--text-3); font-weight: 400; }
.slot[data-r="2"] { box-shadow: inset 0 -2px 0 var(--k-player); } .slot[data-r="3"] { box-shadow: inset 0 -2px 0 var(--k-item); } .slot[data-r="4"] { box-shadow: inset 0 -2px 0 var(--k-wildlife); }
.act { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act .nm { font-weight: 550; }
.act .id { font: 11px var(--mono); color: var(--text-3); }

/* ---------- map ---------- */
.map-page { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.map-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.map-stage { position: relative; min-height: 0; overflow: hidden; background: var(--map-sea); }
.map-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.map-stage canvas.drag { cursor: grabbing; }
.map-float { position: absolute; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-sm); backdrop-filter: blur(6px); }
.map-zoom { right: 12px; bottom: 12px; display: flex; flex-direction: column; padding: 2px; }
.map-read { left: 12px; bottom: 12px; padding: 5px 9px; font: 11px var(--mono); color: var(--text-2); }
.map-follow { left: 12px; top: 12px; padding: 6px 8px 6px 10px; display: flex; align-items: center; gap: 8px; }
.map-feed { right: 12px; top: 12px; width: 260px; max-height: 40%; overflow: hidden; display: flex; flex-direction: column; }
.map-feed h3 { padding: 7px 10px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.map-feed .feed { overflow: auto; padding: 4px 0; font-size: 12px; }
.map-feed .ev { padding: 2px 10px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-feed .ev time { font: 11px var(--mono); color: var(--text-3); margin-right: 6px; }

/* ---------- console ---------- */
.console { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 420px; height: calc(100vh - 170px); position: sticky; top: 12px; }
.console-out { flex: 1; overflow: auto; padding: 10px 12px; font: 12px/1.6 var(--mono); min-height: 0; }
.console-out .in { color: var(--text); } .console-out .in::before { content: "› "; color: var(--accent-text); }
.console-out .ok { color: var(--ok); } .console-out .err { color: var(--bad); } .console-out .dim { color: var(--text-3); }
.console-in { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding: 8px 12px; font-family: var(--mono); }
.console-in input { flex: 1; border: 0; background: transparent; outline: none; font: 12px var(--mono); min-width: 0; }
.console-hint { padding: 0 12px 8px; font: 11px var(--mono); color: var(--text-3); min-height: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-card .card-body { display: flex; flex-direction: column; gap: 8px; }
.cmd-row { display: flex; gap: 6px; align-items: end; flex-wrap: wrap; }
.cmd-row .field { flex: 1 1 110px; }

/* ---------- catalogue ---------- */
.cat-layout { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 18px; align-items: start; }
.cat-rail { position: sticky; top: 0; display: flex; flex-direction: column; gap: 1px; }
.cat-rail a { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 9px; border-radius: var(--radius); color: var(--text-2); font-weight: 500; }
.cat-rail a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.cat-rail a.on { background: var(--surface); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.cat-rail a .n { margin-left: auto; font-size: 11px; color: var(--text-3); }
.cat-rail .rl { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 12px 9px 4px; }
.cat-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.cat-search { flex: 1 1 260px; display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); flex-wrap: wrap; }
.cat-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.cat-search input { flex: 1 1 120px; border: 0; outline: none; background: transparent; height: 24px; min-width: 80px; }
.cat-search .tok { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 4px 0 8px; border-radius: 99px; background: var(--accent-weak); color: var(--accent-text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.cat-search .tok button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 3px; font-size: 14px; line-height: 1; opacity: .7; }
.cat-search .tok button:hover { opacity: 1; }
.cat-group { margin: 16px 0 8px; display: flex; align-items: baseline; gap: 8px; }
.cat-group h2 { font-size: 13px; }
.cat-group .n { color: var(--text-3); }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.asset-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; color: inherit; text-decoration: none !important; transition: border-color .12s, transform .12s; }
.asset-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.thumb { aspect-ratio: 4 / 5; position: relative; background: radial-gradient(120% 90% at 50% 100%, var(--surface-3), var(--surface-2) 60%); display: grid; place-items: center; overflow: hidden; }
.thumb img, .thumb canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb .flag { position: absolute; left: 6px; bottom: 6px; }
.thumb .kind { position: absolute; left: 6px; top: 6px; color: var(--text-3); display: flex; gap: 4px; }
.thumb .score { position: absolute; right: 6px; top: 6px; font: 600 11px var(--mono); padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text-2); }
.thumb .spin { width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }
.asset-meta { padding: 8px 10px 9px; display: flex; flex-direction: column; gap: 3px; min-width: 0; border-top: 1px solid var(--border); }
.asset-meta .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-meta .ln { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.st-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--text-3); }
.st-dot.approved { background: var(--ok); } .st-dot.review { background: var(--accent); } .st-dot.held { background: var(--bad); } .st-dot.draft { background: var(--text-3); }
.mini-strip { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-thumb { width: 52px; height: 52px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; display: grid; place-items: center; position: relative; }
.mini-thumb:hover { border-color: var(--accent); }
.mini-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mini-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* asset page + viewer */
.asset-layout { display: grid; grid-template-columns: minmax(0, 1fr) 384px; gap: 14px; align-items: start; }
.viewer { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); background: #1a1d21; height: clamp(440px, calc(100vh - 150px), 860px); user-select: none; }
.viewer:fullscreen { height: 100vh; border-radius: 0; border: 0; }
.viewer canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.viewer .labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.viewer .pt-label { position: absolute; transform: translate(-50%, -140%); font: 600 10px var(--mono); padding: 1px 5px; border-radius: 3px; background: rgba(15, 17, 20, .82); color: #ffd98a; white-space: nowrap; }
.viewer .vfloat { position: absolute; background: rgba(22, 25, 30, .86); color: #e8eaed; border: 1px solid rgba(255, 255, 255, .10); border-radius: 10px; backdrop-filter: blur(8px); }
.viewer.lightbg .vfloat { background: rgba(255, 255, 255, .9); color: #191c20; border-color: rgba(0, 0, 0, .12); }
.viewer .vtop, .viewer.lightbg .vtop { left: 10px; top: 10px; display: flex; gap: 6px; flex-wrap: wrap; background: none; border: 0; backdrop-filter: none; max-width: calc(100% - 20px); pointer-events: none; }
.viewer .vchip { font: 600 11px var(--mono); padding: 3px 7px; border-radius: 6px; background: rgba(22, 25, 30, .78); color: #d6dae0; border: 1px solid rgba(255, 255, 255, .08); white-space: nowrap; }
.viewer.lightbg .vchip { background: rgba(255, 255, 255, .85); color: #2b3038; border-color: rgba(0, 0, 0, .1); }
.viewer .vchip.note { font-family: var(--font); font-weight: 500; white-space: normal; }
.att .list-item { padding: 6px 12px; }
.att .list-item .grow { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.att .list-item .t { flex: none; max-width: 100%; }
.att .list-item .s { flex: 1; min-width: 0; }
@media (max-width: 900px) { .att .list-item .grow { display: block; } }
.brand-env { cursor: pointer; border: 0; }
.viewer .vload, .viewer.lightbg .vload { inset: 0; display: grid; place-items: center; background: rgba(15, 17, 20, .5); border: 0; border-radius: 0; font-weight: 600; z-index: 3; }
.vbars { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.vbars > * { pointer-events: auto; }
.viewer .vbars .vfloat { position: static; }
.vbar { display: flex; align-items: center; gap: 2px; padding: 4px; max-width: 100%; }
.vbar.wrap { flex-wrap: wrap; justify-content: center; }
.vbtn { height: 28px; min-width: 28px; padding: 0 8px; border: 0; background: transparent; color: inherit; border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 550; white-space: nowrap; }
.vbtn:hover { background: rgba(255, 255, 255, .10); }
.vbtn.on { background: rgba(255, 255, 255, .18); }
.viewer.lightbg .vbtn:hover { background: rgba(0, 0, 0, .07); }
.viewer.lightbg .vbtn.on { background: rgba(0, 0, 0, .12); }
.vsep { width: 1px; height: 18px; background: currentColor; opacity: .16; margin: 0 4px; flex: none; }
.vtime { font: 11px var(--mono); padding: 0 8px; white-space: nowrap; line-height: 1.2; text-align: right; min-width: 78px; }
.vtime b { color: #ff9d8a; font-weight: 600; }
.viewer.lightbg .vtime b { color: #c2412c; }
.scrub { position: relative; width: clamp(140px, 28vw, 380px); height: 28px; cursor: pointer; touch-action: none; flex: 1 1 auto; }
.scrub .track { position: absolute; left: 0; right: 0; top: 9px; height: 10px; background-image: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 100%); background-size: 5% 100%; opacity: .35; border-right: 1px solid currentColor; }
.scrub .head { position: absolute; top: 3px; width: 2px; height: 22px; background: #ff7d66; border-radius: 1px; margin-left: -1px; }
.scrub .mark { position: absolute; top: 5px; width: 9px; height: 9px; margin-left: -4.5px; transform: rotate(45deg); background: #ffcf5c; border: 1px solid rgba(0, 0, 0, .5); cursor: pointer; }
.scrub .mark.cue { background: #6fd3ff; top: 15px; border-radius: 50%; transform: none; }
.scrub .mark:hover { outline: 2px solid #fff; }
.vpop { position: absolute; bottom: 86px; padding: 10px; width: 300px; max-width: calc(100% - 20px); z-index: 4; display: flex; flex-direction: column; gap: 10px; max-height: calc(100% - 110px); overflow: auto; }
.vpop h4 { font-size: 11px; font-weight: 600; opacity: .65; display: flex; align-items: center; }
.vpop h4 span { margin-left: auto; font-weight: 500; }
.vpop .vseg { display: flex; padding: 2px; border-radius: 8px; background: rgba(127, 127, 127, .18); gap: 2px; }
.vpop .vseg button { flex: 1; height: 26px; border: 0; background: none; color: inherit; border-radius: 6px; cursor: pointer; font-weight: 550; opacity: .75; white-space: nowrap; padding: 0 6px; }
.vpop .vseg button.on { background: rgba(127, 127, 127, .38); opacity: 1; }
.vpop .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vpop .tile { border: 0; text-align: left; padding: 7px 8px; border-radius: 8px; background: rgba(127, 127, 127, .14); color: inherit; cursor: pointer; line-height: 1.25; }
.vpop .tile b { display: block; font-weight: 600; font-size: 12px; }
.vpop .tile small { font-size: 11px; opacity: .6; }
.vpop .tile.on { background: color-mix(in srgb, var(--accent) 38%, transparent); }
.vpop .tile .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--c); }
.vpop .swatches { display: flex; gap: 6px; }
.vpop .swatch { width: 30px; height: 30px; border-radius: 7px; border: 1px solid rgba(127, 127, 127, .5); cursor: pointer; padding: 0; }
.vpop .swatch.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.vpop .clips { display: flex; flex-wrap: wrap; gap: 5px; }
.vpop .clip { height: 26px; padding: 0 9px; border-radius: 99px; border: 0; background: rgba(127, 127, 127, .16); color: inherit; cursor: pointer; font-weight: 550; white-space: nowrap; }
.vpop .clip small { opacity: .55; font-weight: 400; margin-left: 4px; font-family: var(--mono); }
.vpop .clip.on { background: #ff7d66; color: #1a0f0c; }
.vpop .part { display: flex; align-items: center; gap: 6px; height: 26px; }
.vpop .part span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vpop .part small { opacity: .55; font-family: var(--mono); font-size: 11px; }
.vpop input[type=range] { width: 100%; }
.vsplit { position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; background: rgba(255, 255, 255, .35); pointer-events: none; }
.vside { position: absolute; top: 44px; font: 600 11px var(--font); padding: 3px 8px; border-radius: 6px; background: rgba(22, 25, 30, .8); color: #fff; }
.asset-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.asset-side .card-body { padding: 10px 12px; }
.score-big { font-size: 28px; font-weight: 650; line-height: 1; letter-spacing: -.02em; }
.score-row { display: grid; grid-template-columns: 110px 1fr 28px; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; }
.note { padding: 8px 0; border-bottom: 1px solid var(--border); }
.note:last-child { border-bottom: 0; }
.note .who { font-weight: 600; }
.note .when { color: var(--text-3); font-size: 11px; margin-left: 6px; }
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fact { background: var(--surface-2); border-radius: 8px; padding: 7px 9px; min-width: 0; }
.fact .lbl { font-size: 11px; color: var(--text-3); white-space: nowrap; }
.fact .val { font-weight: 650; font-size: 14px; white-space: nowrap; }
.wave { width: 100%; height: 64px; display: block; }

/* ---------- world building / content / misc ---------- */
.split { display: grid; grid-template-columns: 240px minmax(0, 1fr) 340px; gap: 12px; align-items: start; }
.wb-map { position: relative; height: 340px; border-bottom: 1px solid var(--border); background: var(--map-land); overflow: hidden; }
.wb-map canvas { width: 100%; height: 100%; display: block; }
.diff { font: 12px/1.6 var(--mono); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; overflow: auto; white-space: pre; max-height: 300px; }
.diff .add { color: var(--ok); display: block; background: color-mix(in srgb, var(--ok) 9%, transparent); }
.diff .del { color: var(--bad); display: block; background: color-mix(in srgb, var(--bad) 9%, transparent); }
.diff .hd { color: var(--text-3); display: block; }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); min-height: 480px; }
.editor textarea { border: 0; outline: none; resize: none; padding: 14px; font: 13px/1.6 var(--mono); background: var(--surface); color: var(--text); border-right: 1px solid var(--border); min-height: 480px; }
.preview { padding: 14px 18px; overflow: auto; font-size: 14px; line-height: 1.6; }
.preview h1 { font-size: 22px; margin: 0 0 10px; } .preview h2 { font-size: 16px; margin: 18px 0 6px; } .preview h3 { font-size: 14px; margin: 14px 0 4px; color: var(--text); }
.preview p { margin: 0 0 10px; } .preview ul { margin: 0 0 10px; padding-left: 20px; } .preview code { background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.preview blockquote { margin: 0 0 10px; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.days { display: grid; grid-template-columns: repeat(30, 1fr); gap: 3px; }
.days i { height: 26px; border-radius: 3px; background: var(--ok); opacity: .8; cursor: default; }
.days i.bad { background: var(--bad); } .days i.none { background: var(--surface-3); }
.timeline { position: relative; height: 40px; margin: 6px 0 2px; }
.timeline .rail { position: absolute; left: 0; right: 0; top: 17px; height: 6px; border-radius: 3px; background: var(--surface-3); }
.timeline .snap { position: absolute; top: 13px; width: 2px; height: 14px; background: var(--text-3); opacity: .5; }
.timeline input { position: absolute; left: -2px; right: -2px; top: 10px; width: calc(100% + 4px); }
.steps { display: flex; flex-direction: column; gap: 6px; font: 12px var(--mono); }
.steps .step { display: flex; gap: 8px; align-items: center; color: var(--text-3); }
.steps .step.done { color: var(--ok); } .steps .step.run { color: var(--text); }

/* ---------- responsive ---------- */
.only-narrow { display: none; }
@media (max-width: 1180px) {
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .asset-layout { grid-template-columns: minmax(0, 1fr); }
  .viewer { height: clamp(420px, 62vh, 720px); }
  .split { grid-template-columns: 220px minmax(0, 1fr); }
  .split > :nth-child(3) { grid-column: 1 / -1; }
  .console { position: static; height: 420px; }
}
@media (max-width: 900px) {
  .g3 { grid-template-columns: minmax(0, 1fr); }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-rail { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .cat-rail .rl { display: none; }
  .cat-rail a { border: 1px solid var(--border); background: var(--surface); height: 26px; }
  .cat-rail a.on { box-shadow: none; border-color: var(--accent); color: var(--accent-text); }
  .cat-rail a .n { margin-left: 4px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .editor textarea { border-right: 0; border-bottom: 1px solid var(--border); min-height: 280px; }
  .map-feed { display: none; }
  .top .crumbs .hide-narrow, .realm-pick .lbl { display: none; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: 240px; transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow); }
  .app.nav-open .side { transform: none; }
  .top, .main { grid-column: 1; }
  .only-narrow { display: inline-flex; }
  .page { padding: 14px 12px 32px; }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-btn { width: 34px; padding: 0; justify-content: center; }
  .search-btn span, .search-btn kbd { display: none; }
  .fact-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- what the real admin area adds ---------- */
.loading { display: grid; place-items: center; height: 100vh; color: var(--text-3); }
.error { color: var(--bad); }
.small { font-size: 12px; }
.main > .page { min-height: 100%; }
select.realm-pick { appearance: none; font-weight: 600; padding-right: 10px; }

/* sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.signin-card { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 14px; }
.signin-card .brand { height: auto; padding: 0; border: 0; }
.signin-card form { display: flex; flex-direction: column; gap: 12px; }
.signin-card .btn.primary { height: 34px; }
.signin-card .foot { display: flex; align-items: center; justify-content: space-between; color: var(--text-3); font-size: 12px; }

/* commands */
.cmd-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 12px; align-items: start; }
.cmd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.cmd-grid .wide { grid-column: 1 / -1; }
.cmd-card .hint { font-size: 11px; color: var(--text-3); }
.cmd-row .field.narrow { flex: 0 1 84px; }
.record { position: sticky; top: 0; max-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.record .tbl-wrap { flex: 1; min-height: 0; }
.rec { padding: 8px 12px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 8px; }
.rec:last-child { border-bottom: 0; }
.rec .what { font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec .said { grid-column: 2; color: var(--text-2); font-size: 12px; }
.rec .meta { grid-column: 2; color: var(--text-3); font-size: 11px; }
.rec.new { animation: rowin 1.6s ease-out; }
.result { padding: 8px 12px; border-radius: var(--radius); font-size: 12px; background: var(--ok-weak); color: var(--ok); }
.result.bad { background: var(--bad-weak); color: var(--bad); }

/* live map */
.map-page { height: calc(100vh - var(--top-h)); }
.map-side { position: absolute; right: 12px; top: 12px; width: 300px; max-height: calc(100% - 24px); overflow: auto; display: flex; flex-direction: column; }
.map-side .insp-sec:last-child { border-bottom: 0; }
.map-side .cmd-row .field { flex: 1 1 70px; }
.map-pick { left: 50%; top: 12px; transform: translateX(-50%); padding: 6px 10px; display: flex; gap: 8px; align-items: center; font-weight: 550; }
.map-stage canvas.pick { cursor: crosshair; }

/* catalogue */
.cat-search input:focus-visible { box-shadow: none; }
.thumb .sw { width: 46%; aspect-ratio: 1; border-radius: 14px; box-shadow: var(--shadow-sm); border: 1px solid color-mix(in srgb, var(--text) 14%, transparent); }
.thumb .sw.round { border-radius: 50%; }
.viewer .viewer-host { position: absolute; inset: 0; }
.viewer .vbar label { display: inline-flex; align-items: center; gap: 6px; padding: 0 8px; height: 28px; white-space: nowrap; }
.viewer .vbar select { height: 24px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .18); background: transparent; color: inherit; }
.viewer .vbar select option { color: #191c20; }
.viewer .vbar input[type=range] { width: 110px; }

/* The catalogue's lightbox: one asset over the catalogue (Pages/AssetLightbox.razor), holding the
   asset page itself. Nearly the whole screen on a desktop, all of it on a phone. */
.lb-scrim { position: fixed; inset: 0; z-index: 300; background: rgba(10, 12, 16, .58); display: grid; padding: 18px; animation: lb-in .12s ease-out; }
.lb { display: flex; flex-direction: column; width: min(1760px, 100%); height: 100%; min-height: 0; margin: 0 auto; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 48px rgba(0, 0, 0, .35); overflow: hidden; outline: none; }
.lb-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 16px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.lb-name { flex: 1 1 auto; min-width: 0; }
.lb-name h2 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name .sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-step { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 4px; border-right: 1px solid var(--border); }
#lb-prev svg { transform: rotate(90deg); }
#lb-next svg { transform: rotate(-90deg); }
.lb-where { font: 12px var(--mono); color: var(--text-2); min-width: 72px; text-align: center; white-space: nowrap; }
.lb-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.lb-body .page { padding: 12px 14px 18px; max-width: none; }
.lb .viewer { height: max(340px, calc(100dvh - 36px - 50px - 26px)); }
@keyframes lb-in { from { opacity: 0; } }
@media (max-width: 720px) {
  .lb-scrim { padding: 0; }
  .lb { border: 0; border-radius: 0; }
  .lb-bar { padding: 6px 6px 6px 12px; gap: 2px; }
  .lb-name .sub, .lb-name .scope { display: none; }
  .lb-where { min-width: 0; padding: 0 2px; }
  .lb-body .page { padding: 0 0 18px; }
  .lb .viewer { height: calc(100dvh - 50px - 64px); border-radius: 0; border-width: 0 0 1px; }
  .lb .asset-side, .lb .asset-mobiles { padding: 0 10px; }
  .lb .page > .banner { margin: 10px; }
}

#blazor-error-ui { display: none; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px; background: var(--bad); color: #fff; z-index: 500; }
#blazor-error-ui a { color: #fff; text-decoration: underline; } #blazor-error-ui .dismiss { cursor: pointer; float: right; }
@media (max-width: 1180px) { .cmd-layout { grid-template-columns: minmax(0, 1fr); } .record { position: static; max-height: 480px; } }
@media (max-width: 900px) { .cmd-grid { grid-template-columns: minmax(0, 1fr); } .map-side { position: static; width: auto; max-height: 45%; border-radius: 0; } }

/* ---------- The blog and the wiki ---------- */
.md-title { width: 100%; height: 38px; font-size: 18px; font-weight: 650; }
.md-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
.md-meta .md-wide { grid-column: 1 / -1; }
.md-meta .row { gap: 4px; }
.md-cover { height: 54px; max-width: 160px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.md-tools { margin-bottom: 8px; gap: 6px; }
.md-tools label.btn { cursor: pointer; }
.editor textarea { width: 100%; }
/* What the gateway makes of Markdown, in the preview. */
.md-body img { max-width: 100%; height: auto; border-radius: var(--radius); }
.md-body a { color: var(--accent-text); text-decoration: underline; }
.md-body a.wikilink.missing { color: var(--bad); text-decoration-style: dashed; }
.md-body pre { background: var(--surface-2); padding: 10px 12px; border-radius: var(--radius); overflow: auto; margin: 0 0 10px; }
.md-body pre code { background: none; padding: 0; }
.md-body ol { margin: 0 0 10px; padding-left: 22px; }
.md-body table { border-collapse: collapse; margin: 0 0 10px; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 4px 9px; text-align: left; }
.md-body hr { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }
.versions { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.version-list { border-right: 1px solid var(--border); max-height: 420px; }
.version-view { padding: 12px 14px; min-width: 0; }
.version-view .diff { max-height: 360px; white-space: normal; }
.version-view .diff span { white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.6em; }
.diff .same { display: block; color: var(--text-2); }
.wiki-cat .tbl td:first-child a { color: var(--text); }
@media (max-width: 900px) {
  .md-meta { grid-template-columns: minmax(0, 1fr); }
  .versions { grid-template-columns: minmax(0, 1fr); }
  .version-list { border-right: 0; border-bottom: 1px solid var(--border); max-height: 220px; }
}

.viewer .vfx { position: absolute; right: 12px; top: 48px; z-index: 3; max-width: 300px; max-height: calc(100% - 150px); overflow: auto; padding: 10px 12px; border-radius: 10px; background: rgba(22, 25, 31, .88); color: #e8eaf0; font-size: 12px; line-height: 1.5; display: flex; flex-direction: column; gap: 2px; }
.viewer .vfx label { display: flex; gap: 7px; align-items: baseline; cursor: pointer; }
.viewer .vfx .vfx-head { opacity: .7; margin-bottom: 6px; }
.viewer .vfx .vfx-foot { display: flex; gap: 6px; margin-top: 8px; }
