/* Shared by Racer, Police Chase and Takedown. */

html, body { overscroll-behavior: none; }
.stage {
  position: relative;
  width: min(calc(100vw - 16px), 1200px);
  height: calc(100vh - 72px);
  height: calc(100dvh - 72px);
  margin: 8px auto 0;
  border-radius: 16px;
  overflow: hidden;
  background: #9cc8e8;
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
canvas { display: block; width: 100%; height: 100%; }
.overlay { background: rgba(10, 16, 30, 0.6) !important; padding: 18px; }
.overlay h2 { font-size: clamp(28px, 6vw, 44px); letter-spacing: 0.06em; font-style: italic; text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35); }
.overlay p { max-width: 440px; margin: 0 auto; line-height: 1.45; }
.overlay p b { color: var(--ink); }
.overlay .hint { font-size: 13px; }
.touch .keys { display: none; }
.stage-btn { display: grid; gap: 2px; min-width: 150px; }
.stage-btn small { font-size: 11px; font-weight: 700; opacity: 0.85; }
.stage-btn:disabled { opacity: 0.4; }

.hud { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 200ms ease; color: #fff; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); font-style: italic; }
.hud.show { opacity: 1; }
.hud .tl { position: absolute; top: 10px; left: 14px; }
.hud #big { font-size: 44px; line-height: 1; }
.hud #big small { font-size: 18px; opacity: 0.9; }
.hud #stage-name { font-size: 12px; letter-spacing: 0.06em; opacity: 0.85; margin-top: 4px; font-style: normal; }
.hud .tc { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: grid; justify-items: center; gap: 6px; }
.hud .track { width: min(36vw, 220px); height: 10px; border-radius: 6px; background: rgba(0, 0, 0, 0.35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3); overflow: hidden; }
.hud #bar { height: 100%; width: 0; background: #ffb020; border-radius: 6px; }
.hud .barlab { font-size: 11px; letter-spacing: 0.1em; font-style: normal; }
.hud #timer { font-size: 26px; line-height: 1; }
.hud .br { position: absolute; right: 16px; bottom: 14px; text-align: right; }
.hud #speed { font-size: 46px; line-height: 1; }
.hud .kmh { font-size: 13px; letter-spacing: 0.1em; }
.touch .hud .br { bottom: auto; top: 60px; }
.hud #nitros { display: flex; gap: 5px; justify-content: flex-end; margin-top: 6px; }
.hud #nitros i { width: 12px; height: 20px; border-radius: 4px; background: #3fa8ff; box-shadow: 0 0 8px #3fa8ff; }
.hud #nitros i.off { background: rgba(0, 0, 0, 0.35); box-shadow: none; }
#msg { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font-size: clamp(34px, 8vw, 64px); font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity 150ms; pointer-events: none; }
#msg.show { opacity: 1; }
#msg small { display: block; font-size: 16px; font-style: normal; letter-spacing: 0.04em; }
#pause { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.3); color: #fff; display: grid; place-items: center; z-index: 6; pointer-events: auto; }
#pause svg { width: 18px; height: 18px; }
.hud .tr { position: absolute; top: 60px; right: 14px; }

.pad { position: absolute; left: 0; right: 0; bottom: 14px; display: none; justify-content: space-between; padding: 0 14px; pointer-events: none; z-index: 4; }
.touch .pad.show { display: flex; }
.pad .side { display: flex; gap: 12px; align-items: flex-end; pointer-events: auto; }
.pad button {
  width: 78px; height: 78px; border-radius: 50%; border: 0; font-size: 28px; font-weight: 900; color: #fff;
  background: rgba(255, 255, 255, 0.16); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
  touch-action: none; transition: transform 60ms, background 60ms;
}
.pad button.nitro { background: rgba(63, 168, 255, 0.5); font-size: 13px; letter-spacing: 0.06em; width: 88px; height: 88px; }
.pad button.small { width: 62px; height: 62px; font-size: 12px; letter-spacing: 0.05em; }
.pad button.trap { background: rgba(255, 176, 32, 0.5); font-size: 11px; width: 70px; height: 70px; }
.pad button.cool { opacity: 0.4; }
.pad button.on { transform: scale(0.9); background: rgba(255, 255, 255, 0.4); }

/* The title's road buttons: one row, the open roads gold, the rest dimmed. */
#stages.modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
#stages .stage-btn { min-width: 190px; --accent: #f6c020; --accent-ink: #4a2a00; font-size: 21px; padding: 11px 22px 13px; border-radius: 16px; }
#stages .stage-btn small { font-family: var(--font); }
#title .menu { max-width: 760px; }
#stages .stage-btn:disabled { --accent: #4a5a7a; --accent-ink: #dde4f4; opacity: 0.8; filter: none; }
