:root {
  --navy: #23345C;
  --cream: #FFF6E6;
  --coral: #FF6B5B;
  --sun: #FFC93C;
  --teal: #24B39B;
  --lilac: #9C7CF4;
  --grey: #B8BCC8;
  --danger: #E8534A;
  --font: "Nunito", "Trebuchet MS", system-ui, sans-serif;
  /* UI fonts (Google Fonts, system fallback) */
  --font-ui: "Fredoka", "Nunito", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-display: "Lilita One", "Fredoka", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --navy-d: #1A2747;
  --teal-l: #46E3C2; --teal-d: #127A68;
  --sun-l: #FFE58A; --sun-d: #C98A12;
  --coral-l: #FF9A8B; --coral-d: #C9443A;
  --lilac-l: #C3AEFF; --lilac-d: #6C4FC4;
  --grey-d: #8A8FA0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* stage box: 9:19.5 portrait, letterboxed */
  --stage-w: min(100vw, calc(100vh * 9 / 19.5));
  --stage-h: min(100vh, calc(100vw * 19.5 / 9));
  --u: calc(var(--stage-w) / 360);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; background: #000; overflow: hidden;
  font-family: var(--font); color: var(--navy);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
#stage {
  position: absolute; left: 50%; top: 50%;
  width: var(--stage-w); height: var(--stage-h);
  transform: translate(-50%, -50%);
  overflow: hidden; background: #3DB6F0;
}
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#world-labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#ui-root { position: absolute; inset: 0; pointer-events: none; }
#ui-root > * { pointer-events: auto; }

/* floating world text (+x.xx) */
.float-text {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none;
  font: 900 calc(var(--u) * 15) / 1 var(--font); color: #FFD84A;
  -webkit-text-stroke: calc(var(--u) * 1.1) #5A3A12; paint-order: stroke fill;
  text-shadow: 0 calc(var(--u) * 1.5) 0 rgba(60, 30, 0, .35);
  will-change: transform, opacity;
}
.float-text.small { font-size: calc(var(--u) * 12); }
.float-icon {
  position: absolute; left: 0; top: 0; pointer-events: none;
  font: 900 calc(var(--u) * 14) / 1 var(--font); color: #fff;
  -webkit-text-stroke: calc(var(--u) * 1) #8A1E1E; paint-order: stroke fill;
}

#err-overlay {
  display: none; position: fixed; left: 4px; right: 4px; bottom: 4px; z-index: 9999;
  max-height: 45vh; overflow: auto; white-space: pre-wrap;
  background: rgba(160, 0, 0, .88); color: #fff; font: 11px/1.3 monospace; padding: 6px; border-radius: 6px;
}
