/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none;
}

/* Live Wallet Hub identity + server-owned Graveyard Stash */
.game-wallet-panel[hidden] {
  display: none;
}

.game-wallet-panel {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 26px);
  color: #f8f3d8;
  font-family: "Trebuchet MS", Arial, sans-serif;
  pointer-events: auto;
}

.game-wallet-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background:
    radial-gradient(circle at 75% 16%, rgba(58, 215, 177, 0.11), transparent 33%),
    radial-gradient(circle at 18% 88%, rgba(143, 83, 214, 0.18), transparent 38%),
    rgba(2, 5, 7, 0.84);
  backdrop-filter: blur(9px);
  cursor: default;
}

.game-wallet-shell {
  --wallet-mint: #8ff4d1;
  --wallet-acid: #d9f06f;
  --wallet-violet: #9d78ec;
  position: relative;
  width: min(1080px, 100%);
  max-height: min(880px, calc(100vh - 24px));
  overflow: auto;
  border: 1px solid rgba(143, 244, 209, 0.48);
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 32%),
    linear-gradient(155deg, #12101a 0%, #080c10 48%, #081814 100%);
  box-shadow:
    0 28px 90px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(157, 120, 236, 0.18) inset,
    0 0 54px rgba(78, 222, 180, 0.11);
  scrollbar-color: rgba(143, 244, 209, 0.42) rgba(4, 8, 9, 0.7);
}

.game-wallet-embedded {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  background: #080a09;
}

.game-wallet-embedded[hidden] { display: none; }

.game-wallet-embedded-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 70px 13px 18px;
  border-bottom: 1px solid rgba(143, 244, 209, 0.2);
  background: #0a1110;
}

.game-wallet-embedded-header strong { display: block; margin-top: 3px; color: #fffbe7; }
.game-wallet-embedded-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.game-wallet-embedded-actions button {
  min-height: 36px;
  border: 1px solid rgba(143, 244, 209, 0.32);
  border-radius: 7px;
  padding: 0 12px;
  color: var(--wallet-mint);
  background: rgba(143, 244, 209, 0.08);
  cursor: pointer;
  font: 700 11px monospace;
}
.game-wallet-embedded-actions button:hover,
.game-wallet-embedded-actions button:focus-visible {
  border-color: var(--wallet-mint);
  color: #fffbe7;
  outline: none;
}
.game-wallet-embedded-close {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 42px;
  height: 42px;
  margin: 0;
  transform: translateY(-50%);
  border: 1px solid rgba(143, 244, 209, 0.42);
  border-radius: 50%;
  padding: 0;
  color: #f8f3d8;
  background: rgba(8, 14, 16, 0.92);
  cursor: pointer;
  font: 400 30px/38px Arial, sans-serif;
}
.game-wallet-embedded-close:hover,
.game-wallet-embedded-close:focus-visible {
  border-color: var(--wallet-mint);
  color: var(--wallet-mint);
  outline: none;
  box-shadow: 0 0 0 3px rgba(143, 244, 209, 0.12);
}
.game-wallet-embedded[data-destination="wallet-hub"] #gameWalletEmbeddedWallet,
.game-wallet-embedded[data-destination="stash-trade"] #gameWalletEmbeddedTrade,
.game-wallet-embedded[data-destination="market"] #gameWalletEmbeddedMarket { display: none; }
.game-wallet-embedded iframe { width: 100%; height: 100%; min-height: 0; border: 0; background: #09080c; }
.game-wallet-embedded[data-destination="market"] iframe { display: none; }
.game-wallet-market-view[hidden] { display: none; }
.game-wallet-market-view {
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 3vw, 34px);
  color: #f8f3d8;
  background:
    radial-gradient(circle at 82% 10%, rgba(72, 231, 190, 0.12), transparent 28%),
    linear-gradient(145deg, #100d18, #08100f 65%, #071714);
}
.game-wallet-market-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.45fr);
  gap: 18px;
  align-items: stretch;
}
.game-wallet-market-hero h3 { margin: 4px 0 8px; font-size: clamp(30px, 5vw, 58px); }
.game-wallet-market-hero p { max-width: 620px; color: #a3aea9; line-height: 1.55; }
.game-wallet-market-selected {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 135px;
  border: 1px solid rgba(143, 244, 209, 0.28);
  border-radius: 16px;
  padding: 20px;
  background: rgba(6, 18, 16, 0.72);
}
.game-wallet-market-selected span { color: var(--wallet-mint); font: 800 13px monospace; letter-spacing: 0.14em; }
.game-wallet-market-selected strong { color: var(--wallet-acid); font-size: clamp(28px, 4vw, 44px); }
.game-wallet-market-selected small { color: #8d9b95; }
.game-wallet-market-chart {
  display: block;
  width: 100%;
  height: 220px;
  margin: 18px 0;
  border: 1px solid rgba(143, 244, 209, 0.22);
  border-radius: 14px;
  background: rgba(3, 10, 10, 0.72);
}
.game-wallet-market-search { display: grid; grid-template-columns: auto minmax(160px, 1fr) auto auto; gap: 8px; align-items: center; }
.game-wallet-market-search label { color: var(--wallet-mint); font: 800 11px monospace; text-transform: uppercase; }
.game-wallet-market-search input,
.game-wallet-market-search button,
.game-wallet-market-pager button {
  min-height: 40px;
  border: 1px solid rgba(143, 244, 209, 0.3);
  border-radius: 7px;
  padding: 0 12px;
  color: #f8f3d8;
  background: rgba(10, 18, 17, 0.9);
  font: 700 11px monospace;
}
.game-wallet-market-search input { width: 100%; font-weight: 400; user-select: text; }
.game-wallet-market-search button,
.game-wallet-market-pager button { cursor: pointer; }
.game-wallet-market-list { display: grid; gap: 7px; margin-top: 14px; }
.game-wallet-market-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  border: 1px solid rgba(157, 120, 236, 0.28);
  border-radius: 8px;
  padding: 8px 12px;
  color: #f8f3d8;
  background: rgba(14, 11, 22, 0.82);
  cursor: pointer;
  text-align: left;
}
.game-wallet-market-row.selected { border-color: var(--wallet-mint); background: rgba(78, 222, 180, 0.12); }
.game-wallet-market-row strong { color: var(--wallet-acid); font: 800 14px monospace; }
.game-wallet-market-row span { overflow: hidden; color: #d8d2c4; text-overflow: ellipsis; white-space: nowrap; }
.game-wallet-market-row em { color: #a7b6af; font: normal 12px monospace; }
.game-wallet-market-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: #97a49e; font: 11px monospace; }
.game-wallet-market-pager button:disabled { opacity: 0.42; cursor: default; }
.game-wallet-panel.embedded-view .game-wallet-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: min(880px, calc(100vh - 24px));
  overflow: hidden;
}
.game-wallet-panel.embedded-view .game-wallet-shell > :not(.game-wallet-embedded) { display: none; }
.game-wallet-panel.embedded-view .game-wallet-embedded {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
}

.game-wallet-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, var(--wallet-violet), var(--wallet-mint), var(--wallet-acid));
}

.game-wallet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 30px 18px;
}

.game-wallet-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--wallet-mint);
  font: 700 11px/1.2 monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.game-wallet-header h2,
.game-wallet-holdings h3 {
  margin: 0;
  color: #fffbe7;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.game-wallet-header h2 {
  font-size: clamp(29px, 4vw, 48px);
  line-height: 1;
}

.game-wallet-header h2 em {
  color: var(--wallet-mint);
  font-style: normal;
}

.game-wallet-header p {
  margin: 9px 0 0;
  color: #aebdb8;
  font-size: 14px;
}

.game-wallet-close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(143, 244, 209, 0.35);
  border-radius: 50%;
  background: rgba(8, 14, 16, 0.82);
  color: #f8f3d8;
  cursor: pointer;
  font-size: 30px;
  line-height: 34px;
}

.game-wallet-close:hover,
.game-wallet-close:focus-visible {
  border-color: var(--wallet-mint);
  color: var(--wallet-mint);
  outline: none;
}

.game-wallet-status {
  margin: 0 30px 18px;
  border: 1px solid rgba(157, 120, 236, 0.22);
  border-radius: 9px;
  background: rgba(80, 54, 130, 0.12);
  color: #c6bdd8;
  padding: 10px 12px;
  font: 12px/1.4 monospace;
}

.game-wallet-status.success { border-color: rgba(143, 244, 209, 0.3); color: var(--wallet-mint); }
.game-wallet-status.warning { border-color: rgba(240, 192, 96, 0.42); color: #f0d38b; }
.game-wallet-status.error { border-color: rgba(255, 96, 118, 0.45); color: #ff9bac; }
.game-wallet-status.loading { animation: game-wallet-pulse 1.1s ease-in-out infinite alternate; }

@keyframes game-wallet-pulse {
  from { opacity: 0.56; }
  to { opacity: 1; }
}

.game-wallet-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.25fr) repeat(2, minmax(190px, 0.8fr));
  gap: 12px;
  padding: 0 30px;
}

.game-wallet-identity,
.game-wallet-metric {
  min-height: 132px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background: rgba(4, 8, 12, 0.68);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.game-wallet-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(157, 120, 236, 0.18), transparent 55%),
    rgba(4, 8, 12, 0.76);
}

