@font-face {
  font-family: 'Lilita One Local';
  src: url('../fonts/lilita_one_regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

:root {
  --font-game: 'Lilita One Local', 'Lilita One', system-ui, -apple-system, sans-serif;
  --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --bg-color: #8f97ab;
  --panel-bg: rgba(22, 27, 34, 0.78);
  --panel-border: rgba(255, 255, 255, 0.12);
  --panel-blur: blur(16px);

  --accent-gold: #ffcc00;
  --accent-green: #2ecc71;
  --accent-red: #e74c3c;
  --accent-blue: #3498db;
  --accent-purple: #9b59b6;

  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.75);
  --text-dim: rgba(255, 255, 255, 0.45);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-ui);
  color: var(--text-white);
}

#renderCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

/* UI Overlay Container */
.ui-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.interactive {
  pointer-events: auto;
}

/* Header & Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  gap: 12px;
}

.top-bar .toolbar {
  max-width: calc(100vw - 480px);
  width: auto;
}

.top-left-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.fps-badge {
  background: rgba(10, 15, 24, 0.85);
  border: 1px solid rgba(0, 255, 136, 0.35);
  border-radius: 20px;
  padding: 6px 14px;
  font-family: monospace;
  font-size: 13px;
  font-weight: 700;
  color: #00ff88;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.cash-container {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel-bg);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--panel-border);
  border-radius: 40px;
  padding: 8px 22px 8px 12px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cash-container:hover {
  transform: translateY(-2px);
}

.coin-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  animation: pulse-coin 3s infinite ease-in-out;
}

@keyframes pulse-coin {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.cash-text {
  font-family: var(--font-game);
  font-size: 26px;
  letter-spacing: 0.5px;
  color: var(--accent-gold);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}

.stats-badge {
  background: var(--panel-bg);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-white);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Toolbar Buttons - Scrollable so no button is ever cut off */
.toolbar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  padding: 6px 8px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap !important;
  scrollbar-width: none !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: var(--shadow-md);
}

.toolbar::-webkit-scrollbar {
  display: none !important;
}

.toolbar > * {
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
}

.btn-tool {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  color: var(--text-white);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.btn-tool:active {
  transform: translateY(0);
}

.btn-tool.active-tool {
  background: var(--accent-red);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 14px rgba(231, 76, 60, 0.6);
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.btn-tool.nft-highlight {
  background: linear-gradient(135deg, #8a2be2, #4a00e0);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 12px rgba(138, 43, 226, 0.4);
}

.btn-tool.nft-highlight:hover {
  box-shadow: 0 0 18px rgba(138, 43, 226, 0.7);
}

/* Bottom HUD Area - Compact floating glassmorphism dock */
.bottom-area {
  position: fixed !important;
  bottom: 14px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  width: 760px !important;
  max-width: 82% !important;
  height: 132px !important;
  max-height: 132px !important;
  min-height: 132px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 12px 6px 12px !important;
  overflow: visible !important;
  background: rgba(18, 18, 18, 0.68) !important;
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-radius: 14px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
  z-index: 20;
}

/* Category Filter Tabs */
.category-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  height: 28px !important;
  font-size: 12px !important;
  flex-shrink: 0;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 2px 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 6px !important;
  padding-bottom: 2px !important;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px !important;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.category-tab:hover {
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.08);
}

.category-tab.active {
  color: #111;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Structure Selection Dock */
.dock-wrapper {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  padding-top: 8px !important;
  padding-bottom: 8px !important;
  height: 78px !important;
  flex: 1;
}

.dock-wrapper::-webkit-scrollbar {
  display: none;
}

.structure-dock {
  display: flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 8px;
  height: 78px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
}

.structure-dock::-webkit-scrollbar {
  display: none;
}

.structure-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 62px;
  width: 62px;
  height: 62px;
  font-size: 10px;
  line-height: 11px;
  flex-shrink: 0 !important;
  transform-origin: center center !important;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 2px;
  cursor: pointer;
  transition: transform 0.15s ease;
  color: var(--text-white);
}

.structure-card:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.05) !important;
  border-color: rgba(255, 255, 255, 0.3);
}

