/* ============================================================
   NEON THEME · 全局主题样式 · 一次引用，所有游戏通用
   用法：每个 HTML 的 <head> 里加一行
        <link rel="stylesheet" href="/neon-theme.css">
   ============================================================ */

/* ---------- 变量 ---------- */
:root {
  --neon-cyan: #00d2ff;
  --neon-purple: #7b2ff7;
  --neon-pink: #ff2fd0;
  --neon-gold: #ffd93d;
  --neon-green: #00ff9d;
  --neon-bg: #05050f;
  --neon-text: #cfefff;
  --neon-text-dim: #8a93b8;
  --neon-gradient: linear-gradient(135deg, #00d2ff, #7b2ff7, #ff2fd0);
  --neon-gradient-btn: linear-gradient(135deg, #00d2ff, #7b2ff7);
  --neon-shadow-btn: 0 8px 28px rgba(0,210,255,.35), inset 0 1px 0 rgba(255,255,255,.3);
  --neon-shadow-btn-hover: 0 12px 36px rgba(123,47,247,.5);
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; height: 100dvh; }
body {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 0%, #1a1a3a 0%, #0a0a1e 55%, #05050f 100%);
  color: var(--neon-text);
  font-family: 'Segoe UI', 'Arial', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

/* 星空背景（可选） */
body.neon-starfield::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 15% 20%, rgba(0,210,255,.6), transparent),
    radial-gradient(1px 1px at 35% 60%, rgba(123,47,247,.5), transparent),
    radial-gradient(1.2px 1.2px at 78% 35%, rgba(255,47,208,.5), transparent),
    radial-gradient(1px 1px at 62% 78%, rgba(0,210,255,.4), transparent);
  pointer-events: none; z-index: 0;
}

/* ---------- Canvas ---------- */
canvas {
  display: block;
  position: fixed;
  inset: 0;
  touch-action: none;
}

/* ---------- HUD 通用 ---------- */
.neon-hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  padding: 18px 22px;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 10;
}
.neon-hud > * { pointer-events: auto; }
.neon-hud-left, .neon-hud-right {
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
}
.neon-hud-right { align-items: flex-end; }

.neon-score {
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(0,210,255,.9), 0 0 30px rgba(0,210,255,.4);
  font-variant-numeric: tabular-nums;
}
.neon-score small { font-size: 14px; color: #7fd6ff; font-weight: 600; margin-left: 6px; }

.neon-sub {
  color: #7fd6ff;
  font-size: 13px;
  text-shadow: 0 0 8px rgba(0,210,255,.5);
}
.neon-best {
  color: #ffd76a;
  font-size: 13px;
  text-shadow: 0 0 8px rgba(255,200,80,.5);
}
.neon-wave {
  color: #ffb020;
  font-size: 15px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255,176,32,.7);
}

/* ---------- 圆形图标按钮 ---------- */
.neon-icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(0,210,255,.5);
  background: rgba(0,210,255,.08);
  color: #8fe4ff;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .15s, background .15s;
  font-family: inherit;
}
.neon-icon-btn:hover { transform: scale(1.08); background: rgba(0,210,255,.2); }
.neon-icon-btn:active { transform: scale(.94); }

/* ---------- 通用按钮 ---------- */
.neon-btn {
  padding: 14px 48px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  border-radius: 40px;
  cursor: pointer;
  color: #fff;
  background: var(--neon-gradient-btn);
  box-shadow: var(--neon-shadow-btn);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
  font-family: inherit;
  margin: 6px 0;
}
.neon-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: var(--neon-shadow-btn-hover); }
.neon-btn:active { transform: scale(.97); }
.neon-btn.small { font-size: 15px; padding: 10px 32px; }
.neon-btn.ghost {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(0,210,255,.35);
  box-shadow: none;
  color: #8fe4ff;
}
.neon-btn.ghost:hover { background: rgba(0,210,255,.15); box-shadow: 0 0 22px rgba(0,210,255,.4); }

/* ---------- 全屏遮罩 ---------- */
.neon-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  color: #fff;
  background: radial-gradient(ellipse at 50% 40%, rgba(20,20,60,.85), rgba(0,0,0,.95));
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  text-align: center;
  padding: 20px;
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.neon-screen.hidden { display: none; }

/* ---------- 标题 ---------- */
.neon-title {
  font-size: clamp(32px, 8vw, 54px);
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 8px;
  background: var(--neon-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 18px rgba(0,210,255,.35));
  animation: neonTitlePulse 2.4s ease-in-out infinite;
}
@keyframes neonTitlePulse {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(0,210,255,.3)); }
  50% { filter: drop-shadow(0 0 26px rgba(123,47,247,.6)); }
}
.neon-subtitle {
  font-size: 15px;
  color: #8a93b8;
  margin-bottom: 28px;
  letter-spacing: 1px;
}

