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

:root {
  --neon-cyan: #00e5ff;
  --neon-pink: #ff2d78;
  --neon-purple: #9d4dff;
  --neon-yellow: #ffd166;
  --bg-deep: #070b1a;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-deep);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ---------- 画布 ---------- */
#gameCanvas {
  position: absolute;
  inset: 0;
  display: block;
  background: radial-gradient(ellipse at 50% 0%, #0d1735 0%, #070b1a 60%, #04060f 100%);
  cursor: crosshair;
  touch-action: none;
}

/* ---------- 屏幕层 ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px;
  background: rgba(4, 6, 15, 0.45);
  backdrop-filter: blur(6px);
}

.hidden { display: none !important; }

.logo {
  font-size: clamp(44px, 8vw, 84px);
  font-weight: 900;
  letter-spacing: 8px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple) 50%, var(--neon-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(0, 229, 255, 0.45));
  text-shadow: none;
  animation: floatIn 0.6s ease-out;
}

.menu-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: floatIn 0.6s ease-out;
}

.best-score {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--neon-yellow);
  background: rgba(255, 209, 102, 0.1);
  border: 1px solid rgba(255, 209, 102, 0.4);
  border-radius: 20px;
  padding: 4px 18px;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.subtitle {
  font-size: clamp(14px, 2.4vw, 20px);
  letter-spacing: 10px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: -8px;
}

.glass {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.start-card {
  padding: 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  min-width: min(92vw, 440px);
  animation: floatIn 0.7s ease-out;
}

.controls { display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: rgba(255,255,255,0.85); }
.controls-title { font-weight: 700; color: var(--neon-cyan); letter-spacing: 3px; margin-bottom: 2px; text-align: center; }
.control-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.dot { color: rgba(255,255,255,0.3); }

.menu-features {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  text-align: center;
}
.feature { letter-spacing: 1px; }

/* ---------- 难度选择 ---------- */
.difficulty-options {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.diff-trigger {
  font-size: 15px;
  letter-spacing: 2px;
  padding: 10px 24px;
  border-radius: 10px;
  cursor: pointer;
}
.diff-panel {
  padding: 26px 30px;
  min-width: min(92vw, 480px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.diff-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  min-width: 120px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  cursor: pointer;
  color: #fff;
  transition: all 0.15s ease;
}
.diff-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,0.4); }
.diff-card.selected {
  border-color: var(--neon-purple);
  background: rgba(157,77,255,0.16);
  box-shadow: 0 0 18px rgba(157,77,255,0.4);
}
.diff-name { font-size: 15px; font-weight: 800; letter-spacing: 1px; }
.diff-desc { font-size: 11px; color: rgba(255,255,255,0.6); text-align: center; line-height: 1.4; }
.key {
  display: inline-block;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--neon-cyan);
  border-radius: 6px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.btn-primary {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #04101f;
  background: linear-gradient(135deg, var(--neon-cyan), #5ff0ff);
  border: none;
  border-radius: 12px;
  padding: 12px 44px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 36px rgba(0, 229, 255, 0.75); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  font-size: 15px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  padding: 10px 32px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:hover { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.5); }

.hint { font-size: 13px; color: rgba(255,255,255,0.5); }

/* ---------- 排行榜 ---------- */
.rank-panel {
  padding: 18px 26px;
  min-width: min(92vw, 420px);
  max-height: 34vh;
  overflow-y: auto;
}
.rank-title { font-weight: 700; letter-spacing: 3px; color: var(--neon-yellow); margin-bottom: 10px; font-size: 17px; }
.rank-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rank-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}
.rank-list li:nth-child(1) { background: rgba(255, 209, 102, 0.12); border: 1px solid rgba(255, 209, 102, 0.4); color: var(--neon-yellow); }
.rank-list li:nth-child(2) { background: rgba(200, 220, 255, 0.08); border: 1px solid rgba(200, 220, 255, 0.3); }
.rank-list li:nth-child(3) { background: rgba(255, 140, 90, 0.08); border: 1px solid rgba(255, 140, 90, 0.3); }
.rank-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-empty { text-align: center; color: rgba(255,255,255,0.45); padding: 16px !important; }

/* ---------- HUD ---------- */
.hud {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.hud-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 20px;
}
.hud-score {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--neon-cyan);
  text-shadow: 0 0 14px rgba(0,229,255,0.6);
  font-variant-numeric: tabular-nums;
}
.hud-combo {
  font-size: 20px;
  font-weight: 900;
  color: var(--neon-pink);
  text-shadow: 0 0 16px rgba(255,45,120,0.7);
  animation: comboPulse 0.4s ease;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
}

