/* WalkQuest — Dark Glassmorphism Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --bg: #0a0d12;
  --bg-card: rgba(255,255,255,0.05);
  --bg-card-hover: rgba(255,255,255,0.08);
  --bg-glass: rgba(255,255,255,0.07);
  --border-glass: rgba(255,255,255,0.1);
  --teal: #58d3b7;
  --teal-glow: rgba(88,211,183,0.3);
  --teal-dim: rgba(88,211,183,0.15);
  --gold: #f0b429;
  --red: #e74c3c;
  --text: #e8eaed;
  --text-dim: rgba(255,255,255,0.5);
  --text-muted: rgba(255,255,255,0.35);
  --nav-bg: rgba(10,13,18,0.92);
  --shadow: 0 8px 32px rgba(0,0,0,0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 64px;
}

/* Light mode */
body.light-mode {
  --bg: #f0f2f5;
  --bg-card: rgba(255,255,255,0.8);
  --bg-card-hover: rgba(255,255,255,0.95);
  --bg-glass: rgba(255,255,255,0.6);
  --border-glass: rgba(0,0,0,0.08);
  --text: #1a1a2e;
  --text-dim: rgba(0,0,0,0.5);
  --text-muted: rgba(0,0,0,0.35);
  --nav-bg: rgba(240,242,245,0.92);
  --shadow: 0 8px 32px rgba(0,0,0,0.1);
}

* { margin:0; padding:0; box-sizing:border-box; }

html { 
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== LANDING PAGE ===== */
.landing {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.landing::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, var(--teal-dim) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(88,211,183,0.08) 0%, transparent 40%);
  animation: bgPulse 8s ease-in-out infinite;
}

@keyframes bgPulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

.landing-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 380px;
  width: 100%;
}

.landing-logo {
  font-size: 64px;
  margin-bottom: 8px;
  animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.landing h1 {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal) 0%, #a8edda 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.landing .tagline {
  color: var(--text-dim);
  font-size: 1rem;
  margin-bottom: 40px;
  font-weight: 300;
}

/* Auth Forms */
.auth-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 32px 24px;
  width: 100%;
}

.auth-card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.auth-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: none;
}

.auth-toggle {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

.auth-toggle a {
  color: var(--teal);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal) 0%, #3db89e 100%);
  color: #0a0d12;
}

.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--teal);
  color: var(--teal);
}

.btn-disabled {
  background: rgba(255,255,255,0.08);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Install Banner */
.install-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, var(--teal) 0%, #3db89e 100%);
  color: #0a0d12;
  padding: 12px 16px;
  display: none;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  font-weight: 600;
  font-size: 0.9rem;
}

.install-banner.show { display: flex; }

.install-banner button {
  background: rgba(0,0,0,0.15);
  border: none;
  color: #0a0d12;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.8rem;
}

.install-dismiss {
  background: none !important;
  font-size: 1.2rem !important;
  padding: 4px 8px !important;
}

/* ===== MAIN APP ===== */
.app-container {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 8px);
}

.tab-content {
  display: none;
  padding: 16px;
  padding-top: 8px;
  min-height: calc(100vh - var(--nav-height));
  min-height: calc(100dvh - var(--nav-height));
  animation: fadeIn 0.3s ease;
}

.tab-content.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.app-header {
  padding: 16px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--teal), #a8edda);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s;
}

.icon-btn:active { background: var(--bg-card-hover); }

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
  border: none;
  background: none;
  font-family: inherit;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform 0.2s;
}

.nav-item .nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-item.active {
  color: var(--teal);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

/* ===== DASHBOARD ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--teal);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Active Challenge Cards */
.active-challenge-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.active-challenge-card:active {
  transform: scale(0.98);
}

.active-challenge-card .challenge-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.challenge-progress {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #a8edda);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Log Steps Button */
.log-steps-btn {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), #3db89e);
  color: #0a0d12;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--teal-glow);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.log-steps-btn:active {
  transform: scale(0.9);
}

/* ===== MAP TAB ===== */
#map-container {
  width: 100%;
  height: calc(100vh - var(--nav-height) - 60px);
  height: calc(100dvh - var(--nav-height) - 60px);
  border-radius: var(--radius);
  overflow: hidden;
}

.map-controls {
  position: absolute;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 20px);
  left: 16px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

/* Challenge markers */
.challenge-marker { background: none; border: none; }

