/* The original #map-v rule outranks the generic .view height, making the map taller than other views. */
#map-v {
  position: relative;
  height: calc(100vh - 100px - var(--header-extra));
  /* The height actually visible on a phone: 100vh counts the address bar too. */
  height: calc(100dvh - 100px - var(--header-extra));
  width: 100%;
}

.map-root {
  height: 100%;
  /* The aircraft card is positioned against this, so "96px from the top" means 96px below the map rather than below
     whichever ancestor happened to be positioned - which was .view, 40px taller, so the card ran into the credits. */
  position: relative;
}

#map {
  height: 100%;
  width: 100%;
  background: var(--c-black);
}

.plane-icon {
  background: none !important;
  border: none !important;
}

/* Your own saved location: a pin, so it can't be mistaken for one of the aircraft dots around it. */
.home-marker {
  background: none !important;
  border: none !important;
}

.home-marker-pin {
  display: block;
  font-size: 15px;
  line-height: 20px;
  text-align: center;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.95));
}

/* An airport's details in its map popup, so you don't have to leave the map to read them. */
.apt-popup-fact {
  margin-top: 4px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--c-grey-aaa);
}

.apt-popup-fact span {
  color: var(--c-amber);
  font-weight: bold;
}

.apt-popup-metar {
  margin-top: 6px;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  line-height: 1.35;
  color: var(--c-white);
  background: rgba(46, 213, 255, 0.05);
  border-left: 2px solid var(--c-cyan);
  word-break: break-word;
}

.plane-wrapper {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-ping {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.4;
  z-index: 1;
}

.pulse {
  animation: radar-pulse 2.5s infinite ease-out !important;
}

.emergency-pulse {
  animation: radar-pulse 0.9s infinite ease-out !important;
}

@keyframes radar-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(3.2); opacity: 0; }
}

.plane-svg-box {
  position: absolute;
  z-index: 2;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The plane you picked: a halo and a place above the others, on top of the white it is drawn in. */
.plane-wrapper--selected {
  z-index: 5;
  filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.85));
}

.plane-wrapper--selected .plane-datatag {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
}

.plane-datatag {
  position: absolute;
  left: 28px;
  top: -5px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid rgba(46, 213, 255, 0.4);
  border-left: 2px solid;
  padding: 2px 4px;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: bold;
  white-space: nowrap;
  border-radius: 2px;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.5px;
  transition: all 0.3s ease;
}

.tag-callsign {
  font-size: 0.62rem;
  letter-spacing: 0.5px;
}

.tag-altitude {
  opacity: 0.8;
  font-size: 0.5rem;
}

.leaflet-popup-content-wrapper {
  background: var(--c-grey-0a0a0a);
  color: var(--c-cyan);
  border: 1px solid var(--c-amber);
  border-radius: 2px;
  /* Room for the route codes and the three columns of figures, while still fitting a small phone. */
  width: min(300px, calc(100vw - 52px));
}

.leaflet-popup-content {
  margin: 12px 14px !important;
  width: auto !important;
}

.apt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  /* A white ring inside a thin dark outline: the pair shows on a dark map, a light one, fields on satellite and a
     street map full of coloured roads. The old glow only worked on dark. */
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.95), 0 0 0 4px rgba(0, 0, 0, 0.28), 0 2px 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.apt-dot {
  position: relative;
}

/* The chart symbols on top of the colour (map_controller's AIRPORT_SHAPES). */
.apt-dot--airport::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 78%;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.apt-dot--heliport::after,
.apt-dot--seaplane::after {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font: 700 8px/1 var(--font-mono);
}

.apt-dot--heliport::after {
  content: "H";
}

.apt-dot--seaplane::after {
  content: "S";
}

/* An airport's code beside its dot: hidden until the map is zoomed in far enough to read it (apt-labels-on). */
.leaflet-tooltip.apt-label {
  display: none;
  padding: 1px 4px;
  background: rgba(10, 10, 10, 0.82);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  box-shadow: none;
  font: 700 0.6rem/1.3 var(--font-mono);
  letter-spacing: 0.5px;
}

.leaflet-tooltip.apt-label::before {
  display: none;
}

.apt-labels-on .leaflet-tooltip.apt-label {
  display: block;
}

/* Airfields and heliports: only from MINOR_LABEL_ZOOM, and a touch quieter than the airports. */
.apt-labels-on .leaflet-tooltip.apt-label--minor {
  display: none;
}