.game-wallet-identity-mark {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border: 1px solid rgba(143, 244, 209, 0.64);
  border-radius: 18px;
  background: linear-gradient(145deg, #272041, #0e3530);
  color: #f9f6db;
  box-shadow: 0 0 24px rgba(143, 244, 209, 0.18);
  font: 900 19px/1 monospace;
}

.game-wallet-identity strong,
.game-wallet-identity code {
  display: block;
}

.game-wallet-identity strong {
  margin: 7px 0 4px;
  color: #fffbe7;
  font-size: 18px;
}

.game-wallet-identity code {
  color: #a9b8b2;
  font-size: 12px;
  word-break: break-all;
}

.game-wallet-state {
  display: inline-flex;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 4px 7px;
  font: 700 9px/1 monospace;
  letter-spacing: 0.07em;
}

.game-wallet-state.ready { color: var(--wallet-mint); }
.game-wallet-state.locked { color: #f0d38b; }

.game-wallet-metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
}

.game-wallet-metric.tns {
  background:
    radial-gradient(circle at 85% 15%, rgba(217, 240, 111, 0.17), transparent 42%),
    rgba(4, 8, 12, 0.76);
}

.game-wallet-metric.season {
  background:
    radial-gradient(circle at 85% 15%, rgba(95, 176, 238, 0.14), transparent 42%),
    rgba(4, 8, 12, 0.76);
}

.game-wallet-metric > span {
  color: #91a49d;
  font: 700 10px/1.2 monospace;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.game-wallet-metric strong {
  margin: 9px 0 7px;
  color: var(--wallet-acid);
  font-size: clamp(20px, 2.5vw, 30px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.game-wallet-metric.season strong { color: #9ad8ff; font-size: clamp(16px, 2vw, 23px); }
.game-wallet-metric small { color: #89958f; font-size: 11px; line-height: 1.45; }

.game-wallet-loadout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 14px 30px 0;
  padding: 13px 16px;
  border: 1px solid rgba(217, 240, 111, 0.2);
  border-radius: 12px;
  background: rgba(217, 240, 111, 0.045);
}

.game-wallet-loadout span {
  display: block;
  color: var(--wallet-acid);
  font: 700 9px/1.2 monospace;
  letter-spacing: 0.12em;
}

.game-wallet-loadout strong { display: block; margin-top: 3px; font-size: 13px; }
.game-wallet-loadout-items { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; color: #c9d3ce; font: 11px/1.35 monospace; }
.game-wallet-loadout-items span { border-radius: 999px; background: rgba(143, 244, 209, 0.08); color: var(--wallet-mint); padding: 6px 9px; letter-spacing: 0; }

.game-wallet-holdings {
  margin: 22px 30px 0;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-wallet-holdings-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.game-wallet-holdings h3 { font-size: 25px; }
.game-wallet-holdings-head small { display: block; margin-top: 5px; color: #8e9c96; font-size: 11px; }

.game-wallet-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.game-wallet-filters button,
.game-wallet-footer button,
.game-wallet-footer a {
  border: 1px solid rgba(143, 244, 209, 0.22);
  border-radius: 999px;
  background: rgba(10, 19, 20, 0.82);
  color: #c8d4cf;
  cursor: pointer;
  font: 700 11px/1 monospace;
  text-decoration: none;
}

.game-wallet-filters button { padding: 8px 11px; }
.game-wallet-filters button:hover,
.game-wallet-filters button:focus-visible,
.game-wallet-filters button.active {
  border-color: var(--wallet-mint);
  background: rgba(143, 244, 209, 0.12);
  color: var(--wallet-mint);
  outline: none;
}

.game-wallet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.game-wallet-asset {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.035), rgba(3, 7, 10, 0.72));
  padding: 10px;
}

.game-wallet-asset-art {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  overflow: hidden;
  border: 1px solid rgba(143, 244, 209, 0.2);
  border-radius: 12px;
  background: radial-gradient(circle, rgba(143, 244, 209, 0.12), rgba(0, 0, 0, 0.3));
  color: var(--wallet-violet);
  font-size: 34px;
}

.game-wallet-asset-art.rarity-unique { border-color: rgba(255, 211, 86, 0.64); box-shadow: inset 0 0 18px rgba(255, 211, 86, 0.08); }
.game-wallet-asset-art.rarity-rare { border-color: rgba(157, 120, 236, 0.64); }
.game-wallet-asset-art.rarity-magic { border-color: rgba(94, 177, 245, 0.58); }
.game-wallet-asset-art img,
.game-wallet-asset-art canvas { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.game-wallet-asset-copy { min-width: 0; }
.game-wallet-asset-copy strong { display: block; overflow: hidden; color: #fffbe7; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.game-wallet-asset-copy small { display: block; margin: 5px 0 8px; color: #8e9c96; font: 10px/1.35 monospace; }
.game-wallet-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.game-wallet-badge { border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 999px; color: #aab5b0; padding: 3px 5px; font: 700 8px/1 monospace; }
.game-wallet-badge.rarity-unique { color: #ffd965; }
.game-wallet-badge.rarity-rare { color: #bd9cff; }
.game-wallet-badge.rarity-magic { color: #8ed6ff; }
.game-wallet-badge.permanent,
.game-wallet-badge.protected { color: var(--wallet-acid); }
.game-wallet-badge.seasonal { color: #ffb887; }
.game-wallet-badge.tradable,
.game-wallet-badge.equipped { color: var(--wallet-mint); }
.game-wallet-badge.locked { color: #f0b48c; }

.game-wallet-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(143, 244, 209, 0.26);
  border-radius: 14px;
  color: #92a099;
  padding: 34px 20px;
  text-align: center;
  font: 12px/1.5 monospace;
}

.game-wallet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 18px 30px 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.game-wallet-footer p { max-width: 500px; margin: 0; color: #87948e; font-size: 11px; line-height: 1.45; }
.game-wallet-footer p strong { color: #d8e4de; }
.game-wallet-footer > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.game-wallet-footer button,
.game-wallet-footer a { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 13px; }
.game-wallet-footer button:hover,
.game-wallet-footer button:focus-visible,
.game-wallet-footer a:hover,
.game-wallet-footer a:focus-visible { border-color: var(--wallet-mint); color: var(--wallet-mint); outline: none; }
.game-wallet-footer a.primary { border-color: rgba(217, 240, 111, 0.62); background: var(--wallet-acid); color: #182010; }
.game-wallet-footer a.primary.is-locked { border-color: #464b47; background: #242927; color: #777f7a; cursor: not-allowed; }

body.game-wallet-open #gameCanvas,
body.game-wallet-open #globeCanvas {
  filter: saturate(0.72) brightness(0.58);
}

@media (max-width: 860px) {
  .game-wallet-summary { grid-template-columns: 1fr 1fr; }
  .game-wallet-identity { grid-column: 1 / -1; }
  .game-wallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .game-wallet-footer { align-items: flex-start; flex-direction: column; }
  .game-wallet-footer > div { justify-content: flex-start; }
}

@media (max-width: 600px) {
  .game-wallet-panel { padding: 0; }
  .game-wallet-shell { width: 100%; max-height: 100dvh; min-height: 100dvh; border: 0; border-radius: 0; }
  .game-wallet-panel.embedded-view .game-wallet-shell { height: 100dvh; }
  .game-wallet-embedded-header { align-items: flex-start; flex-direction: column; }
  .game-wallet-embedded-close { top: 12px; transform: none; }
  .game-wallet-embedded-actions { width: 100%; justify-content: flex-start; }
  .game-wallet-market-hero { grid-template-columns: 1fr; }
  .game-wallet-market-search { grid-template-columns: 1fr 1fr; }
  .game-wallet-market-search label,
  .game-wallet-market-search input { grid-column: 1 / -1; }
  .game-wallet-market-row { grid-template-columns: 58px minmax(0, 1fr); }
  .game-wallet-market-row em { grid-column: 1 / -1; }
  .game-wallet-shell::before { border-radius: 0; }
  .game-wallet-header { padding: 22px 16px 14px; }
  .game-wallet-status { margin: 0 16px 14px; }
  .game-wallet-summary { grid-template-columns: 1fr; padding: 0 16px; }
  .game-wallet-identity { grid-column: auto; }
  .game-wallet-identity,
  .game-wallet-metric { min-height: 108px; }
  .game-wallet-loadout { align-items: flex-start; flex-direction: column; margin: 12px 16px 0; }
  .game-wallet-loadout-items { justify-content: flex-start; }
  .game-wallet-holdings { margin: 18px 16px 0; }
  .game-wallet-holdings-head { align-items: flex-start; flex-direction: column; }
  .game-wallet-filters { justify-content: flex-start; }
  .game-wallet-grid { grid-template-columns: 1fr; }
  .game-wallet-footer { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .game-wallet-footer > div { width: 100%; }
  .game-wallet-footer button,
  .game-wallet-footer a { flex: 1 1 auto; }
}

body {
  overflow: hidden;
  background: #000;
  margin: 0;
  height: 100vh;
  width: 100vw;
  color: #fff;
  font-family: monospace;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Game container */
#gameContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Canvas */
#gameCanvas {
  font-family: monospace;
  image-rendering: pixelated;
  background: #000;
  z-index: 1000;
  position: absolute;
  touch-action: none;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

#globeCanvas {
  z-index: 1001;
  position: absolute;
  touch-action: none;
  display: none;
  background: #02040a;
}

/* ShiftHeads HQ is a dedicated close third-person scene layered above the
   village canvas, ready to grow room-by-room around the equipped character. */
.hq-interior {
  position: fixed;
  inset: 0;
  z-index: 11000;
  overflow: hidden;
  background: #03080d;
  color: #effff9;
  user-select: none;
}

.hq-interior[hidden] { display: none; }
.hq-canvas { width: 100%; height: 100%; display: block; touch-action: none; outline: none; cursor: crosshair; }
.hq-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.42) 100%), linear-gradient(180deg, rgba(2, 8, 14, 0.2), transparent 18%, transparent 80%, rgba(2, 8, 14, 0.36));
}
.hq-header {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  display: grid;
  gap: 2px;
  padding: 12px 16px 11px;
  border-left: 3px solid #58ffc6;
  background: linear-gradient(90deg, rgba(3, 13, 20, 0.88), rgba(3, 13, 20, 0.22));
  text-transform: uppercase;
  letter-spacing: 0.12em;
  pointer-events: none;
}
.hq-header span { color: #7ec7d9; font: 700 10px/1.2 system-ui, sans-serif; }
.hq-header strong { font: 900 clamp(18px, 3vw, 29px)/1 system-ui, sans-serif; }
.hq-header small { color: #d4f8ec; font: 700 10px/1.2 system-ui, sans-serif; }
.hq-reticle { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; pointer-events: none; }
.hq-reticle::before, .hq-reticle::after, .hq-reticle i::before, .hq-reticle i::after {
  content: "";
  position: absolute;
  background: rgba(221, 255, 245, 0.9);
  box-shadow: 0 0 5px rgba(88, 255, 198, 0.7);
}
.hq-reticle::before { width: 6px; height: 1px; left: 0; top: 10px; }
.hq-reticle::after { width: 6px; height: 1px; right: 0; top: 10px; }
.hq-reticle i::before { width: 1px; height: 6px; top: 0; left: 10px; }
.hq-reticle i::after { width: 1px; height: 6px; bottom: 0; left: 10px; }
.hq-prompt {
  position: absolute;
  left: 50%;
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
  translate: -50% 0;
  max-width: min(520px, calc(100vw - 170px));
  padding: 9px 15px;
  border: 1px solid rgba(88, 255, 198, 0.46);
  border-radius: 999px;
  background: rgba(2, 10, 16, 0.82);
  color: #e7fff7;
  font: 750 12px/1.2 system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-align: center;
  pointer-events: none;
}
.hq-prompt.interactive { border-color: #ffe171; color: #fff1b5; }
.hq-camera-status {
  position: absolute;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  display: flex;
  gap: 6px;
  pointer-events: none;
}
.hq-camera-status span {
  padding: 7px 10px;
  border: 1px solid rgba(126, 231, 211, 0.28);
  border-radius: 999px;
  background: rgba(2, 10, 16, 0.72);
  color: #bfe9dd;
  font: 750 10px/1 system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.hq-help-button {
  position: absolute;
  top: max(64px, calc(env(safe-area-inset-top) + 48px));
  right: max(20px, env(safe-area-inset-right));
  padding: 8px 11px;
  border: 1px solid rgba(126, 231, 211, 0.36);
  border-radius: 5px;
  background: rgba(4, 12, 19, 0.82);
  color: #dffaf1;
  font: 800 10px/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.hq-help-button:hover, .hq-help-button:focus-visible { border-color: #58ffc6; color: #58ffc6; outline: none; }
.hq-control-guide {
  position: absolute;
  top: max(102px, calc(env(safe-area-inset-top) + 86px));
  right: max(20px, env(safe-area-inset-right));
  width: min(250px, calc(100vw - 40px));
  padding: 14px;
  border: 1px solid rgba(88, 255, 198, 0.35);
  border-radius: 8px;
  background: rgba(2, 10, 16, 0.92);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
}
.hq-control-guide[hidden] { display: none; }
.hq-control-guide strong { display: block; margin-bottom: 9px; color: #58ffc6; font: 900 12px/1 system-ui, sans-serif; letter-spacing: 0.1em; text-transform: uppercase; }
.hq-control-guide div { display: grid; grid-template-columns: 68px 1fr; align-items: center; gap: 8px; margin-top: 5px; color: #d8ece6; font: 650 11px/1.2 system-ui, sans-serif; }
.hq-control-guide kbd { padding: 4px 6px; border: 1px solid rgba(255, 255, 255, 0.22); border-bottom-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); color: #fff; font: 800 9px/1 system-ui, sans-serif; text-align: center; }
.hq-control-guide small { display: block; margin-top: 10px; color: #8eb6ac; font: 600 9px/1.4 system-ui, sans-serif; }
.hq-exit {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 5px;
  background: rgba(4, 12, 19, 0.82);
  color: #f3fff9;
  font: 800 11px/1 system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.hq-exit:hover, .hq-exit:focus-visible { border-color: #58ffc6; color: #58ffc6; outline: none; }
.hq-touch-controls {
  position: absolute;
  left: max(22px, calc(env(safe-area-inset-left) + 12px));
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
  display: none;
  width: 118px;
  height: 118px;
}
.hq-touch-stick {
  position: relative;
  width: 100%;
  height: 100%;
  border: 1px solid rgba(126, 231, 211, 0.38);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(37, 95, 83, 0.16) 0 34%, rgba(3, 14, 22, 0.7) 36% 100%);
  box-shadow: inset 0 0 24px rgba(88, 255, 198, 0.08), 0 8px 30px rgba(0, 0, 0, 0.25);
  touch-action: none;
}
.hq-touch-stick::before, .hq-touch-stick::after {
  content: "";
  position: absolute;
  background: rgba(126, 231, 211, 0.2);
  pointer-events: none;
}
.hq-touch-stick::before { left: 17px; right: 17px; top: 50%; height: 1px; }
.hq-touch-stick::after { top: 17px; bottom: 17px; left: 50%; width: 1px; }
.hq-touch-stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  translate: -50% -50%;
  border: 1px solid rgba(126, 231, 211, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(111, 255, 211, 0.38), rgba(13, 54, 49, 0.94));
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.42), inset 0 0 10px rgba(88, 255, 198, 0.18);
  pointer-events: none;
  will-change: transform;
}
.hq-touch-actions {
  position: absolute;
  right: max(22px, calc(env(safe-area-inset-right) + 12px));
  bottom: max(30px, calc(env(safe-area-inset-bottom) + 20px));
  display: none;
  grid-template: repeat(2, 54px) / repeat(2, 54px);
  gap: 8px;
}
.hq-touch-actions button {
  min-height: 54px;
  border: 1px solid rgba(126, 231, 211, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(41, 92, 81, 0.9), rgba(3, 14, 22, 0.9));
  color: #e7fff7;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  font: 850 9px/1 system-ui, sans-serif;
  text-transform: uppercase;
  touch-action: none;
}
.hq-touch-actions button[data-hq-action="interact"] { border-color: rgba(255, 225, 113, 0.68); color: #fff0ad; }
.hq-touch-actions button.active { border-color: #ffe171; background: rgba(104, 77, 22, 0.82); }
@media (pointer: coarse) {
  .hq-touch-controls { display: grid; }
  .hq-touch-actions { display: grid; }
  .hq-prompt { bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); }
  .hq-header { max-width: calc(100vw - 150px); }
  .hq-camera-status { right: max(18px, env(safe-area-inset-right)); bottom: max(22px, calc(env(safe-area-inset-bottom) + 12px)); }
  .hq-camera-status span:first-child { display: none; }
  .hq-help-button { top: max(61px, calc(env(safe-area-inset-top) + 45px)); }
  .hq-control-guide { top: max(96px, calc(env(safe-area-inset-top) + 80px)); }
}

/* Joystick */
#joystick {
  width: min(80px, 15vw);
  height: min(80px, 15vw);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  position: absolute;
  display: none;
  z-index: 1000;
  touch-action: none;
}

.mobile-dig-button {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 1005;
  width: 68px;
  height: 68px;
  padding: 6px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 2px solid rgba(221, 192, 105, 0.92);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 34%, rgba(69, 91, 99, 0.96), rgba(10, 19, 24, 0.98) 67%),
    #0a1217;
  color: #fff2c4;
  box-shadow:
    0 5px 0 rgba(47, 33, 16, 0.94),
    0 9px 22px rgba(0, 0, 0, 0.46),
    0 0 18px rgba(221, 192, 105, 0.18);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mobile-dig-button[hidden] {
  display: none !important;
}

.mobile-dig-button img {
  width: 39px;
  height: 39px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.7));
}

.mobile-dig-button span {
  margin-top: -4px;
  font: 800 10px/1 monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.mobile-dig-button.is-held {
  transform: translateY(4px) scale(0.96);
  box-shadow:
    0 1px 0 rgba(47, 33, 16, 0.94),
    0 4px 12px rgba(0, 0, 0, 0.42),
    0 0 24px rgba(255, 214, 96, 0.35);
  border-color: #ffe08a;
}

@media (hover: none) and (pointer: coarse) {
  .mobile-dig-button:not([hidden]) {
    display: flex;
  }
}

.pool-chat-panel {
  position: fixed;
  top: 78px;
  right: 0;
  width: min(360px, calc(100vw - 22px));
  z-index: 1006;
  transform: translateX(calc(100% - 52px));
  transition: transform 180ms ease;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  color: #f8f3d8;
  font-family: Arial, sans-serif;
}

.pool-chat-panel.visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.pool-chat-panel.open {
  transform: translateX(0);
}

.pool-chat-toggle {
  position: absolute;
  left: -2px;
  top: 12px;
  width: 52px;
  height: 52px;
  border: 2px solid rgba(94, 183, 255, 0.74);
  border-right: 0;
  border-radius: 12px 0 0 12px;
  background:
    radial-gradient(circle at 50% 35%, rgba(94, 183, 255, 0.28), transparent 56%),
    rgba(7, 13, 17, 0.92);
  color: #f8f3d8;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.42);
  touch-action: manipulation;
}

.pool-chat-toggle-mark {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.pool-chat-toggle-count {
  position: absolute;
  right: 6px;
  top: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #d63f35;
  color: #fff8df;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
}

.pool-chat-shell {
  margin-left: 50px;
  height: min(430px, calc(100vh - 128px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  border: 2px solid rgba(216, 154, 52, 0.72);
  border-right: 0;
  border-radius: 10px 0 0 10px;
  background:
    linear-gradient(180deg, rgba(24, 11, 14, 0.96), rgba(8, 12, 16, 0.95)),
    rgba(8, 12, 16, 0.94);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.54);
  overflow: hidden;
}

.pool-chat-panel.village-chat .pool-chat-toggle {
  border-color: rgba(86, 218, 139, 0.78);
  background:
    radial-gradient(circle at 50% 35%, rgba(86, 218, 139, 0.26), transparent 56%),
    rgba(7, 13, 17, 0.92);
}

.pool-chat-panel.village-chat .pool-chat-shell {
  border-color: rgba(86, 218, 139, 0.74);
}

.pool-chat-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(248, 243, 216, 0.14);
  background: rgba(65, 31, 18, 0.82);
}

.pool-chat-header strong {
  display: block;
  font-size: 15px;
  line-height: 1.1;
}

.pool-chat-header small {
  display: block;
  margin-top: 3px;
  color: #d9dbc7;
  font-size: 11px;
}

#poolChatClose {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(248, 243, 216, 0.28);
  border-radius: 6px;
  background: rgba(6, 10, 12, 0.72);
  color: #f8f3d8;
  font-size: 22px;
  line-height: 28px;
  cursor: pointer;
  touch-action: manipulation;
}

.pool-chat-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(248, 243, 216, 0.12);
  background: rgba(6, 10, 12, 0.7);
}

.pool-chat-tabs button {
  height: 32px;
  border: 1px solid rgba(248, 243, 216, 0.18);
  border-radius: 7px;
  background: rgba(7, 13, 17, 0.82);
  color: #d9dbc7;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.pool-chat-tabs button.active {
  border-color: rgba(94, 183, 255, 0.7);
  background: rgba(18, 56, 70, 0.9);
  color: #f8f3d8;
  box-shadow: 0 0 12px rgba(94, 183, 255, 0.18);
}

.pool-chat-panel.village-chat .pool-chat-tabs button.active {
  border-color: rgba(86, 218, 139, 0.72);
  background: rgba(22, 70, 43, 0.88);
  box-shadow: 0 0 12px rgba(86, 218, 139, 0.16);
}

.chat-tab-pane {
  display: none;
  min-height: 0;
}

.chat-tab-pane.active {
  display: block;
}

.pool-chat-messages {
  padding: 10px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.pool-chat-messages.active {
  display: flex;
}

.pool-chat-empty,
.pool-chat-system,
.pool-chat-message {
  border-radius: 8px;
  padding: 8px 9px;
}

.pool-chat-empty,
.pool-chat-system {
  color: #d9dbc7;
  background: rgba(94, 183, 255, 0.1);
  border: 1px solid rgba(94, 183, 255, 0.22);
  font-size: 12px;
  text-align: center;
}

.pool-chat-message {
  background: rgba(248, 243, 216, 0.08);
  border: 1px solid rgba(248, 243, 216, 0.12);
}

.pool-chat-message.mine {
  background: rgba(94, 183, 255, 0.13);
  border-color: rgba(94, 183, 255, 0.34);
}

.pool-chat-name {
  display: block;
  margin-bottom: 3px;
  color: #9bd68c;
  font-size: 11px;
  font-weight: 800;
}

.pool-chat-message.mine .pool-chat-name {
  color: #5eb7ff;
}

.pool-chat-text {
  color: #f8f3d8;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}

.chat-jukebox {
  margin: 10px;
  padding: 10px;
  overflow-y: auto;
  border: 1px solid rgba(220, 226, 220, 0.24);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 214, 92, 0.26), transparent 26%),
    radial-gradient(circle at 82% 16%, rgba(255, 58, 58, 0.24), transparent 24%),
    linear-gradient(135deg, rgba(163, 170, 164, 0.16), rgba(12, 14, 16, 0.96) 32%, rgba(51, 10, 14, 0.92) 72%, rgba(6, 8, 9, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    inset 0 -16px 24px rgba(0, 0, 0, 0.28),
    0 8px 18px rgba(0, 0, 0, 0.28);
}

.pool-chat-panel.jukebox-tab .chat-message-tool {
  display: none;
}

.chat-jukebox-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-jukebox-visualizer {
  position: relative;
  height: 92px;
  margin-bottom: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 224, 138, 0.22);
  border-radius: 8px;
  background: #05070c;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.55),
    0 0 18px rgba(255, 42, 42, 0.14);
}

.chat-jukebox-visualizer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chat-jukebox-fx {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
  color: #f8f3d8;
  font-size: 11px;
  font-weight: 900;
}

.chat-jukebox-fx > span {
  padding-top: 6px;
}

.chat-jukebox-fx-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.chat-jukebox-fx-options button {
  min-width: 0;
  height: 28px;
  border: 1px solid rgba(255, 224, 138, 0.32);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(190, 198, 196, 0.16), rgba(15, 18, 18, 0.92)),
    rgba(3, 6, 8, 0.88);
  color: #f8f3d8;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-jukebox-fx-options button.is-active {
  border-color: rgba(255, 70, 70, 0.86);
  color: #ffe08a;
  background:
    linear-gradient(180deg, rgba(255, 102, 61, 0.24), rgba(95, 22, 24, 0.92)),
    rgba(20, 5, 6, 0.94);
  box-shadow: 0 0 12px rgba(255, 42, 42, 0.24);
}

.chat-jukebox-top strong {
  display: block;
  color: #ffe08a;
  font-size: 13px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0;
  text-shadow: 0 0 8px rgba(255, 51, 51, 0.42);
}

.chat-jukebox-top small,
.chat-jukebox-hint {
  display: block;
  color: #d9dbc7;
  font-size: 11px;
  line-height: 1.25;
}

.chat-jukebox-mode,
.chat-jukebox-controls button,
.chat-jukebox-transport button {
  min-height: 32px;
  border: 1px solid rgba(248, 243, 216, 0.3);
  border-radius: 7px;
  background:
    linear-gradient(180deg, rgba(190, 198, 196, 0.22), rgba(38, 42, 43, 0.92)),
    rgba(16, 19, 20, 0.94);
  color: #f8f3d8;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.chat-jukebox-mode[aria-pressed="true"] {
  border-color: rgba(255, 70, 70, 0.84);
  color: #ffe08a;
  box-shadow: 0 0 14px rgba(255, 42, 42, 0.28);
}

.chat-jukebox-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px;
  gap: 6px;
  align-items: center;
}

.chat-jukebox-controls select {
  min-width: 0;
  height: 34px;
  border: 1px solid rgba(255, 224, 138, 0.32);
  border-radius: 7px;
  background: rgba(3, 6, 8, 0.88);
  color: #f8f3d8;
  padding: 0 8px;
  font-size: 12px;
  outline: none;
}

.chat-jukebox-transport {
  display: grid;
  grid-template-columns: 42px 58px 42px minmax(0, 1fr) 64px;
  gap: 6px;
  align-items: center;
  margin-top: 7px;
}

.chat-jukebox-transport button {
  min-height: 28px;
  padding: 0 6px;
  font-size: 11px;
}

.chat-jukebox-transport input {
  min-width: 0;
  width: 100%;
  accent-color: #e33a37;
}

.chat-jukebox-transport small {
  color: #d9dbc7;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.chat-jukebox-volume {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: #f8f3d8;
  font-size: 11px;
  font-weight: 800;
}

.chat-jukebox-upload {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 8px;
  color: #f8f3d8;
  font-size: 11px;
  font-weight: 900;
}

.chat-jukebox-upload input {
  min-width: 0;
  width: 100%;
  border: 1px solid rgba(255, 224, 138, 0.26);
  border-radius: 7px;
  background: rgba(3, 6, 8, 0.88);
  color: #d9dbc7;
  padding: 7px;
  font-size: 11px;
}

.chat-jukebox-upload-status {
  display: block;
  min-height: 14px;
  margin-top: 5px;
  color: #ffe08a;
  font-size: 10px;
  line-height: 1.25;
}

.chat-jukebox-volume input {
  width: 100%;
  accent-color: #e33a37;
}

.chat-jukebox-hint {
  margin-top: 6px;
}

.pool-chat-emojis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  padding: 8px 10px 0;
}

.pool-chat-emojis button {
  height: 32px;
  border: 1px solid rgba(216, 154, 52, 0.34);
  border-radius: 7px;
  background: rgba(6, 10, 12, 0.72);
  color: #f8f3d8;
  font-size: 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.pool-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 8px;
  padding: 10px;
}

.pool-chat-form input {
  min-width: 0;
  height: 38px;
  border: 1px solid rgba(248, 243, 216, 0.22);
  border-radius: 7px;
  background: rgba(3, 6, 8, 0.84);
  color: #f8f3d8;
  padding: 0 10px;
  outline: none;
  font-size: 14px;
  user-select: text;
  -webkit-user-select: text;
}

.pool-chat-form input:focus {
  border-color: rgba(94, 183, 255, 0.84);
  box-shadow: 0 0 0 3px rgba(94, 183, 255, 0.18);
}

.pool-chat-form button {
  height: 38px;
  border: 1px solid rgba(94, 183, 255, 0.6);
  border-radius: 7px;
  background: rgba(18, 56, 70, 0.9);
  color: #f8f3d8;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}

/* Inventory panel */
#inventoryPanel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 15px;
  z-index: 1003;
  font-family: monospace;
  overflow-y: auto;
  display: none;
  flex-direction: column;
}

#inventoryTabs {
  display: flex;
  gap: 5px;
  margin-bottom: 10px;
}

#inventoryTabs button {
  flex: 1;
  padding: 8px;
  background: #444;
  border: 1px solid #666;
  color: #fff;
  cursor: pointer;
  font-size: clamp(12px, 2.5vw, 16px);
  touch-action: manipulation;
}

#inventoryTabs button.active {
  background: #666;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#inventoryContent h3 {
  margin: 10px 0;
  font-size: clamp(14px, 3vw, 18px);
}

#inventoryContent ul {
  list-style: disc;
  margin-left: 20px;
  font-size: clamp(12px, 2.5vw, 16px);
}

/* Start screen */
#startScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(90deg, rgba(3, 8, 12, 0.97), rgba(5, 14, 19, 0.78) 48%, rgba(3, 8, 12, 0.96)),
    linear-gradient(180deg, rgba(40, 13, 50, 0.18), rgba(4, 41, 48, 0.3)),
    url("../assets/shared/world/shiftlands_globe_atlas_v3.png") center/cover no-repeat,
    #050807;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  color: #f3f0df;
  font-family: "Trebuchet MS", Arial, sans-serif;
  padding: clamp(20px, 5vw, 64px);
  animation: fadeIn 1s ease-in;
  pointer-events: auto;
  overflow-y: auto;
}

#startScreen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 24%, rgba(219, 74, 123, 0.18), transparent 26%),
    radial-gradient(circle at 74% 62%, rgba(155, 214, 140, 0.16), transparent 31%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.62) 100%);
  pointer-events: none;
}

#startScreen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5px),
    linear-gradient(115deg, transparent 0%, rgba(248, 243, 216, 0.08) 48%, transparent 56%);
  mix-blend-mode: screen;
  opacity: 0.36;
  pointer-events: none;
}

.home-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(290px, 380px);
  gap: clamp(20px, 4vw, 54px);
  align-items: end;
}

.graveyard-site-actions {
  position: absolute;
  top: clamp(14px, 3vw, 28px);
  right: clamp(14px, 3vw, 32px);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  font-family: "Trebuchet MS", Arial, sans-serif;
}

.graveyard-site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(217, 240, 111, 0.32);
  border-radius: 6px;
  background: rgba(8, 13, 18, 0.74);
  color: #f8f3d8;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.graveyard-site-link:hover {
  border-color: rgba(217, 240, 111, 0.7);
  background: rgba(34, 50, 42, 0.9);
}

.graveyard-site-link[hidden] {
  display: none;
}

.home-hero {
  max-width: 720px;
  padding-bottom: clamp(10px, 3vh, 34px);
}

.home-sound-control#landingMusicBtn {
  min-width: 0;
  height: 36px;
  margin-top: 14px;
  padding: 0 13px;
  gap: 8px;
  border-color: rgba(143, 226, 255, 0.34);
  border-radius: 999px;
  background: rgba(4, 18, 24, 0.74);
  color: #bceeff;
  box-shadow: none;
  font: 800 11px/1 monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.home-sound-control#landingMusicBtn:hover,
.home-sound-control#landingMusicBtn.playing {
  border-color: rgba(217, 240, 111, 0.65);
  background: rgba(25, 48, 42, 0.88);
  color: #efffb4;
  box-shadow: 0 0 22px rgba(143, 226, 255, 0.13);
}

.home-kicker {
  color: #f06f9f;
  font-size: clamp(12px, 1.5vw, 15px);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 12px;
}

#startScreen h1 {
  font-size: clamp(54px, 10vw, 132px);
  line-height: 0.9;
  margin-bottom: clamp(18px, 3vw, 30px);
  color: #f8f3d8;
  text-shadow:
    0 6px 28px rgba(0, 0, 0, 0.86),
    0 0 22px rgba(155, 214, 140, 0.22);
}

.home-lede {
  max-width: 620px;
  color: #d9dbc7;
  font-size: clamp(17px, 2.3vw, 24px);
  line-height: 1.35;
  margin-bottom: clamp(24px, 4vw, 38px);
}

#startScreen button {
  width: fit-content;
  min-width: 210px;
  height: 54px;
  padding: 0 28px;
  font-size: 16px;
  font-weight: 700;
  background: #d9f06f;
  color: #071008;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(240, 111, 159, 0.18);
}

#startScreen button[hidden] {
  display: none;
}

#startScreen button:hover {
  background: #f1ff9a;
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.48);
}

#startScreen button:active {
  background: #b8d95d;
  transform: translateY(0);
}

.start-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.account-status {
  max-width: 620px;
  min-height: 20px;
  margin-top: 13px;
  color: #d9dbc7;
  font-size: 13px;
  line-height: 1.4;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.account-status a {
  color: #d9f06f;
  font-weight: 800;
  text-decoration: none;
}

.account-status a:hover {
  text-decoration: underline;
}

.session-takeover {
  width: fit-content;
  margin-top: 2px;
  border: 1px solid rgba(217, 240, 111, 0.55);
  border-radius: 999px;
  background: rgba(17, 30, 28, 0.9);
  color: #edf8b9;
  padding: 10px 15px;
  font: 800 12px/1.1 monospace;
  cursor: pointer;
}

.session-takeover:hover:not(:disabled) {
  background: rgba(42, 64, 43, 0.95);
  border-color: #d9f06f;
}

.session-takeover:disabled {
  cursor: wait;
  opacity: 0.64;
}

.session-takeover-status {
  min-height: 18px;
  margin: 7px 0 0;
  color: #d9f06f;
  font: 700 12px/1.35 monospace;
}

#startScreen .secondary-start {
  background: rgba(18, 28, 33, 0.78);
  color: #f8f3d8;
  border-color: rgba(217, 240, 111, 0.36);
  box-shadow:
    0 14px 30px rgba(0, 0, 0, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

#startScreen .secondary-start:hover {
  background: rgba(34, 50, 42, 0.9);
}

.guest-join {
  width: min(520px, 100%);
  margin-top: 16px;
  display: grid;
  gap: 9px;
}

.guest-join[hidden] {
  display: none;
}

.guest-join label {
  color: #f8f3d8;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.guest-join-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.guest-join input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(217, 240, 111, 0.34);
  border-radius: 6px;
  background: rgba(8, 13, 18, 0.74);
  color: #f8f3d8;
  font: inherit;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.guest-join input:focus {
  border-color: rgba(217, 240, 111, 0.86);
  box-shadow:
    0 0 0 3px rgba(217, 240, 111, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#startScreen .guest-join-row button {
  min-width: 108px;
}

.multiplayer-status {
  min-height: 18px;
  margin: 0;
  color: #d9dbc7;
  font-size: 13px;
  line-height: 1.35;
}

.home-side {
  display: grid;
  gap: 14px;
}

.home-globe-card {
  position: relative;
  overflow: hidden;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid rgba(143, 226, 255, 0.25);
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 18%, rgba(45, 214, 225, 0.14), transparent 48%),
    linear-gradient(160deg, rgba(5, 18, 25, 0.92), rgba(10, 10, 20, 0.82));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.home-globe-frame {
  position: relative;
  width: min(280px, 68vw);
  aspect-ratio: 1;
  margin: 0 auto 20px;
  border: 1px solid rgba(157, 236, 255, 0.5);
  border-radius: 50%;
  padding: 7px;
  background: rgba(2, 12, 20, 0.82);
  box-shadow:
    0 0 0 9px rgba(86, 219, 232, 0.035),
    0 0 48px rgba(60, 210, 230, 0.2);
}

.home-globe-frame::after {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.3), transparent 18%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.22), transparent 42%, rgba(0, 0, 0, 0.52));
  pointer-events: none;
}

.home-globe-art {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-image: url("../assets/shared/world/shiftlands_globe_atlas_v3.png");
  background-position: 34% center;
  background-size: auto 100%;
  animation: landing-globe-drift 36s linear infinite alternate;
}

@keyframes landing-globe-drift {
  from { background-position: 18% center; }
  to { background-position: 76% center; }
}

.home-globe-kicker {
  margin: 0 0 6px;
  color: #8fe2f4;
  font: 800 11px/1.2 monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.home-globe-card h2 {
  margin: 0;
  color: #f8f3d8;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1;
}

.home-globe-copy {
  margin: 12px auto 0;
  max-width: 330px;
  color: #bfcfd0;
  font-size: 14px;
  line-height: 1.5;
}

.home-notes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.home-notes span {
  display: block;
  padding: 11px 13px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(240, 111, 159, 0.18);
  border-radius: 6px;
  color: #d4d9c6;
  font-size: 13px;
}

/* Game over screen */
#gameOverScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(to bottom, #111, #333);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  color: #fff;
  font-family: monospace;
  text-align: center;
  padding: 20px;
  animation: fadeIn 1s ease-in;
  pointer-events: auto;
}

#gameOverScreen h1 {
  font-size: clamp(24px, 5vw, 36px);
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  color: #f55;
}

