:root {
  --bg: #0c1218;
  --glass: rgba(12, 19, 28, 0.76);
  --glass-strong: rgba(10, 16, 24, 0.88);
  --border: rgba(148, 178, 212, 0.22);
  --accent: #38bdf8;
  --accent-green: #34d399;
  --text: #eef4fb;
  --muted: #9eb0c4;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

#viewport {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#viewport:active {
  cursor: grabbing;
}

/* 加载遮罩 */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 42%, #182738 0%, #090e14 82%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#loading-overlay.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(440px, 88vw);
  padding: 28px 30px;
  border-radius: 16px;
  background: rgba(14, 22, 33, 0.88);
  border: 1px solid rgba(90, 160, 230, 0.28);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(16px);
}

.loading-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--accent);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.loading-card h1 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.loading-card p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 18px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0ea5e9, #34d399);
  transition: width 0.15s ease-out;
}

.loading-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

/* 顶部栏 */
.hud-top {
  position: fixed;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

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

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.8);
}

.brand-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
}

.zone-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.coord-readout {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mode-btn, .toggle-btn, .preset-btn, .side-action {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  padding: 6px 11px;
  transition: all 0.15s ease;
}

.mode-btn:hover, .toggle-btn:hover, .preset-btn:hover, .side-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mode-btn.active {
  background: var(--accent);
  color: #06131f;
  font-weight: 600;
}

.toggle-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.toggle-btn.active {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

/* 帮助面板 */
.help-panel {
  position: fixed;
  top: 72px;
  right: 14px;
  z-index: 25;
  width: min(320px, calc(100vw - 28px));
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.help-panel.collapsed {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}

.icon-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}

.help-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
  color: #cbd8e6;
  line-height: 1.45;
}

.help-list strong {
  color: var(--accent);
}

/* 右下角微调卡 */
.hud-side {
  position: fixed;
  right: 14px;
  bottom: 72px;
  z-index: 18;
  width: 224px;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}

.slider-row span {
  display: flex;
  justify-content: space-between;
}

.slider-row strong {
  color: var(--text);
  font-weight: 600;
}

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

.side-action {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  font-size: 11px;
  padding: 6px 8px;
}

/* 底部机位栏 */
.hud-bottom {
  position: fixed;
  bottom: 12px;
  left: 14px;
  right: 14px;
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.preset-bar {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  overflow-x: auto;
  max-width: 100%;
}

.preset-btn {
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  padding: 6px 12px;
}

.preset-btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
}

/* FPS 准星 */
.fps-reticle {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fps-reticle.hidden {
  display: none;
}

.reticle-ring {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid rgba(56, 189, 248, 0.85);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
}

.fps-hint {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-size: 12px;
  color: #bae6fd;
}

@media (max-width: 820px) {
  .hud-side {
    display: none;
  }
  .coord-readout, .brand-sub {
    display: none;
  }
}
