/* ============================================================================
 * 《山河寻迹》 2026 (v4.0) — Spatial Glassmorphism & Zero-Overlap GIS Architecture
 * ============================================================================ */

:root {
  --bg-obsidian: #070b12;
  --glass-bg: rgba(11, 18, 29, 0.86);
  --glass-bg-heavy: rgba(9, 15, 25, 0.96);
  --glass-border: rgba(255, 255, 255, 0.12);

  --accent-cyan: #38bdf8;
  --accent-emerald: #10b981;
  --accent-gold: #f59e0b;
  --accent-crimson: #f43f5e;
  --accent-pink: #f472b6;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --radius-pill: 9999px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-float: 0 14px 36px -8px rgba(0, 0, 0, 0.72), 0 0 1px 1px rgba(255, 255, 255, 0.08);
  --font-sans: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", Georgia, serif;
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-obsidian);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* 1. Fullscreen Hero GIS Canvas */
#map-viewport {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  background: radial-gradient(circle at 50% 45%, #0d1b2a 0%, #070b12 85%);
}

#gis-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

#gis-canvas:active {
  cursor: grabbing;
}

.glass-pill,
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-float);
}

/* ============================================================================
 * 2. Unified Non-Overlapping Top HUD Row (Flexbox 3-Segment Layout)
 * ============================================================================ */
.top-hud-row {
  position: fixed;
  top: 12px;
  left: 14px;
  right: 14px;
  height: 40px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}

.top-hud-row > * {
  pointer-events: auto;
}

.hud-left-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tiny-brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(56, 189, 248, 0.3));
  border: 1px solid rgba(56, 189, 248, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
  transition: all 0.18s ease;
}

.tiny-brand-badge:hover {
  transform: scale(1.06);
  border-color: var(--accent-cyan);
}

.drawer-toggle-pill {
  height: 36px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
}

.drawer-toggle-pill:hover {
  border-color: var(--accent-cyan);
  background: rgba(15, 26, 42, 0.94);
}

.drawer-toggle-pill.accent-pink-pill {
  border-color: rgba(244, 114, 182, 0.45);
  color: #fbcfe8;
}

.drawer-toggle-pill.accent-pink-pill:hover {
  background: rgba(244, 114, 182, 0.2);
  border-color: #f472b6;
}

.drawer-toggle-pill .count-tag {
  background: rgba(56, 189, 248, 0.22);
  color: var(--accent-cyan);
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 700;
}

/* Center Group: 1-12 Month Scrubber + Dual-Ring Filter + Route Controls */
.hud-center-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.hud-center-bar::-webkit-scrollbar {
  display: none;
}

.timeline-scrubber-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.month-badge-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}

.month-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 5px;
  border-radius: 99px;
  background: linear-gradient(90deg, #38bdf8 0%, #f472b6 25%, #10b981 55%, #f59e0b 80%, #ef4444 92%, #38bdf8 100%);
  outline: none;
  cursor: pointer;
}

.month-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.85);
  cursor: pointer;
}

.month-select-compact {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-pill);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.month-select-compact option {
  background: #0f172a;
  color: #f8fafc;
}

.dual-ring-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(90deg, #f59e0b 50%, #38bdf8 50%);
  border: 1px solid #fff;
}

.route-controls-inline {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.r-pill {
  height: 26px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.r-pill:hover {
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.14);
}

.r-pill.active-pick {
  color: #04101d;
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.45);
}

.r-pill.reset-btn {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.42);
  background: rgba(244, 63, 94, 0.15);
}

.r-pill.reset-btn:hover {
  color: #fff;
  background: rgba(244, 63, 94, 0.88);
  border-color: var(--accent-crimson);
}

.route-summary-chip {
  font-size: 11px;
  color: var(--accent-emerald);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  font-weight: 600;
}

.hud-right-group {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 3px 5px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

.layer-seg-btn {
  height: 26px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.layer-seg-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.layer-seg-btn.active-pick {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.55);
  color: #38bdf8;
}

.seg-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Map Coordinate Pick Banner */
.map-pick-banner {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.6);
}

/* ============================================================================
 * 3. Right-Side Vertical Zoom Dock
 * ============================================================================ */
.right-zoom-dock {
  position: fixed;
  right: 16px;
  top: 62px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.zoom-dock-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}

.zoom-dock-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  transform: scale(1.05);
}

/* ============================================================================
 * 4. Collapsible Left Explorer & Corridor Radar Drawer
 * ============================================================================ */
