* {
  box-sizing: border-box;
}

/* ===== Guided Tour ===== */
#tour-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200000;
  pointer-events: none;
}
#tour-overlay.active { display: block; }

#tour-spotlight {
  position: fixed;
  border-radius: 10px;
  border: 3px solid #4CAF50;
  box-shadow: 0 0 0 4px rgba(76,175,80,0.35), 0 0 24px rgba(76,175,80,0.4);
  z-index: 200001;
  pointer-events: none;
  transition: all .35s ease;
  animation: tour-pulse 1.6s ease-in-out infinite;
}
@keyframes tour-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(76,175,80,0.35), 0 0 24px rgba(76,175,80,0.4); }
  50%      { box-shadow: 0 0 0 7px rgba(76,175,80,0.2), 0 0 36px rgba(76,175,80,0.5); }
}

#tour-tooltip {
  position: fixed;
  z-index: 200002;
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  padding: 20px 22px 16px;
  max-width: 340px;
  width: calc(100vw - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  pointer-events: auto;
}
#tour-step-counter {
  font-size: 11px;
  color: #999;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: .5px;
}
#tour-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: #111;
}
#tour-text {
  margin: 0 0 16px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #444;
}
.tour-btns {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.tour-btns button {
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
#tour-next {
  background: #2e7d32;
  color: #fff;
}
#tour-next:hover { background: #1b5e20; }
#tour-back {
  background: #e8e8e8;
  color: #333;
}
#tour-back:hover { background: #ddd; }
#tour-skip {
  background: transparent;
  color: #999;
  padding: 8px 10px;
}
#tour-skip:hover { color: #555; }

/* ===== Map Instruction Toast ===== */
#map-instruction {
  display: none;
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(46, 125, 50, 0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 28px;
  font-size: 14px;
  font-weight: 600;
  z-index: 900;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: toast-pulse 2s ease-in-out infinite;
  white-space: nowrap;
}
#map-instruction.visible {
  display: block;
}
@keyframes toast-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ===== Ad Overlay ===== */
#ad-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}
#ad-overlay.hidden { display: none; }

#ad-close-btn {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100000;
  background: rgba(0,0,0,0.5);
  color: #fff;
  border: none;
  font-size: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
#ad-close-btn.visible { display: flex; align-items: center; justify-content: center; }

#ad-container {
  width: 80%;
  height: 80%;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
}

.ad-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.ad-video.active {
  opacity: 1;
  pointer-events: auto;
}

#ad-dots {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 100000;
}
.ad-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
}
.ad-dot.active { background: #fff; }

html {
  touch-action: manipulation;
}

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
  background: #f8f9fa;
  --primary-blue: #333333;
  --secondary-blue: #555555;
  --light-bg: #f8f9fa;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
}

#map {
  height: 100vh;
  width: 100%;
}

/* Google Maps info window tweaks */
.gm-style .gm-style-iw-c {
  padding: 0 !important;
  border-radius: 12px;
  overflow: visible;
  width: 240px !important;
  max-width: 240px !important;
}

.gm-style .gm-style-iw-d {
  padding: 0 !important;
  overflow: hidden !important;
  width: 240px !important;
  max-width: 240px !important;
}

.gm-style .gm-style-iw {
  padding: 0 !important;
}

.gm-style .gm-style-iw-chr {
  padding: 0 !important;
  position: relative;
  width: 100%;
  justify-content: flex-end;
  height: 0;
  background: transparent;
  pointer-events: none;
}

.gm-style .gm-style-iw-ch {
  padding-top: 0 !important;
  display: none;
}

.gm-style .gm-style-iw-d > div {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
}

.gm-style .marker-iw {
  width: 100% !important;
  margin: 0;
  padding: 0;
}

.gm-style .gm-ui-hover-effect {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  z-index: 2;
  pointer-events: auto;
}

.gm-style .gm-ui-hover-effect span {
  margin: 6px;
}

/* Header Controls - Modern Unified Top Bar */
.header-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
  pointer-events: auto;
  gap: 16px;
}

.title-bar h1 {
  background: #000000;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

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

.header-btn {
  background: white;
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn:hover {
  background: var(--light-bg);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

/* Header avatar button (sign-in / profile pic) */
.header-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.header-avatar-btn:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(33,150,243,0.15);
}
.header-avatar-btn svg {
  color: #666;
}
.header-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  border-radius: 50%;
}

/* Unread badge on header icons */
.header-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #d32f2f;
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

/* Account sheet menu */
.account-user-info {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 8px;
}
.account-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.account-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  color: white;
  border-radius: 50%;
}
.account-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.account-nickname {
  font-size: 16px;
  font-weight: 600;
  color: white;
}
.account-email {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}
.account-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 8px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s;
  text-align: left;
  width: 100%;
}
.account-menu-item:hover {
  background: rgba(255,255,255,0.06);
}
.account-menu-item svg {
  color: rgba(255,255,255,0.5);
  flex-shrink: 0;
}
.account-menu-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 8px;
}
.account-menu-signout {
  color: rgba(239,68,68,0.85);
}
.account-menu-signout svg {
  color: rgba(239,68,68,0.6);
}

.legend-toggle {
  background: white;
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.legend-toggle:hover {
  background: var(--light-bg);
  border-color: var(--primary-blue);
}

.legend-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
}

/* Tracking Stats Widget - Modern Bottom Bar */
.tracking-stats-widget {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  z-index: 900;
  padding: 12px 16px;
  pointer-events: auto;
}

.tracking-stats-widget.hidden {
  display: none !important;
}

.stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.stats-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.stats-close-btn:hover {
  color: var(--text-primary);
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin: 0;
}

