:root {
  color-scheme: dark;
  --bg: #101019;
  --panel: rgba(18, 18, 31, 0.92);
  --panel-solid: #181827;
  --ink: #f6f3ff;
  --muted: #a8a6be;
  --cyan: #38d9ff;
  --pink: #ff4fd8;
  --orange: #ff8c42;
  --green: #47e38a;
  --yellow: #ffe66d;
  --purple: #8b5cf6;
  --road: #202030;
  --side-panel-width: 360px;
  --admin-side-gutter: 14px;
  --tile-w: 132px;
  --tile-h: 74px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 24% 20%, rgba(56, 217, 255, 0.16), transparent 32%),
    linear-gradient(135deg, #11111d 0%, #171525 52%, #0e141c 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

button:hover {
  border-color: rgba(56, 217, 255, 0.75);
  background: rgba(56, 217, 255, 0.14);
}

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

.hidden {
  display: none !important;
}

.loading-screen {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 24px;
  padding: 32px;
}

.login-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(7, 9, 20, 0.58), rgba(7, 9, 20, 0.84)),
    radial-gradient(circle at 28% 28%, rgba(56, 217, 255, 0.2), transparent 32%),
    radial-gradient(circle at 72% 62%, rgba(255, 79, 216, 0.16), transparent 34%),
    #070914;
}

.login-panel {
  width: min(340px, calc(100vw - 42px));
  display: grid;
  justify-items: center;
  padding: 24px;
  border: 1px solid rgba(56, 217, 255, 0.26);
  border-radius: 8px;
  background: rgba(12, 13, 25, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 24px 80px rgba(0, 0, 0, 0.44);
  text-align: center;
}

.login-panel .login-button {
  width: min(260px, 100%);
  justify-self: center;
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.login-panel .login-button.disabled {
  pointer-events: none;
  opacity: 0.52;
  filter: saturate(0.35);
}

.loading-panel {
  width: min(560px, calc(100vw - 48px));
  display: grid;
  gap: 0;
}

.loading-track {
  position: relative;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 48%, rgba(0, 0, 0, 0.2)),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18),
    0 0 16px rgba(56, 217, 255, 0.08);
}

.loading-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--pink), var(--yellow));
  transition: width 140ms ease;
}

.create-screen {
  min-height: 100%;
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: clamp(18px, 2.8vh, 30px);
  padding: clamp(24px, 3.2vh, 38px) 40px clamp(42px, 6vh, 72px);
  overflow-x: hidden;
  overflow-y: auto;
  background: #070914;
}

.create-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7, 9, 20, 0.74), rgba(7, 9, 20, 0.2) 44%, rgba(7, 9, 20, 0.84)),
    radial-gradient(ellipse at center, transparent 35%, rgba(3, 4, 12, 0.72) 100%);
}

.create-city-backdrop {
  position: absolute;
  inset: -22px;
  z-index: 0;
  width: calc(100% + 44px);
  height: calc(100% + 44px);
  display: block;
  opacity: 0.58;
  filter: blur(7px) saturate(1.18) contrast(1.05);
  transform: scale(1.03);
  pointer-events: none;
}

.create-screen > .brand-lockup,
.create-screen > .create-form {
  position: relative;
  z-index: 2;
}

.brand-lockup {
  display: block;
  text-align: center;
}

.brand-lockup h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 1;
  text-transform: none;
  text-shadow: 0 0 22px rgba(255, 79, 216, 0.45);
}

.create-form {
  width: min(1120px, 100%);
  display: grid;
  gap: clamp(22px, 3vh, 34px);
}

.create-name-badge {
  min-height: 46px;
  min-width: min(420px, 100%);
  justify-self: center;
  display: inline-grid;
  place-items: center;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.26);
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  box-shadow: inset 0 0 18px rgba(56, 217, 255, 0.08), 0 0 26px rgba(255, 79, 216, 0.12);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: clamp(18px, 2vw, 24px);
}

.role-card {
  min-height: clamp(380px, calc(100vh - 315px), 590px);
  padding: 0;
  display: block;
  text-align: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.role-card.active {
  border-color: var(--pink);
  box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.5), 0 0 28px rgba(255, 79, 216, 0.16);
}

.role-card-preview {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
}

.primary-button {
  justify-self: start;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 8px;
  border-color: rgba(255, 79, 216, 0.58);
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.88), rgba(56, 217, 255, 0.82));
  color: #080810;
  font-weight: 800;
  text-transform: uppercase;
}

.create-submit {
  justify-self: center;
  margin-top: 6px;
  padding: 0 28px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 900ms ease, transform 900ms ease, visibility 0s linear 900ms;
}

.create-submit.ready {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 900ms ease, transform 900ms ease;
}

.game-shell {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-panel-width);
  grid-template-rows: 74px minmax(0, 1fr);
}