.apt-minor-labels-on .leaflet-tooltip.apt-label--minor {
  display: block;
  font-weight: 400;
  opacity: 0.9;
}

/* The key to the dots, folded away in the map's corner. */
.apt-key {
  background: rgba(0, 0, 0, 0.85);
  color: var(--c-white);
  border: 1px solid var(--c-grey-444);
  border-radius: 4px;
  padding: 4px 8px;
  font: 0.68rem/1.4 var(--font-mono);
}

.apt-key summary {
  cursor: pointer;
  color: var(--c-cyan);
  font-weight: bold;
  list-style: none;
}

.apt-key ul {
  margin: 6px 0 2px;
  padding: 0;
  list-style: none;
}

.apt-key li {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 3px 0;
}

.apt-key-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: none;
}

.apt-key-runway {
  display: inline-block;
  width: 16px;
  height: 5px;
  background: #4b5563;
  border: 1px solid #000000;
  flex: none;
}

.apt-key-runway--estimated {
  background: #6b7280;
  border-color: rgba(0, 0, 0, 0.4);
  opacity: 0.7;
}

.apt-key-pin {
  width: 16px;
  text-align: center;
  flex: none;
}

.apt-popup-name {
  color: var(--c-white);
}

.apt-popup-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  vertical-align: -1px;
}

.apt-icon {
  background: none !important;
  border: none !important;
}

#map-search-container {
  position: absolute;
  top: 10px;
  left: 10px;
  /* Never wider than the map, and wraps onto another row rather than running off the edge: with the newer buttons the
     toolbar outgrew a tablet's width and a phone held sideways, where the last of them were clipped. */
  max-width: calc(100% - 20px);
  /* Above the aircraft markers (600) but below Leaflet's popups (700), so an open popup is never hidden behind it. */
  z-index: 650;
  display: flex;
  flex-wrap: wrap;
  row-gap: 5px;
  gap: 0;
  background: rgba(0, 0, 0, 0.85);
  padding: 5px;
  border: 1px solid var(--c-grey-333);
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

#map-search-input {
  background: var(--c-grey-0a0a0a) !important;
  border: 1px solid var(--c-grey-444) !important;
  color: var(--c-cyan-bright) !important;
  font-family: var(--font-mono) !important;
  padding: 8px 12px !important;
  outline: none !important;
  width: 130px;
  border-radius: 0 !important;
  text-transform: uppercase;
}

#map-search-input:focus {
  border-color: var(--c-cyan-bright) !important;
  box-shadow: inset 0 0 5px rgba(0, 242, 255, 0.5);
}

.map-btn {
  background: var(--c-grey-1a1a1a) !important;
  border: 1px solid var(--c-grey-444) !important;
  border-left: none !important;
  color: var(--c-grey-aaa) !important;
  font-family: var(--font-mono) !important;
  padding: 8px 15px !important;
  cursor: pointer !important;
  border-radius: 0 !important;
  transition: all 0.2s;
}

/* Phones: the search box and FIND share the first row, and the other buttons and the receiver filter wrap below. */
@media (max-width: 640px) {
  #map-search-container {
    right: 10px;
    flex-wrap: wrap;
    row-gap: 5px;
  }

  #map-search-input {
    flex: 1 1 55%;
    width: auto;
    min-width: 0;
    padding: 6px 8px !important;
    font-size: 0.8rem !important;
  }

  /* The receiver filter shares the second row with the small buttons instead of taking a whole row to itself. */
  #map-search-container > :not(#map-search-input):not(.map-btn) {
    flex: 0 1 auto;
    min-width: 0;
  }

  #map-search-container .airport-filter select,
  #map-search-container .receiver-filter select {
    max-width: 8.5rem;
    padding: 4px 6px;
    font-size: 0.72rem;
  }

  /* The map credits (which OpenStreetMap and OpenTopoMap require) wrap right across a phone's width and covered the
     airport KEY in the bottom-left corner. Kept to the right-hand side they wrap onto more lines but stay readable,
     and the key has its corner back. */
  .leaflet-control-attribution {
    max-width: 62vw;
  }

  /* A plane's or airport's card gets the whole map: the search bar and layer button step aside until it closes. */
  .map-popup-open #map-search-container,
  .map-popup-open .leaflet-control-layers,
  .map-card-open #map-search-container,
  .map-card-open .leaflet-control-layers {
    display: none;
  }

  /* The layer button sits below the two-row search box (more specific than the general rule further down). */
  .leaflet-container .leaflet-top.leaflet-left {
    margin-top: 96px !important;
  }

  #map-search-container .map-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
  }
}

