/* 极速环道竞速 — 样式表
   只负责 HUD / 菜单 / 按钮 / 移动端触控，3D 画面由 Three.js 渲染。 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b1220;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; color: #fff; }
#game-container { position: fixed; inset: 0; }
#game-container canvas { display: block; }
.hidden { display: none !important; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hud-box { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; padding: 6px 14px; text-align: center; min-width: 86px; backdrop-filter: blur(4px); }
.hud-label { display: block; font-size: 11px; color: #9fb3d1; letter-spacing: 1px; }
.hud-box span:last-child { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-bottom { position: absolute; left: 16px; right: 16px; bottom: 16px;
  display: flex; align-items: flex-end; gap: 18px; }
#hud-speed { background: rgba(0,0,0,.55); border-radius: 12px; padding: 8px 18px; }
#speed-num { font-size: 42px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
#hud-speed .unit { font-size: 13px; color: #9fb3d1; margin-left: 4px; }
.nitro-wrap { flex: 1; max-width: 320px; margin-bottom: 6px; }
#nitro-bar { height: 12px; background: rgba(255,255,255,.18); border-radius: 6px; overflow: hidden; margin-top: 4px; }
#nitro-fill { height: 100%; width: 100%; background: linear-gradient(90deg,#22d3ee,#f97316);
  transition: width .12s linear; }
#minimap { margin-left: auto; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.18);
  border-radius: 50%; }
#wrong-way { position: absolute; top: 76px; left: 50%; transform: translateX(-50%);
  background: #dc2626; padding: 8px 20px; border-radius: 999px; font-weight: 800;
  animation: blink .5s infinite alternate; }
@keyframes blink { from { opacity: 1; } to { opacity: .55; } }
#countdown { position: absolute; top: 38%; left: 50%; transform: translate(-50%,-50%);
  font-size: 110px; font-weight: 900; color: #facc15;
  text-shadow: 0 4px 24px rgba(0,0,0,.7); }
#toast { position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  font-size: 26px; font-weight: 800; text-shadow: 0 2px 12px rgba(0,0,0,.8); }

/* ---- 覆盖层：菜单 / 结算 / 暂停 ---- */
.overlay { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center;
  background: rgba(5,10,25,.72); backdrop-filter: blur(6px); padding: 20px; }
.overlay h1 { font-size: 42px; letter-spacing: 2px; }
.overlay .subtitle { color: #9fb3d1; font-size: 15px; }
.menu-card { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px; padding: 16px 20px; line-height: 1.8; max-width: 520px; }
.menu-card .hint { color: #9fb3d1; font-size: 13px; }
button { pointer-events: auto; cursor: pointer; border: none; border-radius: 999px;
  background: #f97316; color: #fff; font-size: 18px; font-weight: 800;
  padding: 13px 38px; box-shadow: 0 6px 20px rgba(249,115,22,.45); }
button:hover { background: #ea580c; }
button.secondary { background: rgba(255,255,255,.16); box-shadow: none; }
.foot { color: #7c8aa5; font-size: 12px; }
#results-body { line-height: 2; font-size: 17px; background: rgba(255,255,255,.08);
  border-radius: 14px; padding: 14px 28px; min-width: 300px; }

/* ---- 移动端触控 ---- */
#touch-controls { position: fixed; inset: auto 0 0 0; z-index: 6; display: flex;
  justify-content: space-between; padding: 0 12px 86px; pointer-events: none; }
#touch-controls button { pointer-events: auto; width: 62px; height: 62px; border-radius: 50%;
  font-size: 15px; padding: 0; background: rgba(255,255,255,.22);
  border: 1px solid rgba(255,255,255,.35); box-shadow: none; }
#touch-controls button.active { background: #f97316; }
.touch-left, .touch-right { display: flex; gap: 10px; align-items: flex-end; }
#touch-throttle { width: 74px !important; height: 74px !important; }
@media (max-width: 640px) {
  .overlay h1 { font-size: 30px; }
  #speed-num { font-size: 30px; }
  #minimap { width: 110px; height: 110px; }
  .hud-box { min-width: 68px; padding: 4px 8px; }
  #countdown { font-size: 72px; }
}
