@layer interface {
:root {
  --wx-bar-height: 72px;
  --wx-world-controls-top: 66px;
  --wx-world-control-size: 44px;
  --wx-world-controls-row-height: 44px;
  --wx-live-gps-top: calc(var(--wx-world-controls-top) + var(--wx-world-controls-row-height) + 8px);
}

html, body { background: var(--wx-bg); color: var(--wx-text); }
body, button, input, select, textarea { font-family: var(--wx-font-ui); letter-spacing: 0; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--wx-blue);
  outline-offset: 2px;
}

/* Title shell */
#titleScreen {
  display: block;
  padding: 0;
  background-color: var(--wx-bg);
  background-position: center;
  overflow: hidden;
}
#titleScreen.hidden { display: none; }
#globeSelectorScreen:not(.show) { display: none; }
#titleScreen::before { background: color-mix(in srgb, var(--wx-panel-solid) 56%, transparent); backdrop-filter: none; }
#titleScreen::after {
  content: '';
  position: absolute;
  inset: var(--wx-bar-height) 0 54px 136px;
  border: 1px solid var(--wx-line-soft);
  pointer-events: none;
  z-index: 0;
}
.logo {
  position: fixed;
  z-index: 4;
  top: 0;
  left: 0;
  width: 350px;
  height: var(--wx-bar-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 22px;
  color: var(--wx-text);
  background: var(--wx-panel);
  border-right: 1px solid var(--wx-line-soft);
  border-bottom: 1px solid var(--wx-line-soft);
  font: 700 20px/1 var(--wx-font-ui);
  text-shadow: none;
  animation: none;
}
.logo::before { content: '◉'; margin-right: 12px; color: var(--wx-blue); font-size: 26px; }
.logo::after { content: ' 3D'; color: var(--wx-blue); }
.sub {
  position: fixed;
  z-index: 4;
  top: 0;
  left: 350px;
  right: 0;
  height: var(--wx-bar-height);
  margin: 0;
  padding: 0 24px;
  display: flex;
  align-items: center;
  color: var(--wx-muted);
  background: var(--wx-panel);
  border-bottom: 1px solid var(--wx-line-soft);
  font: 500 12px/1 var(--wx-font-ui);
  text-transform: uppercase;
  letter-spacing: 0;
}
.title-main-row { position: static; width: auto; }
.menu-container {
  position: static;
  width: auto;
  max-height: none;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.tab-nav {
  position: fixed;
  z-index: 4;
  top: var(--wx-bar-height);
  bottom: 54px;
  left: 0;
  width: 136px;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  background: var(--wx-panel);
  border-right: 1px solid var(--wx-line-soft);
  border-bottom: 0;
  overflow-y: auto;
}
.tab-btn {
  flex: 0 0 76px;
  width: 100%;
  padding: 12px 8px;
  color: var(--wx-muted);
  background: transparent;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  font: 600 11px/1.25 var(--wx-font-ui);
  text-transform: uppercase;
}
.tab-btn:hover { color: var(--wx-text); background: color-mix(in srgb, var(--wx-panel-soft) 4%, transparent); }
.tab-btn.active { color: var(--wx-text); background: rgb(238 201 107 / 0.12); border-left-color: var(--wx-blue); }
.tab-content {
  position: fixed;
  z-index: 3;
  top: calc(var(--wx-bar-height) + 18px);
  right: 18px;
  bottom: 84px;
  width: 360px;
  max-height: none;
  box-sizing: border-box;
  padding: 18px;
  color: var(--wx-text);
  background: var(--wx-panel);
  border: 1px solid var(--wx-line);
  border-radius: 0;
  overflow: auto;
}
.tab-content h1, .tab-content h2, .tab-content h3,
.tab-content label, .tab-content strong { color: var(--wx-text); }
.tab-content input, .tab-content select, .tab-content textarea,
.search-row input, .coords-row input {
  color: var(--wx-text);
  background: var(--wx-input);
  border: 1px solid var(--wx-line);
  border-radius: 2px;
}
.launch-switch-row { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin-bottom: 14px; }
.launch-switch-btn {
  min-height: 52px;
  padding: 6px 2px;
  color: var(--wx-muted);
  background: var(--wx-input);
  border: 1px solid var(--wx-line-soft);
  border-radius: 0;
  font-size: 10px;
}
.launch-switch-btn.active { color: var(--wx-text); background: var(--wx-selected); border-color: var(--wx-blue); }
.loc-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
.loc {
  min-height: 58px;
  color: var(--wx-text);
  background: var(--wx-input);
  border: 1px solid var(--wx-line-soft);
  border-radius: 2px;
}
.loc:hover, .loc.sel { background: var(--wx-selected); border-color: var(--wx-blue); transform: none; }
.loc-name { color: var(--wx-text); }
.loc-region { color: var(--wx-muted); }
.mode, #titleScreen [style*="background:#f8fafc"], #titleScreen [style*="background: #f8fafc"] {
  color: var(--wx-text) !important;
  background: var(--wx-input) !important;
  border-color: var(--wx-line-soft) !important;
  border-radius: 2px !important;
}
.mode-name, .mode-desc{ color: inherit; }
.start-section {
  position: fixed;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  width: 360px;
  padding: 0;
  border: 0;
}
.startBtn {
  height: 52px;
  padding: 0 20px;
  color: var(--wx-action-text);
  background: var(--wx-action);
  border: 1px solid var(--wx-action);
  border-radius: 0;
  box-shadow: none;
  font: 700 13px/1 var(--wx-font-ui);
}
.startBtn:hover { background: var(--wx-action-hover); transform: none; box-shadow: none; }
.title-footer {
  position: fixed;
  z-index: 5;
  left: 0;
  right: 396px;
  bottom: 0;
  height: 54px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  color: var(--wx-muted);
  background: var(--wx-panel);
  border-top: 1px solid var(--wx-line-soft);
}
.title-license { color: var(--wx-muted); font-size: 9px; line-height: 1.3; }
.title-share-btn { width: 34px; height: 34px; color: var(--wx-text); background: transparent; border: 1px solid var(--wx-line); border-radius: 50%; box-shadow: none; }
.flowerChallengeToggleBtn, .auth-float-toggle { border-radius: 2px; }

/* Globe-first command center */
#globeSelectorScreen { padding: 0; background: var(--wx-bg); backdrop-filter: none; }
.globe-selector-shell {
  width: 100%;
  height: 100%;
  padding: 0;
  gap: 0;
  grid-template-columns: 136px minmax(0, 1fr) 332px;
  grid-template-rows: 72px minmax(0, 1fr) 104px;
  color: var(--wx-text);
  background: var(--wx-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.globe-selector-brand {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--wx-text);
  background: var(--wx-bg);
  border-right: 1px solid var(--wx-line-soft);
  border-bottom: 1px solid var(--wx-line-soft);
  font: 700 12px/1.3 var(--wx-font-ui);
}
.globe-selector-brand strong { margin-left: 5px; color: var(--wx-blue); }
.globe-selector-top {
  grid-column: 2 / 4;
  grid-row: 1;
  justify-content: flex-start;
  padding: 0 24px;
  background: var(--wx-bg);
  border-bottom: 1px solid var(--wx-line-soft);
}
.globe-selector-title { color: var(--wx-text); font: 600 14px/1.3 var(--wx-font-ui); text-align: left; }
.globe-selector-subtitle { color: var(--wx-muted); text-align: left; }
.globe-app-rail {
  grid-column: 1;
  grid-row: 2 / 4;
  display: flex;
  flex-direction: column;
  background: var(--wx-bg);
  border-right: 1px solid var(--wx-line-soft);
}
.globe-app-rail button {
  flex: 1 1 0;
  min-height: 58px;
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--wx-muted);
  background: transparent;
  border: 0;
  border-left: 4px solid transparent;
  border-bottom: 1px solid var(--wx-line-soft);
  border-radius: 0;
  font: 600 10px/1 var(--wx-font-ui);
  text-transform: uppercase;
  cursor: pointer;
}
.globe-app-rail button span { color: var(--wx-text); font: 24px/1 var(--wx-font-ui); }
.globe-app-rail button:hover, .globe-app-rail button.active { color: var(--wx-text); background: rgb(238 201 107 / 0.1); border-left-color: var(--wx-blue); }
.globe-selector-stage {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  background: var(--wx-bg);
  border: 0;
  border-radius: 0;
}
.globe-selector-hint { left: 50%; right: auto; bottom: 12px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); background: var(--wx-panel); border: 1px solid var(--wx-line-soft); border-radius: 2px; }
.globe-selector-side {
  grid-column: 3;
  grid-row: 2 / 4;
  padding: 16px;
  gap: 12px;
  color: var(--wx-text);
  background: var(--wx-panel-solid);
  border: 0;
  border-left: 1px solid var(--wx-line-soft);
  border-radius: 0;
}
.globe-selector-stat, .globe-selector-live-details, .globe-selector-live-layer,
.globe-selector-city-item {
  color: var(--wx-text);
  background: var(--wx-input);
  border: 1px solid var(--wx-line-soft);
  border-radius: 2px;
}
.globe-selector-stat-label, .globe-selector-city-item-meta, .globe-selector-live-status,
.globe-selector-live-layer small { color: var(--wx-muted); }
.globe-selector-stat-value, .globe-selector-city-item-name, .globe-selector-live-title,
.globe-selector-live-layer-label { color: var(--wx-text); }
.globe-selector-actions { top: -16px; padding: 6px; background: var(--wx-panel-solid); border-color: var(--wx-line-soft); border-radius: 0; }
.globe-selector-action-btn, .globe-selector-mode-tab, .globe-selector-city-tab,
.globe-selector-search-btn, .globe-selector-live-refresh, .globe-selector-live-chip,
.globe-selector-live-action-btn, .globe-selector-live-filter {
  border-radius: 2px;
  box-shadow: none;
}
#globeSelectorBackBtn { color: var(--wx-text); background: var(--wx-panel-soft); }
#globeSelectorStartBtn { color: var(--hub-action-text, var(--wx-action-text)); background: var(--wx-action); }
.globe-selector-mode-tab, .globe-selector-city-tab { color: var(--wx-muted); background: var(--wx-input); border-color: var(--wx-line-soft); }
.globe-selector-mode-tab.active, .globe-selector-city-tab.active { color: var(--wx-text); background: var(--wx-selected); border-color: var(--wx-blue); }
.globe-selector-row input { color: var(--wx-text); background: var(--wx-bg); border: 1px solid var(--wx-line); border-radius: 2px; }
.globe-destination-bar {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--wx-panel);
  border-top: 0;
}
.globe-destination-bar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--wx-muted);
  background: transparent;
  border: 0;
  border: 0;
  border-radius: 0;
  font: 600 11px/1 var(--wx-font-ui);
  text-transform: uppercase;
  cursor: pointer;
}
.globe-destination-bar button span { font-size: 28px; line-height: 1; }
.globe-destination-bar button:hover, .globe-destination-bar button.active { color: var(--wx-text); background: rgb(238 201 107 / 0.08); }
.globe-selector-shortcut { position: static; width: auto; height: auto; box-shadow: none; }

