:root {
  color-scheme: dark;
  --bg: #10151a;
  --panel: #171e24;
  --panel-2: #202932;
  --ink: #f2f6ee;
  --muted: #9aa8a0;
  --line: #33414a;
  --line-strong: #52636d;
  --accent: #e4b35d;
  --accent-2: #7ed481;
  --danger: #d86c63;
  --cell: 32px;
  --board-cols: 32;
  --board-rows: 20;
  --asset-card: 48px;
  --asset-thumb: 38px;
  --asset-number-line: 10px;
  --map-background-color: #79bf63;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.world-page {
  --world-hud: rgba(12, 20, 24, .86);
  --world-border: #6aaad6;
  --world-ocean: #277fba;
  --world-land: #74c756;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px),
    #071014;
  background-size: 32px 32px;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #25313a;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

button:hover,
button.active {
  border-color: var(--accent);
  color: #fff0c9;
}

button.primary-action {
  border-color: #5f9d61;
  background: #2d6f38;
  color: #f1fff0;
}

button.primary-action:hover {
  border-color: var(--accent-2);
  color: #ffffff;
}

button.danger-action {
  border-color: #7c3e3b;
  background: #3a2427;
  color: #ffd5cf;
}

button.danger-action:hover {
  border-color: var(--danger);
  color: #fff0ed;
}

.wallet-connect {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.wallet-connect[data-wallet-state="connected"] {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.wallet-button[data-wallet-connected="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-color: rgba(111, 191, 117, .72);
  background: rgba(45, 111, 56, .84);
  color: #f1fff0;
}

.wallet-button[data-wallet-connected="true"] svg {
  width: 22px;
  height: 22px;
}

.wallet-game-icon {
  display: block;
}

.wallet-game-icon-back,
.wallet-game-icon-front,
.wallet-game-icon-pocket {
  fill: none;
  stroke: #effff0;
  stroke-width: 1.8;
  shape-rendering: crispEdges;
}

.wallet-game-icon-dot {
  fill: #effff0;
  shape-rendering: crispEdges;
}

.wallet-address {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #d9eadf;
  font-size: 12px;
  font-weight: 760;
}

.wallet-connect[data-wallet-state="connected"] .wallet-address {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 8px;
  border: 1px solid rgba(111, 191, 117, .72);
  border-radius: 6px;
  background: rgba(45, 111, 56, .84);
  max-width: 116px;
  color: #e8ffe7;
  font-size: 10px;
  line-height: 1.1;
}

.wallet-connect[data-standard-state="connected"] .wallet-address {
  display: none;
}

.wallet-button[data-standard-connected="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-color: rgba(111, 191, 117, .72);
  background: rgba(45, 111, 56, .84);
  color: #f1fff0;
}

.auth-login-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(239, 247, 233, .16);
}

.auth-login-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0d1914;
  background: #eaf7e2;
  font-size: 12px;
  font-weight: 900;
}

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

.editor-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px),
    #10151a;
  background-size: 32px 32px;
}

body.editor-mobile-fullscreen {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body.editor-mobile-fullscreen .editor-shell {
  width: 100svw;
  height: 100svh;
  max-width: 100svw;
  max-height: 100svh;
}

.landscape-hint {
  display: none;
}

.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 24, 29, .96);
}

.editor-brand,
.world-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  image-rendering: pixelated;
  border-radius: 7px;
  background: url("/assets/gamegmeta-logo.png?v=chest-logo-20260618b") center / cover no-repeat;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

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

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.canvas-panel,
.asset-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 44px rgba(0, 0, 0, .28);
}

.canvas-panel {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.canvas-head,
.asset-head {
  min-height: 58px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 32, 38, .92);
}

.canvas-head strong,
.asset-head strong {
  display: block;
  font-size: 15px;
}

.canvas-head span,
.asset-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.canvas-stats {
  display: flex;
  gap: 8px;
}

.canvas-stats span {
  margin: 0;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #c9d5cc;
  background: #11181d;
}

.map-frame {
  min-height: 0;
  position: relative;
  overflow: auto;
  padding: 18px;
  background: #0c1115;
  -webkit-overflow-scrolling: touch;
}