.stat-item {
  text-align: center;
  padding: 8px 12px;
  background: transparent;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.stat-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 2px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

/* Legend Panel - Refined Sidebar */
.legend-panel {
  position: fixed;
  top: 60px;
  left: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  width: 320px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  z-index: 50;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.legend-panel::-webkit-scrollbar {
  width: 6px;
}

.legend-panel::-webkit-scrollbar-track {
  background: transparent;
}

.legend-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.legend-panel::-webkit-scrollbar-thumb:hover {
  background: #d1d5db;
}

.legend-panel.hidden {
  display: none;
}

.legend-panel h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 18px 0;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.legend-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.legend-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.legend-section h3 {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-secondary);
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.legend-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toggle-btn {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  text-align: left;
  white-space: nowrap;
}

.toggle-btn:hover {
  background: var(--light-bg);
  border-color: var(--border-color);
}

.toggle-btn.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(30, 64, 175, 0.05));
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  font-weight: 600;
}

.toggle-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-secondary);
}

/* Swatches */
.swatch {
  width: 16px;
  height: 10px;
  display: inline-block;
  margin-right: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.swatch-easy {
  background: #10b981;
}

.swatch-intermediate {
  background: #3b82f6;
}

.swatch-advanced {
  background: #1f2937;
}

.swatch-lift {
  width: 16px;
  height: 2px;
  background: #ef4444;
}

.label-swatch {
  width: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* Legend Footer */
.legend-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.legend-footer p {
  font-size: 9px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
  letter-spacing: 0.5px;
}

/* Conditions & Weather Modal Interior */
.cw-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
  border-radius: 10px;
  margin-bottom: 16px;
}
.cw-hero-emoji { font-size: 36px; line-height: 1; }
.cw-hero-info { display: flex; flex-direction: column; }
.cw-hero-temp {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.cw-hero-desc {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

.cw-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.cw-grid-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 10px 12px;
}
.cw-grid-label {
  font-size: 11px;
  color: #888;
  font-weight: 500;
}
.cw-grid-value {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  text-transform: capitalize;
}

.cw-section {
  padding: 12px 0 4px 0;
  border-top: 1px solid #e0e0e0;
}
.cw-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
}
.cw-report-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cw-stars {
  color: #fbbf24;
  font-size: 16px;
  letter-spacing: 1px;
}
.cw-report-count {
  font-size: 12px;
  color: #999;
}

/* View Runs Modal Interior */
.vrm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  max-height: 240px;
  overflow-y: auto;
}
.vrm-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f5f5f5;
  border-radius: 8px;
  font-size: 13px;
}
.vrm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.vrm-name {
  flex: 1;
  font-weight: 600;
  color: #333;
}
.vrm-dist {
  font-size: 11px;
  color: #888;
  font-weight: 500;
}
.vrm-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}
.vrm-delete:hover {
  color: #e53935;
}

.vrm-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.vrm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: #f5f5f5;
  border-radius: 8px;
  padding: 10px 8px;
}
.vrm-stat-value {
  font-size: 16px;
  font-weight: 700;
  color: #333;
}
.vrm-stat-label {
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ===== Bottom Sheet System ===== */
.bottom-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 999;
  transition: opacity 0.3s ease;
  opacity: 0;
}

.bottom-sheet-backdrop.visible {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(22, 22, 22, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px 16px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
}

.bottom-sheet.open-half {
  transform: translateY(0);
  height: 85vh;
  max-height: 85vh;
}

.bottom-sheet.open-full {
  transform: translateY(0);
  height: 85vh;
  max-height: 85vh;
}

#trail-detail-sheet.open-half,
#trail-detail-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#tracking-setup-sheet.open-half,
#tracking-setup-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#post-run-sheet.open-half,
#post-run-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#live-tracking-sheet.open-half,
#live-tracking-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 20px;
}

#view-runs-sheet.open-half,
#view-runs-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#legend-sheet.open-half,
#legend-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#profile-sheet.open-half,
#profile-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#marker-sheet.open-half,
#marker-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#account-sheet.open-half,
#account-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#conditions-sheet.open-half,
#conditions-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#conditions-report-sheet.open-half,
#conditions-report-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

#auth-sheet.open-half,
#auth-sheet.open-full {
  height: auto;
  max-height: 85vh;
  padding-bottom: 40px;
}

.live-tracking-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.live-track-cell {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px 8px;
  text-align: center;
}

.live-track-value {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.live-track-label {
  font-size: 9px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.live-stop-cell {
  background: rgba(239,68,68,0.25);
  border-color: rgba(239,68,68,0.5);
  cursor: pointer;
}
.live-stop-cell:hover {
  background: rgba(239,68,68,0.45);
}
.live-stop-cell .live-track-value {
  color: #ef4444;
}
.live-stop-cell .live-track-label {
  color: #ef4444;
}

.btn-start-tracking {
  width: 100%;
  padding: 32px;
  font-size: 18px;
  font-weight: 700;
  border-radius: 12px;
  background: #ff6d00;
  color: #fff;
  border: none;
  cursor: pointer;
  letter-spacing: 0.5px;
  animation: strobe-glow 1.5s ease-in-out infinite;
}
.btn-start-tracking:hover {
  background: #e65100;
}

@keyframes strobe-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(255,109,0,0.4); }
  50% { box-shadow: 0 0 24px rgba(255,109,0,0.9), 0 0 48px rgba(255,109,0,0.4); }
}

.bottom-sheet-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 6px;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}

.bottom-sheet-handle::after {
  content: '';
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 12px;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.bottom-sheet-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.sheet-close-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: rgba(255, 255, 255, 0.6);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sheet-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.bottom-sheet-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.bottom-sheet-content::-webkit-scrollbar {
  width: 4px;
}

.bottom-sheet-content::-webkit-scrollbar-track {
  background: transparent;
}

.bottom-sheet-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

/* Dark theme form elements inside sheets */
.bottom-sheet label {
  display: block;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.bottom-sheet input[type="text"],
.bottom-sheet input[type="email"],
.bottom-sheet input[type="password"],
.bottom-sheet select,
.bottom-sheet textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.bottom-sheet input:focus,
.bottom-sheet select:focus,
.bottom-sheet textarea:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
}

.bottom-sheet select {
  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='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.bottom-sheet select option {
  background: #222;
  color: #fff;
}

.bottom-sheet textarea {
  resize: vertical;
  min-height: 80px;
}

.bottom-sheet .btn-primary {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
  width: 100%;
}

.bottom-sheet .btn-primary:hover {
  background: rgba(255, 255, 255, 0.22);
  box-shadow: none;
  transform: none;
}

.bottom-sheet .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.bottom-sheet .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Sheet stat cards */
.sheet-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.sheet-stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
}

