:root {
  --bg: #000;
  --fg: #00ff66;
  --dim: #0a6b33;
  --grid: #074;
  --panel: rgba(0, 0, 0, 0.4);
}

/* 三套主题 */
body[data-theme='blackGreen'] {
  --bg: #000;
  --fg: #aaff00;
  --dim: #4d7a00;
  --grid: #6a9a00;
  --panel: rgba(0, 0, 0, 0.45);
}
body[data-theme='blackYellow'] {
  --bg: #000;
  --fg: #ffd60a;
  --dim: #8a7200;
  --grid: #aa8f00;
  --panel: rgba(0, 0, 0, 0.45);
}
body[data-theme='retro'] {
  --bg: #f9eeb3;
  --fg: #241403;
  --dim: #8a6a22;
  --grid: #000000;
  --panel: rgba(249, 238, 179, 0.6);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  margin: 0;
  padding: 0;
  /* 背景交给 body 传播: html 透明时 body 的主题背景会铺满整个视口 */
  background: transparent;
}
body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", monospace, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--grid);
}
.title {
  font-weight: 700;
  letter-spacing: 1px;
}
.status {
  font-size: 12px;
  color: var(--dim);
}

.stage {
  max-width: 520px;
  margin: 0 auto;
  padding: 10px;
}

.radar-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
}
#radar {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.zoom-row,
.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

/* 刷新进度条：与扫描线同一 10 秒周期，按 +/- 时归零重走 */
.progress-wrap {
  width: 100%;
  height: 5px;
  margin-top: 10px;
  background: var(--panel);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--fg);
  border-radius: 3px;
  transition: none; /* 由 requestAnimationFrame 逐帧驱动 */
}
.btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--grid);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  min-width: 44px;
  min-height: 40px;
}
.btn.wide {
  min-width: 64px;
  font-size: 14px;
}
.btn:active {
  background: var(--panel);
}
.range {
  min-width: 72px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
  justify-content: center;
}
.theme-label {
  font-size: 13px;
  color: var(--dim);
}
.theme-btn {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--grid);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.theme-btn.active {
  background: var(--fg);
  color: var(--bg);
}

.detail {
  margin-top: 14px;
  border: 1px solid var(--grid);
  border-radius: 8px;
  padding: 10px;
}
.detail h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--dim);
}
.detail-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.55;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.modal.hidden {
  display: none;
}
.modal-box {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--grid);
  border-radius: 10px;
  padding: 18px;
  width: min(90vw, 320px);
}
.modal-box h3 {
  margin: 0 0 12px;
}
.modal-box label {
  display: block;
  font-size: 13px;
  margin-bottom: 10px;
}
.modal-box input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--grid);
  border-radius: 6px;
  font-size: 15px;
}
.modal-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}
