/* 霓虹疾跑 · 3D 无尽跑酷 UI 样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #05060f;
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #eaf2ff;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game-container {
  position: fixed; inset: 0;
  touch-action: none;
}
#game-container canvas { display: block; }

/* 受击红晕 */
#vignette {
  position: fixed; inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255,0,60,0) 40%, rgba(255,0,60,0.75) 100%);
  opacity: 0; transition: opacity 0.12s;
  z-index: 30;
}
#vignette.flash { opacity: 1; }
#vignette.shield {
  background: radial-gradient(ellipse at center, rgba(60,180,255,0) 45%, rgba(60,180,255,0.7) 100%);
}

#ui { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#ui > * { pointer-events: auto; }

.hidden { display: none !important; }

/* 加载 */
#loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; background: #05060f; z-index: 100;
  color: #8fb0ff; font-size: 15px; letter-spacing: 2px;
}
.load-spinner {
  width: 42px; height: 42px;
  border: 3px solid rgba(80,140,255,0.2);
  border-top-color: #18e0ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 屏幕面板 */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
}
.screen.overlay { background: rgba(4, 6, 18, 0.72); backdrop-filter: blur(4px); }
#screen-start { background: linear-gradient(180deg, rgba(4,6,18,0.35) 0%, rgba(4,6,18,0.78) 100%); }