.hud-top {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) minmax(160px, 220px);
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: rgba(13, 13, 23, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.identity strong,
.identity small {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.identity small {
  color: var(--muted);
}

.sorty-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  position: relative;
  flex: 0 0 auto;
  background: linear-gradient(160deg, #fefefe, #b8f7ff);
  box-shadow: inset -9px -7px 0 rgba(0, 0, 0, 0.13), 0 0 20px rgba(56, 217, 255, 0.26);
}

.sorty-logo::before,
.sorty-logo::after,
.sorty-logo span::before {
  content: "";
  position: absolute;
  background: #11111d;
  border-radius: 999px;
}

.sorty-logo::before {
  width: 7px;
  height: 7px;
  left: 14px;
  top: 17px;
}

.sorty-logo::after {
  width: 7px;
  height: 7px;
  right: 14px;
  top: 17px;
}

.sorty-logo span::before {
  width: 17px;
  height: 4px;
  left: 15px;
  bottom: 14px;
}

.sorty-logo.unsorted,
.sorty-logo.toxic {
  background: linear-gradient(160deg, #def277, #82d173);
  box-shadow: inset -9px -7px 0 rgba(0, 0, 0, 0.16), 0 0 28px rgba(120, 255, 64, 0.38);
}

.sorty-logo.downed {
  filter: grayscale(0.5) brightness(0.72);
}

.meter-group {
  display: grid;
  gap: 0;
  min-width: 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.85rem;
}

.meter {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  transition: width 180ms ease;
}

.meter-fill.ap {
  background: linear-gradient(90deg, var(--cyan), var(--pink));
}

.meter-fill.condition {
  background: linear-gradient(90deg, var(--green), var(--yellow));
}

.hud-top .meter,
.city-status-bar {
  position: relative;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 48%, rgba(0, 0, 0, 0.2)),
    rgba(255, 255, 255, 0.08);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18),
    0 0 16px rgba(56, 217, 255, 0.08);
}

.hud-top .meter-fill,
.city-status-fill {
  height: 100%;
}

.hud-bar-copy {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 0 8px;
  color: #fff;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.hud-bar-label,
.hud-bar-value {
  min-width: 0;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(5, 6, 14, 0.48);
  box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.04);
  line-height: 1;
}

.hud-bar-label {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.hud-bar-value {
  justify-content: flex-end;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.76rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.city-status .hud-bar-value {
  font-size: 0.72rem;
}

.city-status {
  position: relative;
  display: grid;
  gap: 0;
  min-width: 0;
  padding-right: 18px;
}

.city-status::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 0;
  bottom: 2px;
  width: 1px;
  border-radius: 999px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  box-shadow: 0 0 10px rgba(56, 217, 255, 0.18);
}

.city-status-bar {
  display: flex;
  overflow: hidden;
}

.city-status-fill {
  height: 100%;
  min-width: 0;
  transition: width 180ms ease;
}

.city-status-fill.clean {
  background: linear-gradient(90deg, #47e38a, #86f7b3);
}

.city-status-fill.spilled {
  background: linear-gradient(90deg, #ffe66d, #ffb84d);
}

.city-status-fill.spoiled {
  background: linear-gradient(90deg, #ff6f91, #ff4fd8);
}

.city-status.affected-focus .city-status-fill.spilled {
  order: 1;
}

.city-status.affected-focus .city-status-fill.spoiled {
  order: 2;
}

.city-status.affected-focus .city-status-fill.clean {
  order: 3;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  font-weight: 800;
}

.admin-toggle {
  width: 54px;
  border-color: rgba(255, 79, 216, 0.42);
}

.admin-toggle.active {
  color: #080810;
  background: linear-gradient(135deg, rgba(255, 79, 216, 0.95), rgba(56, 217, 255, 0.88));
}

.city-wrap {
  position: relative;
  overflow: hidden;
  perspective: 920px;
  perspective-origin: 50% 42%;
  background:
    linear-gradient(rgba(176, 203, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 203, 255, 0.018) 1px, transparent 1px),
    linear-gradient(180deg, #070914 0%, #04050b 100%);
  background-size: 36px 36px, 36px 36px, auto;
}

.city-wrap::before,
.city-wrap::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.city-wrap::before {
  z-index: 5;
  opacity: var(--environment-halftone-opacity, 0.12);
  mix-blend-mode: screen;
  background-image: radial-gradient(circle, rgba(206, 225, 255, 0.42) 0 1px, transparent 1.5px);
  background-size: 9px 9px;
}

.city-wrap::after {
  z-index: 6;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(2, 3, 9, var(--environment-vignette-opacity, 0.58)) 100%);
}

.weather-layer {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 7;
  opacity: var(--environment-rain-opacity, 0.22);
  overflow: hidden;
}

.weather-layer.disabled {
  display: none;
}

.rain-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.city-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: pointer;
  transition: filter 220ms ease, transform 220ms ease;
}

.city-wrap.ap-empty .city-canvas,
.city-wrap.ap-empty .weather-layer {
  filter: blur(4px) brightness(0.6);
}

.city-wrap.inside-building .city-canvas {
  filter: blur(1.6px) brightness(0.72) saturate(0.86);
  transform: scale(1.01);
  cursor: default;
}

.city-wrap.inside-building .weather-layer {
  filter: blur(1.2px) brightness(0.74);
}

.city-wrap.inside-building::after {
  background:
    radial-gradient(ellipse at center, rgba(2, 3, 9, 0.08) 0%, rgba(2, 3, 9, 0.34) 54%, rgba(2, 3, 9, 0.78) 100%),
    linear-gradient(180deg, rgba(10, 12, 24, 0.14), rgba(2, 3, 9, 0.34));
}

.inside-building-banner {
  position: absolute;
  z-index: 11;
  left: 50%;
  top: 50%;
  max-width: min(520px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  padding: 14px 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #fff;
  background: rgba(8, 9, 18, 0.46);
  box-shadow: 0 18px 58px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(10px) saturate(1.08);
  font-size: clamp(1.1rem, 2vw, 1.7rem);
  font-weight: 950;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.24);
  pointer-events: none;
}

.inside-building-banner strong {
  display: block;
}

.inside-building-banner-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.inside-building-banner-meta span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
  text-shadow: none;
}

.ap-empty-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  background: rgba(3, 4, 10, 0.42);
  backdrop-filter: blur(6px) saturate(1.1);
}

.ap-empty-card {
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
  padding: 24px;
  border: 1px solid rgba(255, 79, 216, 0.46);
  border-radius: 8px;
  background: rgba(18, 18, 31, 0.88);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.54),
    0 0 38px rgba(255, 79, 216, 0.14);
  text-align: center;
}

.ap-empty-card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
}

