#weatherOverlay {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 16;
  overflow: hidden;
  pointer-events: none;
}

#weatherSvg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  /*
   * Must be auto on touch: parent pointer-events:none + child auto works on
   * desktop but often fails on mobile (hit targets never receive the tap).
   * Empty SVG space stays a globe gesture via data-bt-globe-surface.
   */
  pointer-events: auto;
  /* Event marker scale (CSS px); outline icons, not viewport-scaled. */
  --event-marker-r: 5px;
}

/*
 * Globe map labels: halo via text-shadow only.
 * Samsung Internet maps SVG text stroke / paint-order:stroke to -webkit-text-stroke
 * and paints currentColor (often white), ignoring the actual stroke color.
 */
#weatherSvg .wildfire-label,
#weatherSvg .smoke-label,
#weatherSvg .hurricane-track-label,
#weatherSvg .eclipse-path-label {
  color: #000;
  stroke: none;
  stroke-width: 0;
  paint-order: fill;
  -webkit-text-stroke: 0;
  text-shadow: var(--chrome-text-halo);
}

#weatherSvg .is-hover-label {
  pointer-events: auto;
  cursor: pointer;
}

#weatherSvg .wildfire-label tspan {
  stroke: none;
  stroke-width: 0;
  -webkit-text-stroke: 0;
}

#weatherSvg .event-selection-halo {
  pointer-events: none;
}

/* ── Event strip (sky-photos DragScroller layout) ── */

:root {
  --weather-scroll-select-border: 3px;
  /* Fallback until bt/top_chrome_layout.js publishes --chrome-extension-row-top */
  --chrome-extension-row-top: 54px;
  --weather-filter-row-height: 40px;
  --chrome-extension-filter-row-bottom: 88px;
  --bottom-scroller-clearance: 120px;
  --bottom-scroller-top: max(50vh, calc(100vh - 200px));
}

/* ── Filter bar: extension-toggle row, clear of view dropdown + menu corner ── */

#weatherFilter {
  position: fixed;
  z-index: var(--z-overlay-filter, 15);
  top: var(--chrome-extension-row-top, 54px);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 3px;
  padding: 4px 6px;
  box-sizing: border-box;
  height: auto;
  min-height: var(--weather-filter-row-height);
  background: rgba(0, 0, 0, 0.62);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

#weatherFilter[hidden] {
  display: none !important;
}

#weatherFilter.scroll-menu-right {
  align-items: stretch;
}

#weatherFilter.scroll-menu-left {
  align-items: stretch;
}

.weather-filter-primary {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 3px;
  width: max-content;
  min-width: 0;
  max-width: 100%;
}

#weatherFilter.scroll-menu-right .weather-filter-primary {
  flex-direction: row-reverse;
  justify-content: flex-end;
  align-self: flex-end;
}

#weatherFilter.scroll-menu-left .weather-filter-primary {
  flex-direction: row;
  justify-content: flex-start;
  align-self: flex-start;
}

.weather-filter-search {
  all: unset;
  box-sizing: border-box;
  min-width: 56px;
  flex: 0 1 96px;
  max-width: 160px;
  height: 26px;
  padding: 0 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #eee;
  font: 12px/26px system-ui, sans-serif;
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-user-select: text;
  user-select: text;
}

.weather-filter-category {
  flex: 0 0 auto;
  height: 26px;
  min-width: 5.5em;
  width: max-content;
  max-width: none;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(30, 30, 30, 0.95);
  color: #eee;
  font: 12px system-ui, sans-serif;
  cursor: pointer;
  color-scheme: dark;
}

.weather-filter-search::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.weather-filter-chip-bulk {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  align-items: center;
}

#weatherFilter:not(.show-type-chips) .weather-filter-chip-bulk {
  display: none;
}

.weather-filter-bulk {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  font: 11px/1 system-ui, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.weather-filter-bulk:hover {
  background: rgba(255, 255, 255, 0.14);
}

.weather-filter-bulk-all {
  background: #c8c8c8;
  border-color: rgba(255, 255, 255, 0.55);
  color: #111;
  font-weight: 600;
}

.weather-filter-bulk-all:hover {
  background: #d6d6d6;
  color: #000;
}

.weather-filter-bulk:disabled {
  opacity: 0.42;
  cursor: default;
}

.weather-filter-types {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
  align-self: stretch;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior: contain;
}

.weather-filter-types::-webkit-scrollbar {
  display: none;
}

/* Menu-side origin: first chip (ET) sits at the menu edge; swipe to reveal the rest. */
#weatherFilter.scroll-menu-right .weather-filter-types {
  flex-direction: row;
  justify-content: flex-start;
  direction: rtl;
}

#weatherFilter.scroll-menu-left .weather-filter-types {
  flex-direction: row;
  justify-content: flex-start;
  direction: ltr;
}

#weatherFilter.scroll-menu-right .weather-filter-type {
  direction: ltr;
}

#weatherFilter:not(.show-type-chips) .weather-filter-types {
  display: none;
}

.weather-filter-types.is-disabled {
  opacity: 0.42;
}

