/* Leaderboard panel */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 100vw);
  z-index: 1500;
  background: rgba(12, 14, 22, 0.86);
  border-left: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: -8px 0 40px rgba(0,0,0,0.35), inset 1px 0 0 rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.side-panel.open {
  transform: translateX(0);
  display: flex;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  border-bottom: 1px solid var(--border);
  font-size: 17px;
  font-weight: 700;
}

.panel-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

#leaderboard-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tab.active {
  background: rgba(0,255,136,0.12);
  border-color: var(--accent);
  color: var(--accent);
}

#leaderboard-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  transition: background 0.15s;
}
.lb-row:hover { background: rgba(255,255,255,0.03); }

.lb-rank {
  width: 24px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.lb-rank.top { color: #ffd700; }

.lb-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-rank-badge {
  font-size: 11px;
  color: var(--text-muted);
}

.lb-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  min-width: 60px;
}

/* Territory avatar markers */
.t-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 1px 5px rgba(0,0,0,0.6);
  object-fit: cover;
  display: block;
}
.t-avatar--initial {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.lb-load-more {
  display: block;
  width: calc(100% - 36px);
  margin: 4px 18px 14px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  flex-shrink: 0;
}
.lb-load-more:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

/* Profile drawer (left slide-in) */
#profile-modal {
  align-items: flex-start;
  justify-content: flex-start;
  background: rgba(0, 0, 0, 0.15);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.profile-drawer {
  position: relative;
  width: min(300px, 88vw);
  height: 100%;
  background: rgba(12, 14, 22, 0.86);
  border-right: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: 8px 0 40px rgba(0,0,0,0.35), inset -1px 0 0 rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-drawer.open {
  transform: translateX(0);
}

.profile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.profile-drawer-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.profile-drawer-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 18px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-drawer-section {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-drawer-nav {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.profile-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.profile-nav-item:hover { background: rgba(255,255,255,0.05); }

.profile-nav-icon { font-size: 18px; }
.profile-nav-label { flex: 1; }
.profile-nav-arrow { color: var(--text-muted); font-size: 16px; }

.profile-drawer-footer {
  margin-top: auto;
  padding: 16px 18px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  flex-shrink: 0;
}

.profile-photo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
}

.profile-photo-label {
  cursor: pointer;
}

.profile-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 28px;
  color: #fff;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s;
}

.profile-photo-label:hover .profile-avatar-preview {
  border-color: var(--accent);
}

.profile-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-photo-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.profile-field {
  margin-bottom: 14px;
}

.profile-field label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.profile-name-input {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.profile-name-input:focus { border-color: var(--accent); }
.profile-name-input:disabled { opacity: 0.45; }

.profile-msg {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}
.profile-error { color: var(--danger); }

.profile-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.profile-cancel-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-cancel-btn:hover { background: rgba(255,255,255,0.05); }

.profile-save-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #000;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}
.profile-save-btn:hover { opacity: 0.9; }
.profile-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.profile-logout-btn {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 80, 80, 0.3);
  background: transparent;
  color: #ff5050;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.profile-logout-btn:hover { background: rgba(255, 80, 80, 0.08); }

/* Bounty info card */
.bounty-info-card {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, calc(100vw - 24px));
  background: rgba(12, 14, 22, 0.86);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  padding: 14px 16px;
  z-index: 1200;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.08);
}
.bounty-info-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
}
.bounty-info-content {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding-right: 20px;
}
.bounty-info-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.bounty-info-name {
  font-size: 15px;
  font-weight: 700;
}
.bounty-info-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}
.bounty-info-actions {
  display: flex;
  gap: 8px;
}
.bounty-route-btn {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #000;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.bounty-edit-btn {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.bounty-delete-btn {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,80,80,0.3);
  background: transparent;
  color: #ff5050;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Bounty modal — location display */
.bounty-location-display {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
}

/* Bounty image upload */
.bounty-image-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 72px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
}
.bounty-image-label:hover { border-color: var(--accent); }
.bounty-image-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  display: block;
}
.bounty-image-placeholder {
  font-size: 14px;
  color: var(--text-muted);
  padding: 16px;
}