#gameOverScreen p {
  font-size: clamp(14px, 3vw, 18px);
  margin: 10px 0;
}

#restartBtn {
  padding: 10px 40px;
  min-width: 160px;
  font-size: clamp(14px, 3vw, 18px);
  background: #555;
  color: #fff;
  border: 2px solid #777;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  height: 48px;
  pointer-events: auto;
  touch-action: manipulation;
}

#restartBtn:hover {
  background: #666;
  transform: scale(1.05);
}

#restartBtn:active {
  background: #777;
  transform: scale(0.95);
}

/* Volume complete screen */
#volumeCompleteScreen {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 10, 14, 0.88), rgba(12, 10, 17, 0.96));
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1005;
  color: #f8f3d8;
  font-family: monospace;
  padding: 22px;
  pointer-events: auto;
  text-align: center;
}

.volume-complete-panel {
  width: min(560px, calc(100vw - 36px));
  background: rgba(7, 13, 12, 0.92);
  border: 1px solid rgba(217, 240, 111, 0.58);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.56);
  padding: clamp(22px, 5vw, 42px);
}

.volume-complete-kicker {
  color: #9bd68c;
  display: block;
  font-size: clamp(11px, 2vw, 13px);
  font-weight: 700;
  letter-spacing: 0;
  margin-bottom: 10px;
  text-transform: uppercase;
}

