#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: none;
}

/* Viewfinder corner brackets — the goggle-frame motif */
.hf-corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 1px solid var(--panel-border-strong);
  opacity: 0.55;
}
.hf-corner.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.hf-corner.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.hf-corner.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.hf-corner.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.osd-block {
  position: absolute;
  font-size: 12px;
  line-height: 1.7;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
}

.osd-tl { top: 18px; left: 22px; }
.osd-tr { top: 18px; right: 22px; text-align: right; }
.osd-br { bottom: 20px; right: 22px; text-align: right; }

.k { color: var(--osd-dim); }

/* Goggle-style telemetry readout: big value, small trailing unit/label —
   modeled on the DJI Goggles 3 OSD (ALT / SPD / VSI stack, top-right). */
.osd-tr > div, .osd-br > div { margin-bottom: 2px; }
.osd-tr span:first-child {
  font-size: 15px;
  font-weight: 600;
  color: var(--osd);
}
.osd-tr .u {
  font-size: 9px;
  color: var(--osd-dim);
  letter-spacing: 0.04em;
  margin-left: 4px;
}

.crash-banner {
  margin-top: 8px;
  padding: 4px 8px;
  background: rgba(255, 77, 77, 0.16);
  border: 1px solid var(--armed);
  border-radius: 4px;
  color: var(--armed);
  font-size: 10px;
  letter-spacing: 0.06em;
}

/* Control cluster — stick preview, bottom-center */
.control-cluster {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stick-preview {
  display: flex;
  gap: 10px;
}

.sp-gimbal {
  position: relative;
  width: 78px;
  height: 78px;
  border: 1px solid var(--panel-border-strong);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.32);
}

.sp-tick { position: absolute; background: var(--panel-border-strong); }
.sp-tick.t, .sp-tick.b { left: 50%; width: 1px; height: 5px; transform: translateX(-50%); }
.sp-tick.t { top: 0; }
.sp-tick.b { bottom: 0; }
.sp-tick.l, .sp-tick.r { top: 50%; width: 5px; height: 1px; transform: translateY(-50%); }
.sp-tick.l { left: 0; }
.sp-tick.r { right: 0; }

.sp-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%);
  border: 1px solid var(--osd-faint);
  border-radius: 50%;
}

.sp-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(255, 145, 66, 0.75);
  transform: translate(-50%, -50%);
  transition: transform 0.03s linear;
}

.sp-readout {
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--osd-dim);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.sp-label {
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8.5px;
  color: var(--osd-faint);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

/* Center reticle — simple goggle crosshair, DJI-style: a thin cross with a
   gap at the center dot, no clipped ball/ladder behind it. */
#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  opacity: 0.85;
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: var(--osd);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

#crosshair::before { left: 50%; top: 0; width: 1.5px; height: 8px; transform: translateX(-50%); }
#crosshair::after { left: 50%; bottom: 0; width: 1.5px; height: 8px; transform: translateX(-50%); }
#crosshair .dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px rgba(255, 145, 66, 0.8);
  transform: translate(-50%, -50%);
}
#crosshair .dot::before, #crosshair .dot::after {
  content: "";
  position: absolute;
  top: 50%;
  background: var(--osd);
}
#crosshair .dot::before { left: -13px; width: 8px; height: 1.5px; transform: translateY(-50%); }
#crosshair .dot::after { right: -13px; width: 8px; height: 1.5px; transform: translateY(-50%); }

#previewBanner {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 12px;
  color: var(--osd-dim);
  background: rgba(8, 9, 11, 0.55);
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(6px);
}

#previewBanner strong { color: var(--accent); }

#hud:not(.flying) #crosshair,
#hud:not(.flying) .control-cluster,
#hud:not(.flying) .osd-br,
#hud:not(.flying) .osd-tr { display: none; }

#hud.flying #previewBanner { display: none; }

/* Touch controls — the container spans the full screen just to position its
   two corner sticks, so it must stay click-through itself (pointer-events:
   none) or it silently eats every tap elsewhere in the HUD (launch button,
   reset/camera buttons, orbit-drag on the preview camera). Only the visible
   stick circles opt back in. */
#touchControls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.touch-stick {
  position: absolute;
  bottom: 40px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  border: 1.5px solid var(--panel-border-strong);
  touch-action: none;
  pointer-events: auto;
}

#stickLeft { left: 24px; }
#stickRight { right: 24px; }

.stick-knob {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.stick-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--osd-dim);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .osd-tr { right: 18px; }
}

/* On coarse-pointer devices the draggable touch sticks already occupy the
   bottom corners — the read-only preview would collide/duplicate them.
   Driven by a JS-computed .touch-ui class rather than the media query
   directly (see main.js) so WebXR-capable browsers get the same tap-driven
   UI even when they report a fine pointer (headset laser/gaze cursor)
   instead of a touchscreen — those have no keyboard either. */
body.touch-ui .stick-preview { display: none; }

#hud.no-stick-preview .stick-preview { display: none; }

/* Desktop/touch hint text — keyboard instructions vs. tap targets. Hidden
   by default; the coarse-pointer media query below flips which one shows. */
.hint-touch { display: none; }

.touch-launch-btn { display: none; }

.touch-flight-actions {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: none;
  gap: 14px;
}

.touch-action-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(14, 16, 20, 0.75);
  border: 1px solid var(--panel-border);
  color: var(--osd);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, background 0.15s;
}
.touch-action-btn:active { background: rgba(20, 22, 27, 0.9); border-color: var(--panel-border-strong); }

body.touch-ui .hint-desktop { display: none; }
body.touch-ui .hint-touch { display: inline; }

body.touch-ui .touch-launch-btn {
  display: block;
  position: relative;
  margin: 12px auto 0;
  padding: 14px 30px;
  border-radius: 999px;
  background: var(--accent);
  border: 1px solid var(--accent);
  color: #1a0f05;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body.touch-ui .touch-launch-btn:active { background: var(--accent-strong); }

body.touch-ui #hud.flying .touch-flight-actions { display: flex; }
