/* ═══════════════════════════════════════════════════════════════
   PITTSBURGH BRIDGE TRACKER — styles.css
   Dark mode · Pittsburgh gold + bridge blue · Mobile-first
═══════════════════════════════════════════════════════════════ */

/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-2:    #21262d;
  --surface-3:    #30363d;
  --gold:         #FFB612;
  --gold-dim:     #cc9210;
  --gold-glow:    rgba(255, 182, 18, 0.25);
  --blue:         #4A90D9;
  --blue-dim:     #2f6fac;
  --green:        #3fb950;
  --red:          #f85149;
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --text-dim:     #484f58;
  --border:       rgba(255,255,255,0.08);
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    20px;
  --nav-height:   64px;
  --topbar-height: 52px;
  --safe-top:     env(safe-area-inset-top, 0px);
  --safe-bottom:  env(safe-area-inset-bottom, 0px);
  --shadow:       0 4px 24px rgba(0,0,0,0.4);
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.3);
}

/* ─── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* iOS viewport height fix */
html {
  height: -webkit-fill-available;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input { font-family: inherit; }

/* ─── LOADING SCREEN ─────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

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

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading-bridge {
  font-size: 64px;
  animation: bob 1.5s ease-in-out infinite;
}

.loading-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

/* ─── APP SHELL ──────────────────────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

#app.hidden { display: none; }

/* ─── VIEWS ──────────────────────────────────────────────────── */
.view {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view.active { display: flex; flex-direction: column; }

/* ─── MAP VIEW ───────────────────────────────────────────────── */
/* NOTE: position comes from .view (position: absolute; inset: 0).
   Do NOT add position: relative here — it would override the absolute
   fill and collapse the map to zero height. */
#map-view {
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  background: var(--surface);
  /* Leaflet z-index stacking fix */
  z-index: 0;
}

/* Leaflet dark tile filter */
.leaflet-tile { filter: brightness(0.85) saturate(0.8); }

/* ─── MAP TOP BAR ────────────────────────────────────────────── */
/* ─── MAP TOP BAR ────────────────────────────────────────────── */
#map-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  padding: 0 12px;
  padding-top: var(--safe-top);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(to bottom, rgba(13,17,23,0.85) 0%, transparent 100%);
  z-index: 400;
  pointer-events: none;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
  pointer-events: none;
}

#locate-btn,
.map-icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

#locate-btn:active,
.map-icon-btn:active { transform: scale(0.9); background: var(--surface-2); }

/* Zoom controls are top-right; push them below the topbar */
#map-view .leaflet-top.leaflet-right {
  top: calc(var(--topbar-height) + 8px);
}
/* Attribution — bottom-left, flush to nav bar */
#map-view .leaflet-bottom.leaflet-left {
  bottom: calc(var(--nav-height) + var(--safe-bottom));
}

/* ─── GPS BANNER ─────────────────────────────────────────────── */
#gps-banner {
  position: absolute;
  top: calc(var(--topbar-height) + 4px);
  left: 12px;
  right: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  z-index: 400;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

#gps-banner.error { border-color: var(--red); color: var(--red); }
#gps-banner.hidden { display: none; }

/* ─── NEAREST BRIDGE CARD ────────────────────────────────────── */
#nearest-card {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: rgba(22, 27, 34, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 400;
  animation: slide-up 0.3s ease;
}

#nearest-card.hidden { display: none; }

.nearest-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 12px;
}

.nearest-card-left { flex: 1; min-width: 0; }

.nearest-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--gold);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.nearest-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.nearest-dist {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.nearest-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.12s, opacity 0.12s, background 0.12s;
  white-space: nowrap;
  min-height: 44px;
}

.btn:active { transform: scale(0.96); }

.btn-gold {
  background: var(--gold);
  color: #0d1117;
}
.btn-gold:hover { background: #ffc030; }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-danger {
  background: transparent;
  color: #f85149;
  border: 1px solid #f85149;
}
.btn-danger:hover { background: rgba(248,81,73,0.12); }

