:root {
  --bg: #f5f7fb;
  --paper: #ffffff;
  --paper-soft: #f9fbfe;
  --ink: #101828;
  --muted: #667085;
  --quiet: #98a2b3;
  --line: #d9e4f2;
  --line-soft: #edf2f7;
  --blue: #2563eb;
  --green: #0f9f6e;
  --red: #e5484d;
  --yellow: #f59e0b;
  --teal: #14b8a6;
  --violet: #8b5cf6;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
  --soft-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  --radius: 8px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #fbfcff 0%, var(--bg) 34rem);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  width: min(1340px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 22px 28px;
}

.topbar {
  display: grid;
  grid-template-columns: 240px minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: center;
}

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

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  padding: 7px;
  border-radius: var(--radius);
  background: #101828;
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.18);
  flex: 0 0 auto;
}

.brand-mark span {
  border-radius: 4px;
}

.brand-mark span:nth-child(1) { background: #2563eb; }
.brand-mark span:nth-child(2) { background: #ef4444; }
.brand-mark span:nth-child(3) { background: #10b981; }
.brand-mark span:nth-child(4) { background: #f59e0b; }

.brand-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 23px;
  font-weight: 850;
  line-height: 1;
}

.brand-sub {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 6px 7px 6px 16px;
  border: 1px solid #cbd7ea;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.10);
}

.search-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 7px;
  background: #edf4ff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 900;
  flex: 0 0 auto;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 680;
}

.search input::placeholder {
  color: #697586;
  opacity: 1;
}

.key-hint {
  position: absolute;
  top: 50%;
  right: 92px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--soft-shadow);
  color: var(--quiet);
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
  pointer-events: none;
}

.search:focus-within .key-hint {
  display: none;
}

.go,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 820;
  white-space: nowrap;
}

.go {
  min-width: 72px;
  border: 0;
  background: #101828;
  color: #ffffff;
}

.button {
  min-width: 78px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: #243044;
}

.button:hover,
.go:hover {
  transform: translateY(-1px);
}

.button.primary,
.button.dark {
  border-color: #101828;
  background: #101828;
  color: #ffffff;
}

.button.compact {
  min-width: 0;
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.top-actions {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
}

.suggest {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  z-index: 30;
  display: none;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.suggest.open {
  display: grid;
  gap: 2px;
}

.suggest-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.suggest-item.selected,
.suggest-item:hover {
  background: #edf4ff;
}

.suggest-domain {
  overflow: hidden;
  max-width: 180px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 650;
}

.town-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}

.game-stage,
.district-panel,
.dock {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.game-stage {
  padding: 14px;
}

.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stage-actions {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: center;
}

.errand-pill {
  border-color: #cddcf5;
  background: #edf4ff;
  color: #1d4ed8;
}

.errand-pill.all-done {
  border-color: #bbe7c8;
  background: #ecfdf1;
  color: #087443;
}

.coin-pill {
  border-color: #f2d28a;
  background: #fff8e1;
  color: #8a5a00;
}

.coin-pill.earned {
  animation: coin-pop 520ms ease;
}

@keyframes coin-pop {
  0% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-2px) scale(1.08); }
  100% { transform: translateY(0) scale(1); }
}

.errand-drop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: none;
  width: min(300px, 84vw);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.errand-drop.open {
  display: grid;
  gap: 4px;
}

.errand-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #f9fbfe;
  color: #243044;
  text-align: left;
  font-size: 13px;
  font-weight: 760;
}

.errand-row:hover {
  border-color: #bdcbe0;
}

.errand-row.done {
  opacity: 0.62;
  text-decoration: line-through;
}

.errand-check {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1.5px solid #98a2b3;
  border-radius: 6px;
  background: #ffffff;
  color: #087443;
  font-size: 12px;
  font-weight: 900;
}

.errand-row.done .errand-check {
  border-color: #12b76a;
  background: #ecfdf1;
}

.errand-note {
  margin: 4px 2px 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
}

.kicker {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 840;
}

h1,
h2,
p {
  margin-top: 0;
}

.stage-head h1,
.panel-head h2 {
  margin: 0;
  color: var(--ink);
  line-height: 1.05;
}

.stage-head h1 {
  font-size: clamp(22px, 2.2vw, 31px);
}

.town-map {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: clamp(420px, 56vh, 560px);
  border: 1px solid #c7d6e7;
  border-radius: var(--radius);
  outline: 0;
  background: #7ec97a;
  touch-action: none;
}

.interaction-prompt {
  position: absolute;
  z-index: 40;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 24px);
  min-height: 38px;
  padding: 6px 12px 6px 7px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 7px;
  background: rgba(16, 24, 40, 0.94);
  color: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.28);
  font: 800 13px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
  animation: interaction-in 140ms ease-out;
}

.interaction-prompt[hidden] { display: none; }

.interaction-prompt__key {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-bottom-width: 3px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 10px;
  text-transform: uppercase;
}

.interaction-prompt__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-prompt.is-urgent { background: rgba(15, 118, 110, 0.96); }

.mobile-controls,
.mobile-directory-toggle,
.mobile-sheet-close { display: none; }

@keyframes interaction-in {
  from { opacity: 0; transform: translate(-50%, 5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 720px), (pointer: coarse) {
  body { overscroll-behavior: none; }

  .mobile-directory-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 36;
    display: block;
    min-width: 54px;
    min-height: 36px;
    padding: 7px 10px;
    border: 2px solid rgba(255, 255, 255, 0.94);
    border-radius: 7px;
    background: rgba(16, 24, 40, 0.9);
    color: #fff;
    font: 850 12px/1 Inter, system-ui, sans-serif;
    letter-spacing: 0;
  }

  .mobile-controls {
    position: absolute;
    inset: auto 12px 12px;
    z-index: 35;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    pointer-events: none;
  }

  .mobile-controls button { pointer-events: auto; touch-action: none; user-select: none; }
  .mobile-dpad {
    display: grid;
    grid-template-columns: repeat(3, 52px);
    grid-template-rows: repeat(2, 52px);
    gap: 3px;
  }
  .mobile-dpad button {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: rgba(16, 24, 40, 0.72);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 4px 12px rgba(16, 24, 40, 0.22);
  }
  .mobile-dpad button.active { background: rgba(15, 118, 110, 0.94); transform: scale(0.94); }
  .mobile-dpad [data-mobile-move="w"] { grid-column: 2; grid-row: 1; }
  .mobile-dpad [data-mobile-move="a"] { grid-column: 1; grid-row: 2; }
  .mobile-dpad [data-mobile-move="s"] { grid-column: 2; grid-row: 2; }
  .mobile-dpad [data-mobile-move="d"] { grid-column: 3; grid-row: 2; }
  .mobile-action {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin: 0 6px 5px 0;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #e34856;
    color: #fff;
    font: 900 23px/1 Inter, system-ui, sans-serif;
    box-shadow: 0 5px 16px rgba(95, 26, 35, 0.28);
  }
  .interaction-prompt { bottom: 126px; }
  .town-map:has(.interior.open) .mobile-controls,
  .town-map:has(.interior.open) .mobile-directory-toggle { display: none; }
}

@media (max-width: 520px) {
  .interaction-prompt {
    bottom: 10px;
    min-height: 42px;
    font-size: 12px;
  }
  .interaction-prompt__key { font-size: 0; }
  .interaction-prompt__key::after { content: "Tap"; font-size: 10px; }
}

.town-map canvas {
  display: block;
  border-radius: calc(var(--radius) - 1px);
}

.vr-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(8, 10, 22, 0.22) 100%);
}

body.immersed .game-stage {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px;
  border-radius: 0;
}

body.immersed .town-map {
  flex: 1;
  height: auto;
}

body.immersed .vr-vignette {
  background: radial-gradient(ellipse at center, transparent 52%, rgba(8, 10, 22, 0.4) 100%);
}

body.immersed .control-strip {
  margin-top: 8px;
}

.town-map .night-tint {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transition: background 1200ms ease;
}

.map-hud {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 8;
  width: 154px;
  padding: 7px;
  border: 1px solid rgba(16, 24, 40, 0.38);
  border-radius: 8px;
  background: rgba(250, 252, 255, 0.82);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.16);
  backdrop-filter: blur(8px);
  color: #101828;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
  transform-origin: left bottom;
  transition: opacity 160ms ease, transform 160ms ease;
}

.map-hud.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.map-hud__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 9.5px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.map-hud__status {
  max-width: 72px;
  overflow: hidden;
  color: #536277;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-hud__field {
  position: relative;
  height: 74px;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 40, 0.28);
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 9%, rgba(34, 197, 94, 0.2), transparent 16%),
    radial-gradient(circle at 92% 50%, rgba(14, 165, 233, 0.18), transparent 14%),
    radial-gradient(circle at 8% 50%, rgba(245, 158, 11, 0.18), transparent 14%),
    radial-gradient(circle at 50% 91%, rgba(139, 92, 246, 0.18), transparent 16%),
    #dcebcf;
}