.hud-menu {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: var(--neon-cyan);
  border-radius: 8px;
  width: 38px;
  height: 38px;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.hud-menu:hover { background: rgba(0, 229, 255, 0.28); border-color: var(--neon-cyan); }

.hud-life {
  display: flex;
  gap: 6px;
  font-size: 22px;
  letter-spacing: 2px;
}
.hud-bottom { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.hud-tip { font-size: 12px; color: rgba(255,255,255,0.35); letter-spacing: 2px; }
.hud-wave {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 0 16px rgba(0,229,255,0.5);
}
.hud-skills {
  font-size: 15px;
  letter-spacing: 4px;
  min-height: 20px;
  color: rgba(255,255,255,0.75);
}

/* ---------- 技能升级选择 ---------- */
.upgrade-panel { padding: 26px 30px; min-width: min(92vw, 560px); }
.upgrade-title { font-size: 28px; font-weight: 900; letter-spacing: 4px; color: var(--neon-yellow); text-shadow: 0 0 20px rgba(255,209,102,0.5); }
.upgrade-sub { font-size: 14px; color: rgba(255,255,255,0.7); margin-top: -10px; }
.upgrade-box {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 6px;
}
.upgrade-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 150px;
  padding: 18px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  cursor: pointer;
  color: #fff;
  transition: all 0.18s ease;
}
.upgrade-card:hover {
  transform: translateY(-4px) scale(1.04);
  border-color: var(--neon-yellow);
  background: rgba(255,209,102,0.12);
  box-shadow: 0 0 24px rgba(255,209,102,0.35);
}
.upgrade-card:active { transform: scale(0.96); }
.upgrade-icon { font-size: 40px; line-height: 1; }
.upgrade-name { font-size: 17px; font-weight: 800; color: var(--neon-yellow); }
.upgrade-desc { font-size: 12px; color: rgba(255,255,255,0.72); text-align: center; line-height: 1.5; }
.upgrade-hint { font-size: 12px; color: rgba(255,255,255,0.4); letter-spacing: 2px; margin-top: -4px; }

/* ---------- 波次横幅 ---------- */
.banner {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 7;
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  letter-spacing: 10px;
  text-align: center;
  pointer-events: none;
  text-shadow: 0 0 36px rgba(0, 229, 255, 0.85), 0 2px 8px rgba(0,0,0,0.8);
  animation: bannerPulse 0.5s ease-out;
}
.banner.hidden { display: none; }
@keyframes bannerPulse {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- 遮罩 ---------- */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 15, 0.55);
  backdrop-filter: blur(4px);
}
.overlay-card {
  padding: 30px 44px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  min-width: min(88vw, 380px);
}
.overlay-title { font-size: 28px; font-weight: 800; letter-spacing: 6px; color: var(--neon-cyan); }

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: stretch;
}
.pause-rank { width: 100%; max-height: 30vh; overflow-y: auto; }

/* ---------- 结算 ---------- */
.end-card { padding: 26px 40px; min-width: min(92vw, 420px); }
.end-title { font-size: 34px; font-weight: 900; letter-spacing: 6px; color: var(--neon-pink); text-shadow: 0 0 20px rgba(255,45,120,0.6); }
.end-score { font-size: 26px; font-weight: 800; color: var(--neon-cyan); font-variant-numeric: tabular-nums; }
.end-kills { font-size: 14px; color: rgba(255,255,255,0.7); }
.record {
  font-size: 18px;
  font-weight: 800;
  color: var(--neon-yellow);
  animation: comboPulse 0.5s ease infinite;
}
.submit-row { display: flex; gap: 10px; width: 100%; }
.name-input {
  flex: 1;
  font-size: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0,229,255,0.5);
  background: rgba(255,255,255,0.06);
  color: #fff;
  outline: none;
  min-width: 0;
}
.name-input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 14px rgba(0,229,255,0.35); }
.name-input::placeholder { color: rgba(255,255,255,0.35); }
.submit-done { color: #7CFC9B; font-weight: 600; letter-spacing: 2px; }
.end-rank { min-width: min(92vw, 420px); max-height: 30vh; }

/* ---------- 动画 ---------- */
@keyframes floatIn {
  from { opacity: 0; transform: translateY(-18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes comboPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* 滚动条美化 */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

/* ---------- 账号栏 ---------- */
.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.account-info {
  font-size: 14px;
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  letter-spacing: 1px;
}
.btn-small {
  font-size: 13px;
  padding: 6px 16px;
  letter-spacing: 1px;
  border-radius: 8px;
}

/* ---------- 登录/注册 ---------- */
.auth-panel { padding: 28px 36px; min-width: min(90vw, 360px); }
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}
.auth-form .name-input { width: 100%; padding: 11px 14px; }
.auth-error {
  color: #ff6b81;
  font-size: 13px;
  text-align: center;
  letter-spacing: 1px;
}
.rp-info {
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  text-align: center;
  letter-spacing: 1px;
}
.rp-username {
  color: var(--neon-yellow);
  font-weight: 700;
}

/* ---------- 管理员面板 ---------- */
.admin-panel {
  padding: 24px 28px;
  min-width: min(94vw, 640px);
  max-height: 78vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.admin-table-wrap {
  overflow-y: auto;
  max-height: 58vh;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table thead th {
  position: sticky;
  top: 0;
  background: #141a2e;
  color: var(--neon-cyan);
  font-weight: 700;
  letter-spacing: 1px;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.18);
  z-index: 1;
}
.admin-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: rgba(255,255,255,0.04); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-name { font-weight: 700; }
.admin-score-cell {
  font-variant-numeric: tabular-nums;
  color: var(--neon-cyan);
  font-weight: 700;
  text-align: right;
}
.admin-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-noop { color: rgba(255,255,255,0.25); }
.admin-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-total { font-size: 13px; color: rgba(255,255,255,0.6); letter-spacing: 1px; }
.tag {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.tag-admin { background: rgba(255,209,102,0.2); color: var(--neon-yellow); border: 1px solid rgba(255,209,102,0.5); }
.tag-user { background: rgba(0,229,255,0.12); color: var(--neon-cyan); border: 1px solid rgba(0,229,255,0.4); }
.tag-banned { background: rgba(255,77,94,0.2); color: #ff6b81; border: 1px solid rgba(255,77,94,0.5); }
.tag-ok { background: rgba(124,252,155,0.15); color: #7cfc9b; border: 1px solid rgba(124,252,155,0.4); }
.admin-loading { text-align: center; color: rgba(255,255,255,0.5); padding: 20px; }