.btn-sm { font-size: 12px; padding: 7px 12px; min-height: 36px; border-radius: 8px; }
.btn-lg { font-size: 16px; padding: 14px 20px; min-height: 52px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

.btn.hidden { display: none; }

.icon-btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 20px;
  box-shadow: var(--shadow-sm);
}

/* ─── 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);
  display: flex;
  background: rgba(22, 27, 34, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 500;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  transition: color 0.15s;
  padding: 8px 0;
  min-height: 44px;
}

.nav-btn.active { color: var(--gold); }

.nav-icon { font-size: 22px; line-height: 1; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ─── VIEW HEADER ────────────────────────────────────────────── */
.view-header {
  padding: 16px 16px 8px;
  padding-top: calc(16px + var(--safe-top));
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
  margin: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

/* ─── PROGRESS SECTION ───────────────────────────────────────── */
.progress-numbers {
  font-size: 15px;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1;
}

.progress-big {
  font-size: 32px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -1px;
}

.progress-sep, .progress-label {
  font-size: 16px;
  color: var(--text-muted);
  font-weight: 400;
}

.progress-bar-wrap {
  height: 10px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold) 0%, #ffd060 100%);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-transform: uppercase;
}

.stat-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ─── COLLECTION FILTER BAR ──────────────────────────────────── */
#collection-filter-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px 8px;
  position: sticky;
  top: 53px; /* below .view-header */
  z-index: 9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-pill {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.filter-pill.active {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.filter-pill:hover:not(.active) {
  background: var(--surface-3);
  color: var(--text);
}

.filter-clear-btn {
  margin-left: auto;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.filter-clear-btn:hover {
  background: rgba(248, 81, 73, 0.12);
}

.filter-selects-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.filter-selects-row::-webkit-scrollbar { display: none; }

.filter-select {
  flex-shrink: 0;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238b949e'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  max-width: 140px;
  transition: border-color 0.15s;
}

.filter-select:focus,
.filter-select:not([value=""]):valid {
  border-color: var(--gold);
}

/* Highlight selects that have a non-default value */
.filter-select.active-filter {
  border-color: var(--gold);
  background-color: rgba(255, 182, 18, 0.08);
}

.filter-count-text {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 2px;
  letter-spacing: 0.2px;
}

/* ─── BRIDGE LISTS ───────────────────────────────────────────── */
.list-section {
  padding: 0 12px 12px;
}

.list-heading {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 12px 4px 8px;
}

.bridge-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.bridge-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
  margin-bottom: 4px;
}

.bridge-list-item:active,
.bridge-list-item:hover { background: var(--surface-2); border-color: var(--border); }

.bridge-list-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bridge-list-icon.crossed { background: var(--gold-glow); }
.bridge-list-icon.uncrossed { background: var(--surface-3); }

.bridge-list-info { flex: 1; min-width: 0; }

.bridge-list-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bridge-list-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.bridge-list-chevron {
  color: var(--text-dim);
  font-size: 14px;
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 32px 20px;
  line-height: 1.6;
}

/* ─── SEARCH VIEW ────────────────────────────────────────────── */
.search-box-wrap {
  padding: 12px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px; /* prevents iOS zoom */
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--gold);
}

.search-input::placeholder { color: var(--text-dim); }

/* ─── BRIDGE MODAL ───────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px;
  padding-bottom: calc(20px + var(--safe-bottom));
  animation: sheet-up 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  margin: 0 auto 16px;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.modal-photo {
  width: 100%;
  height: 140px;
  background: var(--surface-2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  overflow: hidden;
}

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

.modal-photo-img.hidden { display: none; }

.modal-photo-icon { font-size: 56px; opacity: 0.5; }
.modal-photo.has-image .modal-photo-icon { display: none; }

.modal-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.modal-bridge-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  line-height: 1.2;
  flex: 1;
}

.modal-status-badge {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.modal-status-badge.crossed {
  background: var(--gold-glow);
  color: var(--gold);
}

.modal-status-badge.uncrossed {
  background: var(--surface-2);
  color: var(--text-muted);
}

.modal-checkin-date {
  font-size: 12px;
  color: var(--green);
  margin-bottom: 12px;
  font-weight: 500;
}

.modal-checkin-date.hidden { display: none; }

/* Details grid */
.modal-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.detail-full { grid-column: 1 / -1; }

.detail-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.detail-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.detail-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

/* Fun fact */
.fun-fact-card {
  background: linear-gradient(135deg, rgba(255,182,18,0.12) 0%, rgba(74,144,217,0.08) 100%);
  border: 1px solid rgba(255,182,18,0.2);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.fun-fact-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.fun-fact-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ─── CELEBRATION OVERLAY ────────────────────────────────────── */
#celebration {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 24px;
}

#celebration.hidden { display: none; }

.celebration-content {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255,182,18,0.3);
  box-shadow: 0 0 40px rgba(255,182,18,0.15), var(--shadow);
  animation: pop-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pop-in {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.celebration-emoji {
  font-size: 64px;
  display: block;
  margin-bottom: 12px;
  animation: wiggle 0.6s ease 0.3s;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25%       { transform: rotate(-10deg); }
  75%       { transform: rotate(10deg); }
}

.celebration-headline {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.celebration-sub {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.celebration-fact {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 20px;
  text-align: left;
  display: none;
}

.celebration-fact:not(:empty) { display: block; }

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

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
  to {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* ─── LEAFLET CUSTOM MARKERS ─────────────────────────────────── */
/* Remove the default white/black background Leaflet adds to div icons */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.bridge-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
  transition: transform 0.15s;
  cursor: pointer;
}

.bridge-marker-uncrossed {
  background: #5a6478;
  border-color: rgba(255,255,255,0.15);
}

.bridge-marker-crossed {
  background: var(--gold);
  border-color: rgba(0,0,0,0.25);
  box-shadow: 0 2px 8px rgba(255,182,18,0.5);
}

.bridge-marker-user {
  width: 18px;
  height: 18px;
  background: var(--blue);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(74,144,217,0.3), 0 2px 8px rgba(0,0,0,0.4);
}

/* ─── MARKER CLUSTER STYLES ─────────────────────────────────── */
.bridge-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.18);
  font-weight: 700;
  font-family: var(--font);
  box-shadow: 0 2px 8px rgba(0,0,0,0.45);
  cursor: pointer;
  transition: transform 0.12s;
}
.bridge-cluster:active { transform: scale(0.9); }
.bridge-cluster span { line-height: 1; }

.bridge-cluster-sm { width: 36px; height: 36px; font-size: 13px; }
.bridge-cluster-md { width: 44px; height: 44px; font-size: 15px; }
.bridge-cluster-lg { width: 52px; height: 52px; font-size: 17px; }

/* No bridges crossed yet — slate blue */
.bridge-cluster-none {
  background: #3d4558;
  color: #c8cfe0;
  border-color: rgba(255,255,255,0.12);
}
/* Some bridges crossed — teal accent */
.bridge-cluster-some {
  background: #1e5f78;
  color: #9de2f8;
  border-color: rgba(100,210,245,0.25);
  box-shadow: 0 2px 8px rgba(0,160,200,0.35);
}
/* All bridges in cluster crossed — gold */
.bridge-cluster-all {
  background: var(--gold);
  color: #1a1f2e;
  border-color: rgba(255,255,255,0.3);
  box-shadow: 0 2px 12px rgba(255,182,18,0.55);
}

/* Override markercluster's default background so only our styles show */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow { transition: left 0.3s ease-out, top 0.3s ease-out; }

/* Leaflet popup overrides */
.leaflet-popup-content-wrapper {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
  color: var(--text) !important;
  padding: 0 !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  padding: 14px 16px !important;
  min-width: 180px;
}

.leaflet-popup-tip { background: var(--surface) !important; }

.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 18px !important;
  top: 6px !important;
  right: 8px !important;
}

.popup-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  padding-right: 20px;
  line-height: 1.2;
}

