* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root { --accent: #ffd24d; --panel: rgba(12, 16, 28, .82); }
html, body { height: 100%; overflow: hidden; background: #0a0e18; color: #fff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; }
canvas { display: block; }

/* ---- pantalla de inicio ---- */
#menu { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 18px; background: radial-gradient(circle at 50% 30%, #1b2440, #070a12);
  z-index: 30; padding: 24px; text-align: center; }
#menu h1 { font-size: clamp(32px, 9vw, 64px); letter-spacing: 1px;
  background: linear-gradient(90deg, #ffd24d, #ff7a4d, #ff4da6); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
#menu p { opacity: .8; max-width: 440px; line-height: 1.5; }
#menu input { font-size: 18px; padding: 12px 16px; border-radius: 12px; border: 2px solid #334;
  background: #121829; color: #fff; width: min(320px, 80vw); text-align: center; }
.btn { font-size: 20px; font-weight: 700; padding: 14px 34px; border: none; border-radius: 14px;
  background: var(--accent); color: #1a1205; cursor: pointer; box-shadow: 0 6px 0 #a9851f; }
.btn:active { transform: translateY(3px); box-shadow: 0 3px 0 #a9851f; }

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; display: none; }
.card { position: fixed; background: var(--panel); border-radius: 14px; padding: 10px 14px;
  backdrop-filter: blur(6px); font-variant-numeric: tabular-nums; }
#lapPos { top: 12px; left: 12px; font-size: 20px; line-height: 1.3; }
#lapPos b { color: var(--accent); }
#mini { top: 12px; right: 12px; width: 120px; height: 120px; padding: 6px; }
#mini canvas { width: 108px; height: 108px; }
#speed { bottom: 14px; left: 50%; transform: translateX(-50%); font-size: 14px; opacity: .85; }
#boostWrap { bottom: 42px; left: 50%; transform: translateX(-50%); width: 160px; height: 8px;
  background: #223; border-radius: 6px; overflow: hidden; }
#boostBar { height: 100%; width: 0; background: linear-gradient(90deg, #4dff88, #ffd24d); }
#count { position: fixed; top: 38%; left: 0; right: 0; text-align: center; font-size: clamp(60px, 20vw, 160px);
  font-weight: 800; color: var(--accent); text-shadow: 0 4px 24px #000; z-index: 12; display: none; }

/* ---- controles tactiles ---- */
#pad { position: fixed; inset: 0; z-index: 11; display: none; }
.ctl { position: fixed; bottom: 22px; width: 84px; height: 84px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35); display: flex;
  align-items: center; justify-content: center; font-size: 30px; pointer-events: auto; color: #fff; }
.ctl:active, .ctl.on { background: rgba(255,210,77,.4); }
#bLeft { left: 20px; } #bRight { left: 120px; }
#bItem { right: 20px; } #bDrift { right: 120px; width: 96px; height: 96px; font-size: 16px; font-weight: 700; }
#bItem.has { background: rgba(77,255,136,.5); box-shadow: 0 0 16px #4dff88; }

/* ---- resultados ---- */
#results { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center;
  background: rgba(4,6,12,.72); }
#results .box { background: var(--panel); border-radius: 18px; padding: 24px 28px; min-width: min(360px, 88vw); }
#results h2 { margin-bottom: 14px; color: var(--accent); }
#results ol { list-style: none; }
#results li { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #ffffff14; font-size: 18px; }
#results li.me { color: var(--accent); font-weight: 700; }
#conn { position: fixed; bottom: 6px; right: 10px; font-size: 11px; opacity: .5; z-index: 25; }
