:root {
  --bg: #0A0C10;
  --text: #E6EAF0;
  --grid: #1E242E;
  --hud-bg: rgba(10, 12, 16, 0.92);
  --border: #2A3140;
  --t: #FF8A1E;
  --ct: #4A9EFF;
  --local: #FFFFFF;
  --dead-alpha: 0.35;
  --accent: #7C3AED;
}

[data-theme="light"] {
  --bg: #F2F4F7;
  --text: #12161C;
  --grid: #C9CFD8;
  --hud-bg: rgba(242, 244, 247, 0.92);
  --border: #A8B2C0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#radar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--hud-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  z-index: 100;
  font-size: 13px;
  gap: 24px;
  flex-wrap: wrap;
}

.hud-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hud-section.controls {
  gap: 12px;
  flex-wrap: wrap;
}

#status {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.status-connected {
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

.status-disconnected {
  background: #EF4444;
  box-shadow: 0 0 8px #EF4444;
}

.status-idle {
  background: #F59E0B;
  box-shadow: 0 0 8px #F59E0B;
}

#map-name {
  font-weight: 600;
  letter-spacing: 0.02em;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.1s, opacity 0.2s;
}

button:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

button:active {
  transform: translateY(0);
}

#theme-toggle {
  font-size: 16px;
  padding: 6px 10px;
}

label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

input[type="range"] {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
}

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

select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

select:hover {
  border-color: var(--accent);
}

#zoom-value,
#alpha-value {
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

#calibration-mode {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#calibration-mode.hidden {
  display: none;
}

.calibration-panel {
  background: var(--hud-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  min-width: 320px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
}

.calibration-panel h3 {
  margin-bottom: 16px;
  font-size: 18px;
  font-weight: 600;
}

.calibration-panel p {
  margin-bottom: 16px;
  font-size: 13px;
  opacity: 0.8;
  line-height: 1.5;
}

.calibration-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.calibration-values div {
  font-size: 13px;
}

.calibration-values span {
  font-weight: 600;
  color: var(--accent);
}

.calibration-panel button {
  width: 100%;
  margin-top: 8px;
}

.calibration-panel button:first-of-type {
  margin-top: 0;
}

@media (max-width: 768px) {
  #hud {
    font-size: 11px;
    padding: 8px 12px;
  }

  .hud-section {
    gap: 8px;
  }

  button {
    font-size: 11px;
    padding: 5px 10px;
  }

  input[type="range"] {
    width: 60px;
  }
}