.map-eraser-button {
  position: absolute;
  left: 26px;
  top: 26px;
  z-index: 20;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(16, 24, 28, .26);
  border-radius: 6px;
  color: #11181d;
  background: rgba(245, 246, 243, .96);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .34);
  cursor: pointer;
}

.map-eraser-button:hover,
.map-eraser-button.active {
  border-color: rgba(255, 216, 84, .82);
  background: rgba(255, 249, 226, .98);
}

.map-board.eraser-active {
  cursor: crosshair;
}

.eraser-pixel-icon {
  width: 25px;
  height: 25px;
  background: url("/assets/editor-eraser.png") center / contain no-repeat;
  image-rendering: auto;
}

.map-board {
  position: relative;
  width: calc(var(--board-cols) * var(--cell));
  height: calc(var(--board-rows) * var(--cell));
  margin: 0 auto;
  border: 2px solid #5e6f78;
  background-color: var(--map-background-color);
  background-image: none;
  image-rendering: pixelated;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .36);
  touch-action: none;
}

.map-board::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(18, 53, 29, .24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 53, 29, .24) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
}

.grid-cell {
  position: absolute;
  z-index: 1;
  width: var(--cell);
  height: var(--cell);
  appearance: none;
  -webkit-appearance: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-repeat: repeat;
  background-size: var(--cell) var(--cell);
  image-rendering: pixelated;
  box-shadow: none;
  outline: 0;
}

.grid-cell.drop-target {
  outline: 0;
}

.grid-cell.drop-target::after,
button.grid-cell:hover::after,
button.grid-cell:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(255, 236, 157, .5);
}

.stamp {
  position: absolute;
  z-index: 3;
  display: block;
  image-rendering: pixelated;
  object-fit: contain;
  user-select: none;
  cursor: move;
}

.stamp.dialogue-npc-stamp {
  z-index: 8;
}

.stamp.selected {
  filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 8px rgba(255, 220, 115, .95));
}

.stamp.blocking::after {
  content: "";
}

.asset-panel {
  display: grid;
  grid-template-rows: auto 1fr;
}

.asset-head {
  align-items: start;
}

.asset-controls {
  display: grid;
  grid-template-columns: minmax(132px, .85fr) minmax(150px, 1fr) minmax(110px, .8fr) auto;
  gap: 8px;
}

#assetSearch,
#packageSelect,
#purposeSelect {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #10171c;
  color: var(--ink);
  outline: none;
}

#deleteAssetMode {
  white-space: nowrap;
  padding: 0 10px;
}

#deleteAssetMode.active {
  border-color: var(--danger);
  background: #593033;
  color: #fff0ed;
}

#editorFullscreen {
  display: none;
}

#editorFullscreen {
  border-color: #ff756c;
  background: linear-gradient(#e94943, #a9171f);
  color: #fff7f2;
  box-shadow: 0 0 0 1px rgba(255, 175, 160, .22), 0 0 12px rgba(233, 73, 67, .34);
}

#editorFullscreen:hover {
  border-color: #ffb1a9;
  color: #ffffff;
}

#assetSearch:focus,
#packageSelect:focus,
#purposeSelect:focus {
  border-color: var(--accent);
}

.saved-map-bar {
  min-height: 48px;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto auto minmax(140px, 1.2fr) auto auto;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #141c22;
}

.saved-map-bar label {
  color: #cbd7d0;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.saved-map-bar input,
.saved-map-bar select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #10171c;
  color: var(--ink);
  outline: none;
}

.saved-map-bar input:focus,
.saved-map-bar select:focus {
  border-color: var(--accent);
}

.share-map-bar {
  min-height: 46px;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) minmax(120px, auto);
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #10181d;
}

.share-map-bar label {
  color: #cbd7d0;
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
}

.share-map-bar input {
  width: 100%;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #0c1216;
  color: #cfe6d5;
  outline: none;
  font-size: 12px;
}

.share-map-bar input:focus {
  border-color: var(--accent);
}

.asset-list {
  min-height: 0;
  overflow: auto;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--asset-card));
  grid-auto-rows: calc(var(--asset-card) + var(--asset-number-line));
  align-content: start;
  justify-content: start;
  column-gap: 8px;
  row-gap: 6px;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.asset-card {
  position: relative;
  width: var(--asset-card);
  height: calc(var(--asset-card) + var(--asset-number-line));
  min-width: var(--asset-card);
  min-height: calc(var(--asset-card) + var(--asset-number-line));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: center;
  display: grid;
  grid-template-rows: var(--asset-card) var(--asset-number-line);
  place-items: center;
  overflow: visible;
  touch-action: manipulation;
}

