:root {
  --bg: #020817;
  --panel: rgba(15, 23, 42, 0.9);
  --panel-2: #111827;
  --line: rgba(148, 163, 184, 0.24);
  --text: #e5e7eb;
  --muted: #94a3b8;
  --brand: #7c3aed;
  --brand-2: #22c55e;
  --amber: #fbbf24;
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(180deg, #020817 0%, #0f172a 100%);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: 100%;
  width: 100%;
  flex: 1;
}

.panel {
  background: rgba(15, 23, 42, 0.9);
  border-right: 1px solid var(--line);
  padding: 28px 22px;
  backdrop-filter: blur(18px);
  overflow-y: auto;
  max-height: 100%;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.panel::-webkit-scrollbar {
  width: 8px;
}

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

.panel::-webkit-scrollbar-thumb {
  background-color: rgba(148, 163, 184, 0.45);
  border-radius: 999px;
}

.panel-header h1 {
  margin: 8px 0 0;
  font-size: 2rem;
}

.eyebrow {
  margin: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brand-2);
}

.next-gig-banner {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.1);
  overflow: hidden;
}

.next-gig-banner.hidden {
  display: none;
}

.next-gig-header {
  padding: 8px 12px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(251, 191, 36, 0.75);
}

.next-gig-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid rgba(251, 191, 36, 0.18);
  background: transparent;
  color: var(--amber);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.next-gig-row:first-of-type {
  border-top: 0;
}

.next-gig-row:hover,
.next-gig-row:focus {
  background: rgba(251, 191, 36, 0.18);
}

.next-gig-venue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.next-gig-when {
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(251, 191, 36, 0.8);
  white-space: nowrap;
  flex-shrink: 0;
}

.gig-select {
  position: relative;
  width: 100%;
  margin-top: 10px;
}

.gig-select.hidden {
  display: none;
}

.gig-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(31, 41, 55, 0.7);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.gig-select-trigger:hover,
.gig-select-trigger:focus {
  border-color: rgba(124, 58, 237, 0.5);
}

.gig-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gig-select-caret {
  color: var(--muted);
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.gig-select.open .gig-select-caret {
  transform: rotate(180deg);
}

.gig-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  z-index: 20;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  padding: 6px;
}

.gig-select-menu.hidden {
  display: none;
}

.gig-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  text-align: left;
  cursor: pointer;
}

.gig-select-option:hover,
.gig-select-option:focus {
  background: rgba(124, 58, 237, 0.18);
}

.gig-select-option-date {
  color: var(--muted);
  font-weight: 600;
  flex-shrink: 0;
}

.gig-select-option-venue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.filters {
  margin-top: 30px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(31, 41, 55, 0.7);
}

.filters label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 12px;
}

.range-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 10px;
}

.slider-wrap {
  position: relative;
  height: 44px;
}

.dual-range {
  position: relative;
  height: 44px;
}

.range-track,
.range-fill {
  position: absolute;
  left: 0;
  right: 0;
  top: 18px;
  height: 8px;
  border-radius: 999px;
}

.range-track {
  background: rgba(148, 163, 184, 0.24);
}

.range-fill {
  background: linear-gradient(90deg, var(--brand), #4f46e5);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.2);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  position: absolute;
  left: 0;
  top: 0;
  height: 44px;
  margin: 0;
  pointer-events: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow);
  margin-top: 12px;
  cursor: pointer;
  pointer-events: auto;
}

input[type="range"]::-moz-range-track {
  height: 8px;
  background: transparent;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  border: 2px solid #ffffff;
  box-shadow: var(--shadow);
  cursor: pointer;
  pointer-events: auto;
}

#year-min { z-index: 4; }
#year-max { z-index: 5; }

.range-summary {
  margin-top: 18px;
  color: var(--muted);
}

.legend {
  margin-top: 26px;
}

.legend h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: var(--text);
  font-size: 0.9rem;
  transition: opacity 0.2s ease;
}

.legend-clickable {
  cursor: pointer;
}

.legend-clickable:hover {
  opacity: 0.8;
}

.legend-clickable:not(.active) {
  opacity: 0.4;
}

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 2px solid;
  transition: transform 0.2s ease;
}

.legend-clickable:hover .legend-dot {
  transform: scale(1.15);
}

.legend-label {
  text-transform: capitalize;
  font-weight: 500;
}

.legend-count {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

.legend-content {
  margin-top: 12px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  background: #fbbf24;
  box-shadow: 0 0 0 6px rgba(251, 191, 36, 0.18);
}

.leaderboard {
  margin-top: 26px;
}

.leaderboard h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  font-family: inherit;
  cursor: pointer;
}

