:root {
  --bg: #181d20;
  --yellow: #faeb12;
  --rail: #ff4d4d;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.62);
  --line: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html,
body,
#map {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Rajdhani, sans-serif;
}

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

.top {
  position: absolute;
  z-index: 800;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 48px;
  background: linear-gradient(to bottom, rgba(24, 29, 32, 0.94), rgba(24, 29, 32, 0));
  pointer-events: none;
}

.brand { pointer-events: auto; }

.tools {
  position: absolute;
  z-index: 810;
  top: 18px;
  right: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.brand img {
  display: block;
  height: 86px;
  width: auto;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.toggles {
  display: flex;
  flex-direction: column;
  min-width: 176px;
  background: rgba(24, 29, 32, 0.92);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
}

.toggles button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}

.toggles button:last-child { border-bottom: 0; }

.toggles button:hover,
.toggles button:focus-visible { background: rgba(255, 255, 255, 0.05); }

.toggles button[aria-pressed="true"] { color: var(--text); }

.toggles button[aria-pressed="true"] .toggle-state { color: var(--yellow); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  flex: none;
}

.dot.live {
  background: var(--yellow);
  box-shadow: 0 0 0 0 rgba(250, 235, 18, 0.7);
  animation: pulse 1.8s ease-out infinite;
}

.dot.bad { background: #ff5d5d; }

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(250, 235, 18, 0); }
  100% { box-shadow: 0 0 0 0 rgba(250, 235, 18, 0); }
}

.preview {
  position: absolute;
  z-index: 800;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 12px;
  background: var(--yellow);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.preview[hidden] { display: none; }

.panel {
  position: absolute;
  z-index: 800;
  top: auto;
  bottom: 16px;
  left: 16px;
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 144px);
  padding: 18px 18px 14px;
  overflow: auto;
  background: rgba(24, 29, 32, 0.94);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
}

.scroll-hint {
  display: none;
  position: absolute;
  z-index: 801;
  left: 16px;
  bottom: 16px;
  width: min(320px, calc(100vw - 32px));
  height: 46px;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding-bottom: 8px;
  background: linear-gradient(to bottom, rgba(24, 29, 32, 0), rgba(24, 29, 32, 0.98) 62%);
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  pointer-events: none;
}

.scroll-hint::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-bottom: 3px;
  border-right: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
  transform: rotate(45deg);
  animation: hint-bob 1.15s ease-in-out infinite;
}

@keyframes hint-bob {
  50% { transform: rotate(45deg) translateY(3px); }
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 44px;
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.03em;
}

.status {
  align-items: flex-start;
  margin-top: 14px;
  font-size: 18px;
  font-weight: 700;
}

.status .dot { margin-top: 6px; }

.status__copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.signal {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.signal[hidden] { display: none; }

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

.note:empty { display: none; }

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

.block h2 {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.flight,
.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin: 0;
}

.flight dd,
.board dd {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.flight dt,
.board dt,
.board small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.board dt { display: block; margin-bottom: 4px; }

.board small,
.board p {
  display: block;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.kist {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.kist-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.photo {
  display: inline-block;
  margin-top: 8px;
  color: var(--yellow);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.photo:hover { text-decoration: underline; }

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend span {
  width: 18px;
  height: 3px;
  background: var(--rail);
}

.source {
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.source a { color: rgba(255, 255, 255, 0.7); }

.leaflet-bar {
  border: 1px solid var(--line);
  box-shadow: none;
}

.leaflet-bar a {
  background: var(--bg);
  color: var(--text);
  border-bottom-color: var(--line);
}

.leaflet-bar a:hover,
.leaflet-bar a:focus {
  background: #22282c;
  color: var(--yellow);
}

.leaflet-control-attribution {
  background: rgba(24, 29, 32, 0.8);
  color: rgba(255, 255, 255, 0.5);
  font-family: Rajdhani, sans-serif;
}

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

.heli-icon,
.base-icon { background: none; border: 0; }

.heli {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
}

.heli.is-stale { opacity: 0.5; }

.heli svg { display: block; width: 100%; height: 100%; }

.base {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.base__dot {
  width: 10px;
  height: 10px;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(250, 235, 18, 0.18);
}

.leaflet-tooltip.base-tip {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--text);
  font-family: Rajdhani, sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}

.leaflet-tooltip.base-tip::before { display: none; }

.panel:not(.is-live) .needs-fix { display: none; }

.panel__toggle {
  display: none;
  width: 100%;
  margin-top: 10px;
  padding: 6px 8px 4px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--yellow);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}

.panel__toggle::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-right: 2px solid var(--yellow);
  border-bottom: 2px solid var(--yellow);
  transform: rotate(45deg) translateY(-2px);
  vertical-align: middle;
}

.panel.is-open .panel__toggle::after {
  transform: rotate(225deg) translateY(-1px);
}

@media (max-width: 720px) {
  .brand img { height: 62px; }
  .top { padding: 12px 12px 36px; }
  .tools { top: 12px; right: 12px; }
  .toggles { min-width: 148px; }
  .toggles button { gap: 12px; padding: 7px 10px; font-size: 11px; }
  .preview { top: 72px; max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
  .panel {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    display: flex;
    flex-direction: column;
    max-height: none;
    padding: 14px 14px 8px;
    overflow: hidden;
  }
  .panel.is-open {
    max-height: min(40vh, calc(100vh - 210px));
  }
  .panel:not(.is-open) .panel__rest { display: none; }
  .panel__rest {
    overflow: auto;
    min-height: 0;
    padding-bottom: 12px;
  }
  .panel__head { cursor: pointer; }
  .panel__toggle { display: block; }
  .panel.is-more ~ .scroll-hint {
    display: flex;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
  }
  .board p { display: none; }
  h1 { font-size: 32px; }
  .board { gap: 8px 12px; }
  .board dd { font-size: 20px; }
  .leaflet-bottom.leaflet-right { bottom: calc(var(--sheet, 180px) + 12px); }
  .leaflet-control-attribution { max-width: min(220px, calc(100vw - 88px)); }
}

@media (prefers-reduced-motion: reduce) {
  .dot.live,
  .scroll-hint::after { animation: none; }
}