#find-btn:hover {
  background: var(--c-cyan-bright) !important;
  color: var(--c-black) !important;
  box-shadow: 0 0 10px var(--c-cyan-bright);
}

#boh-btn:hover {
  background: var(--c-amber) !important;
  color: var(--c-black) !important;
  box-shadow: 0 0 10px var(--c-amber);
}

.leaflet-control-layers {
  background: rgba(0, 0, 0, 0.85) !important;
  border: 1.5px solid var(--c-cyan) !important;
  border-radius: 4px !important;
  color: var(--c-white) !important;
  font-family: var(--font-mono) !important;
  box-shadow: 0 0 15px rgba(46, 213, 255, 0.3) !important;
  transition: all 0.3s ease;
}

.leaflet-control-layers-toggle {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2300f2ff'><path d='M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/></svg>") !important;
  background-size: 26px 26px !important;
  background-position: center !important;
  width: 36px !important;
  height: 36px !important;
}

.leaflet-control-layers-expanded {
  padding: 10px !important;
  background: rgba(0, 0, 0, 0.92) !important;
  border-color: var(--c-pink) !important;
  box-shadow: 0 0 20px rgba(255, 0, 255, 0.4) !important;
}

.leaflet-control-layers-selector {
  accent-color: var(--c-cyan) !important;
  margin-right: 6px !important;
  cursor: pointer;
}

.leaflet-control-layers-base label {
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.75rem;
}

.leaflet-control-layers-base label:last-child {
  margin-bottom: 0;
}

.leaflet-top.leaflet-left {
  margin-top: 65px !important;
  margin-left: 2px !important;
}

#cockpit-hud {
  position: absolute;
  bottom: 25px;
  left: 15px;
  background: rgba(0, 0, 0, 0.85);
  border: 2px solid var(--c-green);
  border-radius: 6px;
  padding: 12px;
  font-family: monospace;
  color: var(--c-green);
  z-index: 1000;
  box-shadow: 0 0 15px rgba(85, 255, 0, 0.25);
  pointer-events: none;
  transition: all 0.3s ease;
  display: flex;
  min-width: 270px;
  flex-direction: column;
  gap: 8px;
}

#cockpit-hud[hidden] {
  display: none;
}

.hud-title {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid rgba(85, 255, 0, 0.4);
  padding-bottom: 4px;
  font-weight: bold;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
}

#hud-callsign {
  color: var(--c-cyan);
}

.hud-dials {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin: 8px 0;
  gap: 8px;
}

.hud-dial-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hud-dial {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  border: 2px solid;
  background: var(--c-black);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hud-dial--speed { border-color: var(--c-yellow); }
.hud-dial--alt { border-color: var(--c-cyan); }

.hud-dial--horizon {
  border-color: var(--c-green);
  background: #002200;
  overflow: hidden;
}

.hud-hand {
  position: absolute;
  width: 2px;
  height: 20px;
  top: 7px;
  transform-origin: bottom center;
  transform: rotate(0deg);
  transition: all 0.5s;
}

.hud-hand--speed {
  background: var(--c-yellow);
  filter: drop-shadow(0 0 2px var(--c-yellow));
}

.hud-hand--alt {
  background: var(--c-cyan);
  filter: drop-shadow(0 0 2px var(--c-cyan));
}

.hud-dial-text {
  font-size: 0.6rem;
  font-weight: bold;
  z-index: 5;
  background: rgba(0, 0, 0, 0.85);
  padding: 1px 2px;
  border-radius: 2px;
}

.hud-dial-text--speed { color: var(--c-yellow); }
.hud-dial-text--alt { color: var(--c-cyan); }

.hud-dial-label {
  font-size: 0.5rem;
  color: var(--c-grey-aaa);
  font-weight: bold;
  letter-spacing: 0.5px;
}

#hud-horizon-sky {
  position: absolute;
  width: 90px;
  height: 90px;
  background: #004400;
  border-bottom: 1px solid var(--c-green);
  top: -45px;
  left: -17px;
  transform: rotate(0deg) translateY(0px);
  transition: all 0.5s;
}

.hud-horizon-wing {
  position: absolute;
  width: 12px;
  height: 2px;
  background: var(--c-pink);
  z-index: 5;
  filter: drop-shadow(0 0 2px var(--c-pink));
}

