:root {
  --bg-dark: #050914;
  --panel-bg: rgba(11, 18, 35, 0.84);
  --panel-border: rgba(56, 189, 248, 0.24);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-green: #10b981;
  --accent-yellow: #eab308;
  --accent-orange: #f97316;
  --accent-red: #ef4444;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #0a1428 0%, #040710 100%);
  color: var(--text-main);
  font-family: var(--font-sans);
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#globe-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#globe-canvas:active {
  cursor: grabbing;
}

.hud-panel {
  position: absolute;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.hud-header {
  top: 16px;
  left: 16px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan);
}

h1 {
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.subtitle {
  font-size: 0.77rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.mono-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-cyan);
}

.segmented-control.two-col,
.segmented-control.three-col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.73rem;
  font-weight: 600;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(56, 189, 248, 0.22);
  color: var(--accent-cyan);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.4);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.wave-status {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.wave-bar-bg {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  overflow: hidden;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.wave-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  transition: width 0.08s linear;
}

.wave-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-small {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent-cyan);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 5px;
  cursor: pointer;
}

.btn-small:hover {
  background: rgba(56, 189, 248, 0.28);
}

/* Right Inspector */
.hud-inspector {
  top: 16px;
  right: 16px;
  width: 310px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspector-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inspector-divider {
  height: 1px;
  background: rgba(148, 163, 184, 0.15);
}

.tag {
  align-self: flex-start;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-origin {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-cyan);
}

.tag-target {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-green);
}

.tile-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 2px;
}

.tile-meta {
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--text-muted);
}

.pair-metrics {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pair-metrics.hidden {
  display: none;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.highlight-row {
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.9);
}

/* Bottom Legend */
.hud-legend {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  white-space: nowrap;
}

.legend-stops {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 5px;
}

.dot-blue { background: #1e4b7a; border: 1px solid #38bdf8; }
.dot-origin { background: #ffffff; box-shadow: 0 0 8px #38bdf8; }
.dot-green { background: #10b981; }
.dot-yellow { background: #eab308; }
.dot-orange { background: #f97316; }
.dot-red { background: #ef4444; }

.globe-tooltip {
  position: fixed;
  pointer-events: none;
  background: rgba(8, 13, 26, 0.94);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.74rem;
  color: var(--text-main);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  z-index: 50;
}

.globe-tooltip.hidden {
  display: none;
}