.left-explorer-drawer {
  position: fixed;
  top: 60px;
  left: 14px;
  bottom: 16px;
  width: 344px;
  z-index: 26;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.22s ease;
}

.left-explorer-drawer.collapsed {
  transform: translateX(-370px);
  opacity: 0;
  pointer-events: none;
}

.drawer-header {
  padding: 9px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.drawer-tabs {
  display: flex;
  gap: 3px;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: var(--radius-pill);
}

.drawer-tab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.drawer-tab.active {
  background: rgba(56, 189, 248, 0.22);
  color: var(--accent-cyan);
}

.drawer-collapse-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.drawer-collapse-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-cyan);
}

.drawer-filters {
  padding: 8px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.phenology-banner-strip {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 9px;
  padding: 6px 8px;
}

.pheno-strip-title {
  font-size: 11px;
  font-weight: 600;
  color: #e2e8f0;
  line-height: 1.35;
}

.seasonal-ring-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #94a3b8;
}

.ring-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}
.ring-swatch.spring { background: #F472B6; }
.ring-swatch.summer { background: #10B981; }
.ring-swatch.autumn { background: #F59E0B; }
.ring-swatch.winter { background: #38BDF8; }
.ring-swatch.heritage { background: #EF4444; }
.ring-swatch.dual {
  background: linear-gradient(90deg, #F59E0B 50%, #38BDF8 50%);
  border: 1px solid #fff;
}

.search-box-row {
  display: flex;
  gap: 6px;
}

.search-input-minimal {
  flex: 1;
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.search-input-minimal:focus {
  border-color: var(--accent-cyan);
}

.province-select-minimal {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 5px 7px;
  color: var(--text-primary);
  font-size: 11.5px;
  outline: none;
  cursor: pointer;
}

.province-select-minimal option {
  background: #0f172a;
  color: #f8fafc;
}

.cat-pills-scroll {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.cat-pills-scroll::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.cat-chip:hover {
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.4);
}

.cat-chip.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Corridor Radar Panel */
.corridor-radar-panel {
  padding: 9px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.corridor-section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #38bdf8;
}

.preset-corridor-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.corridor-preset-btn {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #e0f2fe;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.corridor-preset-btn:hover,
.corridor-preset-btn.active {
  background: rgba(56, 189, 248, 0.28);
  border-color: #38bdf8;
  color: #fff;
}

.corridor-custom-endpoints-row,
.corridor-custom-\ endpoints-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.endpoint-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.endpoint-field label {
  font-size: 10.5px;
  color: #94a3b8;
}

.endpoint-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f8fafc;
  border-radius: 7px;
  padding: 4px 6px;
  font-size: 11.5px;
}

.endpoint-select option {
  background: #0f172a;
}

.corridor-action-row {
  display: flex;
  gap: 5px;
}

.primary-action-btn {
  flex: 1;
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  border: none;
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.primary-action-btn:hover {
  opacity: 0.92;
}

.secondary-action-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 9px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}

.secondary-action-btn:hover {
  border-color: #38bdf8;
  color: #38bdf8;
}

/* Drawer Body List */
.drawer-body-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.drawer-body-list::-webkit-scrollbar {
  width: 5px;
}
.drawer-body-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.spot-card-v3 {
  display: flex;
  gap: 9px;
  padding: 8px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: all 0.16s ease;
}

.spot-card-v3:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.32);
}

.spot-card-v3.selected {
  background: rgba(56, 189, 248, 0.14);
  border-color: var(--accent-cyan);
}

.spot-thumb-v3 {
  width: 66px;
  height: 66px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: #0f172a;
}

.spot-info-v3 {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spot-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.spot-name-v3 {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spot-elev-v3 {
  font-size: 10.5px;
  color: var(--accent-cyan);
  font-weight: 600;
  flex-shrink: 0;
}

.spot-meta-v3 {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.spot-quick-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.mini-act-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.mini-act-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
}

.route-card-v3 {
  padding: 9px 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.16s ease;
}

.route-card-v3:hover {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.4);
}

/* ============================================================================
 * 5. Bottom-Center Non-Overlapping Vertical Stack (Elevation + Spot Preview)
 * ============================================================================ */
.bottom-center-stack {
  position: fixed;
  /* insets follow the left drawer / AI dialog / AI orb (syncBottomStackLayout in app.js) */
  left: var(--bottom-stack-left, 372px);
  right: var(--bottom-stack-right, 448px);
  bottom: 16px;
  z-index: 24;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.bottom-center-stack > * {
  pointer-events: auto;
  width: 100%;
  max-width: 580px;
}

/* Hidden (never overlapped) while a widened AI dialog leaves less than a usable width */
.bottom-center-stack.is-squeezed {
  visibility: hidden;
}

.elevation-floating-drawer {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
}

.elev-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  gap: 8px;
}

.elev-badges-inline {
  display: inline-flex;
  gap: 5px;
  font-size: 10.5px;
}

.elev-supply-footer {
  margin-top: 5px;
  font-size: 10.5px;
  color: #cbd5e1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.floating-spot-card {
  padding: 10px 12px;
  border-radius: var(--radius-lg);
  display: flex;
  gap: 11px;
  align-items: center;
  position: relative;
}

.floating-spot-close {
  position: absolute;
  top: 7px;
  right: 9px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.floating-spot-photo {
  width: 82px;
  height: 82px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.floating-spot-content {
  flex: 1;
  min-width: 0;
  padding-right: 14px;
}

.spot-tier-pill {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  font-weight: 600;
}

.spot-ring-pill {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  font-weight: 600;
}

/* ============================================================================
 * 6. Bottom-Right AI Travel Copilot Trigger & Popover
 * ============================================================================ */
.ai-orb-trigger {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 32;
  height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, #0ea5e9 0%, #10b981 100%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.45);
  transition: transform 0.18s ease;
}

.ai-orb-trigger:hover {
  transform: translateY(-2px) scale(1.03);
}

.ai-orb-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
}

.ai-copilot-popover {
  position: fixed;
  right: 16px;
  bottom: 68px;
  width: 420px;
  height: 540px;
  min-width: 340px;
  max-width: calc(100vw - 32px);
  min-height: 360px;
  max-height: calc(100vh - 86px);
  z-index: 35;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: opacity 0.2s ease;
}

.ai-copilot-popover.collapsed {
  transform: translateY(24px) scale(0.95);
  opacity: 0;
  pointer-events: none;
}

/* Desktop Resize Handles for #ai-copilot-popover */
.ai-resize-handle {
  position: absolute;
  z-index: 42;
  user-select: none;
}

.ai-resize-nw {
  top: 0;
  left: 0;
  width: 22px;
  height: 22px;
  cursor: nwse-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  border-right: 1px solid rgba(56, 189, 248, 0.4);
  border-bottom: 1px solid rgba(56, 189, 248, 0.4);
  border-bottom-right-radius: 8px;
  transition: background 0.15s ease;
}

.ai-resize-nw:hover {
  background: rgba(56, 189, 248, 0.38);
  color: #ffffff;
}

.ai-resize-w {
  top: 22px;
  left: 0;
  bottom: 0;
  width: 7px;
  cursor: ew-resize;
}

.ai-resize-w:hover {
  background: rgba(56, 189, 248, 0.25);
}

.ai-resize-n {
  top: 0;
  left: 22px;
  right: 0;
  height: 7px;
  cursor: ns-resize;
}

.ai-resize-n:hover {
  background: rgba(56, 189, 248, 0.25);
}

.ai-popover-header {
  padding: 10px 12px 10px 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.65);
  flex-shrink: 0;
}

.ai-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.ai-config-bar {
  padding: 8px 12px;
  background: rgba(7, 11, 18, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.ai-messages-box {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ai-msg {
  font-size: 12px;
  line-height: 1.55;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 9px 11px;
  border-radius: 12px;
}

.ai-msg.user {
  align-self: flex-end;
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.45);
  color: #ffffff;
  max-width: 88%;
}

/* Gemini 3.8 Flash Visible Thinking & Real-Time Climate Grounding Panel */
.copilot-thinking-box {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px dashed rgba(251, 191, 36, 0.45);
  font-size: 11px;
  color: #cbd5e1;
}

.copilot-thinking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-weight: 700;
  color: #fbbf24;
  cursor: pointer;
}

.thinking-pulse-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 8px #fbbf24;
  animation: thinkingPulse 1s infinite ease-in-out;
}

.thinking-pulse-dot.done {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: none;
}

@keyframes thinkingPulse {
  0%, 100% { transform: scale(0.85); opacity: 0.55; }
  50% { transform: scale(1.25); opacity: 1; }
}

.copilot-thinking-steps {
  margin-top: 5px;
  padding-left: 4px;
  border-left: 2px solid rgba(251, 191, 36, 0.35);
  font-size: 10.5px;
  line-height: 1.5;
  color: #94a3b8;
}

/* Structured AI Route Cards & Season Comparison Table inside Copilot */
.copilot-season-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  overflow: hidden;
}

.copilot-season-table th,
.copilot-season-table td {
  padding: 5px 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-align: left;
  vertical-align: top;
}

.copilot-season-table th {
  color: #38bdf8;
  font-weight: 700;
  background: rgba(56, 189, 248, 0.1);
}

.copilot-route-card {
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(56, 189, 248, 0.32);
}

.copilot-card-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

.btn-show-on-map {
  flex: 1;
  background: linear-gradient(135deg, #0ea5e9, #10b981);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.btn-show-on-map:hover {
  opacity: 0.92;
}

/* Route-node pills: exactly the nodes that drive the map, in route order */
.copilot-node-pills {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.copilot-node-caption {
  flex-basis: 100%;
  font-size: 10.5px;
  color: #94a3b8;
  margin-bottom: 1px;
}

button.copilot-node-end {
  cursor: pointer;
}

.copilot-node-end {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copilot-spot-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
}

.copilot-spot-pill .pill-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  color: #0f172a;
  background: #38bdf8;
  flex-shrink: 0;
}

.copilot-spot-pill .pill-elev {
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  flex-shrink: 0;
}

.copilot-spot-pill.is-ai-stop {
  border-style: dashed;
  border-color: rgba(103, 232, 249, 0.6);
  color: #67e8f9;
}

.copilot-spot-pill.is-ai-stop .pill-idx {
  background: #22d3ee;
}

.copilot-spot-pill.is-via-town {
  border-style: dotted;
  border-color: rgba(148, 163, 184, 0.65);
  color: #cbd5e1;
}

.copilot-spot-pill.is-via-town .pill-idx {
  background: #94a3b8;
}

.copilot-route-pending {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.7);
  border: 1px dashed rgba(56, 189, 248, 0.35);
}

.copilot-route-pending .thinking-pulse-dot {
  flex-shrink: 0;
}

.copilot-route-pending.is-empty {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
}

.copilot-route-card.is-reference {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.4);
  opacity: 0.86;
}

.copilot-ref-tag {
  display: inline-block;
  margin-bottom: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.copilot-unresolved-note {
  margin-top: 4px;
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 10.5px;
  line-height: 1.45;
  color: #fcd34d;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
}

.ai-quick-chips {
  padding: 6px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ai-quick-chips::-webkit-scrollbar {
  display: none;
}

.ai-prompt-chip {
  flex-shrink: 0;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: #bae6fd;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
  font-size: 10.5px;
  cursor: pointer;
  white-space: nowrap;
}

.ai-prompt-chip:hover {
  background: rgba(56, 189, 248, 0.24);
  color: #fff;
}

.ai-input-bar {
  padding: 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 6px;
}

.ai-input-field {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
  color: #fff;
  font-size: 12px;
  outline: none;
}

.ai-send-btn {
  background: var(--accent-cyan);
  border: none;
  color: #04101d;
  font-weight: 700;
  font-size: 12px;
  padding: 0 13px;
  border-radius: 8px;
  cursor: pointer;
}

/* ============================================================================
 * 7. Modals (Spot Detail + Multi-Season Gallery + UGC Upload + Roadbook)
 * ============================================================================ */
.spot-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 9, 17, 0.78);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.spot-modal-card {
  width: 100%;
  max-width: 680px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--glass-bg-heavy);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 18px;
  padding: 18px 20px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85);
}

.gallery-season-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.gallery-tab-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd5e1;
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.gallery-tab-btn.active {
  background: rgba(56, 189, 248, 0.24);
  border-color: #38bdf8;
  color: #fff;
}

.phenology-bars-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  align-items: end;
  height: 54px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  margin-bottom: 12px;
}

.pheno-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.pheno-bar-fill {
  width: 100%;
  border-radius: 3px 3px 0 0;
  transition: height 0.2s ease;
}

.pheno-bar-lbl {
  font-size: 9.5px;
  color: #94a3b8;
}

.ugc-form-grid {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ugc-form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ugc-form-row label,
.ugc-form-row-2col label,
.ugc-form-row-3col label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}

.ugc-form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ugc-form-row-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.roadbook-pre-box {
  background: rgba(7, 11, 18, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.55;
  color: #e2e8f0;
  white-space: pre-wrap;
  max-height: 56vh;
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

/* ============================================================================
 * 8. Responsive Layout Adaptation (Tablet & Mobile 390x844 Zero-Overlap)
 * ============================================================================ */
@media (max-width: 1024px) {
  .bottom-center-stack {
    left: var(--bottom-stack-left, 16px);
    right: var(--bottom-stack-right, 70px);
  }
}

@media (max-width: 768px) {
  .top-hud-row {
    top: 6px;
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
    height: auto;
    gap: 4px;
  }
  .hud-left-group {
    gap: 4px;
  }
  #drawer-toggle-label {
    display: none;
  }
  .tiny-brand-badge {
    width: 26px;
    height: 26px;
    font-size: 11.5px;
  }
  .drawer-toggle-pill {
    height: 26px;
    padding: 0 5px;
    font-size: 9.5px;
  }
  .hud-right-group {
    height: 26px;
    padding: 1px 3px;
    gap: 1px;
  }
  .layer-seg-btn {
    height: 22px;
    padding: 0 3px;
    font-size: 9px;
  }
  .hud-center-bar {
    order: 3;
    width: 100%;
    height: 30px;
    padding: 0 8px;
  }
  .left-explorer-drawer {
    top: 74px;
    left: 10px;
    bottom: auto;
    width: calc(100vw - 64px);
    height: 196px;
    max-height: 196px;
  }
  .right-zoom-dock {
    top: 74px;
    right: 10px;
    bottom: auto;
  }
  .bottom-center-stack {
    top: 276px;
    bottom: auto;
    left: 10px;
    right: 10px;
    gap: 4px;
  }
  .elevation-floating-drawer {
    padding: 5px 8px;
    max-height: 128px;
    overflow: hidden;
  }
  .elev-header-row {
    margin-bottom: 2px;
  }
  #elevation-canvas {
    height: 46px !important;
  }
  .elev-supply-footer {
    margin-top: 2px;
    font-size: 9.5px;
    white-space: nowrap;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .floating-spot-card {
    padding: 5px 8px;
    gap: 8px;
    max-height: 126px;
    overflow: hidden;
  }
  .floating-spot-photo {
    width: 52px;
    height: 52px;
  }
  .ai-copilot-popover {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 50px;
    max-height: 232px;
  }
  .ai-popover-header {
    padding: 6px 10px;
  }
  .ai-messages-box {
    min-height: 64px;
    max-height: 106px;
    padding: 6px 8px;
  }
  .ai-quick-chips {
    padding: 4px 8px;
  }
  .ai-input-bar {
    padding: 5px 8px;
  }
  .ai-orb-trigger {
    right: 10px;
    bottom: 6px;
    height: 38px;
    padding: 0 14px;
    font-size: 11.5px;
  }
  .corridor-weather-strip {
    padding: 1px 4px !important;
    font-size: 9px !important;
    margin-bottom: 1px !important;
  }
  #elevation-canvas {
    height: 36px !important;
  }
}

/* V4.1 Corridor Live Weather Warning Strip */
.corridor-weather-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 8px;
  margin-bottom: 3px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.22);
  font-size: 10.5px;
  color: #e2e8f0;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.corridor-weather-strip::-webkit-scrollbar {
  display: none;
}

/* V4.1 Before/After Dual-Season Split-Screen Slider */
.dual-season-slider-box {
  position: relative;
  width: 100%;
  height: 260px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(245, 158, 11, 0.45);
  user-select: none;
  margin-bottom: 12px;
  background: #070d19;
}
.dual-season-img-full {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.dual-season-before-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.dual-season-divider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2.5px;
  background: linear-gradient(180deg, #f59e0b, #ffffff, #38bdf8);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  z-index: 4;
}
.dual-season-handle-pill {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(7, 13, 25, 0.88);
  border: 1.5px solid #f8fafc;
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 99px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  z-index: 5;
}
.dual-season-badge-left,
.dual-season-badge-right {
  position: absolute;
  top: 10px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  backdrop-filter: blur(8px);
  z-index: 3;
  pointer-events: none;
}
.dual-season-badge-left {
  left: 10px;
  background: rgba(245, 158, 11, 0.85);
  color: #070d19;
}
.dual-season-badge-right {
  right: 10px;
  background: rgba(56, 189, 248, 0.85);
  color: #070d19;
}
.dual-season-range-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 6;
  margin: 0;
}