.hud-horizon-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--c-pink);
  z-index: 5;
}

.hud-horizon-tip {
  position: absolute;
  width: 3px;
  height: 2px;
  background: var(--c-pink);
  z-index: 5;
}

.hud-horizon-tip--left { left: 12px; }
.hud-horizon-tip--right { right: 12px; }

.hud-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  color: var(--c-grey-aaa);
  border-top: 1px dashed rgba(85, 255, 0, 0.2);
  padding-top: 4px;
  margin-top: 2px;
}

#hud-vs-text { color: var(--c-green); }
#hud-hdg-text { color: var(--c-white); }

/* Plane details in the map popup: photo, maker, operator, sightings, a fact and the SPOTTER link. */
.plane-popup-extra {
  margin-top: 6px;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--c-grey-aaa);
}

.plane-popup-loading {
  font-style: italic;
}

.plane-popup-photo {
  position: relative;
  display: block;
  max-width: 260px;
  margin: 2px 0 6px;
}

.plane-popup-photo img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: 100px;
  object-fit: cover;
  border-radius: 3px;
}

.plane-popup-photo--none img {
  object-fit: contain;
  background: var(--c-grey-050505);
}

.plane-popup-credit {
  display: block;
  margin-top: 2px;
  font-size: 0.58rem;
  color: var(--c-grey-aaa);
}

/* ‹ › arrows and a counter over a plane photo, in the map popup and on the life story page. */
.photo-arrow {
  position: absolute;
  top: 50px;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(5, 13, 32, 0.75);
  color: #ffffff;
  font-size: 18px;
  line-height: 26px;
  text-align: center;
  cursor: pointer;
}

.photo-arrow--previous { left: 4px; }
.photo-arrow--next { right: 4px; }

.photo-count {
  position: absolute;
  top: 4px;
  right: 4px;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(5, 13, 32, 0.75);
  color: #ffffff;
  font-size: 0.6rem;
}

.plane-popup-fact {
  margin-top: 6px;
  padding: 4px 6px;
  border: 1px dashed currentColor;
  border-radius: 3px;
  font-size: 0.66rem;
  line-height: 1.35;
  color: var(--c-cyan);
}

.plane-popup-spotter {
  display: block;
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px solid var(--c-amber);
  border-radius: 3px;
  color: var(--c-amber);
  font-size: 0.66rem;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
}

.plane-popup-flights {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--c-grey-222);
}

.plane-popup-flights-title {
  color: var(--c-amber);
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.5px;
}

.plane-popup-flights ol {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.66rem;
  line-height: 1.5;
  color: var(--c-grey-aaa);
}

.plane-popup-flight-when {
  color: var(--c-white);
  font-family: monospace;
}

.apt-popup-place {
  margin-top: 4px;
  color: var(--c-grey-aaa);
  font-size: 0.7rem;
}

.apt-popup-web {
  margin-top: 6px;
  font-size: 0.7rem;
}

.apt-popup-web a {
  color: var(--c-cyan);
}

.plane-popup-story {
  margin-top: 4px;
  border-color: var(--c-cyan);
  color: var(--c-cyan);
}

/* Radar sweeper rotation (toggled from CONFIG). */
@keyframes radar-sweep-anim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-sweeper-active {
  animation: radar-sweep-anim 8s linear infinite !important;
}

@media (max-width: 768px) {
  #cockpit-hud {
    left: 4%;
    right: 4%;
    width: 92%;
    bottom: 15px;
    min-width: auto;
    padding: 8px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.6);
  }

  .hud-dial {
    width: 48px;
    height: 48px;
  }

  #hud-horizon-sky {
    width: 78px;
    height: 78px;
    left: -15px;
    top: -39px;
  }
}

/* Touch screens: no blurred glow on every plane and airport. A blur is redrawn for each of them whenever the map moves,
   hundreds at a time with the airports on, and on a phone that is the stutter. The rings and outlines that make them
   stand out are sharp edges and stay; the plane you picked keeps its halo. */
@media (pointer: coarse) {
  .leaflet-marker-pane .plane-svg-box svg {
    filter: none !important;
  }

  .apt-dot {
    box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.95), 0 0 0 4px rgba(0, 0, 0, 0.28);
  }
}

