.arcgis-map-65km {
  --ts-accent: #0090d7;
  --panel-bg: rgba(27, 29, 29, 0.78);
  --panel-solid: #1b1d1d;
  --panel-h: 66px;              /* kept in sync by JS (ResizeObserver) */
  position: relative;
  width: 100%;
  text-align: left;
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
}

.arcgis-map-65km * {
  box-sizing: border-box;
}

/* ── Map frame. JS wraps .map-viewdiv + .slider-panel in this. ── */
.arcgis-map-65km .map-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3 !important;
  height: auto;
  max-height: 720px;
}

.arcgis-map-65km .map-viewdiv {
  position: absolute;
  inset: 0;
}

/* ── Time slider ── */
.arcgis-map-65km .slider-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: var(--panel-bg);
  padding: 14px 24px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.arcgis-map-65km .year-label {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  min-width: 52px;
  text-align: center;
  letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
}

.arcgis-map-65km .play-btn {
  background: var(--ts-accent);
  color: #fff;
  border: none;
  border-radius: 0; /* square */
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.1s;
  flex-shrink: 0;
  touch-action: manipulation;
}

.arcgis-map-65km .play-btn:hover {
  background: #004f9f;
  transform: scale(1.05);
}

.arcgis-map-65km .play-btn:active {
  transform: scale(0.97);
}

.arcgis-map-65km .play-btn:focus-visible,
.arcgis-map-65km .year-slider:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.arcgis-map-65km .year-edge {
  font-size: 12px;
  color: #ddd;
  white-space: nowrap;
}

.arcgis-map-65km .year-slider {
  flex: 1;
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 0;
  background: #fff; /* white slider line */
  outline: none;
  cursor: pointer;
  touch-action: pan-y;
}

.arcgis-map-65km .year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 0; /* square */
  background: var(--ts-accent);
  border: 2px solid #fff;
  cursor: pointer;
  transition: transform 0.15s;
}

.arcgis-map-65km .year-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Square thumb — Firefox */
.arcgis-map-65km .year-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 0;
  background: var(--ts-accent);
  border: 2px solid #fff;
  cursor: pointer;
}

.arcgis-map-65km .year-slider::-moz-range-track {
  height: 4px;
  background: #fff;
}

/* ── ArcGIS components ── */
.arcgis-map-65km arcgis-legend,
.arcgis-map-65km arcgis-chart,
.arcgis-map-65km .esri-widget {
  font-family: "Open Sans", Helvetica, Arial, sans-serif;
}

.arcgis-map-65km .esri-ui-bottom-left,
.arcgis-map-65km .esri-ui-bottom-right {
  bottom: calc(var(--panel-h) + 8px);
}

.arcgis-map-65km arcgis-legend {
  --calcite-color-foreground-1: var(--panel-bg);
  --calcite-color-foreground-2: var(--panel-bg);
  --calcite-color-foreground-3: var(--panel-bg);
  --calcite-color-text-1: #ffffff;
  --calcite-color-text-2: #ffffff;
  --calcite-color-text-3: #ffffff;
}

.arcgis-map-65km .bottom-right-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.arcgis-map-65km .heatmap-toggle-panel {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.arcgis-map-65km .layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  touch-action: manipulation;
}

.arcgis-map-65km .layer-item input[type="checkbox"] {
  accent-color: var(--ts-accent);
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

/* ── Chart panel: 260px inside the view ── */
.arcgis-map-65km .chart-panel {
  background: var(--panel-bg);
  border-radius: 10px;
  padding: 8px 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

.arcgis-map-65km .chart-el {
  display: block;
  width: 260px;
  height: auto;
}

/* ── Below-map stack: chart + toggle + legend, mobile only ── */
.arcgis-map-65km .below-map {
  display: block;
  background: var(--panel-solid);
  color: #fff;
  border-top: 2px solid var(--ts-accent);
}

.arcgis-map-65km .below-map[hidden] {
  display: none;
}

.arcgis-map-65km .panel-heading {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #cfd4d4;
}

.arcgis-map-65km .controls-host:empty {
  display: none;
}

.arcgis-map-65km .controls-host {
  padding: 12px 16px 0;
}

/* The chart is always visible — no collapse. */
.arcgis-map-65km .chart-host {
  padding: 14px 16px 6px;
}

/* Panels lose their card styling in the stack: the stack is the card. */
.arcgis-map-65km .below-map .chart-panel,
.arcgis-map-65km .below-map .heatmap-toggle-panel {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.arcgis-map-65km .below-map .chart-el {
  width: 100%;

}

.arcgis-map-65km .legend-summary {
  list-style: none;
  cursor: pointer;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 10px;
  touch-action: manipulation;
}

.arcgis-map-65km .legend-summary::-webkit-details-marker {
  display: none;
}

.arcgis-map-65km .legend-summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ts-accent);
  border-bottom: 2px solid var(--ts-accent);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.arcgis-map-65km .legend-host[open] .legend-summary::before {
  transform: rotate(45deg);
}

.arcgis-map-65km .legend-body {
  max-height: 40vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 10px 12px;
}

.arcgis-map-65km .legend-body arcgis-legend {
  --calcite-color-foreground-1: transparent;
  --calcite-color-foreground-2: transparent;
  --calcite-color-foreground-3: transparent;
  display: block;
}

/* ── Mobile: keep this breakpoint equal to MOBILE_QUERY in the JS ── */
@media (max-width: 700px) {
  .arcgis-map-65km .map-wrap {
    aspect-ratio: auto !important;
    height: 54vh;
    min-height: 300px;
    max-height: 460px;
  }

  .arcgis-map-65km .slider-panel {
    flex-wrap: wrap;
    padding: 10px 14px 12px;
    gap: 8px 12px;
  }

  /* Row 1: play button + year. Row 2: full-width slider. */
  .arcgis-map-65km .year-edge {
    display: none;
  }

  .arcgis-map-65km .year-label {
    font-size: 19px;
    margin-left: auto;
    min-width: 0;
  }

  .arcgis-map-65km .year-slider {
    order: 3;
    flex: 1 0 100%;
    height: 6px;
  }

  /* Touch targets */
  .arcgis-map-65km .play-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .arcgis-map-65km .year-slider::-webkit-slider-thumb {
    width: 26px;
    height: 26px;
  }

  .arcgis-map-65km .year-slider::-moz-range-thumb {
    width: 26px;
    height: 26px;
  }

  .arcgis-map-65km .layer-item {
    font-size: 14px;
    min-height: 32px;
  }

  .arcgis-map-65km .layer-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  /* Only attribution is left in the view corners */
  .arcgis-map-65km .esri-ui-bottom-right {
    bottom: calc(var(--panel-h) + 4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcgis-map-65km .play-btn,
  .arcgis-map-65km .year-slider::-webkit-slider-thumb,
  .arcgis-map-65km .legend-summary::before {
    transition: none;
  }
}