.collapsible-chevron {
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.collapsible-section.collapsed .collapsible-chevron {
  transform: rotate(-90deg);
}

.collapsible-body {
  margin-top: 12px;
}

.collapsible-section.collapsed .collapsible-body {
  display: none;
}

.leaderboard-content,
.districts-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 20px 1fr 28px;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: rgba(31, 41, 55, 0.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, transform 0.15s ease;
}

.leaderboard-row:hover {
  background: rgba(124, 58, 237, 0.18);
  transform: translateX(2px);
}

.leaderboard-rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.leaderboard-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.leaderboard-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  min-width: 0;
}

.leaderboard-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.leaderboard-photo-icon {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.leaderboard-bar-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
  display: block;
}

.leaderboard-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.districts-single-header {
  margin-top: 14px;
  margin-bottom: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.districts-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.district-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(124, 58, 237, 0.12);
  color: var(--text);
  font-family: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.district-chip:hover,
.district-chip:focus {
  background: rgba(124, 58, 237, 0.28);
  transform: translateY(-1px);
}

.leaderboard-count {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  color: var(--muted);
}

.venue-pin-wrap {
  background: transparent;
  border: none;
}

.venue-pin {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.4);
}

.cluster-marker-wrap {
  background: transparent;
  border: none;
}

.cluster-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #0b1220;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
}

/* Camera badge: a small notification-style dot in the corner of a pin or
   cluster bubble, flagging that photos are attached. Purple to match the
   app's brand accent so it reads as "extra info", not a venue-type color. */
.photo-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--brand);
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.5);
}

.pin-photo-badge {
  width: 11px;
  height: 11px;
  top: -3px;
  right: -3px;
}

.venue-tooltip-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.venue-tooltip-label svg {
  flex-shrink: 0;
}

.cluster-tooltip-line {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 2px 4px;
  margin: 0 -4px;
  border-radius: 6px;
  transition: background 0.12s ease;
}

.cluster-tooltip-line:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: underline;
}

.cluster-tooltip-line svg {
  flex-shrink: 0;
}

@keyframes markerFlash {
  0%, 100% {
    filter: brightness(1) drop-shadow(0 0 0 rgba(248, 250, 252, 0));
  }
  50% {
    filter: brightness(1.7) drop-shadow(0 0 10px rgba(248, 250, 252, 0.95));
  }
}

/* Loops for as long as a Top Venues row is hovered/focused. Deliberately
   uses `filter`, never `transform` — Leaflet positions markers with an
   inline `transform: translate3d(...)` on this same element, and animating
   `transform` here would overwrite that and snap the marker to (0,0). */
.marker-flash {
  animation: markerFlash 0.9s ease-in-out infinite;
}

.cluster-tooltip {
  max-width: 220px;
  line-height: 1.5;
}

.cluster-tooltip-more {
  color: var(--muted) !important;
}

/* Cluster info now renders as a Popup (not a Tooltip) — it doesn't
   auto-close on mouseout, so it can be safely clicked into. Popup's DOM
   nests the actual bubble inside .leaflet-popup-content-wrapper, with a
   separate .leaflet-popup-tip for the little pointer triangle, so those
   need styling directly rather than the outer .leaflet-popup element. */
.leaflet-popup.cluster-popup .leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  color: #f8fafc;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
}

.leaflet-popup.cluster-popup .leaflet-popup-content {
  margin: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  max-width: 220px;
  line-height: 1.5;
}

.leaflet-popup.cluster-popup .leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.97);
  box-shadow: none;
}

.map-area {
  position: relative;
  height: 100%;
  width: 100%;
}

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

.panel-toggle {
  display: none;
}

.leaflet-container {
  background: #dfeaf5;
}

.pub-tooltip {
  background: rgba(15, 23, 42, 0.96) !important;
  border: 1px solid rgba(148, 163, 184, 0.25) !important;
  border-radius: 10px !important;
  color: #f8fafc !important;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 6px 10px !important;
}

.pub-tooltip:before {
  border-top-color: rgba(15, 23, 42, 0.96) !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.hidden,
.lightbox.hidden {
  display: none;
}

.modal-card {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(15, 23, 42, 0.97);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  padding: 18px 18px 22px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.42);
}

.close-btn,
.close-lightbox {
  position: absolute;
  right: 14px;
  top: 12px;
  background: transparent;
  color: var(--text);
  border: 0;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s ease;
}

.close-btn:hover,
.close-lightbox:hover {
  opacity: 1;
}

.modal-header h2 {
  margin: 4px 0 18px;
  font-size: clamp(1.4rem, 2vw, 1.8rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.modal-header h3 {
  margin: 0 0 18px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
}

.modal-venue-id {
  font-size: 0.8rem;
  font-weight: 400;
  color: rgba(148, 163, 184, 0.6);
}

.next-gig-badge {
  display: inline-block;
  margin: -10px 0 12px;
  padding: 4px 10px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.1);
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 600;
}

.next-gig-badge.hidden {
  display: none;
}

.chart-wrap {
  position: relative;
  height: 260px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 12px;
}

.images-section {
  margin-top: 18px;
}

.images-section h3 {
  margin: 0 0 12px;
}

.image-carousel-shell {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.carousel-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

.image-track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  padding: 8px 4px 2px;
}

.image-track::-webkit-scrollbar {
  display: none;
}

.image-card {
  flex: 0 0 calc((100% - 24px) / 3);
  min-height: 180px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.7);
  overflow: hidden;
  scroll-snap-align: start;
  cursor: pointer;
}

