:root {
  --g: #7dffb0;
  --g-dim: rgba(125, 255, 176, 0.35);
  --bg: #030806;
  --panel: rgba(4, 12, 8, 0.96);
  --text: #e8eaed;
  --muted: rgba(232, 234, 237, 0.58);
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --tabs-h: calc(62px + var(--bottom));
  color-scheme: dark;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 var(--mono);
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
[hidden] {
  display: none !important;
}

#map {
  position: fixed;
  inset: 0;
  background: #000;
}
body[data-basemap='satellite'] .leaflet-tile-pane {
  filter: saturate(0.75) contrast(1.08) brightness(0.88);
}
.leaflet-control-attribution {
  background: rgba(0, 0, 0, 0.55) !important;
  color: rgba(255, 255, 255, 0.55) !important;
  font-size: 9px !important;
  margin-bottom: calc(var(--tabs-h) + 2px) !important;
}
.leaflet-control-attribution a {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Top bar */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(var(--top) + 8px) 12px 10px;
  background: linear-gradient(rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  letter-spacing: 3px;
}
.brand b {
  color: var(--g);
  font-size: 14px;
}
.brand small {
  color: var(--muted);
  font-size: 10px;
}
.eye {
  align-self: center;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--g);
  box-shadow: 0 0 10px var(--g);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}
.chips {
  display: flex;
  gap: 6px;
}
.chip {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--muted);
  white-space: nowrap;
}
.chip.ok,
#chip-planes {
  color: var(--g);
  border-color: var(--g-dim);
}

/* Overhead banner */
.overhead {
  position: fixed;
  top: calc(var(--top) + 50px);
  left: 12px;
  right: 12px;
  z-index: 1001;
  padding: 10px 14px;
  border: 1px solid #ff6b5a;
  border-radius: 12px;
  background: rgba(30, 6, 4, 0.94);
  color: #ffb3a8;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-align: center;
  box-shadow: 0 0 24px rgba(255, 107, 90, 0.35);
  animation: pulse 1.4s ease-in-out infinite;
}

/* Floating buttons */
.fabs {
  position: fixed;
  right: 12px;
  bottom: calc(var(--tabs-h) + 14px);
  z-index: 1000;
  display: grid;
  gap: 10px;
  transition: transform 0.2s;
}
body.has-player .fabs {
  transform: translateY(-62px);
}
body.sheet-open .fabs {
  display: none;
}
.fab {
  width: 46px;
  height: 46px;
  border: 1px solid var(--g-dim);
  border-radius: 50%;
  background: var(--panel);
  color: var(--g);
  font-size: 20px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* Map markers */
.you {
  position: relative;
}
.you i {
  position: absolute;
  inset: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2f8bff;
  box-shadow: 0 0 0 6px rgba(47, 139, 255, 0.25), 0 0 14px #2f8bff;
}
.you b {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
  letter-spacing: 1px;
}
.plane {
  position: relative;
}
.plane svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
  filter: drop-shadow(0 0 3px #000) drop-shadow(0 0 2px #000);
  transition: transform 0.4s;
}
.plane b {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 3px #000;
}
.plane.selected svg,
.plane.followed svg {
  filter: drop-shadow(0 0 6px #fff) drop-shadow(0 0 2px #000);
}
.cam i {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #6cc8ff;
  border-radius: 6px;
  background: rgba(2, 14, 24, 0.88);
  color: #6cc8ff;
  font-style: normal;
  font-size: 12px;
}

/* Bottom tabs */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1003;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: var(--tabs-h);
  padding: 6px 6px var(--bottom);
  border-top: 1px solid rgba(125, 255, 176, 0.15);
  background: rgba(2, 6, 4, 0.97);
}
.tabs button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: 9.5px;
  letter-spacing: 2px;
}
.tabs button span {
  font-size: 18px;
  letter-spacing: 0;
}
.tabs button.on {
  color: var(--g);
  background: rgba(125, 255, 176, 0.08);
}
.badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 26px);
  min-width: 17px;
  padding: 1px 4px;
  border-radius: 999px;
  background: #ffb347;
  color: #1a1204;
  font-size: 9px;
  letter-spacing: 0;
}