body.space-flight-active #worldQuickControls,
body.solid-world-active #worldQuickControls,
body.activity-browser-open #worldQuickControls,
body:has(#largeMap.show) #worldQuickControls,
body:has(#roomPanelModal.show) #worldQuickControls,
body:has(#propertyPanel.show) #worldQuickControls { display: none !important; }
[hidden] { display: none !important; }
body.space-flight-active #worldQuickControls,
body.solid-world-active #worldQuickControls,
body.activity-browser-open #worldQuickControls,
body:has(#largeMap.show) #worldQuickControls,
body:has(#roomPanelModal.show) #worldQuickControls,
body:has(#propertyPanel.show) #worldQuickControls { display: none !important; }
.worldQuickControl {
  min-width: var(--wx-world-control-size);
  width: var(--wx-world-control-size);
  height: var(--wx-world-control-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--wx-muted);
  background: var(--wx-panel);
  border: 1px solid var(--wx-line-soft);
  border-radius: 50%;
  cursor: pointer;
}
.worldQuickControl svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.worldQuickControl span { display: none; }
.worldQuickControl:hover,.worldQuickControl:focus-visible,.worldQuickControl[aria-pressed="true"] { color: var(--wx-text); background: rgb(238 201 107 / .13); border-color: color-mix(in srgb, var(--wx-action) 70%, transparent); }
#coords {
  left: 14px;
  bottom: 246px;
  width: 222px;
  box-sizing: border-box;
  padding: 8px;
  color: var(--wx-text);
  background: var(--wx-panel);
  border: 1px solid var(--wx-line-soft);
  border-radius: 0;
  box-shadow: none;
}
#coordsOsmLink { color: var(--wx-green); }
#minimap {
  left: 14px;
  bottom: 14px;
  width: 222px;
  height: 222px;
  border: 2px solid var(--wx-line);
  border-radius: 0;
  box-shadow: none;
}
#minimapZoomControls { left: 186px; bottom: 22px; }
.minimapZoomBtn, #minimapZoomLevel { border-radius: 0; }
[hidden] { display: none !important; }
.mainMenuBtn {
  top: 0;
  right: 0;
  height: 58px;
  padding: 0 22px;
  color: var(--wx-text);
  background: var(--wx-panel);
  border: 0;
  border-left: 1px solid var(--wx-line-soft);
  border-bottom: 1px solid var(--wx-line-soft);
  border-radius: 0;
  box-shadow: none;
  font: 600 10px/1 var(--wx-font-ui);
}
.mainMenuBtn:hover { color: var(--wx-text); background: var(--wx-panel-solid); border-color: var(--wx-line-soft); transform: none; box-shadow: none; }
#gameShareFloatBtn { top: 0; right: 132px; bottom: auto; left: auto; width: 58px; height: 58px; border-radius: 0; background: var(--wx-panel); border-color: var(--wx-line-soft); }
#memoryFlowerFloatBtn { display: none !important; }

/* Mobile play shell */
@media (max-width: 760px), (pointer: coarse) {
  :root { --wx-world-controls-top: max(74px, calc(env(safe-area-inset-top) + 66px)); --wx-world-control-size: 44px; --wx-world-controls-row-height: 46px; }
  :root { --wx-bar-height: 64px; }
  #titleScreen { overflow-y: auto; }
  #titleScreen::after { display: none; }
  .logo { width: 100%; height: 54px; padding: 0 14px; font-size: 15px; }
  .sub { display: none; }
  .tab-nav { top: 54px; bottom: auto; width: 100%; height: 58px; flex-direction: row; padding: 0; border-right: 0; border-bottom: 1px solid var(--wx-line-soft); overflow-x: auto; }
  .tab-btn { flex: 0 0 92px; height: 58px; padding: 8px 4px; border-left: 0; border-bottom: 3px solid transparent; font-size: 9px; }
  .tab-btn.active { border-left-color: transparent; border-bottom-color: var(--wx-blue); }
  .tab-content { position: absolute; top: 112px; left: 0; right: 0; bottom: 112px; width: 100%; padding: 14px; border-width: 0; }
  .start-section { right: 10px; bottom: 58px; width: calc(100% - 20px); }
  .title-footer { right: 0; height: 50px; padding: 6px 10px; }
  .title-license { display: none; }
  .loc-grid { grid-template-columns: 1fr 1fr; }

  .globe-selector-shell { display: flex; flex-direction: column; min-height: 100dvh; overflow-y: auto; }
  .globe-selector-brand { flex: 0 0 54px; padding: 0 14px; border-right: 0; }
  .globe-selector-top { display: none; }
  .globe-app-rail { position: fixed; z-index: 8; left: 0; right: 0; bottom: 0; height: 68px; flex-direction: row; border-right: 0; border-top: 1px solid var(--wx-line-soft); }
  .globe-app-rail button { flex: 1; min-width: 0; min-height: 68px; padding: 5px 1px; gap: 4px; border-left: 0; border-bottom: 0; border-top: 3px solid transparent; font-size: 7px; }
  .globe-app-rail button span { font-size: 19px; }
  .globe-app-rail button.active { border-left-color: transparent; border-top-color: var(--wx-blue); }
  .globe-selector-stage { order: 1; flex: 0 0 44dvh; min-height: 290px; }
  .globe-destination-bar { order: 2; flex: 0 0 78px; }
  .globe-destination-bar button { font-size: 8px; }
  .globe-destination-bar button span { font-size: 21px; }
  .globe-selector-side { order: 3; flex: 0 0 auto; padding: 12px 12px 82px; overflow: visible; border-top: 1px solid var(--wx-line-soft); border-left: 0; }
  .mainMenuBtn { width: 58px; height: 66px; padding: 0; overflow: hidden; font-size: 0; pointer-events: auto; z-index: 10020; }
  .mainMenuBtn::before { content: '☰'; font: 28px/1 var(--wx-font-ui); }
  #gameShareFloatBtn { top: var(--wx-world-controls-top); right: 88px; width: 46px; height: 46px; border-radius: 50%; }
  /* An expanded paint tool palette must remain reachable above the map. */
  #paintTownHud[data-paint-layout="expanded"] { top: calc(70px + env(safe-area-inset-top)) !important; z-index: 110 !important; max-height: calc(100dvh - 180px); overflow-y: auto; }
  #multiplayerMenu { position: relative; left: auto; bottom: auto; z-index: auto; } #memoryFlowerFloatBtn { display: none !important; }
}

@media (max-width: 390px) {
  .tab-content { bottom: 108px; }
  .loc-grid { grid-template-columns: 1fr; }
  body.solid-world-active #solidWorldReturnBtn {
    right: 12px !important;
    min-height: 44px;
  }
}

/* A central status panel leaves both landscape thumb-control zones free. */
@media (max-height: 560px) and (orientation: landscape) and (pointer: coarse) {
  :root { --wx-live-gps-top: var(--wx-world-controls-top); }
}
}
body:has(#worldSelectionNotice:not([hidden])) .tutorial-card { display: none !important; }
#terrainImageryCredit { color: var(--wx-action); font-size: 9px; white-space: nowrap; }
