/* Ironhold city explorer. Same visual language as the Guard Duty dashboard (styles.css):
   gunmetal surfaces, hairline steel, brass for action and headings, oxblood for threats and DM-only,
   verdigris for selection and allies. System fonts only; no external assets.
   Slots: #ui-search (top bar), #ui-panel (right / bottom sheet), #ui-levels (left), #ui-minimap
   (bottom left), #ui-hud (bottom right). Module builders: style inside your slot, reuse the tokens
   and the .btn / .btn-icon / .chip / .card helpers below. */

:root {
  --bg: #16191d;
  --bg-2: #1b1f24;
  --panel: #1f242a;
  --panel-2: #252b32;
  --panel-3: #2c333b;
  --inset: #121519;
  --line: #2f363e;
  --line-2: #3d4650;
  --line-3: #4d5763;
  --text: #e7e2d7;
  --text-2: #bdb8ad;
  --muted: #8b9198;
  --faint: #646b73;
  --brass: #c9a253;
  --brass-2: #e2bf72;
  --brass-ink: #1b1608;
  --brass-tint: rgba(201, 162, 83, 0.12);
  --brass-line: rgba(201, 162, 83, 0.38);
  --oxblood: #9b3a35;
  --oxblood-2: #d97a70;
  --oxblood-tint: rgba(155, 58, 53, 0.18);
  --verdigris: #4a9584;
  --verdigris-2: #7fc6b2;
  --verdigris-tint: rgba(74, 149, 132, 0.16);
  --steel: #6b8db0;
  --steel-2: #a3bfdb;
  --glass: rgba(24, 28, 33, 0.9);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --ui: -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -16px rgba(0, 0, 0, 0.8);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--brass-2);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --gutter: 12px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
body {
  color: var(--text);
  font: 13px/1.45 var(--ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(201, 162, 83, 0.35); }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--radius-sm); }
[hidden] { display: none !important; }

.city { position: fixed; inset: 0; overflow: hidden; }
.stage { position: absolute; inset: 0; }
.stage__canvas { display: block; width: 100%; height: 100%; touch-action: none; outline: none; }
.labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; contain: strict; }
.labels.is-off { visibility: hidden; }

/* ---------------------------------------------------------------- labels */
.lbl {
  position: absolute; left: 0; top: 0;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .28s var(--ease);
  will-change: transform, opacity;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 8px rgba(0, 0, 0, 0.55);
}
.lbl.is-on { opacity: 1; }
.lbl--click.is-on { pointer-events: auto; cursor: pointer; }

.lbl--district {
  font: 600 21px/1 var(--serif);
  letter-spacing: 0.3em; text-transform: uppercase;
  color: rgba(231, 226, 215, 0.86);
  padding: 4px 0 4px 0.3em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.7);
}
.lbl--district:hover { color: var(--brass-2); }
.lbl--subarea { font: italic 12.5px/1.2 var(--serif); color: var(--text-2); padding: 2px 0; }
.lbl--region { font: italic 600 14px/1.2 var(--serif); color: var(--brass-2); padding: 2px 0; }
.lbl--gate, .lbl--road {
  font: 600 9.5px/1.2 var(--ui); letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(231, 226, 215, 0.66); padding: 1px 0;
}
.lbl--gate { color: var(--brass-2); }
.lbl--landmark {
  isolation: isolate;
  font: 500 11.5px/1.25 var(--ui); color: var(--text);
  padding: 3px 8px 11px; text-shadow: none;
}
.lbl--landmark::before {
  content: ""; position: absolute; inset: 0 0 8px 0; z-index: -1;
  background: rgba(19, 22, 26, 0.88);
  border: 1px solid var(--brass-line); border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.9);
}
.lbl--landmark::after {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 6px; height: 6px; margin-left: -3px;
  background: var(--brass); transform: rotate(45deg); border-radius: 1px;
}
.lbl--landmark:hover::before { border-color: var(--brass-2); background: rgba(33, 37, 43, 0.95); }
.lbl--landmark.lbl--dm::before { border-color: rgba(217, 122, 112, 0.6); }
.lbl--landmark.lbl--dm::after { background: var(--oxblood-2); }
.lbl--room { font: 500 10.5px/1.2 var(--ui); color: var(--text); padding: 1px 4px; background: rgba(19, 22, 26, 0.72); border-radius: 3px; text-shadow: none; }
.lbl--level { font: 600 10px/1.2 var(--ui); letter-spacing: .08em; color: var(--brass-2); }
.lbl--note { font: 11px/1.2 var(--ui); color: var(--text-2); }