.sheet-stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sheet-stat-card .stat-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.sheet-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sheet-stat-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Dark theme toggle buttons in sheets */
.bottom-sheet .toggle-btn {
  color: rgba(255, 255, 255, 0.8);
  border-color: transparent;
}

.bottom-sheet .toggle-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.bottom-sheet .toggle-btn.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Dark legend section borders */
.bottom-sheet .legend-section {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .legend-section h3 {
  color: rgba(255, 255, 255, 0.4);
}

.bottom-sheet .legend-panel h2 {
  color: #fff;
}

.bottom-sheet .legend-footer p {
  color: rgba(255, 255, 255, 0.3);
}

.bottom-sheet .legend-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* Dark theme tabs in sheets */
.bottom-sheet .profile-tabs,
.bottom-sheet .marker-tabs {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  margin-bottom: 20px;
}

.bottom-sheet .profile-tab-btn,
.bottom-sheet .tab-btn {
  color: rgba(255, 255, 255, 0.45);
  border-bottom-color: transparent;
}

.bottom-sheet .profile-tab-btn.active,
.bottom-sheet .tab-btn.active {
  color: #fff;
  border-bottom-color: #fff;
}

.bottom-sheet .profile-tab-btn:hover,
.bottom-sheet .tab-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.05);
}

/* Dark theme profile elements */
.bottom-sheet .profile-section label {
  color: rgba(255, 255, 255, 0.5);
}

.bottom-sheet .profile-pic-container img {
  border-color: rgba(255, 255, 255, 0.2);
}

.bottom-sheet .profile-form label {
  color: rgba(255, 255, 255, 0.6);
}