.structure-card.active {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--accent-gold);
  transform: scale(1.05) !important;
  z-index: 5 !important;
  margin: 2px !important;
  box-shadow: 0 6px 16px rgba(255, 204, 0, 0.35);
}

.card-icon {
  font-size: 24px;
  line-height: 1;
  margin-bottom: 3px;
}

.card-name {
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  max-width: 58px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-white);
  line-height: 11px;
}

.card-price {
  font-family: var(--font-game);
  font-size: 10px;
  color: var(--accent-gold);
  margin-top: 2px;
  line-height: 11px;
}

.card-badge {
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-muted);
  padding: 1px 4px;
  border-radius: 4px;
}

.structure-card.active .card-badge {
  background: var(--accent-gold);
  color: #111;
}

/* Instructions Floating Overlay (Bottom Left) */
.instructions-overlay {
  position: absolute;
  bottom: 110px;
  left: 15px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel-bg);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  max-width: 280px;
  transition: opacity 0.3s ease;
}

.instructions-title {
  font-family: var(--font-game);
  font-size: 16px;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hotkey-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.hotkey-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.kbd-badge {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  padding: 2px 6px;
  font-family: monospace;
  font-weight: 700;
  font-size: 10px;
  color: #fff;
}

/* Toast Notifications */
.toast-notification {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: rgba(18, 22, 30, 0.92);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid var(--panel-border);
  color: var(--text-white);
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 100;
}

.toast-notification.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Hover label over enterable houses */
.enter-prompt {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -100%);
  background: rgba(18, 22, 30, 0.9);
  border: 1px solid #3ddc84;
  color: #eafff3;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  z-index: 90;
  white-space: nowrap;
}

/* Mobile Touch Controls Hint */
.mobile-hint {
  position: absolute;
  bottom: 165px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  background: rgba(18, 22, 30, 0.88);
  backdrop-filter: var(--panel-blur);
  -webkit-backdrop-filter: var(--panel-blur);
  border: 1px solid rgba(0, 240, 255, 0.35);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  z-index: 95;
  pointer-events: none;
  animation: hintFadeIn 0.4s ease;
}

.mobile-hint span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-white);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 5px 10px;
  white-space: nowrap;
}

.mobile-hint.hide {
  opacity: 0;
  transition: opacity 0.6s ease;
}

@keyframes hintFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #2e3646 0%, #151a24 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.4s ease;
}

.loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-logo {
  width: 140px;
  height: 140px;
  margin-bottom: 24px;
  animation: float-logo 3s ease-in-out infinite;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.6));
  object-fit: contain;
  border-radius: 24px;
}

@keyframes float-logo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.loading-title {
  font-family: var(--font-game);
  font-size: 36px;
  color: var(--text-white);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.loading-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.progress-container {
  width: 320px;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffcc00, #ff8800);
  border-radius: 10px;
  transition: width 0.15s ease;
  box-shadow: 0 0 12px rgba(255, 204, 0, 0.8);
}

.progress-text {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: #1b212c;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 28px;
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  z-index: 2;
  transform: scale(0.92);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-game);
  font-size: 24px;
  color: var(--accent-gold);
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.modal-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
}

.modal-body p {
  margin-bottom: 12px;
}

.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.nft-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.nft-item:hover {
  transform: translateY(-4px);
  border-color: var(--accent-purple);
  box-shadow: 0 6px 16px rgba(155, 89, 182, 0.3);
}

.nft-item img {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  object-fit: cover;
  object-fit: cover;
  margin-bottom: 8px;
}

.nft-item h4 {
  font-size: 12px;
  color: #fff;
  font-weight: 700;
}

.nft-item span {
  font-size: 10px;
  color: var(--accent-gold);
  margin-top: 2px;
}

.nft-item .nft-chain {
  display: block;
  width: 100%;
  font-family: monospace;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: break-all;
}

/* ==========================================================================
   THE MAZE ARCADE POPUP MODAL
   ========================================================================== */
.maze-modal {
  z-index: 999;
}

.maze-modal-card {
  max-width: 980px;
  width: 95vw;
  height: 90vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center top, #182030, #0c1018);
  border: 2px solid #00f0ff;
  border-radius: 20px;
  padding: 16px 20px;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.35), 0 20px 50px rgba(0, 0, 0, 0.85);
  overflow: hidden;
}

