* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: monospace;
  color: #fff;
}

#container {
  position: relative;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  margin: 10px;
  border: 1px solid rgba(255, 160, 40, 0.5);
  border-radius: 12px;
  overflow: hidden;
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* --- US Panel: floating 16:9 overlay --- */
#us-panel {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 960px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  z-index: 10;
  cursor: grab;
  border: 1px solid rgba(255,255,255,0.1);
}

#us-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  z-index: 20;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.3) 50%);
}

/* Layer 0: Interface base (bottom) */
#us-interface {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Layer 1: Video on top of interface, below overlays
   Sized to fill the viewport area within the interface
   Reference: video spans from sidebar to depth scale, top bar to bottom ticks */
#us-video {
  position: absolute;
  left: 14%;
  top: 12%;
  width: 67%;
  height: 90%;
  object-fit: cover;
  z-index: 1;
}

/* Layer 2: SVG SafeTrack dynamic elements */
#safetrack-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
}

/* Layer 3: Green overlay (brackets, triangles)
   Centered on viewport center x=780, as %: 780/1920=40.6%
   Overlay is 272px wide in 1920 space = 14.2% */
#us-overlay {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  top: 9%;
  height: 75.8%;
  left: 40.5%;
  transform: scale(1.25);
  transform-origin: top center;
}

/* Layer 4: Depth marker — right next to the depth scale ticks
   Scale ticks at roughly x=1090-1130 in 1920 = ~57% */
#us-depth-marker {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  left: 77%;
  top: 20%;
  width: 40px;
}

/* --- SVG element styles --- */
#st-solid-line {
  stroke: #fff;
  stroke-width: 2;
}

#st-dashed-line {
  stroke: #fff;
  stroke-width: 2;
  stroke-dasharray: 8 6;
}

#st-tip-ring {
  opacity: 0.9;
}

#st-depth-text {
  fill: #0f0;
  font-size: 28px;
  font-family: monospace;
  text-anchor: start;
}

/* --- Help Panel --- */
#help-panel {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
  pointer-events: none;
  border: 1px solid rgba(255, 160, 40, 0.5);
  border-radius: 12px;
  padding: 10px;
}

.help-group {
  background: transparent;
  border: 1px solid rgba(255, 160, 40, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
}

.help-title {
  font-size: 10px;
  font-weight: bold;
  color: rgba(255, 180, 60, 0.9);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.help-row {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  white-space: nowrap;
}

.help-key {
  display: inline-block;
  min-width: 70px;
  color: rgba(255, 190, 80, 0.9);
  font-weight: bold;
}
