/* ==========================================================================
   雷霆战机 · 样式表
   设计基调：深色太空 + 青蓝 / 品红霓虹；HUD 与数字使用等宽字体，
   中文优先使用系统黑体栈（雅黑 / 苹方）。
   注意：界面本身是"太空深色"，与 IDE 的 light 主题无关，属于内容配色。
   ========================================================================== */

/* ------------------------------- 设计变量 -------------------------------- */
:root {
  --bg: #05060f;
  --bg-deep: #0a0c1c;
  --cyan: #35e6ff;
  --magenta: #ff3ea5;
  --amber: #ffc857;
  --green: #6cff9d;
  --teal: #78ffdc;
  --red: #ff5c6c;
  --text: #e6f4ff;
  --text-dim: rgba(198, 220, 240, 0.66);

  --font-cjk: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB",
              "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
  --font-mono: "Courier New", Consolas, "SFMono-Regular", Menlo,
               "Microsoft YaHei", "PingFang SC", monospace;
}

/* --------------------------------- 重置 ---------------------------------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-cjk);
  /* 移动端：禁止双击缩放与滚动回弹 */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

body {
  /* 画布之外的信箱区域同样是太空色，避免突兀白边 */
  background:
    radial-gradient(circle at 50% 20%, #101738 0%, var(--bg) 62%),
    var(--bg);
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------- 画布 ---------------------------------- */
#game {
  display: block;
  /* 具体尺寸由 JS 按视口等比计算并设置 */
  background: var(--bg);
  box-shadow: 0 0 0 1px rgba(53, 230, 255, 0.18),
              0 0 48px rgba(53, 230, 255, 0.12),
              0 18px 60px rgba(0, 0, 0, 0.65);
  border-radius: 4px;
  touch-action: none;
  cursor: crosshair;
  image-rendering: auto;
}

/* -------------------------------- 覆盖层 --------------------------------- */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 6, 16, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  overflow: auto;
  transition: opacity 0.18s ease;
}

/* 覆盖层隐藏时不接收事件，避免遮挡画布 */
.overlay.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.panel {
  display: none;
  width: min(92vw, 460px);
  max-height: 92vh;
  overflow: auto;
  padding: 24px 22px 22px;
  text-align: center;
  border: 1px solid rgba(53, 230, 255, 0.32);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(12, 18, 40, 0.96), rgba(8, 10, 26, 0.96));
  box-shadow: 0 0 0 1px rgba(255, 62, 165, 0.12),
              0 0 40px rgba(53, 230, 255, 0.16),
              inset 0 0 60px rgba(53, 230, 255, 0.05);
}

/* JS 通过切换 .show 决定展示哪个面板 */
.panel.show { display: block; }

/* --------------------------------- 标题 ---------------------------------- */
.title {
  margin: 0 0 6px;
  font-size: clamp(30px, 8vw, 44px);
  letter-spacing: 6px;
  color: #ffffff;
  text-shadow: 0 0 12px var(--cyan), 0 0 34px rgba(53, 230, 255, 0.55);
}

.title.small { font-size: clamp(24px, 6.5vw, 34px); letter-spacing: 5px; }
.title.danger {
  color: #fff;
  text-shadow: 0 0 12px var(--red), 0 0 34px rgba(255, 92, 108, 0.6);
}

.subtitle {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-dim);
}

.hi-line {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--text-dim);
}
.hi-line .mono { color: var(--amber); font-weight: 700; }