.ap-empty-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.road-segment,
.street-node,
.building-model,
.character-model {
  position: absolute;
  transform-style: preserve-3d;
}

.road-segment {
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(255, 230, 109, 0.28) 49% 51%, transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.16)),
    #202030;
  box-shadow: inset 0 0 28px rgba(0, 0, 0, 0.35), 0 0 28px rgba(56, 217, 255, 0.08);
  transform: translate(-50%, -50%) translateZ(1px);
}

.road-segment.east {
  width: 222px;
  height: 58px;
}

.road-segment.south {
  width: 58px;
  height: 222px;
}

.street-node {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  border-color: rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at center, rgba(56, 217, 255, 0.22), transparent 42%),
    linear-gradient(135deg, #2b2b43, #181827);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.34), 0 0 24px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%) translateZ(3px);
}

.street-node:hover {
  box-shadow: inset 0 0 22px rgba(56, 217, 255, 0.28), 0 0 34px rgba(56, 217, 255, 0.24);
}

.street-node.selected {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(255, 79, 216, 0.58), 0 0 32px rgba(255, 79, 216, 0.32);
}

.street-node.current {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(56, 217, 255, 0.76), 0 0 36px rgba(56, 217, 255, 0.3);
}

.building-model {
  width: 118px;
  height: 118px;
  --building-width: 78px;
  --building-depth: 72px;
  border: 0;
  background: transparent;
  padding: 0;
  transform: translate(-50%, -50%) translateZ(8px);
}

.building-model:hover {
  border: 0;
  background: transparent;
}

.building-model:hover .building-pad,
.building-model.selected .building-pad {
  box-shadow: 0 0 0 3px rgba(255, 79, 216, 0.62), 0 0 28px rgba(255, 79, 216, 0.28);
}

.building-pad {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104px;
  height: 82px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.2)),
    rgba(38, 39, 58, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translate(-50%, -50%) translateZ(2px);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.32);
}

.building-cube {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--building-width);
  height: var(--building-depth);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

.cube-face {
  position: absolute;
  background: var(--building-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, 0.14);
  backface-visibility: hidden;
}

.cube-face.top {
  left: 0;
  top: 0;
  width: var(--building-width);
  height: var(--building-depth);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 36%),
    color-mix(in srgb, var(--building-color) 88%, white);
  transform: translateZ(var(--building-height));
}

.cube-face.front,
.cube-face.back {
  left: 0;
  width: var(--building-width);
  height: var(--building-height);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 20%),
    color-mix(in srgb, var(--building-color) 84%, #11111d);
}

.cube-face.front {
  top: var(--building-depth);
  transform-origin: top center;
  transform: rotateX(90deg);
}

.cube-face.back {
  top: 0;
  transform-origin: top center;
  transform: rotateX(90deg) translateY(calc(-1 * var(--building-height)));
  filter: brightness(0.74);
}

.cube-face.left,
.cube-face.right {
  top: 0;
  width: var(--building-depth);
  height: var(--building-height);
  background: color-mix(in srgb, var(--building-color) 68%, #080810);
}

.cube-face.left {
  left: 0;
  transform-origin: left top;
  transform: rotateY(-90deg) rotateZ(90deg);
}

.cube-face.right {
  right: 0;
  transform-origin: right top;
  transform: rotateY(90deg) rotateZ(-90deg);
}

.window-grid {
  position: absolute;
  inset: 14px 10px 18px;
  opacity: 0.5;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.65) 0 8px, transparent 9px 18px),
    repeating-linear-gradient(180deg, transparent 0 13px, rgba(255, 255, 255, 0.45) 14px 18px);
}

.roof-label {
  min-width: 46px;
  min-height: 26px;
  display: grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: #0d0d16;
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0;
}