.bottom-sheet .markers-section {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .markers-section h3 {
  color: #fff;
}

.bottom-sheet .marker-item {
  background: rgba(255, 255, 255, 0.04);
}

.bottom-sheet .marker-info strong {
  color: #fff;
}

.bottom-sheet .marker-info small {
  color: rgba(255, 255, 255, 0.4);
}

.bottom-sheet .marker-actions button {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}

/* Dark theme marker form */
.bottom-sheet .marker-coords {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
}

.bottom-sheet .marker-form label {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 0;
}

.bottom-sheet .marker-form input,
.bottom-sheet .marker-form textarea,
.bottom-sheet .marker-form select {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.bottom-sheet .marker-form input::placeholder,
.bottom-sheet .marker-form textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.bottom-sheet .marker-form input:focus,
.bottom-sheet .marker-form textarea:focus,
.bottom-sheet .marker-form select:focus {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05);
}

.bottom-sheet .marker-form select option {
  background: #1a1a1a;
  color: #fff;
}

/* Dark theme tracking elements */
.bottom-sheet .tracking-filter {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .tracking-sessions-list {
  color: rgba(255, 255, 255, 0.6);
}

.bottom-sheet .tracking-session-item {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .session-name {
  color: #fff;
}

.bottom-sheet .session-stats {
  color: rgba(255, 255, 255, 0.4);
}

/* Dark tracking stat cards */
.bottom-sheet .tracking-stats-grid .stat-card {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .tracking-stats-grid .stat-value {
  color: #fff;
}

.bottom-sheet .tracking-stats-grid .stat-label {
  color: rgba(255, 255, 255, 0.4);
}

/* Auth form in dark sheet */
.bottom-sheet .auth-form input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.bottom-sheet .auth-form input:focus {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.bottom-sheet .auth-submit-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.bottom-sheet .auth-submit-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.bottom-sheet .google-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.bottom-sheet .google-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.bottom-sheet .auth-divider {
  color: rgba(255, 255, 255, 0.3);
}

.bottom-sheet .auth-switch {
  color: rgba(255, 255, 255, 0.5);
}

.bottom-sheet .auth-switch a {
  color: #fff;
}

.bottom-sheet h2 {
  color: #fff;
}

/* Live tracking sheet special styling */
.bottom-sheet .live-indicator {
  color: #ff4444;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bottom-sheet .live-timer {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  font-family: 'Courier New', monospace;
}

.bottom-sheet .btn-stop-tracking {
  width: 100%;
  padding: 14px;
  background: rgba(211, 47, 47, 0.8);
  color: white;
  border: 1px solid rgba(211, 47, 47, 0.5);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.bottom-sheet .btn-stop-tracking:hover {
  background: rgba(211, 47, 47, 1);
}

/* Conditions interior in sheet */
.bottom-sheet .cw-hero {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

.bottom-sheet .cw-hero-temp { color: #fff; }
.bottom-sheet .cw-hero-desc { color: rgba(255, 255, 255, 0.6); }

.bottom-sheet .cw-grid-item {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .cw-grid-label { color: rgba(255, 255, 255, 0.5); }
.bottom-sheet .cw-grid-value { color: #fff; }

.bottom-sheet .cw-section-title { color: rgba(255, 255, 255, 0.5); }
.bottom-sheet .cw-stars { color: #ffd700; }
.bottom-sheet .cw-report-count { color: rgba(255, 255, 255, 0.4); }

/* Conditions report form in sheet */
.bottom-sheet .rating-selector {
  gap: 6px;
}

.bottom-sheet .rating-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
}

.bottom-sheet .rating-btn.active {
  background: rgba(255, 215, 0, 0.15);
  border-color: rgba(255, 215, 0, 0.3);
  color: #ffd700;
}

/* View runs in sheet */
.bottom-sheet .vrm-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.bottom-sheet .vrm-name { color: #222; }
.bottom-sheet .vrm-dist { color: #666; }

.bottom-sheet .vrm-stat {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .vrm-stat-value { color: #222; }
.bottom-sheet .vrm-stat-label { color: #666; }

/* Trail list in dark sheet */
.bottom-sheet .trail-list-empty {
  color: rgba(255, 255, 255, 0.35);
}

.bottom-sheet .trail-list-item {
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

.bottom-sheet .trail-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.bottom-sheet .trail-list-item.active {
  background: rgba(255, 255, 255, 0.08);
}

.bottom-sheet .tli-name { color: #fff; }
.bottom-sheet .tli-meta span { color: rgba(255, 255, 255, 0.35); }

/* Upload thumbs in dark sheet */
.bottom-sheet .thumb-item {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

/* Image carousel in dark sheet */
.bottom-sheet .image-carousel {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

/* Loading Overlay - Modern */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(248, 249, 250, 0.95), rgba(245, 246, 247, 0.95));
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}

.loading-overlay h2 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 8px 0;
  color: var(--text-primary);
}

.loading-text {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
  animation: pulse 2s ease-in-out infinite;
}

.loading-subtext {
  font-size: 9px;
  color: var(--text-secondary);
  font-family: 'Monaco', 'Courier New', monospace;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Scrollbar styling */
.legend-panel::-webkit-scrollbar {
  width: 6px;
}

.legend-panel::-webkit-scrollbar-track {
  background: #f5f5f5;
  border-radius: 3px;
}

.legend-panel::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.legend-panel::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Auth Modal */
.auth-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.auth-modal-content {
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.auth-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 28px;
  color: #666;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-close:hover {
  color: #000;
}

.auth-modal h2 {
  margin: 0 0 24px 0;
  font-size: 24px;
  text-align: center;
  color: #000;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #000;
}

.auth-form input:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.auth-submit-btn {
  padding: 12px;
  background: #2e7d32;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.auth-submit-btn:hover {
  background: #262626;
}

.google-btn {
  padding: 12px;
  background: white;
  color: #000;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.google-btn:hover {
  background: #f8f8f8;
}

.auth-divider {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin: 8px 0;
}

.auth-switch {
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-top: 12px;
}

.auth-switch a {
  color: #333333;
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Header Auth & User Profile */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #000;
  transition: all 0.2s;
}

.auth-btn:hover {
  background: #f8f8f8;
  border-color: #999;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  background: white;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ddd;
}

.profile-open-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.profile-open-btn:hover {
  background: #f0f0f0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #333333;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

.user-email {
  font-size: 11px;
  color: #666;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signout-btn {
  padding: 4px 8px;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s;
}

.signout-btn:hover {
  background: #f8f8f8;
  color: #000;
}
/* Profile & Marker Modals */
.profile-modal,
.marker-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(5px);
}

.profile-modal.show,
.marker-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  max-width: 520px;
  width: 95%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  margin: 0 0 24px 0;
  font-size: 20px;
  font-weight: 700;
  color: #333;
  letter-spacing: -0.3px;
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .modal-content {
    padding: 20px;
    width: 98%;
    max-height: 90vh;
    border-radius: 8px;
  }
  
  .modal-content h2 {
    font-size: 18px;
    margin-bottom: 20px;
  }
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #888;
  background: none;
  border: none;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #000;
}

.profile-section {
  margin-bottom: 30px;
}

.profile-section label {
  display: block;
  font-weight: 600;
  color: #333;
  font-size: 13px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.profile-section input[type="text"],
.profile-section select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  background: #f8f9fa;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.profile-section select {
  background: #f8f9fa 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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
  padding-right: 32px;
}

.profile-section input[type="text"]:focus,
.profile-section select:focus {
  outline: none;
  border-color: var(--primary-blue);
  background: #fff;
}

.profile-pic-container {
  text-align: center;
  margin-bottom: 20px;
}

.profile-pic-container img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #333333;
  margin-bottom: 15px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.profile-form label {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.profile-form input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #000;
}

.markers-section {
  border-top: 1px solid #eee;
  padding-top: 20px;
}

.markers-section h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 16px;
}

.markers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.marker-item {
  padding: 10px;
  border-left: 4px solid;
  border-radius: 4px;
  background-color: #f9f9f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.marker-item.favorite { border-color: #555555; }
.marker-item.location { border-color: #333333; }
.marker-item.hazard { border-color: #444444; }
.marker-item.note { border-color: #555555; }

.marker-info {
  flex: 1;
}

.marker-info strong {
  display: block;
  color: #333;
  font-size: 14px;
}

.marker-info small {
  color: #888;
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

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

.marker-actions button {
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background-color: #ddd;
  color: #333;
  transition: background-color 0.2s;
}

.marker-actions button:hover {
  background-color: #bbb;
}

/* Marker Modal */
.marker-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.marker-form label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 14px;
  margin-bottom: 0;
  display: block;
}

.marker-form label:first-child {
  margin-top: 0;
}

.marker-form input,
.marker-form textarea,
.marker-form select {
  padding: 12px 14px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  width: 100%;
  color: #000;
}

.marker-form input:focus,
.marker-form textarea:focus,
.marker-form select:focus {
  outline: none;
  border-color: #333333;
  background: white;
  box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.marker-form textarea {
  resize: vertical;
  min-height: 100px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

@media (max-width: 480px) {
  .marker-form {
    gap: 18px;
  }
  
  .marker-form input,
  .marker-form textarea,
  .marker-form select {
    padding: 11px 12px;
    font-size: 16px;
  }
}

.marker-coords {
  padding: 14px 16px;
  background-color: rgba(51, 51, 51, 0.05);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  text-align: center;
  color: #666;
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary,
.btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(51, 51, 51, 0.2);
  min-height: auto;
  width: auto;
  text-transform: none;
  letter-spacing: normal;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1f1f1f, #3d3d3d);
  box-shadow: 0 4px 12px rgba(51, 51, 51, 0.3);
  transform: translateY(-1px);
}

/* Inline uploaded thumbnails */
.upload-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumb-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  background: #fafafa;
}

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

.thumb-check {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: #333333;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb-delete {
  position: absolute;
  right: 4px;
  top: 4px;
  background: #555555;
  color: white;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.thumb-progress {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #666;
}

.btn-primary:active {
  background-color: #0d3d1c;
  transform: scale(0.98);
}

.btn-secondary {
  background-color: #e0e0e0;
  color: #333;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: all 0.3s ease;
  width: 100%;
  min-height: 44px;
}

.btn-secondary:hover {
  background-color: #bdbdbd;
}

@media (max-width: 480px) {
  .btn-primary,
  .btn-secondary {
    padding: 10px 16px;
    font-size: 13px;
    min-height: 40px;
  }
}

/* Marker Tab Navigation */
.marker-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Equal width tab buttons */
.marker-tabs .tab-btn {
  flex: 1 1 0;
}

.tab-btn.active {
  color: #333333;
  border-bottom-color: #333333;
}

.tab-btn:hover {
  color: #333333;
  background: rgba(51, 51, 51, 0.05);
}

/* Hide inactive tabs */
.marker-form {
  display: none;
}

.marker-form.active-tab {
  display: block;
}

/* Disable form when waiting for location */
.marker-modal[data-waiting-for-location="true"] .marker-form input,
.marker-modal[data-waiting-for-location="true"] .marker-form textarea,
.marker-modal[data-waiting-for-location="true"] .marker-form select,
.marker-modal[data-waiting-for-location="true"] .btn-primary {
  opacity: 0.5;
  pointer-events: none;
  cursor: not-allowed;
}

.marker-modal[data-waiting-for-location="true"] .marker-coords {
  background-color: rgba(51, 51, 51, 0.15);
  border: 2px solid #333333;
  font-weight: 600;
  color: #333333;
  animation: pulse-coords 1.5s ease-in-out infinite;
}

@keyframes pulse-coords {
  0%, 100% { box-shadow: 0 0 0 0 rgba(51, 51, 51, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(51, 51, 51, 0); }
}

/* Floating Add Marker Button */
.floating-add-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #333333;
  color: white;
  border: none;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 90;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-add-btn:hover {
  background-color: #1f1f1f;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transform: translateX(-50%) scale(1.1);
}

.floating-add-btn:active {
  transform: translateX(-50%) scale(0.95);
}

/* Pulsing state when waiting for location */
#marker-modal[data-waiting-for-location="true"] ~ .floating-add-btn {
  animation: pulse-btn 1.5s ease-in-out infinite;
  background-color: #333333;
}

@keyframes pulse-btn {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(51, 51, 51, 0.7);
  }
  50% {
    box-shadow: 0 0 0 15px rgba(51, 51, 51, 0);
  }
}

/* FAB Container and Menu */
.fab-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fab-menu {
  display: none;
  flex-direction: row;
  gap: 16px;
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fab-menu.show {
  display: flex;
  opacity: 1;
  transform: translateY(-72px);
}

.fab-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.fab-menu-item:hover {
  background: rgba(51, 51, 51, 0.9);
  transform: scale(1.05);
}

.fab-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.fab-label {
  font-size: 14px;
  font-weight: 500;
  flex-shrink: 0;
}

.floating-add-btn.menu-open {
  transform: translateX(-50%) rotate(45deg);
  background-color: #555555;
}

.floating-add-btn.menu-open:hover {
  background-color: #424242;
}

/* Mobile Responsive FAB Menu */
@media (max-width: 768px) {
  .fab-menu {
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    display: flex;
  }

  .fab-menu.show {
    display: flex;
    opacity: 1;
    transform: translateY(-340px);
  }

  .fab-menu-item {
    padding: 12px 16px;
    font-size: 14px;
    gap: 8px;
    width: calc(100vw - 40px);
    max-width: 300px;
    white-space: normal;
    justify-content: center;
    text-align: center;
  }

  .fab-menu-item:hover {
    transform: scale(1);
  }

  .fab-icon {
    font-size: 18px;
  }

  .fab-label {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .fab-menu.show {
    transform: translateY(-320px);
  }

  .fab-menu-item {
    padding: 11px 14px;
    font-size: 13px;
    gap: 8px;
    width: calc(100vw - 32px);
    max-width: 280px;
    min-height: 44px;
    justify-content: center;
    white-space: normal;
    text-align: center;
  }

  .fab-menu-item:hover {
    transform: scale(1);
  }

  .fab-icon {
    font-size: 16px;
  }

  .fab-label {
    font-size: 12px;
  }
}

/* Runs overlay on map */
.runs-legend {
  position: fixed;
  top: 80px;
  right: 20px;
  background: rgba(30, 30, 30, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  z-index: 85;
  backdrop-filter: blur(10px);
  min-width: 200px;
  max-width: 280px;
}

.runs-legend h3 {
  margin: 0 0 12px 0;
  color: #cccccc;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.runs-legend .close-runs {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 20px;
  padding: 0;
  line-height: 1;
}

.runs-legend .close-runs:hover {
  color: white;
}

.runs-legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: #ccc;
}

.runs-legend-item:last-child {
  border-bottom: none;
}

.runs-legend-color {
  width: 20px;
  height: 4px;
  border-radius: 2px;
}

.runs-legend-stats {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
  color: #888;
}

.runs-legend-stats div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.runs-legend-stats span:last-child {
  color: #cccccc;
  font-weight: 500;
}

.no-runs-message {
  color: #888;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

@media (max-width: 768px) {
  .modal-content {
    padding: 20px;
    width: 96%;
    max-width: 100%;
    margin: 12px;
  }

  .modal-content h2 {
    font-size: 20px;
    margin-bottom: 18px;
  }

  .marker-form {
    gap: 18px;
  }

  .marker-form label {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .marker-form input,
  .marker-form textarea,
  .marker-form select {
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 8px;
  }

  .marker-tabs {
    margin-bottom: 18px;
    gap: 0;
  }

  .tab-btn {
    padding: 10px 16px;
    font-size: 12px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 11px 20px;
    font-size: 13px;
    min-height: 40px;
  }

  .close-btn {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .floating-add-btn {
    width: 56px;
    height: 56px;
    bottom: 24px;
    font-size: 28px;
  }
}

/* Image Carousel Styles */
.image-carousel {
  margin-top: 20px;
  border-radius: 12px;
  overflow: hidden;
  background: #f5f5f5;
}

.carousel-container {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: #f0f0f0;
  touch-action: pan-y;
  user-select: none;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease-out;
  transform: translateX(0);
}

.carousel-slide {
  flex: 0 0 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.carousel-slide img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  display: block;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 12px;
  background: white;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.carousel-dot.active {
  width: 24px;
  border-radius: 4px;
  background: #333333;
}

.carousel-dot:hover {
  background: #999;
}

@media (max-width: 480px) {
  .modal-content {
    padding: 18px;
    width: 94%;
    margin: 8px;
  }

  .modal-content h2 {
    font-size: 18px;
    margin-bottom: 16px;
  }

  .marker-form {
    gap: 14px;
  }

  .marker-form label {
    font-size: 9px;
    margin-bottom: 5px;
  }

  .marker-form input,
  .marker-form textarea,
  .marker-form select {
    padding: 9px 11px;
    font-size: 16px;
    min-height: 42px;
  }

  .marker-coords {
    min-height: 40px;
    padding: 12px 14px;
    font-size: 12px;
  }

  .marker-tabs {
    gap: 0;
    margin-bottom: 14px;
  }

  .tab-btn {
    padding: 9px 14px;
    font-size: 11px;
    flex: 1;
  }

  .btn-primary,
  .btn-secondary {
    padding: 10px 16px;
    font-size: 12px;
    min-height: 40px;
  }

  .close-btn {
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .floating-add-btn {
    width: 54px;
    height: 54px;
    bottom: 20px;
    font-size: 26px;
  }
}

/* Profile Tabs */
.profile-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #e0e0e0;
}

.profile-tab-btn {
  flex: 1;
  padding: 12px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: -2px;
}

.profile-tab-btn:hover {
  color: #333;
  background: #f5f5f5;
}

.profile-tab-btn.active {
  color: #333333;
  border-bottom-color: #333333;
}

.profile-tab-content {
  display: none;
}

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

/* Tracking Stats Grid */
.tracking-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: linear-gradient(135deg, #333333 0%, #1f1f1f 100%);
  color: white;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(51, 51, 51, 0.2);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 11px;
  opacity: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tracking Filter */
.tracking-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tracking-filter select {
  flex: 1;
  min-width: 120px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: white;
}

.tracking-filter select:focus {
  outline: none;
  border-color: #333333;
  box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

/* Tracking Sessions List */
.tracking-sessions-list {
  max-height: 400px;
  overflow-y: auto;
}

.tracking-day-section {
  margin-bottom: 16px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.tracking-day-header {
  padding: 16px;
  background: #f9f9f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.2s ease;
}

.tracking-day-header:hover {
  background: #f0f0f0;
}

.tracking-day-header h3 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
  color: #333;
}

.tracking-day-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  font-size: 12px;
  color: #666;
}

.tracking-day-stats span {
  white-space: nowrap;
}

.toggle-icon {
  margin-left: auto;
  font-size: 14px;
  color: #999;
  transition: transform 0.2s ease;
}

.tracking-day-sessions {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.tracking-day-sessions.expanded {
  max-height: 2000px;
}

.tracking-session-item {
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  transition: background 0.2s ease;
}

.tracking-session-item:hover {
  background: #fafafa;
}

.tracking-session-item.run {
  border-left: 3px solid #333333;
}

.tracking-session-item.lift {
  border-left: 3px solid #555555;
}

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

.session-icon {
  font-size: 18px;
}

.session-name {
  font-weight: 600;
  color: #333;
  font-size: 14px;
}

.difficulty-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.difficulty-badge.easy {
  background: #e8e8e8;
  color: #333333;
}

.difficulty-badge.intermediate {
  background: #d3d3d3;
  color: #333333;
}

.difficulty-badge.advanced {
  background: #bababa;
  color: #ffffff;
}

.session-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #666;
  margin-bottom: 8px;
}

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

.btn-replay,
.btn-share {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-replay:hover {
  background: #333333;
  color: white;
  border-color: #333333;
}

.btn-share:hover {
  background: #555555;
  color: white;
  border-color: #555555;
}

/* GPS Tracking Active State */
#start-tracking-btn.tracking-active {
  background: #555555;
  animation: pulse-tracking 2s ease-in-out infinite;
}

@keyframes pulse-tracking {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Responsive adjustments for tracking */
@media (max-width: 768px) {
  .tracking-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tracking-filter {
    flex-direction: column;
  }
  
  .tracking-filter select,
  .tracking-filter button {
    width: 100%;
  }
  
  .tracking-day-stats {
    font-size: 11px;
    gap: 8px;
  }
  
  .session-stats {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .stat-card .stat-value {
    font-size: 22px;
  }
  
  .stat-card .stat-label {
    font-size: 10px;
  }
  
  .profile-tab-btn {
    font-size: 12px;
    padding: 10px 12px;
  }
}

/* Live Tracking Overlay */
.live-tracking-overlay {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 20px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 900;
  border: 2px solid #333333;
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.live-tracking-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.live-indicator {
  color: #ff4444;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.live-timer {
  color: white;
  font-size: 20px;
  font-weight: 900;
  font-family: 'Courier New', monospace;
}

.live-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

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

.live-stat-value {
  color: white;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.live-stat-label {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.btn-stop-tracking {
  width: 100%;
  padding: 12px;
  background: #555555;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-stop-tracking:hover {
  background: #3d3d3d;
  transform: scale(1.02);
}

.btn-stop-tracking:active {
  transform: scale(0.98);
}

/* Tracking Stats Grid in Post-Run Modal */
.tracking-stats-grid .stat-card {
  background: #f5f5f5;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.tracking-stats-grid .stat-value {
  font-size: 28px;
  font-weight: 900;
  color: #333333;
  margin-bottom: 4px;
}

.tracking-stats-grid .stat-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive adjustments for live overlay */
@media (max-width: 768px) {
  .live-tracking-overlay {
    right: 10px;
    top: 10px;
    min-width: 200px;
    padding: 16px;
  }
  
  .live-timer {
    font-size: 18px;
  }
  
  .live-stat-value {
    font-size: 16px;
  }
  
  .live-stats-grid {
    gap: 8px;
  }
}

/* Rating Selector */
.rating-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.rating-btn {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-btn:hover {
  border-color: #999999;
  background: #f0f0f0;
}

.rating-btn.active {
  border-color: #999999;
  background: #f0f0f0;
  box-shadow: 0 2px 8px rgba(153, 153, 153, 0.2);
}

/* Enhanced Stats in Widget */
.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}

.stats-row:last-child {
  margin-bottom: 0;
}

/* Season Comparison Styles */
.season-comparison {
  margin-top: 24px;
  padding: 16px;
  background: #f5f5f5;
  border-radius: 8px;
}

.season-header {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #333;
}

.season-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e0e0e0;
}

.season-row:last-child {
  border-bottom: none;
}

.season-year {
  font-weight: 600;
  color: #666;
}

.season-stats {
  display: flex;
  gap: 16px;
  font-size: 12px;
}

.season-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.season-stat-value {
  font-weight: 700;
  color: #333333;
}

.season-stat-label {
  font-size: 10px;
  color: #999;
  text-transform: uppercase;
}

/* ===== Chat Feature ===== */
.chat-toggle-btn {
  position: fixed;
  bottom: 90px;
  left: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #000;
  color: white;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.chat-toggle-btn:hover { transform: scale(1.1); }

.chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #d32f2f;
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.chat-panel {
  position: fixed;
  bottom: 148px;
  left: 16px;
  width: 320px;
  max-height: 420px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: #000;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.chat-online-badge {
  background: #2e7d32;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
}

.chat-close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}

.chat-messages {
  overflow-y: auto;
  padding: 10px 12px 60px;
  flex: 1;
  min-height: 0;
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-msg {
  position: relative;
  padding: 8px 12px;
  border-radius: 18px;
  max-width: 80%;
  font-size: 14px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.4);
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 11px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  padding: 0;
  line-height: 1;
}

.chat-msg:hover .chat-delete-btn,
.chat-msg:active .chat-delete-btn {
  opacity: 1;
}

.chat-delete-btn:hover {
  background: rgba(255,59,48,0.8);
  color: #fff;
}

.chat-msg.other .chat-delete-btn {
  right: auto;
  left: 4px;
}

.chat-msg.other {
  background: rgba(255,255,255,0.12);
  color: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.self {
  background: #0095f6;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg .chat-nick {
  font-size: 10px;
  font-weight: 700;
  color: #81c784;
  display: block;
  margin-bottom: 2px;
}

.chat-msg .chat-text {
  display: block;
  color: #fff;
  font-size: 14px;
  line-height: 1.4;
}

.chat-msg.self .chat-nick {
  color: rgba(255,255,255,0.7);
  text-align: right;
}

.chat-msg .chat-time {
  font-size: 9px;
  color: rgba(255,255,255,0.4);
  margin-top: 3px;
  display: block;
}

.chat-msg.self .chat-time {
  color: rgba(255,255,255,0.6);
  text-align: right;
}

.chat-input-row {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  gap: 8px;
  background: rgba(22, 22, 22, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 2;
}

.chat-input {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.chat-input::placeholder {
  color: rgba(255,255,255,0.4);
}

.chat-input:focus {
  border-color: rgba(255,255,255,0.3);
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.chat-send-btn:hover { opacity: 0.8; }

#chat-sheet.open-half,
#chat-sheet.open-full {
  height: auto;
  max-height: 55vh;
  padding-bottom: 40px;
}

@media (max-width: 480px) {
  .chat-panel {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 140px;
    max-height: 50vh;
  }
  .chat-toggle-btn {
    bottom: 80px;
    left: 12px;
    width: 44px;
    height: 44px;
  }
}

/* ===== Trail Detail Panel (Trailforks-style slide-in) ===== */
.trail-detail-panel {
  position: fixed;
  top: 60px;
  right: -380px;
  width: 340px;
  max-height: calc(100vh - 80px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 10px 0 0 10px;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
  overflow-y: auto;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.trail-detail-panel.open {
  right: 0;
}

.trail-detail-panel::-webkit-scrollbar {
  width: 5px;
}
.trail-detail-panel::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Header */
.tdp-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.tdp-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
}
.tdp-close:hover {
  background: var(--light-bg);
  color: var(--text-primary);
}

.tdp-difficulty-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.tdp-difficulty-badge.easy {
  background: #d1fae5;
  color: #065f46;
}
.tdp-difficulty-badge.easy::before {
  content: '●';
  color: #10b981;
}
.tdp-difficulty-badge.intermediate {
  background: #dbeafe;
  color: #1e3a5f;
}
.tdp-difficulty-badge.intermediate::before {
  content: '■';
  color: #3b82f6;
}
.tdp-difficulty-badge.advanced {
  background: #f3f4f6;
  color: #111827;
}
.tdp-difficulty-badge.advanced::before {
  content: '◆';
  color: #111827;
}
.tdp-difficulty-badge.lift {
  background: #fce4ec;
  color: #b71c1c;
}
.tdp-difficulty-badge.lift::before {
  content: '🚡';
}

.tdp-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  padding-right: 30px;
}

.tdp-type {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
  display: block;
}

/* Stats grid */
.tdp-stats {
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tdp-stat {
  padding: 10px 12px;
  background: var(--light-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.tdp-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tdp-stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
  margin-top: 2px;
}

.tdp-stat.full-width {
  grid-column: 1 / -1;
}

.btn-zoom-trail {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  padding: 6px 10px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-zoom-trail:hover {
  background: rgba(255,255,255,0.2);
}

/* Actions */
.tdp-actions {
  padding: 12px 20px 20px;
  border-top: 1px solid var(--border-color);
}
.tdp-btn {
  width: 100%;
  padding: 10px;
  background: #000;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.tdp-btn:hover {
  background: #333;
}

/* Mobile: bottom sheet */
@media (max-width: 640px) {
  .trail-detail-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    left: 0;
    width: 100%;
    max-height: 60vh;
    border-radius: 16px 16px 0 0;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .trail-detail-panel.open {
    bottom: 0;
    right: 0;
  }
}

/* ===== Trail List (Your Runs) in Legend ===== */
.trail-list {
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trail-list::-webkit-scrollbar {
  width: 4px;
}
.trail-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.trail-list-empty {
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 16px 8px;
  line-height: 1.5;
}

.trail-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.trail-list-item:hover {
  background: var(--light-bg);
  border-color: var(--border-color);
}
.trail-list-item.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: var(--primary-blue);
}

.tli-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
}

.tli-info {
  flex: 1;
  min-width: 0;
}
.tli-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tli-meta {
  font-size: 10px;
  color: var(--text-secondary);
  display: flex;
  gap: 8px;
  margin-top: 1px;
}

.tli-difficulty {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  align-self: center;
}
.tli-difficulty.easy { background: #d1fae5; color: #065f46; }
.tli-difficulty.intermediate { background: #dbeafe; color: #1e3a5f; }
.tli-difficulty.advanced { background: #f3f4f6; color: #111827; }

/* ===== Facilities Panel ===== */
.facilities-panel {
  position: fixed;
  top: 0;
  right: -380px;
  width: 360px;
  height: 100vh;
  background: rgba(22, 22, 22, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
}

.facilities-panel.show {
  right: 0;
}

.facilities-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.facilities-panel-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}

.facilities-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.facility-tab-btn {
  flex: 1;
  padding: 13px 8px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  margin-bottom: -1px;
}

.facility-tab-btn.active {
  color: #fff;
  border-bottom-color: #f57c00;
}

.facility-tab-btn[data-tab="washrooms"].active {
  border-bottom-color: #29b6f6;
}

.facility-tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.facility-tab-content.active-tab {
  display: flex;
  flex-direction: column;
}

.facility-list {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.facility-empty {
  padding: 40px 16px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
}

.facility-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 11px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border-left: 4px solid transparent;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}

.facility-item:hover {
  background: rgba(255, 255, 255, 0.09);
}

.facility-item.active {
  background: rgba(255, 255, 255, 0.11);
  border-left-color: #f57c00;
}

.facility-item[data-kind="washroom"].active {
  border-left-color: #29b6f6;
}

.facility-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  box-shadow: 0 0 6px rgba(0,0,0,0.4);
}

.facility-dot.restaurant { background: #f57c00; }
.facility-dot.washroom   { background: #0288d1; }

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

.facility-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facility-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
}

.facility-badge.restaurant {
  background: rgba(245, 124, 0, 0.18);
  color: #ff9800;
}

.facility-badge.washroom {
  background: rgba(2, 136, 209, 0.18);
  color: #29b6f6;
}

.facility-hours {
  margin-top: 5px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.38);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.facility-map-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 0;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.18s;
  line-height: 1;
}

.facility-map-btn:hover {
  opacity: 1;
}

.restaurant-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.restaurant-status {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 12px;
}

.restaurant-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.45);
  margin: 14px 0 8px;
}

.restaurant-meta-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.restaurant-meta-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.35;
}

.restaurant-meta-item a {
  color: #ffd166;
  text-decoration: none;
}

.restaurant-route-row {
  margin-top: 14px;
}

.restaurant-nav-btn {
  width: 100%;
}

.restaurant-route-meta {
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.58);
}

.restaurant-reviews {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.restaurant-review-item {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
}

.restaurant-review-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 6px;
}

.restaurant-review-item p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.4;
}

.restaurant-empty {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
}

#restaurant-detail-sheet {
  left: 10vw;
  right: auto;
  width: 80vw;
  bottom: 10vh;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transform: translateY(calc(100% + 12vh));
}

#restaurant-detail-sheet.open-half,
#restaurant-detail-sheet.open-full {
  transform: translateY(0);
  height: 80vh;
  max-height: 80vh;
}

@media (max-width: 600px) {
  .facilities-panel {
    width: 100vw;
    right: -100vw;
  }

  #restaurant-detail-sheet {
    left: 3vw;
    width: 94vw;
    bottom: 2vh;
    border-radius: 14px;
    transform: translateY(calc(100% + 4vh));
  }

  #restaurant-detail-sheet.open-half,
  #restaurant-detail-sheet.open-full {
    height: 82vh;
    max-height: 82vh;
  }
}

/* Save Activity button animation */
@keyframes whistler-spin {
  to { transform: rotate(360deg); }
}
@keyframes whistler-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}
#save-activity-btn.is-saving {
  pointer-events: none;
  animation: whistler-pulse 1.1s ease-in-out infinite;
  background: linear-gradient(90deg, #1976d2, #42a5f5, #1976d2);
  background-size: 200% 100%;
  background-position: 0% 50%;
  color: #fff !important;
}
#save-activity-btn .save-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: whistler-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
#save-activity-btn.is-success {
  background: #2e7d32 !important;
  color: #fff !important;
  pointer-events: none;
}