.marker-pin {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.marker-pin span {
  transform: rotate(45deg);
  font-size: 14px;
}

/* User location */
.user-dot {
  width: 24px;
  height: 24px;
  background: rgba(88,211,183,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}

.user-dot-inner {
  width: 12px;
  height: 12px;
  background: var(--teal);
  border-radius: 50%;
  border: 2px solid white;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.user-marker { background: none; border: none; }

/* Bottom Sheet */
.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-glass);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 12px 20px calc(var(--nav-height) + var(--safe-bottom) + 16px);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 90;
  max-height: 60vh;
  overflow-y: auto;
}

.bottom-sheet.visible {
  transform: translateY(0);
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  margin: 0 auto 16px;
  cursor: pointer;
}

.sheet-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.diff-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diff-easy { background: rgba(88,211,183,0.15); color: var(--teal); }
.diff-medium { background: rgba(240,180,41,0.15); color: var(--gold); }
.diff-hard { background: rgba(231,76,60,0.15); color: var(--red); }

.distance-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  color: var(--text-dim);
}

.sheet-content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.sheet-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 16px;
}

.sheet-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.sheet-stats .stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.stat-icon { font-size: 1rem; }

.sheet-area {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
  display: inline-block;
}

/* ===== CHALLENGES TAB ===== */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
  font-family: inherit;
}

.filter-chip.active {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--teal);
}

.challenge-list-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
  cursor: pointer;
}

.challenge-list-card:active { transform: scale(0.98); }

.challenge-info {
  flex: 1;
}

.challenge-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.challenge-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.challenge-xp {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
  width: auto;
  border-radius: 20px;
}

/* ===== LEADERBOARD ===== */
.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.lb-tab {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
}

.lb-tab.active {
  background: var(--teal-dim);
  border-color: var(--teal);
  color: var(--teal);
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 0 20px;
}

.podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 100px;
}

.podium-avatar {
  font-size: 2rem;
  margin-bottom: 4px;
}

.podium-medal { font-size: 1.2rem; }

.podium-name {
  font-size: 0.7rem;
  font-weight: 600;
  margin: 4px 0;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.podium-steps {
  font-size: 0.75rem;
  color: var(--teal);
  font-weight: 700;
}

.podium-bar {
  width: 100%;
  height: var(--h, 100px);
  background: linear-gradient(180deg, var(--teal-dim) 0%, transparent 100%);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-top: 8px;
}

.podium-user .podium-name { color: var(--teal); }

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
}

.lb-user {
  border-color: var(--teal);
  background: var(--teal-dim);
}

.lb-rank {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 30px;
}

.lb-avatar { font-size: 1.3rem; }

.lb-name {
  flex: 1;
  font-weight: 500;
  font-size: 0.9rem;
}

.lb-steps {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--teal);
}

/* ===== PROFILE ===== */
.profile-header {
  text-align: center;
  padding: 24px 0;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), #3db89e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 12px;
}

.profile-name {
  font-size: 1.3rem;
  font-weight: 700;
}