/* The selected aircraft's panel, docked to the map.
 *
 * This used to be a Leaflet popup tethered to the marker: 300px wide with its own scrollbar, so the photo sat below
 * the fold, the airport names were cut off mid-word, and the whole card shuffled about as the plane moved. Every
 * tracker worth comparing against docks a panel instead, and it solves all three at once - full height means no
 * inner scrollbar, and a fixed corner means the card stays where you left it.
 */
#plane-panel {
  position: absolute;
  top: 96px;
  right: 10px;
  /* Above Leaflet's controls, which sit at 1000 and otherwise draw the zoom buttons, the KEY and the attribution
     straight across the card. The attribution is moved rather than covered, below: the tile licences require it. */
  z-index: 1001;
  width: min(340px, calc(100vw - 20px));
  /* Room for the toolbar above and the attribution below; the panel scrolls only if a plane really has that much. */
  max-height: calc(100% - 148px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--c-grey-0a0a0a);
  border: 1px solid var(--c-amber);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.55);
  padding: 12px 14px;
}

#plane-panel[hidden] {
  display: none;
}

.plane-panel-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  color: var(--c-grey-aaa);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
}

.plane-panel-close:hover {
  color: var(--c-white);
}

/* A plane's card: what it is, where it's going, how it's flying, then Flyaboo's own extras. */
.plane-card {
  font-size: 12px;
  line-height: 1.45;
  /* Clear of the card's own scrollbar, which sat over the destination code. */
  padding-right: 4px;
}

.plane-card-call {
  display: block;
  color: var(--c-amber);
  font-weight: bold;
  font-size: 1.25em;
  letter-spacing: 0.5px;
}

.plane-card-sub {
  color: var(--c-grey-aaa);
}

/* The two figures everyone reads, given the room the six used to share between them. */
.plane-figures--headline .plane-figure-value {
  font-size: 1.25em;
}

/* The rest of the figures, folded away until asked for. */
.plane-more {
  margin-top: 8px;
  border-top: 1px solid var(--c-grey-222);
  padding-top: 6px;
}

.plane-more > summary {
  cursor: pointer;
  color: var(--c-grey-aaa);
  font-size: 0.9em;
  list-style: none;
}

.plane-more > summary::-webkit-details-marker {
  display: none;
}

.plane-more[open] > summary {
  color: var(--c-cyan);
  margin-bottom: 6px;
}

.plane-card-lost {
  color: var(--c-grey-aaa);
  padding: 6px 0;
}

/* On a phone the card is a sheet along the bottom, the way a map app shows what you tapped: the plane stays visible
   above it rather than being covered by a panel down one side. This has to come after the docked rule above, which
   otherwise wins on equal specificity and leaves the sheet 340px wide in the wrong corner. */
@media (max-width: 640px) {
  .map-root {
    --sheet-height: 62dvh;
  }

  #plane-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: auto;
    max-height: var(--sheet-height);
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  }

  /* The KEY and the map credits live in the bottom corners, which is where the sheet now is. They step up above it
     rather than being hidden: OpenStreetMap and Esri both require their credit to stay on screen. */
  .map-card-open .leaflet-bottom {
    bottom: var(--sheet-height);
  }
}

.plane-popup-photo--waiting {
  color: var(--c-grey-aaa);
  font-size: 0.9em;
  padding: 10px 0;
}

/* An airport name that is still too long after the place is taken out gets trimmed rather than wrapping the codes
   apart. */
.plane-route-names span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plane-route {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--c-grey-333);
}

.plane-route-codes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.32em;
  font-weight: bold;
  line-height: 1.1;
}

.plane-route-from { color: var(--c-pink); }
.plane-route-to { color: var(--c-aqua); }

.plane-route-arrow {
  flex: 1;
  text-align: center;
  color: var(--c-grey-aaa);
  font-size: 0.7em;
}

.plane-route-names {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--c-grey-aaa);
  font-size: 0.85em;
}

/* A long airport name is cut rather than pushing the codes about; the code above it says which airport it is. */
.plane-route-names span {
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plane-route-names span:last-child {
  text-align: right;
}

.plane-journey-bar {
  height: 4px;
  margin: 6px 0 3px;
  border-radius: 2px;
  background: var(--c-grey-333);
  overflow: hidden;
}

.plane-journey-bar span {
  display: block;
  height: 100%;
  background: var(--c-cyan);
}

.plane-journey-text {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--c-grey-aaa);
  font-size: 0.85em;
}

.plane-journey-text span:last-child {
  text-align: right;
}

