:root {
  color-scheme: light dark;
  --ink: #102033;
  --muted: #5d7288;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --line: rgba(20, 75, 130, 0.18);
  --shadow: 0 18px 42px rgba(12, 47, 92, 0.2);
  --accent: #1d8cf8;
  --accent-strong: #0956b6;
  --accent-soft: #e7f3ff;
  --spark: #ffcb05;
  --spark-strong: #f2a900;
  --danger: #ef4444;
  --app-bg: #dbeeff;
  --map-bg: #cfe7fb;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-bg-strong: rgba(255, 255, 255, 0.97);
  --panel-card: #f8fbff;
  --panel-card-soft: rgba(255, 255, 255, 0.72);
  --input-bg: #ffffff;
  --chip-bg: #e7f3ff;
  --control-bg: rgba(255, 255, 255, 0.92);
  --control-bg-hover: #ffffff;
  --button-bg: #1d8cf8;
  --button-shadow: #0956b6;
  --inverse-ink: #ffffff;
  --focus-ring: rgba(255, 203, 5, 0.32);
  --map-tile-filter: none;
  --legal-bg: #dbeeff;
  --placeholder-bg: #fff1f2;
  --placeholder-ink: #991b1b;
  --status-next-bg: rgba(255, 255, 255, 0.94);
  --status-near-bg: rgba(255, 250, 240, 0.95);
  --status-ok-bg: rgba(240, 253, 244, 0.95);
  --status-over-bg: rgba(255, 245, 245, 0.96);
  --status-next-ink: #4c1d95;
  --status-near-ink: #92400e;
  --status-ok-ink: #166534;
  --status-over-ink: #991b1b;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
.app-shell,
.map-stage,
#map {
  min-height: 100%;
  height: 100%;
}

.map-stage {
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--app-bg);
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-container {
  overflow: hidden;
  position: relative;
  touch-action: pan-x pan-y;
  font-family: inherit;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  width: 256px;
  height: 256px;
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 690;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-map-pane canvas,
.leaflet-map-pane svg {
  z-index: 200;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  float: left;
  clear: both;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-bottom.leaflet-left .leaflet-control-zoom {
  margin-bottom: max(34px, calc(env(safe-area-inset-bottom) + 34px));
}

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-right .leaflet-control {
  margin-right: 10px;
}

.leaflet-control-zoom {
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.12);
}

.leaflet-control-zoom a {
  display: block;
  width: 32px;
  height: 32px;
  color: #fff;
  text-align: center;
  text-decoration: none;
  line-height: 32px;
  font-size: 16px;
  font-weight: 700;
  background: #1d8cf8;
}

.leaflet-control-zoom a + a {
  border-top: 1px solid rgba(255, 255, 255, 0.32);
}

.leaflet-control-attribution {
  padding: 3px 7px;
  border-radius: 6px 0 0;
  background: rgba(255, 255, 255, 0.9);
}

.leaflet-control-attribution a {
  color: var(--accent-strong);
}

.leaflet-tooltip {
  position: absolute;
  padding: 7px 9px;
  border: 1px solid rgba(29, 140, 248, 0.24);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.12);
  white-space: nowrap;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: 100%;
  overflow: hidden;
}

.map-stage {
  position: relative;
  isolation: isolate;
}

.map-stage::before,
.map-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  pointer-events: none;
}

#map {
  z-index: 1;
  background: var(--map-bg);
}

.awaiting-location .map-stage {
  background:
    repeating-linear-gradient(36deg, rgba(9, 86, 182, 0.12) 0 1px, transparent 1px 74px),
    repeating-linear-gradient(126deg, rgba(15, 118, 110, 0.1) 0 1px, transparent 1px 86px),
    linear-gradient(145deg, #dff4ff 0%, #f8fcff 42%, #e8fff3 100%);
}

.awaiting-location .map-stage::before {
  display: block;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.48), transparent 42%, rgba(255, 255, 255, 0.52)),
    repeating-linear-gradient(0deg, transparent 0 56px, rgba(29, 140, 248, 0.09) 57px 58px),
    repeating-linear-gradient(90deg, transparent 0 56px, rgba(29, 140, 248, 0.09) 57px 58px);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.22));
}

.awaiting-location .map-stage::after {
  display: block;
  inset: auto 0 0;
  height: 38%;
  background: linear-gradient(to top, rgba(29, 140, 248, 0.14), transparent);
}

.awaiting-location #map,
.awaiting-location .topbar,
.awaiting-location .location-panel,
.awaiting-location .gps-return-button,
.awaiting-location .location-panel-toggle,
.awaiting-location .cell-panel-toggle,
.awaiting-location .weather-panel-toggle,
.awaiting-location .panel-toggle,
.awaiting-location .help-toggle,
.awaiting-location .help-panel,
.awaiting-location .about-panel,
.awaiting-location .cell-panel,
.awaiting-location .weather-panel,
.awaiting-location .control-panel,
.awaiting-location .leaflet-control-container {
  visibility: hidden;
}