.asset-list.delete-mode .asset-card {
  cursor: default;
}

.asset-card.active {
  background: transparent;
}

.asset-card img {
  width: var(--asset-thumb);
  height: var(--asset-thumb);
  max-width: var(--asset-thumb);
  max-height: var(--asset-thumb);
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
  display: block;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #2a343b;
  padding: 4px;
}

.asset-card.active img {
  border-color: var(--accent);
  background: #2c352f;
}

.asset-delete-button {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 2;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 1px solid rgba(255, 210, 204, .9);
  border-radius: 50%;
  background: #6c2e31;
  color: #fff3f0;
  font-size: 14px;
  line-height: 16px;
  display: grid;
  place-items: center;
}

.asset-delete-button:hover {
  border-color: #ffffff;
  background: #9c3e41;
  color: #ffffff;
}

.asset-card span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.asset-card small {
  position: static;
  align-self: end;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #9aa8a0;
  font-size: 7px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 0;
  pointer-events: none;
  text-align: center;
}

.asset-card.asset-note {
  aspect-ratio: auto;
  width: 118px;
  min-height: 68px;
  padding: 10px;
  place-items: start;
  text-align: left;
}

.asset-card.asset-note span {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  display: block;
  color: #d9e5d9;
  font-size: 12px;
}

.world-map-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 12, 15, .82);
}

.world-map-overlay[hidden] {
  display: none;
}

.world-page-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  background: radial-gradient(circle at 50% 45%, rgba(39, 127, 186, .12), transparent 62%);
}

.world-map-panel {
  width: min(1120px, 96vw);
  height: min(820px, 92vh);
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid #536875;
  border-radius: 8px;
  background: #111a1f;
  box-shadow: 0 28px 80px rgba(0, 0, 0, .5);
  overflow: hidden;
}

.world-map-topbar {
  min-height: 64px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(106, 170, 214, .36);
  background: rgba(20, 30, 35, .96);
}

.world-brand-copy {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.world-page-hud {
  background: var(--world-hud);
  backdrop-filter: blur(8px);
}

.world-map-topbar strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.world-map-topbar span {
  display: block;
  margin-top: 8px;
  color: #b9c9c5;
  font-size: 12px;
  max-width: min(760px, 52vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-map-actions,
.world-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 0;
}

.world-view-toggle {
  padding: 3px;
  border: 1px solid rgba(210, 238, 219, .16);
  border-radius: 8px;
  background: rgba(9, 15, 18, .72);
}

.world-view-toggle button {
  min-width: 70px;
  min-height: 32px;
  padding: 0 12px;
  border-color: transparent;
  background: transparent;
  color: #c8d9d2;
}

.world-view-toggle button.active {
  border-color: rgba(241, 201, 90, .78);
  background: rgba(41, 55, 62, .95);
  color: #fff2bf;
}

.world-map-stage {
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px 24px 24px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
    #081218;
  background-size: 24px 24px;
  touch-action: none;
  user-select: none;
}

.world-map-surface {
  --world-cols: 24;
  --world-rows: 16;
  --world-cell-px: 32px;
  position: relative;
  width: 768px;
  height: 512px;
  min-width: 320px;
  min-height: 260px;
  aspect-ratio: var(--world-cols) / var(--world-rows);
  border: 6px solid #0a3550;
  outline: none;
  overflow: hidden;
  image-rendering: pixelated;
  transform-origin: center center;
  will-change: transform;
  background: #176fb1;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, .48),
    inset 0 0 0 2px rgba(255, 255, 255, .16);
}

.world-map-surface[hidden] {
  display: none;
}

.world-planet-canvas {
  display: block;
  width: min(100%, 980px);
  height: min(100%, 720px);
  min-width: 280px;
  min-height: 240px;
  border: 1px solid rgba(106, 170, 214, .42);
  border-radius: 10px;
  outline: none;
  background: #010409;
  box-shadow:
    0 28px 90px rgba(0, 0, 0, .52),
    inset 0 0 0 1px rgba(255, 255, 255, .08);
  touch-action: none;
  cursor: grab;
}

.world-planet-canvas:active {
  cursor: grabbing;
}

.world-planet-canvas[hidden] {
  display: none;
}

.world-map-surface::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    linear-gradient(rgba(232, 250, 255, .30) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 250, 255, .30) 1px, transparent 1px);
  background-size:
    calc(100% / var(--world-cols)) calc(100% / var(--world-rows)),
    calc(100% / var(--world-cols)) calc(100% / var(--world-rows));
}

