* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #111; font-family: system-ui, sans-serif; }
#game { position: fixed; inset: 0; }
canvas { display: block; }

/* --- 游戏 HUD --- */
#hud {
  position: fixed; top: 16px; left: 16px; color: #fff;
  font-size: 14px; line-height: 1.6; text-shadow: 0 1px 3px rgba(0,0,0,.6);
  pointer-events: none; user-select: none; display: none;
}
#hud .speed { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
#hud .unit { font-size: 14px; }
#hud .lap { font-size: 18px; font-weight: 600; margin-top: 2px; }
#hud .time { font-variant-numeric: tabular-nums; color: #ffd447; }
#hud .warn { color: #ff5555; font-weight: 700; display: none; margin-top: 6px; }
#hud .warn.show { display: block; }
.exit-hint {
  margin-top: 20px; font-size: 14px; color: rgba(255,255,255,0.6);
  padding: 4px 8px; border: 1px solid rgba(255,255,255,0.2);
  border-radius: 4px; display: inline-block;
}

/* --- 手机端虚拟按键 --- */
#touch-controls {
  position: fixed; inset: 0; pointer-events: none; display: none;
  user-select: none; -webkit-user-select: none;
}
#touch-controls .btn {
  position: absolute; pointer-events: auto;
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35);
  color: #fff; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; -webkit-tap-highlight-color: transparent; backdrop-filter: blur(4px);
}
#touch-controls .btn.active { background: rgba(255,255,255,.35); }
#btn-left  { left: 24px;  bottom: 24px; }
#btn-right { left: 112px; bottom: 24px; }
#btn-gas   { right: 24px; bottom: 24px; width: 88px; height: 88px; }
#btn-brake { right: 128px; bottom: 24px; }
#btn-hand  { right: 24px; bottom: 128px; }
#btn-nitro { right: 24px; bottom: 230px; width: 72px; height: 72px; font-weight: 900; color: #00ffff; background: rgba(0, 255, 255, 0.2); border-color: #00ffff; }

@media (pointer: coarse) {
  #touch-controls { display: block; }
}

/* --- UI 界面通用样式 --- */
.ui-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0a1128 0%, #1a2a6c 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #fff; z-index: 100; font-family: system-ui, sans-serif;
}
.ui-screen h1 { font-size: 64px; margin-bottom: 10px; color: #00ffff; text-shadow: 0 0 20px #00ffff; letter-spacing: 4px; }
.ui-screen h2 { font-size: 36px; margin-bottom: 30px; }
.ui-screen p { color: #888; margin-bottom: 40px; letter-spacing: 2px; }
.menu-buttons { display: flex; flex-direction: column; gap: 16px; }
.ui-btn {
  padding: 16px 64px; font-size: 20px; font-weight: bold; color: #fff;
  background: rgba(255,255,255,0.1); border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px; cursor: pointer; transition: all 0.2s; backdrop-filter: blur(10px);
}
.ui-btn:hover { background: rgba(255,255,255,0.3); transform: translateY(-2px); }
.ui-btn.primary { background: rgba(0, 255, 255, 0.2); border-color: #00ffff; box-shadow: 0 0 15px rgba(0,255,255,0.4); }
.ui-btn.primary:hover { background: rgba(0, 255, 255, 0.4); }

/* 个人中心 */
.profile-card {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  padding: 30px; border-radius: 12px; display: flex; align-items: center; gap: 30px; margin-bottom: 40px;
}
.avatar { font-size: 64px; }
.info h3 { margin-bottom: 10px; font-size: 24px; }
.info p { margin-bottom: 5px; color: #fff; font-size: 16px; letter-spacing: 1px; }
.info span { color: #ffd700; font-weight: bold; }