.building-status,
.containment-stack {
  position: absolute;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #080810;
  font-size: 0.7rem;
  font-weight: 900;
  transform: translateZ(calc(var(--building-height) + 8px));
}

.building-status {
  left: 23px;
  top: 22px;
  padding: 0 7px;
}

.building-status.powered {
  background: var(--yellow);
}

.building-status.hazard {
  left: 50%;
  background: #b3f542;
}

.building-model.powered .cube-face.top {
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, 0.14), 0 0 34px rgba(255, 230, 109, 0.44);
}

.building-model.spilled .building-pad,
.building-model.spoiled .building-pad {
  background:
    radial-gradient(circle at 42% 58%, rgba(179, 245, 66, 0.32), transparent 34%),
    rgba(38, 39, 58, 0.92);
}

.containment-stack {
  right: 18px;
  bottom: 22px;
  min-width: 28px;
  height: 28px;
  background: var(--orange);
  box-shadow: 0 0 18px rgba(255, 140, 66, 0.36);
}

.character-model {
  width: 58px;
  height: 58px;
  --sorty-width: 30px;
  --sorty-depth: 26px;
  --sorty-height: 50px;
  --sorty-color: #f7fbff;
  pointer-events: none;
  transform: translate(-50%, -50%) translateZ(8px);
  transform-style: preserve-3d;
}

.character-model .shadow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 44px;
  height: 30px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.34);
  transform: translate(-50%, -50%) translateZ(2px);
}

.sorty-cube {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--sorty-width);
  height: var(--sorty-depth);
  transform: translate(-50%, -50%);
  transform-style: preserve-3d;
}

.sorty-face {
  position: absolute;
  background: var(--sorty-color);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow: inset -5px -7px 0 rgba(0, 0, 0, 0.14);
  backface-visibility: hidden;
}

.sorty-face.top {
  left: 0;
  top: 0;
  width: var(--sorty-width);
  height: var(--sorty-depth);
  border-radius: 999px 999px 10px 10px;
  transform: translateZ(var(--sorty-height));
}

.sorty-face.front,
.sorty-face.back {
  left: 0;
  width: var(--sorty-width);
  height: var(--sorty-height);
}

.sorty-face.front {
  top: var(--sorty-depth);
  border-radius: 12px 12px 8px 8px;
  transform-origin: top center;
  transform: rotateX(90deg);
}

.sorty-face.back {
  top: 0;
  border-radius: 12px 12px 8px 8px;
  transform-origin: top center;
  transform: rotateX(90deg) translateY(calc(-1 * var(--sorty-height)));
  filter: brightness(0.82);
}

.sorty-face.left,
.sorty-face.right {
  top: 0;
  width: var(--sorty-depth);
  height: var(--sorty-height);
  filter: brightness(0.86);
}

.sorty-face.left {
  left: 0;
  transform-origin: left top;
  transform: rotateY(-90deg) rotateZ(90deg);
}

.sorty-face.right {
  right: 0;
  transform-origin: right top;
  transform: rotateY(90deg) rotateZ(-90deg);
}

.character-model .eye {
  position: absolute;
  top: 13px;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #151522;
}

.character-model .eye.left {
  left: 7px;
}

.character-model .eye.right {
  right: 7px;
}

.character-model.player .sorty-face {
  outline: 2px solid var(--pink);
}

.character-model.unsorted,
.character-model.toxic {
  --sorty-color: #cce965;
}

.character-model.downed {
  transform: translate(-50%, -50%) translateZ(8px) rotateZ(-72deg);
}