.world-cell {
  position: absolute;
  z-index: 1;
  display: block;
  pointer-events: none;
}

.world-cell.ocean {
  background: #1d73b8;
}

.world-cell.land {
  background: #cfb8f4;
}

.world-cell.ocean.v1 {
  background: #1769aa;
}

.world-cell.ocean.v2 {
  background: #247fc4;
}

.world-cell.ocean.v3 {
  background: #1b6fb1;
}

.world-cell.ocean.v4 {
  background: #2a85c8;
}

.world-cell.land.v1 {
  background: #d8c5f8;
}

.world-cell.land.v2 {
  background: #c8adf0;
}

.world-cell.land.v3 {
  background: #e1cffb;
}

.world-cell.land.v4 {
  background: #c1a4ec;
}

.world-cell.land.mapped {
  background: #63b844;
}

.world-cell.land.mapped.v1 {
  background: #75c851;
}

.world-cell.land.mapped.v2 {
  background: #56a83d;
}

.world-cell.land.mapped.v3 {
  background: #88d35b;
}

.world-cell.land.mapped.v4 {
  background: #6fbd48;
}

.world-cell.land.online {
  background: #f08a2b;
}

.world-cell.land.online.v1 {
  background: #ff9a34;
}

.world-cell.land.online.v2 {
  background: #de7622;
}

.world-cell.land.online.v3 {
  background: #f6a94c;
}

.world-cell.land.online.v4 {
  background: #ce681d;
}