.map-hud__field[data-zone="estate"] {
  background:
    linear-gradient(90deg, #4f9fdd 0 18%, transparent 18%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.62) 0 36%, transparent 36%),
    #9ccf81;
}

.map-hud__field[data-zone="sea"] {
  background:
    linear-gradient(180deg, #f2d68f 0 76%, #4f9fdd 76%),
    #f2d68f;
}

.map-hud__field::before,
.map-hud__field::after {
  content: "";
  position: absolute;
  background: rgba(158, 121, 69, 0.48);
  pointer-events: none;
}

.map-hud__field::before {
  top: 47%;
  left: 0;
  width: 100%;
  height: 8px;
}

.map-hud__field::after {
  top: 0;
  left: 48%;
  width: 8px;
  height: 100%;
}

.map-hud__field[data-zone="estate"]::before,
.map-hud__field[data-zone="estate"]::after,
.map-hud__field[data-zone="sea"]::before,
.map-hud__field[data-zone="sea"]::after {
  display: none;
}

.map-dot,
.map-player {
  position: absolute;
  translate: -50% -50%;
  border-radius: 999px;
}

.map-dot {
  z-index: 2;
  display: grid;
  width: 13px;
  height: 13px;
  place-items: center;
  border: 1px solid #101828;
  background: var(--dot-color, #2563eb);
  color: #ffffff;
  font-size: 6.5px;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 2px 4px rgba(16, 24, 40, 0.18);
  cursor: pointer;
}

.map-dot--landmark {
  cursor: default;
}

.map-dot--exit {
  width: 15px;
  height: 15px;
  border-color: rgba(16, 24, 40, 0.62);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.52), 0 2px 5px rgba(16, 24, 40, 0.18);
}

.map-dot--building {
  width: 9px;
  height: 9px;
  border-color: rgba(16, 24, 40, 0.58);
  font-size: 0;
}

.map-dot--building::after {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
}

.map-dot.active {
  z-index: 4;
  transform: scale(1.22);
  box-shadow: 0 0 0 3px rgba(255, 215, 102, 0.72), 0 3px 8px rgba(16, 24, 40, 0.28);
}

.map-dot--building.active {
  width: 13px;
  height: 13px;
  font-size: 6.5px;
}

.map-dot--building.active::after {
  content: none;
}

.map-player {
  z-index: 5;
  width: 10px;
  height: 10px;
  border: 2px solid #101828;
  background: #ffd766;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9), 0 3px 7px rgba(16, 24, 40, 0.32);
}

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #f9fbfe;
}

.key-cluster {
  display: grid;
  width: 92px;
  grid-template-columns: repeat(3, 28px);
  gap: 4px;
}

.key {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #cbd7ea;
  border-radius: 6px;
  background: #ffffff;
  color: #344054;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 2px 0 #d9e4f2;
}

.key.active {
  border-color: #101828;
  background: #101828;
  color: #ffffff;
  box-shadow: 0 2px 0 #667085;
}

.key-up {
  grid-column: 2;
}

.avatar-tools {
  display: grid;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 720px) {
  .avatar-swatch {
    width: 26px;
    height: 26px;
    background-size: 78px 208px;
    background-position: -26px -3px;
  }

  .tone-dot {
    width: 18px;
    height: 18px;
  }
}

/* Phone game shell: keep the world in the first viewport and move the web directory to a sheet. */
@media (max-width: 720px) {
  .app-shell { padding: 8px; }
  .topbar {
    position: relative;
    z-index: 20;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 8px;
  }
  .brand-sub { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .search { grid-column: 2; min-height: 42px; }
  .top-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .top-actions .button { flex: 1 0 auto; min-height: 36px; padding: 7px 10px; }
  .town-layout { display: block; }
  .game-stage { padding: 8px; }
  .stage-head { margin-bottom: 7px; }
  .stage-head h1 { font-size: 20px; }
  .stage-actions { gap: 4px; }
  .stage-actions .button { width: auto; min-height: 32px; padding: 6px 8px; font-size: 10px; }
  #immerseButton, #centerPlayer { display: none; }
  .town-map {
    height: clamp(470px, calc(100svh - 235px), 640px);
    min-height: 470px;
    border-radius: 6px;
  }
  .town-map:has(.interior.open) { height: min(82svh, 720px); min-height: 560px; }
  .control-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 7px 0 0;
  }
  .control-strip .avatar-tools,
  .control-strip .touch-hint,
  .control-strip #enterButton,
  .control-strip #openDefaultButton,
  .control-strip #randomStopButton { display: none; }
  .control-strip .button { width: 100%; min-width: 0; padding: 6px 3px; font-size: 9px; }
  .dock { display: none; }

  .district-panel {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 84;
    display: block;
    width: 100%;
    max-height: 72svh;
    overflow-y: auto;
    padding: 42px 12px 14px;
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    background: #fff;
    box-shadow: 0 -18px 42px rgba(15, 23, 42, 0.22);
    transform: translateY(105%);
    transition: transform 220ms ease;
  }
  body.mobile-directory-open .district-panel { transform: translateY(0); }
  body.mobile-directory-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 83;
    background: rgba(16, 24, 40, 0.34);
  }
  .mobile-sheet-close {
    position: absolute;
    top: 9px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #f4f6fa;
    color: #253044;
  }
  .category-strip { position: sticky; top: -1px; z-index: 2; background: #fff; }
  .adventure-panel { top: 112px; bottom: auto; left: 14px; width: min(300px, calc(100vw - 86px)); }
  .rewards-drawer { width: 100vw; padding: 14px; }
}

@media (max-width: 400px) {
  .town-map { min-height: 440px; height: clamp(440px, calc(100svh - 225px), 590px); }
  .mobile-dpad { grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); }
  .mobile-dpad button { width: 48px; height: 48px; }
  .mobile-action { width: 62px; height: 62px; }
}

.picker-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.avatar-swatch {
  box-sizing: content-box;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 8px;
  background-color: #dcefdb;
  background-repeat: no-repeat;
  background-size: 96px 256px;
  background-position: -32px -4px;
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px var(--line), 0 2px 0 #d9e4f2;
}

.avatar-swatch.active {
  box-shadow: 0 0 0 2px #101828, 0 3px 0 #d9e4f2;
}

.avatar-swatch[data-value="crab"] {
  background-color: #dff0fa;
  background-position: -32px -34px; /* the crab lives in the lower half of the frame */
}

/* identity ring on YOUR avatar inside interiors */
.dom-avatar:not(.keeper)::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 4px;
  height: 12px;
  border: 2px solid rgba(255, 201, 74, 0.95);
  border-radius: 50%;
  animation: mering 0.9s ease-in-out infinite;
}

@keyframes mering {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 201, 74, 0.5); opacity: 0.95; }
  50% { box-shadow: 0 0 0 4px rgba(255, 201, 74, 0.06); opacity: 0.6; }
}

.tone-dot {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--dot, #ccc);
  box-shadow: 0 0 0 1px var(--line);
}

.tone-dot.active {
  box-shadow: 0 0 0 2px #101828;
}

.avatar-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 40, 0.42);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, visibility 0s linear 160ms;
}

.avatar-modal.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0s;
}

.avatar-card {
  width: min(560px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.3);
}

.avatar-menu-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.avatar-menu-head h2 { margin: 0; font-size: 22px; }

.avatar-preview {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 10px 14px;
  border: 1px solid #cbd7ea;
  border-radius: 8px;
  background: #eef8ee;
}

.avatar-preview-sprite {
  display: block;
  width: 64px;
  height: 72px;
  background-repeat: no-repeat;
  background-position: -64px -8px;
  background-size: 192px 512px;
  image-rendering: pixelated;
}

.avatar-preview-sprite[data-value="crab"] { background-position: -64px -68px; }
.avatar-preview-copy span,
.avatar-preview-copy strong,
.avatar-preview-copy small { display: block; }
.avatar-preview-copy span { color: var(--muted); font-size: 11px; font-weight: 800; }
.avatar-preview-copy strong { margin-top: 2px; color: var(--ink); font-size: 20px; }
.avatar-preview-copy small { margin-top: 4px; color: #475467; font-size: 12px; font-weight: 700; }

.avatar-option-list { display: grid; gap: 14px; }
.avatar-option-group { min-width: 0; margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line-soft); }
.avatar-option-group legend { padding: 0 8px 0 0; color: #344054; font-size: 12px; font-weight: 850; }
.avatar-card .avatar-swatch { width: 42px; height: 42px; background-size: 126px 336px; background-position: -42px -5px; }
.avatar-card .avatar-swatch[data-value="crab"] { background-position: -42px -45px; }
.avatar-card .tone-dot { width: 30px; height: 30px; }

@media (max-width: 720px) {
  .avatar-modal { place-items: end stretch; padding: 0; }
  .avatar-card {
    width: 100%;
    max-height: min(86dvh, 700px);
    padding: 14px max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }
  .avatar-preview { grid-template-columns: 64px minmax(0, 1fr); min-height: 82px; padding: 7px 10px; }
  .avatar-preview-sprite { transform: scale(0.84); transform-origin: center; }
}

.touch-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 230px;
  min-height: 34px;
  max-width: 360px;
  padding: 7px 10px;
  border: 1px solid #cbd7ea;
  border-radius: 8px;
  background: #ffffff;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 2px 0 #d9e4f2;
}

@media (pointer: coarse) {
  .key-cluster { display: none; }
}

@media (max-width: 520px) {
  .key-cluster {
    display: none;
  }

  .touch-hint {
    order: -1;
    flex-basis: 100%;
    max-width: none;
  }

  .avatar-tools {
    justify-content: center;
    width: 100%;
  }
}

.district-panel {
  overflow: hidden;
}

.panel-head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line-soft);
}

.district-icon,
.site-icon,
.quick-icon {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent, var(--blue));
  box-shadow: inset 0 -12px 20px rgba(0, 0, 0, 0.16);
  font-weight: 900;
}

.district-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  font-size: 16px;
}

.panel-head h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 26px;
}

.panel-head p:last-child {
  overflow: hidden;
  margin: 5px 0 0;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.district-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.default-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin: 12px;
  padding: 11px;
  border: 1px solid #cddcf5;
  border-radius: var(--radius);
  background: #edf4ff;
}

.default-label {
  padding: 4px 7px;
  border-radius: 6px;
  background: #ffffff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
}

.default-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.category-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
}

.category-chip {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 0 9px 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.category-chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip-accent);
}