.tile {
  position: absolute;
  width: var(--tile-w);
  height: var(--tile-h);
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: linear-gradient(145deg, #282840, #181827);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.28);
  transition: filter 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.tile:hover {
  filter: brightness(1.22);
  box-shadow: inset 0 0 18px rgba(56, 217, 255, 0.22), 0 0 22px rgba(56, 217, 255, 0.22);
}

.tile.selected {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px rgba(255, 79, 216, 0.62), 0 0 26px rgba(255, 79, 216, 0.28);
}

.tile.current {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(56, 217, 255, 0.7), 0 0 24px rgba(56, 217, 255, 0.32);
}

.tile.spilled {
  background: linear-gradient(145deg, #4a3648, #232039);
}

.tile.spoiled {
  background: linear-gradient(145deg, #333617, #1b1d12);
}

.tile.street {
  background: linear-gradient(145deg, #27273a, #1c1c2b);
}

.building {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 66px;
  height: 62px;
  transform: translate(-50%, -78%);
  border-radius: 5px 5px 3px 3px;
  background: var(--building-color, var(--cyan));
  box-shadow: inset -10px -12px 0 rgba(0, 0, 0, 0.2), 0 10px 18px rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  color: #080810;
  font-size: 0.7rem;
  font-weight: 900;
  text-shadow: none;
}

.building::before {
  content: "";
  position: absolute;
  inset: 8px 11px auto 11px;
  height: 7px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 0 rgba(255, 255, 255, 0.52), 0 36px 0 rgba(255, 255, 255, 0.38);
}

.building.powered {
  outline: 2px solid rgba(255, 230, 109, 0.8);
  box-shadow:
    inset -10px -12px 0 rgba(0, 0, 0, 0.2),
    0 0 24px rgba(255, 230, 109, 0.36),
    0 10px 18px rgba(0, 0, 0, 0.35);
}

.containment {
  position: absolute;
  right: 26px;
  bottom: 15px;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  background: rgba(255, 140, 66, 0.94);
  color: #160b05;
  font-size: 0.78rem;
  font-weight: 900;
}

.character-token {
  position: absolute;
  width: 38px;
  height: 46px;
  transform: translate(-50%, -100%);
  z-index: 5;
  pointer-events: none;
}

.character-token .body {
  position: absolute;
  left: 7px;
  bottom: 0;
  width: 24px;
  height: 34px;
  border-radius: 12px 12px 8px 8px;
  background: #f7fbff;
  box-shadow: inset -5px -6px 0 rgba(0, 0, 0, 0.16), 0 0 14px rgba(255, 255, 255, 0.25);
}

.character-token .eye {
  position: absolute;
  top: 13px;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #151522;
}

.character-token .eye.left {
  left: 13px;
}

.character-token .eye.right {
  right: 13px;
}

.character-token.player .body {
  outline: 2px solid var(--pink);
}

.character-token.unsorted .body,
.character-token.toxic .body {
  background: #cce965;
}

.character-token.downed {
  transform: translate(-50%, -68%) rotate(-70deg);
  filter: grayscale(0.3) brightness(0.8);
}

.side-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(14, 15, 29, 0.96), rgba(9, 11, 22, 0.94)),
    radial-gradient(circle at 50% 0%, rgba(56, 217, 255, 0.12), transparent 42%);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
}

.side-profile {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(56, 217, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(56, 217, 255, 0.1), transparent 44%),
    rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 16px 38px rgba(0, 0, 0, 0.25);
}

.side-profile-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.side-profile strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-edit-button {
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(255, 79, 216, 0.48);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 79, 216, 0.13);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.side-module {
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

#panelActions:not(.collapsed) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#panelActions:not(.collapsed) .panel-body {
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  overflow: auto;
}

.panel-toggle {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 14px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(56, 217, 255, 0.13), transparent 62%),
    rgba(255, 255, 255, 0.035);
  text-align: left;
}

.panel-toggle span {
  font-weight: 950;
}

.panel-toggle small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.panel-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(235, 244, 255, 0.78);
  border-bottom: 2px solid rgba(235, 244, 255, 0.78);
  transform: translateY(-2px) rotate(45deg);
}

.side-module.collapsed .panel-toggle::after {
  transform: translateY(2px) rotate(225deg);
}

.panel-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.side-module.collapsed .panel-body {
  display: none;
}

.panel-empty {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.84rem;
  font-weight: 750;
}

.location-card,
.skill-row,
.character-row {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.location-card {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.location-card h2 {
  margin: 0;
  font-size: 1.08rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: #080810;
  background: var(--yellow);
  font-size: 0.76rem;
  font-weight: 800;
}

.tag.dark {
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.tag.hot {
  background: var(--pink);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-buttons button,
.character-row button,
.skill-row button,
.building-modal-actions button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 10px;
  font-weight: 700;
}

.action-buttons .panel-empty {
  grid-column: 1 / -1;
}

.local-characters {
  display: grid;
  gap: 8px;
}

.character-row {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.character-row header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.character-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.inventory-grid,
.skill-list {
  display: grid;
  gap: 8px;
}

.skill-row {
  padding: 10px;
}

.inventory-capacity {
  display: grid;
  gap: 7px;
}

.inventory-capacity-label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.inventory-capacity-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}

.inventory-capacity-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width 180ms ease;
}

.inventory-grid {
  grid-template-columns: 1fr;
}

.inventory-slot {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 44px;
  align-items: center;
  column-gap: 12px;
  padding: 8px;
  border: 1px solid rgba(56, 217, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(56, 217, 255, 0.08), transparent 58%),
    rgba(0, 0, 0, 0.2);
}

.inventory-slot.empty {
  min-height: 42px;
  display: block;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.12);
}

.inventory-item-copy {
  display: grid;
  align-content: start;
  min-width: 0;
}

.inventory-item-copy strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-row small,
.location-card small,
.character-row small {
  color: var(--muted);
}

.inventory-quantity {
  align-self: stretch;
  display: grid;
  place-items: center;
  margin: -8px 0;
  border-left: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 0 7px 7px 0;
  color: #080810;
  background: var(--yellow);
  font-size: 0.86rem;
  font-weight: 950;
}

.inventory-drop {
  min-height: 32px;
  padding: 0;
  justify-self: stretch;
  border-color: rgba(255, 79, 216, 0.4);
  border-radius: 7px;
  background: rgba(255, 79, 216, 0.1);
  font-size: 0.72rem;
  font-weight: 950;
}

.skill-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  align-items: end;
  padding: 0 2px;
}

.skill-summary span,
.skill-summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.skill-summary strong {
  color: var(--cyan);
  font-weight: 950;
}

.skill-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-color: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  outline: none;
}