#volumeCompleteScreen h1 {
  color: #fff7d2;
  font-size: clamp(30px, 7vw, 54px);
  letter-spacing: 0;
  margin: 0 0 14px;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.68);
}

#volumeCompleteMessage {
  color: #d9f2f6;
  font-size: clamp(15px, 3.4vw, 20px);
  line-height: 1.45;
  margin: 0 auto 14px;
  max-width: 470px;
}

#volumeCompleteReward {
  background: rgba(217, 240, 111, 0.08);
  border: 1px solid rgba(217, 240, 111, 0.22);
  border-radius: 6px;
  color: #cbd8c0;
  font-size: clamp(12px, 2.4vw, 14px);
  line-height: 1.45;
  margin: 18px auto 24px;
  max-width: 430px;
  padding: 10px 12px;
}

#volumeContinueBtn {
  background: #d9f06f;
  border: 2px solid #fff7d2;
  border-radius: 6px;
  color: #17200f;
  cursor: pointer;
  font-family: monospace;
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 800;
  min-height: 48px;
  min-width: min(280px, 100%);
  padding: 11px 24px;
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.2s ease;
}

#volumeContinueBtn:hover,
#volumeContinueBtn:focus-visible {
  background: #fff7d2;
  outline: none;
  transform: translateY(-1px);
}