.profile-xp {
  color: var(--teal);
  font-weight: 600;
  font-size: 0.9rem;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.badge-item {
  text-align: center;
  padding: 12px 4px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.badge-item.locked {
  opacity: 0.3;
  filter: grayscale(1);
}

.badge-icon { font-size: 1.5rem; }

.badge-name {
  font-size: 0.6rem;
  color: var(--text-dim);
  margin-top: 4px;
  font-weight: 500;
}

.settings-section {
  margin-top: 24px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.setting-label {
  font-weight: 500;
  font-size: 0.9rem;
}

/* Toggle Switch */
.toggle {
  width: 48px;
  height: 26px;
  background: rgba(255,255,255,0.15);
  border-radius: 13px;
  position: relative;
  cursor: pointer;
  transition: background 0.3s;
}

.toggle.on { background: var(--teal); }

.toggle::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

.toggle.on::after { transform: translateX(22px); }

/* Language select */
.lang-select {
  padding: 6px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-select option { background: var(--bg); }

/* Edit name */
.edit-name-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.edit-name-row input {
  flex: 1;
  padding: 10px 14px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.edit-name-row input:focus { border-color: var(--teal); }

.edit-name-row button {
  padding: 10px 20px;
  background: var(--teal);
  color: #0a0d12;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.logout-btn {
  width: 100%;
  padding: 14px;
  margin-top: 24px;
  background: rgba(231,76,60,0.1);
  border: 1px solid rgba(231,76,60,0.3);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 2000;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== CELEBRATION ===== */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.celebration-overlay.show { display: flex; }

.celebration-card {
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  padding: 40px 32px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  animation: celebrationPop 0.5s ease;
}

@keyframes celebrationPop {
  0% { transform: scale(0.5); opacity: 0; }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); opacity: 1; }
}

.celebration-emoji { font-size: 4rem; margin-bottom: 12px; }
.celebration-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px; }
.celebration-xp { font-size: 1.1rem; color: var(--teal); font-weight: 700; margin-bottom: 20px; }

/* Confetti */
.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3001;
  overflow: hidden;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  top: -10px;
  animation: confettiFall 3s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== STEP MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.modal-overlay.show { display: flex; }

.modal-card {
  background: var(--nav-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 32px 24px;
  max-width: 320px;
  width: 90%;
  text-align: center;
}

.modal-card h3 {
  margin-bottom: 16px;
  font-weight: 700;
}

.modal-card input {
  width: 100%;
  padding: 14px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  font-family: inherit;
  margin-bottom: 16px;
}

.modal-card input:focus { border-color: var(--teal); }

.modal-btns {
  display: flex;
  gap: 8px;
}

.modal-btns .btn { flex: 1; }

/* Quick step presets */
.step-presets {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.step-preset {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
}

.step-preset:active { background: var(--teal-dim); color: var(--teal); }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-glass); border-radius: 4px; }

/* ===== SOCIAL LOGIN ===== */
.social-divider {
  display: flex;
  align-items: center;
  margin: 20px 0 16px;
  gap: 12px;
}

.social-divider::before,
.social-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-glass);
}

.social-divider span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-social {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-glass);
  color: var(--text);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-social:active {
  transform: scale(0.97);
  background: rgba(255,255,255,0.1);
}

.btn-social svg {
  flex-shrink: 0;
}

.btn-openai:hover { border-color: #10a37f; }
.btn-google:hover { border-color: #4285F4; }

.btn-guest {
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--border-glass);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  transition: all 0.2s;
}

.btn-guest:active { background: rgba(255,255,255,0.04); }

/* ===== MEMBERSHIP BADGE (Profile) ===== */
.profile-name-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.membership-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  white-space: nowrap;
}

.profile-auth-method {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== MEMBERSHIP CARD ===== */
.membership-card {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.membership-card::before {
  content: '';
  position: absolute;
  top: -30%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--teal-dim) 0%, transparent 70%);
  pointer-events: none;
}

.membership-card-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.membership-card-tier {
  font-size: 2.5rem;
}

.membership-card-info {
  flex: 1;
}

.membership-card-tier-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.membership-card-since {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.membership-upgrade-btn {
  white-space: nowrap;
}

.membership-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-glass);
  position: relative;
}

.membership-stat {
  text-align: center;
}

.membership-stat-value {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--teal);
}

.membership-stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-top: 2px;
}

/* ===== TIER BENEFITS LIST ===== */
.tier-benefits-list {
  margin-bottom: 20px;
}

.tier-benefit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xs);
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.tier-benefit-item.locked {
  opacity: 0.45;
}

.tier-benefit-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.tier-benefit-text {
  flex: 1;
}

.tier-benefit-tag {
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--teal-dim);
  color: var(--teal);
  font-weight: 600;
  white-space: nowrap;
}

/* ===== MEMBERSHIP MODAL ===== */
.membership-modal-card {
  max-width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 16px;
}

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

.membership-modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tier Cards */
.tier-cards-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tier-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
  position: relative;
}

.tier-card-current {
  border-color: var(--tier-color, var(--teal));
  box-shadow: 0 0 20px rgba(88,211,183,0.1);
}

.tier-card-featured {
  background: linear-gradient(135deg, rgba(88,211,183,0.08) 0%, rgba(255,255,255,0.04) 100%);
}

.tier-card-featured::before {
  content: '⭐ BEST VALUE';
  position: absolute;
  top: -1px;
  right: 16px;
  background: linear-gradient(135deg, var(--teal), #3db89e);
  color: #0a0d12;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 0 0 8px 8px;
  letter-spacing: 0.5px;
}

.tier-card-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.tier-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tier-color, var(--text));
}

.tier-card-price {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 4px 0;
  color: var(--text);
}

.tier-card-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.4;
}

.tier-card-features {
  list-style: none;
  text-align: left;
  margin-bottom: 16px;
}

.tier-card-features li {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 3px 0;
}

/* Comparison table */
.comparison-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.comparison-table-wrap::-webkit-scrollbar { display: none; }

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.comparison-table th,
.comparison-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border-glass);
}

.comparison-table th {
  font-weight: 700;
  color: var(--text-dim);
  font-size: 0.7rem;
  line-height: 1.4;
}

.comparison-table td:first-child {
  text-align: left;
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

/* Upgrade modal */
.upgrade-modal-card {
  max-width: 340px;
  text-align: center;
}

.upgrade-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

/* Leaflet overrides */
.leaflet-control-zoom a {
  background: var(--nav-bg) !important;
  color: var(--text) !important;
  border-color: var(--border-glass) !important;
}

/* Tab map needs no padding */
#tab-map { padding: 0; }
#tab-map.active { display: block; position: relative; }