.plane-card-unconfirmed {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--c-grey-333);
  color: var(--c-grey-aaa);
}

.plane-figures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 8px;
  margin: 10px 0 2px;
}

.plane-figure {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.plane-figure-label {
  color: var(--c-grey-aaa);
  font-size: 0.72em;
  letter-spacing: 0.5px;
}

.plane-figure-value {
  color: var(--c-white);
  font-weight: bold;
}

.plane-spark {
  margin: 6px 0 2px;
}

.plane-spark svg {
  display: block;
  width: 100%;
  height: 26px;
}

.plane-spark polyline {
  fill: none;
  stroke: var(--c-cyan);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.plane-spark-label {
  color: var(--c-grey-aaa);
  font-size: 0.78em;
}

.plane-card-note {
  margin-top: 6px;
  color: var(--c-grey-aaa);
  font-size: 0.9em;
  line-height: 1.35;
}

.plane-card-hold {
  margin-top: 8px;
  padding: 5px 8px;
  border: 1px dashed var(--c-amber);
  border-radius: 3px;
  background: rgba(255, 176, 0, 0.12);
  color: var(--c-amber);
  font-weight: bold;
  font-size: 0.85em;
  text-align: center;
  letter-spacing: 0.5px;
}

.plane-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.plane-action {
  flex: 1;
  padding: 6px 4px;
  border: 1px solid var(--c-grey-333);
  border-radius: 4px;
  background: var(--c-grey-080808);
  color: var(--c-cyan);
  font-size: 0.78em;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
}

.plane-action span {
  display: block;
  font-size: 1.2em;
}

/* The map's plane filter: a row under the toolbar, only while it's open. */
/* Hangs under the toolbar, which floats over the map: inside it as a flex row it simply made the toolbar wider. */
#plane-filters {
  position: absolute;
  top: 100%;
  /* Clear of Leaflet's layers button, which sits at the map's top left and draws above this. */
  left: 52px;
  margin-top: 6px;
  width: max-content;
  max-width: min(560px, calc(100vw - 92px));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 8px 10px;
  border: 1px solid var(--c-grey-333);
  border-radius: 4px;
  background: var(--c-grey-0a0a0a);
  color: var(--c-grey-aaa);
  font-size: 0.78rem;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

#plane-filters[hidden] {
  display: none;
}

#plane-filters label {
  display: flex;
  align-items: center;
  gap: 6px;
}

#plane-filters select,
#plane-filters input[type="search"] {
  padding: 4px 6px;
  border: 1px solid var(--c-grey-333);
  border-radius: 3px;
  background: var(--c-black);
  color: var(--c-white);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

#plane-filters input[type="search"] {
  min-width: 0;
  width: 15rem;
  max-width: 100%;
}

.plane-filter-count {
  color: var(--c-amber);
}

.map-btn--on {
  border-color: var(--c-amber) !important;
  color: var(--c-amber) !important;
}

@media (max-width: 640px) {
  #plane-filters {
    gap: 6px 10px;
  }

  #plane-filters label {
    flex: 1 1 100%;
  }

  #plane-filters input[type="search"] {
    flex: 1;
    width: auto;
  }
}

/* The height colour scale, shown while the aircraft are coloured by height. Bottom left, above the map credits. */
#altitude-scale {
  position: absolute;
  left: 10px;
  /* Above the 🗝️ KEY button, which shares this corner. */
  bottom: 70px;
  z-index: 640;
  width: min(230px, 46vw);
  padding: 6px 8px;
  border: 1px solid var(--c-grey-333);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.85);
  color: var(--c-grey-aaa);
  font-size: 0.62rem;
  pointer-events: none;
}

#altitude-scale[hidden] {
  display: none;
}

.altitude-scale-bar {
  height: 8px;
  border-radius: 2px;
}

.altitude-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
}

.altitude-scale-title {
  text-align: center;
  letter-spacing: 0.5px;
}

/* The FOLLOW button sits with the card's other actions and lights up while it's on. */
.plane-action--on {
  border-color: var(--c-amber);
  color: var(--c-amber);
}

button.plane-action {
  font-family: inherit;
  cursor: pointer;
}

/* A destination our own receivers watched, rather than one a route feed supplied. Quiet, but it is the part of the
   card no tracker without aerials can show. */
.plane-route-seen {
  margin-top: 4px;
  color: var(--c-green);
  font-size: 0.85em;
}