/* Bounty notes textarea */
.bounty-notes {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

/* Badge image in profile shelf */
.badge-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* How-to-play FAB (bottom-left) */
.how-to-play-fab {
  position: fixed;
  left: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  z-index: 1000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s, border-color 0.2s;
}
.how-to-play-fab:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Admin fab stacks above the how-to-play fab when both visible */
.admin-fab:not(.hidden) ~ .how-to-play-fab,
.how-to-play-fab.admin-above {
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
}

/* Admin: drop-a-treasure button (mirrors the map-style FAB, bottom-left) */
.admin-fab {
  position: fixed;
  left: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  z-index: 1000;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 18px rgba(255,205,40,0.28);
}

/* Drop-treasure modal: side-by-side tier + radius row */
.bounty-row { display: flex; gap: 12px; }
.bounty-row-grow { flex: 1; }
.bounty-row-narrow { width: 110px; flex-shrink: 0; }

select.profile-name-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* Badge shelf (profile) */
.badge-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
}
.badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  max-width: 100%;
}
.badge-medal {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #3a2a06;
  background: radial-gradient(circle at 35% 30%, #fff3c0, var(--medal, #f4c948));
  box-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.badge.tier-gold   { --medal: #f4c948; }
.badge.tier-silver { --medal: #d7dde3; }
.badge.tier-bronze { --medal: #cd8b4f; }
.badge-info { display: flex; flex-direction: column; min-width: 0; }
.badge-name {
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.badge-date { font-size: 11px; color: var(--text-muted); }
.badge-code {
  font-size: 10px;
  font-family: 'Courier New', Courier, monospace;
  color: var(--accent);
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.badge-code:hover { opacity: 1; }

/* Vaults panel — above the profile overlay (2000), slides in from left */
#vaults-panel {
  z-index: 2100;
  overflow-y: auto;
  left: 0;
  right: auto;
  border-left: none;
  border-right: 1px solid rgba(255,255,255,0.14);
  box-shadow: 8px 0 40px rgba(0,0,0,0.35), inset -1px 0 0 rgba(255,255,255,0.06);
  transform: translateX(-100%);
}

#vaults-panel.open {
  transform: translateX(0);
}

.vaults-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.vaults-wallet-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.vaults-treasures-section {
  padding: 16px 18px;
  flex: 1;
}

.vaults-section-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.wallet-address-row,
.wallet-balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.wallet-address {
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  color: var(--accent);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wallet-balance {
  font-size: 12px;
  color: var(--text-muted);
  flex: 1;
}
.wallet-action-btn {
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.wallet-action-btn:hover { background: rgba(255,255,255,0.1); }
.wallet-action-btn--accent {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,255,136,0.06);
}
.wallet-action-btn--accent:hover { background: rgba(0,255,136,0.12); }

.wallet-export-btn {
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.wallet-export-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Export key sub-modal */
.wallet-export-card {
  padding: 22px 24px;
  max-width: 360px;
  text-align: left;
}
.wallet-export-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
}
.wallet-export-header button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.wallet-export-warning {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  background: rgba(255,68,68,0.08);
  border: 1px solid rgba(255,68,68,0.25);
  border-radius: 8px;
  padding: 10px 12px;
}
.wallet-export-warning strong { color: var(--danger); }
.wallet-reveal-btn { width: 100%; margin-top: 0; }

.wallet-key-box { margin-top: 12px; }
.wallet-key-text {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  padding: 8px;
  resize: none;
  margin-bottom: 8px;
}
.wallet-export-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.wallet-export-actions .wallet-action-btn { flex: 1; text-align: center; }
.wallet-export-hint {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.wallet-export-loading { font-size: 13px; color: var(--text-muted); text-align: center; padding: 12px 0; }

/* Map search */
.map-search {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: min(280px, calc(100vw - 180px));
  z-index: 1000;
}

@media (max-width: 520px) {
  .map-search {
    top: calc(env(safe-area-inset-top, 0px) + 12px);
    left: 68px;
    right: 58px;
    width: auto;
    transform: none;
    padding-top: 10px;
    z-index: 1001;
  }

  #walk-stats {
    top: calc(env(safe-area-inset-top, 0px) + 70px);
    right: 12px;
  }
  .map-search-input {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    border-radius: 8px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    box-shadow: none;
  }
  .map-search-results {
    margin-top: 10px;
  }
}
.map-search-input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  transition: border-color 0.2s;
}
.map-search-input:focus { border-color: var(--accent); }
.map-search-input::-webkit-search-cancel-button { cursor: pointer; }
.map-search-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  max-height: 260px;
  overflow-y: auto;
}
.map-search-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.12s;
}
.map-search-result:last-child { border-bottom: none; }
.map-search-result:hover,
.map-search-result.active { background: rgba(255,255,255,0.07); }
.msr-name { font-size: 13px; font-weight: 600; }
.msr-sub  { font-size: 11px; color: var(--text-muted); }

/* Map style picker */
.map-style {
  position: fixed;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 28px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.map-style-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(12, 14, 22, 0.80);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.07);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-style-menu {
  display: flex;
  flex-direction: row;
  gap: 10px;
  padding: 10px;
  background: rgba(12, 14, 22, 0.80);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.07);
}

/* Google Maps-style option: tile thumbnail with label underneath */
.map-style-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s;
}
.map-style-thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s;
}
.map-style-opt.active {
  color: var(--accent);
}
.map-style-opt.active .map-style-thumb {
  border-color: var(--accent);
}