#volumeContinueBtn:active {
  transform: translateY(1px);
}

/* Village hub controls */
#villageScreen {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(220px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  background: transparent;
  display: none;
  align-items: flex-start;
  justify-content: flex-start;
  z-index: 1003;
  color: #f3f0df;
  font-family: "Trebuchet MS", Arial, sans-serif;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
}

.village-shell {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
}

.village-hero {
  display: grid;
  grid-template-columns: 48px;
  gap: 8px;
  align-items: start;
}

.village-actions {
  display: grid;
  grid-template-columns: 48px;
  gap: 8px;
  margin-top: 0;
  pointer-events: auto;
}

.village-actions button {
  min-width: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: #050b12;
  color: #f8f3d8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.village-actions button:hover {
  border-color: rgba(155, 214, 140, 0.72);
  box-shadow: 0 0 16px rgba(88, 214, 255, 0.28), 0 0 20px rgba(155, 214, 140, 0.18);
  transform: translateY(-2px);
}

.globe-menu-button {
  position: relative;
  overflow: visible;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  isolation: isolate;
}

.globe-face {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.38), transparent 18%),
    radial-gradient(circle at 62% 70%, rgba(8, 5, 18, 0.52), transparent 34%),
    url("../assets/shared/world/worldmap_shiftheads.png") 48% 50% / 210% 145% no-repeat,
    #0b2f3c;
  box-shadow:
    inset -9px -8px 16px rgba(0, 0, 0, 0.62),
    inset 5px 4px 10px rgba(168, 240, 255, 0.24),
    0 0 0 1px rgba(139, 217, 239, 0.55),
    0 0 14px rgba(80, 200, 120, 0.22);
  z-index: 1;
}