/* Sheet */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tabs-h);
  z-index: 1002;
  max-height: 58dvh;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--g-dim);
  border-radius: 18px 18px 0 0;
  background: var(--panel);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6);
  animation: up 0.18s ease-out;
}
body.has-player .sheet {
  bottom: calc(var(--tabs-h) + 60px);
  max-height: calc(58dvh - 60px);
}
@keyframes up {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
}
.sheet-grip {
  display: grid;
  place-items: center;
  height: 22px;
  cursor: pointer;
}
.sheet-grip i {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.25);
}
.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 12px 16px;
  -webkit-user-select: text;
  user-select: text;
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.sheet-head b {
  color: var(--g);
  letter-spacing: 3px;
  font-size: 13px;
}
.sheet-head small {
  flex: 1;
  color: var(--muted);
  font-size: 10px;
}
.pill,
.seg button,
.card-actions button,
.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 11px;
  border: 1px solid var(--g-dim);
  border-radius: 999px;
  background: none;
  color: var(--g);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-decoration: none;
  white-space: nowrap;
}
.pill.on,
.seg button.on,
.card-actions .on {
  background: rgba(125, 255, 176, 0.15);
  border-color: var(--g);
}
.seg {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.search input {
  width: 100%;
  margin-bottom: 8px;
  padding: 11px 12px;
  border: 1px solid rgba(125, 255, 176, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font: 16px var(--mono);
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.row button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
}
.row.on button {
  border-color: var(--g-dim);
  background: rgba(125, 255, 176, 0.1);
}
.row .dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.row .ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--g-dim);
  border-radius: 50%;
  color: var(--g);
  font-style: normal;
  font-size: 11px;
}
.row.on .ico {
  background: var(--g);
  color: #031008;
}
.txt {
  flex: 1;
  display: grid;
  min-width: 0;
}
.txt b {
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.txt small {
  color: var(--muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alt {
  color: var(--g);
  font-size: 11px;
  white-space: nowrap;
}
.empty,
.note {
  margin: 8px 2px;
  color: var(--muted);
  font-size: 11px;
}
.note {
  font-size: 10px;
  opacity: 0.85;
}
.allclear {
  margin: 4px 0 8px;
  padding: 12px;
  border: 1px solid var(--g-dim);
  border-radius: 10px;
  color: var(--g);
}
.sub {
  margin: 14px 2px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2px;
}
.alert {
  --c: #6cc8ff;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 4px solid var(--c);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.alert.c-yellow {
  --c: #ffd84a;
}
.alert.c-amber {
  --c: #ff9a3c;
}
.alert.c-red {
  --c: #ff4b4b;
}
.alert b {
  color: var(--c);
}
.alert small {
  color: var(--muted);
  font-size: 10px;
}
.alert summary {
  color: var(--muted);
  font-size: 10px;
}
.alert p {
  margin: 4px 0 0;
  font-size: 11.5px;
}
.alert-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

/* Info card (plane / camera) */
.card {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--tabs-h) + 8px);
  z-index: 1002;
  padding: 12px;
  border: 1px solid var(--g-dim);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  animation: up 0.18s ease-out;
}
body.has-player .card {
  bottom: calc(var(--tabs-h) + 68px);
}
.card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.card-title {
  flex: 1;
  display: grid;
  min-width: 0;
}
.card-title b {
  color: var(--g);
  font-size: 15px;
  letter-spacing: 1px;
}
.card-title small {
  color: var(--muted);
  font-size: 10.5px;
}
.x {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 17px;
  padding: 0 4px;
}
.route {
  margin-top: 6px;
  font-size: 13px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}
.stat {
  display: grid;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.stat small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.5px;
}
.stat b {
  font-size: 13px;
}
.emergency {
  margin-top: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 75, 75, 0.15);
  color: #ff8b8b;
  font-size: 11px;
}
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.card-actions > * {
  flex: 1;
}
.cam-frame {
  margin-top: 10px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 352 / 288;
}
.cam-frame img,
.cam-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Player */
.player {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: calc(var(--tabs-h) + 6px);
  z-index: 1003;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 7px 7px 14px;
  border: 1px solid var(--g-dim);
  border-radius: 14px;
  background: rgb(4, 14, 9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.now {
  flex: 1;
  display: grid;
  min-width: 0;
}
.now b {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.now small {
  color: var(--g);
  font-size: 9.5px;
  letter-spacing: 1.5px;
}
.player button {
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--g-dim);
  border-radius: 50%;
  background: none;
  color: var(--g);
}
.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}
.eq i {
  width: 3px;
  height: 100%;
  background: var(--g);
  transform-origin: bottom;
  animation: eq 0.9s ease-in-out infinite;
}
.eq i:nth-child(2) {
  animation-delay: -0.3s;
}
.eq i:nth-child(3) {
  animation-delay: -0.6s;
}
@keyframes eq {
  0%,
  100% {
    transform: scaleY(0.25);
  }
  50% {
    transform: scaleY(1);
  }
}
.player.paused .eq i {
  animation-play-state: paused;
}

.toast {
  position: fixed;
  top: calc(var(--top) + 54px);
  left: 50%;
  z-index: 1100;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border: 1px solid var(--g-dim);
  border-radius: 12px;
  background: rgb(4, 14, 9);
  font-size: 12px;
  text-align: center;
}