/* Full-screen claim celebration */
.celebration-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 3500;
  background: rgba(4, 4, 12, 0.82);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.4s;
}
.celebration-fullscreen.steal { background: rgba(14, 5, 5, 0.94); }
.celebration-fullscreen.fade { opacity: 0; pointer-events: none; }

.celebration-inner {
  text-align: center;
  padding: 32px 28px;
  max-width: 340px;
  width: 90%;
  pointer-events: none;
  animation: celebrate-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(12, 14, 22, 0.86);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 24px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.10);
}

.celebration-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid rgba(153,69,255,0.5);
  background: rgba(153,69,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  margin: 0 auto 20px;
}
.celebration-fullscreen.steal .celebration-icon {
  border-color: rgba(255,85,0,0.5);
  background: rgba(255,85,0,0.1);
}

#celebration-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

#celebration-stat {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}
#celebration-stat.celebration-stat-sol {
  font-size: 48px;
  color: #9945ff;
  line-height: 1;
  margin-bottom: 2px;
}
.celebration-fullscreen.steal #celebration-stat { color: #ff7733; }

.celebration-badge-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
}

.celebration-actions {
  margin-top: 28px;
  pointer-events: auto;
}

.celebration-share {
  padding: 11px 32px;
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 24px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.celebration-share:hover { background: rgba(0,255,136,0.1); }
.celebration-fullscreen.steal .celebration-share {
  border-color: #ff7733;
  color: #ff7733;
}
.celebration-fullscreen.steal .celebration-share:hover { background: rgba(255,119,51,0.1); }

.celebration-dismiss-hint {
  margin-top: 24px;
  font-size: 12px;
  color: rgba(255,255,255,0.25);
  pointer-events: none;
}

@keyframes celebrate-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}

/* Secret code block inside celebration card */
.celebration-code {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  pointer-events: auto;
}

.celebration-code-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.celebration-code-words {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  line-height: 1.8;
  white-space: pre-line;
  margin-bottom: 10px;
}

.celebration-code-copy {
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 20px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 18px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s;
}
.celebration-code-copy:hover { background: rgba(0,255,136,0.1); }

/* Confetti */
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4000;
}