.skill-row:focus-visible {
  border-color: rgba(56, 217, 255, 0.56);
  box-shadow: 0 0 0 1px rgba(56, 217, 255, 0.18);
}

.skill-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.skill-row.learned {
  border-color: rgba(71, 227, 138, 0.32);
  background:
    linear-gradient(90deg, rgba(71, 227, 138, 0.1), transparent 62%),
    rgba(255, 255, 255, 0.055);
}

.skill-row.expanded {
  align-items: start;
  border-color: rgba(56, 217, 255, 0.34);
}

.skill-description {
  display: none;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.skill-row.expanded .skill-description {
  display: block;
}

.connection-notice {
  position: fixed;
  z-index: 130;
  left: 50%;
  top: 88px;
  width: min(560px, calc(100vw - 32px));
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 14px;
  transform: translateX(-50%);
  border: 1px solid rgba(255, 230, 109, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 230, 109, 0.2), rgba(255, 79, 216, 0.14)),
    rgba(8, 8, 14, 0.9);
  box-shadow:
    0 0 30px rgba(255, 230, 109, 0.15),
    inset 0 0 0 1px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

.connection-notice-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.connection-notice strong {
  color: #fff;
  font-size: 0.76rem;
  font-weight: 950;
  text-transform: uppercase;
}

.connection-notice span {
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.84rem;
  line-height: 1.25;
}

.connection-notice button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 13px;
  border-color: rgba(255, 79, 216, 0.65);
  border-radius: 7px;
  background: rgba(255, 79, 216, 0.18);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(560px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(8, 8, 14, 0.92);
  border: 1px solid rgba(56, 217, 255, 0.48);
  box-shadow: 0 0 28px rgba(56, 217, 255, 0.18);
}

.return-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 4, 10, 0.72);
  backdrop-filter: blur(5px);
}

.return-gate-card {
  width: min(380px, calc(100vw - 40px));
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 24px;
  border: 1px solid rgba(255, 79, 216, 0.42);
  border-radius: 8px;
  background: rgba(18, 18, 31, 0.96);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.58),
    0 0 34px rgba(255, 79, 216, 0.14);
}

.return-gate-card h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.1;
  text-align: center;
}

.return-gate-card .primary-button {
  justify-self: stretch;
}

.quick-start {
  position: fixed;
  inset: 0;
  z-index: 121;
  display: grid;
  place-items: center;
  padding: 24px;
}

.quick-start-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 10, 0.68);
  backdrop-filter: blur(5px);
}

.quick-start-card {
  position: relative;
  width: min(820px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(56, 217, 255, 0.42);
  border-radius: 8px;
  background: rgba(18, 18, 31, 0.96);
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(255, 79, 216, 0.13);
}

.quick-start-body {
  display: grid;
  gap: 16px;
}

.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quick-start-section,
.quick-start-tips {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.quick-start-section h3,
.quick-start-tips h3 {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.quick-start-section p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.quick-start-keys {
  width: 132px;
  display: grid;
  grid-template-columns: repeat(3, 36px);
  gap: 6px;
}

.quick-start-keys kbd {
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(56, 217, 255, 0.42);
  border-bottom-color: rgba(255, 79, 216, 0.52);
  border-radius: 7px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
  font-family: inherit;
  font-weight: 950;
}

.quick-start-mouse {
  width: 52px;
  height: 78px;
  display: grid;
  justify-items: center;
  padding-top: 8px;
  border: 2px solid rgba(56, 217, 255, 0.52);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.06);
}

.quick-start-mouse span {
  width: 8px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--pink), var(--cyan));
}

.quick-start-tips ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--ink);
}

.quick-start-tips li {
  padding-left: 4px;
  line-height: 1.42;
}

.quick-start-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 140px);
  align-items: center;
  gap: 14px;
}

.quick-start-footer .primary-button {
  min-width: 96px;
  justify-self: end;
}

.quick-start-check {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 800;
}

.quick-start-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--pink);
}

.building-modal {
  position: fixed;
  top: 74px;
  right: var(--side-panel-width);
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
}

.building-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 10, 0.62);
  backdrop-filter: blur(3px);
}

.building-modal-card {
  position: relative;
  width: min(760px, calc(100vw - var(--side-panel-width) - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(56, 217, 255, 0.34);
  border-radius: 8px;
  background: rgba(18, 18, 31, 0.96);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.48),
    0 0 32px rgba(56, 217, 255, 0.12);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-weight: 900;
}

.building-modal-body {
  display: grid;
  gap: 16px;
}

.building-modal-body h2 {
  margin: 0;
  font-size: 1.42rem;
  line-height: 1.15;
}

.building-modal-body h3 {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.building-modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding-right: 46px;
}

.building-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.84fr);
  gap: 14px;
}

.building-modal-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.042);
}

.building-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.building-detail {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.14);
}

.building-detail span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.building-detail strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.96rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.building-modal-note {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.building-modal-note.empty {
  color: rgba(168, 166, 190, 0.64);
}

.building-modal-alerts {
  display: grid;
  gap: 8px;
}

.building-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.building-modal-actions button {
  min-width: 0;
  height: auto;
  min-height: 38px;
  padding: 8px 10px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.building-modal-meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.09);
}