.globe-face::after {
  content: "";
  position: absolute;
  inset: 18% 12%;
  border-radius: 50%;
  border-left: 1px solid rgba(199, 237, 247, 0.34);
  border-right: 1px solid rgba(199, 237, 247, 0.2);
  transform: rotate(-18deg);
}

#openWorldMapBtn .globe-celestial-orbit {
  --celestial-orbit-x: 0px;
  --celestial-orbit-y: -29px;
  --celestial-sun-opacity: 1;
  --celestial-moon-opacity: 0;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%) translate(var(--celestial-orbit-x), var(--celestial-orbit-y));
  z-index: 3;
  will-change: transform;
}

#openWorldMapBtn .globe-celestial-body {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 50%;
  transition: opacity 0.7s ease, filter 0.7s ease;
}

#openWorldMapBtn .globe-celestial-sun {
  background: radial-gradient(circle at 35% 32%, #fffbe0 0 18%, #ffe48a 42%, #f7a93b 100%);
  box-shadow: 0 0 4px 1px rgba(255, 225, 125, 0.92), 0 0 9px 2px rgba(255, 173, 70, 0.5);
  opacity: var(--celestial-sun-opacity);
}

#openWorldMapBtn .globe-celestial-moon {
  background: radial-gradient(circle at 34% 30%, #f4f8ff 0 16%, #c8d9f4 58%, #829bc5 100%);
  box-shadow: 0 0 4px 1px rgba(202, 222, 255, 0.78), 0 0 8px 1px rgba(105, 142, 212, 0.46);
  opacity: var(--celestial-moon-opacity);
}

#openWorldMapBtn .globe-celestial-moon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  top: -1px;
  left: 3px;
  border-radius: 50%;
  background: #071426;
  opacity: 0.88;
}

@media (prefers-reduced-motion: reduce) {
  #openWorldMapBtn .globe-celestial-body {
    transition: none;
  }
}

.menu-bar .globe-menu-button::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background:
    linear-gradient(#f8f3d8, #f8f3d8) center 5px / 8px 1.5px no-repeat,
    linear-gradient(#f8f3d8, #f8f3d8) center 8px / 8px 1.5px no-repeat,
    linear-gradient(#f8f3d8, #f8f3d8) center 11px / 8px 1.5px no-repeat,
    rgba(7, 10, 14, 0.88);
  border: 1px solid rgba(155, 214, 140, 0.62);
  box-shadow: 0 0 8px rgba(155, 214, 140, 0.22);
  z-index: 2;
}

.globe-menu-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.burger-menu-button {
  position: relative;
  overflow: visible;
  isolation: isolate;
}

.burger-menu-button::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 24%, rgba(255, 255, 255, 0.3), transparent 18%),
    radial-gradient(circle at 62% 70%, rgba(80, 200, 120, 0.18), transparent 31%),
    url("../assets/shared/world/space_globe_backdrop.png") center / cover no-repeat,
    #071017;
  box-shadow:
    inset -9px -8px 16px rgba(0, 0, 0, 0.66),
    inset 5px 4px 10px rgba(168, 240, 255, 0.18),
    0 0 0 1px rgba(139, 217, 239, 0.55),
    0 0 14px rgba(80, 200, 120, 0.2);
  z-index: 1;
}

.burger-stack {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 24px;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.burger-stack::before,
.burger-stack::after {
  content: "";
  position: absolute;
  left: 0;
  width: 31px;
}

.burger-stack::before {
  top: 0;
  height: 11px;
  border-radius: 17px 17px 8px 8px;
  background:
    radial-gradient(circle at 8px 4px, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle at 16px 3px, rgba(255, 255, 255, 0.82) 0 1px, transparent 1.5px),
    radial-gradient(circle at 23px 5px, rgba(255, 255, 255, 0.78) 0 1px, transparent 1.5px),
    linear-gradient(#f3b35f, #c8782d);
  box-shadow: inset 0 -2px 0 rgba(105, 49, 14, 0.32), 0 0 8px rgba(248, 179, 88, 0.25);
}

.burger-stack::after {
  bottom: 0;
  height: 7px;
  border-radius: 4px 4px 11px 11px;
  background: linear-gradient(#d18438, #9d4f22);
  box-shadow: inset 0 2px 0 rgba(255, 218, 144, 0.24);
}

.burger-stack {
  background:
    linear-gradient(135deg, transparent 0 10%, #ffd84f 11% 22%, transparent 23% 100%) 1px 11px / 29px 5px no-repeat,
    linear-gradient(#63b54a, #3f8c32) 2px 13px / 27px 3px no-repeat,
    linear-gradient(#6b2f1b, #34130d) 1px 16px / 29px 6px no-repeat;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 7px rgba(248, 179, 88, 0.22));
}


/* World map screen */
#worldMapScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  z-index: 1002;
  color: #fff;
  font-family: monospace;
  text-align: center;
  padding: 20px;
  animation: fadeIn 1s ease-in;
  pointer-events: none;
}

#worldMapScreen h1 {
  font-size: clamp(20px, 4.5vw, 32px);
  margin: 20px 0 10px;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.62);
  background: linear-gradient(180deg, rgba(16, 40, 52, 0.86), rgba(8, 18, 24, 0.76));
  border: 1px solid rgba(139, 217, 239, 0.65);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  color: #fff7d2;
  padding: 9px 18px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

#worldMapScreen p {
  font-size: clamp(12px, 2.5vw, 16px);
  margin: 10px 0;
  max-width: 90%;
  line-height: 1.5;
  background: rgba(8, 18, 24, 0.68);
  border: 1px solid rgba(139, 217, 239, 0.45);
  color: #d9f2f6;
  padding: 8px 16px;
  border-radius: 6px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.5s ease;
}

#worldMapScreen h1.hidden,
#worldMapScreen p.hidden {
  opacity: 0;
  pointer-events: none;
}

.world-map-hud {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr minmax(150px, 220px);
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 92px 22px 22px;
  pointer-events: none;
}

.world-map-panel {
  align-self: start;
  background: rgba(8, 18, 24, 0.72);
  border: 1px solid rgba(139, 217, 239, 0.75);
  border-radius: 6px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.3);
  color: #fff7d2;
  padding: 10px 12px;
  text-align: left;
}

.world-map-panel h2 {
  color: #8bd9ef;
  font-size: 13px;
  letter-spacing: 0;
  margin: 0 0 8px;
}

.world-map-panel h3 {
  color: #fff7d2;
  font-size: 10px;
  letter-spacing: 0;
  margin: 9px 0 4px;
}

.world-map-panel div {
  align-items: center;
  color: #d9f2f6;
  display: flex;
  font-size: 11px;
  gap: 7px;
  line-height: 1.45;
  margin: 4px 0;
}

.world-map-panel button {
  align-items: center;
  background: rgba(255, 247, 210, 0.08);
  border: 1px solid rgba(139, 217, 239, 0.34);
  border-radius: 5px;
  color: #d9f2f6;
  cursor: pointer;
  display: flex;
  font-family: monospace;
  font-size: 11px;
  line-height: 1.3;
  margin: 5px 0;
  padding: 7px 8px;
  pointer-events: auto;
  text-align: left;
  width: 100%;
}

.world-map-panel button:hover,
.world-map-panel button:focus-visible {
  background: rgba(139, 217, 239, 0.18);
  border-color: #8bd9ef;
  color: #fff7d2;
  outline: none;
}

.world-map-panel .world-map-list {
  display: block;
  margin: 0;
}

.world-map-panel .world-map-entry {
  align-items: stretch;
  display: flex;
  gap: 6px;
  justify-content: space-between;
  margin: 5px 0;
}

.world-map-panel .world-map-focus {
  flex: 1 1 auto;
  margin: 0;
  min-width: 0;
  width: auto;
}

.world-map-panel .world-map-focus span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-map-status {
  border: 1px solid rgba(255, 247, 210, 0.24);
  border-radius: 4px;
  color: #fff7d2;
  flex: 0 0 auto;
  font-size: 9px;
  margin-left: 8px;
  padding: 2px 5px;
  text-transform: uppercase;
}

.world-map-panel .world-map-open {
  flex: 0 0 auto;
  justify-content: center;
  margin: 0;
  padding: 3px 6px;
  width: auto;
}

.world-map-panel .world-map-open:disabled {
  cursor: default;
  opacity: 0.62;
}

.world-map-entry.locked,
.world-map-entry.future {
  color: #b8c2bd;
}

.world-map-entry.locked .world-map-status {
  color: #ffd5a8;
}

.world-map-entry.future .world-map-status {
  color: #d8d3c5;
}

.world-map-entry.completed .world-map-status {
  color: #9bd68c;
}

.world-map-dev-reset {
  border-color: rgba(233, 79, 122, 0.48);
  color: #ffd5df;
  display: none;
  margin-top: 10px;
}

.world-map-dev-reset.visible {
  display: flex;
}

.world-map-dev-reset:hover,
.world-map-dev-reset:focus-visible {
  background: rgba(233, 79, 122, 0.18);
  border-color: #e94f7a;
}

.world-map-legend {
  grid-column: 1;
  grid-row: 1;
}

.world-map-regions {
  grid-column: 3;
  grid-row: 1;
}

.legend-dot {
  border: 2px solid #fff7d2;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  height: 12px;
  width: 12px;
}

.legend-dot.active {
  background: #e94f7a;
}

.legend-dot.future {
  background: #d8d3c5;
}

.legend-dot.safe {
  background: #50c878;
}

.legend-dot.polar {
  background: #6bdaf2;
}

/* Menu bar */
#menuBar {
  position: fixed;
  bottom: 13px;
  right: 20px;
  z-index: 1004;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#menuBar[style*="display: none"] {
  opacity: 0;
  pointer-events: none;
}

#menuBar[style*="display: block"] {
  opacity: 1;
}

.menu-toggle {
  width: min(58px, 13vw);
  height: min(58px, 13vw);
  font-size: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(8, 20, 28, 0.96), rgba(3, 5, 8, 0.96));
  color: #fff;
  border: 1px solid rgba(139, 217, 239, 0.7);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 18px rgba(80, 200, 120, 0.18), 0 0 26px rgba(139, 217, 239, 0.12);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  touch-action: manipulation;
  pointer-events: auto;
}