/* Proof page */
.proof-page {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.proof-map {
  flex: 1;
  min-height: 0;
}

.proof-info {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  overflow-y: auto;
  max-height: 45vh;
}

.proof-owner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.proof-owner-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.proof-owner-name { font-size: 18px; font-weight: 800; }
.proof-owner-rank { font-size: 12px; color: var(--text-muted); }

.proof-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.proof-stat {
  display: flex;
  flex-direction: column;
}

.proof-stat-value { font-size: 20px; font-weight: 800; color: var(--accent); }
.proof-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.proof-history { border-top: 1px solid var(--border); padding-top: 12px; }
.proof-history-title { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }

.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 13px;
}
.history-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.history-name { font-weight: 600; }
.history-date { color: var(--text-muted); margin-left: auto; font-size: 12px; }
.history-lost { color: var(--danger); font-size: 11px; }

.proof-share-btn {
  display: block;
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

/* HUD stats pill */
.hud-pill {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
  left: 12px;
  background: rgba(12, 14, 22, 0.78);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 20px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  z-index: 800;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 2px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  pointer-events: none;
  white-space: normal;
  min-width: 62px;
}

.hud-pill-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 7px 0;
}

.hud-pill-num {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}

.hud-pill-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: center;
}

.hud-pill-sep {
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.hud-live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #48cae4;
  margin-left: 3px;
  vertical-align: 1px;
  animation: hud-pulse 1.8s ease-in-out infinite;
}

@keyframes hud-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

.hud-live      { color: #48cae4; }
.hud-remaining { color: #ffd700; }
.hud-sol       { color: #9945ff; }
.hud-claimed   { color: #00ff88; }
.hud-players   { color: #c77dff; }

.hud-sol-icon {
  width: 10px;
  height: 10px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 2px;
  opacity: 0.85;
}

@media (max-width: 520px) {
  .hud-pill {
    pointer-events: auto;
    cursor: pointer;
  }

  /* collapsed: one stat visible at a time, fully rounded */
  .hud-pill:not(.expanded) { border-radius: 999px; }
  .hud-pill:not(.expanded) .hud-pill-stat { display: none; }
  .hud-pill:not(.expanded) .hud-pill-stat.active { display: flex; }
  .hud-pill:not(.expanded) .hud-pill-sep { display: none; }

  /* expanded: show all */
  .hud-pill.expanded .hud-pill-stat { display: flex; }
  .hud-pill.expanded .hud-pill-sep { display: block; }
}

/* ── How to Play modal ───────────────────────────────────────────────── */
.howto-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 90vh;
  background: rgba(11, 13, 20, 0.97);
  border: 1px solid rgba(255,255,255,0.14);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  box-shadow: 0 -8px 48px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: howto-slide-up 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes howto-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.howto-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
}

.howto-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.howto-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  line-height: 1;
}

.howto-slider { flex: 1; overflow: hidden; min-height: 0; }
.howto-track { display: flex; width: 500%; height: 100%; transition: transform 0.35s cubic-bezier(0.4,0,0.2,1); }
.howto-slide { width: 20%; flex-shrink: 0; display: flex; flex-direction: column; align-items: center; padding: 16px 24px 8px; gap: 12px; box-sizing: border-box; }
.howto-anim { width: 100%; flex: 1; min-height: 0; border-radius: 16px; background: #0b0d14; overflow: hidden; }
.howto-anim svg { width: 100%; height: 100%; }
.howto-slide-title { font-size: 17px; font-weight: 700; color: var(--text); text-align: center; flex-shrink: 0; }
.howto-slide-desc { font-size: 13px; color: var(--text-muted); text-align: center; line-height: 1.5; flex-shrink: 0; }
.howto-nav { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 6px 0; flex-shrink: 0; }
.howto-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.2); border: none; cursor: pointer; padding: 0; transition: width 0.3s, background 0.3s, border-radius 0.3s; -webkit-tap-highlight-color: transparent; }
.howto-dot.active { width: 22px; border-radius: 3px; background: var(--accent); }

.howto-cta {
  margin: 12px 20px;
  margin-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  width: calc(100% - 40px);
  padding: 15px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s;
}

.howto-cta:hover { opacity: 0.88; }