.world-map-marker {
  position: absolute;
  z-index: 4;
  width: calc(82% / var(--world-cols));
  height: calc(82% / var(--world-rows));
  min-width: 0;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #1b1008;
  font-size: max(7px, calc(var(--world-cell-px) * .5));
  font-weight: 950;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.world-map-marker[data-online-count="0"],
.world-map-marker:not([data-online-count]) {
  color: transparent;
}

.world-map-marker:hover,
.world-map-marker:focus {
  box-shadow: inset 0 0 0 2px rgba(255, 231, 107, .75);
  outline: none;
}

.world-player {
  position: absolute;
  z-index: 5;
  width: calc(78% / var(--world-cols));
  height: calc(78% / var(--world-rows));
  transform: translate(-50%, -50%);
  background:
    linear-gradient(#1b1b22 0 0) 50% 16% / 44% 24% no-repeat,
    linear-gradient(#e8bb77 0 0) 50% 42% / 56% 34% no-repeat,
    linear-gradient(#2b637b 0 0) 50% 78% / 64% 34% no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .55));
  pointer-events: none;
}

.world-map-tooltip {
  position: absolute;
  z-index: 7;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid #6f7e72;
  border-radius: 6px;
  background: rgba(12, 19, 22, .94);
  color: #f2f8ef;
  font-size: 12px;
  font-weight: 760;
  pointer-events: none;
  white-space: nowrap;
}

@media (max-height: 520px) {
  .world-page-shell {
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .world-map-topbar {
    min-height: 58px;
    padding: 8px 12px;
  }

  .world-map-topbar strong {
    font-size: 16px;
  }

  .world-map-topbar span {
    margin-top: 4px;
  }

  .world-map-stage {
    padding: 10px 12px 12px;
  }

  .world-map-surface {
    width: calc(100vw - 24px);
    height: calc(100vh - 82px);
    min-height: 180px;
  }
}

@media (max-width: 640px) {
  .world-page-shell {
    grid-template-rows: 56px minmax(0, 1fr);
  }

  .world-map-topbar {
    min-height: 56px;
    padding: 8px 10px;
    gap: 8px;
  }

  .world-map-actions {
    gap: 6px;
  }

  .world-view-toggle {
    gap: 4px;
    padding: 2px;
  }

  .world-map-topbar strong {
    font-size: 16px;
  }

  .world-map-topbar span {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.25;
    max-width: 34vw;
  }

  .world-map-topbar button {
    min-width: 0;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.1;
  }

  .world-view-toggle button {
    min-width: 50px;
    min-height: 30px;
    padding: 0 8px;
  }

  .world-map-stage {
    padding: 8px;
  }

  .world-map-surface {
    min-width: 0;
    min-height: 0;
    border-width: 4px;
  }

  .world-planet-canvas {
    width: calc(100vw - 16px);
    height: calc(100vh - 72px);
    min-height: 220px;
  }
}

.statusbar {
  min-height: 36px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  background: #12191e;
  color: var(--muted);
  font-size: 12px;
}

.statusbar span:first-child {
  color: #dfe9db;
}

@media (max-width: 720px) {
  :root {
    --asset-card: 44px;
    --asset-thumb: 34px;
  }

  .saved-map-bar {
    grid-template-columns: 1fr 1fr;
  }

  .share-map-bar {
    grid-template-columns: 1fr auto;
  }

  .share-map-bar input {
    grid-column: 1 / -1;
    order: 3;
  }

  .saved-map-bar label {
    align-self: end;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 52vh) minmax(260px, 1fr);
  }

  .canvas-panel,
  .asset-panel {
    min-height: 0;
  }

  .asset-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    height: auto;
    align-items: start;
    flex-direction: column;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
    grid-template-rows: minmax(340px, 50vh) minmax(260px, 1fr);
  }

  :root {
    --asset-card: 42px;
    --asset-thumb: 32px;
  }

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

  .asset-head,
  .canvas-head {
    align-items: stretch;
    flex-direction: column;
  }

  .asset-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) and (orientation: landscape),
  (max-width: 640px) and (orientation: portrait),
  (pointer: coarse) and (max-height: 640px),
  (max-height: 640px) and (orientation: landscape) {
  :root {
    --asset-card: 42px;
    --asset-thumb: 32px;
    --asset-number-line: 8px;
  }

  .topbar {
    height: 36px;
    padding: 3px 7px;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  h1 {
    font-size: 12px;
    white-space: nowrap;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    border-radius: 6px;
  }

  .toolbar {
    gap: 4px;
    flex-wrap: nowrap;
  }

  .toolbar button,
  .wallet-button {
    min-height: 24px;
    padding: 0 6px;
    font-size: 9px;
    border-radius: 5px;
  }

  #editorFullscreen {
    display: inline-block;
  }

  .wallet-connect:not([data-wallet-state="connected"]) .wallet-address {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1.12fr) minmax(230px, .88fr);
    grid-template-rows: 1fr;
    gap: 5px;
    padding: 5px;
  }

  .canvas-head,
  .asset-head {
    min-height: 28px;
    padding: 3px 6px;
    flex-direction: row;
    align-items: center;
    gap: 5px;
  }

  .canvas-head strong,
  .asset-head strong {
    font-size: 10px;
  }

  .canvas-head span,
  .asset-head span,
  .canvas-stats {
    display: none;
  }

  .saved-map-bar {
    min-height: 28px;
    grid-template-columns: minmax(90px, 1fr) auto minmax(100px, 1fr) auto auto;
    padding: 3px 5px;
    gap: 4px;
  }

  .saved-map-bar label {
    display: none;
  }

  .saved-map-bar input,
  .saved-map-bar select,
  .saved-map-bar button,
  .share-map-bar input,
  .share-map-bar button {
    min-height: 23px;
    padding: 0 6px;
    font-size: 9px;
    border-radius: 5px;
  }

  .share-map-bar {
    min-height: 28px;
    padding: 3px 5px;
    gap: 4px;
  }

  .map-frame {
    padding: 4px;
    overflow: hidden;
    touch-action: none;
  }

  .map-board {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    transform-origin: 0 0;
    will-change: transform;
  }

  .asset-controls {
    grid-template-columns: 1fr 1fr;
    gap: 3px;
  }

  #assetSearch,
  #packageSelect,
  #purposeSelect,
  #deleteAssetMode {
    min-height: 23px;
    padding: 0 6px;
    font-size: 9px;
    border-radius: 5px;
  }

  .asset-list {
    padding: 5px;
    column-gap: 6px;
    row-gap: 4px;
  }

  .statusbar {
    min-height: 0;
    height: 0;
    padding: 0;
    overflow: hidden;
    border-top: 0;
  }
}

@media (max-width: 760px) and (orientation: portrait),
  (pointer: coarse) and (orientation: portrait) {
  html,
  body {
    position: fixed;
    inset: 0;
    overflow: hidden;
  }

  .editor-shell,
  body.editor-mobile-fullscreen .editor-shell {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 100svh;
    height: 100svw;
    max-width: 100svh;
    max-height: 100svw;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
  }

  .landscape-hint {
    display: none;
  }
}

/* Grass brand system shared by editor and world subpages. */
:root {
  --bg: #d9ffd6;
  --panel: rgba(255, 251, 231, .94);
  --panel-2: rgba(233, 255, 214, .96);
  --ink: #12351d;
  --muted: #42604a;
  --line: rgba(18, 53, 29, .28);
  --line-strong: #12351d;
  --accent: #ffd65a;
  --accent-2: #5fcb4d;
  --danger: #c9413d;
  --grass: #5fcb4d;
  --grass-2: #a7e957;
  --deep: #12351d;
  --cream: #fffbe7;
  --gold: #ffd65a;
  --sky: #bdefff;
  --button-shadow: 4px 4px 0 rgba(18, 53, 29, .2);
  --button-shadow-hover: 6px 6px 0 rgba(18, 53, 29, .24);
  --card-shadow: 8px 8px 0 rgba(18, 53, 29, .13);
}

html,
body {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .24) 25%, transparent 25% 50%, rgba(255, 255, 255, .18) 50% 75%, transparent 75%),
    linear-gradient(180deg, #dfffd1 0%, #8bdd69 58%, #62c84f 100%);
  background-size: 34px 34px, auto;
  color: var(--ink);
}

