@font-face {
  font-family: "Pixelify Sans";
  src: url("/assets/fonts/pixelify-sans-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("/assets/fonts/barlow-condensed-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("/assets/fonts/barlow-condensed-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Barlow Condensed", "Arial Narrow", ui-sans-serif, system-ui, sans-serif;
  --ink: #dccfbf;
  --muted: #9e9993;
  --panel: #061425;
  --panel-soft: #142634;
  --deep: #050d19;
  --surface: #142634;
  --surface-teal: #053445;
  --line: #313946;
  --accent: #cb9a53;
  --teal-secondary: #1e565f;
  --teal: #339597;
  --danger: #b05437;
  --live: #7f814f;
  --window-ink: #041326;
  --window-raised: #071a2a;
  --window-card: #06101d;
  --window-line: #30495a;
  --window-highlight: #4b6470;
  --teal-bright: #68cdc7;
  --gold-bright: #dda35e;
  --coral-bright: #c86d5a;
  --live-bright: #afd14f;
  --radius-window: 18px;
  --radius-hud: 10px;
  --radius-card: 8px;
  --radius-control: 6px;
  --window-shadow: inset 0 0 0 2px var(--deep), inset 0 0 0 3px var(--window-highlight), 6px 6px 0 #02070d;
  --icon-font: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
  --pixel-font: "Pixelify Sans", "Lucida Console", monospace;
  --topbar-height: 72px;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--deep);
  color: var(--ink);
}

button, input, select { font: inherit; }

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible, input:focus-visible {
  outline: 2px solid #8bd4c8;
  outline-offset: 2px;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: auto auto minmax(260px, 680px) auto;
  align-items: center;
  gap: 16px;
  padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 4px 0 #020711;
}

.brand, .account-button, .icon-button, .world-tab {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  text-align: left;
}

.brand-mark, .auth-mark, .loading-mark {
  display: grid;
  place-items: center;
  border: 1px solid rgba(232, 207, 145, 0.45);
  background: var(--accent);
  color: var(--deep);
  font-family: "Arial Narrow", "Roboto Condensed", system-ui, sans-serif;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.35), 0 8px 24px rgba(0, 0, 0, 0.24);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.brand strong, .brand small { display: block; }
.brand strong { font-family: "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; font-size: 1.03rem; letter-spacing: 0.04em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 0.69rem; letter-spacing: 0.16em; text-transform: uppercase; }

.world-tabs {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 3px;
}

.world-tab {
  min-height: 38px;
  border-radius: 9px;
  padding: 0 12px;
  color: #91a4a1;
  font-size: 0.78rem;
  font-weight: 750;
  white-space: nowrap;
}

.world-tab.active {
  background: rgba(112, 168, 158, 0.16);
  color: #e6f4ef;
  box-shadow: inset 0 0 0 1px rgba(129, 202, 188, 0.16);
}
.compact-label { display: none; }

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #65d39d;
  box-shadow: 0 0 0 4px rgba(101, 211, 157, 0.1);
}

.search-shell {
  position: relative;
  min-width: 0;
  width: 100%;
}

.search-shell input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(6, 13, 15, 0.72);
  color: var(--ink);
  padding: 0 42px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.search-shell input::placeholder { color: #71827f; }
.search-shell input:focus {
  border-color: rgba(119, 195, 181, 0.62);
  background: rgba(8, 17, 19, 0.94);
  box-shadow: 0 0 0 3px rgba(99, 177, 163, 0.1);
}

.search-icon {
  position: absolute;
  z-index: 2;
  left: 14px;
  top: 8px;
  color: #8ca09c;
  font-size: 1.35rem;
  pointer-events: none;
}

.search-shell kbd {
  position: absolute;
  right: 11px;
  top: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 7px;
  color: #72827f;
  font: 700 0.64rem/1 system-ui, sans-serif;
}

.search-close {
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  width: 44px;
  height: 44px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #a8b8b4;
  font-size: 1.25rem;
  cursor: pointer;
}

.search-results {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  width: 100%;
  max-height: min(68vh, 560px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(14, 23, 25, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  padding: 7px;
}

.search-summary {
  padding: 8px 10px 10px;
  color: #7f918e;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-result {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.search-result > span:nth-child(2) { min-width: 0; }

.search-result:hover, .search-result.active { background: rgba(116, 179, 168, 0.11); }
.result-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--result-color, #7db9ae); }
.search-result strong, .search-result small { display: block; }
.search-result strong { font-size: 0.86rem; }
.search-result small { margin-top: 3px; color: #80918e; font-size: 0.72rem; }
.result-kind { color: #6f817e; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.topbar-actions { display: flex; align-items: center; justify-content: end; gap: 8px; }

.icon-button, .account-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.icon-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
}
.icon-button > span:first-child { color: #e1c27b; font-size: 1.1rem; }
.icon-button .button-label { font-size: 0.76rem; font-weight: 750; }
.icon-button small {
  min-width: 19px;
  border-radius: 20px;
  background: rgba(216, 182, 111, 0.14);
  padding: 3px 5px;
  color: #e1c27b;
  font-size: 0.65rem;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 6px;
  text-align: left;
}
.account-avatar, .resident-avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--avatar-color, #5d8c83);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.13);
}
.account-avatar { width: 32px; height: 32px; }
.account-button strong, .account-button small { display: block; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-button strong { font-size: 0.75rem; }
.account-button small { color: #83938f; font-size: 0.64rem; }

.city-stage {
  position: fixed;
  inset: var(--topbar-height) 0 0;
  overflow: hidden;
  background: #23383f;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
  image-rendering: pixelated;
}
#game-canvas.dragging { cursor: grabbing; }

.environment-card, .connection-pill, .sandbox-controls, .my-resident-card, .my-resident-shortcut, .resident-context, .control-hud, .map-controls {
  position: absolute;
  z-index: 20;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28);
}

.environment-card {
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 14px;
  padding: 9px 13px 9px 9px;
  pointer-events: none;
}
.weather-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(220, 186, 111, 0.11);
  color: #f0cd7d;
  font-size: 1.35rem;
}
.environment-primary { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; }
.environment-primary span { color: #60716e; }
.environment-secondary { margin-top: 4px; color: #98aaa6; font-size: 0.71rem; }

.connection-pill {
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.7rem;
}
.connection-pill span { width: 7px; height: 7px; border-radius: 50%; background: #e2b96c; }
.connection-pill[data-state="online"] span { background: #64d29c; }
.connection-pill[data-state="offline"] span { background: #dc776f; }
.connection-pill strong { font-size: inherit; }

.map-controls {
  left: 16px;
  bottom: 18px;
  display: grid;
  border-radius: 12px;
  overflow: hidden;
}
.map-controls button, .speed-row button {
  width: 42px;
  height: 42px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 1.15rem;
}
.map-controls button:last-child { border-bottom: 0; }
.map-controls button:hover, .speed-row button:hover { background: rgba(123, 188, 176, 0.12); }

.sandbox-controls {
  left: 72px;
  bottom: 18px;
  width: min(360px, calc(100vw - 100px));
  border-radius: 14px;
  padding: 11px 12px;
}
.sandbox-heading { display: flex; justify-content: space-between; color: #91a39f; font-size: 0.69rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.sandbox-heading strong { color: #e2c27b; }
.sandbox-heading-status { display: flex; align-items: center; gap: 6px; }
.sandbox-heading-status button { min-height: 25px; border: 1px solid rgba(118, 193, 179, 0.3); border-radius: 7px; background: rgba(84, 150, 138, 0.14); color: #d8ebe6; padding: 0 7px; font-size: 0.56rem; font-weight: 850; text-transform: none; letter-spacing: 0; }
.sandbox-controls.read-only .speed-row { opacity: 0.55; }
.speed-row { display: grid; grid-template-columns: 38px 36px 1fr 36px; align-items: center; gap: 6px; margin-top: 7px; }
.speed-row button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 9px; font-size: 1rem; }
.speed-row input { width: 100%; accent-color: #7bc3b5; }
.sandbox-controls small { display: block; margin-top: 4px; color: #71837f; font-size: 0.65rem; }

.my-resident-card {
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-width: min(500px, calc(100vw - 170px));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-radius: 16px;
  padding: 8px;
}
.app[data-resident-context="true"] .my-resident-card { display: none; }
.my-resident-shortcut { display: none; }

.resident-context {
  left: 50%;
  bottom: 18px;
  width: min(560px, calc(100vw - 190px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 42px;
  align-items: center;
  gap: 6px;
  border-radius: 15px;
  padding: 6px;
}
.resident-context-main {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  padding: 2px 5px;
  text-align: left;
  cursor: pointer;
}
.resident-context-copy { min-width: 0; }
.resident-context-copy small, .resident-context-copy strong, .resident-context-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resident-context-copy small { color: #d3b875; font-size: 0.54rem; font-weight: 900; letter-spacing: 0.11em; text-transform: uppercase; }
.resident-context-copy strong { margin-top: 1px; font-size: 0.78rem; }
.resident-context-copy span { margin-top: 1px; color: #82948f; font-size: 0.61rem; }
.resident-context-action, .resident-context-close {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: #dfe8e5;
  padding: 0 12px;
  font-size: 0.69rem;
  font-weight: 850;
}
.resident-context-action { min-width: 66px; border-color: var(--teal); background: var(--surface-teal); }
.resident-context-action:disabled { opacity: 0.55; }
.resident-context-close { width: 42px; padding: 0; color: #9baba7; font-size: 1.1rem; }
.resident-mini-profile { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 2px 4px; color: inherit; text-align: left; cursor: pointer; }
.resident-avatar { width: 38px; height: 38px; flex: none; }
.resident-mini-profile small, .resident-mini-profile strong { display: block; }
.resident-mini-profile small { color: #82948f; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.09em; }
.resident-mini-profile strong { margin-top: 2px; font-size: 0.81rem; }
.resident-card-actions { display: flex; gap: 6px; }
.resident-card-actions button, .control-hud button, .inspector-action, .auth-submit {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  padding: 0 12px;
  color: #dfe8e5;
  font-size: 0.71rem;
  font-weight: 800;
  cursor: pointer;
}
.resident-card-actions .primary, .inspector-action.primary, .auth-submit {
  border-color: rgba(118, 193, 179, 0.34);
  background: var(--surface-teal);
}

.control-hud {
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-width: min(610px, calc(100vw - 190px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-color: rgba(218, 185, 112, 0.32);
  border-radius: 16px;
  padding: 10px 11px 10px 14px;
}
.control-hud small, .control-hud strong, .control-hud span { display: block; }
.control-hud small { color: #d7b976; font-size: 0.58rem; font-weight: 900; letter-spacing: 0.13em; }
.control-hud strong { margin-top: 2px; font-size: 0.86rem; }
.control-hud span { margin-top: 2px; color: #82948f; font-size: 0.66rem; }
.control-hud button { border-color: rgba(221, 187, 111, 0.25); }

.touch-pad {
  position: absolute;
  z-index: 24;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 142px;
  height: 142px;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 44px);
  gap: 4px;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.touch-pad button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(14, 24, 27, 0.78);
  color: #d7e4e0;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.touch-pad button[data-direction="up"] { grid-column: 2; }
.touch-pad button[data-direction="left"] { grid-column: 1; grid-row: 2; }
.touch-pad button[data-direction="down"] { grid-column: 2; grid-row: 2; }
.touch-pad button[data-direction="right"] { grid-column: 3; grid-row: 2; }
.touch-pad button:active { background: rgba(100, 178, 164, 0.38); }

.inspector {
  position: absolute;
  z-index: 32;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(390px, calc(100vw - 28px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 22, 24, 0.96);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.5);
  scrollbar-color: #49645f transparent;
}
.inspector-hero { position: relative; overflow: hidden; padding: 22px 20px 18px; border-bottom: 1px solid var(--line); }
.inspector-hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--teal); pointer-events: none; }
.inspector-close { position: absolute; z-index: 2; top: 10px; right: 10px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.18); color: #9dadaa; font-size: 1.2rem; cursor: pointer; }
.inspector-collapse { position: absolute; z-index: 2; top: 10px; right: 54px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.18); color: #c7d5d1; font-size: 1.2rem; cursor: pointer; }
.inspector.collapsed { top: 14px; bottom: auto; overflow: hidden; }
.inspector-compact { position: relative; display: grid; grid-template-columns: 42px minmax(0, 1fr) 38px 54px; align-items: center; gap: 9px; min-height: 66px; overflow: hidden; padding: 9px; }
.inspector-compact::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--teal); pointer-events: none; }
.inspector-compact > * { position: relative; }
.inspector-compact .resident-avatar { width: 42px; height: 42px; }
.inspector-compact-copy { min-width: 0; }
.inspector-compact-copy small, .inspector-compact-copy strong, .inspector-compact-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inspector-compact-copy small { color: #d3b875; font-size: 0.56rem; font-weight: 900; letter-spacing: 0.11em; }
.inspector-compact-copy strong { margin-top: 2px; font-size: 0.8rem; }
.inspector-compact-copy span { margin-top: 2px; color: #839590; font-size: 0.64rem; }
.inspector-compact button { min-height: 38px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.04); color: #dfe8e5; padding: 0 7px; font-size: 0.67rem; font-weight: 800; }
.inspector-compact button:disabled { color: #71817e; cursor: not-allowed; }
.inspector-avatar { position: relative; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--avatar-color, #618d84); font-weight: 900; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.12), 0 12px 30px rgba(0, 0, 0, 0.25); }
.inspector-kicker { position: relative; margin: 13px 0 4px; color: #d3b875; font-size: 0.63rem; font-weight: 900; letter-spacing: 0.13em; text-transform: uppercase; }
.inspector h2 { position: relative; margin: 0; font: 800 1.55rem/1.15 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.inspector-subtitle { position: relative; margin: 7px 0 0; color: #8da09b; font-size: 0.76rem; line-height: 1.5; }
.now-card { position: relative; margin-top: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(4, 11, 13, 0.35); padding: 11px 12px; }
.now-card small, .now-card strong { display: block; }
.now-card small { color: #788a86; font-size: 0.61rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.now-card strong { margin-top: 4px; font-size: 0.79rem; }
.inspector-actions { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.inspector-action { width: 100%; }
.inspector-action.saved { color: #e2c27b; }
.viewer-presence { border-bottom: 1px solid var(--line); padding: 10px 14px; background: rgba(70, 142, 119, 0.05); }
.viewer-presence-summary { width: 100%; min-height: 38px; display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; border: 0; border-radius: 9px; background: transparent; color: #b8d6ce; padding: 4px 6px; text-align: left; }
.viewer-presence-summary strong { font-size: 0.7rem; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #64d29c; box-shadow: 0 0 0 4px rgba(100, 210, 156, 0.1); }
.viewer-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px 6px 2px 23px; }
.viewer-list button { min-height: 30px; border: 1px solid rgba(121, 190, 172, 0.15); border-radius: 999px; background: rgba(91, 158, 143, 0.08); color: #c7ded8; padding: 0 10px; font-size: 0.65rem; }
.viewer-list button small { margin-left: 4px; color: #7fb8aa; font-size: 0.56rem; text-transform: uppercase; }
.viewer-list-more { align-self: center; color: #718a84; font-size: 0.6rem; }
.inspector-section { padding: 17px 20px; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.section-heading h3 { margin: 0; font-size: 0.77rem; text-transform: uppercase; letter-spacing: 0.09em; }
.section-heading span { color: #72837f; font-size: 0.65rem; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.profile-cell { min-width: 0; border: 1px solid rgba(195, 221, 213, 0.1); border-radius: 10px; background: rgba(255, 255, 255, 0.025); padding: 9px; }
.profile-cell span, .profile-cell strong { display: block; overflow: hidden; text-overflow: ellipsis; }
.profile-cell span { color: #748682; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; }
.profile-cell strong { margin-top: 4px; font-size: 0.72rem; white-space: nowrap; }
.bio-copy { margin: 0; color: #a5b4b0; font-size: 0.78rem; line-height: 1.65; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.life-loading { min-height: 92px; }
.life-motivation { display: grid; gap: 7px; margin: 0 0 15px; color: var(--muted); font-size: 0.72rem; }
.life-motivation > span { color: var(--ink); font-weight: 700; }
.life-motivation select { width: 100%; min-height: 44px; padding: 0 12px; color: var(--ink); background: rgba(7, 17, 20, 0.72); border: 1px solid var(--line); border-radius: 10px; }
.relationship-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.relationship-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 9px; align-items: center; min-width: 0; padding: 9px; text-align: left; background: rgba(9, 20, 22, 0.56); border: 1px solid var(--line); border-radius: 11px; }
.relationship-card:hover { border-color: rgba(106, 185, 174, 0.55); }
.relationship-card > span:last-child { min-width: 0; }
.relationship-card strong, .relationship-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relationship-card strong { font-size: 0.76rem; }
.relationship-card small { margin-top: 3px; color: var(--muted); font-size: 0.62rem; }
.relationship-avatar { display: grid; place-items: center; width: 36px; height: 36px; color: #f7f3e8; background: #7b6051; border-radius: 50%; font-size: 0.7rem; font-weight: 800; }
.family-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.family-links button { padding: 7px 9px; color: #bdd8d2; background: rgba(67, 111, 102, 0.18); border: 1px solid rgba(106, 185, 174, 0.28); border-radius: 999px; font-size: 0.66rem; }
.thought-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.thought-list li { padding: 10px 12px; background: rgba(9, 20, 22, 0.48); border-left: 2px solid rgba(216, 182, 111, 0.58); border-radius: 0 9px 9px 0; }
.thought-list span { color: var(--accent); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.thought-list p { margin: 4px 0 0; color: #c5d1ce; font-size: 0.73rem; line-height: 1.5; }
.life-empty { margin: 0; color: var(--muted); font-size: 0.72rem; }
.tag { border: 1px solid rgba(127, 191, 179, 0.15); border-radius: 999px; background: rgba(94, 154, 143, 0.08); padding: 5px 8px; color: #a9c4be; font-size: 0.65rem; }
.preference-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preference-columns h4 { margin: 0 0 7px; color: #7f918d; font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; }
.preference-columns ul { margin: 0; padding-left: 16px; color: #a8b7b3; font-size: 0.71rem; line-height: 1.6; }
.schedule-tabs { display: flex; gap: 6px; margin-bottom: 11px; }
.schedule-tabs button { flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: #839590; font-size: 0.68rem; font-weight: 800; }
.schedule-tabs button.active { background: rgba(101, 178, 164, 0.13); color: #dceae6; }
.schedule-list { position: relative; display: grid; gap: 8px; }
.schedule-row { display: grid; grid-template-columns: 54px 8px 1fr; align-items: start; gap: 8px; color: #8ea09b; font-size: 0.69rem; }
.schedule-time { font-variant-numeric: tabular-nums; color: #71837f; }
.schedule-node { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #526964; }
.schedule-row.current { color: #e6efec; }
.schedule-row.current .schedule-node { background: #d9b86e; box-shadow: 0 0 0 4px rgba(217, 184, 110, 0.1); }
.building-symbol { font-size: 1.45rem; }
.occupant-list { display: grid; gap: 5px; }
.occupant-row { width: 100%; display: grid; grid-template-columns: 8px 1fr; gap: 9px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.025); padding: 8px; color: inherit; text-align: left; cursor: pointer; }
.occupant-row.portrait-row { grid-template-columns: 40px 1fr; align-items: center; }
.occupant-avatar { width: 40px; height: 40px; border-radius: 2px; }
.occupant-row:hover { background: rgba(104, 173, 160, 0.09); }
.occupant-row i { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--resident-color, #77aa9f); }
.occupant-row strong, .occupant-row small { display: block; }
.occupant-row strong { font-size: 0.7rem; }
.occupant-row small { margin-top: 2px; color: #71837f; font-size: 0.62rem; }

.saved-drawer {
  position: absolute;
  z-index: 45;
  top: 14px;
  right: 14px;
  width: min(360px, calc(100vw - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 22, 24, 0.97);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.5);
  padding: 18px;
}
.drawer-heading { display: flex; justify-content: space-between; align-items: start; }
.drawer-heading small { color: #d1b575; font-size: 0.6rem; font-weight: 900; letter-spacing: 0.12em; }
.drawer-heading h2 { margin: 3px 0 0; font: 800 1.45rem "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.drawer-heading button { width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.04); color: #9aaba7; font-size: 1.2rem; }
.drawer-intro { color: #7f918d; font-size: 0.72rem; line-height: 1.5; }
.saved-list { display: grid; gap: 7px; }
.saved-row { display: grid; grid-template-columns: 1fr 34px; gap: 5px; }
.saved-main { display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 9px; min-height: 50px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255, 255, 255, 0.025); color: inherit; padding: 6px; text-align: left; }
.saved-main strong, .saved-main small { display: block; }
.saved-main strong { font-size: 0.72rem; }
.saved-main small { margin-top: 2px; color: #758783; font-size: 0.62rem; }
.saved-remove { border: 0; border-radius: 9px; background: transparent; color: #71827f; }
.saved-empty { border: 1px dashed var(--line); border-radius: 12px; padding: 30px 15px; color: #788985; text-align: center; font-size: 0.73rem; line-height: 1.6; }

.admin-panel {
  position: absolute;
  z-index: 48;
  inset: 12px 12px 12px auto;
  width: min(720px, calc(100vw - 24px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13, 22, 24, 0.98);
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.58);
  padding: 18px;
}
.admin-content { display: grid; gap: 12px; margin-top: 14px; }
.admin-loading, .admin-empty { color: #7f918d; font-size: 0.72rem; }
.admin-section { border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.018); padding: 12px; }
.admin-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.admin-section-heading h3 { margin: 0; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.admin-section-heading span { color: #778985; font-size: 0.64rem; }
.admin-registration { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-registration strong, .admin-registration small { display: block; }
.admin-registration strong { font-size: 0.76rem; }
.admin-registration small { margin-top: 2px; color: #71837f; font-size: 0.62rem; }
.admin-registration button, .admin-account-actions button, .admin-error button { min-height: 34px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 255, 255, 0.04); color: #d8e4e1; padding: 0 9px; font-size: 0.64rem; font-weight: 800; }
.admin-health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.admin-health-grid > div { border: 1px solid rgba(195, 221, 213, 0.09); border-radius: 9px; padding: 8px; }
.admin-health-grid small, .admin-health-grid strong { display: block; }
.admin-health-grid small { color: #72837f; font-size: 0.56rem; text-transform: uppercase; }
.admin-health-grid strong { margin-top: 3px; font-size: 0.68rem; overflow-wrap: anywhere; }
.admin-security-note { margin: 0 0 9px; color: var(--muted); font-size: 0.65rem; line-height: 1.5; }
.admin-security-list { display: grid; gap: 8px; }
.admin-security-event { display: grid; gap: 9px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface); padding: 10px; }
.admin-security-event-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.admin-security-event-heading span, .admin-security-event-heading strong, .admin-security-event-heading small { display: block; }
.admin-security-event-heading strong { font-size: 0.7rem; }
.admin-security-event-heading small { margin-top: 2px; color: var(--muted); font-size: 0.57rem; }
.admin-security-event-heading b { border: 1px solid var(--line); border-radius: 2px; background: var(--deep); padding: 3px 5px; color: var(--muted); font-size: 0.55rem; letter-spacing: 0.06em; text-transform: uppercase; }
.admin-security-event-heading b[data-outcome="success"],
.admin-security-event-heading b[data-outcome="allowed"] { border-color: var(--live); color: #a4a66f; }
.admin-security-event-heading b[data-outcome="failed"],
.admin-security-event-heading b[data-outcome="blocked"] { border-color: var(--danger); color: #d88369; }
.admin-security-event dl { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0; }
.admin-security-event dl div:last-child { grid-column: 1 / -1; }
.admin-security-event dt { color: var(--muted); font-size: 0.54rem; letter-spacing: 0.05em; text-transform: uppercase; }
.admin-security-event dd { margin: 2px 0 0; color: var(--ink); font-size: 0.62rem; overflow-wrap: anywhere; }
.admin-security-event .security-address-raw { color: var(--accent); font-weight: 850; }
.admin-security-reason { display: grid; gap: 4px; color: var(--muted); font-size: 0.58rem; font-weight: 800; }
.admin-security-reason input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 2px; background: var(--deep); color: var(--ink); padding: 0 9px; font: inherit; font-size: 0.67rem; }
.admin-security-event > button { min-height: 42px; border: 1px solid var(--danger); border-radius: 2px; background: #291821; color: #d88369; padding: 0 10px; font-size: 0.63rem; font-weight: 850; }
.security-reveal-notice { margin: 0; border-left: 2px solid var(--accent); padding-left: 8px; color: var(--muted); font-size: 0.61rem; line-height: 1.45; }
.admin-account-list { display: grid; gap: 8px; }
.admin-account-row { border: 1px solid rgba(195, 221, 213, 0.1); border-radius: 11px; background: rgba(5, 12, 14, 0.28); padding: 10px; }
.admin-account-identity { display: flex; align-items: center; gap: 8px; }
.admin-account-identity strong, .admin-account-identity small { display: block; }
.admin-account-identity strong { font-size: 0.73rem; }
.admin-account-identity small { margin-top: 2px; color: #788a86; font-size: 0.61rem; }
.player-online-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #6c7b78; }
.player-online-dot.online { background: #64d29c; box-shadow: 0 0 0 3px rgba(100, 210, 156, 0.09); }
.admin-account-row dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 9px 0; }
.admin-account-row dl div { min-width: 0; }
.admin-account-row dt { color: #6f817d; font-size: 0.54rem; text-transform: uppercase; }
.admin-account-row dd { margin: 2px 0 0; overflow: hidden; color: #a9b8b4; font-size: 0.61rem; text-overflow: ellipsis; white-space: nowrap; }
.admin-account-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-report-list { display: grid; gap: 7px; }
.admin-report-list article { border-top: 1px solid rgba(195, 221, 213, 0.08); padding-top: 7px; }
.admin-report-list article:first-child { border-top: 0; padding-top: 0; }
.admin-report-list strong { font-size: 0.67rem; }
.admin-report-list small { margin-left: 6px; color: #71837f; font-size: 0.58rem; }
.admin-report-list p { margin: 4px 0 0; color: #9caca8; font-size: 0.66rem; line-height: 1.45; }
.admin-activity-list, .admin-operations-events > div { display: grid; gap: 7px; }
.admin-activity-list article, .admin-operations-events article { display: grid; gap: 3px; border-top: 1px solid rgba(195, 221, 213, 0.08); padding-top: 7px; }
.admin-activity-list article:first-child, .admin-operations-events article:first-child { border-top: 0; padding-top: 0; }
.admin-activity-list article > span, .admin-operations-events article > span { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.admin-activity-list strong, .admin-operations-events strong { font-size: 0.67rem; }
.admin-activity-list small, .admin-operations-events small { color: #71837f; font-size: 0.57rem; }
.admin-activity-list p, .admin-operations-events p { margin: 0; color: #91a29e; font-size: 0.62rem; }
.admin-operations-events { border: 1px solid var(--line); border-radius: 13px; background: rgba(255, 255, 255, 0.018); padding: 11px 12px; }
.admin-operations-events summary { display: flex; justify-content: space-between; cursor: pointer; color: #aebebb; font-size: 0.7rem; font-weight: 800; list-style-position: inside; }
.admin-operations-events summary span { color: #71837f; font-size: 0.61rem; }
.admin-operations-events[open] summary { margin-bottom: 10px; }
.admin-error { border: 1px solid rgba(225, 120, 111, 0.2); border-radius: 11px; padding: 12px; }
.admin-error p { color: #a79a96; font-size: 0.68rem; }

.online-presence-button { position: relative; display: inline-flex; align-items: center; gap: 2px; border: 0; background: transparent; color: inherit; padding: 0; font: inherit; cursor: pointer; pointer-events: auto; }
.online-presence-button .live-dot { width: 5px; height: 5px; }
.city-minimap { position: absolute; z-index: 16; left: 14px; bottom: 14px; width: 150px; height: 96px; border: 1px solid rgba(207, 230, 224, .2); border-radius: 10px; opacity: .16; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); transition: opacity 500ms ease; pointer-events: none; }
.city-minimap.active { opacity: .82; }
.online-roster, .community-panel { position: absolute; z-index: 49; inset: 12px 12px 12px auto; width: min(430px, calc(100vw - 24px)); overflow: auto; border: 2px solid var(--line); border-radius: 3px; background: var(--panel); box-shadow: 5px 5px 0 #020711; padding: 16px; }
.online-roster-list { display: grid; gap: 6px; }
.online-roster-list > button { display: flex; align-items: center; gap: 8px; min-height: 48px; border: 1px solid rgba(195, 221, 213, .1); border-radius: 10px; background: rgba(255, 255, 255, .025); color: var(--ink); padding: 7px 9px; text-align: left; }
.online-roster-list strong, .online-roster-list small { display: block; }
.online-roster-list strong { font-size: .72rem; }
.online-roster-list small { margin-top: 2px; color: #798b87; font-size: .59rem; text-transform: capitalize; }
.community-panel { display: grid; grid-template-rows: auto auto auto minmax(120px, 1fr) auto auto; overflow: hidden; }
.community-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0; scrollbar-width: thin; }
.community-tabs button { flex: none; min-height: 34px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .025); color: #82948f; padding: 0 10px; font-size: .61rem; font-weight: 800; }
.community-tabs button.active { border-color: rgba(110, 196, 178, .32); background: rgba(88, 166, 151, .14); color: #e0ece8; }
.community-conversations { display: flex; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
.community-conversations button { display: flex; align-items: center; gap: 6px; flex: none; min-height: 30px; border: 0; border-radius: 8px; background: rgba(255,255,255,.035); color: #aabbb6; padding: 0 8px; font-size: .61rem; }
.community-conversations button.active { background: rgba(102, 183, 167, .17); }
.community-conversations button span { min-width: 17px; border-radius: 9px; background: #b07849; color: white; padding: 2px 4px; }
.community-message-list { min-height: 160px; overflow-y: auto; padding: 7px 2px; }
.community-message { position: relative; margin: 0 0 7px; border: 1px solid rgba(195, 221, 213, .08); border-radius: 10px; background: rgba(4, 11, 13, .28); padding: 8px 9px; }
.community-message.system { border-color: rgba(222, 192, 117, .16); background: rgba(148, 115, 53, .07); }
.community-message > div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.community-message > div button { border: 0; background: transparent; color: #8ec8bd; padding: 0; font-size: .66rem; font-weight: 850; }
.community-message > div button:disabled { color: #d2b974; }
.community-message time { color: #667975; font-size: .54rem; }
.community-message p { margin: 5px 0 0; color: #c1cfcb; font-size: .69rem; line-height: 1.45; overflow-wrap: anywhere; }
.moderation-card { display: grid; gap: 8px; margin-bottom: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 16, 18, .55); }
.moderation-card > small { color: #9db8b1; font-weight: 800; letter-spacing: .08em; }
.moderation-card p, .moderation-card blockquote { margin: 0; line-height: 1.45; }
.moderation-card blockquote { padding-left: 9px; border-left: 2px solid #b77b6d; color: #d1b8ae; }
.moderation-card > div { display: flex; flex-wrap: wrap; gap: 6px; }
.moderation-card button, .moderation-card select { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.06); color: var(--ink); }
.moderation-card code { overflow-wrap: anywhere; white-space: normal; color: #8ea7a3; }
.community-report { display: block; margin: 5px 0 0 auto; border: 0; background: transparent; color: #7e8e8a; padding: 0; font-size: .54rem; }
.community-empty, .community-workflow-intro { color: #7d908b; font-size: .67rem; line-height: 1.5; }
.community-workflow-intro { border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.community-workflow-intro p { margin: 5px 0 0; }
.community-older { justify-self: center; min-height: 30px; border: 0; background: transparent; color: #82b6ac; font-size: .61rem; font-weight: 800; }
.community-composer { display: grid; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.community-composer label { display: grid; gap: 4px; color: #91a39e; font-size: .61rem; font-weight: 800; }
.community-composer input, .community-composer textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: rgba(3, 9, 11, .6); color: var(--ink); padding: 8px 9px; font: inherit; font-size: .7rem; resize: none; }
.community-composer > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.community-composer small { color: #687a76; font-size: .53rem; }
.community-composer button { min-height: 34px; border: 1px solid var(--teal); border-radius: 2px; background: var(--surface-teal); color: var(--ink); padding: 0 14px; font-size: .63rem; font-weight: 850; }
.favorite-search input { width: 100%; min-height: 38px; margin: 8px 0; border: 1px solid var(--line); border-radius: 9px; background: rgba(4, 11, 13, .48); color: var(--ink); padding: 0 10px; }
.favorite-pagination { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-top: 9px; }
.favorite-pagination button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.035); color: #c3d1cd; }
.favorite-pagination span { color: #788a86; font-size: .6rem; }
.orientation-hint { position: absolute; z-index: 55; left: max(8px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 8px; max-width: 360px; border: 1px solid rgba(221, 191, 118, .28); border-radius: 10px; background: rgba(17, 27, 30, .96); padding: 8px 10px; color: #cbd7d3; font-size: .63rem; pointer-events: none; }
.orientation-hint button { flex: none; min-height: 30px; border: 0; border-radius: 7px; background: rgba(214, 181, 103, .15); color: #e9cf8f; font-size: .6rem; font-weight: 850; pointer-events: auto; }
.provider-auth { min-height: 44px; border: 1px solid rgba(141, 192, 182, .28); border-radius: 10px; background: rgba(92, 152, 141, .1); color: #dbe9e5; font-size: .72rem; font-weight: 850; }
.feedback-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.feedback-kind button { min-height: 34px; border: 0; border-radius: 7px; background: transparent; color: #788b86; font-size: .65rem; font-weight: 800; }
.feedback-kind button.active { background: rgba(102, 183, 167, .14); color: #dceae6; }
.resident-reveal-dialog { width: min(520px, calc(100vw - 28px)); border: 1px solid rgba(222, 193, 121, .32); border-radius: 22px; background: #111d20; color: var(--ink); box-shadow: 0 35px 120px rgba(0, 0, 0, .68); padding: 25px; text-align: center; }
.resident-reveal-dialog::backdrop { background: #050d19e8; }
.resident-reveal-art { width: 88px; height: 88px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 2px; background: var(--surface-teal); box-shadow: 5px 5px 0 #020711; }
.resident-reveal-art span { font: 900 1.55rem/1 system-ui; }
.resident-reveal-dialog > small { color: #d7b967; font-size: .62rem; font-weight: 900; letter-spacing: .16em; }
.resident-reveal-dialog h2 { margin: 6px 0 7px; font: 800 1.65rem/1.15 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.resident-reveal-dialog > p { margin: 0 auto 15px; max-width: 430px; color: #91a39e; font-size: .72rem; line-height: 1.55; }
.resident-reveal-details { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 16px; text-align: left; }
.resident-reveal-details div { border: 1px solid var(--line); border-radius: 9px; padding: 8px; }
.resident-reveal-details small, .resident-reveal-details strong { display: block; }
.resident-reveal-details small { color: #71837f; font-size: .54rem; text-transform: uppercase; }
.resident-reveal-details strong { margin-top: 2px; font-size: .68rem; }
.resident-reveal-dialog > button { min-height: 44px; width: 100%; border: 1px solid var(--teal); border-radius: 2px; background: var(--surface-teal); color: var(--ink); font-weight: 850; }

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(460px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 21, 23, 0.96);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.42);
  padding: 10px 16px;
  color: #dce7e4;
  font-size: 0.75rem;
}

.loading-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  overflow: hidden;
  background: #130f2d;
  transition: opacity 450ms ease, visibility 450ms ease;
}
.loading-overlay::before {
  content: "";
  position: absolute;
  inset: -28px;
  background: var(--deep);
  transform: scale(1.04);
}
.splash-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.splash-vignette { position: absolute; inset: 0; background: #050d194d; }
.splash-panel {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: clamp(18px, 4.5vh, 52px);
  width: min(720px, calc(100vw - 32px));
  transform: translateX(-50%);
  border: 1px solid rgba(255, 222, 157, 0.4);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(3, 5, 20, 0.58), inset 0 1px rgba(255, 255, 255, 0.12);
  padding: 18px;
  text-align: center;
}
.splash-eyebrow { margin: 0; color: #ffcf74; font-size: 0.68rem; font-weight: 900; letter-spacing: 0.2em; }
.splash-copy { margin: 7px auto 15px; max-width: 590px; color: #d4d8e1; font-size: 0.79rem; line-height: 1.45; text-shadow: 0 1px 2px #050712; }
.splash-actions { display: flex; justify-content: center; gap: 9px; }
.splash-actions button {
  min-width: 150px;
  min-height: 46px;
  border: 1px solid rgba(255, 227, 177, 0.28);
  border-radius: 11px;
  background: rgba(13, 22, 36, 0.82);
  color: #f7eee1;
  padding: 0 20px;
  font-size: 0.76rem;
  font-weight: 850;
  cursor: pointer;
}
.splash-actions .splash-primary {
  background: var(--accent);
  border-color: #ffd795;
  color: #25152a;
  box-shadow: 0 8px 28px rgba(235, 133, 55, 0.3), inset 0 1px rgba(255, 255, 255, 0.48);
}
.splash-actions button:disabled { cursor: wait; opacity: 0.5; }
.splash-loading { display: grid; justify-items: center; gap: 7px; margin-top: 12px; color: #adb5c4; font-size: 0.66rem; }
.loading-track { width: min(270px, 65vw); height: 4px; overflow: hidden; border-radius: 5px; background: rgba(255, 255, 255, 0.12); }
.loading-track span { display: block; width: 15%; height: 100%; border-radius: inherit; background: var(--teal); transition: width 300ms ease; }
.app.is-ready .splash-loading { min-height: 15px; }
.app.is-ready .loading-track { display: none; }
.app.splash-dismissed .loading-overlay { opacity: 0; visibility: hidden; pointer-events: none; }

.auth-dialog, .feedback-dialog, .audio-dialog, .recovery-dialog, .recovery-key-dialog, .player-profile-dialog, .admin-confirm-dialog {
  width: min(460px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #111d20;
  color: var(--ink);
  box-shadow: 0 35px 120px rgba(0, 0, 0, 0.65);
  padding: 26px;
}
.auth-dialog::backdrop, .feedback-dialog::backdrop, .audio-dialog::backdrop, .recovery-dialog::backdrop, .recovery-key-dialog::backdrop, .player-profile-dialog::backdrop, .admin-confirm-dialog::backdrop { background: #050d19e8; }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.04); color: #8fa09c; font-size: 1.2rem; }
.auth-intro { text-align: center; }
.auth-mark { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px; }
.auth-intro > small { color: #d2b674; font-size: 0.61rem; font-weight: 900; letter-spacing: 0.16em; }
.auth-intro h2 { margin: 7px 0 8px; font: 800 1.55rem/1.15 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.auth-intro p { margin: 0; color: #8fa19d; font-size: 0.76rem; line-height: 1.6; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 19px; border: 1px solid var(--line); border-radius: 11px; padding: 4px; }
.auth-tabs button { min-height: 38px; border: 0; border-radius: 8px; background: transparent; color: #7e908c; font-size: 0.73rem; font-weight: 800; }
.auth-tabs button.active { background: rgba(105, 176, 163, 0.13); color: #e5efec; }
#auth-form { display: grid; gap: 12px; margin-top: 17px; }
#auth-form label { color: #9badA8; font-size: 0.68rem; font-weight: 800; }
#auth-form input { width: 100%; height: 44px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 11, 13, 0.55); color: var(--ink); padding: 0 12px; }
.auth-submit { min-height: 44px; margin-top: 2px; }
.auth-help { min-height: 34px; border: 0; background: transparent; color: #90bdb5; font-size: 0.69rem; font-weight: 750; cursor: pointer; }
.auth-error { margin: 0; border: 1px solid rgba(225, 120, 111, 0.22); border-radius: 9px; background: rgba(177, 76, 69, 0.09); padding: 8px 10px; color: #e9a29a; font-size: 0.69rem; line-height: 1.4; }
.auth-fine-print { margin: 13px 0 0; color: #6e807c; font-size: 0.65rem; line-height: 1.5; text-align: center; }

.recovery-dialog { width: min(520px, calc(100vw - 28px)); }
.recovery-key-dialog { width: min(560px, calc(100vw - 28px)); text-align: center; }
.recovery-heading > small { color: #d2b674; font-size: 0.61rem; font-weight: 900; letter-spacing: 0.16em; }
.recovery-heading h2 { margin: 7px 0 8px; font: 800 1.5rem/1.18 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.recovery-heading p { margin: 0 32px 17px 0; color: #8fa19d; font-size: 0.75rem; line-height: 1.55; }
.recovery-dialog > label, .recovery-section label { display: block; color: #9bada8; font-size: 0.68rem; font-weight: 800; }
.recovery-dialog input:not([type="checkbox"]) { width: 100%; height: 44px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 11, 13, 0.55); color: var(--ink); padding: 0 12px; }
.recovery-section { display: grid; gap: 9px; margin-top: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 11, 13, 0.28); padding: 11px; }
.recovery-section h3 { margin: 0; font-size: 0.74rem; }
.recovery-section button, .recovery-key-actions button, .recovery-continue { min-height: 40px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); color: #dfe8e5; padding: 0 12px; font-size: 0.7rem; font-weight: 850; }
.recovery-section button.primary, .recovery-key-actions button.primary, .recovery-continue { border-color: var(--teal); background: var(--surface-teal); }
.recovery-section button:disabled, .recovery-key-actions button:disabled { opacity: 0.42; cursor: not-allowed; }
.recovery-result { margin: 0; border-radius: 9px; background: rgba(98, 181, 163, 0.1); padding: 9px; color: #c9e9e2; font-size: 0.73rem; }
.recovery-key-dialog .recovery-heading p { margin-right: 0; }
.recovery-key-dialog code { display: block; margin: 18px 0 13px; border: 1px solid rgba(225, 195, 123, 0.3); border-radius: 12px; background: rgba(5, 11, 14, 0.72); padding: 18px 10px; color: #f2d38b; overflow-wrap: anywhere; font: 800 clamp(0.85rem, 3.2vw, 1.15rem)/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.05em; }
.recovery-key-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-acknowledgment { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0 12px; color: #b4c2be; font-size: 0.72rem; line-height: 1.45; text-align: left; }
.recovery-acknowledgment input { margin-top: 2px; accent-color: #6bb9ab; }
.recovery-continue { width: 100%; }
.recovery-continue:disabled { opacity: 0.42; cursor: not-allowed; }
.recovery-warning { margin: 11px 0 0; color: #8e7f72; font-size: 0.62rem; line-height: 1.5; }

.feedback-dialog { width: min(560px, calc(100vw - 28px)); }
.audio-dialog { width: min(470px, calc(100vw - 28px)); }
.audio-dialog p { color: #8fa29d; font-size: 0.75rem; line-height: 1.55; margin: 5px 42px 20px 0; }
.audio-heading small { color: #d9b96f; font-size: 0.62rem; font-weight: 900; letter-spacing: 0.13em; }
.audio-heading h2 { margin: 4px 0 0; font-family: "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; font-size: 1.55rem; }
.audio-dialog > label:not(.audio-mute-row) { display: flex; justify-content: space-between; margin-top: 16px; color: #b5c5c1; font-size: 0.72rem; font-weight: 800; }
.audio-dialog output { color: #e0c37c; }
.audio-dialog > input[type="range"] { width: 100%; accent-color: #69bdad; }
.audio-mute-row { display: flex; align-items: center; gap: 9px; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; color: #d8e4e1; font-size: 0.75rem; font-weight: 800; }
.audio-mute-row input { accent-color: #69bdad; }
.audio-note { display: block; margin-top: 18px; color: #6f827d; font-size: 0.64rem; }
.feedback-heading > small { color: #d2b674; font-size: 0.61rem; font-weight: 900; letter-spacing: 0.16em; }
.feedback-heading h2 { margin: 7px 0 8px; font: 800 1.55rem/1.15 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.feedback-heading p { margin: 0 35px 18px 0; color: #8fa19d; font-size: 0.75rem; line-height: 1.55; }
.feedback-dialog > label { display: block; color: #a9bbb6; font-size: 0.69rem; font-weight: 850; }
.feedback-dialog textarea { width: 100%; min-height: 126px; resize: vertical; margin-top: 7px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 11, 13, 0.55); color: var(--ink); padding: 11px 12px; font: inherit; font-size: 0.78rem; line-height: 1.5; }
.feedback-dialog textarea:focus { outline: 2px solid #8bd4c8; outline-offset: 2px; }
.feedback-context-card { margin-top: 13px; border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 11, 13, 0.34); padding: 10px 11px; }
.feedback-context-card strong { display: block; color: #8fa19d; font-size: 0.63rem; text-transform: uppercase; letter-spacing: 0.07em; }
.feedback-context-card pre { max-height: 135px; overflow: auto; margin: 7px 0 0; color: #849691; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.65rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.feedback-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.feedback-actions:has(#submit-feedback-button:not(.hidden)) { grid-template-columns: repeat(3, 1fr); }
.feedback-actions button { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); color: #dfe8e5; font-size: 0.72rem; font-weight: 850; }
.feedback-actions .primary { border-color: var(--teal); background: var(--surface-teal); }
.feedback-fine-print { margin: 10px 0 0; color: #6e807c; font-size: 0.64rem; text-align: center; }

.player-profile-dialog { width: min(430px, calc(100vw - 28px)); padding: 0; }
.player-profile-heading { position: relative; overflow: hidden; padding: 24px 22px 19px; border-bottom: 1px solid var(--line); background: var(--surface); }
.player-profile-heading h2, .player-profile-error h2 { margin: 0; font: 800 1.55rem/1.15 "Arial Narrow", "Roboto Condensed", system-ui, sans-serif; }
.player-resident-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 9px; margin: 15px; border: 1px solid var(--line); border-radius: 12px; padding: 9px; }
.player-resident-card small, .player-resident-card strong { display: block; }
.player-resident-card small { color: #758783; font-size: 0.56rem; letter-spacing: 0.08em; }
.player-resident-card strong { margin-top: 2px; font-size: 0.73rem; }
.player-resident-card button { min-height: 36px; border: 1px solid rgba(118, 193, 179, 0.3); border-radius: 9px; background: rgba(84, 150, 138, 0.13); color: #dce9e6; padding: 0 10px; font-size: 0.65rem; font-weight: 800; }
.player-profile-note, .player-profile-loading, .player-profile-error { margin: 15px; color: #82938f; font-size: 0.68rem; line-height: 1.5; }
.player-profile-error { padding: 28px 5px; }
.admin-confirm-dialog { width: min(440px, calc(100vw - 28px)); }
.admin-confirm-dialog > label { display: block; color: #9bada8; font-size: 0.68rem; font-weight: 800; }
.admin-confirm-dialog input { width: 100%; height: 44px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(4, 11, 13, 0.55); color: var(--ink); padding: 0 12px; }
.admin-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 10px; }
.admin-confirm-actions button { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.04); color: #dfe8e5; font-size: 0.7rem; font-weight: 850; }
.admin-confirm-actions .primary { border-color: var(--teal); background: var(--surface-teal); }

@media (hover: hover) {
  button { transition: background 140ms ease, border-color 140ms ease, transform 140ms ease; }
  button:hover { border-color: rgba(164, 208, 199, 0.28); }
}

@media (max-width: 1120px) {
  .topbar { grid-template-columns: auto minmax(240px, 1fr) auto; }
  .world-tabs { position: absolute; top: calc(100% + 10px); left: 16px; z-index: 10; background: var(--panel); }
  .environment-card { top: 66px; }
}

@media (max-width: 760px) {
  :root { --topbar-height: 64px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; padding-top: 7px; padding-bottom: 7px; }
  .topbar.search-active { z-index: 70; grid-template-columns: auto minmax(0, 1fr); }
  .topbar.search-active .topbar-actions { display: none; }
  .brand > span:last-child, .icon-button .button-label, .account-button > span:last-child, .search-shell kbd { display: none; }
  .brand-mark { width: 40px; height: 40px; }
  .topbar-actions { gap: 5px; }
  .icon-button, .account-button { width: 44px; justify-content: center; padding: 5px; }
  .account-avatar { width: 32px; height: 32px; }
  .search-shell input { min-width: 0; padding-right: 12px; font-size: 0.78rem; }
  .search-shell.search-active input { padding-right: 44px; }
  .search-shell.search-active input::-webkit-search-cancel-button { display: none; }
  .search-shell.search-active .search-close { display: grid; }
  .search-shell.search-active kbd { display: none; }
  .search-shell.search-active .search-results {
    position: fixed;
    top: var(--search-results-top, var(--topbar-height));
    left: var(--search-results-left, 8px);
    width: var(--search-results-width, calc(100vw - 16px));
    max-height: var(--search-results-max-height, calc(100dvh - var(--topbar-height) - 8px));
    margin: 0;
    padding-right: max(7px, env(safe-area-inset-right));
    padding-left: max(7px, env(safe-area-inset-left));
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
  .search-result { min-height: 56px; align-items: start; padding: 9px 10px; }
  .search-result strong { line-height: 1.25; overflow-wrap: anywhere; }
  .search-result small { line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
  .result-dot { margin-top: 4px; }
  .result-kind { padding-top: 2px; }
  .wide-label { display: none; }
  .compact-label { display: inline; }
  .world-tabs { left: 8px; top: calc(100% + 8px); padding: 2px; }
  .world-tab { min-height: 36px; padding: 0 9px; }
  .environment-card { top: 8px; right: 8px; left: auto; max-width: min(228px, calc(100vw - 154px)); gap: 7px; border-radius: 12px; padding: 6px 8px 6px 6px; }
  .environment-primary { gap: 4px; font-size: 0.63rem; white-space: nowrap; }
  .environment-secondary { margin-top: 2px; overflow: hidden; font-size: 0.59rem; text-overflow: ellipsis; white-space: nowrap; }
  .weather-icon { width: 32px; height: 32px; flex: none; border-radius: 9px; font-size: 1rem; }
  .connection-pill { top: 58px; right: 8px; min-width: 20px; min-height: 20px; justify-content: center; padding: 6px; }
  .connection-pill strong { display: none; }
  .map-controls { right: max(8px, env(safe-area-inset-right)); left: auto; bottom: calc(62px + max(8px, env(safe-area-inset-bottom))); }
  .app[data-mode="sandbox"] .map-controls { bottom: calc(178px + max(8px, env(safe-area-inset-bottom))); }
  .my-resident-card { display: none !important; }
  .my-resident-shortcut:not(.hidden) {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    padding: 3px;
  }
  .my-resident-shortcut .resident-avatar { width: 38px; height: 38px; }
  .resident-context {
    right: calc(62px + env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    min-width: 0;
    transform: none;
    grid-template-columns: minmax(0, 1fr) auto 40px;
    gap: 4px;
    border-radius: 13px;
    padding: 5px;
  }
  .resident-context-main { min-height: 42px; grid-template-columns: 36px minmax(0, 1fr); gap: 7px; padding: 1px 3px; }
  .resident-context-main .resident-avatar { width: 36px; height: 36px; }
  .resident-context-copy strong { font-size: 0.72rem; }
  .resident-context-copy span { font-size: 0.56rem; }
  .resident-context-action { min-width: 58px; min-height: 40px; padding: 0 8px; }
  .resident-context-close { width: 40px; min-height: 40px; }
  .control-hud {
    bottom: calc(62px + max(8px, env(safe-area-inset-bottom)));
    min-width: 0;
    width: calc(100vw - 76px);
    margin-left: -26px;
  }
  .app[data-controlling="true"] .map-controls,
  .app[data-controlling="true"] .my-resident-shortcut,
  .app[data-controlling="true"] .resident-context { display: none !important; }
  .app[data-controlling="true"] .sandbox-controls { display: none !important; }
  .app[data-controlling="true"] .control-hud {
    right: 168px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    min-width: 0;
    display: grid;
    transform: none;
    margin: 0;
    padding: 8px;
  }
  .app[data-controlling="true"] .control-hud button { width: 100%; min-height: 40px; margin-top: 6px; }
  .app[data-controlling="true"] .touch-pad:not(.hidden) {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    display: grid;
  }
  .control-hud span { display: none; }
  .control-hud { gap: 8px; }
  .control-hud button { padding: 0 9px; }
  .sandbox-controls { right: 8px; bottom: calc(62px + max(8px, env(safe-area-inset-bottom))); left: 8px; width: auto; border-radius: 13px; padding: 9px 10px; }
  .app[data-mode="sandbox"] .sandbox-controls { bottom: calc(62px + max(8px, env(safe-area-inset-bottom))); }
  .inspector { top: auto; right: 8px; bottom: 8px; left: 8px; width: auto; max-height: min(72vh, 680px); border-radius: 17px; }
  .saved-drawer { inset: auto 8px 8px; width: auto; max-height: 78vh; }
  .community-panel, .online-roster { inset: 8px; width: auto; padding: 13px; }
  .city-minimap { left: max(8px, env(safe-area-inset-left)); bottom: calc(62px + max(8px, env(safe-area-inset-bottom))); width: 108px; height: 70px; }
  .app[data-mode="sandbox"] .city-minimap { bottom: calc(178px + max(8px, env(safe-area-inset-bottom))); }
  .admin-panel { inset: 8px; width: auto; padding: 15px; }
  .admin-health-grid { grid-template-columns: 1fr 1fr; }
  .admin-account-row dl { grid-template-columns: 1fr 1fr; }
  .toast { bottom: calc(72px + max(8px, env(safe-area-inset-bottom))); }
  .app[data-mode="sandbox"] .toast { bottom: calc(178px + max(8px, env(safe-area-inset-bottom))); }
  .app[data-controlling="true"] .toast { bottom: calc(150px + max(8px, env(safe-area-inset-bottom))); }
  .profile-grid { grid-template-columns: 1fr 1fr; }
  .loading-overlay::before { filter: blur(18px) saturate(0.95) brightness(0.72); }
  .splash-art { height: auto; object-fit: contain; object-position: center top; }
  .splash-vignette { background: #050d194d; }
  .splash-panel { bottom: max(12px, env(safe-area-inset-bottom)); padding: 15px; border-radius: 17px; }
  .splash-copy { margin-bottom: 12px; font-size: 0.73rem; }
  .splash-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .splash-actions .splash-primary { grid-column: 1 / -1; }
  .splash-actions:has(#splash-register-button[hidden]) #splash-login-button { grid-column: 1 / -1; }
  .splash-actions button { min-width: 0; width: 100%; padding: 0 10px; }
}

@media (max-width: 940px) and (orientation: landscape) {
  :root { --topbar-height: 52px; }
  .topbar { min-height: 52px; padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: 4px; }
  .brand-mark { width: 36px; height: 36px; }
  .world-tabs { top: calc(100% + 5px); left: max(6px, env(safe-area-inset-left)); }
  .environment-card { top: 6px; right: max(6px, env(safe-area-inset-right)); max-width: 250px; }
  .connection-pill { top: 50px; right: max(6px, env(safe-area-inset-right)); }
  .map-controls { right: max(6px, env(safe-area-inset-right)); bottom: 50%; transform: translateY(50%); }
  .city-minimap { left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); }
  .inspector { inset: 58px auto 6px max(6px, env(safe-area-inset-left)); width: min(330px, 42vw); max-height: none; border-radius: 14px; }
  .resident-context { right: auto; left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); width: min(360px, 48vw); }
  .my-resident-shortcut:not(.hidden) { right: auto; left: max(6px, env(safe-area-inset-left)); bottom: max(6px, env(safe-area-inset-bottom)); }
  .app[data-controlling="true"] .touch-pad:not(.hidden) { right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); }
  .app[data-controlling="true"] .control-hud { left: max(8px, env(safe-area-inset-left)); right: auto; bottom: max(8px, env(safe-area-inset-bottom)); width: min(310px, 42vw); }
  .sandbox-controls { right: auto; left: max(8px, env(safe-area-inset-left)); bottom: max(8px, env(safe-area-inset-bottom)); width: min(370px, 48vw); }
  .community-panel, .online-roster, .saved-drawer { inset: 58px max(6px, env(safe-area-inset-right)) 6px auto; width: min(430px, 48vw); max-height: none; }
}

@media (min-width: 761px) and (max-width: 940px) {
  .topbar.search-active { z-index: 70; grid-template-columns: auto minmax(0, 1fr); }
  .topbar.search-active .topbar-actions { display: none; }
  .search-shell.search-active input { padding-right: 44px; }
  .search-shell.search-active input::-webkit-search-cancel-button { display: none; }
  .search-shell.search-active .search-close { display: grid; }
  .search-shell.search-active kbd { display: none; }
  .search-shell.search-active .search-results {
    position: fixed;
    top: var(--search-results-top, var(--topbar-height));
    left: var(--search-results-left, 8px);
    width: var(--search-results-width, calc(100vw - 16px));
    max-height: var(--search-results-max-height, calc(100dvh - var(--topbar-height) - 8px));
    margin: 0;
    padding-right: max(7px, env(safe-area-inset-right));
    padding-left: max(7px, env(safe-area-inset-left));
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }
}

:fullscreen .topbar { padding-top: max(6px, env(safe-area-inset-top)); padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }

@media (pointer: coarse) {
  .touch-pad:not(.hidden) { display: grid; }
}

@media (max-width: 470px) {
  .world-tab { padding: 0 9px; font-size: 0.7rem; }
  .preference-columns { grid-template-columns: 1fr; }
  .feedback-dialog { padding: 20px 17px; }
  .feedback-actions, .feedback-actions:has(#submit-feedback-button:not(.hidden)) { grid-template-columns: 1fr; }
  .player-resident-card { grid-template-columns: 38px minmax(0, 1fr); }
  .player-resident-card button { grid-column: 1 / -1; }
  .relationship-grid { grid-template-columns: 1fr; }
}

@media (max-width: 355px) {
  .environment-card { top: 52px; right: 8px; left: 8px; max-width: none; }
  .connection-pill { top: 102px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

/* Diego City's interface uses one opaque, pixel-stepped component language. */
.topbar {
  border: 2px solid var(--line);
  border-radius: 2px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--deep), 4px 4px 0 #020711;
}

.environment-card,
.connection-pill,
.sandbox-controls,
.my-resident-card,
.my-resident-shortcut,
.resident-context,
.control-hud {
  border: 2px solid var(--line);
  border-radius: var(--radius-hud);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--deep), 4px 4px 0 #020711;
}

.map-controls {
  border: 2px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--deep), 4px 4px 0 #020711;
}

.search-results,
.inspector,
.saved-drawer,
.admin-panel,
.online-roster,
.community-panel,
.orientation-hint,
.splash-panel,
.auth-dialog,
.feedback-dialog,
.audio-dialog,
.recovery-dialog,
.recovery-key-dialog,
.resident-reveal-dialog,
.player-profile-dialog,
.admin-confirm-dialog {
  border: 3px solid var(--teal-secondary);
  border-radius: var(--radius-window);
  background: var(--window-ink);
  box-shadow: var(--window-shadow);
}

.world-tabs,
.icon-button,
.account-button,
.search-shell input {
  border-color: var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
}

.search-result,
.profile-cell,
.relationship-card,
.thought-list li,
.saved-main,
.admin-section,
.admin-account-row,
.admin-operations-events,
.online-roster-list > button,
.community-message,
.moderation-card,
.community-workflow-intro,
.community-composer input,
.community-composer textarea,
.favorite-search input,
.feedback-context-card,
.recovery-section,
.player-resident-card,
.now-card {
  border-color: var(--line);
  border-radius: var(--radius-card);
  background: var(--window-card);
}

.brand-mark,
.auth-mark,
.loading-mark {
  border: 2px solid #e1b76e;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: inset -2px -2px 0 #9a6d35, 3px 3px 0 #020711;
}

.icon-button > span:first-child,
.search-icon,
.weather-icon,
.map-controls button,
.speed-row button,
.touch-pad button,
.dialog-close,
.inspector-close,
.resident-context-close {
  font-family: var(--icon-font);
  font-variant-emoji: text;
  text-shadow: none;
}

.world-tab,
.icon-button,
.account-button,
.map-controls button,
.speed-row button,
.resident-context-action,
.resident-context-close,
.resident-card-actions button,
.control-hud button,
.inspector-action,
.auth-submit,
.schedule-tabs button,
.drawer-heading button,
.admin-registration button,
.admin-account-actions button,
.community-tabs button,
.community-conversations button,
.community-composer button,
.favorite-pagination button,
.feedback-kind button,
.feedback-actions button,
.recovery-section button,
.recovery-key-actions button,
.recovery-continue,
.admin-confirm-actions button,
.provider-auth {
  border-radius: var(--radius-control);
}

.world-tab.active,
.schedule-tabs button.active,
.community-tabs button.active,
.community-conversations button.active,
.feedback-kind button.active,
.auth-tabs button.active {
  border-color: var(--teal);
  background: var(--surface-teal);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 #021f2a;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.world-tab:not(:disabled):active,
.icon-button:not(:disabled):active,
.account-button:not(:disabled):active,
.map-controls button:not(:disabled):active,
.speed-row button:not(:disabled):active,
.resident-card-actions button:not(:disabled):active,
.control-hud button:not(:disabled):active,
.inspector-action:not(:disabled):active,
.auth-submit:not(:disabled):active,
.community-tabs button:not(:disabled):active,
.community-composer button:not(:disabled):active,
.feedback-actions button:not(:disabled):active {
  border-color: var(--teal-secondary);
  transform: translate(1px, 1px);
}

.resident-card-actions .primary,
.inspector-action.primary,
.auth-submit,
.resident-context-action,
.community-composer button,
.feedback-actions .primary,
.recovery-section button.primary,
.recovery-key-actions button.primary,
.recovery-continue,
.admin-confirm-actions .primary,
.resident-reveal-dialog > button {
  border-color: var(--teal);
  background: var(--surface-teal);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 #021f2a;
}

.dialog-close,
.inspector-close,
.resident-context-close,
.saved-remove {
  border-color: var(--danger);
  border-radius: var(--radius-control);
  background: #291821;
  color: #d88369;
}

.live-dot,
.connection-pill[data-state="online"] span,
.player-online-dot.online,
.presence-dot {
  background: var(--live-bright);
  box-shadow: 0 0 0 2px var(--deep);
}

.inspector-kicker,
.drawer-heading small,
.sandbox-heading strong,
.control-hud small,
.splash-eyebrow,
.auth-intro > small,
.recovery-heading > small,
.audio-heading small,
.feedback-heading > small,
.resident-reveal-dialog > small {
  color: var(--accent);
}

.inspector h2,
.drawer-heading h2,
.auth-intro h2,
.recovery-heading h2,
.audio-heading h2,
.feedback-heading h2,
.resident-reveal-dialog h2,
.player-profile-heading h2,
.player-profile-error h2 {
  color: var(--ink);
  font-family: var(--pixel-font);
  font-weight: 850;
  letter-spacing: 0.02em;
}

.brand strong,
.world-tab,
.search-label,
.inspector-kicker,
.drawer-heading h2,
.sandbox-heading,
.control-hud small,
.splash-eyebrow,
.auth-tabs button,
.community-tabs button {
  font-family: var(--pixel-font);
}

.search-results,
.inspector,
.saved-drawer,
.admin-panel,
.online-roster,
.community-panel {
  scrollbar-color: var(--teal) var(--deep);
}

.search-result:hover,
.search-result.active,
.map-controls button:hover,
.speed-row button:hover,
.occupant-row:hover,
.saved-main:hover,
.online-roster-list > button:hover {
  background: var(--surface-teal);
}

.splash-picture { position: absolute; inset: 0; display: block; }
.splash-picture .splash-art { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.loading-overlay { background: var(--deep); }
.loading-overlay::before { display: none; }
.splash-panel { border-color: var(--accent); }
.splash-actions button { border-radius: var(--radius-control); background: var(--surface); color: var(--ink); }
.splash-actions .splash-primary { border-color: #e1b76e; background: var(--accent); color: var(--deep); box-shadow: inset 0 -2px 0 #9a6d35; }
.loading-track { border-radius: 0; background: var(--surface); }
.loading-track span { border-radius: 0; background: var(--teal); }

@media (max-width: 760px) and (orientation: portrait) {
  .app[data-controlling="true"] .control-hud {
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    min-width: 0;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    transform: none;
    margin: 0;
    padding: 6px 7px 6px 10px;
  }
  .app[data-controlling="true"] .control-hud > div { min-width: 0; }
  .app[data-controlling="true"] .control-hud small,
  .app[data-controlling="true"] .control-hud strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app[data-controlling="true"] .control-hud button {
    width: auto;
    min-width: 124px;
    min-height: 44px;
    margin: 0;
    padding: 0 10px;
    flex: none;
  }
  .app[data-controlling="true"] .touch-pad:not(.hidden) {
    right: auto;
    bottom: calc(74px + env(safe-area-inset-bottom));
    left: 50%;
    width: 140px;
    height: 92px;
    grid-template-columns: repeat(3, 44px);
    grid-template-rows: repeat(2, 44px);
    transform: translateX(-50%);
  }
  .touch-pad button { min-width: 44px; min-height: 44px; border-radius: 2px; background: var(--panel); }
}

@media (max-width: 940px) and (orientation: landscape) {
  .app[data-controlling="true"] .control-hud {
    min-height: 58px;
    display: flex;
    align-items: center;
    padding: 7px;
  }
  .app[data-controlling="true"] .control-hud button { min-height: 44px; margin: 0; }
  .app[data-controlling="true"] .touch-pad:not(.hidden) { width: 140px; height: 92px; grid-template-rows: repeat(2, 44px); }
  .touch-pad button { min-width: 44px; min-height: 44px; }
}

/* Resident portraits use a square pixel frame; place icons use the shared medallion treatment below. */
.resident-portrait-frame {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  border: 2px solid var(--teal-secondary);
  border-radius: 2px;
  background: var(--avatar-color, var(--surface));
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--deep), 2px 2px 0 #020711;
  image-rendering: pixelated;
}

.resident-portrait-fallback,
.resident-portrait-image {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.resident-portrait-fallback {
  z-index: 0;
  display: grid;
  place-items: center;
  background: var(--avatar-color, var(--surface));
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
}

.resident-portrait-image {
  z-index: 1;
  display: block;
  max-width: none;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.resident-portrait-frame:has(.resident-portrait-image) .resident-portrait-fallback { opacity: 0; }

.search-result.resident-search-result { grid-template-columns: 40px minmax(0, 1fr) auto; }
.search-result-portrait { width: 40px; height: 40px; }
.resident-search-result strong,
.resident-search-result small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-main { grid-template-columns: 38px minmax(0, 1fr); }
#resident-reveal-avatar.resident-portrait-frame { width: 80px; height: 80px; }

/* Final opaque component pass: nested controls must not fall back to the old glass-and-pill theme. */
.inspector-collapse,
.inspector-compact button,
.viewer-list button,
.life-motivation select,
.family-links button,
.tag,
.schedule-tabs button,
.occupant-row,
.drawer-heading button,
.saved-remove,
.saved-empty,
.admin-registration button,
.admin-account-actions button,
.admin-error,
.admin-error button,
.admin-health-grid > div,
.online-roster-list > button,
.community-tabs button,
.community-conversations button,
.community-conversations button span,
.community-message,
.moderation-card,
.moderation-card button,
.moderation-card select,
.community-workflow-intro,
.community-composer input,
.community-composer textarea,
.favorite-search input,
.favorite-pagination button,
.orientation-hint button,
.provider-auth,
.feedback-kind,
.feedback-kind button,
.resident-reveal-details div,
.auth-tabs,
.auth-tabs button,
#auth-form input,
.auth-error,
.recovery-dialog input:not([type="checkbox"]),
.recovery-section,
.recovery-section button,
.recovery-key-actions button,
.recovery-continue,
.recovery-result,
.recovery-key-dialog code,
.audio-mute-row,
.feedback-dialog textarea,
.feedback-context-card,
.feedback-actions button,
.player-resident-card,
.player-resident-card button,
.admin-confirm-dialog input,
.admin-confirm-actions button {
  border-radius: var(--radius-control);
}

.inspector-compact button,
.viewer-presence,
.viewer-list button,
.family-links button,
.tag,
.schedule-tabs button,
.occupant-row,
.saved-empty,
.admin-registration button,
.admin-account-actions button,
.admin-error button,
.admin-health-grid > div,
.online-roster-list > button,
.community-tabs button,
.community-conversations button,
.community-message,
.moderation-card,
.moderation-card button,
.moderation-card select,
.community-workflow-intro,
.favorite-pagination button,
.orientation-hint button,
.feedback-kind,
.feedback-kind button,
.resident-reveal-details div,
.auth-tabs,
.auth-tabs button,
.recovery-section,
.recovery-section button,
.recovery-key-actions button,
.recovery-continue,
.audio-mute-row,
.feedback-context-card,
.feedback-actions button,
.player-resident-card,
.player-resident-card button,
.admin-confirm-actions button {
  border-color: var(--line);
  background: var(--surface);
}

.life-motivation select,
.community-composer input,
.community-composer textarea,
.favorite-search input,
#auth-form input,
.recovery-dialog input:not([type="checkbox"]),
.recovery-key-dialog code,
.feedback-dialog textarea,
.admin-confirm-dialog input {
  border-color: var(--line);
  background: var(--deep);
}

.icon-button small,
.community-conversations button span,
.recovery-result {
  border-radius: var(--radius-control);
  background: var(--surface-teal);
}

.community-message.system {
  border-color: var(--accent);
  background: var(--surface);
}

.auth-error,
.admin-error {
  border-color: var(--danger);
  background: #291821;
}

.inspector-collapse,
.drawer-heading button,
.search-close,
.saved-remove {
  border: 1px solid var(--danger);
  border-radius: var(--radius-control);
  background: #291821;
  color: #d88369;
}

.sandbox-heading-status button,
.provider-auth,
.orientation-hint button,
.player-resident-card button {
  border-color: var(--teal);
  border-radius: var(--radius-control);
  background: var(--surface-teal);
  color: var(--ink);
}

/* A small limited-palette icon kit keeps every legacy glyph in one pixel-art visual language. */
.icon-button > span:first-child,
.weather-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--teal-secondary);
  border-radius: 2px;
  background: var(--surface-teal);
  color: var(--accent);
  box-shadow: inset -2px -2px 0 var(--deep);
  line-height: 1;
}

.icon-button > span:first-child {
  width: 26px;
  height: 26px;
  flex: none;
  font-size: 1rem;
}

.weather-icon {
  border-width: 2px;
  background: var(--surface);
}

.map-controls button,
.speed-row button,
.touch-pad button {
  border-color: var(--line);
  border-radius: 2px;
  background: var(--panel);
  color: var(--accent);
  box-shadow: inset -2px -2px 0 var(--deep);
}

.map-controls button:not(:disabled):active,
.speed-row button:not(:disabled):active,
.touch-pad button:not(:disabled):active {
  border-color: var(--teal);
  background: var(--surface-teal);
  color: var(--ink);
}

.touch-pad:not(.hidden) { display: grid; }

.inspector {
  border-width: 3px;
  background: var(--window-ink);
}

.inspector-hero,
.inspector-compact {
  background: var(--window-raised);
}

.inspector-hero {
  padding: 25px 20px 20px;
}

.inspector-avatar {
  width: 68px;
  height: 68px;
  border: 3px solid var(--teal-secondary);
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px var(--deep), 4px 4px 0 #02070d;
}

.inspector-hero:has(.building-symbol) {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  align-items: end;
  column-gap: 15px;
}

.inspector-hero:has(.building-symbol) .building-symbol {
  grid-column: 1;
  grid-row: 1 / 4;
  align-self: center;
}

.inspector-hero:has(.building-symbol) .inspector-kicker,
.inspector-hero:has(.building-symbol) h2,
.inspector-hero:has(.building-symbol) .inspector-subtitle {
  grid-column: 2;
  min-width: 0;
}

.inspector-hero:has(.building-symbol) .inspector-kicker { margin-top: 0; }

.inspector-hero:has(.building-symbol) h2 {
  overflow-wrap: anywhere;
}

.inspector-hero:has(.building-symbol) .now-card,
.inspector-hero:has(.building-symbol) .inspector-actions {
  grid-column: 1 / -1;
}

.building-symbol {
  width: 84px;
  height: 84px;
  border: 3px solid var(--teal);
  border-radius: 50%;
  background: var(--surface-teal);
  color: var(--gold-bright);
  box-shadow: inset 0 0 0 3px var(--deep), 4px 4px 0 #020711;
  font-family: var(--icon-font);
  font-size: 2rem;
  font-variant-emoji: text;
  line-height: 1;
  text-shadow: none;
  image-rendering: pixelated;
}

.inspector-kicker {
  width: fit-content;
  border: 2px solid #6e5537;
  border-radius: 4px;
  background: #211b1a;
  box-shadow: 2px 2px 0 var(--deep);
  padding: 3px 7px;
  color: var(--gold-bright);
  line-height: 1;
}

.inspector h2 {
  font-size: 1.9rem;
  line-height: 1.02;
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

.inspector-close,
.dialog-close,
.drawer-heading button {
  border: 2px solid var(--coral-bright);
  border-radius: var(--radius-control);
  background: #291821;
  color: #e08a72;
  box-shadow: 3px 3px 0 #02070d;
}

.inspector-collapse {
  border: 2px solid var(--window-line);
  border-radius: var(--radius-control);
  background: var(--deep);
  color: var(--teal-bright);
  box-shadow: 3px 3px 0 #02070d;
}

.now-card {
  border: 2px solid var(--window-line);
  border-left-color: var(--teal);
  border-radius: var(--radius-card);
  background: var(--window-card);
  box-shadow: inset 0 2px 0 #0b2333, 3px 3px 0 #02070d;
  padding: 13px 14px;
}

.now-card small {
  color: var(--teal-bright);
  font-family: var(--pixel-font);
  letter-spacing: 0.12em;
}

.now-card strong { line-height: 1.45; }

.profile-cell,
.relationship-card,
.occupant-row,
.saved-main,
.online-roster-list > button,
.community-message,
.moderation-card,
.player-resident-card {
  border-radius: var(--radius-card);
  background: var(--window-card);
  box-shadow: inset 0 1px 0 #0b2333, 3px 3px 0 #02070d;
}

.section-heading { align-items: center; }

.section-heading::after {
  content: "";
  order: 1;
  min-width: 18px;
  flex: 1;
  border-top: 2px dashed var(--window-line);
}

.section-heading h3 {
  order: 0;
  color: var(--teal-bright);
  font-family: var(--pixel-font);
  font-size: 0.84rem;
}

.section-heading span { order: 2; }

.profile-cell span {
  color: var(--muted);
  letter-spacing: 0.09em;
}

.profile-cell strong {
  color: var(--ink);
  font-size: 0.78rem;
}

.inspector:has(.building-symbol) .profile-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.inspector:has(.building-symbol) .profile-cell {
  min-height: 76px;
  display: grid;
  align-content: center;
  text-align: center;
}

.inspector:has(.building-symbol) .profile-cell strong {
  white-space: normal;
  overflow-wrap: anywhere;
}

.inspector:has(.building-symbol) .profile-cell:nth-child(2) strong { color: var(--gold-bright); }
.inspector:has(.building-symbol) .profile-cell:nth-child(3) strong { color: var(--teal-bright); }
.inspector:has(.building-symbol) .profile-cell:nth-child(4) strong { color: var(--coral-bright); }

.toast {
  border: 2px solid var(--accent);
  border-radius: var(--radius-hud);
  background: var(--window-ink);
  box-shadow: inset 0 0 0 1px var(--deep), 4px 4px 0 #020711;
  color: var(--ink);
}

@media (max-width: 940px) and (orientation: landscape) {
  .inspector-hero:has(.building-symbol) {
    grid-template-columns: 60px minmax(0, 1fr);
    column-gap: 10px;
    padding: 18px 14px 14px;
  }

  .inspector-hero:has(.building-symbol) .building-symbol {
    width: 58px;
    height: 58px;
    font-size: 1.45rem;
  }

  .inspector-hero:has(.building-symbol) h2 { font-size: 1.38rem; }
  .inspector:has(.building-symbol) .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 355px) and (orientation: portrait) {
  .inspector:has(.building-symbol) .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) and (orientation: portrait) {
  .app[data-controlling="true"] .toast {
    bottom: calc(174px + env(safe-area-inset-bottom));
  }
}