/* ---------------------------------------------------------------- shared controls */
.btn, .btn-icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.btn { padding: 5px 10px; font-weight: 500; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn:hover, .btn-icon:hover { border-color: var(--brass-line); color: var(--brass-2); background: var(--panel-3); }
.btn[aria-pressed="true"], .btn-icon[aria-pressed="true"] { border-color: var(--brass); color: var(--brass-2); background: var(--brass-tint); }
.btn--brass { background: var(--brass); border-color: var(--brass); color: var(--brass-ink); }
.btn--brass:hover { background: var(--brass-2); color: var(--brass-ink); }
.btn-icon svg, .btn svg { width: 18px; height: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 11px; color: var(--text-2); background: var(--panel-2);
}
.chip--brass { border-color: var(--brass-line); color: var(--brass-2); background: var(--brass-tint); }
.chip--dm { border-color: rgba(217, 122, 112, .5); color: var(--oxblood-2); background: var(--oxblood-tint); }
.chip--ok { border-color: rgba(127, 198, 178, .45); color: var(--verdigris-2); background: var(--verdigris-tint); }
.card {
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.eyebrow { font: 600 10px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: absolute; top: var(--gutter); left: var(--gutter); right: var(--gutter);
  display: flex; align-items: flex-start; gap: 10px; pointer-events: none; z-index: 5;
}
.topbar > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 8px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.brand__mark { width: 26px; height: 26px; color: var(--brass); flex: none; }
.brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.brand__name { font: 600 16px/1.1 var(--serif); letter-spacing: .08em; color: var(--text); }
.brand__sub { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.mode-badge { display: none; margin-left: 4px; padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; }
[data-mode="dm"] .mode-badge--dm { display: inline-block; color: var(--oxblood-2); border: 1px solid rgba(217, 122, 112, .45); background: var(--oxblood-tint); }
.slot--search { flex: 0 1 380px; min-width: 0; }

/* ---------------------------------------------------------------- panel */
.slot--panel {
  position: absolute; top: 72px; right: var(--gutter); width: 340px;
  max-height: calc(100% - 72px - 150px); overflow: auto; z-index: 6;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* ---------------------------------------------------------------- levels, minimap, hud */
.slot--levels { position: absolute; left: var(--gutter); top: 50%; transform: translateY(-50%); z-index: 4; }
.slot--minimap { position: absolute; left: var(--gutter); bottom: var(--gutter); z-index: 4; }
.slot--hud {
  position: absolute; right: var(--gutter); bottom: var(--gutter); z-index: 4;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
}

.hud-row { display: flex; gap: 6px; align-items: center; }
.hud-col { display: flex; flex-direction: column; gap: 4px; }
.hud-group { display: flex; flex-direction: column; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.hud-group .btn-icon { border: 0; border-radius: 0; background: transparent; }
.hud-group .btn-icon + .btn-icon { border-top: 1px solid var(--line); }
.compass { width: 46px; height: 46px; border-radius: 50%; padding: 0; background: var(--glass); border: 1px solid var(--line-2); box-shadow: var(--shadow); cursor: pointer; }
.compass:hover { border-color: var(--brass-line); }
.compass svg { width: 100%; height: 100%; display: block; transition: transform .08s linear; }
.scalebar { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 4px 8px; font-size: 10.5px; color: var(--text-2); background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scalebar__bar { height: 6px; border: 1.5px solid var(--text-2); border-top: 0; }
.readout { font: 10.5px/1.3 var(--mono); color: var(--muted); text-align: right; padding: 0 2px; text-shadow: 0 1px 2px #000; }
.layers-menu {
  position: absolute; right: 52px; bottom: 0; width: 210px; padding: 8px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.layers-menu label { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: var(--radius-sm); cursor: pointer; }
.layers-menu label:hover { background: var(--panel-3); }
.layers-menu input { accent-color: var(--brass); }
.layers-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---------------------------------------------------------------- toasts, loading */
.toasts { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 20; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 7px 12px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line-2); box-shadow: var(--shadow); color: var(--text); transition: opacity .35s, transform .35s; max-width: min(520px, 92vw); }
.toast--warn { border-color: var(--brass-line); }
.toast--error { border-color: rgba(217, 122, 112, .6); color: var(--oxblood-2); }
.toast.is-out { opacity: 0; transform: translateY(-6px); }

.loading {
  position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: radial-gradient(ellipse at 50% 45%, #232830 0%, var(--bg) 62%);
  transition: opacity .6s var(--ease);
}
.loading.is-done { opacity: 0; pointer-events: none; }
.loading__mark { width: 64px; height: 64px; color: var(--brass); animation: spin 6s linear infinite; }
.loading__title { font: 600 26px/1 var(--serif); letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; color: var(--text); }
.loading__text { font-size: 12px; letter-spacing: .06em; color: var(--muted); max-width: 80vw; text-align: center; }
.loading.is-error .loading__text { color: var(--oxblood-2); }
.loading.is-error .loading__mark { animation: none; color: var(--oxblood); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading__mark { animation: none; } .lbl { transition: none; } }

/* ---------------------------------------------------------------- phone / small windows */
@media (max-width: 700px) {
  :root { --gutter: 8px; }
  .brand__sub, .brand__text { display: none; }
  .brand { padding: 5px 7px; }
  .slot--search { flex: 1 1 auto; }
  .slot--panel { top: auto; bottom: var(--gutter); left: var(--gutter); right: var(--gutter); width: auto; max-height: 46vh; z-index: 8; }
  .slot--minimap { display: none; }
  .slot--levels { top: 64px; transform: none; }
  .lbl--district { font-size: 16px; }
  .readout { display: none; }
}
@media (pointer: coarse) { .btn-icon { width: 40px; height: 40px; } }

/* ================================================================ ui-integration
   Owned by the ui-integration builder: the info panel (js/ui/panel.js), search and the guide overlay
   (js/ui/search.js), the minimap and legend (js/ui/minimap.js), and the player build's title card
   (tools/build_player_city.py). Tokens and helpers come from the core sections above. */

/* ---- info panel (on desktop it stops left of the HUD column, so the zoom and rotate buttons stay usable) */
@media (min-width: 701px) {
  .slot--panel { right: calc(var(--gutter) + 56px); max-height: calc(100% - 72px - 84px); }
}
.pn { padding: 13px 14px 12px; }
.pn-head { margin-bottom: 2px; }
.pn-eyebrow { color: var(--brass); }
.pn-title { margin: 3px 0 6px; font: 600 20px/1.2 var(--serif); color: var(--text); text-wrap: balance; }
.pn-sub { margin: -2px 0 6px; font-size: 12px; color: var(--muted); }
.pn-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.pn-sec { margin-top: 12px; color: var(--text-2); }
.pn-sec > .eyebrow { margin-bottom: 5px; }
.pn-sec p { margin: 4px 0; }
.pn-sec ul { margin: 4px 0; padding-left: 18px; }
.pn-blurb { color: var(--text); font: 14px/1.5 var(--serif); }
.pn-blurb p:first-child { margin-top: 0; }
.pn-dm { border-left: 2px solid var(--oxblood); padding-left: 9px; }
.pn-dm > .eyebrow, .pn-dmtext { color: var(--oxblood-2); }
.pn-details summary { cursor: pointer; list-style: none; }
.pn-details summary::-webkit-details-marker { display: none; }
.pn-details summary::after { content: " ▸"; }
.pn-details[open] summary::after { content: " ▾"; }
.pn-details p { font-size: 12px; color: var(--muted); }
.pn-note { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.pn-dim { color: var(--faint); font-size: 11.5px; }
.pn-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 12.5px; }
.pn-facts dt { color: var(--muted); }
.pn-facts dd { margin: 0; color: var(--text); }
.pn-swatch { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 2px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.pn-rooms { list-style: none; margin: 0; padding: 0 !important; display: flex; flex-direction: column; }
.pn-room { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
.pn-room:first-child { border-top: 0; }
.pn-room__main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 7px; }
.pn-room__name { color: var(--text); }
.pn-room__note { flex-basis: 100%; font-size: 11.5px; color: var(--muted); }
.pn-room.is-dm .pn-room__name { color: var(--oxblood-2); }
.pn-look, .pn-link, .chip--btn { font: inherit; cursor: pointer; }
.pn-look { flex: none; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--muted); font-size: 11px; }
.pn-look:hover { border-color: var(--verdigris); color: var(--verdigris-2); }
.pn-link { padding: 0; border: 0; background: none; color: var(--brass-2); text-decoration: underline; text-underline-offset: 2px; }
.chip--btn:hover { border-color: var(--brass-line); color: var(--brass-2); }
.chip--btn.chip--dm:hover { color: #f1a39a; }
.pn-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; align-items: center; }
.pn-spacer { flex: 1; }
.pn-iconbtn { width: 30px; height: 30px; }
.pn-iconbtn svg { width: 17px; height: 17px; }

/* ---- search (top bar) */
.sr { display: flex; gap: 6px; align-items: flex-start; }
.sr-box { position: relative; flex: 1; min-width: 0; }
.sr-icon { position: absolute; left: 10px; top: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.sr-input { width: 100%; height: 36px; padding: 0 34px 0 32px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--glass); box-shadow: var(--shadow); color: var(--text); -webkit-appearance: none; appearance: none; }
.sr-input::placeholder { color: var(--muted); }
.sr-input:focus { border-color: var(--brass-line); }
.sr-input::-webkit-search-cancel-button { display: none; }
.sr-kbd { position: absolute; right: 8px; top: 8px; pointer-events: none; font: 600 11px/1 var(--mono); padding: 3px 6px; border-radius: 3px; border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--muted); background: var(--panel); }
.sr-input:focus ~ .sr-kbd { display: none; }
.sr-help { flex: none; width: 36px; height: 36px; background: var(--glass); border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.sr-list { position: absolute; top: 40px; left: 0; right: 0; z-index: 12; margin: 0; padding: 4px; list-style: none; background: rgba(24, 28, 33, .97); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); max-height: min(62vh, 520px); overflow: auto; overscroll-behavior: contain; }
.sr-head { padding: 4px 8px 2px; font: 600 10px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.sr-empty { padding: 10px 8px; color: var(--muted); }
.sr-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; }
.sr-row[aria-selected="true"] { background: var(--panel-3); }
.sr-main { display: flex; flex-direction: column; min-width: 0; }
.sr-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.sr-name mark, .sr-alias mark { background: none; color: var(--brass-2); font-weight: 600; }
.sr-alias, .sr-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-kind { flex: none; color: var(--faint); font-size: 11px; white-space: nowrap; padding-top: 1px; }
.sr-row.is-dm .sr-name { color: var(--oxblood-2); }
.sr-row.is-far .sr-name { color: var(--text-2); font-style: italic; }
.sr-sw { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }

/* ---- guide overlay (controls + legend) */
.gd-overlay { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 12, 14, .58); }
.gd-card { width: min(760px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; background: rgba(24, 28, 33, .98); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 24px 60px -20px #000; }
.gd-head { display: flex; align-items: center; gap: 14px; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.gd-head h2 { margin: 2px 0 0; font: 600 21px/1.1 var(--serif); }
.gd-tabs { display: flex; gap: 4px; margin-left: auto; }
.gd-tabs button { padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; }
.gd-tabs button[aria-selected="true"] { border-color: var(--brass); color: var(--brass-2); background: var(--brass-tint); }
.gd-close { width: 32px; height: 32px; }
.gd-body { padding: 6px 18px 18px; overflow: auto; color: var(--text-2); }
.gd-body h3 { margin: 14px 0 6px; font: 600 10.5px/1.2 var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.gd-body p { margin: 8px 0; }
.gd-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 26px; }
.gd-table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.gd-table th { text-align: left; font-weight: 500; color: var(--text); padding: 4px 12px 4px 0; vertical-align: top; white-space: nowrap; }
.gd-table td { padding: 4px 0; color: var(--text-2); }
.gd-table tr + tr th, .gd-table tr + tr td { border-top: 1px solid var(--line); }
.gd-body kbd { font: 600 11px/1 var(--mono); padding: 2px 5px; border-radius: 3px; border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--text); background: var(--panel); }
.gd-tiers { margin: 4px 0; padding-left: 20px; }
.gd-tiers li { margin: 3px 0; }
.gd-tiers b { color: var(--text); font-weight: 600; }
.gd-dm { border-left: 2px solid var(--oxblood); padding-left: 12px; margin-top: 12px; }
.gd-dm h3 { color: var(--oxblood-2); }
.gd-dm ul { margin: 4px 0; padding-left: 18px; }
.gd-linkbtn { padding: 0; border: 0; background: none; color: var(--brass-2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.lg-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lg-list li { display: flex; align-items: center; gap: 10px; }
.lg-list li > span:last-child { min-width: 0; }
.lg-list small { display: block; color: var(--muted); font-size: 11.5px; }
.lg-list b { color: var(--text); font-weight: 600; }
.lg-list--tight { gap: 3px; }
.lg-key { flex: none; width: 128px; display: flex; justify-content: center; align-items: center; }
.lg-sw { flex: none; width: 14px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }
.lg-sample.lbl { position: relative; left: auto; top: auto; opacity: 1; transition: none; will-change: auto; }
.lg-sample.lbl--district { font-size: 15px; }
.lg-box { flex: none; width: 34px; height: 18px; border: 1.5px solid; border-radius: 1px; }
.lg-box--hover { border-color: #e2bf72; }
.lg-box--sel { border-color: #7fc6b2; }
.lg-box--view { border-color: #9b3a35; background: rgba(201, 162, 83, .18); }
.lg-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #c9a253; box-shadow: 0 0 0 1.5px #16191d; }
.lg-note { font-size: 12px; color: var(--muted); }

/* ---- minimap */
.mm { --mm-w: 250px; --mm-ar: 16 / 9; position: relative; width: var(--mm-w); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; background: #e8e4da; transition: width .2s var(--ease); }
.mm.is-big { --mm-w: min(440px, 40vw); }
.mm-map { position: relative; aspect-ratio: var(--mm-ar); cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; }
.mm-map.is-dragging { cursor: grabbing; }
.mm-map.is-noimg { background: #2a3038; }
.mm-map img, .mm-map svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.mm-map img { filter: saturate(.75) brightness(.94) contrast(1.02); -webkit-user-drag: none; }
.mm-dot { fill: #c9a253; stroke: #16191d; stroke-width: 4; }
.mm-dot.is-dm { fill: #d97a70; }
.mm-dot.is-hover { fill: #fff3d0; r: 15; }
.mm-view { fill: rgba(201, 162, 83, .18); stroke: #9b3a35; stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.mm-ctr { display: none; fill: none; stroke: #9b3a35; stroke-width: 2px; }
.mm-ctr * { vector-effect: non-scaling-stroke; }
.mm.is-close .mm-ctr { display: inline; }
.mm-sel { fill: none; stroke: #2f8f7a; stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.mm-tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; }
.mm-btn { width: 24px; height: 24px; padding: 3px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; border: 1px solid var(--line-2); background: var(--glass); color: var(--text-2); cursor: pointer; }
.mm-btn:hover { color: var(--brass-2); border-color: var(--brass-line); }
.mm-btn svg { width: 16px; height: 16px; }
.mm.is-collapsed { width: auto; background: var(--glass); }
.mm.is-collapsed .mm-map, .mm.is-collapsed .mm-size { display: none; }
.mm.is-collapsed .mm-tools { position: static; padding: 4px; }

/* ---- player build: title card (tools/build_player_city.py adds the markup) */
.title-card { position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(ellipse at 50% 40%, rgba(22, 25, 29, .55), rgba(10, 12, 14, .82)); transition: opacity .45s var(--ease); }
.title-card.is-out { opacity: 0; pointer-events: none; }
.title-card__card { max-width: 440px; padding: 26px 26px 22px; text-align: center; background: rgba(24, 28, 33, .96); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 24px 60px -20px #000; }
.title-card__mark { width: 52px; height: 52px; color: var(--brass); }
.title-card h1 { margin: 10px 0 4px; font: 600 30px/1.05 var(--serif); letter-spacing: .26em; padding-left: .26em; text-transform: uppercase; color: var(--text); }
.title-card__sub { margin: 0 0 14px; font: italic 15px/1.4 var(--serif); color: var(--brass-2); }
.title-card p { margin: 8px 0; color: var(--text-2); }
.title-card__hint { font-size: 12px; color: var(--muted); }
.title-card .btn { margin-top: 12px; padding: 7px 18px; }

@media (max-width: 700px) {
  .sr-kbd { display: none; }
  .sr-input { padding-right: 12px; }
  .pn { padding: 11px 12px 10px; }
  .pn-title { font-size: 18px; }
  .gd-overlay { padding: 8px; align-items: stretch; }
  .gd-card { max-height: none; }
  .gd-head { flex-wrap: wrap; }
  .gd-tabs { order: 3; margin-left: 0; width: 100%; }
  .lg-key { width: 110px; }
  .title-card h1 { font-size: 24px; }
}

/* ================================================================ undercity
   Owned by the undercity builder (js/ui/levels.js, js/gen/undercity.js): the level slider, its badge,
   the x-ray toggle, the breadcrumb bar, and the level chips / entry-hall / stair labels on the map. */
.ucl {
  width: 214px; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ucl-head { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.ucl-head .eyebrow { flex: 1; }
.ucl-xray, .ucl-fold, .ucl-step {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text-2);
  cursor: pointer; transition: border-color .15s, background .15s, color .15s;
}
.ucl-xray { padding: 2px 7px 2px 5px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.ucl-xray svg { width: 15px; height: 15px; }
.ucl-fold { width: 24px; height: 22px; padding: 0; }
.ucl-fold svg, .ucl-step svg { width: 14px; height: 14px; }
.ucl-xray:hover, .ucl-fold:hover, .ucl-step:hover { border-color: var(--brass-line); color: var(--brass-2); background: var(--panel-3); }
.ucl-xray[aria-pressed="true"] { border-color: var(--verdigris); color: var(--verdigris-2); background: var(--verdigris-tint); }
.ucl.is-collapsed .ucl-fold svg { transform: rotate(-90deg); }
.ucl.is-collapsed .ucl-rows, .ucl.is-collapsed .ucl-places { display: none; }

.ucl-badge {
  --uc: var(--brass);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 9px; align-items: center;
  padding: 6px 8px; text-align: left; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--uc) 55%, transparent); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--uc) 14%, var(--panel)); color: var(--text);
}
.ucl-badge.is-surface { border-color: var(--line-2); background: var(--panel-2); }
.ucl-tag {
  grid-row: 1 / span 2; min-width: 30px; height: 30px; padding: 0 5px; display: grid; place-items: center;
  border-radius: 5px; background: var(--uc); color: #15120c; font: 700 13px/1 var(--ui); letter-spacing: .02em;
}
.ucl-badge.is-surface .ucl-tag { background: var(--panel-3); color: var(--text-2); }
.ucl-bname { font: 600 13px/1.15 var(--serif); }
.ucl-by { font-size: 10.5px; color: var(--muted); }

.ucl-steps { display: flex; align-items: center; gap: 4px; }
.ucl-step { width: 30px; height: 24px; padding: 0; }
.ucl-keys { margin-left: auto; font: 10px/1 var(--mono); color: var(--faint); letter-spacing: .1em; }

.ucl-rows { position: relative; display: flex; flex-direction: column; gap: 1px; padding-left: 10px; }
.ucl-rows::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; border-radius: 1px; background: var(--line-2); }
.ucl-row {
  --uc: var(--brass);
  position: relative; display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent;
  color: var(--text-2); cursor: pointer; text-align: left; font-size: 12px;
}
.ucl-row:hover { background: var(--panel-3); color: var(--text); }
.ucl-row[aria-checked="true"] { border-color: color-mix(in srgb, var(--uc) 60%, transparent); background: color-mix(in srgb, var(--uc) 16%, transparent); color: var(--text); }
.ucl-dot { position: relative; z-index: 1; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--uc); box-shadow: 0 0 0 2px var(--panel); }
.ucl-row[aria-checked="true"] .ucl-dot { width: 12px; height: 12px; margin-left: -2px; box-shadow: 0 0 0 2px var(--panel), 0 0 8px var(--uc); }
.ucl-row--surface .ucl-dot { background: var(--text-2); }
.ucl-row--bottom { margin-bottom: 3px; }
.ucl-row--bottom::after { content: ""; position: absolute; left: 14px; right: 4px; bottom: -3px; border-bottom: 1px dashed var(--line-3); }
.ucl-row--under { color: var(--muted); }
.ucl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ucl-y { font: 10.5px/1 var(--mono); color: var(--faint); }
.ucl-n { min-width: 16px; padding: 1px 4px; border-radius: 999px; font-size: 10px; text-align: center; color: var(--brass-2); background: var(--brass-tint); }
.ucl-n--0 { visibility: hidden; }

.ucl-places { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; border-top: 1px solid var(--line); max-height: 30vh; overflow: auto; }
.ucl-places .eyebrow { padding: 2px 2px 3px; }
.ucl-place { padding: 3px 6px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 12px; }
.ucl-place:hover { background: var(--panel-3); color: var(--brass-2); }
.ucl-place.is-dm { color: var(--oxblood-2); }
.ucl-empty { padding: 2px; font-size: 11px; color: var(--muted); }

.ucb {
  position: absolute; left: 50%; bottom: var(--gutter); transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 2px; max-width: min(760px, calc(100% - 520px)); padding: 3px 5px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
  font-size: 12px; white-space: nowrap; overflow: hidden;
}
.ucb-c { min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 3px 8px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); cursor: pointer; }
.ucb-c:hover { background: var(--panel-3); color: var(--brass-2); }
.ucb-c.is-text { cursor: default; color: var(--muted); font-style: italic; }
.ucb-c.is-text:hover { background: transparent; color: var(--muted); }
.ucb-sep { color: var(--faint); }
.ucb-level { --uc: var(--brass); display: inline-flex; align-items: center; gap: 6px; color: var(--text); background: color-mix(in srgb, var(--uc) 16%, transparent); font-weight: 600; }
.ucb-level i { width: 8px; height: 8px; border-radius: 50%; background: var(--uc); flex: none; }
.ucb-level.is-surface { background: transparent; font-weight: 500; color: var(--text-2); }
.ucb-sel { color: var(--verdigris-2); }
.ucb-sel small { color: var(--muted); font-size: 10px; }
.ucb-lv { display: inline-flex; align-items: center; gap: 3px; min-width: 0; }
.ucb-x { flex: none; width: 20px; height: 20px; margin-left: -2px; padding: 0; border: 0; border-radius: 50%; background: var(--panel-3); color: var(--text-2); cursor: pointer; font-size: 14px; line-height: 1; }
.ucb-x:hover { color: var(--oxblood-2); }

.lbl .uc-lv {
  display: inline-block; margin: 0 6px 0 -3px; padding: 0 4px; border-radius: 3px;
  font: 700 9.5px/14px var(--ui); letter-spacing: .03em; vertical-align: 1px;
  background: var(--uc, var(--brass)); color: #15120c;
}
.lbl--uc-hall { font: 600 9.5px/1.2 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: #ff8a7a; padding: 1px 0 6px; }
.lbl--uc-hall::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: #d23a2f; }
.lbl--uc-shaft { font: 600 9px/1.2 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--brass-2); padding: 1px 5px; border-radius: 3px; background: rgba(19, 22, 26, .78); text-shadow: none; }

@media (max-width: 700px) {
  .ucl { width: 178px; padding: 6px; }
  .ucl-keys { display: none; }
  .ucb { left: var(--gutter); transform: none; max-width: calc(100% - 2 * var(--gutter) - 176px); font-size: 11px; }
  .ucb .is-text, .ucb .is-text + .ucb-sep { display: none; }
}
@media (max-width: 1100px) and (min-width: 701px) { .ucb { max-width: calc(100% - 300px); } }

/* citadel-interiors ------------------------------------------------ floor selector, room labels (gen/interiors.js, gen/citadel.js) */
.slot--levels { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ci-floors {
  width: 214px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.ci-head { padding: 0 2px; }
.ci-title { display: flex; align-items: center; gap: 6px; font: 600 14px/1.25 var(--serif); color: var(--text); margin-top: 2px; }
.ci-ward { width: 9px; height: 9px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(0, 0, 0, .4); }
.ci-dim { color: var(--muted); font-size: 11px; line-height: 1.3; }
.ci-step { display: flex; align-items: center; gap: 6px; }
.ci-step .btn-icon { width: 30px; height: 28px; }
.ci-cur { flex: 1; text-align: center; font: 600 12.5px/1 var(--ui); color: var(--brass-2); letter-spacing: .02em; }
.ci-list { display: flex; flex-direction: column; gap: 1px; max-height: min(38vh, 300px); overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.ci-f {
  display: flex; align-items: center; gap: 6px; min-height: 22px; padding: 2px 6px; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-2); cursor: pointer; text-align: left; font-size: 11.5px;
}
.ci-f:hover { background: var(--panel-3); color: var(--text); }
.ci-f.is-on { border-color: var(--brass-line); background: var(--brass-tint); color: var(--brass-2); }
.ci-f.is-sky .ci-f__n { color: var(--steel-2); }
.ci-f.is-below { color: var(--muted); }
.ci-f__n { width: 22px; flex: none; font: 600 11px/1 var(--mono); text-align: right; }
.ci-f__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brass); flex: none; }
.ci-f__named { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ci-toggle { display: flex; gap: 4px; }
.ci-toggle .btn { flex: 1; padding: 4px 6px; font-size: 11.5px; }
.ci-room { border-top: 1px solid var(--line); padding-top: 6px; }
.ci-room__name { font: 600 12.5px/1.3 var(--ui); color: var(--text); }
.ci-room__furn { margin-top: 2px; }
.ci-room__dm { margin-top: 4px; padding-left: 6px; border-left: 2px solid var(--oxblood); color: var(--oxblood-2); font-size: 11px; line-height: 1.35; }
.lbl--room-named { background: rgba(43, 35, 18, 0.86); color: var(--brass-2); box-shadow: 0 0 0 1px var(--brass-line); font-weight: 600; }
.lbl--room-named.lbl--dm { color: var(--oxblood-2); box-shadow: 0 0 0 1px rgba(217, 122, 112, .5); }
.lbl--ward { font: 600 10px/1.2 var(--ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); text-shadow: 0 1px 3px #000; }
@media (max-width: 700px) {
  .ci-floors { width: 168px; }
  .ci-list { max-height: 24vh; }
  .ci-f__named { display: none; }
}

/* ================================================================ qa (integration fixes, 2026-10-06)
   Desktop: the left column (Undercity levels + Citadel floors) hangs under the top bar and scrolls instead of
   running under the top bar or the minimap when both panels show; the breadcrumb clears the minimap and the
   scale bar at mid widths. */
@media (min-width: 701px) {
  .slot--levels {
    top: 64px; transform: none;
    max-height: calc(100% - 64px - 141px - 2 * var(--gutter) - 10px);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  }
}
@media (max-width: 1100px) and (min-width: 701px) {
  .ucb { left: calc(var(--gutter) + 258px); transform: none; max-width: calc(100% - 258px - 2 * var(--gutter) - 200px); }
}
@media (min-width: 1101px) {
  .ucb { max-width: min(760px, calc(100% - 2 * (258px + var(--gutter) + 10px))); }
}
.ucl-xray { white-space: nowrap; }

/* ================================================================ CUTAWAY (modes/cutaway.js, render/interior/ui.js; owner: cutaway)
   The info card in the left column (it reuses the .ci-* floor picker above), the "Cutaway · C" chip over a selected
   building, and the room labels of the storeys below the chosen one in the exploded view. */
.cw-card { width: 238px; }
.cw-head { display: flex; align-items: center; justify-content: space-between; min-height: 20px; }
.cw-x.btn-icon { width: 24px; height: 24px; border-color: transparent; background: transparent; }
.cw-x.btn-icon svg { width: 14px; height: 14px; }
.cw-sub { margin-top: -3px; }
.cw-strip { display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; line-height: 1.3; min-width: 0; }
.cw-strip__k { flex: none; width: 38px; font: 600 9.5px/1.3 var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cw-strip__v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.cw-card .ci-step .cw-explode { margin-left: 2px; }
.cw-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.cw-pad { display: grid; grid-template-columns: repeat(3, 30px); grid-template-rows: repeat(3, 24px); gap: 2px; }
.cw-pad .btn-icon { width: 30px; height: 24px; }
.cw-pad .btn-icon svg { width: 15px; height: 15px; }
.cw-u { grid-column: 2; grid-row: 1; }
.cw-l { grid-column: 1; grid-row: 2; }
.cw-r { grid-column: 3; grid-row: 2; }
.cw-d { grid-column: 2; grid-row: 3; }
.cw-nav > .btn-icon { width: 32px; height: 32px; }
.cw-keys { font-size: 10px; line-height: 1.4; }
.cw-flash { color: var(--brass-2); font-size: 11px; }
.cw-flash:empty { display: none; }
.cw-below { font-style: italic; }
.lbl--note.cw-chip {
  font: 600 10.5px/1.2 var(--ui); letter-spacing: .04em; color: var(--brass-ink); text-shadow: none;
  padding: 3px 8px; border-radius: 999px; background: var(--brass-2); box-shadow: 0 4px 12px -6px rgba(0, 0, 0, .9);
}
.lbl--note.cw-chip:hover { background: #f0d08a; }
.lbl--room.cw-lbl--low.is-on { opacity: .7; }
@media (max-width: 700px) {
  .cw-card { width: 172px; padding: 6px; gap: 4px; }
  .cw-keys, .cw-card .ci-list, .cw-card .cw-sub, .cw-card .cw-below { display: none; }
  .cw-card .ci-title { font-size: 13px; }
  .cw-nav > .btn-icon { width: 28px; height: 28px; }
  .cw-pad { grid-template-columns: repeat(3, 28px); grid-template-rows: repeat(3, 24px); }
  .cw-pad .btn-icon { width: 28px; }
}