.building-modal-section {
  display: grid;
  gap: 8px;
}

.building-modal-section > small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.building-occupants {
  display: grid;
  gap: 8px;
}

.building-modal.inside-building {
  place-items: center;
  padding: 24px;
}

.building-modal.inside-building .building-modal-backdrop {
  background: rgba(3, 4, 10, 0.36);
  backdrop-filter: blur(4px);
}

.building-modal.inside-building .building-modal-card {
  width: min(1120px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  max-height: calc(100vh - 48px);
  border-radius: 8px;
  border: 1px solid rgba(56, 217, 255, 0.28);
  background: rgba(18, 18, 31, 0.74);
  backdrop-filter: blur(16px) saturate(1.2);
  padding: 24px;
}

.building-modal.inside-building .modal-close {
  display: none;
}

.building-modal.inside-building .building-modal-body {
  width: 100%;
  margin: 0 auto;
  padding-right: 0;
  gap: 18px;
}

.building-modal.inside-building .building-modal-actions {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.sorty-editor {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 24px;
}

.sorty-editor-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 4, 10, 0.62);
  backdrop-filter: blur(5px);
}

.sorty-editor-card {
  position: relative;
  width: min(1320px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 18px;
  border: 1px solid rgba(255, 79, 216, 0.44);
  border-radius: 8px;
  background: rgba(15, 15, 28, 0.9);
  box-shadow:
    0 24px 90px rgba(0, 0, 0, 0.58),
    0 0 38px rgba(255, 79, 216, 0.14);
}

.sorty-editor-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 0.42fr) minmax(0, 1fr);
  gap: 16px;
}

.sorty-preview-wrap {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(56, 217, 255, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 44%, rgba(56, 217, 255, 0.18), transparent 38%),
    linear-gradient(rgba(176, 203, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 203, 255, 0.03) 1px, transparent 1px),
    #070914;
  background-size: auto, 34px 34px, 34px 34px;
}

.sorty-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.sorty-preview-canvas:active {
  cursor: grabbing;
}

.sorty-editor-controls {
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.sorty-editor-controls > *,
.sorty-hat-controls > *,
.sorty-skin-controls > *,
.sorty-shape-controls > * {
  min-width: 0;
}

.sorty-editor-controls label,
.sorty-shape-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.sorty-editor-controls select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.24);
}

.sorty-face-section,
.sorty-hat-controls,
.sorty-skin-controls,
.sorty-shape-controls {
  display: grid;
  gap: 10px;
}

.sorty-hat-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sorty-skin-controls,
.sorty-shape-controls {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.sorty-skin-controls {
  margin-top: 10px;
}

.sorty-face-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.sorty-face-option {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}

.sorty-face-option.active {
  border-color: var(--pink);
  box-shadow: 0 0 0 1px rgba(255, 79, 216, 0.48), 0 0 22px rgba(255, 79, 216, 0.2);
}

.sorty-face-option img {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
}

.sorty-face-default {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #080810;
  background: linear-gradient(160deg, #fefefe, #b8f7ff);
  font-weight: 900;
}

.sorty-hat-controls input[type="range"],
.sorty-skin-controls input[type="range"],
.sorty-shape-controls input[type="range"] {
  width: 100%;
}

.sorty-editor-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.sorty-editor-actions button {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 850;
}

.admin-panel {
  position: fixed;
  top: 90px;
  right: var(--admin-side-gutter);
  bottom: 18px;
  z-index: 24;
  width: min(calc(var(--side-panel-width) - var(--admin-side-gutter) * 2), calc(100vw - var(--admin-side-gutter) * 2));
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(255, 79, 216, 0.42);
  border-radius: 8px;
  background: rgba(15, 15, 28, 0.92);
  backdrop-filter: blur(14px) saturate(1.15);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.52),
    0 0 34px rgba(255, 79, 216, 0.12);
}

.admin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 8px;
  background: rgba(15, 15, 28, 0.96);
}

.admin-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-panel-header-actions .icon-button {
  width: 36px;
  height: 36px;
}

.admin-collapsed-scene-controls {
  display: none;
}

.admin-panel.collapsed {
  bottom: auto;
  width: min(calc(var(--side-panel-width) - var(--admin-side-gutter) * 2), calc(100vw - var(--admin-side-gutter) * 2));
  overflow: hidden;
  padding: 9px 10px;
}

.admin-panel.collapsed .admin-panel-header {
  padding-bottom: 0;
}

.admin-panel.collapsed .admin-panel-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.admin-panel.collapsed .admin-panel-header > strong {
  display: none;
}

.admin-panel.collapsed .admin-collapsed-scene-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.admin-collapsed-scene-controls button {
  min-height: 32px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 0.73rem;
  font-weight: 850;
}

.admin-panel.collapsed .admin-section,
.admin-panel.collapsed .admin-form {
  display: none;
}