body.world-page {
  --world-hud: rgba(255, 251, 231, .92);
  --world-border: #12351d;
  --world-ocean: #2f91cf;
  --world-land: #cdb2f2;
  background:
    linear-gradient(rgba(18, 53, 29, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 53, 29, .08) 1px, transparent 1px),
    linear-gradient(180deg, #dfffd1 0%, #8bdd69 100%);
  background-size: 32px 32px, 32px 32px, auto;
}

.editor-shell {
  background:
    linear-gradient(rgba(18, 53, 29, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 53, 29, .08) 1px, transparent 1px),
    rgba(217, 255, 214, .82);
  background-size: 32px 32px;
}

.topbar,
.world-map-topbar,
.statusbar {
  border-color: rgba(18, 53, 29, .28);
  background: rgba(255, 251, 231, .94);
  color: var(--deep);
  box-shadow: 0 4px 0 rgba(18, 53, 29, .12);
}

.editor-brand,
.world-brand {
  color: var(--deep);
  text-decoration: none;
  font-weight: 950;
}

.brand-mark {
  border: 3px solid var(--deep);
  background-color: var(--cream);
  box-shadow: 3px 3px 0 rgba(18, 53, 29, .2);
}

button,
#assetSearch,
#packageSelect,
#purposeSelect,
.saved-map-bar input,
.saved-map-bar select,
.share-map-bar input {
  border: 3px solid var(--deep);
  border-radius: 14px;
  background: var(--cream);
  color: var(--deep);
  font-weight: 900;
  box-shadow: var(--button-shadow);
}

button {
  min-height: 38px;
  padding: 0 14px;
}

button:hover,
button.active,
#assetSearch:focus,
#packageSelect:focus,
#purposeSelect:focus,
.saved-map-bar input:focus,
.saved-map-bar select:focus,
.share-map-bar input:focus {
  border-color: var(--deep);
  color: var(--deep);
  background: #fff7c2;
  box-shadow: var(--button-shadow-hover);
}

button.grid-cell,
button.grid-cell:hover,
button.grid-cell:focus,
button.grid-cell:active,
button.grid-cell.active {
  width: var(--cell);
  height: var(--cell);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: inherit;
  box-shadow: none;
  outline: 0;
}

button.primary-action {
  border-color: var(--deep);
  background: linear-gradient(180deg, var(--grass-2), var(--grass));
  color: var(--deep);
}

button.danger-action,
#editorFullscreen {
  border-color: #5b1718;
  background: linear-gradient(180deg, #ff706a, #c9413d);
  color: #fff9ef;
}

.wallet-connect[data-wallet-state="connected"] .wallet-address,
.wallet-button[data-wallet-connected="true"],
.wallet-button[data-standard-connected="true"] {
  border: 3px solid var(--deep);
  border-radius: 14px;
  background: linear-gradient(180deg, var(--grass-2), #2e8f3e);
  color: #fffbe7;
  box-shadow: var(--button-shadow);
}

.canvas-panel,
.asset-panel,
.world-map-panel {
  border: 4px solid var(--deep);
  border-radius: 18px;
  background: rgba(255, 251, 231, .94);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.canvas-head,
.asset-head,
.saved-map-bar,
.share-map-bar {
  border-color: rgba(18, 53, 29, .22);
  background: rgba(233, 255, 214, .92);
  color: var(--deep);
}

.canvas-head span,
.asset-head span,
.saved-map-bar label,
.share-map-bar label,
.statusbar {
  color: var(--muted);
}

.canvas-stats span {
  border: 2px solid rgba(18, 53, 29, .3);
  background: var(--cream);
  color: var(--deep);
  font-weight: 900;
}

.asset-head {
  align-items: center;
}

.canvas-head {
  display: none;
}

.asset-head strong {
  font-size: 12px;
  line-height: 1.1;
}

.asset-controls {
  grid-template-columns: minmax(156px, .9fr) minmax(180px, 1fr) minmax(160px, .9fr) auto;
  align-items: center;
}

#assetSearch,
#packageSelect,
#purposeSelect,
#deleteAssetMode {
  min-height: 36px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

#assetSearch,
#packageSelect,
#purposeSelect {
  padding: 0 11px;
}

#deleteAssetMode {
  padding: 0 12px;
  white-space: nowrap;
}

.saved-map-bar {
  grid-template-columns: auto minmax(140px, 1fr) auto auto minmax(170px, 1.25fr) auto auto;
}

.saved-map-bar label {
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.share-map-bar label {
  color: var(--deep);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.saved-map-bar input,
.saved-map-bar select,
.saved-map-bar button,
.share-map-bar input,
.share-map-bar button {
  min-height: 36px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.1;
}

.saved-map-bar input,
.saved-map-bar select,
.share-map-bar input {
  padding: 0 11px;
}

.saved-map-bar button,
.share-map-bar button {
  padding: 0 12px;
  white-space: nowrap;
}

.tg-group-status {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
}

.tg-group-status[data-state="valid"] {
  color: #2e8f3e;
}

.tg-group-status[data-state="invalid"] {
  color: #c9413d;
}

#openSavedMap {
  border-color: #6b3412;
  background: linear-gradient(180deg, #ffbf57, #ee7f24);
  color: #3b1b08;
  animation: open-button-breathe 2.4s ease-in-out infinite;
}

#openSavedMap:hover,
#openSavedMap:focus {
  background: linear-gradient(180deg, #ffd27a, #ff922e);
  color: #2c1205;
}

@keyframes open-button-breathe {
  0%,
  100% {
    box-shadow: var(--button-shadow), 0 0 0 rgba(238, 127, 36, 0);
    filter: saturate(1);
  }

  50% {
    box-shadow: var(--button-shadow-hover), 0 0 14px rgba(238, 127, 36, .42);
    filter: saturate(1.16);
  }
}

.map-frame {
  background: rgba(217, 255, 214, .78);
}

.map-board {
  border: 4px solid var(--deep);
  background-image: none;
  box-shadow: none;
}

.map-eraser-button,
.asset-card img {
  border: 3px solid rgba(18, 53, 29, .55);
  border-radius: 10px;
  background: rgba(255, 251, 231, .92);
  box-shadow: 3px 3px 0 rgba(18, 53, 29, .16);
}

.map-eraser-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  line-height: 0;
}

.map-eraser-button .eraser-pixel-icon {
  display: block;
  width: 24px;
  height: 24px;
  background-position: center;
  background-size: contain;
}

.asset-card.active img {
  border-color: var(--gold);
  background: #fff7c2;
  box-shadow: 0 0 0 2px rgba(18, 53, 29, .18), 4px 4px 0 rgba(18, 53, 29, .18);
}

.asset-card small {
  color: #42604a;
  font-weight: 700;
}

.world-page-shell {
  gap: 14px;
  padding: 14px;
  grid-template-rows: auto minmax(0, 1fr);
  background:
    radial-gradient(circle at 50% 42%, rgba(189, 239, 255, .44), transparent 62%),
    rgba(217, 255, 214, .78);
}

.world-page-hud {
  backdrop-filter: blur(10px);
}

.world-map-topbar span {
  color: var(--muted);
}

.world-map-topbar {
  min-height: 64px;
  border: 4px solid var(--deep);
  border-radius: 22px;
  box-shadow: var(--card-shadow);
}

.world-brand-copy {
  flex: 1 1 460px;
  max-width: min(720px, 52vw);
}

.world-brand {
  width: max-content;
}

.world-map-topbar span {
  max-width: 100%;
}

.world-map-actions {
  gap: 10px;
}

.world-view-toggle {
  border: 3px solid var(--deep);
  border-radius: 16px;
  background: rgba(255, 251, 231, .8);
  box-shadow: var(--button-shadow);
}

.world-view-toggle button {
  box-shadow: none;
}

.world-view-toggle button.active {
  border-color: var(--deep);
  background: linear-gradient(180deg, var(--gold), #f0b94a);
  color: var(--deep);
}

.world-map-stage {
  border: 4px solid var(--deep);
  border-radius: 24px;
  background:
    linear-gradient(rgba(18, 53, 29, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 53, 29, .08) 1px, transparent 1px),
    rgba(217, 255, 214, .74);
  background-size: 24px 24px;
  box-shadow: var(--card-shadow);
}

.world-map-surface,
.world-planet-canvas {
  border-color: var(--deep);
  box-shadow: 6px 6px 0 rgba(18, 53, 29, .16);
}

.world-map-tooltip {
  border: 3px solid var(--deep);
  border-radius: 14px;
  background: var(--cream);
  color: var(--deep);
  box-shadow: var(--button-shadow);
}

@media (max-width: 920px) and (orientation: landscape),
  (max-width: 640px) and (orientation: portrait),
  (pointer: coarse) and (max-height: 640px),
  (max-height: 640px) and (orientation: landscape) {
  .toolbar button,
  .wallet-button,
  .saved-map-bar input,
  .saved-map-bar select,
  .saved-map-bar button,
  .share-map-bar input,
  .share-map-bar button,
  #assetSearch,
  #packageSelect,
  #purposeSelect,
  #deleteAssetMode {
    min-height: 23px;
    padding: 0 6px;
    border-width: 2px;
    border-radius: 6px;
    font-size: 9px;
    box-shadow: 2px 2px 0 rgba(18, 53, 29, .16);
  }

  .topbar {
    height: 36px;
    padding: 3px 7px;
  }

  .brand-mark {
    width: 24px;
    height: 24px;
    border-width: 2px;
    border-radius: 6px;
  }

  .canvas-panel,
  .asset-panel {
    border-width: 2px;
    border-radius: 10px;
    box-shadow: 3px 3px 0 rgba(18, 53, 29, .12);
  }

  .map-board {
    border-width: 2px;
    box-shadow: none;
  }

  .asset-card img {
    border-width: 2px;
    border-radius: 7px;
    box-shadow: 2px 2px 0 rgba(18, 53, 29, .12);
  }
}

@media (max-width: 640px) {
  .world-map-topbar button,
  .world-view-toggle button {
    min-height: 30px;
    padding: 0 8px;
    border-width: 2px;
    border-radius: 10px;
    font-size: 12px;
    box-shadow: 2px 2px 0 rgba(18, 53, 29, .14);
  }

  .world-map-topbar {
    min-height: 64px;
    padding: 8px 10px;
    border-width: 3px;
    border-radius: 18px;
    align-items: center;
  }

  .world-view-toggle {
    border-width: 2px;
    border-radius: 12px;
  }

  .world-page-shell {
    gap: 8px;
    padding: 8px;
  }

  .world-brand-copy {
    flex: 1 1 118px;
    max-width: 118px;
    gap: 2px;
  }

  .world-brand {
    gap: 7px;
  }

  .world-map-topbar span {
    display: none;
  }

  .world-map-actions {
    gap: 5px;
  }

  .world-map-stage {
    border-width: 3px;
    border-radius: 18px;
  }
}
