/* SKY VIEW: labels over the real aircraft, drawn on a night-sky backdrop or the phone's camera. */
#sky-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%;
  padding-bottom: 0;
}

#sky-v [hidden] {
  display: none !important;
}

.sky-root {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: linear-gradient(to bottom, #050d20 0%, #0f2a52 55%, #2b5d8e 100%);
  color: #f5f7fa;
}

.sky-root--dragging {
  cursor: grabbing;
}

.sky-camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sky-horizon {
  position: absolute;
  left: -150vmax;
  top: -1px;
  width: 300vmax;
  height: 2px;
  background: rgba(234, 88, 12, 0.75);
  pointer-events: none;
}

/* The ground below the horizon, only when the camera is off. */
.sky-horizon::after {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 100%;
  height: 300vmax;
  background: rgba(10, 26, 18, 0.6);
}

.sky-root--camera .sky-horizon::after,
.sky-root--world .sky-horizon::after {
  display: none;
}

/* The 3D world (MapLibre with terrain) behind the labels; the controller sizes, turns and moves it. */
.sky-world {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.sky-world .maplibregl-canvas {
  outline: none;
}

.sky-root--world .sky-world {
  opacity: 1;
}

.sky-root--world .sky-horizon {
  opacity: 0.45;
}

.sky-root--camera .sky-world,
.sky-world-credit {
  display: none;
}

.sky-root--world:not(.sky-root--camera) .sky-world-credit {
  position: absolute;
  right: 6px;
  bottom: 0;
  z-index: 5;
  display: block;
  margin: 0;
  font-size: 0.55rem;
  opacity: 0.75;
}

.sky-world-credit a {
  color: inherit;
}

.sky-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  pointer-events: none;
}

.sky-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sky-label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: #ffffff;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  will-change: transform;
}

.sky-label-dot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  border: 2px solid var(--plane-colour, #5ac8fa);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
  color: var(--plane-colour, #5ac8fa);
  font-size: 15px;
  line-height: 1;
}

.sky-label-text {
  white-space: pre;
  background: rgba(5, 13, 32, 0.75);
  border-left: 3px solid var(--plane-colour, #5ac8fa);
  border-radius: 0 3px 3px 0;
  padding: 2px 6px;
  line-height: 1.25;
}

.sky-label--edge .sky-label-dot {
  border: 0;
  box-shadow: none;
  transform: rotate(var(--arrow-angle));
}

.sky-label--edge .sky-label-text {
  font-size: 0.65rem;
  opacity: 0.85;
}

.sky-label--selected .sky-label-dot {
  background: var(--plane-colour, #5ac8fa);
}

.sky-label--selected .sky-label-text {
  outline: 1px solid #ea580c;
}

.sky-bar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sky-compass {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: rgba(5, 13, 32, 0.82);
  border: 1px solid #2f74b5;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
}

.sky-status {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 12px;
  z-index: 5;
  margin: 0;
  background: rgba(5, 13, 32, 0.82);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 0.68rem;
  text-align: center;
  pointer-events: none;
}

.sky-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 48px;
  z-index: 6;
  max-width: 420px;
  margin: 0 auto;
  background: #0b1d3a;
  border: 1px solid #ea580c;
  border-radius: 4px;
  padding: 10px 34px 10px 12px;
  font-size: 0.75rem;
  line-height: 1.5;
  cursor: default;
}

.sky-card strong {
  color: #ffb000;
  font-size: 0.95rem;
}

.sky-card-type {
  color: #aab4c3;
}

.sky-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.sky-card-actions .map-btn {
  text-decoration: none;
}

.sky-card-close {
  position: absolute;
  top: 4px;
  right: 6px;
  border: 0;
  background: none;
  color: #f5f7fa;
  font-size: 1rem;
  cursor: pointer;
}

@media (max-width: 600px) {
  .sky-compass {
    top: auto;
    bottom: 40px;
    font-size: 0.68rem;
  }

  .sky-card {
    bottom: 70px;
  }
}
