/* 低空航线冲突检测：HUD 与页面壳（对齐 camera-earth 视觉） */
:root {
  --hud-bg: #071018;
  --hud-fg: #e8f4f4;
  --hud-accent: #3db8a8;
  --hud-warn: #ff6b6b;
  --hud-soft: #f0c674;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--hud-bg);
  color: var(--hud-fg);
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
}

#cesiumContainer {
  position: fixed;
  inset: 0;
}

.hud {
  position: fixed;
  z-index: 2;
  pointer-events: none;
}

.hud * {
  pointer-events: auto;
}

.hud-top {
  top: 16px;
  left: 16px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.hud-top a {
  color: #9fe8dd;
  text-decoration: none;
  font-size: 0.92rem;
}

.hud-top a:focus-visible {
  outline: 2px solid var(--hud-accent);
  outline-offset: 3px;
}

.hud-top h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
}

.hud-controls {
  left: 16px;
  bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  max-width: min(640px, calc(100vw - 220px));
}

.hud-controls button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--hud-accent);
  color: var(--hud-bg);
  font-weight: 700;
  cursor: pointer;
}

.hud-controls button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* 播放态：更深强调色，文案由 JS 切换为「暂停」 */
#btnPlay[aria-pressed="true"] {
  background: #2a8f82;
  box-shadow:
    0 0 0 2px rgba(61, 184, 168, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

#btnReplay {
  background: rgba(61, 184, 168, 0.22);
  color: var(--hud-fg);
  border: 1px solid rgba(61, 184, 168, 0.45);
}

.hud-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(232, 244, 244, 0.86);
}

.hud-slider input[type="range"] {
  width: 120px;
  accent-color: var(--hud-accent);
}

.hud-slider output {
  min-width: 2.2em;
  font-variant-numeric: tabular-nums;
}

.hud-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: rgba(232, 244, 244, 0.9);
  cursor: pointer;
  user-select: none;
}

.hud-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--hud-accent);
  cursor: pointer;
}

.hud-check:focus-within {
  outline: 2px solid var(--hud-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.hud-hint {
  margin: 0;
  flex-basis: 100%;
  font-size: 0.88rem;
  color: rgba(232, 244, 244, 0.86);
}

/* 右侧详情面板 */
.hud-side {
  top: 16px;
  right: 16px;
  bottom: 18px;
  width: min(320px, calc(100vw - 32px));
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 16px;
  border-radius: 12px;
  background: rgba(7, 16, 24, 0.78);
  border: 1px solid rgba(61, 184, 168, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: auto;
}

.hud-side[hidden] {
  display: none !important;
}

/* 详情打开时压在底栏控件之上（尤其移动端） */
.hud-side:not([hidden]) {
  z-index: 4;
}

.hud-side__close {
  position: absolute;
  top: 10px;
  right: 10px;
  appearance: none;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  color: rgba(232, 244, 244, 0.85);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.hud-side__close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--hud-fg);
}

.hud-side__close:focus-visible {
  outline: 2px solid var(--hud-accent);
  outline-offset: 2px;
}

.hud-side h2 {
  margin: 0;
  padding-right: 36px;
  font-size: 0.95rem;
  font-weight: 650;
}

#detailBody {
  font-size: 0.84rem;
  line-height: 1.55;
  color: rgba(232, 244, 244, 0.88);
}

#detailBody :where(strong, .warn) {
  color: var(--hud-warn);
}

#detailBody :where(.soft, em.highlight) {
  color: var(--hud-soft);
}

@media (max-width: 720px) {
  .hud-top {
    right: 16px;
    flex-wrap: wrap;
  }

  .hud-controls {
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    width: 100%;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px 16px 0 0;
    background: rgba(7, 16, 24, 0.88);
    border-top: 1px solid rgba(61, 184, 168, 0.28);
    box-sizing: border-box;
  }

  .hud-slider input[type="range"] {
    flex: 1;
    min-width: 80px;
    width: auto;
  }

  .hud-side {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 40vh;
    height: 40vh;
    border-radius: 16px 16px 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
}