.maze-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.25);
  margin-bottom: 12px;
}

.maze-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.maze-header-icon {
  font-size: 26px;
  filter: drop-shadow(0 0 8px #00f0ff);
  animation: rotateIcon 12s linear infinite;
}

@keyframes rotateIcon {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.maze-title {
  font-family: var(--font-game);
  font-size: 24px;
  color: #fff;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #00f0ff, #ffd700);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 16px rgba(0, 240, 255, 0.5);
  margin: 0;
}

.maze-badge {
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #00f0ff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.maze-header-center {
  display: flex;
  align-items: center;
}

.maze-nft-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 215, 0, 0.12);
  border: 1px solid rgba(255, 215, 0, 0.45);
  padding: 6px 14px;
  border-radius: 12px;
  font-family: var(--font-game);
  font-size: 15px;
  color: #ffd700;
  box-shadow: 0 0 14px rgba(255, 215, 0, 0.25);
  letter-spacing: 0.5px;
}

.gem-icon {
  font-size: 16px;
  animation: pulseGem 2s ease-in-out infinite;
}

@keyframes pulseGem {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px #ffd700); }
  50% { transform: scale(1.2); filter: drop-shadow(0 0 10px #ffea00); }
}

.maze-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.maze-close-btn:hover {
  background: rgba(255, 60, 60, 0.8);
  border-color: #ff3c3c;
  transform: scale(1.08);
  box-shadow: 0 0 15px rgba(255, 60, 60, 0.6);
}

.maze-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  border-radius: 14px;
  background: #080c14;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.maze-game-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  overflow: auto;
}

.maze-game-frame {
  width: 100%;
  height: 100%;
  min-height: 480px;
  border: 0;
  border-radius: 12px;
  background: #050505;
  display: block;
}

.maze-placeholder-screen {
  text-align: center;
  padding: 30px;
  max-width: 540px;
}

.maze-loading-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(0, 240, 255, 0.2);
  border-top-color: #00f0ff;
  border-right-color: #ffd700;
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spinMaze 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

@keyframes spinMaze {
  to { transform: rotate(360deg); }
}

.maze-placeholder-title {
  font-family: var(--font-game);
  font-size: 28px;
  color: #fff;
  letter-spacing: 2px;
  margin-bottom: 8px;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.6);
}

.maze-placeholder-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 22px;
}

.maze-nft-previews {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.nft-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e0e8f5;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
}

.maze-ready-badge {
  font-size: 13px;
  font-weight: 700;
  color: #00f0ff;
  letter-spacing: 0.5px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px dashed rgba(0, 240, 255, 0.4);
  padding: 10px 18px;
  border-radius: 10px;
  display: inline-block;
}

/* ==========================================================================
   MULTI-CITY / DISTRICT TRAVEL MODAL
   ========================================================================== */
.city-travel-btn {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(138, 43, 226, 0.25)) !important;
  border-color: rgba(0, 240, 255, 0.5) !important;
}

.city-travel-btn:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.4), rgba(138, 43, 226, 0.45)) !important;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.5) !important;
  transform: translateY(-2px);
}

.city-switcher-modal {
  z-index: 950;
}

.city-switcher-card {
  max-width: 900px;
  width: 94vw;
  max-height: 88vh;
  background: radial-gradient(circle at center top, #1c2538, #0e1422);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 24px;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.2), 0 20px 60px rgba(0, 0, 0, 0.85);
}

.city-switcher-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.city-switcher-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px #00f0ff);
}

.city-switcher-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
}

.city-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 10px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 6px;
}

.city-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.city-card:hover {
  background: rgba(0, 240, 255, 0.08);
  border-color: #00f0ff;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 240, 255, 0.25);
}

.city-card.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: #00f0ff;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.35);
}

.city-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.city-card-icon {
  font-size: 28px;
}

.city-card-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #00f0ff;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.city-card-title {
  font-family: var(--font-game);
  font-size: 17px;
  color: #fff;
  margin-bottom: 6px;
}

.city-card-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.4;
  margin-bottom: 14px;
  flex: 1;
}