.popup-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

.popup-crossed-badge {
  display: inline-block;
  background: var(--gold-glow);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.popup-actions {
  display: flex;
  gap: 6px;
}

/* ─── BADGES VIEW ────────────────────────────────────────────── */
.badges-summary {
  padding: 14px 16px 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.badges-earned-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold);
}

.badges-grid-wrap {
  padding: 0 12px 20px;
}

.badge-category {
  margin-top: 4px;
}

.badge-cat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 14px 2px 8px;
}

.badge-grid-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.badge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.badge-earned {
  border-color: rgba(255, 182, 18, 0.45);
  background: linear-gradient(145deg, var(--surface) 0%, rgba(255, 182, 18, 0.07) 100%);
}

.badge-locked {
  opacity: 0.6;
}

.badge-emoji {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 4px;
  display: block;
}

.badge-emoji-locked {
  filter: grayscale(0.8);
  opacity: 0.5;
}

.badge-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.badge-name-locked {
  color: var(--text-muted);
}

.badge-earned-date {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

.badge-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
  margin-top: 1px;
}

.badge-progress {
  width: 100%;
  margin-top: 6px;
}

.badge-progress-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 3px;
}

.badge-progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.badge-progress-text {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
}

/* ─── BADGE UNLOCK POPUP ─────────────────────────────────────── */
.badge-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.badge-popup-overlay.hidden { display: none; }