/* ---------- 最终分数 ---------- */
.neon-final-score {
  font-size: clamp(52px, 14vw, 80px);
  font-weight: 900;
  color: #00e0ff;
  margin: 10px 0 4px;
  text-shadow: 0 0 28px rgba(0,210,255,.8), 0 0 60px rgba(0,210,255,.35);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.neon-best-line {
  font-size: 14px;
  color: #ffd76a;
  margin-bottom: 22px;
  letter-spacing: 1px;
}
.neon-new-record {
  color: #ff5fa0;
  animation: neonBlink 1s steps(2) infinite;
}
@keyframes neonBlink { 50% { opacity: .35; } }

/* ---------- Toast ---------- */
.neon-toast {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(.7);
  background: rgba(5,5,15,.95);
  color: #8fe4ff;
  font-size: 18px;
  font-weight: 800;
  padding: 12px 30px;
  border-radius: 999px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(0,210,255,.6);
  box-shadow: 0 0 30px rgba(0,210,255,.5);
  transition: opacity .25s, transform .3s cubic-bezier(.34,1.6,.64,1);
  letter-spacing: 2px;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(0,210,255,.6);
}
.neon-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ---------- Modal ---------- */
.neon-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}
.neon-modal.hidden { display: none; }
.neon-modal-box {
  background: linear-gradient(160deg, rgba(10,15,35,.98), rgba(5,5,15,.98));
  border: 1px solid rgba(0,210,255,.5);
  border-radius: 18px;
  padding: 26px 28px;
  width: min(400px, 92vw);
  text-align: center;
  box-shadow: 0 0 40px rgba(0,210,255,.35), inset 0 1px 0 rgba(255,255,255,.1);
}
.neon-modal-box h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  background: var(--neon-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}
.neon-modal-box p {
  font-size: 14px;
  color: #8a93b8;
  line-height: 1.9;
  margin-bottom: 20px;
}
.neon-modal-btns { display: flex; gap: 10px; justify-content: center; }

/* ---------- 虚拟按钮容器 ---------- */
.neon-mobile-controls {
  position: fixed;
  bottom: 20px;
  left: 0; right: 0;
  display: none;
  justify-content: space-between;
  padding: 0 22px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  pointer-events: none;
}
.neon-mobile-controls > * { pointer-events: auto; }
.neon-m-btn {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(0,210,255,.4);
  background: rgba(0,210,255,.1);
  color: #cfefff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
  transition: background .12s, transform .12s;
  cursor: pointer;
}
.neon-m-btn:active { background: rgba(0,210,255,.35); transform: scale(.92); }

/* ---------- 分数弹出 ---------- */
.neon-pop { animation: neonPop .18s ease-out; }
@keyframes neonPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---------- 移动端检测 ---------- */
@media (hover: none) and (pointer: coarse) {
  .neon-mobile-controls { display: flex; }
  .neon-hide-mobile { display: none !important; }
}

/* ---------- 小屏 ---------- */
@media (max-width: 520px) {
  .neon-score { font-size: 24px; }
  .neon-sub, .neon-best, .neon-wave { font-size: 11px; }
  .neon-icon-btn { width: 38px; height: 38px; font-size: 15px; }
  .neon-btn { padding: 12px 36px; font-size: 16px; }
  .neon-btn.small { padding: 8px 24px; font-size: 13px; }
  .neon-m-btn { width: 54px; height: 54px; font-size: 20px; }
  .neon-hud { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
}

/* ---------- 安全区快捷类 ---------- */
.neon-safe-top { padding-top: calc(14px + env(safe-area-inset-top, 0px)); }
.neon-safe-bottom { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
/* ============================================================
   横屏提示遮罩（手机竖屏时显示）
   ============================================================ */
.neon-landscape-overlay {
    position: fixed; inset: 0;
    background: radial-gradient(ellipse at 50% 50%, #1a1a3a, #05050f);
    z-index: 99999;
    display: none;   /* 默认隐藏，JS 根据方向显示 */
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: #cfefff;
}
.neon-landscape-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 90vw;
}
.neon-landscape-icon {
    font-size: 64px;
    animation: neonRotate 2.2s ease-in-out infinite;
}
@keyframes neonRotate {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-90deg); }
}
.neon-landscape-text {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 6px;
    background: var(--neon-gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 18px rgba(0,210,255,.5));
}
.neon-landscape-sub {
    font-size: 13px;
    color: #7fd6ff;
    letter-spacing: 2px;
    text-shadow: 0 0 8px rgba(0,210,255,.4);
    line-height: 1.7;
}