.btn-travel {
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-game);
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 114, 255, 0.3);
}

.btn-travel:hover {
  background: linear-gradient(135deg, #00d4ff, #0088ff);
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 114, 255, 0.5);
}

.btn-travel.current {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #00f0ff;
  box-shadow: none;
}

/* Fast Travel World Loading Overlay */
.world-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.world-loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.world-loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 20, 0.85);
  backdrop-filter: blur(8px);
}

.world-loading-card {
  position: relative;
  z-index: 2;
  text-align: center;
  background: rgba(20, 28, 44, 0.9);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 20px;
  padding: 30px 40px;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.3);
  max-width: 400px;
}

.world-loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(0, 240, 255, 0.2);
  border-top-color: #00f0ff;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spinMaze 0.8s linear infinite;
}

.world-loading-card h3 {
  font-family: var(--font-game);
  font-size: 22px;
  color: #fff;
  margin-bottom: 6px;
}

.world-loading-card p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 16px;
}

.world-loading-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.world-loading-bar {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #00f0ff, #0072ff);
  animation: loadingBarPulse 1.2s ease-in-out infinite alternate;
}

@keyframes loadingBarPulse {
  from { transform: scaleX(0.3); }
  to { transform: scaleX(1); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .top-bar {
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top, 0px));
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .top-left-group {
    gap: 10px;
    justify-content: space-between;
    width: 100%;
  }
  .fps-badge {
    padding: 4px 10px;
    font-size: 11px;
  }
  .cash-container {
    padding: 6px 14px 6px 8px;
    gap: 8px;
  }
  .coin-icon {
    width: 26px;
    height: 26px;
  }
  .cash-text {
    font-size: 18px;
  }
  .stats-badge {
    padding: 6px 10px;
    font-size: 11px;
  }
  .toolbar {
    flex-wrap: nowrap !important;
    max-width: 100% !important;
    border-radius: 16px;
    gap: 4px !important;
    padding: 4px 6px !important;
  }
  .top-bar .toolbar {
    max-width: 100%;
    width: 100%;
  }
  .btn-tool {
    padding: 8px 12px;
    font-size: 12px;
    min-height: 42px;
  }
  .instructions-overlay {
    display: none;
  }
  .bottom-area {
    bottom: calc(10px + env(safe-area-inset-bottom, 0px)) !important;
    width: 97vw !important;
    max-width: 97vw !important;
    height: 148px !important;
    max-height: 148px !important;
    min-height: 148px !important;
    padding: 8px 8px 6px 8px !important;
  }
  .category-tabs {
    width: 100%;
    height: 30px !important;
    font-size: 12px !important;
    gap: 4px;
    padding: 2px 4px;
    margin-bottom: 4px !important;
    justify-content: flex-start;
    align-self: stretch;
  }
  .category-tab {
    padding: 4px 10px;
    font-size: 11px !important;
  }
  .dock-wrapper {
    height: 86px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
  .structure-dock {
    height: 86px;
    gap: 6px;
  }
  .structure-card {
    min-width: 66px;
    width: 66px;
    height: 66px;
    font-size: 10px;
    line-height: 11px;
  }
  .card-name {
    font-size: 9px;
  }
  .toast-notification {
    font-size: 12px;
    padding: 8px 14px;
    max-width: 92vw;
  }
  .maze-modal-card {
    width: 98vw;
    height: 95vh;
    padding: 10px;
  }
  .maze-title {
    font-size: 18px;
  }
  .maze-nft-counter {
    font-size: 12px;
    padding: 4px 8px;
  }
  .maze-game-frame {
    min-height: 0;
  }
  .modal-card {
    width: 94vw;
    padding: 18px;
    max-height: 90vh;
  }
  .city-switcher-card {
    width: 97vw;
  }
  .world-creator-footer {
    flex-wrap: wrap;
    justify-content: center;
  }
  .world-creator-footer .btn-travel {
    flex: 1 1 45%;
    max-width: 220px;
  }
}

/* Extra narrow phones */
@media (max-width: 480px) {
  .bottom-area {
    height: 152px !important;
    max-height: 152px !important;
    min-height: 152px !important;
  }
  .dock-wrapper,
  .structure-dock {
    height: 88px !important;
  }
  .structure-card {
    min-width: 64px;
    width: 64px;
    height: 64px;
  }
  .world-creator-body {
    padding: 10px;
  }
  .wc-paint-row {
    flex-direction: column;
  }
  #wcMapCanvas {
    min-width: 0;
    width: 100%;
  }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .instructions-overlay {
    display: none;
  }
  .top-bar {
    padding: 4px 8px;
  }
  .bottom-area {
    height: 120px !important;
    max-height: 120px !important;
    min-height: 120px !important;
  }
  .dock-wrapper,
  .structure-dock {
    height: 70px !important;
  }
  .structure-card {
    min-width: 58px;
    width: 58px;
    height: 58px;
  }
}