.weather-filter-type {
  all: unset;
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-width: 40px;
  min-height: 28px;
  height: auto;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid color-mix(in srgb, var(--intensity-color, #aaa) 55%, transparent);
  color: var(--intensity-color, #eee);
  font: 600 10px/1.15 system-ui, sans-serif;
  text-align: center;
  cursor: pointer;
  background: color-mix(in srgb, var(--intensity-color, #aaa) 14%, transparent);
}

.weather-filter-type-line {
  display: block;
  white-space: nowrap;
}

.weather-filter-type:disabled {
  cursor: default;
}

.weather-filter-type.is-on {
  color: #111;
  border-color: var(--intensity-color, #fff);
  background: var(--intensity-color, #fff);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--intensity-color, #fff) 40%, transparent);
}

/* Portrait: scroller under the menu/filter row, full width */
#weatherScrollGallery.horizontal {
  top: auto;
  bottom: var(--bottom-scroller-clearance);
  left: 0;
  right: 0;
  height: min(84px, 18vh);
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
}

/* Landscape: same side as the menu, but only in the lower half. */
#weatherScrollGallery.vertical {
  width: min(114px, 34vw);
  top: calc(var(--chrome-extension-filter-row-bottom, 88px) + 8px);
  bottom: var(--bottom-scroller-clearance);
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y;
}

#weatherScrollGallery.vertical.scroll-menu-right {
  /* Match #weatherFilter exterior (menu-corner + 8px gap). */
  right: calc(var(--menu-corner-size, 56px) + 8px);
  left: auto;
}

#weatherScrollGallery.vertical.scroll-menu-left {
  left: calc(var(--menu-corner-size, 56px) + 8px);
  right: auto;
}

#weatherScrollGallery {
  padding: var(--weather-scroll-select-border);
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  cursor: grab;
  position: fixed;
  z-index: 20;
  /* Match .weather-filter-category outline — separate strip from date/time/speed */
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
}

#weatherScrollGallery::-webkit-scrollbar {
  display: none;
}

#weatherScrollGallery.dragging {
  cursor: grabbing;
}

#weatherScrollBox {
  display: flex;
  gap: var(--sky-scroll-gap, 5px);
}

#weatherScrollGallery.horizontal #weatherScrollBox {
  flex-direction: row;
  height: 100%;
  align-items: stretch;
}

#weatherScrollGallery.vertical #weatherScrollBox {
  flex-direction: column;
  width: 100%;
}

.weather-scroll-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  border: var(--weather-scroll-select-border) solid transparent;
  box-sizing: border-box;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-user-select: none;
  user-select: none;
  scroll-snap-align: center;
  text-align: left;
}

#weatherScrollGallery.scroll-menu-right .weather-scroll-card {
  text-align: right;
}

#weatherScrollGallery.scroll-menu-left .weather-scroll-card {
  text-align: left;
}

#weatherScrollGallery.horizontal .weather-scroll-card {
  height: 100%;
  min-width: 100px;
  max-width: 126px;
}

#weatherScrollGallery.vertical .weather-scroll-card {
  width: 100%;
  min-height: 68px;
}

.weather-scroll-card.is-selected {
  border-color: #fff;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--event-color, #5dade2) 60%, transparent);
}

.weather-scroll-card.is-disabled {
  /* Keep type/intensity hue; mute by darkening (no grayscale). */
  opacity: 1;
  cursor: grab;
  background: rgba(40, 40, 40, 0.55);
}

.weather-scroll-card.is-disabled .weather-scroll-name {
  filter: brightness(0.55);
}

.weather-scroll-card.is-disabled .weather-scroll-type,
.weather-scroll-card.is-disabled .weather-scroll-place,
.weather-scroll-card.is-disabled .weather-scroll-country,
.weather-scroll-card.is-disabled .weather-scroll-date {
  opacity: 0.55;
}

.weather-scroll-card.is-disabled.is-selected {
  border-color: color-mix(in srgb, var(--event-color, #5dade2) 45%, transparent);
  box-shadow: none;
}

.weather-scroll-name {
  font: 500 11px/1.15 system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-scroll-type,
.weather-scroll-place,
.weather-scroll-country,
.weather-scroll-date {
  font: 10px/1.2 system-ui, sans-serif;
  color: rgba(255, 255, 255, 0.75);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-scroll-type {
  color: rgba(255, 255, 255, 0.88);
}

.weather-scroll-place,
.weather-scroll-country,
.weather-scroll-date {
  color: rgba(255, 255, 255, 0.82);
}

/* Place / country may wrap on narrow vertical cards. */
.weather-scroll-place,
.weather-scroll-country {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.weather-scroll-place[hidden],
.weather-scroll-country[hidden],
.weather-scroll-type[hidden] {
  display: none;
}

/* Settings → Weather databases */
.settings-weather-catalogs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.settings-weather-catalogs-hint {
  margin: 0 0 4px;
  color: rgba(180, 180, 180, 0.85);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  line-height: 1.35;
}

.settings-weather-catalog-row {
  margin: 0;
}