.category-chip.active {
  border-color: var(--chip-accent);
  background: color-mix(in srgb, var(--chip-accent) 10%, #ffffff);
}

.site-list {
  display: grid;
  gap: 7px;
  padding: 0 12px 12px;
}

.site-row {
  display: grid;
  grid-template-columns: 28px 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #ffffff;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.site-row:hover {
  border-color: #bdcbe0;
  background: #f8fbff;
  transform: translateY(-1px);
}

.site-row.is-default {
  border-color: color-mix(in srgb, var(--accent) 42%, #d9e4f2);
  background: color-mix(in srgb, var(--accent) 7%, #ffffff);
}

.site-row.is-custom .rank {
  background: #fff7ed;
  color: #c2410c;
}

.rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: #f1f5f9;
  color: #647084;
  font-size: 12px;
  font-weight: 900;
}

.site-icon,
.quick-icon {
  position: relative;
  overflow: hidden;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  font-size: 12px;
}

.favicon {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding: 16%;
  border-radius: inherit;
  background: #ffffff;
  object-fit: contain;
}

.site-copy {
  min-width: 0;
}

.site-name,
.site-note,
.domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-name {
  display: block;
  color: #243044;
  font-size: 14px;
  font-weight: 860;
}

.site-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

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

.site-mini {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: #4d5b70;
  font-size: 11px;
  font-weight: 820;
}

.site-mini.dark {
  border-color: #101828;
  background: #101828;
  color: #ffffff;
}

.site-mini.danger {
  border-color: #fee2e2;
  background: #fff5f5;
  color: #b42318;
}

.site-mini.favorite-action {
  width: 30px;
  padding: 0;
  justify-content: center;
  border-color: #f2c94c;
  background: #fffbea;
  color: #9a6700;
  font-size: 17px;
  line-height: 1;
}

.site-row.is-favorite { box-shadow: inset 3px 0 0 #f2c94c; }

.site-mini[disabled] {
  opacity: 0.58;
  cursor: default;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto;
  gap: 8px;
  padding: 0 12px 14px;
}

.add-form input {
  min-width: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}

.add-form input:focus {
  border-color: #8fb4f8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.dock {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
}

#favoritesDock { grid-column: 1 / -1; }
#favoritesDock .quick-row { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }

.quick-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.quick-tile {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.quick-tile:hover {
  border-color: #bdcbe0;
}

.quick-icon {
  width: 34px;
  height: 34px;
  font-size: 11px;
}

.quick-copy {
  min-width: 0;
}

.quick-name,
.quick-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-name {
  color: #243044;
  font-size: 12px;
  font-weight: 860;
}

.quick-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid #cddcf5;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  color: #243044;
  font-size: 13px;
  font-weight: 760;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.credits-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(16, 24, 40, 0.46);
}

.credits-modal.open {
  display: flex;
}

.credits-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.credits-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.credits-head .button { flex: 0 0 auto; width: auto; min-width: 72px; }

.credits-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.credits-copy {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.credits-list {
  display: grid;
  gap: 8px;
}

.credits-list p {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #f9fbfe;
  color: #344054;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.45;
}

.credits-list code {
  font-size: 12px;
  font-weight: 800;
}


.edit-mode .site-mini[data-action="default"] {
  border-color: var(--accent, var(--blue));
  color: var(--accent, var(--blue));
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .town-layout {
    grid-template-columns: 1fr;
  }

  .district-panel {
    order: 2;
  }

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

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .brand-name {
    font-size: 20px;
  }

  .search {
    min-height: 50px;
    gap: 8px;
    padding-left: 12px;
  }

  .search input {
    font-size: 14px;
  }

  .key-hint {
    display: none;
  }

  .go {
    min-width: 64px;
  }

  .town-map {
    height: 360px;
  }

  .town-map:has(.interior.open) {
    height: min(78vh, 680px);
    min-height: 520px;
  }

  .map-hud {
    width: 144px;
    padding: 7px;
  }

  .map-hud__field {
    height: 74px;
  }

  .map-hud__status {
    max-width: 56px;
  }




  .control-strip {
    align-items: stretch;
  }

  .site-row {
    grid-template-columns: 24px 34px minmax(0, 1fr);
  }

  .site-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .add-form {
    grid-template-columns: 1fr;
  }

  .quick-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .button {
    width: 100%;
  }

  .search .go {
    width: auto;
    flex: 0 0 64px;
  }

  .stage-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .town-map {
    height: 340px;
  }

  .town-map:has(.interior.open) {
    height: min(80vh, 650px);
    min-height: 500px;
  }

  .map-hud {
    left: 8px;
    bottom: 8px;
    width: 126px;
  }

  .map-hud__head {
    font-size: 9px;
  }

  .map-hud__status {
    display: none;
  }

  .map-dot {
    width: 12px;
    height: 12px;
    font-size: 5.5px;
  }

  .map-dot--building {
    width: 9px;
    height: 9px;
    font-size: 0;
  }

  .map-dot--building.active {
    width: 12px;
    height: 12px;
    font-size: 5.5px;
  }

  .map-dot--exit {
    width: 14px;
    height: 14px;
  }

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

.friends-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  width: min(340px, 92vw);
  padding: 16px;
  border-left: 1px solid var(--line);
  background: #ffffff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.14);
  transform: translateX(105%);
  transition: transform 200ms ease;
}

.friends-drawer.open {
  transform: translateX(0);
}

.rewards-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 72;
  display: flex;
  flex-direction: column;
  width: min(460px, 96vw);
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -18px 0 48px rgba(15, 23, 42, 0.16);
  transform: translateX(105%);
  transition: transform 200ms ease;
}

.rewards-drawer.open { transform: translateX(0); }

.drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.drawer-head h2 { margin: 0; font-size: 22px; }
.drawer-balance { color: #835400; font-size: 13px; font-weight: 850; }

.reward-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f4f6fa;
}

.reward-tabs button {
  min-width: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #5a667a;
  font: 800 12px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}

.reward-tabs button.active { background: #fff; color: #101828; box-shadow: 0 1px 4px rgba(16, 24, 40, 0.12); }

.rewards-list {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 2px;
}

.reward-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 66px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: #fbfcfe;
}

.reward-item.equipped { border-color: #0f9f7f; background: #effcf7; }
.reward-preview { display: grid; place-items: center; width: 52px; height: 50px; border-radius: 6px; background: #edf1f7; overflow: hidden; }
.reward-preview img { max-width: 44px; max-height: 42px; image-rendering: pixelated; }
.reward-preview img[src*="animals"] { width: 36px; max-width: none; object-fit: none; object-position: left top; }
.reward-color { width: 30px; height: 30px; border: 4px solid #fff; border-radius: 50%; background: var(--reward-color); box-shadow: 0 0 0 1px rgba(16, 24, 40, 0.24); }
.reward-copy { min-width: 0; }
.reward-copy strong, .reward-copy span { display: block; }
.reward-copy strong { color: #1c2738; font-size: 13px; }
.reward-copy span { margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 650; line-height: 1.3; }
.reward-item > button {
  min-width: 74px;
  padding: 8px;
  border: 1px solid #101828;
  border-radius: 6px;
  background: #101828;
  color: #fff;
  font: 800 11px/1 Inter, system-ui, sans-serif;
  letter-spacing: 0;
  cursor: pointer;
}
.reward-item > button:disabled { border-color: var(--line); background: #edf0f5; color: #7b8798; cursor: default; }

.adventure-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 58;
  width: min(330px, calc(100vw - 36px));
  padding: 12px 38px 12px 13px;
  border: 1px solid #d5b45a;
  border-radius: 7px;
  background: #fffbea;
  box-shadow: 0 10px 28px rgba(60, 44, 5, 0.18);
  color: #342a12;
}

.adventure-panel[hidden] { display: none; }
.adventure-panel strong { display: block; margin-top: 8px; font-size: 14px; }
.adventure-panel p { margin: 3px 0 0; color: #665324; font-size: 12px; font-weight: 700; line-height: 1.35; }
.adventure-panel > button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b5a2e;
  cursor: pointer;
}

.adventure-progress { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; font-size: 10px; font-weight: 850; }
.adventure-progress > span:last-child { position: relative; height: 5px; overflow: hidden; border-radius: 3px; background: #eadfb8; }
.adventure-progress > span:last-child::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--progress, 0%); background: #d29814; transition: width 220ms ease; }
.quest-pill { border-color: #dbc169; background: #fff8db; color: #604913; }

.friends-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.friends-head h2 {
  margin: 0;
  font-size: 22px;
}

.friends-list {
  display: grid;
  gap: 8px;
}

.friend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: #f9fbfe;
}

.friend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, 0.16);
}

.friend-name {
  display: block;
  font-size: 14px;
  font-weight: 860;
  color: #243044;
}

.friend-note {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.chillvote-card {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cddcf5;
  border-radius: var(--radius);
  background: #edf4ff;
}

.chillvote-card strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.chillvote-card p {
  margin: 0 0 10px;
  color: #44546c;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
}

.chillvote-card .button[disabled] {
  width: 100%;
  opacity: 0.72;
  cursor: default;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  margin-top: 12px;
  padding: 4px 2px;
  min-height: 60px;
}

.chat-line {
  margin: 0 0 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: #344054;
}

.chat-line strong {
  color: #101828;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.chat-form input {
  min-width: 0;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  font-size: 13px;
  font-weight: 680;
}

.chat-form input:focus {
  border-color: #8fb4f8;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.button.active {
  border-color: #101828;
  background: #eef2f9;
}


/* ------------------------------------------------------------ venue interiors */
.interior {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

/* In-world arcade booths: a self-hosted open-source game in a friendly frame */
.arcade {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: none;
  flex-direction: column;
  background: rgba(9, 12, 20, 0.94);
}

.arcade.open {
  display: flex;
}

/* While a booth is open, the game owns the screen: walking controls,
   interaction prompt, and the mobile Sites toggle all stand down. */
.town-map:has(.arcade.open) .mobile-controls,
.town-map:has(.arcade.open) .interaction-prompt,
.town-map:has(.arcade.open) .mobile-directory-toggle {
  display: none;
}

.arcade-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
}

.arcade-title {
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.arcade iframe {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
}

.arcade-credit {
  color: #cbd5e1;
  font-size: 11px;
  line-height: 1.5;
  padding: 6px 12px;
}

.arcade-credit a {
  color: #93c5fd;
}

.interior.open {
  opacity: 1;
}

.room2 {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 6px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.35);
  pointer-events: auto;
}

.room2-head {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--room-accent, #2563eb) 7%, #ffffff);
}

.room2-head .district-icon {
  width: 44px;
  height: 44px;
  font-size: 14px;
}

.room2-title h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.05;
}

.home-floor-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.home-floor-tab {
  min-width: 88px;
  padding: 5px 8px;
  border: 1.5px solid #d8e0ec;
  border-radius: 7px;
  background: #ffffff;
  color: #243044;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(16, 24, 40, 0.08);
}

.home-floor-tab span,
.home-floor-tab small {
  display: block;
  white-space: nowrap;
}

.home-floor-tab span {
  font-size: 10.5px;
  font-weight: 900;
}

.home-floor-tab small {
  margin-top: 1px;
  color: #64748b;
  font-size: 9px;
  font-weight: 750;
}

.home-floor-tab.active {
  border-color: #101828;
  background: #fff7d6;
  box-shadow: 0 0 0 3px rgba(255, 215, 102, 0.22);
}

.room2-body {
  position: relative;
  display: grid;
  flex: 1;
  grid-template-columns: auto minmax(0, 1fr); /* site list left, shop floor right */
  grid-template-rows: minmax(0, 1fr); /* children never outgrow the room */
  gap: 0;
  overflow: hidden;
  /* game-interior bones: dark back wall band + baseboard + plank floor */
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--room-accent, #2563eb) 30%, #352d44), color-mix(in srgb, var(--room-accent, #2563eb) 16%, #453c58)) top / 100% 88px no-repeat,
    linear-gradient(#101828, #101828) 0 88px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #b98d5f 0 44px, #a87f54 44px 46px, #c2966a 46px 90px, #a87f54 90px 92px);
  background-color: #b98d5f;
}

.home-room .room2-body {
  background:
    linear-gradient(180deg, #2b4258, #445b68) top / 100% 92px no-repeat,
    linear-gradient(#13202e, #13202e) 0 92px / 100% 3px no-repeat,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 22%, transparent 78%, rgba(255, 255, 255, 0.08)),
    repeating-linear-gradient(45deg, #8a6543 0 34px, #6f4d32 34px 37px, #9b7450 37px 70px, #6f4d32 70px 73px);
  background-color: #8a6543;
}

.home-room .room2-body[data-home-floor="0"] {
  background:
    linear-gradient(180deg, #1f2937, #374151) top / 100% 92px no-repeat,
    linear-gradient(#0f172a, #0f172a) 0 92px / 100% 3px no-repeat,
    radial-gradient(ellipse at 58% 52%, rgba(96, 165, 250, 0.12), transparent 48%),
    repeating-linear-gradient(45deg, #4b5563 0 34px, #374151 34px 37px, #5b6472 37px 70px, #374151 70px 73px);
}

.home-room .room2-body[data-home-floor="2"] {
  background:
    linear-gradient(180deg, #4b3a5f, #6f5b75) top / 100% 92px no-repeat,
    linear-gradient(#2d243a, #2d243a) 0 92px / 100% 3px no-repeat,
    repeating-linear-gradient(45deg, #94785d 0 34px, #72533a 34px 37px, #a88a68 37px 70px, #72533a 70px 73px);
}

.home-room .room2-body[data-home-floor="3"] {
  background:
    linear-gradient(180deg, #0e7490, #5ea6bb) top / 100% 92px no-repeat,
    linear-gradient(#134e4a, #134e4a) 0 92px / 100% 3px no-repeat,
    radial-gradient(ellipse at 28% 58%, rgba(103, 232, 249, 0.18), transparent 42%),
    repeating-linear-gradient(45deg, #7aa78d 0 34px, #5f8b74 34px 37px, #92baa0 37px 70px, #5f8b74 70px 73px);
}

.home-room .room2-body[data-home-floor="4"] {
  background:
    linear-gradient(180deg, #0f3f66, #3b82a0) top / 100% 92px no-repeat,
    linear-gradient(#083344, #083344) 0 92px / 100% 3px no-repeat,
    radial-gradient(ellipse at 74% 22%, rgba(254, 240, 138, 0.3), transparent 22%),
    repeating-linear-gradient(45deg, #86a68c 0 34px, #6c8e74 34px 37px, #9fbe9b 37px 70px, #6c8e74 70px 73px);
}

.home-room .room2-head {
  background:
    linear-gradient(90deg, rgba(224, 102, 154, 0.14), rgba(79, 159, 221, 0.12)),
    #ffffff;
}

/* warm light pool over the counter + darker corners */
.room2-body::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(ellipse 320px 150px at 50% 70px, rgba(255, 240, 200, 0.17), transparent 70%),
    radial-gradient(ellipse at 50% 58%, transparent 52%, rgba(18, 12, 30, 0.3) 100%);
}

/* the whole catalog lives on the left, sized so it ALWAYS fits the room —
   1 sub-column up to 6 sites, 2 beyond, compact rows beyond 8 */
.home-room .room2-body::after {
  background:
    radial-gradient(ellipse 360px 160px at 58% 72px, rgba(255, 239, 186, 0.19), transparent 70%),
    radial-gradient(ellipse 260px 110px at 78% 74%, rgba(79, 159, 221, 0.16), transparent 72%),
    radial-gradient(ellipse at 50% 58%, transparent 57%, rgba(10, 15, 25, 0.26) 100%);
}

.home-room-zone {
  position: absolute;
  z-index: 0;
  overflow: hidden;
  border: 2px solid rgba(16, 24, 40, 0.74);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08)),
    var(--zone-bg, #d7b98e);
  box-shadow:
    inset 0 0 0 3px rgba(255, 253, 246, 0.2),
    0 4px 0 rgba(16, 24, 40, 0.18);
  pointer-events: none;
}

.home-room-zone::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed rgba(16, 24, 40, 0.24);
  border-radius: 5px;
}

.home-room-zone::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 36px;
  height: 15px;
  transform: translateX(-50%);
  border: 2px solid rgba(16, 24, 40, 0.7);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(255, 253, 246, 0.82);
}

.home-room-zone span {
  position: absolute;
  left: 8px;
  top: 6px;
  z-index: 1;
  padding: 2px 6px;
  border: 1.5px solid rgba(16, 24, 40, 0.74);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.9);
  color: #172033;
  font-size: 8.5px;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 2px 0 rgba(16, 24, 40, 0.12);
}

.home-room-zone--night { --zone-bg: linear-gradient(135deg, #172554, #111827); }
.home-room-zone--play { --zone-bg: linear-gradient(135deg, #312e81, #0f766e); }
.home-room-zone--warm { --zone-bg: linear-gradient(135deg, #c08457, #a16207); }
.home-room-zone--rose { --zone-bg: linear-gradient(135deg, #f0abfc, #fb7185); }
.home-room-zone--water { --zone-bg: linear-gradient(135deg, #67e8f9, #2563eb); }
.home-room-zone--ocean { --zone-bg: linear-gradient(135deg, #0e7490, #1e3a8a); }
.home-room-zone--cream { --zone-bg: linear-gradient(135deg, #fde68a, #f8fafc); }
.home-room-zone--gold { --zone-bg: linear-gradient(135deg, #fcd34d, #b45309); }
.home-room-zone--library { --zone-bg: linear-gradient(135deg, #7c2d12, #334155); }
.home-room-zone--garden { --zone-bg: linear-gradient(135deg, #86efac, #15803d); }
.home-room-zone--gallery { --zone-bg: linear-gradient(135deg, #f8fafc, #93c5fd); }
.home-room-zone--suite { --zone-bg: linear-gradient(135deg, #fbcfe8, #7c3aed); }
.home-room-zone--study { --zone-bg: linear-gradient(135deg, #cbd5e1, #475569); }
.home-room-zone--music { --zone-bg: linear-gradient(135deg, #fef3c7, #7c2d12); }
.home-room-zone--sky { --zone-bg: linear-gradient(135deg, #bae6fd, #38bdf8); }
.home-room-zone--studio { --zone-bg: linear-gradient(135deg, #fff7ed, #60a5fa 52%, #f87171); }

.home-feature {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  image-rendering: pixelated;
  transition: filter 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.home-feature.is-active {
  filter: brightness(1.16) saturate(1.15);
  transform: translateY(-1px);
}

.home-feature--rug {
  border: 3px solid #43281d;
  border-radius: 48% 48% 12px 12px;
  background:
    radial-gradient(ellipse at 50% 18%, rgba(255, 247, 210, 0.22), transparent 34%),
    linear-gradient(90deg, transparent 0 42%, rgba(255, 255, 255, 0.18) 42% 45%, transparent 45% 55%, rgba(255, 255, 255, 0.18) 55% 58%, transparent 58%),
    repeating-linear-gradient(0deg, #7f1d1d 0 16px, #9f3f2f 16px 19px, #14532d 19px 34px, #0f3f28 34px 37px);
  box-shadow: inset 0 0 0 4px rgba(255, 239, 186, 0.22), 0 7px 0 rgba(16, 24, 40, 0.26);
  opacity: 0.88;
}

.home-feature--hearth {
  border: 3px solid #13202e;
  border-bottom-width: 7px;
  border-radius: 6px 6px 3px 3px;
  background:
    radial-gradient(circle at 50% 76%, #ffd36a 0 7px, #ef4444 8px 15px, transparent 16px),
    linear-gradient(90deg, #6b3f2a 0 16px, #f2dcc0 16px 60px, #6b3f2a 60px);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.35);
  animation: home-firelight 1.2s ease-in-out infinite;
}

.home-feature--hearth::before {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 8px;
  height: 20px;
  border: 2px solid #13202e;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: #2a1d19;
}

.home-feature--theater {
  border: 3px solid #13202e;
  border-radius: 6px;
  background:
    radial-gradient(circle at 28% 76%, #ef4444 0 6px, transparent 7px),
    radial-gradient(circle at 50% 76%, #ef4444 0 6px, transparent 7px),
    radial-gradient(circle at 72% 76%, #ef4444 0 6px, transparent 7px),
    linear-gradient(180deg, #020617 0 58%, #7f1d1d 59% 75%, #450a0a 76%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.38);
}

.home-feature--theater::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 8px;
  height: 22px;
  border: 2px solid #e2e8f0;
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 50%, rgba(96, 165, 250, 0.32), transparent 54%),
    #0f172a;
  animation: home-screen 3.6s steps(4) infinite;
}

.home-feature--terrace {
  border: 3px solid #13202e;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 0 46%, #13202e 46% 49%, transparent 49%),
    linear-gradient(180deg, #bfe3ff 0 43%, #4f9fdd 44% 66%, #74b85d 67%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.32);
}

.home-feature--bar {
  border: 3px solid #13202e;
  border-radius: 7px;
  background:
    radial-gradient(circle at 24px 15px, #60a5fa 0 4px, transparent 5px),
    radial-gradient(circle at 46px 13px, #fbbf24 0 4px, transparent 5px),
    radial-gradient(circle at 68px 16px, #22c55e 0 4px, transparent 5px),
    linear-gradient(180deg, #f8fafc 0 14px, #6b3f2a 15px 100%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34);
}

.home-feature--bar::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  height: 8px;
  border-radius: 4px;
  background: #3a2518;
  box-shadow: 0 -12px 0 rgba(255, 255, 255, 0.16);
}

.home-feature--gallery {
  border: 3px solid #13202e;
  border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 0 22%, #13202e 22% 24%, transparent 24% 48%, #13202e 48% 50%, transparent 50% 74%, #13202e 74% 76%, transparent 76%),
    linear-gradient(180deg, #f8ead1 0 55%, #d6b285 56%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34);
}

.home-feature--gallery::before {
  content: "";
  position: absolute;
  inset: 7px 11px 14px;
  background:
    radial-gradient(circle at 18% 42%, #f43f5e 0 8px, transparent 9px),
    radial-gradient(circle at 51% 40%, #4f9fdd 0 9px, transparent 10px),
    radial-gradient(circle at 82% 42%, #22c55e 0 8px, transparent 9px);
}

.home-feature--aquarium {
  border: 4px solid #13202e;
  border-radius: 8px;
  background:
    radial-gradient(circle at 25% 55%, #fbbf24 0 4px, transparent 5px),
    radial-gradient(circle at 62% 44%, #fb7185 0 4px, transparent 5px),
    radial-gradient(circle at 78% 63%, #22c55e 0 3px, transparent 4px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.18) 0 3px, transparent 3px 12px),
    linear-gradient(180deg, #93c5fd, #38bdf8);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.3);
  animation: home-water 2.4s linear infinite;
}

.home-feature--aquarium::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 8px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.2);
}

.home-feature--aquarium::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 16px;
  width: 14px;
  height: 7px;
  border-radius: 50% 65% 65% 50%;
  background: #f97316;
  box-shadow: 42px 7px 0 #eab308, 78px -2px 0 #ef4444;
  animation: home-fish 4.5s ease-in-out infinite;
}

.home-feature--terrace::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: 8px;
  height: 2px;
  background: #ffffff;
  box-shadow: 0 -10px 0 rgba(255, 255, 255, 0.75), 0 -20px 0 rgba(255, 255, 255, 0.55);
}

.home-feature--pool {
  border: 4px solid #f8fafc;
  border-radius: 9px;
  background:
    linear-gradient(90deg, transparent 0 31%, rgba(255, 255, 255, 0.55) 31% 33%, transparent 33% 64%, rgba(255, 255, 255, 0.55) 64% 66%, transparent 66%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.2) 0 4px, transparent 4px 13px),
    #4f9fdd;
  box-shadow: 0 4px 0 #93c5fd, 0 10px 14px rgba(16, 24, 40, 0.25);
  animation: home-water 2.8s linear infinite;
}

.home-feature--spa {
  border: 4px solid #e2e8f0;
  border-radius: 15px;
  background:
    radial-gradient(circle at 26% 44%, rgba(255, 255, 255, 0.82) 0 4px, transparent 5px),
    radial-gradient(circle at 62% 58%, rgba(255, 255, 255, 0.75) 0 3px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 6px, transparent 6px 16px),
    #38bdf8;
  box-shadow: 0 4px 0 #94a3b8, 0 8px 13px rgba(16, 24, 40, 0.24);
}

.home-feature--spa::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: -16px;
  height: 16px;
  background:
    radial-gradient(ellipse at 24% 100%, rgba(255, 255, 255, 0.66) 0 5px, transparent 7px),
    radial-gradient(ellipse at 54% 100%, rgba(255, 255, 255, 0.58) 0 5px, transparent 8px),
    radial-gradient(ellipse at 78% 100%, rgba(255, 255, 255, 0.54) 0 4px, transparent 7px);
  animation: home-steam 2s ease-in-out infinite;
}

.home-feature--piano {
  border: 3px solid #13202e;
  border-radius: 35px 16px 14px 12px;
  background:
    linear-gradient(90deg, #ffffff 0 35px, #101828 35px 38px, #ffffff 38px 46px, #101828 46px 49px, #ffffff 49px 58px, #101828 58px 61px, #ffffff 61px),
    linear-gradient(145deg, #111827 0 62%, #374151 63%);
  background-size: 70px 13px, auto;
  background-position: 8px 32px, 0 0;
  background-repeat: no-repeat;
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.4);
}

.home-feature--piano::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 16px;
  bottom: -11px;
  height: 8px;
  border-left: 3px solid #13202e;
  border-right: 3px solid #13202e;
}

.home-feature--library {
  border: 3px solid #13202e;
  border-radius: 6px;
  background:
    linear-gradient(90deg, #f97316 0 7px, #f8fafc 7px 11px, #2563eb 11px 17px, #22c55e 17px 24px, #facc15 24px 31px, #e0669a 31px 38px, #8b5cf6 38px 45px, #f8fafc 45px 49px, #14b8a6 49px 56px, #ef4444 56px 64px, #f97316 64px 72px, #f8fafc 72px),
    linear-gradient(180deg, transparent 0 13px, #13202e 13px 16px, transparent 16px 28px, #13202e 28px 31px, transparent 31px),
    #6b3f2a;
  background-size: 76px 12px, auto, auto;
  background-position: 8px 8px, 0 0, 0 0;
  background-repeat: repeat-x, no-repeat, no-repeat;
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.36);
}

.home-feature--library::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 7px;
  border-radius: 4px;
  background: #3a2518;
}

.home-feature--marina {
  border: 3px solid #13202e;
  border-radius: 8px;
  background:
    radial-gradient(circle at 78% 24%, #fff7d6 0 8px, transparent 9px),
    linear-gradient(180deg, #bde7ff 0 42%, #4f9fdd 43% 72%, #0f3f66 73%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.3) 0 8px, transparent 8px 23px);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34);
  overflow: hidden;
}

.home-feature--marina::before {
  content: "";
  position: absolute;
  left: 28px;
  top: 22px;
  width: 54px;
  height: 15px;
  border-radius: 60% 70% 45% 45%;
  background:
    linear-gradient(90deg, #f8fafc 0 68%, #e2e8f0 69%),
    #f8fafc;
  box-shadow: 0 3px 0 #ef4444, 22px -10px 0 -4px #dbeafe;
}

.home-feature--marina::after {
  content: "";
  position: absolute;
  inset: 8px 10px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  box-shadow: inset 36px 0 0 rgba(19, 32, 46, 0.34), inset -36px 0 0 rgba(19, 32, 46, 0.18);
}

.home-feature--pets {
  border: 3px solid #13202e;
  border-radius: 14px 14px 7px 7px;
  background:
    radial-gradient(circle at 23% 58%, #c68c59 0 8px, transparent 9px),
    radial-gradient(circle at 68% 50%, #475569 0 7px, transparent 8px),
    radial-gradient(circle at 75% 45%, #f8fafc 0 3px, transparent 4px),
    linear-gradient(180deg, #ffedd5 0 30%, #d9b26d 31%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.32);
}

.home-feature--pets::before {
  content: "";
  position: absolute;
  left: 15px;
  right: 15px;
  bottom: 6px;
  height: 14px;
  border-radius: 999px;
  background: #e0669a;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.36);
}

.home-feature--pets::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #13202e;
  box-shadow: 43px -1px 0 #13202e, 52px 5px 0 #13202e;
}

.home-feature--dining {
  border: 3px solid #13202e;
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 50%, #f8fafc 0 9px, transparent 10px),
    radial-gradient(circle at 50% 50%, #f8fafc 0 9px, transparent 10px),
    radial-gradient(circle at 80% 50%, #f8fafc 0 9px, transparent 10px),
    linear-gradient(90deg, transparent 0 15%, #3a2518 15% 18%, transparent 18% 82%, #3a2518 82% 85%, transparent 85%),
    linear-gradient(180deg, #8b5a2b, #5d3a1f);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34);
}

.home-feature--dining::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  bottom: 18px;
  border: 2px solid rgba(255, 247, 214, 0.5);
  border-radius: 999px;
}

.home-feature--game {
  border: 3px solid #13202e;
  border-radius: 8px;
  background:
    radial-gradient(circle at 24% 28%, #ef4444 0 6px, transparent 7px),
    radial-gradient(circle at 46% 28%, #22c55e 0 6px, transparent 7px),
    radial-gradient(circle at 68% 28%, #3b82f6 0 6px, transparent 7px),
    linear-gradient(180deg, #111827 0 56%, #475569 57%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.42);
}

.home-feature--game::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 13px;
  height: 24px;
  border: 2px solid #e2e8f0;
  border-radius: 5px;
  background:
    linear-gradient(90deg, #facc15 0 34%, #22c55e 34% 67%, #38bdf8 67%),
    #0f172a;
}

.home-feature--studio {
  border: 3px solid #13202e;
  border-radius: 8px;
  background:
    linear-gradient(135deg, transparent 0 48%, #13202e 48% 52%, transparent 52%),
    radial-gradient(circle at 30% 72%, #ef4444 0 7px, transparent 8px),
    radial-gradient(circle at 50% 68%, #facc15 0 7px, transparent 8px),
    radial-gradient(circle at 70% 72%, #3b82f6 0 7px, transparent 8px),
    linear-gradient(180deg, #fff7ed 0 58%, #d6b285 59%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34);
}

.home-feature--observatory {
  border: 3px solid #13202e;
  border-radius: 50% 50% 12px 12px;
  background:
    radial-gradient(circle at 50% 28%, #fef08a 0 7px, transparent 8px),
    radial-gradient(circle at 27% 36%, #dbeafe 0 3px, transparent 4px),
    radial-gradient(circle at 72% 46%, #dbeafe 0 3px, transparent 4px),
    linear-gradient(180deg, #172554 0 56%, #e2e8f0 57%);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.4);
}

.home-feature--observatory::before {
  content: "";
  position: absolute;
  right: 12px;
  top: 30px;
  width: 58px;
  height: 10px;
  border-radius: 999px;
  background: #334155;
  transform: rotate(-24deg);
  box-shadow: inset 0 0 0 2px #e0f2fe;
}

.home-feature--yoga {
  border: 3px solid #13202e;
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 38%, #fef08a 0 13px, transparent 14px),
    radial-gradient(ellipse at 50% 76%, rgba(255, 255, 255, 0.48), transparent 45%),
    repeating-linear-gradient(90deg, #86efac 0 20px, #6ee7b7 20px 24px);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.28);
}

.home-room-label {
  position: absolute;
  z-index: 11;
  padding: 3px 7px;
  border: 1.5px solid #101828;
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.95);
  color: #1c2740;
  font-size: 9.5px;
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 3px 0 rgba(16, 24, 40, 0.18);
}

.home-floor-banner {
  position: absolute;
  z-index: 12;
  width: 280px;
  padding: 6px 10px;
  border: 2px solid #101828;
  border-radius: 10px;
  background: rgba(255, 253, 246, 0.96);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.22);
  pointer-events: none;
}

.home-floor-banner strong,
.home-floor-banner span {
  display: block;
}

.home-decor-palette {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.home-decor-swatch {
  width: 23px;
  height: 23px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.18);
  cursor: pointer;
}

.home-decor-swatch.active { outline: 2px solid #101828; outline-offset: 2px; }
.home-decor-swatch--classic { background: #c59a62; }
.home-decor-swatch--coastal { background: #58b6c7; }
.home-decor-swatch--modern { background: #596273; }
.home-decor-swatch--garden { background: #5aa568; }

.home-design-button.active {
  border-color: #101828;
  background: #ffdf73;
  color: #101828;
}

.home-furniture {
  position: absolute;
  z-index: 13;
  display: grid;
  place-items: end center;
  width: 68px;
  height: 68px;
  transform: translate(-34px, -34px);
  border: 2px solid transparent;
  border-radius: 7px;
  pointer-events: none;
  touch-action: none;
}

.home-furniture img {
  max-width: 44px;
  max-height: 44px;
  image-rendering: pixelated;
  transform: scale(1.45);
  filter: drop-shadow(0 3px 2px rgba(15, 23, 42, 0.42));
  pointer-events: none;
}

.home-furniture > span {
  display: none;
  position: absolute;
  bottom: -14px;
  padding: 2px 5px;
  border-radius: 4px;
  background: #101828;
  color: #ffffff;
  font-size: 8px;
  font-weight: 850;
  white-space: nowrap;
}

.home-furniture > button {
  display: none;
  position: absolute;
  top: -9px;
  right: -9px;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #be123c;
  color: #ffffff;
  font-size: 15px;
  font-weight: 950;
  line-height: 18px;
  cursor: pointer;
}

.home-furniture.is-designing {
  border-color: #ffffff;
  outline: 2px dashed #0f8294;
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.28);
  pointer-events: auto;
  cursor: grab;
}

.home-furniture.is-designing > span,
.home-furniture.is-designing > button { display: block; }
.home-furniture.is-dragging { cursor: grabbing; transform: translate(-34px, -34px) scale(1.06); }

.home-design-tray {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: min(440px, calc(100% - 20px));
  min-height: 50px;
  padding: 6px 8px;
  overflow-x: auto;
  border: 2px solid #101828;
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.97);
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.25);
}

.home-design-tray > strong,
.home-design-tray > span {
  flex: 0 0 auto;
  color: #344054;
  font-size: 9px;
  font-weight: 850;
}

.home-design-tray > button {
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 40px;
  padding: 3px;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.home-design-tray img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
}

.home-design-tray button span {
  max-width: 52px;
  overflow: hidden;
  color: #344054;
  font-size: 7px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#roomBody[data-home-theme="classic"] { --home-theme: #b7793f; --home-theme-soft: #fff3df; }
#roomBody[data-home-theme="coastal"] { --home-theme: #0f8294; --home-theme-soft: #e5fbff; }
#roomBody[data-home-theme="modern"] { --home-theme: #374151; --home-theme-soft: #eef0f3; }
#roomBody[data-home-theme="garden"] { --home-theme: #287a47; --home-theme-soft: #eaf8e9; }

#roomBody[data-home-theme] .room2-floor {
  background-color: var(--home-theme-soft);
  border-color: var(--home-theme);
}

#roomBody[data-home-theme] .home-room-zone {
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--home-theme) 34%, transparent);
}

#roomBody[data-home-theme] .home-room-label {
  border-color: var(--home-theme);
}

.home-floor-banner strong {
  font-size: 12px;
  font-weight: 950;
  color: #101828;
}

.home-floor-banner span {
  margin-top: 1px;
  color: #5b6472;
  font-size: 10px;
  font-weight: 760;
}

.home-stairs {
  position: absolute;
  z-index: 14;
  width: 104px;
  height: 58px;
  border: 3px solid #13202e;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.22) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #7c4a24, #c28b56);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(16, 24, 40, 0.34), 0 0 0 4px rgba(255, 215, 102, 0.12);
}

.home-stairs::before {
  content: "";
  position: absolute;
  inset: 7px 14px;
  border-left: 4px solid rgba(16, 24, 40, 0.6);
  border-right: 4px solid rgba(16, 24, 40, 0.6);
}

.home-stairs span,
.home-stairs small {
  position: relative;
  z-index: 1;
  display: block;
  text-shadow: 0 1px 0 #101828;
}

.home-stairs span {
  font-size: 12px;
  font-weight: 950;
}

.home-stairs small {
  margin-top: 1px;
  font-size: 9px;
  font-weight: 850;
}

.home-stairs--up::after,
.home-stairs--down::after {
  position: absolute;
  right: 8px;
  top: 8px;
  color: #fff7d6;
  font-size: 18px;
  font-weight: 950;
}

.home-stairs--up::after {
  content: "^";
}

.home-stairs--down::after {
  content: "v";
}

@keyframes home-firelight {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes home-screen {
  0% { box-shadow: inset 0 0 0 0 rgba(96, 165, 250, 0.12); }
  50% { box-shadow: inset 0 0 16px rgba(96, 165, 250, 0.38); }
  100% { box-shadow: inset 0 0 0 0 rgba(96, 165, 250, 0.12); }
}

@keyframes home-water {
  from { background-position: 0 0, 0 0, 0 0; }
  to { background-position: 24px 0, 0 18px, 0 0; }
}

@keyframes home-fish {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(14px); }
}

@keyframes home-steam {
  0%, 100% { opacity: 0.42; transform: translateY(0); }
  50% { opacity: 0.78; transform: translateY(-4px); }
}

.room2-list {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(196px, 236px));
  gap: 10px;
  align-content: start;
  padding: 96px 10px 14px 12px;
  min-height: 0;
  overflow-y: auto; /* worst case the catalog scrolls — it never pushes the EXIT away */
}

.room2-list.compact {
  gap: 7px;
  grid-template-columns: repeat(var(--cols, 1), minmax(160px, 200px));
}

.room2-list.compact .site-row {
  padding: 4px 8px;
}

.room2-list.compact .site-note {
  display: none;
}

/* site rows as merchandise display tables */
.room2 .site-row {
  position: relative;
  z-index: 1;
  border: 2px solid #101828;
  background: #fffdf6;
  box-shadow: 0 5px 0 #7a5230, 0 9px 12px rgba(40, 24, 8, 0.35);
  cursor: pointer;
}

.room2 .site-row .default-label {
  align-self: center;
}

.room2 .site-row.stand-near {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.room2 .site-row.zap {
  animation: rowzap 0.55s ease;
}

@keyframes rowzap {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  35% { transform: scale(1.04); box-shadow: 0 0 0 9px rgba(59, 130, 246, 0); }
  100% { transform: scale(1); }
}

.room2-floor {
  position: relative;
}

/* runner rug across the shop floor toward the door */
.room2-floor::before {
  content: "";
  position: absolute;
  inset: 96px 16% 4px;
  border: 3px solid #6d3532;
  border-radius: 5px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.07) 0 4px, transparent 4px 22px),
    #9a4f43;
  box-shadow: inset 0 0 0 2px #b8695c, 0 2px 4px rgba(40, 24, 8, 0.3);
}

.room2-exit {
  position: absolute;
  z-index: 8; /* the door outranks even the dialogue box — always findable */
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px 6px;
  border: 2px solid #101828;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #3a2a18;
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  box-shadow: 0 -14px 22px rgba(255, 236, 190, 0.28);
}

/* pixel furniture props + windows */
.iprop {
  position: absolute;
  image-rendering: pixelated;
  transform: scale(var(--s, 2));
  transform-origin: top left;
  pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(15, 23, 42, 0.4));
}

.iprop-feature {
  pointer-events: auto;
  cursor: pointer;
  border-radius: 3px;
  transition: filter 160ms ease, transform 160ms ease;
}

.iprop-feature:hover,
.iprop-feature:focus-visible,
.iprop-feature.is-active {
  filter: drop-shadow(0 3px 2px rgba(15, 23, 42, 0.4)) drop-shadow(0 0 8px rgba(255, 215, 102, 0.78));
}

.iprop-feature.is-active {
  transform: scale(var(--s, 2)) translateY(-1px);
}

.iwindow {
  position: absolute;
  top: 16px;
  z-index: 0;
  width: 36px;
  height: 30px;
  border: 3px solid #101828;
  border-radius: 4px;
  background:
    linear-gradient(transparent 0 12px, #101828 12px 15px, transparent 15px),
    linear-gradient(90deg, transparent 0 15px, #101828 15px 18px, transparent 18px),
    linear-gradient(180deg, #bfe3ff, #8fc7f2);
  box-shadow: 0 3px 0 rgba(16, 24, 40, 0.35);
  pointer-events: none;
}

.room-mat {
  position: absolute;
  width: 28px;
  height: 18px;
  border: 2px dashed #b7a888;
  border-radius: 6px;
  background: rgba(139, 92, 46, 0.08);
  pointer-events: none;
}

.room-mat.near {
  border-color: #3b82f6;
  animation: matpulse 0.9s ease-in-out infinite;
}

@keyframes matpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0.05); }
}

.dom-avatar {
  position: absolute;
  z-index: 5;
  width: 44px;
  height: 88px;
  background-repeat: no-repeat;
  background-size: 132px 352px; /* 2.75x \u2014 rooms feel zoomed-in; site cards stay the same size */
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(15, 23, 42, 0.35));
}

.dom-avatar.grabbed {
  transform: scale(1.08);
}

/* the PLAYER is never hidden by anything — they render above props,
   counter, dialogue box, everything (they walk on top, never behind) */
.dom-avatar:not(.keeper) {
  z-index: 40;
}

.dom-avatar.keeper {
  pointer-events: auto;
  cursor: pointer;
}

.keeper-tag {
  position: absolute;
  z-index: 6;
  width: 120px;
  padding: 2px 0;
  border-radius: 6px;
  background: rgba(16, 24, 40, 0.82);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
}

/* Zelda-style bottom dialogue box: speaker stays visible, text never covers them */
.dialogue-box {
  position: absolute;
  bottom: 8px;
  right: 10px;
  left: auto;
  max-width: min(340px, 46%); /* docked bottom-right, near the clerk; list + EXIT stay clear */
  z-index: 7;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 2.5px solid #101828;
  border-radius: 10px;
  background: rgba(252, 250, 242, 0.97);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.35), inset 0 0 0 2px rgba(16, 24, 40, 0.08);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.dialogue-box.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dlg-portrait {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border: 2px solid #101828;
  border-radius: 8px;
  background-color: #dcefdb;
  background-repeat: no-repeat;
  background-size: 132px 352px; /* sheet at 2.75x: head crop */
  background-position: -44px -3px;
  image-rendering: pixelated;
}

.dlg-copy {
  flex: 1;
  min-width: 0;
}

.dlg-name {
  display: block;
  margin-bottom: 2px;
  color: #6b4b12;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.dialogue-box .kb-text {
  font-size: 13px;
  font-weight: 720;
  color: #1c2740;
  line-height: 1.35;
}

.dialogue-box .kb-chips {
  flex: 0 0 auto;
  flex-direction: column;
  margin-top: 0;
}

.keeper-bubble {
  position: absolute;
  top: -12px;
  z-index: 7;
  width: 230px;
  padding: 8px 10px;
  border: 1.5px solid #101828;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  color: #1c2740;
  font-size: 12.5px;
  font-weight: 720;
  line-height: 1.35;
  text-align: center;
  transform: translateX(-50%) translateY(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.keeper-bubble.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.kb-text {
  display: block;
}

.kb-chips {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin-top: 7px;
}

.kb-chips button {
  padding: 3px 9px;
  border: 1.5px solid #101828;
  border-radius: 999px;
  background: #f1f5ff;
  color: #1c2740;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.kb-chips button:hover {
  background: #dbe7ff;
}

.friend-tier {
  margin-left: 5px;
  color: #7c5cff;
  font-size: 10.5px;
  font-style: normal;
  font-weight: 800;
}

.weather-rain {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
  background:
    repeating-linear-gradient(105deg, transparent 0 9px, rgba(180, 205, 235, 0.28) 9px 10px, transparent 10px 23px),
    linear-gradient(180deg, rgba(40, 52, 80, 0.16), rgba(40, 52, 80, 0.1));
  animation: rainfall 0.5s linear infinite;
}

body.raining .weather-rain {
  display: block;
}

@keyframes rainfall {
  from { background-position: 0 0, 0 0; }
  to { background-position: -18px 64px, 0 0; }
}

.room2-hint {
  margin: 0;
  padding: 7px 12px;
  border-top: 1px solid var(--line-soft);
  background: #f9fbfe;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 720px) {
  .home-room .room2-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 6px 8px;
  }

  .home-room .room2-head .district-icon,
  .home-room .room2-title .kicker {
    display: none;
  }

  .home-room .room2-title h2 {
    font-size: 15px;
  }

  .home-floor-tabs {
    gap: 4px;
  }

  .home-floor-tab {
    flex: 1 1 58px;
    min-width: 56px;
    padding: 3px 5px;
  }

  .home-floor-tab span {
    overflow: hidden;
    font-size: 8.5px;
    text-overflow: ellipsis;
  }

  .home-floor-tab small {
    display: none;
  }

  .home-room .room2-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .home-room .room2-list,
  .room2-list {
    grid-template-columns: repeat(2, minmax(92px, 112px));
    gap: 6px;
    padding: 92px 6px 10px 8px;
  }

  .home-room .room2-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(92px, 112px);
    grid-template-columns: none;
    align-content: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 5px 7px;
  }

  .home-room .room2-floor {
    grid-row: 2;
    min-height: 0;
  }

  .home-room-zone {
    border-width: 1.5px;
  }

  .home-room-zone span,
  .home-room-label {
    font-size: 8px;
  }

  .home-floor-banner {
    width: 176px;
    padding: 5px 8px;
  }

  .home-floor-banner span {
    display: none;
  }

  .home-stairs {
    width: 88px;
    height: 50px;
  }

  .home-design-tray {
    right: 6px;
    bottom: 6px;
    left: 6px;
    max-width: none;
    min-height: 44px;
    padding: 4px 6px;
  }

  .home-design-tray > button { flex-basis: 48px; min-height: 36px; }
  .home-furniture { transform: translate(-30px, -30px) scale(0.88); }
  .home-furniture.is-dragging { transform: translate(-30px, -30px) scale(0.95); }

  .room2-list .site-note {
    display: none;
  }

  .room2-list .site-row {
    padding: 4px 6px;
  }

  .room2 .site-row {
    grid-template-columns: 24px 34px minmax(0, 1fr);
  }

  .room2-hint {
    display: none;
  }
}

.room-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px;
  padding: 5px 10px;
  border: 2px solid #101828;
  border-radius: 8px;
  background: color-mix(in srgb, var(--room-accent, #2563eb) 84%, #101828);
  box-shadow: 0 6px 16px rgba(10, 14, 24, 0.4);
  pointer-events: auto;
}

.room-strip .room-kicker {
  margin: 0 0 2px;
}

.room-strip h2 {
  margin: 0;
  color: #ffffff;
  font-size: 15px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(16, 24, 40, 0.55);
}

.room-strip .room-kicker {
  font-size: 10px;
}

.interior .room-hint {
  margin: 8px;
  border: 0;
  border-radius: 7px;
  pointer-events: none;
}

.interior .room {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 6px;
  overflow: hidden;
  border: 3px solid #101828;
  border-radius: 6px;
  image-rendering: pixelated;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.05) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.07) 0 2px, transparent 2px 24px),
    linear-gradient(180deg, #c59a6b, #b98d5f);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), inset 0 -40px 60px rgba(63, 36, 12, 0.18);
}

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 3px solid #101828;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.13) 0 14px, transparent 14px 28px),
    color-mix(in srgb, var(--room-accent, #2563eb) 82%, #101828);
}

.room-kicker {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.room-head h2 {
  margin: 0;
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(16, 24, 40, 0.55);
}

.room-grid {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  align-content: start;
  overflow-y: auto;
  padding: 14px;
}

.poster {
  position: relative;
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 12px 8px 10px;
  border: 3px solid #101828;
  border-radius: 6px;
  background: linear-gradient(180deg, #fffdf5, #f3ead6);
  box-shadow: 0 3px 0 #7a5230, 0 6px 10px rgba(63, 36, 12, 0.25);
  text-align: center;
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.poster:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #7a5230, 0 10px 14px rgba(63, 36, 12, 0.3);
}

.poster-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid #101828;
  border-radius: 8px;
  background: var(--accent, #2563eb);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: inset 0 -10px 14px rgba(0, 0, 0, 0.2);
}

.poster-name {
  overflow: hidden;
  max-width: 100%;
  color: #24180c;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 870;
}

.poster-note {
  overflow: hidden;
  max-width: 100%;
  color: #6d5334;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 680;
}

.poster-star {
  position: absolute;
  top: -9px;
  right: -6px;
  padding: 2px 6px;
  border: 2px solid #101828;
  border-radius: 999px;
  background: #ffd766;
  color: #4d3305;
  font-size: 9.5px;
  font-weight: 900;
}

.room-hint {
  margin: 0;
  padding: 8px 12px;
  border-top: 3px solid #101828;
  background: rgba(16, 24, 40, 0.82);
  color: #e8ecf5;
  font-size: 11.5px;
  font-weight: 720;
  text-align: center;
}

@media (max-width: 720px) {
  .app-shell { padding: 8px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr); }
  .top-actions { grid-column: 1 / -1; display: flex; }
  .town-map { height: clamp(470px, calc(100svh - 235px), 640px); min-height: 470px; }
  .town-map:has(.interior.open) { height: min(82svh, 720px); min-height: 560px; }
}

@media (max-width: 400px) {
  .town-map { height: clamp(440px, calc(100svh - 225px), 590px); min-height: 440px; }
}

/* Resident conversations */
.dialogue-panel {
  position: fixed;
  right: 18px;
  bottom: 84px;
  z-index: 160;
  width: min(380px, calc(100vw - 28px));
  padding: 14px;
  border: 3px solid #101828;
  border-radius: 8px;
  background: #fffdf6;
  box-shadow: 0 10px 0 rgba(16, 24, 40, 0.25), 0 22px 50px rgba(16, 24, 40, 0.25);
}

.dialogue-panel[hidden] { display: none; }
.dialogue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialogue-head h2 { margin: 0; font-size: 20px; }
.dialogue-head .kicker { margin-bottom: 2px; }
.dialogue-head > button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #e8edf4;
  color: #101828;
  font-weight: 900;
  cursor: pointer;
}

.dialogue-memory {
  margin: 9px 0;
  padding: 7px 9px;
  border-left: 3px solid #0f8294;
  background: #e9faf9;
  color: #476071;
  font-size: 10px;
  font-weight: 720;
}

.dialogue-response {
  min-height: 58px;
  margin: 10px 0;
  color: #1d2939;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.dialogue-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.dialogue-choices button,
.dialogue-complete {
  min-height: 38px;
  padding: 7px 9px;
  border: 1.5px solid #b7c3d4;
  border-radius: 6px;
  background: #ffffff;
  color: #27364d;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
}

.dialogue-choices button:hover,
.dialogue-choices button:focus-visible { border-color: #0f8294; background: #e9faf9; }
.dialogue-complete { width: 100%; margin-top: 8px; border-color: #166534; background: #dcfce7; color: #14532d; }

@media (max-width: 720px) {
  .dialogue-panel { right: 8px; bottom: 92px; left: 8px; width: auto; padding: 11px; }
  .dialogue-response { min-height: 44px; margin: 8px 0; }
  .dialogue-memory { max-height: 44px; overflow: hidden; }
}

/* Each destination keeps the same UI, with a distinct world signature. */
.game-stage { --world-accent: #f2c94c; --world-glow: rgba(242, 201, 76, 0.2); }
.game-stage[data-world="estate"] { --world-accent: #e0669a; --world-glow: rgba(224, 102, 154, 0.2); }
.game-stage[data-world="sea"] { --world-accent: #19a7b8; --world-glow: rgba(25, 167, 184, 0.2); }
.game-stage[data-world="north"] { --world-accent: #4b9b58; --world-glow: rgba(75, 155, 88, 0.2); }
.game-stage[data-world="south"] { --world-accent: #8b5cf6; --world-glow: rgba(139, 92, 246, 0.2); }
.game-stage[data-world="reef"] { --world-accent: #0e7490; --world-glow: rgba(14, 116, 144, 0.22); }

.game-stage {
  position: relative;
  border-color: color-mix(in srgb, var(--world-accent) 62%, #d3dce8);
  box-shadow: 0 0 0 3px var(--world-glow), var(--soft-shadow);
  transition: border-color 280ms ease, box-shadow 280ms ease;
}

.game-stage::before {
  content: "";
  position: absolute;
  z-index: 90;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--world-accent);
  pointer-events: none;
}

.world-arrival {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 210;
  display: grid;
  min-width: min(360px, calc(100vw - 32px));
  padding: 16px 22px;
  transform: translate(-50%, -42%) scale(0.96);
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: rgba(16, 24, 40, 0.94);
  color: #ffffff;
  text-align: center;
  opacity: 0;
  box-shadow: 0 16px 50px rgba(16, 24, 40, 0.36);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
}

.world-arrival[hidden] { display: none; }
.world-arrival.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.world-arrival span { color: #9bdedb; font-size: 9px; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.world-arrival strong { margin-top: 3px; font-size: 23px; letter-spacing: 0; }
.world-arrival small { margin-top: 4px; color: #d8e0ec; font-size: 11px; font-weight: 700; }
.world-traveling .game-stage { filter: saturate(0.88); }

@media (prefers-reduced-motion: reduce) {
  .world-arrival,
  .game-stage { transition: none; }
}

@media (max-width: 720px) {
  .dock { display: none; }

  .adventure-panel {
    top: 132px;
    right: auto;
    bottom: auto;
    height: auto;
    max-height: 124px;
    overflow: hidden;
  }

  .district-panel {
    visibility: hidden;
    opacity: 0;
    transform: none;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 0s linear 180ms;
  }

  body.mobile-directory-open .district-panel {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition-delay: 0s;
  }
}

/* Responsive launch hardening. Keep the game usable from small phones to wide desktops. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

.town-layout,
.game-stage,
.district-panel,
.stage-head,
.stage-actions,
.control-strip,
.town-map {
  min-width: 0;
}

.town-map canvas {
  width: 100% !important;
  max-width: 100%;
  height: 100% !important;
}

@media (max-width: 900px) {
  .app-shell {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-right: max(8px, env(safe-area-inset-right));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left));
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 8px;
  }

  .brand-sub { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .search { grid-column: 2; min-height: 42px; }

  .top-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  .top-actions .button {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 7px 4px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .town-layout { margin-top: 8px; }
  .game-stage { padding: 10px; }
  .stage-actions { flex-wrap: wrap; justify-content: flex-end; }
  .dock { display: none; }

  .mobile-directory-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 36;
    display: block;
    min-width: 54px;
    min-height: 36px;
    padding: 7px 10px;
    border: 2px solid rgba(255, 255, 255, 0.94);
    border-radius: 7px;
    background: rgba(16, 24, 40, 0.9);
    color: #fff;
    font: 850 12px/1 Inter, system-ui, sans-serif;
  }

  .district-panel {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 84;
    display: block;
    width: 100%;
    max-height: min(76dvh, 760px);
    overflow-y: auto;
    padding: 42px 12px max(14px, env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    visibility: hidden;
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease, visibility 0s linear 180ms;
  }

  body.mobile-directory-open .district-panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
  }

  body.mobile-directory-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 83;
    background: rgba(16, 24, 40, 0.34);
  }

  .mobile-sheet-close {
    position: absolute;
    top: 9px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: #f4f6fa;
    color: #253044;
  }

  .category-strip { position: sticky; top: -1px; z-index: 2; background: #fff; }
}

@media (max-width: 720px) {
  .brand-name { font-size: 19px; }
  .search-icon { display: none; }
  .search { padding-left: 10px; }
  .search input { font-size: 13px; }
  .go { min-width: 58px; }

  .stage-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    margin-bottom: 7px;
  }

  .stage-head h1 { font-size: 19px; }
  .stage-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    width: 100%;
  }

  .stage-actions .button {
    width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px;
  }

  .town-map {
    height: clamp(430px, calc(100dvh - 250px), 620px);
    min-height: 430px;
  }

  .mobile-controls {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
  }

  .interaction-prompt {
    bottom: 118px;
    max-width: calc(100% - 24px);
  }

  .stage-pill-extra { display: none; }

  .town-map:has(.interior.open) .interaction-prompt { bottom: 12px; max-width: calc(100% - 24px); }

  .map-hud {
    top: 52px;
    bottom: auto;
    left: 8px;
  }

  .dialogue-panel {
    top: auto;
    right: 8px;
    bottom: calc(122px + env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
  }

  .adventure-panel {
    right: 12px;
    bottom: calc(126px + env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
  }
}

@media (max-width: 360px) {
  .top-actions { gap: 4px; }
  .top-actions .button { padding-inline: 2px; font-size: 9px; }
  .mobile-dpad { grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(2, 44px); }
  .mobile-dpad button { width: 44px; height: 44px; }
  .mobile-action { width: 58px; height: 58px; }
  .interaction-prompt { bottom: 108px; max-width: calc(100% - 20px); }
}

@media (min-width: 721px) and (max-width: 900px) {
  .town-map { height: clamp(420px, calc(100dvh - 250px), 560px); }
  .control-strip { padding: 8px; gap: 8px; }
}

@media (pointer: coarse) and (min-width: 721px) {
  .interaction-prompt { bottom: 126px; }
  .map-hud { top: 54px; bottom: auto; }
}

@media (max-height: 520px) and (min-width: 721px) and (max-width: 1000px) {
  .topbar {
    grid-template-columns: 150px minmax(230px, 1fr) auto;
    align-items: center;
  }

  .brand-name { font-size: 18px; }
  .search { grid-column: auto; }
  .top-actions {
    grid-column: auto;
    display: grid;
    width: auto;
  }
  .town-map { height: 360px; min-height: 360px; }
}

/* Production beta surfaces */
.beta-badge {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin-left: 5px;
  padding: 2px 5px;
  border: 1px solid #12756b;
  border-radius: 4px;
  background: #e7f8f4;
  color: #10665e;
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  vertical-align: 3px;
}

.top-actions > a.button { text-decoration: none; }

.journal-drawer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 96;
  width: min(430px, 94vw);
  height: 100dvh;
  overflow-y: auto;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: #f8fafc;
  box-shadow: 12px 0 34px rgba(16, 24, 40, 0.18);
  transform: translateX(-105%);
  transition: transform 180ms ease;
}

.journal-drawer.open { transform: translateX(0); }

.journal-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #b9ddd7;
  border-radius: 8px;
  background: #ecf9f6;
  color: #164e48;
}

.journal-summary strong { font-size: 13px; }
.journal-summary span { flex: 0 0 auto; color: #3d6864; font-size: 11px; font-weight: 750; }
.journal-list { display: grid; gap: 8px; }

.journal-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 92px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.journal-item.complete { border-color: #8fd0b6; background: #f1fbf6; }
.journal-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 7px; background: #263248; color: #fff; font-weight: 900; }
.journal-copy { min-width: 0; }
.journal-copy strong, .journal-copy span, .journal-copy small { display: block; }
.journal-copy strong { color: #1d2939; font-size: 13px; }
.journal-copy span { margin-top: 2px; color: #667085; font-size: 11px; font-weight: 700; }
.journal-copy small { margin-top: 5px; color: #526074; font-size: 10px; line-height: 1.3; }
.journal-meter { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 3px; background: #e5eaf0; }
.journal-meter span { height: 100%; border-radius: inherit; background: #198878; }
.journal-badge { padding: 5px 7px; border-radius: 5px; background: #edf1f5; color: #536173; font-size: 10px; font-weight: 850; }
.journal-item.complete .journal-badge { background: #d8f4e5; color: #17623e; }

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.about-actions > .button { text-decoration: none; }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.about-grid section { padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.about-grid strong { color: #1f2a3b; font-size: 12px; }
.about-grid p { margin: 5px 0 0; color: #5f6d7e; font-size: 11px; font-weight: 600; line-height: 1.45; }
.credits-details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.credits-details summary { color: #344054; font-size: 12px; font-weight: 800; cursor: pointer; }

@media (max-width: 720px) {
  .journal-drawer { width: 100vw; padding: 14px 12px max(14px, env(safe-area-inset-bottom)); }
  .journal-summary { align-items: flex-start; flex-direction: column; gap: 3px; }
  .about-grid { grid-template-columns: 1fr; }
  .about-actions { display: grid; grid-template-columns: 1fr; }
  .about-actions > .button { width: 100%; text-align: center; }
  .credits-head { align-items: flex-start; }
  .credits-head h2 { line-height: 1.05; }
}

@media (max-width: 380px) {
  .journal-item { grid-template-columns: 36px minmax(0, 1fr); }
  .journal-icon { width: 34px; height: 34px; }
  .journal-badge { grid-column: 2; justify-self: start; }
}

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