/* ==========================================================
   霓虹弹力球实验室 — 样式
   深色赛博科技感 / 全屏 Canvas / HUD 面板
   ========================================================== */

:root {
  --bg-deep: #04040e;
  --bg-mid: #0b0820;
  --neon-cyan: #00f0ff;
  --neon-mint: #00ff9d;
  --neon-pink: #ff2d75;
  --neon-violet: #b14dff;
  --neon-amber: #ffd400;

  --text-main: #dff6ff;
  --text-dim: #6f8ba6;

  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas,
    "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-deep);
}

body {
  font-family: var(--font-ui);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;

  /* 底层径向渐变 + 赛博网格，网格在上、渐变在下 */
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(0, 240, 255, 0.055) 0px,
      rgba(0, 240, 255, 0.055) 1px,
      transparent 1px,
      transparent 52px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 240, 255, 0.055) 0px,
      rgba(0, 240, 255, 0.055) 1px,
      transparent 1px,
      transparent 52px
    ),
    radial-gradient(ellipse 90% 70% at 50% 45%, var(--bg-mid) 0%, var(--bg-deep) 72%);
  background-attachment: fixed;
}

/* ---------------- 画布 ---------------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
  cursor: crosshair;
  will-change: transform;
}

/* ---------------- 装饰覆盖层 ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

/* CRT 扫描线 */
.overlay--scan {
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.55;
  mix-blend-mode: multiply;
}

/* 四角暗角，聚焦中心 */
.overlay--vignette {
  background: radial-gradient(
    ellipse 78% 68% at 50% 48%,
    transparent 40%,
    rgba(2, 2, 10, 0.55) 78%,
    rgba(2, 2, 10, 0.9) 100%
  );
}

/* 爆炸时的全屏闪光 */
.flash {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(220, 250, 255, 0.95) 0%,
    rgba(0, 240, 255, 0.45) 32%,
    rgba(177, 77, 255, 0.18) 55%,
    transparent 75%
  );
}

/* ---------------- HUD 面板通用 ---------------- */

.panel {
  position: fixed;
  z-index: 10;
  padding: 14px 16px;
  border-radius: 12px;
  background: linear-gradient(
    160deg,
    rgba(10, 16, 38, 0.82),
    rgba(6, 8, 22, 0.72)
  );
  border: 1px solid rgba(0, 240, 255, 0.28);
  box-shadow:
    0 0 24px rgba(0, 240, 255, 0.14),
    0 0 2px rgba(0, 240, 255, 0.5) inset,
    0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* 面板四角的切角装饰 */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--neon-cyan);
  opacity: 0.75;
  pointer-events: none;
}
.panel::before {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
  border-top-left-radius: 12px;
}
.panel::after {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
  border-bottom-right-radius: 12px;
}

/* ---------------- 左上角数据面板 ---------------- */

.stats {
  top: 18px;
  left: 18px;
  min-width: 232px;
}

.stats__title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0, 240, 255, 0.16);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.7);
}

.stats__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--neon-mint);
  box-shadow: 0 0 8px var(--neon-mint);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.75);
  }
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
}

.stat__label {
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.stat__value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--neon-cyan);
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.65);
}

.stat__value--good {
  color: var(--neon-mint);
  text-shadow: 0 0 12px rgba(0, 255, 157, 0.65);
}

.stat__value--hot {
  color: var(--neon-pink);
  text-shadow: 0 0 12px rgba(255, 45, 117, 0.65);
}

/* ---------------- 底部提示 ---------------- */

.hint {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  color: var(--text-dim);
  background: rgba(6, 10, 26, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.14);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}

.hint__sep {
  color: rgba(0, 240, 255, 0.5);
}

/* ---------------- 右下角控制按钮 ---------------- */

.controls {
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 10px;
  padding: 12px;
}

.btn {
  position: relative;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid rgba(0, 240, 255, 0.45);
  background: linear-gradient(
    180deg,
    rgba(0, 240, 255, 0.12),
    rgba(0, 240, 255, 0.03)
  );
  color: #a9f4ff;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
    transform 0.08s ease, background 0.18s ease;
  box-shadow:
    0 0 12px rgba(0, 240, 255, 0.16),
    0 0 10px rgba(0, 240, 255, 0.1) inset;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  color: #eafeff;
  border-color: var(--neon-cyan);
  background: linear-gradient(
    180deg,
    rgba(0, 240, 255, 0.26),
    rgba(0, 240, 255, 0.08)
  );
  box-shadow:
    0 0 26px rgba(0, 240, 255, 0.55),
    0 0 18px rgba(0, 240, 255, 0.22) inset;
}

.btn:active {
  transform: translateY(1px) scale(0.975);
}

.btn:focus-visible {
  outline: 2px solid rgba(0, 240, 255, 0.8);
  outline-offset: 2px;
}

/* 爆炸按钮：暖色警示 */
.btn--hot {
  border-color: rgba(255, 45, 117, 0.55);
  background: linear-gradient(
    180deg,
    rgba(255, 45, 117, 0.18),
    rgba(255, 122, 0, 0.06)
  );
  color: #ffc2d8;
  box-shadow:
    0 0 12px rgba(255, 45, 117, 0.22),
    0 0 10px rgba(255, 45, 117, 0.12) inset;
}

.btn--hot:hover {
  color: #fff2f7;
  border-color: var(--neon-pink);
  background: linear-gradient(
    180deg,
    rgba(255, 45, 117, 0.34),
    rgba(255, 122, 0, 0.14)
  );
  box-shadow:
    0 0 28px rgba(255, 45, 117, 0.65),
    0 0 20px rgba(255, 45, 117, 0.3) inset;
}

/* 暂停状态下的按钮高亮 */
.btn.is-active {
  color: #051018;
  border-color: var(--neon-amber);
  background: linear-gradient(180deg, #ffe97a, var(--neon-amber));
  box-shadow: 0 0 26px rgba(255, 212, 0, 0.6);
}

/* ---------------- 小屏适配 ---------------- */

@media (max-width: 640px) {
  .stats {
    top: 12px;
    left: 12px;
    min-width: 186px;
    padding: 11px 13px;
  }
  .stat__value {
    font-size: 13px;
  }
  .controls {
    right: 12px;
    bottom: 12px;
    gap: 8px;
    padding: 9px;
  }
  .btn {
    padding: 9px 13px;
    font-size: 12px;
    letter-spacing: 0.04em;
  }
  .hint {
    bottom: 76px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stats__dot {
    animation: none;
  }
}