.menu-toggle:hover {
  border-color: rgba(248, 243, 216, 0.78);
  box-shadow: 0 0 20px rgba(80, 200, 120, 0.26), 0 0 30px rgba(139, 217, 239, 0.2);
  transform: scale(1.05);
}

.menu-toggle:active {
  transform: scale(0.95);
}

.menu-buttons {
  position: absolute;
  bottom: 29px;
  right: 29px;
  width: min(240px, 60vw);
  height: min(240px, 60vw);
  background:
    radial-gradient(circle, rgba(8, 23, 30, 0.48) 0 24%, rgba(3, 5, 8, 0.6) 25% 58%, transparent 59%),
    url("../assets/shared/world/space_globe_backdrop.png") center / cover no-repeat;
  border: 1px solid rgba(139, 217, 239, 0.18);
  border-radius: 50%;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transform-origin: center center;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  pointer-events: none;
}

.menu-buttons.open {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.menu-btn {
  position: absolute;
  width: min(50px, 11vw);
  height: min(50px, 11vw);
  font-size: clamp(12px, 2.5vw, 16px);
  background: rgba(16, 15, 18, 0.92);
  color: #fff;
  border: 1px solid rgba(215, 196, 138, 0.46);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.3s ease, opacity 0.3s ease;
  touch-action: manipulation;
  opacity: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.menu-btn.center {
  background: #050b12;
  font-size: 0;
  border-color: rgba(139, 217, 239, 0.72);
  z-index: 1005;
  box-shadow: 0 0 18px rgba(80, 200, 120, 0.18), 0 0 24px rgba(139, 217, 239, 0.14);
}

.menu-icon {
  display: block;
  width: 82%;
  height: 82%;
  object-fit: contain;
  pointer-events: none;
  filter:
    saturate(1.2)
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 7px rgba(139, 217, 239, 0.2));
}

.menu-btn-disabled .menu-icon {
  filter:
    saturate(0.9)
    drop-shadow(0 2px 2px rgba(0, 0, 0, 0.58))
    drop-shadow(0 0 5px rgba(139, 217, 239, 0.12));
}

.menu-buttons.open .menu-btn {
  opacity: 1;
}

/* Circular positioning for buttons */
.menu-buttons.open .menu-btn:nth-child(1) { transform: translate(-50%, calc(-50% - 80px)); transition-delay: 0.05s; }
.menu-buttons.open .menu-btn:nth-child(2) { transform: translate(calc(-50% + 56px), calc(-50% - 56px)); transition-delay: 0.1s; }
.menu-buttons.open .menu-btn:nth-child(3) { transform: translate(calc(-50% + 80px), -50%); transition-delay: 0.15s; }
.menu-buttons.open .menu-btn:nth-child(4) { transform: translate(calc(-50% + 56px), calc(-50% + 56px)); transition-delay: 0.2s; }
.menu-buttons.open .menu-btn:nth-child(5) { transform: translate(-50%, calc(-50% + 80px)); transition-delay: 0.25s; }
.menu-buttons.open .menu-btn:nth-child(6) { transform: translate(calc(-50% - 56px), calc(-50% + 56px)); transition-delay: 0.3s; }
.menu-buttons.open .menu-btn:nth-child(7) { transform: translate(calc(-50% - 80px), -50%); transition-delay: 0.35s; }
.menu-buttons.open .menu-btn:nth-child(8) { transform: translate(calc(-50% - 56px), calc(-50% - 56px)); transition-delay: 0.4s; }
.menu-buttons.open .menu-btn:nth-child(9) { transform: translate(-50%, -50%); transition-delay: 0.45s; }

.menu-btn:hover {
  background: #666;
  transform: scale(1.1) translate(-50%, -50%);
}

.menu-btn:active {
  background: #777;
  transform: scale(0.95) translate(-50%, -50%);
}

.menu-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  filter: grayscale(0.8);
}

/* Loading screen */
#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(28, 220, 175, 0.14), transparent 31%),
    radial-gradient(circle at 35% 62%, rgba(153, 69, 255, 0.13), transparent 32%),
    linear-gradient(145deg, #05070b 0%, #0c0812 48%, #03100e 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10002;
}

#loadingScreen::before,
#loadingScreen::after {
  content: "";
  position: absolute;
  inset: -30%;
  pointer-events: none;
}

#loadingScreen::before {
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(153, 69, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 241, 149, 0.14) 1px, transparent 1px);
  background-size: 54px 54px;
  transform: perspective(420px) rotateX(58deg) translateY(25%);
  animation: graveyardLoaderGrid 8s linear infinite;
}

#loadingScreen::after {
  background: conic-gradient(from 0deg, transparent, rgba(20, 241, 149, 0.08), transparent, rgba(153, 69, 255, 0.1), transparent);
  animation: graveyardLoaderAtmosphere 14s linear infinite;
}

.graveyard-loading-stage {
  position: relative;
  z-index: 1;
  width: min(88vw, 520px);
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid rgba(117, 255, 223, 0.28);
  border-radius: 24px;
  color: #f6f1ff;
  text-align: center;
  background: linear-gradient(145deg, rgba(15, 12, 24, 0.92), rgba(5, 17, 17, 0.88));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.65), 0 0 55px rgba(20, 241, 149, 0.12), inset 0 0 35px rgba(153, 69, 255, 0.08);
  backdrop-filter: blur(18px);
}

.graveyard-loading-portal {
  position: relative;
  width: clamp(145px, 28vw, 210px);
  aspect-ratio: 1;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(7, 9, 14, 0.12) 35%, rgba(20, 241, 149, 0.13) 58%, transparent 72%);
  filter: drop-shadow(0 0 28px rgba(20, 241, 149, 0.28));
}

.graveyard-loading-orbit {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #14f195;
  border-right-color: rgba(0, 209, 255, 0.65);
  animation: graveyardLoaderSpin 2.8s linear infinite;
}

.graveyard-loading-orbit.orbit-two {
  inset: 14%;
  border-top-color: #9945ff;
  border-right-color: rgba(255, 88, 197, 0.75);
  animation-direction: reverse;
  animation-duration: 2s;
}

.graveyard-loading-owl {
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(86, 203, 255, 0.42));
  animation: graveyardLoaderOwl 2.4s ease-in-out infinite;
}

.graveyard-loading-skull {
  position: absolute;
  right: 9%;
  bottom: 12%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #101116;
  font-size: 24px;
  background: linear-gradient(135deg, #14f195, #62dfff 48%, #9945ff);
  box-shadow: 0 0 18px rgba(98, 223, 255, 0.7);
}

.graveyard-loading-kicker {
  margin: 0 0 8px;
  color: #8effd2;
  font: 800 clamp(11px, 2.2vw, 14px)/1.1 monospace;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.graveyard-loading-stage h2 {
  margin: 0;
  font: 800 clamp(24px, 5vw, 42px)/1.05 Georgia, serif;
  text-shadow: 0 0 24px rgba(153, 69, 255, 0.35);
}

.graveyard-loading-detail {
  min-height: 1.4em;
  margin: 14px 0 18px;
  color: #c9c5d4;
  font: 600 clamp(12px, 2.4vw, 15px)/1.4 monospace;
}

.graveyard-loading-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 99px;
  background: rgba(0, 0, 0, 0.52);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.65);
}

.graveyard-loading-track span {
  display: block;
  width: 2%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #9945ff, #00d1ff, #14f195);
  box-shadow: 0 0 18px rgba(20, 241, 149, 0.8);
  transition: width 180ms ease-out;
}

.graveyard-loading-solana-bars {
  display: grid;
  gap: 4px;
  width: 58px;
  margin: 20px auto 0;
  transform: skew(-14deg);
}