.game-title {
  font-size: clamp(38px, 8vw, 64px);
  letter-spacing: 10px;
  font-weight: 900;
  background: linear-gradient(90deg, #18e0ff, #ff2d95);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 34px rgba(24, 224, 255, 0.35);
}
.game-sub { font-size: 13px; letter-spacing: 6px; color: #8fb0ff; margin-top: -8px; }

.stats-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stat-tag {
  background: rgba(20, 30, 70, 0.65);
  border: 1px solid rgba(80, 140, 255, 0.35);
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; color: #aeC4ff;
}
.stat-tag b { color: #fff; margin-left: 4px; }
.coin-dot {
  display: inline-block; width: 11px; height: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe98a, #f5b301 65%, #b97e00);
  margin-right: 5px; vertical-align: -1px;
  box-shadow: 0 0 6px rgba(245, 179, 1, 0.8);
}

/* 按钮 */
.btn {
  font-family: inherit;
  background: rgba(22, 34, 78, 0.85);
  color: #dce8ff;
  border: 1px solid rgba(90, 150, 255, 0.5);
  border-radius: 10px;
  padding: 10px 26px;
  font-size: 16px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s;
  min-width: 150px;
}
.btn:hover { background: rgba(38, 56, 120, 0.95); box-shadow: 0 0 14px rgba(60, 140, 255, 0.4); }
.btn:active { transform: scale(0.95); }
.btn-primary {
  background: linear-gradient(90deg, #0aa8c8, #7a2bd8);
  border-color: rgba(160, 220, 255, 0.7);
  font-size: 19px; font-weight: 700;
  padding: 13px 40px;
  box-shadow: 0 0 22px rgba(24, 200, 255, 0.35);
}
.btn-primary:hover { box-shadow: 0 0 30px rgba(120, 90, 255, 0.6); }
.btn-small { min-width: 0; padding: 5px 16px; font-size: 13px; border-radius: 16px; }
.btn-small.owned { border-color: #3ddc84; color: #9ff0c4; }
.btn-small.locked { border-color: #f5b301; color: #ffd766; }
.btn-small.cant { border-color: #666; color: #888; }
.btn-arrow { min-width: 0; padding: 8px 14px; border-radius: 50%; font-size: 15px; }
.btn-mute { min-width: 0; font-size: 13px; padding: 6px 14px; opacity: 0.85; }
.btn-pause {
  min-width: 0; width: 42px; height: 42px;
  border-radius: 50%; padding: 0;
  font-size: 14px; line-height: 42px; text-align: center;
}
.btn:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: none; }

/* 皮肤选择 */
.skin-box {
  display: flex; align-items: center; gap: 14px;
  background: rgba(12, 18, 45, 0.6);
  border: 1px solid rgba(80, 140, 255, 0.25);
  border-radius: 14px; padding: 10px 16px;
}
.skin-mid { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 130px; }
.skin-label { font-size: 11px; letter-spacing: 3px; color: #7f96cc; }
#skin-name { font-size: 17px; font-weight: 700; letter-spacing: 2px; }

/* 任务 */
.missions {
  width: min(420px, 92vw);
  background: rgba(12, 18, 45, 0.6);
  border: 1px solid rgba(80, 140, 255, 0.25);
  border-radius: 14px; padding: 12px 16px;
}
.missions h3 { font-size: 14px; letter-spacing: 4px; color: #8fb0ff; margin-bottom: 8px; text-align: center; }
.missions ul { list-style: none; }
.missions li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: 13px;
  border-top: 1px dashed rgba(90, 140, 255, 0.15);
}
.missions li:first-child { border-top: none; }
.mi-text { flex: 1; color: #cdd9f5; }
.mi-bar {
  width: 84px; height: 8px; border-radius: 4px;
  background: rgba(60, 80, 140, 0.4); overflow: hidden; flex-shrink: 0;
}
.mi-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #18e0ff, #7a5cff); border-radius: 4px; }
.mi-num { width: 62px; text-align: right; font-size: 11px; color: #7f96cc; flex-shrink: 0; }
.mi-claim {
  min-width: 0; flex-shrink: 0;
  padding: 3px 10px; font-size: 12px;
  border-radius: 12px;
  background: linear-gradient(90deg, #c8860a, #f5b301);
  border: none; color: #201500; font-weight: 700; cursor: pointer;
}
.mi-claim:active { transform: scale(0.93); }
.mi-done { color: #3ddc84; font-size: 12px; flex-shrink: 0; }

.help-text {
  font-size: 12px; line-height: 1.9; color: #7f96cc;
  text-align: center; letter-spacing: 1px;
}

/* HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 16px;
}
#hud-score {
  font-size: 34px; font-weight: 900; letter-spacing: 2px;
  text-shadow: 0 0 14px rgba(24, 224, 255, 0.6);
}
#hud-dist { font-size: 14px; color: #9fc0ff; letter-spacing: 2px; }
#hud-right { display: flex; align-items: center; gap: 12px; pointer-events: auto; }
#hud-coins {
  font-size: 17px; font-weight: 700; color: #ffd766;
  background: rgba(20, 26, 10, 0.5); padding: 6px 12px; border-radius: 18px;
  border: 1px solid rgba(245, 179, 1, 0.35);
}
#powerup-bar {
  position: absolute; top: 74px; left: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.pu-chip {
  position: relative;
  width: 92px; padding: 4px 8px;
  font-size: 12px; letter-spacing: 1px;
  border-radius: 8px; overflow: hidden;
  background: rgba(14, 22, 52, 0.75);
  border: 1px solid rgba(120, 170, 255, 0.4);
  color: #eaf2ff;
}
.pu-chip > i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(24, 224, 255, 0.28);
}
.pu-chip > span { position: relative; }

/* 结算 */
.screen h2 { font-size: 34px; letter-spacing: 8px; text-shadow: 0 0 18px rgba(255, 60, 90, 0.5); }
.newbest {
  color: #ffd766; font-size: 16px; font-weight: 700; letter-spacing: 4px;
  animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 0.6; transform: scale(1); } to { opacity: 1; transform: scale(1.08); } }
.over-grid {
  display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px; width: min(360px, 86vw);
}
.over-cell {
  background: rgba(14, 22, 52, 0.75);
  border: 1px solid rgba(80, 140, 255, 0.3);
  border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.over-cell span { font-size: 12px; color: #7f96cc; letter-spacing: 2px; }
.over-cell b { font-size: 22px; }
.missions-over { width: min(360px, 86vw); }

/* 提示与浮层 */
#hint {
  position: absolute; left: 50%; bottom: 15%;
  transform: translateX(-50%);
  background: rgba(8, 12, 30, 0.8);
  border: 1px solid rgba(24, 224, 255, 0.5);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 14px; letter-spacing: 2px; color: #bfefff;
  text-align: center; line-height: 1.8;
  animation: hintIn 0.4s ease-out;
  white-space: nowrap;
}
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }

#toast-wrap {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(10, 16, 40, 0.9);
  border: 1px solid rgba(245, 179, 1, 0.6);
  color: #ffe9a8;
  padding: 8px 18px; border-radius: 20px;
  font-size: 13px; letter-spacing: 1px;
  animation: toastIn 0.3s ease-out;
  transition: opacity 0.4s, transform 0.4s;
  white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.out { opacity: 0; transform: translateY(-10px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 600px) {
  .btn { min-width: 120px; font-size: 15px; }
  .game-title { letter-spacing: 6px; }
  .missions { font-size: 12px; }
  #hud-score { font-size: 26px; }
  .screen { gap: 10px; }
}
