@font-face {
  font-family: 'Space Grotesk';
  src: url('fonts/spacegrotesk.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --bg: #050816;
  --bg-2: #091426;
  --panel: rgba(9, 16, 31, 0.52);
  --panel-strong: rgba(8, 14, 24, 0.76);
  --panel-border: rgba(140, 203, 255, 0.16);
  --text: #f4f8ff;
  --muted: rgba(224, 236, 255, 0.72);
  --accent: #5ce6ff;
  --accent-2: #ffb86b;
  --good: #50f0be;
  --danger: #ff7575;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(92, 230, 255, 0.16), transparent 28%),
    radial-gradient(circle at 80% 80%, rgba(255, 184, 107, 0.11), transparent 32%),
    linear-gradient(145deg, var(--bg), var(--bg-2));
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at center, black 28%, transparent 100%);
}

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.42;
  pointer-events: none;
}

.ambient-one {
  width: 34rem;
  height: 34rem;
  left: -8rem;
  top: -6rem;
  background: rgba(92, 230, 255, 0.16);
}

.ambient-two {
  width: 26rem;
  height: 26rem;
  right: -6rem;
  bottom: -8rem;
  background: rgba(255, 184, 107, 0.14);
}

.ambient-three {
  width: 18rem;
  height: 18rem;
  left: 45%;
  top: 8%;
  background: rgba(80, 240, 190, 0.08);
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.glass {
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(16, 24, 40, 0.76), rgba(5, 10, 18, 0.52));
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.topbar {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 24px;
}

.topbar-panel {
  display: grid;
  gap: 0.8rem;
  flex: 1;
  min-width: 0;
}

.collapsible-body {
  display: grid;
  gap: 0.8rem;
  overflow: hidden;
}

.collapsible-body.is-collapsed {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.6vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.eyebrow {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.76rem;
  color: var(--accent);
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.searchbox {
  display: grid;
  gap: 0.45rem;
  max-width: 22rem;
}

.searchbox span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

.searchbox input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  font: inherit;
}

.searchbox input::placeholder {
  color: rgba(244, 248, 255, 0.45);
}

.searchbox input:focus {
  border-color: rgba(92, 230, 255, 0.46);
  box-shadow: 0 0 0 3px rgba(92, 230, 255, 0.12);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.filter-chip,
.pill-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  padding: 0.62rem 0.9rem;
  font: inherit;
  cursor: pointer;
}

.filter-chip.is-active {
  border-color: rgba(92, 230, 255, 0.5);
  background: rgba(92, 230, 255, 0.14);
}

.meta-card {
  min-width: 10rem;
  padding: 0.85rem 0.95rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-card.compact span,
.detail-label,
.mini-stat span,
.panel h2,
.panel p,
.hud-pill.soft {
  color: var(--muted);
}

.meta-card span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.meta-card strong {
  font-size: 1rem;
  font-weight: 700;
}

.radar-stage {
  position: absolute;
  inset: 0;
}

.globe {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 20% 20%, rgba(92, 230, 255, 0.06), transparent 30%),
    radial-gradient(circle at 80% 80%, rgba(255, 184, 107, 0.05), transparent 34%),
    #050816;
}

.globe .leaflet-container {
  display: block;
  width: 100% !important;
  height: 100% !important;
  background: #050816;
  font: inherit;
}

.leaflet-tile-pane {
}

body.cockpit-active #globe {
  width: 200vw !important;
  height: 300vh !important;
  left: -50vw !important;
  top: -100vh !important;
  transform-origin: center center;
}

.leaflet-control-zoom,
.leaflet-control-attribution {
  border: 1px solid rgba(140, 203, 255, 0.16) !important;
  background: rgba(8, 14, 24, 0.72) !important;
  backdrop-filter: blur(14px);
  color: var(--text) !important;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35) !important;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  background: transparent !important;
  color: var(--text) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.leaflet-bar a:last-child {
  border-bottom: 0 !important;
}

.leaflet-control-attribution,
.leaflet-control-attribution a {
  color: rgba(224, 236, 255, 0.72) !important;
}

.leaflet-container .leaflet-popup-content-wrapper,
.leaflet-container .leaflet-popup-tip {
  background: rgba(8, 14, 24, 0.82);
  color: var(--text);
  box-shadow: var(--shadow);
}

.hud-stack {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  max-width: min(560px, calc(100vw - 2rem));
}

.hud-pill {
  padding: 0.75rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(6, 12, 20, 0.6);
  color: var(--text);
  font-size: 0.88rem;
}

.panel {
  position: fixed;
  z-index: 1000;
  width: min(360px, calc(100vw - 2rem));
  padding: 1rem;
  border-radius: 24px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-body {
  display: grid;
  gap: 0.75rem;
}

.panel-body.is-collapsed {
  display: none;
}

.panel-left {
  left: 1rem;
  top: auto;
  bottom: 1rem;
  max-height: calc(100vh - 12.5rem);
  overflow: auto;
}

.panel-right {
  right: 1rem;
  top: auto;
  bottom: 1rem;
  max-height: calc(100vh - 12.5rem);
  overflow: auto;
}

.panel h2 {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.92rem;
}

.panel p {
  margin: 0 0 1rem;
  line-height: 1.6;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.mini-stats {
  display: grid;
  gap: 0.75rem;
}

.mini-stat {
  padding: 0.8rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mini-stat span,
.detail-label {
  display: block;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.74rem;
}

.mini-stat strong,
.detail-grid strong {
  font-size: 1rem;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.9rem 0 0.6rem;
}

.list-header h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.92rem;
}

.list-header span {
  color: var(--muted);
}

.aircraft-list {
  display: grid;
  gap: 0.55rem;
  max-height: 32vh;
  overflow: auto;
  padding-right: 0.2rem;
}

.aircraft-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 0.8rem;
  padding: 0.8rem 0.85rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.aircraft-item:hover,
.aircraft-item.is-active {
  border-color: rgba(92, 230, 255, 0.45);
  background: rgba(92, 230, 255, 0.08);
}

.aircraft-item strong {
  font-size: 0.98rem;
}

.aircraft-item span {
  color: var(--muted);
  font-size: 0.84rem;
}

.hint {
  margin-top: 1rem !important;
  font-size: 0.92rem;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-head p {
  margin-bottom: 0;
}

.icon-button {
  appearance: none;
  border: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 1.35rem;
  cursor: pointer;
}

.topbar-toggle {
  flex: 0 0 auto;
  align-self: flex-start;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.detail-grid > div {
  padding: 0.8rem 0.85rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-error {
  margin-top: 1rem !important;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--accent-2);
}

@media (max-width: 1200px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-left,
  .panel-right {
    bottom: 1rem;
    top: auto;
  }
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .is-hidden-mobile {
    display: none !important;
  }
  
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .hud-stack {
    bottom: calc(40vh + 2rem);
    top: auto;
  }

  .panel-left,
  .panel-right {
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-height: 40vh;
  }
  
  .panel-right {
    z-index: 1001;
  }
}

@media (max-width: 640px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .filter-row {
    gap: 0.45rem;
  }

  .brand h1 {
    font-size: 2rem;
  }
}

.home-marker-pulse {
  display: flex;
  align-items: center;
  justify-content: center;
}
.home-marker-pulse div {
  width: 14px;
  height: 14px;
  background-color: #ff4444;
  border-radius: 50%;
  box-shadow: 0 0 0 rgba(255, 68, 68, 0.6);
  animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(255, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 68, 68, 0);
  }
}