.admin-section,
.admin-form {
  flex: 0 0 auto;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.admin-collapsible {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.admin-section-toggle {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 900;
  text-align: left;
}

.admin-section-body {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.admin-collapsible.collapsed .admin-section-body {
  display: none;
}

.admin-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.admin-section input,
.admin-section select {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.24);
  outline: none;
}

.admin-section input[type="range"] {
  padding: 0;
}

.admin-check {
  display: flex !important;
  align-items: center;
  grid-template-columns: auto 1fr;
  gap: 10px !important;
}

.admin-section .admin-check input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 auto;
}

.admin-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-grid.two {
  grid-template-columns: 1fr 88px;
}

.admin-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.admin-scene-list {
  max-height: 190px;
  overflow: auto;
  display: grid;
  gap: 7px;
}

.admin-scene-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-scene-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(104px, 128px) 38px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.18);
}

.admin-scene-row strong,
.admin-scene-row small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-scene-row small {
  color: var(--muted);
  font-size: 0.74rem;
}

.admin-scene-row select {
  min-height: 32px;
}

.admin-scene-row button {
  min-height: 32px;
  padding: 0;
}

.admin-move-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.admin-move-pad button:first-child,
.admin-move-pad button:last-child {
  grid-column: 2;
}

.admin-transform-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.admin-section button {
  min-height: 38px;
  border-radius: 8px;
  font-weight: 850;
}

.admin-collapsible > .admin-section-toggle {
  min-height: 42px;
  border-radius: 0;
}

.admin-section button.danger {
  border-color: rgba(255, 111, 145, 0.55);
  background: rgba(255, 111, 145, 0.13);
}

select.native-select-hidden {
  display: none !important;
}

.custom-select {
  width: 100%;
  min-width: 0;
  position: relative;
}

.custom-select .custom-select-button {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.24);
  font: inherit;
  font-weight: 850;
  text-align: left;
  outline: none;
}

.custom-select .custom-select-button::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid rgba(235, 244, 255, 0.74);
  border-bottom: 2px solid rgba(235, 244, 255, 0.74);
  transform: translateY(-2px) rotate(45deg);
}

.custom-select.open .custom-select-button {
  border-color: rgba(56, 217, 255, 0.66);
  box-shadow: 0 0 0 1px rgba(56, 217, 255, 0.18);
}

.custom-select.drop-up .custom-select-button::after {
  transform: translateY(2px) rotate(225deg);
}

.custom-select.disabled {
  opacity: 0.55;
}

.custom-select-menu {
  position: fixed;
  z-index: 90;
  display: grid;
  gap: 3px;
  overflow: auto;
  padding: 5px;
  border: 1px solid rgba(56, 217, 255, 0.34);
  border-radius: 8px;
  background: rgba(10, 12, 24, 0.98);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.48),
    0 0 22px rgba(56, 217, 255, 0.12);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  border-color: rgba(56, 217, 255, 0.38);
  background: rgba(56, 217, 255, 0.11);
}

.custom-select-option.active {
  border-color: rgba(255, 79, 216, 0.54);
  background: rgba(255, 79, 216, 0.16);
}

.custom-select-option:disabled {
  opacity: 0.42;
}

.admin-scene-row .custom-select .custom-select-button {
  min-height: 32px;
  padding: 0 9px;
  font-size: 0.78rem;
}

.sorty-editor.onboarding .modal-close {
  display: none;
}

@media (max-width: 980px) {
  .game-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 84px minmax(0, 1fr) 42vh;
  }

  .building-modal {
    top: 84px;
    right: 0;
    bottom: 42vh;
    left: 0;
  }

  .building-modal-card {
    width: min(760px, calc(100vw - 32px));
  }

  .hud-top {
    grid-template-columns: minmax(220px, 1fr) minmax(140px, 180px) minmax(140px, 180px);
    grid-auto-rows: minmax(42px, auto);
  }

  .side-panel {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .role-grid {
    grid-template-columns: 1fr;
  }

  .role-card {
    min-height: clamp(280px, 42vh, 420px);
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }

  .building-modal-actions {
    grid-template-columns: 1fr;
  }

  .building-modal-grid {
    grid-template-columns: 1fr;
  }

  .quick-start-grid {
    grid-template-columns: 1fr;
  }

  .building-modal-meters {
    grid-template-columns: 1fr;
  }

  .sorty-editor-body {
    grid-template-columns: 1fr;
  }

  .sorty-preview-wrap {
    min-height: 300px;
  }
}

@media (max-width: 620px) {
  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
  }

  .game-shell {
    grid-template-rows: 148px minmax(0, 1fr) 42vh;
  }

  .building-modal {
    top: 148px;
  }

  .quick-start {
    padding: 14px;
  }

  .quick-start-card {
    width: calc(100vw - 28px);
    max-height: calc(100vh - 28px);
    padding: 18px;
  }

  .quick-start-footer {
    grid-template-columns: 1fr;
  }

  .hud-top {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 10px;
  }

  .connection-notice {
    top: 160px;
  }

  .hud-top .meter-group,
  .hud-top .icon-button {
    order: 1;
  }

  .city-status {
    order: 0;
    grid-column: 1 / -1;
    padding-right: 0;
    padding-bottom: 12px;
  }

  .city-status::after {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  }
}