.badge-popup-card {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  text-align: center;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 0 48px rgba(255, 182, 18, 0.22);
  animation: badge-popup-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes badge-popup-in {
  from { opacity: 0; transform: scale(0.82) translateY(16px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.badge-popup-new-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}

.badge-popup-emoji {
  font-size: 68px;
  line-height: 1;
  display: block;
  margin: 0 auto 14px;
}

.badge-popup-name {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.2;
}

.badge-popup-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 22px;
  line-height: 1.5;
}

/* ─── BACKUP BUTTONS ─────────────────────────────────────────── */
.backup-row {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.btn-backup {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
}

.btn-backup:hover,
.btn-backup:active {
  background: var(--surface-3);
  border-color: var(--gold);
}

/* ─── IMPORT CONFIRM MODAL ───────────────────────────────────── */
.import-confirm-sheet {
  padding: 24px 20px;
  padding-bottom: calc(24px + var(--safe-bottom));
}

.import-confirm-body {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-muted);
  white-space: pre-line;
  margin: 12px 0 20px;
}

/* ─── ABOUT MODAL ────────────────────────────────────────────── */
.about-sheet {
  max-height: 92vh;
  padding: 20px 20px 32px;
  padding-bottom: calc(32px + var(--safe-bottom));
}

.about-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-right: 36px; /* clear the close button */
}

.about-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.about-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.about-section-heading {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}

.about-text {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.about-text:last-child { margin-bottom: 0; }

.about-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}

.about-list li {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  padding-left: 4px;
}

.about-list li strong {
  color: var(--text);
}

.about-link {
  color: var(--blue);
  text-decoration: underline;
  text-decoration-color: rgba(74, 144, 217, 0.4);
  text-underline-offset: 2px;
}

.about-link:hover { text-decoration-color: var(--blue); }

/* ─── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: 99px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 900;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
  animation: toast-in 0.25s ease;
  pointer-events: none;
}

.toast.toast-hide {
  animation: toast-out 0.35s ease forwards;
}

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

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

/* ─── ANIMATIONS & HELPERS ───────────────────────────────────── */
@keyframes slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fade-in { animation: fade-in 0.2s ease; }

/* ─── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 99px; }

/* ─── UTILITIES ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