.graveyard-loading-solana-bars i {
  height: 5px;
  border-radius: 4px;
  background: linear-gradient(90deg, #9945ff, #14f195);
  animation: graveyardLoaderBars 1.1s ease-in-out infinite alternate;
}

.graveyard-loading-solana-bars i:nth-child(2) { animation-delay: 0.18s; }
.graveyard-loading-solana-bars i:nth-child(3) { animation-delay: 0.36s; }

.loading-error .graveyard-loading-track span {
  background: linear-gradient(90deg, #ff4d6d, #ffb347);
}

@keyframes graveyardLoaderSpin { to { transform: rotate(360deg); } }
@keyframes graveyardLoaderOwl { 50% { transform: translateY(-5px) scale(1.025); } }
@keyframes graveyardLoaderBars { from { transform: scaleX(0.42); opacity: 0.45; } to { transform: scaleX(1); opacity: 1; } }
@keyframes graveyardLoaderGrid { to { transform: perspective(420px) rotateX(58deg) translateY(31%); } }
@keyframes graveyardLoaderAtmosphere { to { transform: rotate(360deg); } }

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Plot popup */
.plot-popup {
  position: absolute;
  background: rgba(10, 18, 24, 0.9);
  color: #fff7d2;
  padding: 8px 11px;
  border-radius: 5px;
  border: 1px solid #8bd9ef;
  font-family: monospace;
  font-size: clamp(10px, 2vw, 12px);
  display: none;
  z-index: 1003;
  pointer-events: none;
  max-width: 220px;
  text-align: center;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.plot-popup span {
  display: block;
}

#plotName {
  font-weight: bold;
  margin-bottom: 3px;
}

#plotCoords {
  font-size: clamp(8px, 1.8vw, 10px);
  color: #c7edf7;
  line-height: 1.35;
  white-space: pre-line;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  #menuBar {
    bottom: 13px;
  }
  .menu-toggle {
    width: min(54px, 14vw);
    height: min(54px, 14vw);
    font-size: 0;
  }
  .menu-buttons {
    bottom: 27px;
    right: 27px;
    width: min(210px, 52.5vw);
    height: min(210px, 52.5vw);
    padding: 15px;
  }
  .menu-btn {
    width: min(45px, 10vw);
    height: min(45px, 10vw);
    font-size: clamp(10px, 2vw, 14px);
  }
  .menu-btn.center {
    font-size: clamp(14px, 2.5vw, 18px);
  }
  .menu-buttons.open .menu-btn:nth-child(1) { transform: translate(-50%, calc(-50% - 70px)); }
  .menu-buttons.open .menu-btn:nth-child(2) { transform: translate(calc(-50% + 49px), calc(-50% - 49px)); }
  .menu-buttons.open .menu-btn:nth-child(3) { transform: translate(calc(-50% + 70px), -50%); }
  .menu-buttons.open .menu-btn:nth-child(4) { transform: translate(calc(-50% + 49px), calc(-50% + 49px)); }
  .menu-buttons.open .menu-btn:nth-child(5) { transform: translate(-50%, calc(-50% + 70px)); }
  .menu-buttons.open .menu-btn:nth-child(6) { transform: translate(calc(-50% - 49px), calc(-50% + 49px)); }
  .menu-buttons.open .menu-btn:nth-child(7) { transform: translate(calc(-50% - 70px), -50%); }
  .menu-buttons.open .menu-btn:nth-child(8) { transform: translate(calc(-50% - 49px), calc(-50% - 49px)); }
  .menu-buttons.open .menu-btn:nth-child(9) { transform: translate(-50%, -50%); }
  #inventoryPanel {
    padding: 10px;
  }
  #inventoryTabs button {
    font-size: clamp(10px, 2vw, 14px);
  }
  #startScreen {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    padding: 24px 16px;
  }
  .graveyard-site-actions {
    position: relative;
    top: auto;
    right: auto;
    justify-content: flex-start;
    width: 100%;
    margin-bottom: 18px;
  }
  .graveyard-site-link {
    min-height: 36px;
    padding: 0 12px;
  }
  .home-shell {
    grid-template-columns: 1fr;
    gap: 18px;
    align-items: start;
    min-height: 100%;
  }
  .home-hero {
    padding-bottom: 0;
  }
  #startScreen h1 {
    font-size: clamp(44px, 16vw, 76px);
    margin-bottom: 16px;
  }
  .home-lede {
    font-size: 16px;
    margin-bottom: 22px;
  }
  .start-actions,
  .guest-join-row {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .start-actions {
    display: grid;
  }
  #startScreen button {
    width: 100%;
    min-width: 0;
    height: 48px;
    font-size: 15px;
  }
  .guest-join input {
    height: 48px;
  }
  .home-side {
    width: 100%;
  }
  .home-globe-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    column-gap: 16px;
    align-items: center;
    text-align: left;
  }
  .home-globe-frame {
    grid-row: 1 / span 3;
    width: 112px;
    margin: 0;
  }
  .home-globe-copy {
    margin: 7px 0 0;
  }
  .home-notes {
    grid-template-columns: 1fr;
  }
  .home-notes span {
    padding: 9px 11px;
    font-size: 12px;
  }
  #villageScreen {
    top: 10px;
    left: 10px;
    width: min(210px, calc(100vw - 20px));
    max-height: 46vh;
    padding: 0;
  }
  .village-shell {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .village-hero {
    grid-template-columns: 42px;
  }
  .village-actions {
    display: grid;
    grid-template-columns: 42px;
  }
  .village-actions button {
    width: 42px;
    min-width: 0;
    height: 42px;
    font-size: 0;
  }
  #gameOverScreen h1 {
    font-size: clamp(20px, 4.5vw, 28px);
  }
  #gameOverScreen p {
    font-size: clamp(12px, 2.5vw, 16px);
  }
  #restartBtn {
    font-size: clamp(12px, 2.5vw, 16px);
    padding: 8px 32px;
    min-width: 140px;
    height: 40px;
  }
  #worldMapScreen h1 {
    font-size: clamp(18px, 4vw, 26px);
  }
  #worldMapScreen p {
    font-size: clamp(10px, 2vw, 14px);
  }
  .world-map-hud {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    padding: 78px 10px 10px;
  }
  .world-map-panel {
    padding: 7px 8px;
  }
  .world-map-panel h2 {
    font-size: 11px;
    margin-bottom: 5px;
  }
  .world-map-panel h3 {
    font-size: 9px;
    margin: 5px 0 3px;
  }
  .world-map-panel div {
    font-size: 9px;
    line-height: 1.25;
    margin: 2px 0;
  }
  .world-map-panel button {
    font-size: 9px;
    margin: 3px 0;
    padding: 5px 6px;
  }
  .world-map-legend {
    grid-column: 1;
    grid-row: 1;
  }
  .world-map-regions {
    grid-column: 2;
    grid-row: 1;
  }
  .legend-dot {
    height: 9px;
    width: 9px;
  }
  .plot-popup {
    padding: 6px 8px;
    font-size: clamp(8px, 1.8vw, 10px);
    max-width: 190px;
    border: 1px solid #8bd9ef;
  }
}

/* Handle landscape orientation */
@media (orientation: landscape) {
  #menuBar {
    bottom: 12px;
    right: 20px;
  }
  .menu-toggle {
    width: min(54px, 12vh);
    height: min(54px, 12vh);
    font-size: 0;
  }
  .menu-buttons {
    bottom: 27px;
    right: 27px;
    width: min(210px, 52.5vh);
    height: min(210px, 52.5vh);
    padding: 15px;
  }
  .menu-btn {
    width: min(45px, 10vh);
    height: min(45px, 10vh);
    font-size: clamp(10px, 2vh, 14px);
  }
  .menu-btn.center {
    font-size: clamp(14px, 2.5vh, 18px);
  }
  .menu-buttons.open .menu-btn:nth-child(1) { transform: translate(-50%, calc(-50% - 70px)); }
  .menu-buttons.open .menu-btn:nth-child(2) { transform: translate(calc(-50% + 49px), calc(-50% - 49px)); }
  .menu-buttons.open .menu-btn:nth-child(3) { transform: translate(calc(-50% + 70px), -50%); }
  .menu-buttons.open .menu-btn:nth-child(4) { transform: translate(calc(-50% + 49px), calc(-50% + 49px)); }
  .menu-buttons.open .menu-btn:nth-child(5) { transform: translate(-50%, calc(-50% + 70px)); }
  .menu-buttons.open .menu-btn:nth-child(6) { transform: translate(calc(-50% - 49px), calc(-50% + 49px)); }
  .menu-buttons.open .menu-btn:nth-child(7) { transform: translate(calc(-50% - 70px), -50%); }
  .menu-buttons.open .menu-btn:nth-child(8) { transform: translate(calc(-50% - 49px), calc(-50% - 49px)); }
  .menu-buttons.open .menu-btn:nth-child(9) { transform: translate(-50%, -50%); }
}

/* Ensure safe-area-insets are respected */
@supports (bottom: env(safe-area-inset-bottom)) {
  .mobile-dig-button {
    right: calc(20px + env(safe-area-inset-right));
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
  #menuBar {
    bottom: calc(13px + env(safe-area-inset-bottom));
    right: calc(20px + env(safe-area-inset-right));
  }
  .menu-buttons {
    bottom: 29px;
    right: calc(29px + env(safe-area-inset-right));
  }
}

@supports (bottom: env(safe-area-inset-bottom)) {
  @media (max-width: 600px) {
    #menuBar {
      bottom: calc(13px + env(safe-area-inset-bottom));
    }
  }
}

/* Ensure playerName input is focusable and allows text selection */
#playerName {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.graveyard-tns-toast {
  position: fixed;
  z-index: 12000;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 16px 22px;
  border: 1px solid rgba(45, 226, 230, 0.58);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 136, 0, 0.18), rgba(45, 226, 230, 0.14)),
    rgba(6, 10, 12, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 34px rgba(45, 226, 230, 0.24);
  color: #fff7e8;
  font-weight: 900;
  font-size: clamp(20px, 4vw, 34px);
  line-height: 1.05;
  text-align: center;
  letter-spacing: 0;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.42s ease, transform 0.42s ease, visibility 0s linear 0.42s;
}

.graveyard-tns-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  transition: opacity 0.42s ease, transform 0.42s ease, visibility 0s;
}

.graveyard-save-notice {
  position: fixed;
  z-index: 12000;
  left: 50%;
  bottom: max(88px, calc(32px + env(safe-area-inset-bottom)));
  transform: translate(-50%, 10px);
  padding: 11px 18px;
  border: 1px solid rgba(86, 255, 207, 0.68);
  border-radius: 8px;
  background: rgba(5, 20, 18, 0.96);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.56);
  color: #8fffdc;
  font-family: "Courier New", monospace;
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.graveyard-save-notice.is-error {
  border-color: rgba(255, 118, 103, 0.75);
  color: #ffb1a8;
}

.graveyard-save-notice.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s;
}

/* Keep Wallet + Stash inside the same visual world as the canvas inventory. */
.game-wallet-backdrop {
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: none;
}

.game-wallet-shell {
  border: 2px solid #b8a16a;
  border-radius: 0;
  background: rgba(11, 10, 9, 0.94);
  box-shadow:
    inset 0 0 0 7px #151310,
    inset 0 0 0 9px #4b4334,
    0 24px 72px rgba(0, 0, 0, 0.72);
  scrollbar-color: #766846 #0b0a09;
}

.game-wallet-shell::before {
  inset: 10px;
  height: auto;
  border: 1px solid #766846;
  border-radius: 0;
  background: none;
  pointer-events: none;
}

.game-wallet-header,
.game-wallet-embedded-header {
  border-bottom: 1px solid #4b4334;
  background: rgba(8, 7, 6, 0.88);
}

.game-wallet-close,
.game-wallet-embedded-close {
  border: 1px solid #d7c48a;
  border-radius: 0;
  color: #f8f3d8;
  background: #201916;
  box-shadow: none;
}

.game-wallet-embedded {
  background: transparent;
}

.game-wallet-embedded iframe {
  background: transparent;
}

.game-wallet-embedded-actions button,
.game-wallet-filters button,
.game-wallet-footer button,
.game-wallet-footer a {
  border-color: #766846;
  border-radius: 0;
  color: #e8dcae;
  background: #171513;
}

.game-wallet-status,
.game-wallet-identity,
.game-wallet-metric,
.game-wallet-loadout,
.game-wallet-asset,
.game-wallet-market-selected,
.game-wallet-market-chart,
.game-wallet-market-row {
  border-color: #5f5439;
  border-radius: 0;
  background-color: rgba(10, 9, 8, 0.82);
  box-shadow: none;
}