/* ===== World Creator Editor ===== */
.world-creator-modal {
  z-index: 1000;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 12px !important;
  box-sizing: border-box !important;
}

.world-creator-card {
  position: relative;
  width: 96vw;
  max-width: 1180px;
  max-height: 90vh;
  height: 90vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at center top, #1c2538, #0e1422);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 20px;
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.2), 0 20px 60px rgba(0, 0, 0, 0.85);
  overflow: hidden;
  z-index: 10;
}

.world-creator-header {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.world-creator-body {
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  gap: 14px;
  padding: 12px 18px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.wc-section {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px;
  backdrop-filter: blur(12px);
}

.wc-title {
  font-family: var(--font-game);
  font-size: 15px;
  color: #00f0ff;
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

.wc-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 10px;
}

.wc-field input[type="text"],
.wc-field textarea,
.wc-field select,
.wc-field input[type="number"] {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 12px;
  padding: 7px 9px;
  outline: none;
}

.wc-field input:focus,
.wc-field textarea:focus,
.wc-field select:focus {
  border-color: #00f0ff;
}

.wc-field input[type="color"] {
  width: 100%;
  height: 34px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: pointer;
}

.wc-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wc-range-row input[type="range"] {
  flex: 1;
  accent-color: #00f0ff;
}

.wc-range-row span {
  font-family: monospace;
  font-size: 12px;
  color: #00f0ff;
  min-width: 52px;
  text-align: right;
}

.wc-group {
  margin-bottom: 14px;
}

.wc-group-title {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 6px;
}

.wc-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.wc-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
}

.wc-check:hover {
  background: rgba(0, 240, 255, 0.1);
}

.wc-check input {
  accent-color: #00f0ff;
}

.wc-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.wc-tool {
  flex: 1;
  padding: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid transparent;
  border-radius: 8px;
  color: #fff;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.wc-tool.active {
  background: rgba(0, 240, 255, 0.2);
  border-color: #00f0ff;
  color: #00f0ff;
}

.wc-paint-row {
  display: flex;
  gap: 10px;
}

.wc-paint-brushes {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.wc-brush {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wc-brush.active {
  border-color: #00f0ff;
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
}

#wcMapCanvas {
  flex: 1;
  width: 100%;
  min-width: 140px;
  image-rendering: pixelated;
  background: #3f8f4b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  cursor: crosshair;
}

.wc-hint {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 8px;
}

.world-creator-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid rgba(0, 217, 255, 0.25);
  flex-shrink: 0;
  background: #0d1322 !important;
  z-index: 20;
}

.world-creator-footer .btn-travel {
  width: auto;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
}

.world-creator-footer #wcSave {
  background: linear-gradient(135deg, #00d9ff, #0072ff) !important;
  color: #fff !important;
  box-shadow: 0 0 18px rgba(0, 217, 255, 0.5);
  border: 1px solid #00f0ff !important;
}

/* Custom world cards in travel modal */
.create-world-card {
  border: 2px dashed #00d9ff !important;
  background: rgba(0, 217, 255, 0.08) !important;
}

.create-world-card .btn-travel {
  background: linear-gradient(135deg, #00d9ff, #0072ff) !important;
}

.world-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.wc-mini {
  flex: 1;
  padding: 5px 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-ui);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.wc-mini:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: #00f0ff;
}

.wc-mini.danger:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: #e74c3c;
}

@media (max-width: 900px) {
  .world-creator-body {
    grid-template-columns: 1fr;
  }
}