/* --------------------------------- 按钮 ---------------------------------- */
.primary-btn, .ghost-btn {
  display: inline-block;
  margin: 4px 6px;
  padding: 12px 26px;
  font-family: var(--font-cjk);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #04121c;
  background: linear-gradient(180deg, #6ff3ff, var(--cyan));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
  box-shadow: 0 0 18px rgba(53, 230, 255, 0.45), 0 6px 16px rgba(0, 0, 0, 0.45);
}

.ghost-btn {
  color: var(--cyan);
  background: transparent;
  border: 1px solid rgba(53, 230, 255, 0.5);
  box-shadow: none;
}

.primary-btn:hover, .ghost-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.primary-btn:active, .ghost-btn:active { transform: translateY(1px); }
.primary-btn:focus-visible, .ghost-btn:focus-visible,
.touch-btn:focus-visible {
  outline: 2px solid var(--magenta);
  outline-offset: 3px;
}

.btn-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }

/* ------------------------------- 说明区块 -------------------------------- */
.help {
  display: flex;
  gap: 14px;
  margin: 20px 0 14px;
  text-align: left;
}

.help-col {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(53, 230, 255, 0.16);
  border-radius: 10px;
  background: rgba(8, 14, 32, 0.6);
}

.help h3 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
}

.help ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-dim);
}
.help b { color: var(--text); font-family: var(--font-mono); }

.tips {
  margin: 12px 0 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-dim);
}

/* ------------------------------- 结算数据 -------------------------------- */
.score-line {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--text-dim);
}
.score-line .mono { color: var(--text); font-size: 19px; }

.result {
  margin: 0 auto 12px;
  width: min(100%, 280px);
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 12px;
  margin-bottom: 6px;
  border: 1px solid rgba(53, 230, 255, 0.14);
  border-radius: 8px;
  background: rgba(8, 14, 32, 0.55);
  font-size: 13px;
  color: var(--text-dim);
}
.result-row b { font-size: 18px; color: var(--text); }
.result-row.hi { border-color: rgba(255, 200, 87, 0.35); }
.result-row.hi b { color: var(--amber); }

.new-record {
  display: none;
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--amber);
  text-shadow: 0 0 14px rgba(255, 200, 87, 0.7);
  animation: blink 0.9s steps(2, start) infinite;
}
.new-record.show { display: block; }

@keyframes blink { 50% { opacity: 0.35; } }

/* ------------------------------ 颜色工具类 ------------------------------- */
.mono { font-family: var(--font-mono); }
.c-cyan { color: var(--cyan); }
.c-magenta { color: var(--magenta); }
.c-green { color: var(--green); }
.c-teal { color: var(--teal); }
.c-amber { color: var(--amber); }
.c-red { color: var(--red); }

/* ------------------------------ 触摸控件 --------------------------------- */
#touch-controls {
  position: absolute;
  right: 14px;
  bottom: 18px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 5;
}

/* 仅在触摸设备或窄屏时显示 */
#touch-controls.enabled { display: flex; }

.touch-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(53, 230, 255, 0.55);
  background: rgba(8, 16, 36, 0.72);
  color: var(--cyan);
  font-family: var(--font-cjk);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  touch-action: none;
  box-shadow: 0 0 14px rgba(53, 230, 255, 0.3);
}

.touch-btn.bomb {
  border-color: rgba(255, 200, 87, 0.6);
  color: var(--amber);
  box-shadow: 0 0 14px rgba(255, 200, 87, 0.3);
}

.touch-btn:active { filter: brightness(1.35); }

/* ------------------------------- 响应式 ---------------------------------- */
/* 横屏矮屏（如手机横放）：压缩面板内边距，保证内容不被裁切 */
@media (max-height: 560px) {
  .panel { padding: 16px 16px 14px; }
  .help { margin: 12px 0 10px; }
  .help ul { line-height: 1.6; }
  .title { font-size: clamp(22px, 5vw, 30px); }
}

/* 窄屏：说明区改为上下堆叠 */
@media (max-width: 420px) {
  .help { flex-direction: column; gap: 10px; }
  .panel { padding: 18px 14px 16px; }
}

/* 尊重用户的"减少动态效果"偏好 */
@media (prefers-reduced-motion: reduce) {
  .new-record { animation: none; }
  .overlay, .primary-btn, .ghost-btn { transition: none; }
}