.topbar {
  position: absolute;
  z-index: 500;
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 13px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 14px rgba(12, 47, 92, 0.13);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  text-align: left;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.brand:hover,
.brand:focus-visible {
  border-color: var(--spark);
  box-shadow: 0 8px 16px rgba(12, 47, 92, 0.14), 0 0 0 3px rgba(255, 203, 5, 0.32);
  transform: translateY(-1px);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  border: 3px solid #0956b6;
  background:
    radial-gradient(circle at 70% 30%, var(--spark) 0 10%, transparent 11%),
    linear-gradient(90deg, transparent 0 30%, rgba(9, 86, 182, 0.7) 31% 36%, transparent 37% 63%, rgba(9, 86, 182, 0.7) 64% 69%, transparent 70%),
    linear-gradient(0deg, transparent 0 30%, rgba(9, 86, 182, 0.7) 31% 36%, transparent 37% 63%, rgba(9, 86, 182, 0.7) 64% 69%, transparent 70%),
    radial-gradient(circle, #ffffff 0 58%, #e7f3ff 59% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.78),
    0 3px 0 rgba(16, 32, 51, 0.16);
}

.brand h1,
.brand p,
.panel-header h2,
.panel-header p,
.legend h2,
.legend p {
  margin: 0;
}

.brand h1 {
  color: #0956b6;
  font-size: 16px;
  line-height: 1.1;
}

.brand p {
  max-width: 36ch;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.about-panel {
  position: absolute;
  z-index: 525;
  top: max(82px, calc(env(safe-area-inset-top) + 82px));
  left: 12px;
  width: min(390px, calc(100vw - 24px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(12, 47, 92, 0.14);
  backdrop-filter: blur(18px);
  transition:
    opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
  max-height: min(76vh, 680px);
  overflow: auto;
}

.about-panel.is-collapsed {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.about-list,
.about-list dt,
.about-list dd {
  margin: 0;
}

.about-list {
  display: grid;
  gap: 8px;
}

.about-list > div {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(29, 140, 248, 0.14);
  border-radius: 8px;
  background: #f8fbff;
}

.about-list dt {
  color: #0956b6;
  font-size: 12px;
  font-weight: 600;
}

.about-list dd {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.about-list a {
  color: #0956b6;
  font-weight: 600;
  text-decoration: none;
}

.about-list a:hover,
.about-list a:focus-visible {
  text-decoration: underline;
}

.install-box {
  display: grid;
  gap: 7px;
}

.install-box button {
  min-height: 38px;
  width: fit-content;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: #1d8cf8;
  box-shadow: 0 3px 0 #0956b6;
  font-size: 12px;
  font-weight: 700;
}

.install-box button.is-hidden {
  display: none;
}

.install-box span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.version-info-row {
  align-items: start;
}

.version-info-row dd {
  display: flex;
  align-items: center;
}

.version-inline-button {
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  color: #0f766e;
  background: rgba(51, 209, 160, 0.16);
  font-size: 11px;
  font-weight: 600;
}

.version-inline-button::after {
  content: "⌄";
  margin-left: 6px;
  display: inline-block;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.version-inline-button[aria-expanded="true"]::after {
  transform: rotate(180deg);
}

.theme-info-row dd {
  min-width: 0;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(220px, 100%);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-card-soft);
}

.theme-switch label {
  min-width: 0;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-switch span {
  display: grid;
  min-height: 28px;
  place-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.theme-switch input:checked + span {
  color: var(--inverse-ink);
  background: var(--button-bg);
}

.changelog-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(29, 140, 248, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.changelog-list[hidden] {
  display: none;
}

.changelog-entry {
  display: grid;
  gap: 5px;
}

.changelog-entry h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.changelog-entry h3 span {
  color: var(--muted);
  font-weight: 700;
}

.changelog-entry ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.changelog-entry li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.changelog-entry li::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: #0956b6;
  opacity: 0.5;
}

.changelog-entry li span {
  min-width: 0;
  flex: 1;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: auto;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  flex: 0 0 36px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: #0956b6;
  background: #fff;
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.11);
  pointer-events: auto;
}

.icon-button span {
  font-size: 19px;
  line-height: 1;
}

.icon-button.compact {
  width: 34px;
  height: 34px;
  box-shadow: none;
}

.ghost {
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.panel-close-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  flex: 0 0 48px;
  border: 1px solid rgba(29, 140, 248, 0.18);
  border-radius: 8px;
  color: #0956b6;
  background: #f1f8ff;
  font-size: 24px;
  line-height: 1;
}

.location-consent {
  position: absolute;
  z-index: 530;
  top: 50%;
  left: 50%;
  width: min(340px, calc(100vw - 24px));
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 20px 18px 18px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(232, 248, 255, 0.93)),
    radial-gradient(circle at 18% 18%, rgba(255, 203, 5, 0.24), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(51, 209, 160, 0.22), transparent 28%);
  box-shadow: 0 8px 20px rgba(12, 47, 92, 0.16);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(18px);
}

.location-consent.is-hidden {
  display: none;
}

.location-consent p {
  margin: 0;
  color: #0956b6;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.location-consent span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.location-consent-logo {
  width: 58px;
  height: 58px;
  border: 4px solid #0956b6;
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 32%, var(--spark) 0 9%, transparent 10%),
    linear-gradient(90deg, transparent 0 29%, rgba(9, 86, 182, 0.68) 30% 36%, transparent 37% 63%, rgba(9, 86, 182, 0.68) 64% 70%, transparent 71%),
    linear-gradient(0deg, transparent 0 29%, rgba(9, 86, 182, 0.68) 30% 36%, transparent 37% 63%, rgba(9, 86, 182, 0.68) 64% 70%, transparent 71%),
    radial-gradient(circle, #ffffff 0 57%, #e7f3ff 58% 100%);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.75),
    0 8px 20px rgba(12, 47, 92, 0.18);
}

.location-consent div {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.location-consent button {
  min-height: 44px;
  border-radius: 8px;
  color: #fff;
  background: #1d8cf8;
  box-shadow: 0 4px 0 #0956b6;
  font-weight: 700;
}

.location-consent button + button {
  color: #102033;
  background: var(--spark);
  box-shadow: 0 4px 0 var(--spark-strong);
}

.location-panel {
  position: absolute;
  z-index: 518;
  top: max(82px, calc(env(safe-area-inset-top) + 82px));
  left: 12px;
  width: min(430px, calc(100vw - 24px));
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 6px 14px rgba(12, 47, 92, 0.13);
  backdrop-filter: blur(18px);
  transition:
    opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.location-panel.is-collapsed {
  visibility: hidden;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.location-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.location-panel-header span {
  color: #0956b6;
  font-size: 14px;
  font-weight: 700;
}

.gps-return-button,
.location-panel-toggle {
  position: absolute;
  z-index: 506;
  left: 12px;
  display: grid;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  color: #0956b6;
  background: #fff;
  box-shadow: 0 4px 12px rgba(12, 47, 92, 0.12);
}

.gps-return-button {
  top: max(90px, calc(env(safe-area-inset-top) + 90px));
  place-items: center;
}

.location-panel-toggle {
  top: max(142px, calc(env(safe-area-inset-top) + 142px));
  display: none;
}

.location-panel-toggle.is-visible {
  display: grid;
  place-items: center;
}

.gps-return-button::before {
  content: "";
  width: 21px;
  height: 21px;
  background: #0956b6;
  clip-path: polygon(50% 0, 87% 100%, 50% 78%, 13% 100%);
  transform: rotate(42deg) translate(1px, -1px);
  filter: drop-shadow(0 2px 0 rgba(12, 47, 92, 0.18));
}

.location-panel-toggle::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 13px;
  height: 13px;
  border: 2.5px solid #0956b6;
  border-radius: 50%;
}

.location-panel-toggle::after {
  content: "";
  position: absolute;
  top: 24px;
  left: 24px;
  width: 9px;
  height: 2.5px;
  border-radius: 999px;
  background: #0956b6;
  transform: rotate(45deg);
  transform-origin: left center;
}

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

.mode-switch label {
  min-width: 0;
}

.mode-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-switch span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(29, 140, 248, 0.18);
  border-radius: 8px;
  color: #5d7288;
  background: #f1f8ff;
  font-size: 13px;
  font-weight: 600;
}

.mode-switch input:checked + span {
  color: #fff;
  border-color: #0956b6;
  background: #1d8cf8;
}

.location-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
}

.location-row input {
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid rgba(29, 140, 248, 0.24);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.location-row button:not(.icon-button) {
  min-height: 42px;
  border-radius: 8px;
  color: #fff;
  background: #1d8cf8;
  box-shadow: 0 3px 0 #0956b6;
  font-weight: 700;
}

.location-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cell-panel-toggle,
.weather-panel-toggle,
.panel-toggle {
  position: absolute;
  z-index: 520;
  bottom: max(18px, env(safe-area-inset-bottom));
  min-width: 76px;
  min-height: 44px;
  border-radius: 8px;
  color: #0956b6;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(29, 140, 248, 0.28);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.12);
  font-size: 12px;
  font-weight: 600;
  backdrop-filter: blur(12px);
  transition: background 120ms ease, border-color 120ms ease;
}

.cell-panel-toggle:hover,
.weather-panel-toggle:hover,
.panel-toggle:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(29, 140, 248, 0.5);
}

.panel-toggle {
  right: 14px;
  width: 86px;
}

.cell-panel-toggle {
  right: 198px;
  width: 76px;
}

.weather-panel-toggle {
  right: 108px;
  width: 82px;
}

.help-toggle {
  position: absolute;
  z-index: 520;
  top: max(12px, env(safe-area-inset-top));
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: #0956b6;
  background: rgba(255, 255, 255, 0.92);
  border: 1.5px solid rgba(29, 140, 248, 0.28);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.12);
  font-size: 16px;
  font-weight: 600;
  backdrop-filter: blur(12px);
}

.help-panel {
  position: absolute;
  z-index: 515;
  right: 12px;
  bottom: 78px;
  width: min(372px, calc(100vw - 24px));
  max-height: min(64vh, 540px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(12, 47, 92, 0.14);
  backdrop-filter: blur(18px);
  transition:
    opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.help-panel.is-collapsed {
  visibility: hidden;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.cell-panel,
.weather-panel,
.control-panel {
  position: absolute;
  z-index: 510;
  right: 12px;
  bottom: 78px;
  width: min(372px, calc(100vw - 24px));
  max-height: min(72vh, 660px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 18px rgba(12, 47, 92, 0.14);
  backdrop-filter: blur(18px);
  transform: translateY(0);
  transition:
    opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    visibility 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cell-panel {
  z-index: 512;
  max-height: min(54vh, 390px);
}

.weather-panel {
  z-index: 512;
  max-height: min(42vh, 300px);
}

.cell-panel.is-collapsed,
.weather-panel.is-collapsed,
.control-panel.is-collapsed {
  visibility: hidden;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-header h2,
.legend h2 {
  color: #0956b6;
  font-size: 14px;
  letter-spacing: 0;
}

.panel-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.layer-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.layer-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 32px;
  gap: 8px;
  padding: 11px;
  border: 1px solid rgba(29, 140, 248, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.layer-toggle {
  display: grid;
  grid-template-columns: 20px 18px 1fr;
  gap: 9px;
  align-items: center;
  min-width: 0;
  font-weight: 700;
}

.layer-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 3px solid currentColor;
  background: color-mix(in srgb, currentColor 20%, transparent);
}

.layer-title {
  min-width: 0;
  font-size: 14px;
}

.info-button {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #0956b6;
  background: #e7f3ff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.layer-card.is-open .info-button {
  transform: rotate(180deg);
}

.layer-description {
  display: none;
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.layer-card.is-open .layer-description {
  display: block;
}

.weather-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid rgba(29, 140, 248, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.weather-controls h2,
.weather-controls p {
  margin: 0;
}

.weather-controls h2 {
  color: #0956b6;
  font-size: 14px;
}

.weather-controls p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.location-radius-control {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 9px;
  border: 1px solid rgba(29, 140, 248, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.location-radius-control strong,
.location-radius-control span {
  display: block;
}

.location-radius-control strong {
  color: var(--ink);
  font-size: 11.5px;
  line-height: 1.2;
}

.location-radius-control span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
}

.location-radius-control .switch-control {
  flex: 0 0 auto;
  transform: scale(0.82);
  transform-origin: right center;
}

.switch-control {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 66px;
  height: 38px;
}

.switch-control input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-control span {
  position: relative;
  width: 58px;
  height: 32px;
  border: 2px solid rgba(9, 86, 182, 0.2);
  border-radius: 999px;
  background: #d8e5f1;
  box-shadow: inset 0 2px 5px rgba(12, 47, 92, 0.14);
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.24);
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.switch-control input:checked + span {
  border-color: rgba(15, 118, 110, 0.38);
  background: #33d1a0;
}

.switch-control input:checked + span::after {
  transform: translateX(26px);
}

.switch-control input:focus-visible + span {
  outline: 3px solid rgba(29, 140, 248, 0.28);
  outline-offset: 3px;
}

.waypoint-controls {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(29, 140, 248, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.waypoint-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.waypoint-header > div:first-child {
  flex: 1;
  min-width: 0;
}

.waypoint-header-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.waypoint-icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  min-height: unset;
  border-radius: 8px;
  color: #0956b6;
  background: rgba(29, 140, 248, 0.08);
  border: 1px solid rgba(29, 140, 248, 0.16);
  box-shadow: none;
}

.waypoint-icon-btn:hover:not(:disabled) {
  background: rgba(29, 140, 248, 0.16);
}

.waypoint-icon-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.waypoint-icon-btn--danger {
  color: #854f0b;
  background: rgba(255, 203, 5, 0.12);
  border-color: rgba(242, 169, 0, 0.24);
}

.waypoint-icon-btn--danger:hover {
  background: rgba(255, 203, 5, 0.24);
}

.waypoint-controls h2,
.waypoint-controls p {
  margin: 0;
}

.waypoint-controls h2 {
  color: #0956b6;
  font-size: 13px;
}

.waypoint-controls p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.waypoint-import-summary {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(29, 140, 248, 0.16);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
}

.waypoint-import-summary[hidden] {
  display: none;
}

.waypoint-import-summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.waypoint-import-summary__head strong {
  color: var(--ink);
  font-size: 12px;
}

.waypoint-import-summary__head span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  text-align: right;
}

.waypoint-import-summary__head.is-ok strong {
  color: var(--status-ok-ink);
}

.waypoint-import-summary__head.is-mixed strong {
  color: var(--status-near-ink);
}

.waypoint-import-summary__head.is-error strong {
  color: var(--status-over-ink);
}

.waypoint-import-summary__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.waypoint-import-summary__grid span {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-card-soft);
  font-size: 10.5px;
  line-height: 1.2;
}

.waypoint-import-summary__grid b {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}

.waypoint-import-summary ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.waypoint-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px 16px;
  text-align: center;
}

.waypoint-empty-state[hidden] {
  display: none;
}

.waypoint-empty-state p {
  margin: 0;
  color: #0956b6;
  font-size: 13px;
  font-weight: 600;
}

.waypoint-empty-state span {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  max-width: 28ch;
}

.waypoint-visibility {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: 1px solid rgba(29, 140, 248, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.waypoint-visibility strong,
.waypoint-visibility span {
  display: block;
}

.waypoint-visibility strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.waypoint-visibility span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
}

.waypoint-visibility .switch-control {
  flex: 0 0 auto;
  transform: scale(0.86);
  transform-origin: right center;
}

.waypoint-controls input,
.waypoint-controls textarea,
.waypoint-controls select {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(29, 140, 248, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.waypoint-controls input,
.waypoint-controls select {
  min-height: 40px;
  padding: 0 10px;
}

.waypoint-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.waypoint-selects label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.waypoint-selects span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.waypoint-controls textarea {
  resize: vertical;
  min-height: 68px;
  padding: 9px 10px;
  line-height: 1.35;
}

.waypoint-actions {
  display: grid;
  gap: 8px;
}

.waypoint-controls button {
  min-height: 38px;
  border-radius: 8px;
  color: #fff;
  background: #1d8cf8;
  box-shadow: 0 3px 0 #0956b6;
  font-size: 11.5px;
  font-weight: 700;
}

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


.waypoint-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--tag-color, #1d8cf8);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.16);
  font-size: 13px;
  font-weight: 700;
  pointer-events: auto;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease;
}

.waypoint-marker.is-arena {
  background: var(--tag-color, #ef3b78);
}

.waypoint-marker.is-inactive {
  color: #e2e8f0;
  background: #94a3b8;
  opacity: 0.7;
}

.waypoint-marker.is-planned {
  color: #92400e;
  background: #fef3c7;
  border-color: #fbbf24;
  border-style: dashed;
  border-width: 2.5px;
}

.waypoint-marker.is-planned.is-arena {
  background: #fef3c7;
  border-color: #f59e0b;
}

.waypoint-marker.is-candidate {
  box-shadow:
    0 0 0 7px rgba(239, 68, 68, 0.46),
    0 0 0 16px rgba(239, 68, 68, 0.2),
    0 0 24px rgba(239, 68, 68, 0.42);
  animation: candidate-pulse 1.4s ease-in-out 3;
}

@keyframes candidate-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 7px rgba(239, 68, 68, 0.46),
      0 0 0 16px rgba(239, 68, 68, 0.2),
      0 0 24px rgba(239, 68, 68, 0.42);
  }
  50% {
    box-shadow:
      0 0 0 11px rgba(239, 68, 68, 0.58),
      0 0 0 24px rgba(239, 68, 68, 0.26),
      0 0 34px rgba(239, 68, 68, 0.52);
  }
}

.leaflet-marker-icon.is-moving-waypoint .waypoint-marker {
  transform: scale(1.2);
  box-shadow:
    0 0 0 7px rgba(29, 140, 248, 0.2),
    0 12px 28px rgba(12, 47, 92, 0.38);
}

.location-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: rgba(29, 140, 248, 0.18);
  box-shadow:
    0 0 0 8px rgba(29, 140, 248, 0.14),
    0 8px 22px rgba(12, 47, 92, 0.28);
}

.location-marker::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1d8cf8;
  box-shadow: inset 0 0 0 3px #fff;
}

.location-marker.has-heading::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 7px solid transparent;
  border-bottom: 16px solid #1d8cf8;
  border-left: 7px solid transparent;
  filter: drop-shadow(0 2px 2px rgba(12, 47, 92, 0.25));
  transform: translateX(-50%) rotate(var(--heading));
  transform-origin: 50% 25px;
}

.leaflet-marker-icon:hover .waypoint-marker,
.leaflet-marker-icon:focus .waypoint-marker {
  transform: scale(1.18);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.18);
}

#map.is-placing-waypoint {
  cursor: crosshair;
}

.waypoint-popup {
  display: grid;
  gap: 6px;
  min-width: 220px;
  max-width: min(270px, 80vw);
  max-height: min(430px, calc(100vh - 180px));
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}

.waypoint-name-field {
  display: grid;
}

.waypoint-name-field input {
  width: 100%;
  min-height: 32px;
  border: 1px solid rgba(29, 140, 248, 0.24);
  border-radius: 8px;
  padding: 5px 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.94);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.waypoint-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 2px;
  border: 1px solid rgba(29, 140, 248, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.waypoint-type-toggle label {
  display: grid;
  min-width: 0;
}

.waypoint-type-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.waypoint-type-toggle span {
  display: grid;
  place-items: center;
  min-height: 26px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.waypoint-type-toggle input:checked + span {
  color: #fff;
  background: #1d8cf8;
}

.waypoint-type-toggle input[value="arena"]:checked + span {
  background: #ef3b78;
}

.waypoint-popup span,
.waypoint-popup em {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.waypoint-popup em {
  color: #0956b6;
  font-style: normal;
  font-weight: 700;
}

.waypoint-planned-toggle,
.waypoint-planned-form-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}

.waypoint-planned-toggle input,
.waypoint-planned-form-toggle input {
  width: 14px;
  height: 14px;
  accent-color: #d97706;
  flex-shrink: 0;
  min-height: unset;
}

.waypoint-photo-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.waypoint-photo-fields label {
  display: grid;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}

.waypoint-photo-fields input {
  min-height: 28px;
  padding: 0 7px;
  border: 1px solid rgba(29, 140, 248, 0.2);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  width: 100%;
  min-width: 0;
}

.s14-planned-delta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--muted);
  padding-top: 5px;
  border-top: 1px solid rgba(29, 140, 248, 0.1);
}

.s14-planned-badge {
  font-size: 9.5px;
  font-weight: 600;
  color: #92400e;
  background: #fef9ec;
  border: 1px solid #f3d577;
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.s14-score-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(29, 140, 248, 0.1);
}

.s14-score-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.s14-candidate-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  min-width: 78px;
  height: 30px;
  border-radius: 8px;
  background: #ef4444;
  border: 1.5px solid #b91c1c;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, box-shadow 120ms, transform 120ms;
  padding: 0 12px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(185, 28, 28, 0.22);
}

.s14-candidate-chip:hover {
  background: #dc2626;
  border-color: #991b1b;
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.3);
  transform: translateY(-1px);
}

.s14-score-hint {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  margin: 0;
  padding-top: 5px;
  border-top: 1px solid rgba(29, 140, 248, 0.1);
}

.waypoint-popup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.waypoint-popup button {
  min-height: 30px;
  border-radius: 7px;
  color: #fff;
  background: #1d8cf8;
  font-size: 11px;
  font-weight: 600;
}

.waypoint-popup button[data-waypoint-action="save"] {
  grid-column: 1 / -1;
  min-height: 30px;
}

.waypoint-popup button[data-waypoint-action="delete"] {
  background: var(--danger);
}

.waypoint-tooltip {
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(14, 24, 40, 0.92);
  color: #fff;
  font-weight: 700;
  margin-top: -28px;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.34),
    0 2px 5px rgba(0, 0, 0, 0.2),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.waypoint-tooltip.leaflet-tooltip-top::before {
  border-top-color: rgba(14, 24, 40, 0.92);
}

.leaflet-popup-content-wrapper {
  border: 1px solid rgba(29, 140, 248, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 14px rgba(12, 47, 92, 0.13);
  backdrop-filter: blur(12px);
}

.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.97);
}

.leaflet-popup-content {
  margin: 10px 12px;
}

.leaflet-popup-close-button {
  color: var(--muted) !important;
  font-size: 18px !important;
  padding: 4px 6px !important;
}

.s14-cell-popup-wrapper .leaflet-popup-content-wrapper {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-bg-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: s14-popup-in 160ms ease-out;
}

.s14-cell-popup-wrapper .leaflet-popup-content {
  margin: 8px;
}

.s14-cell-popup-wrapper .leaflet-popup-tip {
  background: var(--panel-bg-strong);
}

.s14-cell-popup {
  display: grid;
  gap: 7px;
  width: 220px;
  max-height: min(360px, calc(100vh - 180px));
  overflow: auto;
  overscroll-behavior: contain;
  padding: 2px;
  color: var(--ink);
}

.s14-cell-popup > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.s14-cell-popup strong {
  font-size: 12px;
}

.s14-cell-popup span {
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.s14-cell-popup p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.4;
}

.s14-cell-popup dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0;
}

.s14-cell-popup dl div {
  display: grid;
  gap: 2px;
  padding: 5px 4px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-card);
}

.s14-cell-popup dt,
.s14-cell-popup dd {
  margin: 0;
  text-align: center;
}

.s14-cell-popup dt {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.s14-cell-popup dd {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.s14-cell-popup.is-near > div:first-child > span,
.s14-cell-popup.is-near > p {
  color: var(--status-near-ink);
}

.s14-cell-popup.is-ok > div:first-child > span,
.s14-cell-popup.is-full > div:first-child > span,
.s14-cell-popup.is-ok > p,
.s14-cell-popup.is-full > p {
  color: var(--status-ok-ink);
}

.s14-cell-popup.is-over > div:first-child > span,
.s14-cell-popup.is-over > p {
  color: var(--status-over-ink);
}

@keyframes s14-popup-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.legend {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.boost-list {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.help-panel .boost-list {
  overflow: auto;
  padding-top: 0;
  border-top: 0;
}

.help-section {
  padding: 10px;
  border: 1px solid rgba(29, 140, 248, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.help-section summary {
  cursor: pointer;
  color: #0956b6;
  font-size: 14px;
  font-weight: 700;
}

.help-section p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.boost-list h2,
.boost-list dl,
.boost-list dt,
.boost-list dd {
  margin: 0;
}

.boost-list h2 {
  font-size: 14px;
}

.boost-list dl {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.boost-list div {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.boost-list dt {
  color: #0956b6;
  font-size: 12px;
  font-weight: 600;
}

.boost-list dd {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.boost-list b {
  color: var(--ink);
  font-weight: 700;
}

.boost-list span {
  display: block;
}

.type-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-links a {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid rgba(29, 140, 248, 0.2);
  border-radius: 8px;
  color: #0956b6;
  background: #e7f3ff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.type-links a:hover,
.type-links a:focus-visible {
  border-color: var(--spark);
  background: #fff8d6;
  text-decoration: none;
}

.source-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.legend p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.s2-label {
  padding: 3px 7px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  color: #0956b6;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 8px rgba(12, 47, 92, 0.11);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.s2-label.is-weather {
  padding: 4px 9px;
  font-size: 11px;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 10px rgba(12, 47, 92, 0.14);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}

.s2-label.is-s14-status {
  display: inline-flex;
  min-width: 0;
  max-width: 58px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding-inline: 6px;
  border-color: rgba(124, 58, 237, 0.26);
  color: #4c1d95;
  background: rgba(255, 255, 255, 0.94);
  text-overflow: ellipsis;
  cursor: pointer;
}

.s2-label.is-s14-status.is-near {
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(255, 250, 240, 0.95);
}

.s2-label.is-s14-status.is-ok,
.s2-label.is-s14-status.is-full {
  color: #166534;
  border-color: rgba(34, 197, 94, 0.34);
  background: rgba(240, 253, 244, 0.95);
}

.s2-label.is-s14-status.is-over {
  color: #991b1b;
  border-color: rgba(239, 68, 68, 0.42);
  background: rgba(255, 245, 245, 0.96);
}

.leaflet-control-attribution {
  font-size: 10px;
}

.legal-page {
  min-height: 100%;
  height: auto;
  overflow: auto;
  background: #dbeeff;
}

.legal-document {
  width: min(820px, calc(100vw - 28px));
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 0 max(34px, env(safe-area-inset-bottom));
  color: var(--ink);
}

.legal-back {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 12px;
  border-radius: 8px;
  color: #fff;
  background: #1d8cf8;
  box-shadow: 0 4px 0 #0956b6;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.legal-card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(12, 47, 92, 0.13);
}

.legal-card h1,
.legal-card h2,
.legal-card p,
.legal-card ul {
  margin: 0;
}

.legal-card h1 {
  color: #0956b6;
  font-size: 28px;
  line-height: 1.1;
}

.legal-card h2 {
  margin-top: 6px;
  color: #0956b6;
  font-size: 17px;
}

.legal-card p,
.legal-card li {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.legal-card ul {
  padding-left: 20px;
}

.legal-card a {
  color: #0956b6;
  font-weight: 800;
}

.legal-placeholder {
  padding: 12px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  border-radius: 8px;
  color: #991b1b;
  background: #fff1f2;
}

@media (max-width: 700px) {
  .leaflet-bottom.leaflet-left .leaflet-control-zoom {
    margin-bottom: max(62px, calc(env(safe-area-inset-bottom) + 62px));
  }

  .topbar {
    align-items: flex-start;
  }

  .brand {
    max-width: calc(100vw - 82px);
  }

  .brand p {
    display: none;
  }

  .location-panel {
    top: max(114px, calc(env(safe-area-inset-top) + 114px));
    left: 10px;
    right: 10px;
    width: auto;
  }

  .about-panel {
    top: max(114px, calc(env(safe-area-inset-top) + 114px));
    left: 10px;
    right: 10px;
    width: auto;
  }

  .gps-return-button {
    top: max(122px, calc(env(safe-area-inset-top) + 122px));
    left: 10px;
  }

  .location-panel-toggle {
    top: max(174px, calc(env(safe-area-inset-top) + 174px));
    left: 10px;
  }

  .control-panel {
    left: 10px;
    right: 10px;
    bottom: 74px;
    width: auto;
    max-height: 56vh;
  }

  .cell-panel {
    left: 10px;
    right: 10px;
    bottom: 74px;
    width: auto;
  }

  .weather-panel {
    left: 10px;
    right: 10px;
    bottom: 74px;
    width: auto;
  }

  .help-panel {
    left: 10px;
    right: 10px;
    bottom: 74px;
    width: auto;
  }

  .cell-panel-toggle {
    right: auto;
    left: 54px;
    width: 76px;
    min-width: 76px;
  }

  .weather-panel-toggle {
    right: auto;
    left: 138px;
    width: 82px;
    min-width: 82px;
  }

  .panel-toggle {
    right: auto;
    left: 228px;
    width: 86px;
    min-width: 86px;
  }

  .help-toggle {
    top: max(12px, env(safe-area-inset-top));
    right: 10px;
    width: 44px;
    height: 44px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #d0e4f8;
    --muted: #7a9ab8;
    --surface: rgba(16, 26, 44, 0.96);
    --surface-solid: #111e2e;
    --line: rgba(100, 160, 230, 0.2);
    --accent-soft: rgba(29, 140, 248, 0.15);
    --accent-strong: #5ba3f5;
  }

  body { background: #0c1422; }
  #map { background: #0e1a2c; }

  .awaiting-location .map-stage {
    background: linear-gradient(145deg, #0d1a2e 0%, #0c1422 50%, #0c1e1a 100%);
  }

  .brand {
    background: rgba(14, 24, 40, 0.96);
    border-color: rgba(255, 255, 255, 0.1);
  }
  .brand h1 { color: #5ba3f5; }

  .about-panel,
  .location-panel,
  .cell-panel,
  .weather-panel,
  .control-panel {
    background: rgba(14, 24, 40, 0.97);
    border-color: rgba(255, 255, 255, 0.09);
  }

  .gps-return-button,
  .location-panel-toggle {
    background: rgba(14, 24, 40, 0.97);
    border-color: rgba(100, 160, 230, 0.25);
    color: #5ba3f5;
  }

  .cell-panel-toggle,
  .weather-panel-toggle,
  .panel-toggle {
    background: rgba(14, 24, 40, 0.92);
    border-color: rgba(100, 160, 230, 0.25);
    color: #5ba3f5;
  }

  .help-toggle {
    background: rgba(14, 24, 40, 0.92);
    border-color: rgba(100, 160, 230, 0.25);
    color: #5ba3f5;
  }

  .leaflet-control-zoom {
    background: #111e2e;
    border-color: rgba(255, 255, 255, 0.1);
  }
  .leaflet-control-zoom a { background: #1a3a62; }
  .leaflet-control-attribution {
    background: rgba(12, 20, 34, 0.85);
    color: var(--muted);
  }
  .leaflet-tooltip {
    background: rgba(14, 24, 40, 0.97);
    color: var(--ink);
    border-color: rgba(100, 160, 230, 0.2);
  }
  .leaflet-popup-content-wrapper {
    background: rgba(14, 24, 40, 0.98);
    border-color: rgba(100, 160, 230, 0.18);
  }
  .leaflet-popup-tip { background: rgba(14, 24, 40, 0.98); }
  .leaflet-popup-close-button { color: var(--muted) !important; }
  .s14-cell-popup-wrapper .leaflet-popup-content-wrapper {
    background: rgba(14, 24, 40, 0.98);
  }
  .s14-cell-popup-wrapper .leaflet-popup-tip { background: rgba(14, 24, 40, 0.98); }

  .panel-header h2 { color: #5ba3f5; }
  .panel-header p { color: var(--muted); }
  .panel-close-button { background: rgba(255, 255, 255, 0.06); border-color: rgba(100, 160, 230, 0.18); color: #5ba3f5; }

  .layer-card { background: rgba(255, 255, 255, 0.04); border-color: rgba(100, 160, 230, 0.15); }
  .layer-card .layer-title { color: var(--ink); }

  .location-consent {
    background: rgba(14, 24, 40, 0.98);
    border-color: rgba(255, 255, 255, 0.12);
  }
  .location-consent p { color: #5ba3f5; }

  .mode-switch span {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(100, 160, 230, 0.2);
    color: var(--muted);
  }
  .location-panel-header span { color: #5ba3f5; }
  .location-row input {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(100, 160, 230, 0.2);
    color: var(--ink);
  }
  .location-row button:not(.icon-button) { background: #1a3a62; box-shadow: 0 3px 0 #0c2545; }

  .waypoint-controls {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(100, 160, 230, 0.15);
  }
  .waypoint-controls h2 { color: #5ba3f5; }
  .waypoint-controls input,
  .waypoint-controls select,
  .waypoint-controls textarea {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(100, 160, 230, 0.2);
    color: var(--ink);
  }
  .waypoint-visibility {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(100, 160, 230, 0.15);
  }
  .waypoint-visibility strong { color: var(--ink); }

  .waypoint-empty-state p { color: #5ba3f5; }
  .waypoint-empty-state svg circle, .waypoint-empty-state svg line { stroke: rgba(91, 163, 245, 0.4); }
  .waypoint-empty-state svg circle:last-of-type { fill: #5ba3f5; }

  .waypoint-icon-btn { background: rgba(29, 140, 248, 0.1); border-color: rgba(100, 160, 230, 0.2); color: #5ba3f5; }
  .waypoint-icon-btn:hover:not(:disabled) { background: rgba(29, 140, 248, 0.18); }
  .waypoint-icon-btn--danger { background: rgba(217, 119, 6, 0.1); border-color: rgba(251, 191, 36, 0.2); color: #fbbf24; }

  .about-list > div { background: rgba(255, 255, 255, 0.04); border-color: rgba(100, 160, 230, 0.15); }
  .about-list dt { color: #5ba3f5; }
  .about-list a { color: #5ba3f5; }
  .about-list dd { color: var(--muted); }
  .version-inline-button { background: rgba(51, 209, 160, 0.1); border-color: rgba(15, 118, 110, 0.3); color: #34d399; }

  .install-box button { background: #1a3a62; box-shadow: 0 3px 0 #0c2545; }

  .help-section { background: rgba(255, 255, 255, 0.04); border-color: rgba(100, 160, 230, 0.15); }
  .help-section summary { color: #5ba3f5; }

  .s14-cell-popup { color: var(--ink); }
  .s14-cell-popup dl div { background: rgba(29, 140, 248, 0.1); border-color: rgba(100, 160, 230, 0.18); }
  .s14-cell-popup strong { color: var(--ink); }

  .weather-controls h2 { color: #5ba3f5; }

  .s2-label { background: rgba(14, 24, 40, 0.88) !important; color: #5ba3f5 !important; }
  .s2-label.is-weather { color: #fff !important; }

  .location-marker { background: rgba(29, 140, 248, 0.2); }

  .waypoint-planned-form-toggle { color: var(--muted); }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #d9ecff;
    --muted: #95abc2;
    --surface: rgba(15, 25, 42, 0.96);
    --surface-solid: #101b2c;
    --line: rgba(115, 176, 245, 0.22);
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
    --accent: #5ba3f5;
    --accent-strong: #84bfff;
    --accent-soft: rgba(91, 163, 245, 0.16);
    --spark: #ffd84d;
    --spark-strong: #c99700;
    --danger: #fb7185;
    --app-bg: #0c1422;
    --map-bg: #0e1a2c;
    --panel-bg: rgba(14, 24, 40, 0.96);
    --panel-bg-strong: rgba(14, 24, 40, 0.985);
    --panel-card: rgba(255, 255, 255, 0.045);
    --panel-card-soft: rgba(255, 255, 255, 0.065);
    --input-bg: rgba(255, 255, 255, 0.075);
    --chip-bg: rgba(91, 163, 245, 0.16);
    --control-bg: rgba(14, 24, 40, 0.92);
    --control-bg-hover: rgba(19, 35, 57, 0.98);
    --button-bg: #1a5b9e;
    --button-shadow: #0b315a;
    --inverse-ink: #ffffff;
    --focus-ring: rgba(255, 216, 77, 0.24);
    --map-tile-filter: brightness(0.68) contrast(1.14) saturate(0.78);
    --legal-bg: #0c1422;
    --placeholder-bg: rgba(127, 29, 29, 0.18);
    --placeholder-ink: #fecaca;
    --status-next-bg: rgba(124, 58, 237, 0.2);
    --status-near-bg: rgba(245, 158, 11, 0.16);
    --status-ok-bg: rgba(34, 197, 94, 0.14);
    --status-over-bg: rgba(239, 68, 68, 0.16);
    --status-next-ink: #c4b5fd;
    --status-near-ink: #fbbf24;
    --status-ok-ink: #86efac;
    --status-over-ink: #fca5a5;
  }
}

:root[data-theme="dark"] {
  --ink: #d9ecff;
  --muted: #95abc2;
  --surface: rgba(15, 25, 42, 0.96);
  --surface-solid: #101b2c;
  --line: rgba(115, 176, 245, 0.22);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
  --accent: #5ba3f5;
  --accent-strong: #84bfff;
  --accent-soft: rgba(91, 163, 245, 0.16);
  --spark: #ffd84d;
  --spark-strong: #c99700;
  --danger: #fb7185;
  --app-bg: #0c1422;
  --map-bg: #0e1a2c;
  --panel-bg: rgba(14, 24, 40, 0.96);
  --panel-bg-strong: rgba(14, 24, 40, 0.985);
  --panel-card: rgba(255, 255, 255, 0.045);
  --panel-card-soft: rgba(255, 255, 255, 0.065);
  --input-bg: rgba(255, 255, 255, 0.075);
  --chip-bg: rgba(91, 163, 245, 0.16);
  --control-bg: rgba(14, 24, 40, 0.92);
  --control-bg-hover: rgba(19, 35, 57, 0.98);
  --button-bg: #1a5b9e;
  --button-shadow: #0b315a;
  --inverse-ink: #ffffff;
  --focus-ring: rgba(255, 216, 77, 0.24);
  --map-tile-filter: brightness(0.68) contrast(1.14) saturate(0.78);
  --legal-bg: #0c1422;
  --placeholder-bg: rgba(127, 29, 29, 0.18);
  --placeholder-ink: #fecaca;
  --status-next-bg: rgba(124, 58, 237, 0.2);
  --status-near-bg: rgba(245, 158, 11, 0.16);
  --status-ok-bg: rgba(34, 197, 94, 0.14);
  --status-over-bg: rgba(239, 68, 68, 0.16);
  --status-next-ink: #c4b5fd;
  --status-near-ink: #fbbf24;
  --status-ok-ink: #86efac;
  --status-over-ink: #fca5a5;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"],
:root.is-dark-theme {
  color-scheme: dark;
}

.leaflet-tile-pane {
  filter: var(--map-tile-filter);
}

.brand,
.about-panel,
.location-panel,
.help-panel,
.cell-panel,
.weather-panel,
.control-panel,
.leaflet-popup-content-wrapper,
.leaflet-tooltip {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.leaflet-popup-tip {
  background: var(--panel-bg);
}

.about-list > div,
.changelog-list,
.layer-card,
.weather-controls,
.waypoint-controls,
.waypoint-visibility,
.location-radius-control,
.help-section,
.s14-cell-popup dl div,
.waypoint-type-toggle,
.s14-cell-popup-wrapper .leaflet-popup-content-wrapper,
.legal-card {
  border-color: var(--line);
  background: var(--panel-card);
}

.s14-cell-popup-wrapper .leaflet-popup-tip {
  background: var(--panel-card);
}

.s14-cell-popup-wrapper .leaflet-popup-content-wrapper {
  background: var(--panel-bg-strong);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.s14-cell-popup-wrapper .leaflet-popup-tip {
  background: var(--panel-bg-strong);
}

.location-row input,
.waypoint-controls input,
.waypoint-controls textarea,
.waypoint-controls select,
.waypoint-name-field input,
.waypoint-photo-fields input {
  color: var(--ink);
  border-color: var(--line);
  background: var(--input-bg);
}

.cell-panel-toggle,
.weather-panel-toggle,
.panel-toggle,
.help-toggle,
.gps-return-button,
.location-panel-toggle,
.panel-close-button,
.icon-button,
.leaflet-control-attribution {
  color: var(--accent-strong);
  border-color: var(--line);
  background: var(--control-bg);
}

.cell-panel-toggle:hover,
.weather-panel-toggle:hover,
.panel-toggle:hover,
.help-toggle:hover,
.gps-return-button:hover,
.location-panel-toggle:hover,
.panel-close-button:hover {
  background: var(--control-bg-hover);
}

.leaflet-control-zoom {
  border-color: var(--line);
  background: var(--panel-bg);
}

.leaflet-control-zoom a,
.location-row button:not(.icon-button),
.location-consent button,
.install-box button,
.waypoint-popup button,
.waypoint-actions button,
.legal-back {
  color: var(--inverse-ink);
  background: var(--button-bg);
  box-shadow: 0 3px 0 var(--button-shadow);
}

.brand h1,
.about-list dt,
.about-list a,
.panel-header h2,
.legend h2,
.location-panel-header span,
.location-consent p,
.waypoint-controls h2,
.weather-controls h2,
.help-section summary,
.boost-list dt,
.type-links a,
.s14-cell-popup span,
.waypoint-popup em,
.legal-card h1,
.legal-card h2,
.legal-card a {
  color: var(--accent-strong);
}

.gps-return-button::before,
.location-panel-toggle::after {
  background: var(--accent-strong);
}

.location-panel-toggle::before {
  border-color: var(--accent-strong);
}

.brand-mark,
.location-consent-logo {
  border-color: var(--accent-strong);
  background:
    radial-gradient(circle at 70% 30%, var(--spark) 0 10%, transparent 11%),
    linear-gradient(90deg, transparent 0 30%, color-mix(in srgb, var(--accent-strong) 70%, transparent) 31% 36%, transparent 37% 63%, color-mix(in srgb, var(--accent-strong) 70%, transparent) 64% 69%, transparent 70%),
    linear-gradient(0deg, transparent 0 30%, color-mix(in srgb, var(--accent-strong) 70%, transparent) 31% 36%, transparent 37% 63%, color-mix(in srgb, var(--accent-strong) 70%, transparent) 64% 69%, transparent 70%),
    radial-gradient(circle, var(--surface-solid) 0 58%, var(--accent-soft) 59% 100%);
}

.location-consent {
  border-color: var(--line);
  background:
    radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--spark) 18%, transparent), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(51, 209, 160, 0.14), transparent 28%),
    var(--panel-bg-strong);
}

.location-consent button + button {
  color: #102033;
  background: var(--spark);
  box-shadow: 0 3px 0 var(--spark-strong);
}

.mode-switch span,
.type-links a,
.info-button,
.s2-label {
  color: var(--accent-strong);
  border-color: var(--line);
  background: var(--chip-bg);
}

.mode-switch input:checked + span,
.waypoint-type-toggle input:checked + span {
  color: var(--inverse-ink);
  border-color: var(--button-bg);
  background: var(--button-bg);
}

.switch-control span {
  border-color: var(--line);
  background: color-mix(in srgb, var(--muted) 28%, transparent);
}

.switch-control span::after {
  background: var(--surface-solid);
}

.switch-control input:checked + span {
  border-color: rgba(51, 209, 160, 0.44);
  background: #33d1a0;
}

.waypoint-icon-btn {
  color: var(--accent-strong);
  border-color: var(--line);
  background: var(--accent-soft);
}

.waypoint-icon-btn--danger {
  color: var(--spark-strong);
  border-color: color-mix(in srgb, var(--spark) 32%, transparent);
  background: color-mix(in srgb, var(--spark) 14%, transparent);
}

.waypoint-type-toggle input[value="arena"]:checked + span,
.waypoint-marker.is-arena,
.waypoint-popup button[data-waypoint-action="delete"] {
  color: var(--inverse-ink);
  background: #ef3b78;
}

.waypoint-marker {
  border-color: var(--surface-solid);
}

.waypoint-marker.is-inactive {
  color: #e2e8f0;
  background: #64748b;
}

.waypoint-marker.is-planned,
.s14-planned-badge {
  color: #92400e;
  border-color: #f59e0b;
  background: #fef3c7;
}

.s14-candidate-chip {
  color: #fff;
  border-color: #fb7185;
  background: #e11d48;
}

.s2-label.is-s14-status {
  color: var(--status-next-ink);
  border-color: color-mix(in srgb, var(--status-next-ink) 38%, transparent);
  background: var(--status-next-bg);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--panel-bg-strong) 72%, transparent),
    0 6px 16px rgba(0, 0, 0, 0.22);
}

.s2-label.is-s14-status.is-near {
  color: var(--status-near-ink);
  border-color: color-mix(in srgb, var(--status-near-ink) 42%, transparent);
  background: var(--status-near-bg);
}

.s2-label.is-s14-status.is-ok,
.s2-label.is-s14-status.is-full {
  color: var(--status-ok-ink);
  border-color: color-mix(in srgb, var(--status-ok-ink) 42%, transparent);
  background: var(--status-ok-bg);
}

.s2-label.is-s14-status.is-over {
  color: var(--status-over-ink);
  border-color: color-mix(in srgb, var(--status-over-ink) 42%, transparent);
  background: var(--status-over-bg);
}

.legal-page {
  background: var(--legal-bg);
}

.legal-placeholder {
  color: var(--placeholder-ink);
  background: var(--placeholder-bg);
}

:root.is-dark-theme .waypoint-empty-state svg circle,
:root.is-dark-theme .waypoint-empty-state svg line {
  stroke: rgba(132, 191, 255, 0.45);
}

:root.is-dark-theme .waypoint-empty-state svg circle:last-of-type {
  fill: var(--accent-strong);
}

/* Inline-Text-Button für Status-Meldungen (z.B. Wetter-Retry, Export-Warnung) */
.inline-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent, #0ea5e9);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
}
.inline-link:hover {
  opacity: 0.8;
}

/* ── Tag-Chips ─────────────────────────────────────────── */
.waypoint-tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}

.tag-chip {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1.5px solid var(--tag-color, var(--border));
  background: transparent;
  color: var(--tag-color, var(--text-secondary));
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.tag-chip.is-active {
  background: var(--tag-color, var(--accent));
  color: #fff;
  border-color: transparent;
}

/* ── Waypoint Tag-Input (Formular & Popup) ─────────────── */
#waypointTagInput,
.waypoint-tag-field input {
  width: 100%;
  box-sizing: border-box;
}

.waypoint-tag-field {
  display: block;
  margin-top: 6px;
}

/* ── Highscore-Button ──────────────────────────────────── */
.highscore-toggle {
  position: absolute;
  bottom: calc(var(--safe-bottom, 0px) + 136px);
  right: 14px;
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

/* ── Highscore-Panel ───────────────────────────────────── */
.highscore-panel {
  position: absolute;
  bottom: calc(var(--safe-bottom, 0px) + 180px);
  right: 60px;
  z-index: 1001;
  width: min(340px, calc(100vw - 32px));
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  padding-bottom: 12px;
  transition: opacity 160ms, transform 160ms;
}

.highscore-panel.is-collapsed {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.highscore-tabs {
  display: flex;
  gap: 6px;
  padding: 4px 16px 10px;
}

.highscore-tab {
  flex: 1;
  padding: 5px 0;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.highscore-tab.is-active {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

.highscore-list {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.highscore-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.highscore-rank {
  font-size: 18px;
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

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

.highscore-name {
  font-weight: 700;
  font-size: 14px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.highscore-bar-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.highscore-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 300ms ease;
}

.highscore-count {
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text);
}

.highscore-empty {
  color: var(--text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 12px 0;
}

/* ── Highscore Filter-Interaktion ──────────────────────── */
.highscore-row {
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 6px;
  margin: 0 -6px;
  transition: background 120ms;
}
.highscore-row:hover {
  background: var(--surface-hover, rgba(0,0,0,.05));
}
.highscore-row.is-filtered {
  background: var(--surface-hover, rgba(0,0,0,.07));
  outline: 1.5px solid var(--border);
}
.highscore-filter-icon {
  font-size: 13px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Waypoint-Bild (experimentell) ────────────────────── */
.waypoint-image-section {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.waypoint-image-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 6px;
  display: block;
}
.waypoint-image-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.waypoint-image-search-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.waypoint-image-search-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.waypoint-image-remove-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}
.waypoint-image-results {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.image-result-thumb {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 6px;
  overflow: hidden;
  width: calc(33% - 4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  transition: outline 100ms;
}
.image-result-thumb img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 6px;
}
.image-result-thumb:hover {
  outline: 2px solid var(--accent);
}
.image-search-status {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}