.image-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
  background: #0b1220;
}

/* Sticky year chapter label between photo groups: pins to the left edge of
   the visible carousel while its group of photos scrolls past, then the
   next year's label takes over as the scroll crosses into it. */
.image-year-label {
  position: sticky;
  left: 0;
  z-index: 5;
  flex: 0 0 32px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--brand), #4f46e5);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.4);
  scroll-snap-align: none;
}

.image-year-label span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: #f8fafc;
  white-space: nowrap;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(15, 23, 42, 0.45);
}

.weather-section {
  margin-top: 18px;
}

.weather-section h3 {
  margin: 0 0 12px;
}

.weather-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.weather-date-label {
  font-weight: 600;
  font-size: 0.9rem;
  min-width: 200px;
  text-align: center;
}

.stepper-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.7);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.stepper-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.weather-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

.weather-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.weather-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.weather-wrap {
  position: relative;
  height: 220px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 12px;
}

.weather-status {
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.weather-status.hidden {
  display: none;
}

.travel-section {
  margin-top: 18px;
}

.travel-section h3 {
  margin: 0 0 12px;
}

.travel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.travel-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.88));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
}

.travel-rank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4f46e5);
  color: #fff;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.travel-info {
  min-width: 0;
}

.travel-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.travel-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.travel-time {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--brand-2);
  white-space: nowrap;
}

.travel-distance {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.travel-elevation-wrap {
  position: relative;
  height: 40px;
  margin-top: 8px;
}

.travel-elevation {
  display: block;
  width: 100%;
  height: 100%;
}

.travel-unavailable {
  font-size: 0.78rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 2px;
}

.travel-footnote {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 23, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 24px;
}

.lightbox-content {
  position: relative;
  max-width: min(1000px, 90vw);
  max-height: 90vh;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--line);
  padding: 18px;
}

.lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.75);
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
  transition: opacity 0.2s ease, background 0.2s ease;
  z-index: 1;
}

.lightbox-nav:hover {
  opacity: 1;
  background: rgba(124, 58, 237, 0.55);
}

.lightbox-nav-prev {
  left: 10px;
}

.lightbox-nav-next {
  right: 10px;
}

.lightbox-counter {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    position: relative;
    height: 100%;
  }

  .panel-toggle {
    display: flex;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--brand), #4f46e5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1500;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .panel-toggle:active {
    transform: scale(0.95);
  }

  .panel-toggle:hover {
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.6);
  }

  .panel {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    padding: 20px 16px;
    border-right: none;
    border-bottom: none;
    overflow-y: auto;
    z-index: 1400;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    background: rgba(15, 23, 42, 0.95);
  }

  .panel.active {
    transform: translateX(0);
  }

  .panel-header h1 {
    font-size: 1.5rem;
  }

  .panel-header p {
    font-size: 0.7rem;
  }

  .filters {
    margin-top: 20px;
    padding: 14px 12px;
  }

  .legend {
    margin-top: 20px;
  }

  .map-area {
    height: 100%;
    width: 100%;
  }

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

  .image-card {
    flex-basis: calc(100% - 10px);
  }

  .chart-wrap {
    height: 200px;
  }

  .weather-wrap {
    height: 180px;
  }

  .weather-date-label {
    font-size: 0.8rem;
    min-width: 0;
  }

  .image-carousel-shell {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
  }

  .lightbox-nav {
    width: 38px;
    height: 38px;
    font-size: 1.5rem;
  }

  .lightbox-nav-prev {
    left: 4px;
  }

  .lightbox-nav-next {
    right: 4px;
  }

  .modal-card {
    width: min(90vw, 100%);
    padding: 12px 12px 16px;
  }

  .close-btn {
    right: 10px;
    top: 10px;
  }

  .modal-header {
    margin-bottom: 12px;
  }

  .modal-header h2 {
    font-size: 1.3rem;
  }
}

@media (max-width: 900px) {

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
  }

  .panel {
    position: static;
    width: 100%;
    height: auto;
    max-height: 300px;
    padding: 24px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
    overflow-y: auto;
    transform: none;
  }

  .panel-toggle {
    display: none;
  }

  .map-area {
    position: relative;
    min-height: 0;
    height: 100%;
    width: 100%;
  }

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

  .image-card {
    flex-basis: calc(100% - 10px);
  }

  .chart-wrap {
    height: 220px;
  }

  .weather-wrap {
    height: 200px;
  }

  .image-carousel-shell {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
  }

  .carousel-btn {
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
  }
}
