/* Boda Nights & Days UI. Fonts are bundled (SIL Open Font License) so the game works offline. */
@font-face {
  font-family: 'Bungee';
  font-weight: 400;
  font-display: swap;
  src: url('fonts/bungee-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/chakra-petch-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/chakra-petch-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Chakra Petch';
  font-weight: 700;
  font-display: swap;
  src: url('fonts/chakra-petch-latin-700-normal.woff2') format('woff2');
}
:root {
  --bg: #0a0718;
  --panel: rgba(14, 11, 30, 0.8); /* solid enough to read without a live blur of the 3D view behind it */
  --line: rgba(190, 180, 255, 0.22);
  --or: #ff9f1c;
  --ord: #b3530b;
  --pk: #ff3d7f;
  --tl: #2ee6c5;
  --rd: #ff4d5e;
  --gd: #ffc23d;
  --tx: #f4efff;
  --dim: #b7aed6;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Chakra Petch', system-ui, sans-serif;
  color: var(--tx);
  font-weight: 600;
}
button {
  font-family: inherit;
  color: inherit;
}
#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#c.px {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.hide {
  display: none !important;
}
.glass {
  background: var(--panel);
  border: 1px solid var(--line);
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#hud button,
#hud .tc {
  pointer-events: auto;
}
#top {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
#hpBox {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
#hearts {
  display: flex;
  gap: 3px;
  padding: 6px 9px;
  border-radius: 12px;
}
#hearts svg {
  width: clamp(17px, 2.9vmin, 24px);
  height: auto;
}
#pus {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pu {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 8px 4px;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid currentColor;
}
.pu i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
}
#mid {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#chip {
  border-radius: 999px;
  padding: 6px 14px;
  font-size: clamp(10px, 1.8vmin, 13px);
  letter-spacing: 0.1em;
  white-space: nowrap;
  display: flex;
  gap: 10px;
}
#chip span {
  color: var(--gd);
}
#bossbar {
  width: min(380px, 54vw);
  text-align: center;
  font:
    400 clamp(11px, 2vmin, 14px) 'Bungee',
    sans-serif;
  color: var(--rd);
  text-shadow: 0 2px 0 #05030f;
}
#bossbar i {
  display: block;
  height: 9px;
  border: 1px solid rgba(0, 0, 0, 0.7);
  background: rgba(40, 10, 24, 0.8);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 3px;
}
#bossbar em {
  display: block;
  height: 100%;
  background: linear-gradient(#ff8a66, #ff4d5e);
  width: 100%;
}
#rt {
  display: flex;
  align-items: center;
  gap: 8px;
}
#score {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 12px;
  font:
    400 clamp(13px, 2.4vmin, 17px) 'Bungee',
    sans-serif;
}
.coin {
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #ffc23d 55%, #b3530b);
  display: inline-block;
}
.ib {
  width: 44px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  letter-spacing: 0.08em;
  cursor: pointer;
  line-height: 1;
}
.ib svg {
  width: 18px;
  height: 18px;
  margin-bottom: 2px;
}
.ib:active {
  background: rgba(255, 159, 28, 0.3);
}
#radar {
  position: absolute;
  right: 10px;
  top: 60px;
  width: clamp(120px, 15vmin, 170px);
  height: clamp(120px, 15vmin, 170px);
  border-radius: 16px;
  border: 2px solid rgba(190, 180, 255, 0.35);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
#banner {
  position: absolute;
  left: 0;
  right: 0;
  top: 24%;
  text-align: center;
  font:
    400 clamp(24px, 6.4vmin, 52px) 'Bungee',
    sans-serif;
  color: var(--or);
  text-shadow:
    0 3px 0 var(--ord),
    0 7px 14px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.25s;
}
#banner.on {
  opacity: 1;
}
#banner small {
  display: block;
  font:
    700 clamp(12px, 2.3vmin, 17px) 'Chakra Petch',
    sans-serif;
  color: var(--tx);
  text-shadow: 0 2px 6px #000;
  letter-spacing: 0.1em;
  margin-top: 4px;
}
#ret {
  position: absolute;
  left: 0;
  top: 0;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border: 2px solid rgba(244, 239, 255, 0.75);
  border-radius: 50%;
  transition:
    width 0.08s,
    height 0.08s,
    margin 0.08s,
    border-color 0.08s;
  will-change: transform;
}
#ret:before,
#ret:after {
  content: '';
  position: absolute;
  background: rgba(244, 239, 255, 0.9);
}
#ret:before {
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px;
  border-radius: 50%;
}
#ret.lock {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-color: var(--rd);
  box-shadow: 0 0 12px rgba(255, 77, 94, 0.8);
}
#ret.hit {
  border-color: #fff;
  box-shadow: 0 0 16px #fff;
}
/* ---------- shooting feedback (weapons.js): hit marker, damage numbers, rocket lock bracket ---------- */
.hitm,
.rlock,
.dmgN {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}
.hitm {
  width: 0;
  height: 0;
}
/* four ticks round the point of impact, like an X with the middle cut out */
.hitm i {
  position: absolute;
  left: -1.5px;
  top: -13px;
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
  transform-origin: 1.5px 13px;
}
.hitm i:nth-child(1) {
  transform: rotate(45deg);
}
.hitm i:nth-child(2) {
  transform: rotate(135deg);
}
.hitm i:nth-child(3) {
  transform: rotate(225deg);
}
.hitm i:nth-child(4) {
  transform: rotate(315deg);
}
.hitm.crit i {
  background: var(--gd);
  height: 10px;
}
.hitm.kill i {
  background: var(--rd);
  width: 4px;
  height: 11px;
  box-shadow:
    0 0 6px rgba(255, 77, 94, 0.9),
    0 0 2px #000;
}
.dmgN {
  font:
    400 clamp(15px, 2.6vmin, 22px) 'Bungee',
    sans-serif;
  color: #fff;
  white-space: nowrap;
  text-shadow:
    0 2px 0 #05030f,
    0 0 3px #05030f,
    0 0 10px rgba(0, 0, 0, 0.7);
}
.dmgN.crit {
  color: var(--gd);
  font-size: clamp(18px, 3.2vmin, 28px);
}
.dmgN.kill {
  color: var(--rd);
}
/* the rocket lock: four orange corners that close on the target, red once it is locked */
.rlock {
  width: 0;
  height: 0;
}
.rlock i {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 3px solid var(--or);
  filter: drop-shadow(0 0 4px rgba(255, 120, 30, 0.8));
}
.rlock i:nth-child(1) {
  left: -30px;
  top: -30px;
  border-right: 0;
  border-bottom: 0;
}
.rlock i:nth-child(2) {
  left: 16px;
  top: -30px;
  border-left: 0;
  border-bottom: 0;
}
.rlock i:nth-child(3) {
  left: -30px;
  top: 16px;
  border-right: 0;
  border-top: 0;
}
.rlock i:nth-child(4) {
  left: 16px;
  top: 16px;
  border-left: 0;
  border-top: 0;
}
.rlock b {
  position: absolute;
  left: 0;
  top: 34px;
  transform: translateX(-50%);
  font:
    400 11px 'Bungee',
    sans-serif;
  letter-spacing: 0.12em;
  color: var(--or);
  text-shadow: 0 2px 0 #05030f;
}
.rlock.locked i {
  border-color: var(--rd);
  filter: drop-shadow(0 0 6px rgba(255, 60, 80, 0.9));
}
.rlock.locked b {
  color: var(--rd);
}
#speedo {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 6px 14px 8px;
  border-radius: 14px;
  text-align: center;
  min-width: 120px;
}
#speedo b {
  font:
    400 clamp(20px, 4vmin, 28px) 'Bungee',
    sans-serif;
  line-height: 1;
}
#speedo small {
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin-left: 4px;
}
#dash {
  height: 5px;
  border-radius: 3px;
  background: rgba(46, 230, 197, 0.18);
  overflow: hidden;
  margin-top: 5px;
}
#dash em {
  display: block;
  height: 100%;
  background: var(--tl);
  width: 100%;
}
#dashL {
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--tl);
  margin-top: 3px;
}
#hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
  padding: 5px 9px;
  border-radius: 8px;
  line-height: 1.5;
  opacity: 0.85;
}
.touch #hint {
  display: none;
}

/* ---------- touch controls ---------- */
.tb {
  border-radius: 50%;
  font-size: 12px;
  letter-spacing: 0.1em;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
}
.tb svg {
  width: 28px;
  height: 28px;
}
#bDash {
  position: absolute;
  right: 18px;
  bottom: 24px;
  width: 96px;
  height: 96px;
  color: var(--tl);
  border-color: rgba(46, 230, 197, 0.65);
}
.touch #bDash {
  display: flex;
}
#bDash:active {
  background: rgba(46, 230, 197, 0.3);
}
#bDash.cd {
  opacity: 0.45;
}
/* the rocket button sits beside NITRO, smaller; it fades out with the rack empty */
#bRocket {
  position: absolute;
  right: 126px;
  bottom: 30px;
  width: 72px;
  height: 72px;
  font-size: 10px;
  color: var(--or);
  border-color: rgba(255, 159, 28, 0.65);
}
#bRocket svg {
  width: 22px;
  height: 22px;
}
.touch #bRocket {
  display: flex;
}
#bRocket:active {
  background: rgba(255, 159, 28, 0.3);
}
#bRocket.cd {
  opacity: 0.3;
}
#joy {
  position: absolute;
  width: 118px;
  height: 118px;
  margin: -59px 0 0 -59px;
  border-radius: 50%;
  border: 2px solid rgba(244, 239, 255, 0.4);
  background: rgba(14, 11, 30, 0.35);
  display: none;
}
#joy i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: var(--or);
  border: 2px solid rgba(0, 0, 0, 0.6);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
@media (max-aspect-ratio: 1/1) {
  #mid {
    top: 50px;
  }
  #radar {
    top: 60px;
    width: 104px;
    height: 104px;
  }
  #pus {
    margin-top: 36px;
  }
}

/* ---------- overlays ---------- */
#bars,
#bars * {
  pointer-events: none;
}
#bars i {
  position: fixed;
  left: 0;
  right: 0;
  height: 0;
  background: #05030f;
  transition: height 0.35s;
}
#bars i:first-child {
  top: 0;
}
#bars i:nth-child(2) {
  bottom: 0;
}
#bars.on i {
  height: 13vh;
}
#card {
  position: fixed;
  left: 6vw;
  bottom: 17vh;
  opacity: 0;
  transform: translateX(-20px);
  transition: all 0.4s 0.3s;
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
}
#bars.on #card {
  opacity: 1;
  transform: none;
}
#card small {
  display: block;
  color: var(--gd);
  font-size: clamp(11px, 2.2vmin, 16px);
  letter-spacing: 0.12em;
}
#card b {
  display: block;
  font-weight: 400;
  font-size: clamp(34px, 9vmin, 84px);
  line-height: 1;
  color: var(--rd);
  text-shadow:
    0 4px 0 #7a1423,
    0 8px 18px #000;
}
#card span {
  font:
    700 clamp(12px, 2.4vmin, 18px) 'Chakra Petch',
    sans-serif;
  color: var(--tx);
}
.ov {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  overflow-y: auto;
  text-align: center;
  gap: 14px;
  padding: 20px;
  background: radial-gradient(ellipse at center, rgba(10, 7, 24, 0.35), rgba(10, 7, 24, 0.9));
}
.ov h1 {
  font:
    400 clamp(40px, 12vmin, 100px)/0.92 'Bungee',
    sans-serif;
  color: var(--or);
  text-shadow:
    0 5px 0 var(--ord),
    0 10px 22px #000;
}
.ov h1 em {
  font-style: normal;
  color: var(--pk);
  text-shadow:
    0 5px 0 #8f1241,
    0 10px 22px #000;
}
.ov h2 {
  font:
    400 clamp(28px, 8vmin, 60px)/1 'Bungee',
    sans-serif;
  color: var(--gd);
  text-shadow:
    0 4px 0 var(--ord),
    0 8px 18px #000;
}
.ov p {
  font-size: clamp(12px, 2.3vmin, 16px);
  color: var(--dim);
  letter-spacing: 0.05em;
  max-width: 560px;
  line-height: 1.5;
}
.ov p b {
  color: var(--tx);
}
.keys {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 7px;
  max-width: 640px;
}
.keys span {
  border-radius: 10px;
  padding: 6px 10px;
  font-size: clamp(10px, 1.9vmin, 13px);
  color: var(--tx);
  text-align: left;
  white-space: nowrap;
}
.keys span b {
  color: var(--gd);
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
  margin-right: 6px;
}
@media (max-width: 520px) {
  .keys {
    grid-template-columns: repeat(2, auto);
  }
}
.go {
  pointer-events: auto;
  font:
    400 clamp(16px, 3.4vmin, 24px) 'Bungee',
    sans-serif;
  color: #2a1200;
  background: var(--or);
  border: 0;
  border-radius: 16px;
  padding: 12px 30px 14px;
  box-shadow:
    0 6px 0 var(--ord),
    0 12px 22px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  margin-top: 6px;
}
.go:disabled {
  opacity: 0.6;
  cursor: default;
}
.go:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 var(--ord),
    0 6px 12px rgba(0, 0, 0, 0.6);
}
.menu {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(300px, 80vw);
}
.opt {
  pointer-events: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  letter-spacing: 0.1em;
  cursor: pointer;
}
.opt b {
  color: var(--gd);
}
.opt:active {
  background: rgba(255, 159, 28, 0.3);
}
#stars {
  display: flex;
  gap: 8px;
}
#stars svg {
  width: clamp(40px, 9vmin, 66px);
  height: auto;
  filter: drop-shadow(0 4px 6px #000);
}
#tally {
  display: grid;
  grid-template-columns: auto auto;
  gap: 5px 24px;
  font-size: clamp(13px, 2.4vmin, 17px);
  text-align: left;
}
#tally b {
  text-align: right;
  color: var(--gd);
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
}
#nogl {
  display: none;
}

/* ---------- XP bar ---------- */
#xp {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 10px;
  font:
    400 11px 'Bungee',
    sans-serif;
  color: var(--tl);
  min-width: 150px;
}
#xp i {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(46, 230, 197, 0.15);
  overflow: hidden;
}
#xp em {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2ee6c5, #9fffe9);
  transition: width 0.15s;
}

/* ---------- stacked overlays (level-up, garage, settings) ---------- */
.ov.top {
  z-index: 5;
  background: radial-gradient(ellipse at center, rgba(10, 7, 24, 0.94), rgba(10, 7, 24, 0.98));
}
.ov button.gpf {
  outline: 3px solid var(--tl);
  outline-offset: 3px;
}
.ov button:focus {
  outline: none;
}
.ov button.gpf:focus {
  outline: 3px solid var(--tl);
}
.menu .go {
  margin: 0 0 6px;
}
.menu.wide {
  width: min(460px, 90vw);
}
.opt:disabled {
  opacity: 0.45;
  cursor: default;
}

/* level-up cards */
#cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 900px;
}
.card {
  pointer-events: auto;
  position: relative;
  width: min(240px, 80vw);
  min-height: 170px;
  padding: 22px 16px 16px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 2px solid var(--c);
  text-align: center;
  transition: transform 0.12s;
}
.card:hover,
.card.gpf {
  transform: translateY(-4px);
  box-shadow: 0 0 24px color-mix(in srgb, var(--c) 55%, transparent);
}
.card kbd {
  position: absolute;
  left: 10px;
  top: 8px;
  font:
    400 12px 'Bungee',
    sans-serif;
  color: var(--dim);
}
.card b {
  font:
    400 clamp(15px, 2.6vmin, 20px) 'Bungee',
    sans-serif;
  color: var(--c);
}
.card span {
  font-size: 14px;
  color: var(--tx);
  line-height: 1.35;
}
.card em,
.perm em {
  display: flex;
  gap: 4px;
  margin-top: auto;
}
.card em i,
.perm em i {
  width: 16px;
  height: 6px;
  border-radius: 3px;
  background: rgba(190, 180, 255, 0.2);
}
.card em i.on,
.perm em i.on {
  background: var(--c, var(--gd));
}

/* garage rows */
.perm {
  text-align: left;
  gap: 12px;
}
.perm span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.perm small {
  font-size: 12px;
  color: var(--dim);
  letter-spacing: 0.03em;
}
.perm em {
  margin-top: 3px;
}
.perm strong {
  font:
    400 16px 'Bungee',
    sans-serif;
  color: var(--gd);
  white-space: nowrap;
}
.perm.maxed strong {
  color: var(--tl);
}

/* "& DAYS" line under the title */
.ov h1 .amp {
  display: block;
  font-size: 0.42em;
  letter-spacing: 0.18em;
  color: var(--gd);
  text-shadow:
    0 3px 0 var(--ord),
    0 8px 16px #000;
  margin-top: 0.12em;
}

/* route select */
#routeCards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 300px));
  gap: 14px;
  justify-content: center;
}
@media (max-width: 640px) {
  #routeCards {
    grid-template-columns: minmax(0, 300px);
  }
}
.card.route {
  width: auto;
  min-height: 150px;
  align-items: flex-start;
  text-align: left;
  padding: 16px 18px;
}
.card.route small {
  font:
    400 11px 'Bungee',
    sans-serif;
  letter-spacing: 0.14em;
  color: var(--c);
}
.card.route.cur {
  box-shadow: 0 0 0 2px var(--tl) inset;
}
.card.route .km {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--dim);
  margin-top: auto;
}

/* race select (the career): five cards a row, then a strip with the focused race's rule and stars */
#raceCards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: min(1240px, 100%);
}
@media (max-width: 700px) {
  #raceCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.card.race {
  width: auto;
  min-height: 0;
  align-items: stretch;
  text-align: left;
  padding: 10px 13px 11px;
  gap: 4px;
}
.card.race em {
  display: inline;
  margin: 0;
  font-style: normal;
}
.card.race .hd,
.card.race .ft {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card.race .no {
  font:
    400 13px 'Bungee',
    sans-serif;
  color: var(--dim);
}
.card.race .st {
  color: var(--gd);
  letter-spacing: 0.12em;
  font-size: 14px;
}
.card.race b {
  font-size: clamp(13px, 2.1vmin, 17px);
  line-height: 1.1;
}
.card.race small {
  font:
    400 10px 'Bungee',
    sans-serif;
  letter-spacing: 0.1em;
  color: var(--c);
}
.card.race .bl {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.3;
}
.card.race .cr {
  font:
    400 10px 'Bungee',
    sans-serif;
  letter-spacing: 0.06em;
  color: var(--pk);
  margin-top: auto;
}
.card.race .cr i {
  font-style: normal;
  color: var(--dim);
  margin-right: 3px;
}
.card.race .cr + .tg {
  margin-top: 0;
}
.card.race .tg {
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--tx);
  line-height: 1.35;
  margin-top: auto;
}
.card.race .ft {
  font:
    400 11px 'Bungee',
    sans-serif;
  letter-spacing: 0.08em;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 2px 8px;
}
@media (max-width: 1000px) {
  .card.race .ft {
    font-size: 10px;
    letter-spacing: 0.03em;
  }
}
.card.race .rule {
  color: var(--r);
}
.card.race .pay {
  color: var(--gd);
}
.card.race .lock {
  color: var(--dim);
}
.card.race.locked {
  border-style: dashed;
  border-color: rgba(190, 180, 255, 0.3);
}
.card.race.locked > * {
  opacity: 0.45;
}
.card.race.locked:hover {
  transform: none;
  box-shadow: none;
}
.card.race.cur {
  box-shadow: 0 0 0 2px var(--tl) inset;
}
#raceInfo {
  width: min(1240px, 100%);
  min-height: 62px;
  border-radius: 14px;
  border-left: 4px solid var(--c, var(--gd));
  padding: 9px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  text-align: left;
}
#raceInfo b {
  font:
    400 15px 'Bungee',
    sans-serif;
  color: var(--c, var(--gd));
}
#raceInfo span {
  font-size: 13px;
  color: var(--tx);
  flex: 1 1 260px;
}
#raceInfo u {
  text-decoration: none;
  color: var(--gd);
}
#raceInfo .blurb {
  display: none;
  flex-basis: 100%;
  max-width: none;
  font-size: 12px;
}
#raceInfo .cr {
  flex: 1 1 100%;
  font-style: normal;
  font-size: 12px;
  color: var(--dim);
}
#raceInfo .cr i {
  font:
    400 12px 'Bungee',
    sans-serif;
  font-style: normal;
  color: var(--pk);
  margin-right: 8px;
}
#raceInfo ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  list-style: none;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--dim);
}
#raceInfo li i {
  font-style: normal;
  color: rgba(190, 180, 255, 0.3);
  margin-right: 5px;
}
#raceInfo li.on {
  color: var(--tx);
}
#raceInfo li.on i {
  color: var(--gd);
}
#raceInfo small {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.menu.row {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: auto;
}
.menu.row .go {
  margin: 0;
}
#diffBtn {
  gap: 10px;
}
#raceCards,
#raceInfo {
  flex-shrink: 0; /* a tall list scrolls the screen rather than squashing the strip under the buttons */
}
/* short windows: the blurb moves from the cards to the strip under them, and everything tightens up */
@media (max-height: 640px) {
  #races > p,
  .card.race .bl {
    display: none;
  }
  #races {
    gap: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
  }
  #races h2 {
    font-size: 34px;
  }
  .card.race {
    padding: 8px 10px 9px;
    gap: 3px;
  }
  #raceInfo {
    padding: 6px 14px;
    gap: 2px 12px;
  }
  #raceInfo .blurb {
    display: block;
    line-height: 1.35;
  }
  #raceInfo .cr {
    flex-basis: auto;
  }
}

/* results: the race name over the title, and the race's three star conditions under the stars */
#endRace {
  font:
    400 clamp(12px, 2.4vmin, 16px) 'Bungee',
    sans-serif;
  letter-spacing: 0.14em;
  color: var(--tl);
}
#endStars {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  font-size: clamp(11px, 2vmin, 13px);
  letter-spacing: 0.06em;
  color: var(--dim);
}
#endStars li i {
  font-style: normal;
  color: rgba(190, 180, 255, 0.3);
  margin-right: 5px;
}
#endStars li.on {
  color: var(--tx);
}
#endStars li.on i {
  color: var(--gd);
}
#end.race #tally {
  grid-template-columns: auto auto auto auto;
  column-gap: 20px;
}
#end.race #tally span:nth-child(4n + 3) {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}
#end.race .menu {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  width: auto;
}
#end.race .menu .go {
  margin: 0;
}
@media (max-width: 620px) {
  #end.race #tally {
    grid-template-columns: auto auto;
  }
  #end.race #tally span:nth-child(4n + 3) {
    padding-left: 0;
    border-left: 0;
  }
}

/* race rule and clock under the HUD's route chip */
#rule {
  font:
    400 clamp(11px, 2vmin, 14px) 'Bungee',
    sans-serif;
  letter-spacing: 0.08em;
  color: var(--c, var(--gd));
  text-shadow: 0 2px 4px #000;
  white-space: nowrap;
}
#rule small {
  font: inherit;
  color: var(--tx);
  margin-left: 8px;
}
#rule.warn {
  color: var(--rd);
  animation: rulePulse 0.5s ease-in-out infinite alternate;
}
@keyframes rulePulse {
  to {
    opacity: 0.55;
  }
}

/* title: Bungee's capitals rise above a tight line box, so give the heading room above it */
.ov h1 {
  line-height: 1.02;
  margin-top: 0.12em;
}
/* short windows: tighter menus */
@media (max-height: 760px) {
  .ov {
    gap: 9px;
    padding: 12px 20px;
  }
  .ov h1 {
    font-size: clamp(34px, 10vh, 80px);
  }
  .ov p {
    font-size: 12px;
    max-width: 640px;
  }
  .opt {
    padding: 9px 14px;
  }
  .card.route {
    min-height: 120px;
  }
}
@media (max-height: 560px) {
  #start > p:not(:first-child),
  #start .keys {
    display: none !important;
  }
}

/* ---------- route progress, combo, feed, tips, nitro bar ---------- */
#prog {
  position: relative;
  width: min(420px, 60vw);
  height: 7px;
  border-radius: 4px;
  background: rgba(14, 11, 30, 0.6);
  border: 1px solid var(--line);
}
#prog em {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #2ee6c5, #ffc23d);
}
#prog i {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 9px;
  background: rgba(244, 239, 255, 0.55);
}
#prog i:nth-of-type(1) {
  left: 20%;
}
#prog i:nth-of-type(2) {
  left: 40%;
}
#prog i:nth-of-type(3) {
  left: 60%;
}
#prog i:nth-of-type(4) {
  left: 80%;
}
#prog b {
  position: absolute;
  right: -44px;
  top: -5px;
  font:
    400 10px 'Bungee',
    sans-serif;
  color: var(--rd);
}
#combo {
  position: absolute;
  right: 14px;
  top: clamp(190px, 26vmin, 250px);
  text-align: right;
  font-family: 'Bungee', sans-serif;
  text-shadow: 0 3px 0 #05030f;
}
#combo b {
  display: block;
  font-weight: 400;
  font-size: clamp(26px, 5vmin, 40px);
  line-height: 1;
  color: var(--gd);
}
#combo small {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--tx);
}
#combo i {
  display: block;
  width: 90px;
  height: 4px;
  margin: 4px 0 0 auto;
  background: rgba(255, 194, 61, 0.2);
  border-radius: 2px;
  overflow: hidden;
}
#combo em {
  display: block;
  height: 100%;
  background: var(--gd);
}
#feed {
  position: absolute;
  right: 14px;
  top: clamp(260px, 36vmin, 330px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.fd {
  animation: fd 1.7s ease-out forwards;
  text-align: right;
  text-shadow: 0 2px 4px #000;
}
.fd b {
  display: block;
  font:
    400 clamp(13px, 2.3vmin, 17px) 'Bungee',
    sans-serif;
}
.fd small {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--tx);
}
@keyframes fd {
  0% {
    opacity: 0;
    transform: translateX(24px);
  }
  12% {
    opacity: 1;
    transform: none;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}
#tip {
  position: absolute;
  left: 50%;
  bottom: 168px; /* clear of the speed and nitro panel */
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--tl);
  font-size: clamp(13px, 2.4vmin, 17px);
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}
#tip.on {
  opacity: 1;
}
#tip b {
  color: var(--gd);
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
  padding: 0 3px;
}
#dash {
  position: relative;
  height: 7px;
}
#dash::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    90deg,
    transparent calc(33.3% - 1px),
    #05030f 0 33.3%,
    transparent 0 calc(66.6% - 1px),
    #05030f 0 66.6%,
    transparent 0
  );
}
#dash.ready em {
  box-shadow: 0 0 8px var(--tl);
}
.card.route .st {
  position: absolute;
  right: 14px;
  top: 12px;
  font-style: normal;
  color: var(--gd);
  letter-spacing: 2px;
}

/* ---------- big Asphalt-style nitro bar ---------- */
#speedo {
  min-width: min(300px, 70vw);
  padding: 8px 16px 10px;
}
#dash {
  height: 14px;
  border-radius: 7px;
  background: rgba(46, 230, 197, 0.14);
  border: 1px solid rgba(46, 230, 197, 0.45);
  margin-top: 7px;
}
#dash em {
  background: linear-gradient(90deg, #12b8a0, #2ee6c5 60%, #c8fff4);
  transition: width 0.12s;
}
#dash.ready em {
  box-shadow: 0 0 12px var(--tl);
}
#dashL {
  font-size: 10px;
  margin-top: 5px;
  color: var(--dim);
}
#dashL b {
  color: var(--tl);
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
  letter-spacing: 0.14em;
}
#dashL kbd {
  font: inherit;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  margin-left: 6px;
}
#dash.ready + #dashL kbd {
  border-color: var(--tl);
  color: var(--tx);
  animation: pulse 1s infinite;
}
#speedo.boost {
  border-color: var(--tl);
  box-shadow: 0 0 22px rgba(46, 230, 197, 0.55);
}
#speedo.boost #kmh {
  color: var(--tl);
}
@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}
.touch #dashL kbd {
  display: none;
}

/* ================= racing HUD: no boxes, a speed and nitro arc at the top, slanted type, big callouts ================= */
#hud #hearts,
#hud #xp,
#hud #score,
#hud #chip {
  background: none;
  border: 0;
  padding: 2px 4px;
}
#hud #hearts svg {
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
}
#hud #score,
#hud #chip,
#hud #xp {
  text-shadow: 0 2px 4px #000;
}
#hint {
  display: none;
}
#speedo {
  top: 4px;
  bottom: auto;
  min-width: 0;
  width: min(340px, 62vw);
  padding: 0;
  background: none;
  border: 0;
  box-shadow: none !important;
}
#arc {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.6));
}
#arc path {
  fill: none;
  stroke-width: 13;
  stroke-linecap: butt;
}
#arc .bg {
  stroke: rgba(10, 8, 24, 0.55);
}
#arcFill {
  stroke: var(--gd);
  stroke-dasharray: 0 100;
  transition:
    stroke-dasharray 0.15s,
    stroke 0.2s;
}
#speedo.boost #arcFill {
  stroke: #58c8ff;
  filter: drop-shadow(0 0 6px #58c8ff);
}
#speedo #kmh {
  position: absolute;
  left: 50%;
  top: -2px;
  transform: translateX(-62%) skewX(-10deg);
  font-size: clamp(26px, 5vmin, 40px);
  color: var(--gd);
  text-shadow:
    0 3px 0 #05030f,
    0 0 12px rgba(0, 0, 0, 0.6);
}
#speedo > small {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(110%) skewX(-10deg);
  font:
    400 12px 'Bungee',
    sans-serif;
  color: var(--tx);
  text-shadow: 0 2px 3px #000;
}
#speedo.boost #kmh {
  color: #9fe0ff;
}
#dash,
#dashL {
  display: none;
}
#pos {
  position: absolute;
  left: -84px;
  top: 8px;
  font:
    400 clamp(14px, 2.6vmin, 20px) 'Bungee',
    sans-serif;
  transform: skewX(-10deg) rotate(-6deg);
  color: var(--tx);
  text-shadow: 0 3px 0 #05030f;
  white-space: nowrap;
}
#pos b {
  font-weight: 400;
  font-size: 1.7em;
  color: var(--gd);
}
#pos small {
  font-size: 0.7em;
}
#mid {
  top: clamp(64px, 11vmin, 92px);
}
#chip {
  font-size: 11px;
  transform: skewX(-10deg);
}
#prog {
  width: min(300px, 50vw);
  height: 5px;
}
/* callouts sit beside the bike, yellow and underlined, like a stunt score */
#feed {
  right: auto;
  left: 57%;
  top: 36%;
  align-items: flex-start;
  gap: 8px;
}
.fd {
  text-align: left;
  transform: skewX(-10deg);
}
.fd b {
  font-size: clamp(18px, 3.6vmin, 32px);
  line-height: 1;
  padding-bottom: 2px;
  border-bottom: 3px solid currentColor;
  display: inline-block;
  text-shadow: 0 3px 0 #05030f;
}
.fd small {
  display: block;
  font:
    400 clamp(12px, 2.2vmin, 18px) 'Bungee',
    sans-serif;
  color: var(--gd);
  margin-top: 3px;
  text-shadow: 0 2px 0 #05030f;
}
#combo {
  right: auto;
  left: 57%;
  top: 26%;
  text-align: left;
  transform: skewX(-10deg);
}
#combo i {
  margin: 4px 0 0;
}
#tip {
  bottom: 54px;
}
#banner {
  transform: skewX(-8deg);
}
.touch #speedo {
  top: 4px;
}

/* speed number centred in the arc, with the unit under it */
#arc .bg {
  stroke: rgba(244, 239, 255, 0.2);
}
#speedo #kmh {
  top: -4px;
  transform: translateX(-50%) skewX(-10deg);
}
#speedo > small {
  top: clamp(26px, 5vmin, 40px);
  transform: translateX(-50%) skewX(-10deg);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
#arc {
  margin-top: clamp(16px, 3vmin, 26px);
}
#pos {
  top: 22px;
}

/* keep the combo counter clear of the centre banner */
#combo {
  left: 74%;
  top: 32%;
}
#feed {
  top: 44%;
}

/* ---------- garage: bikes with stat bars ---------- */
#garage {
  justify-content: flex-start;
  padding-top: 24px;
}
#garage h3 {
  font:
    400 14px 'Bungee',
    sans-serif;
  letter-spacing: 0.16em;
  color: var(--tl);
  margin-top: 6px;
}
.bike {
  text-align: left;
  gap: 12px;
  border-left: 6px solid var(--c);
}
.bike.cur {
  box-shadow: 0 0 0 2px var(--tl) inset;
}
.bike span {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.bike small {
  font-size: 12px;
  color: var(--dim);
}
.bike strong {
  font:
    400 15px 'Bungee',
    sans-serif;
  color: var(--gd);
  white-space: nowrap;
}
.bike .stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 14px;
  margin-top: 4px;
  font-style: normal;
}
.bike .stats i {
  display: flex;
  align-items: center;
  gap: 6px;
  font-style: normal;
  width: auto;
  height: auto;
  background: none;
}
.bike .stats u {
  text-decoration: none;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
  width: 56px;
}
.bike .stats s {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(190, 180, 255, 0.18);
  overflow: hidden;
}
.bike .stats q {
  display: block;
  height: 100%;
  background: #3d9bff;
}

/* ---------- police chase: a distance tag and red/blue flashes in the bottom corners ---------- */
#cops {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) skewX(-10deg);
  font:
    400 clamp(14px, 2.6vmin, 20px) 'Bungee',
    sans-serif;
  color: #9cc4ff;
  text-shadow: 0 3px 0 #05030f;
  display: none;
}
#cops.on {
  display: block;
}
#cops span {
  color: var(--tx);
  margin-left: 8px;
}
#hud.cops::before,
#hud.cops::after {
  content: '';
  position: absolute;
  bottom: 0;
  width: 46vw;
  height: 36vh;
  pointer-events: none;
  animation: copflash 0.34s steps(1) infinite;
}
#hud.cops::before {
  left: 0;
  background: radial-gradient(ellipse at 0% 100%, rgba(255, 40, 40, 0.5), transparent 70%);
}
#hud.cops::after {
  right: 0;
  background: radial-gradient(ellipse at 100% 100%, rgba(50, 110, 255, 0.5), transparent 70%);
  animation-delay: 0.17s;
}
@keyframes copflash {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.15;
  }
}

/* ---------- main menu: two short entries side by side ---------- */
.menu .pair {
  display: flex;
  gap: 9px;
}
.menu .pair .opt {
  flex: 1;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

/* ---------- credits: a scrolling list between the heading and BACK ---------- */
#credits {
  justify-content: flex-start;
  padding-top: 24px;
}
#crList {
  flex: 0 1 auto;
  min-height: 120px;
  width: min(720px, 94vw);
  overflow-y: auto;
  padding: 14px 18px;
  border-radius: 14px;
  text-align: left;
  pointer-events: auto;
}
#crList h3 {
  font:
    400 13px 'Bungee',
    sans-serif;
  letter-spacing: 0.14em;
  color: var(--tl);
  margin: 4px 0 8px;
}
#crList ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
#crList li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid rgba(190, 180, 255, 0.14);
}
#crList li b {
  font-size: 14px;
  color: var(--tx);
}
#crList li span {
  font-size: 13px;
  color: var(--gd);
}
#crList li span i {
  font-style: normal;
  color: var(--tl);
}
#crList li small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--dim);
}
#crList li u {
  text-decoration: none;
  font-size: 10px;
  color: var(--dim);
  opacity: 0.7;
  overflow-wrap: anywhere;
}
#crList p {
  max-width: none;
  font-size: 12px;
  margin: 8px 0;
}

/* ---------- callouts live at the right edge, clear of the road ahead (the chase camera sits close) ---------- */
#feed {
  left: auto;
  right: 18px;
  top: 40%;
  align-items: flex-end;
  gap: 6px;
  max-width: 28vw;
}
.fd {
  text-align: right;
  transform-origin: right center;
}
.fd b {
  font-size: clamp(12px, 2vmin, 16px);
}

/* ---------- the arc is the nitro bar: three charges, labelled, glowing when one is ready ---------- */
#arc .seg {
  stroke: #05030f;
  stroke-width: 15;
  stroke-dasharray: 0.8 32.53;
}
#speedo .nlab {
  position: absolute;
  left: 50%;
  top: 58px;
  transform: translateX(-50%) skewX(-10deg);
  font:
    400 11px 'Bungee',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.14em;
  color: #9fe0ff;
  text-shadow: 0 2px 3px #000;
  white-space: nowrap;
}
#speedo .nlab kbd {
  font: inherit;
  font-size: 9px;
  padding: 0 4px;
  margin-left: 4px;
  border: 1px solid rgba(159, 224, 255, 0.6);
  border-radius: 3px;
  opacity: 0.55;
}
#speedo.ready .nlab kbd {
  opacity: 1;
  color: #05030f;
  background: #2ee6c5;
  border-color: #2ee6c5;
}
#speedo.ready #arcFill {
  stroke: #2ee6c5;
  filter: drop-shadow(0 0 5px rgba(46, 230, 197, 0.85));
  animation: nitroReady 1.1s ease-in-out infinite;
}
@keyframes nitroReady {
  50% {
    filter: drop-shadow(0 0 1px rgba(46, 230, 197, 0.4));
  }
}
@media (prefers-reduced-motion: reduce) {
  #speedo.ready #arcFill {
    animation: none;
  }
}

/* ---------- full-screen panels hide the title screen completely; garage in two columns on wide screens ---------- */
.ov.top {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(46, 230, 197, 0.07), transparent 60%), linear-gradient(#0b0820, #070514);
}
.gcols {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.gcols section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
@media (min-width: 1000px) {
  .gcols {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
  }
  .gcols section {
    width: auto;
  }
  /* three columns (bikes, guns, upgrades): narrower cards so all three fit side by side */
  .gcols {
    gap: 18px;
  }
  .gcols .menu.wide {
    width: min(400px, calc((100vw - 96px) / 3));
  }
}

/* ---------- title screen: the live street stays visible, but the text sits on a dark band so it reads ---------- */
#start {
  background:
    linear-gradient(90deg, transparent 0%, rgba(8, 6, 20, 0.78) 30%, rgba(8, 6, 20, 0.78) 70%, transparent 100%),
    radial-gradient(ellipse at center, rgba(10, 7, 24, 0.2), rgba(10, 7, 24, 0.85));
}
#start > p {
  color: #e6e1f5;
  text-shadow: 0 1px 3px #000;
  max-width: 34em;
}

/* ---------- race HUD, styled on the arcade racers the game is modelled on (Asphalt 9) ----------
   speed top right in big italic numbers with the race clock in a pink badge under it, a POS / DIST panel top left,
   a long nitro bar across the top, callouts on the right in dark panels with a red edge */
#hud #speedo {
  position: absolute;
  top: calc(58px + env(safe-area-inset-top, 0px));
  right: calc(16px + env(safe-area-inset-right, 0px));
  left: auto;
  bottom: auto;
  transform: none;
  width: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
#hud #speedo #arc,
#hud #speedo .nlab,
#hud #speedo #pos {
  display: none;
}
#hud #speedo > small {
  position: static;
  transform: none;
  order: 1;
  font:
    italic 800 13px 'Chakra Petch',
    sans-serif;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: -6px;
}
#hud #speedo #kmh {
  position: static;
  transform: none;
  order: 2;
  font:
    italic 800 clamp(44px, 6.4vmin, 74px) / 0.92 'Chakra Petch',
    sans-serif;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.45),
    0 0 16px rgba(0, 0, 0, 0.35);
}
#hud #speedo.boost #kmh {
  color: #fff;
  text-shadow:
    0 0 14px #ff3df0,
    0 0 28px rgba(255, 61, 240, 0.6);
}
#rtime {
  order: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  background: #e8195f;
  color: #fff;
  transform: skewX(-12deg);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
#rtime svg {
  width: 18px;
  height: 18px;
}
#rtime b {
  font:
    italic 800 clamp(16px, 2.4vmin, 22px) 'Chakra Petch',
    sans-serif;
  font-variant-numeric: tabular-nums;
}
#posBox {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 0;
  pointer-events: none;
}
#posBox span,
#posBox b {
  padding: 4px 10px;
  background: rgba(14, 14, 22, 0.78);
  color: #fff;
  font:
    italic 700 clamp(13px, 2vmin, 17px) 'Chakra Petch',
    sans-serif;
}
#posBox b {
  text-align: right;
  font-weight: 800;
  min-width: 4.2em;
  font-variant-numeric: tabular-nums;
}
#posBox b#posBig {
  color: #ff3d7f;
}
#hpBox {
  padding-top: clamp(62px, 8.6vmin, 72px);
}
/* the nitro bar: long and slanted across the top centre, filling with a hot gradient */
#hud #dash {
  display: block;
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  width: min(34vw, 440px);
  height: 18px;
  transform: translateX(-50%) skewX(-24deg);
  background: rgba(14, 14, 22, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(255, 61, 240, 0.35);
}
#hud #dash em {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff3df0, #ffe14a 70%, #fffbe0);
  transition: width 0.15s;
}
#hud #speedo.boost ~ #dash,
#hud #dash.ready {
  box-shadow: 0 0 22px rgba(255, 225, 74, 0.6);
}
#hud #mid {
  top: calc(40px + env(safe-area-inset-top, 0px));
}
/* callouts down the right: dark panels with a red edge, white italic text */
#hud #feed {
  left: auto;
  right: calc(16px + env(safe-area-inset-right, 0px));
  top: 40%;
  align-items: flex-end;
  gap: 6px;
}
#hud .fd {
  transform: none;
  text-align: right;
  background: rgba(14, 14, 22, 0.74);
  border-right: 5px solid #e8195f;
  padding: 5px 12px 5px 14px;
  text-shadow: none;
}
#hud .fd b {
  display: inline;
  font:
    italic 800 clamp(15px, 2.4vmin, 20px) 'Chakra Petch',
    sans-serif;
  color: #fff !important;
  text-decoration: none;
}
#hud .fd small {
  display: inline;
  margin-left: 8px;
  font:
    italic 600 clamp(12px, 1.8vmin, 15px) 'Chakra Petch',
    sans-serif;
  color: #fff;
  opacity: 0.85;
  letter-spacing: 0;
}
/* the minimap moves to the left, under the race panel, like the track map in the reference */
#hud #radar {
  right: auto;
  left: calc(16px + env(safe-area-inset-left, 0px));
  top: auto;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
}

/* ---------- portrait (phones held upright, tablets): the race HUD restacks into rows so nothing overlaps ----------
   1: POS / DIST left, coins + camera + pause right; 2: the nitro bar; 3: route name and progress; 4: hearts and XP
   left, speed and race clock right. The first-ride tip sits under the HUD, clear of the bike and the touch buttons,
   and ROCKET stacks over NITRO so the bottom centre stays open for the bike and the steering thumb. */
@media (max-aspect-ratio: 1/1) {
  #hud #posBox {
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: calc(10px + env(safe-area-inset-left, 0px));
  }
  #hud #posBox span,
  #hud #posBox b {
    padding: 3px 8px;
    font-size: 14px;
  }
  #hud #posBox b {
    min-width: 3.4em;
  }
  #top {
    top: calc(10px + env(safe-area-inset-top, 0px));
  }
  #hud #dash {
    top: calc(62px + env(safe-area-inset-top, 0px));
    width: min(68vw, 440px);
    height: 16px;
  }
  #hud #mid {
    top: calc(88px + env(safe-area-inset-top, 0px));
    max-width: calc(100vw - 24px);
    gap: 4px;
  }
  #hud #chip {
    font-size: 10px;
    max-width: 100%;
  }
  #hud #chip span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #hud #prog {
    width: min(300px, 62vw);
  }
  #hud #rule {
    white-space: normal;
    text-align: center;
  }
  #hud #bossbar {
    width: min(300px, 62vw);
  }
  #hpBox {
    padding-top: 156px;
  }
  #pus {
    margin-top: 2px;
  }
  #hud #speedo {
    top: calc(166px + env(safe-area-inset-top, 0px));
  }
  #hud #radar {
    width: clamp(104px, 17vw, 150px);
    height: clamp(104px, 17vw, 150px);
  }
  #hud #banner {
    top: max(37%, 340px);
  }
  /* combo on the left and callouts on the right, side by side under the banner and above the rider */
  #hud #combo {
    left: calc(16px + env(safe-area-inset-left, 0px));
    right: auto;
    top: max(44%, 402px);
  }
  #hud #feed {
    top: max(44%, 402px);
    max-width: calc(100vw - 140px);
  }
  #hud .fd b {
    font-size: 13px;
  }
  #hud .fd small {
    font-size: 11px;
  }
  #hud #tip {
    top: calc(272px + env(safe-area-inset-top, 0px));
    bottom: auto;
    width: max-content;
    max-width: calc(100vw - 32px);
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }
  #hud #cops {
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(clamp(104px, 17vw, 150px) + 30px + env(safe-area-inset-bottom, 0px));
    transform: skewX(-10deg);
  }
  .touch #bDash {
    right: calc(16px + env(safe-area-inset-right, 0px));
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .touch #bRocket {
    right: calc(28px + env(safe-area-inset-right, 0px));
    bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  }
}
/* portrait tablets: the speed and the banner are bigger, so the tip and the callouts sit a little lower */
@media (max-aspect-ratio: 1/1) and (min-width: 600px) {
  #hud #tip {
    top: calc(300px + env(safe-area-inset-top, 0px));
  }
  #hud #combo,
  #hud #feed {
    top: 46%;
  }
}
/* phones held sideways (short screens): the banner drops under the boss bar, and the combo and the callouts stack
   down the right under the speed instead of on top of each other */
@media (min-aspect-ratio: 1/1) and (max-height: 500px) {
  #hud #banner {
    top: 128px;
  }
  #hud #combo {
    top: 150px;
  }
  #hud #feed {
    top: 212px;
  }
}
/* touch in landscape: the tip wraps between the minimap and the NITRO / ROCKET buttons instead of running under them */
@media (min-aspect-ratio: 1/1) {
  .touch #hud #tip {
    width: max-content;
    max-width: calc(100vw - 2 * (220px + env(safe-area-inset-right, 0px)));
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }
}

/* phones: the credits list fits inside the menu padding instead of pushing the screen sideways */
@media (max-width: 600px) {
  #crList {
    width: 100%;
  }
}
/* first load: a light sweeps across the RIDE button while the models come in, so a slow connection never looks stuck
   (the button also counts the megabytes in, see ui/menus.js) */
#bStart:disabled {
  background: linear-gradient(100deg, var(--or) 42%, #ffd28f 50%, var(--or) 58%) 0 0 / 300% 100%;
  animation: loadSweep 1.6s linear infinite;
}
@keyframes loadSweep {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  #bStart:disabled {
    animation: none;
  }
}

/* ---------- phone controls (Asphalt layout) ----------
   The bike accelerates on its own. Tilt: nitro at mid-height and brake at the bottom of BOTH edges, so either thumb
   can fire. Arrows: steering bottom-left, nitro above brake on the right (FLIP mirrors it for left-handers). Targets
   are 64-80 px, they react on touch-down, and nothing sits in front of the bike. */
#tctl {
  display: none;
}
.touch #tctl {
  display: block;
}
.touch #bDash,
#joy {
  display: none !important;
}
.tc {
  position: absolute;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(10, 14, 20, 0.38);
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.08s,
    background 0.08s;
}
.tc svg {
  width: 48%;
  height: 48%;
  pointer-events: none;
}
.tc.on {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.93);
}
.tn {
  width: 80px;
  height: 80px;
  color: var(--tl);
  border-color: var(--tl);
  box-shadow: 0 0 0 4px rgba(46, 230, 197, 0.18);
}
.tn.cd {
  opacity: 0.4; /* no charge in the tank */
}
.tn.full {
  box-shadow:
    0 0 0 4px rgba(46, 230, 197, 0.45),
    0 0 22px rgba(46, 230, 197, 0.6); /* full bar: double-tap for the shockwave */
}
.tn.perfect {
  box-shadow:
    0 0 0 6px rgba(255, 194, 61, 0.95),
    0 0 24px rgba(255, 194, 61, 0.75); /* the perfect-nitro window: tap again now */
}
.tbk {
  width: 64px;
  height: 64px;
}
.ta {
  width: 80px;
  height: 80px;
}
/* which buttons each scheme shows (data/controls.js): Tap to steer and Tilt: nitro and brake on both edges (in Tap
   to steer the rest of the screen is the steering: left half left, right half right). Tilt and icons: brake and
   gas pedals, nitro both sides. On-screen controls: the wheel, nitro and brake. Directional: arrows, nitro, brake */
.ctl-tap #tNitroL,
.ctl-tap #tNitroR,
.ctl-tap #tBrakeL,
.ctl-tap #tBrakeR,
.ctl-tilt #tNitroL,
.ctl-tilt #tNitroR,
.ctl-tilt #tBrakeL,
.ctl-tilt #tBrakeR,
.ctl-icons #tNitroL,
.ctl-icons #tNitroR,
.ctl-icons #tBrakeL,
.ctl-icons #tGas,
.ctl-wheel #tWheel,
.ctl-wheel #tNitroR,
.ctl-wheel #tBrakeR,
.ctl-arrows #tLeft,
.ctl-arrows #tRight,
.ctl-arrows #tNitroR,
.ctl-arrows #tBrakeR {
  display: flex;
}
/* the gas pedal (Tilt and icons), bottom right */
.tg {
  width: 72px;
  height: 96px;
  border-radius: 18px;
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  color: var(--tl);
  border-color: var(--tl);
}
.flip.ctl-icons #tGas {
  right: auto;
  left: calc(24px + env(safe-area-inset-left, 0px));
}
.flip.ctl-icons #tBrakeL {
  left: auto;
  right: calc(24px + env(safe-area-inset-right, 0px));
}
/* the steering wheel (On-screen controls), bottom left */
.tw {
  width: 150px;
  height: 150px;
  left: calc(14px + env(safe-area-inset-left, 0px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 14, 20, 0.28);
  border-width: 0;
  color: rgba(255, 255, 255, 0.92);
}
.tw svg {
  width: 100%;
  height: 100%;
  transition: transform 0.12s ease-out; /* springs back to centre on release */
}
.tw.on svg {
  transition: none;
}
.tw.on {
  transform: none;
  background: rgba(10, 14, 20, 0.4);
}
.flip.ctl-wheel #tWheel {
  left: auto;
  right: calc(14px + env(safe-area-inset-right, 0px));
}
.flip.ctl-wheel #tNitroR {
  right: auto;
  left: calc(16px + env(safe-area-inset-left, 0px));
}
.flip.ctl-wheel #tBrakeR {
  right: auto;
  left: calc(24px + env(safe-area-inset-left, 0px));
}
#tNitroL {
  left: calc(16px + env(safe-area-inset-left, 0px));
  top: calc(50% - 30px);
}
#tNitroR {
  right: calc(16px + env(safe-area-inset-right, 0px));
  top: calc(50% - 30px);
}
#tBrakeL {
  left: calc(24px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
#tBrakeR {
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
#tLeft {
  left: calc(16px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
#tRight {
  left: calc(110px + env(safe-area-inset-left, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
/* FLIP (left-handed): in Arrows the steering moves right and nitro + brake move left; Tilt is symmetric already */
.flip.ctl-arrows #tLeft {
  left: auto;
  right: calc(110px + env(safe-area-inset-right, 0px));
}
.flip.ctl-arrows #tRight {
  left: auto;
  right: calc(16px + env(safe-area-inset-right, 0px));
}
.flip.ctl-arrows #tNitroR {
  right: auto;
  left: calc(16px + env(safe-area-inset-left, 0px));
}
.flip.ctl-arrows #tBrakeR {
  right: auto;
  left: calc(24px + env(safe-area-inset-left, 0px));
}
/* a ghost label for the first races only: how to steer */
#tHint {
  position: absolute;
  left: 50%;
  top: 22%; /* under the race title, clear of the callouts in the middle and of the bike */
  transform: translateX(-50%);
  display: none;
  padding: 5px 14px;
  border: 1px dashed rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  background: rgba(10, 14, 20, 0.45);
  color: #fff;
  font:
    700 12px 'Chakra Petch',
    sans-serif;
  letter-spacing: 0.06em;
  white-space: nowrap;
  pointer-events: none;
}
#tHint.on {
  display: block;
}
/* phones: the steering hint sits low between the thumbs, and callouts drop below a banner instead of piling on it */
.touch #tHint {
  top: auto;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
}
.touch.banOn #hud #feed {
  visibility: hidden; /* phones: while a banner is up the small callouts wait (they are short-lived anyway) */
}
/* the rocket only exists in Night Hunt (free rides): beside the right nitro button */
.touch #bRocket {
  right: calc(112px + env(safe-area-inset-right, 0px));
  top: calc(50% - 20px);
  bottom: auto;
  width: 60px;
  height: 60px;
}
/* phones: the minimap would sit under the left thumb, so it is off (the spec makes it optional); tips and callouts
   move to the upper centre, clear of the buttons and of the road in front of the bike */
.touch #hud #radar {
  display: none;
}
.touch #hud #tip {
  top: calc(118px + env(safe-area-inset-top, 0px));
  bottom: auto;
}
.touch #hud #feed {
  right: auto;
  left: 50%;
  transform: translateX(-50%);
  top: 30%;
  align-items: center;
}
.touch #hud #feed .fd {
  text-align: center;
}
.touch #hud #feed .fd:nth-last-child(n + 3) {
  display: none; /* two callouts at most on a phone */
}
/* phones play in landscape only (the spec's rotate screen) */
#rotate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  background: #0b0e14;
  color: #fff;
  text-align: center;
  font:
    700 18px 'Chakra Petch',
    sans-serif;
}
#rotate svg {
  width: 72px;
  height: 72px;
  color: var(--tl);
}
#rotate span {
  font-weight: 400;
  font-size: 14px;
  color: var(--dim);
}
@media (orientation: portrait) {
  .touch #rotate {
    display: flex;
  }
}
/* phones in a race: Asphalt's clean HUD. Position, progress, speed + nitro, timer and pause stay; the coin counter and
   the map-name chip go (the start banner names the road) */
.touch.race #hud #score,
.touch.race #hud #chip {
  display: none;
}

/* ---------- the Controls screen (as in Asphalt): a row of scheme cards, the chosen one marked SELECTED ---------- */
#ctlCards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: min(1040px, 100%);
}
.ctlCard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 190px;
  padding: 14px 8px 40px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: linear-gradient(180deg, #1d2a4a, #34476e);
  color: #fff;
  cursor: pointer;
  transform: skewX(-4deg);
}
.ctlCard > * {
  transform: skewX(4deg);
}
.ctlCard b {
  font:
    700 italic clamp(12px, 1.6vw, 16px) 'Chakra Petch',
    sans-serif;
  color: var(--gd);
  letter-spacing: 0.02em;
  min-height: 2.4em;
  display: flex;
  align-items: center;
  text-align: center;
}
.ctlCard svg {
  width: 82%;
  max-width: 130px;
}
.ctlCard span {
  font-size: 13px;
  color: #dfe6f5;
}
.ctlCard i {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30px;
  line-height: 30px;
  font:
    700 13px/30px 'Chakra Petch',
    sans-serif;
  font-style: normal;
  letter-spacing: 0.08em;
}
.ctlCard.on {
  border-color: #fff;
}
.ctlCard.on i {
  background: #fff;
  color: #14203a;
}
.ctlCard:hover {
  border-color: rgba(255, 255, 255, 0.6);
}
#ctlOpts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(1040px, 100%);
}
#ctlOpts .opt {
  width: auto;
  font-size: 13px;
}
/* phones in landscape: the cards stay in one row, a little shorter */
@media (max-height: 500px) {
  #controls h2 {
    margin: 0;
  }
  .ctlCard {
    min-height: 150px;
    padding: 8px 6px 34px;
    gap: 4px;
  }
}
@media (max-width: 640px) {
  #ctlCards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #ctlOpts {
    grid-template-columns: minmax(0, 1fr);
  }
}
/* the Controls screen opens from Settings: it stacks above it */
#controls {
  z-index: 6;
}

/* ---------- race HUD: the slanted nitro bar, the speed top right with the clock in its pink badge, POS / DIST top
   left and the callouts in dark panels (the owner's pick over an Asphalt 8 layout) ---------- */
#lapBox {
  display: none; /* a laps readout for an Asphalt 8 style top bar; not used in this layout */
}
#iosTip {
  max-width: 34em;
  margin: 4px auto 0;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--dim);
  text-align: center;
}
.crPriv {
  margin: 0 0 8px;
  text-align: right;
}
.crPriv a {
  color: var(--gd, #2ee6c5);
}
/* a secret level not yet earned: dark, with a gold edge */
.card.race.secret {
  background: linear-gradient(160deg, rgba(20, 16, 8, 0.85), rgba(8, 8, 12, 0.92));
  border-color: rgba(255, 194, 61, 0.55);
}
.card.race.secret b {
  color: #ffc23d;
  letter-spacing: 0.08em;
}

/* ---------- HUD layers: the same HUD, at a fraction of what it cost to draw ----------
   Measured on a budget phone (Mali-G57): with the HUD hidden the race ran at 50 fps, with it showing at 19. The
   browser paints everything that shares a layer together, in strips the full width of the screen, so one changed
   digit repainted every soft shadow and glow across that strip, at three times the CSS size on a phone. Now each
   part of the HUD is a small layer of its own (will-change): a change repaints only that part, and the screen-wide
   strips are empty, so they are not blended over the game at all. The bars are filled by a transform (ui/hud.js): the
   compositor moves them, on its own thread, and nothing is repainted. */
#posBox,
#hpBox > *,
#rt > *,
#mid,
#speedo > small,
#kmh,
#rtime,
#hud #dash,
#combo,
#feed,
#tip,
#cops,
#banner,
#lapBox,
#radar,
#tHint,
.tc,
.tb {
  will-change: transform;
}
#xp em,
#prog em,
#dash em,
#hud #dash em,
#bossbar em,
#combo em {
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
  transition: transform 0.12s linear; /* eased by the compositor between the HUD's updates */
}
#bossbar em {
  transform: none;
}
/* Phones: no blurred shadows on anything that changes as you ride. A blur is redrawn in full every time the text
   over it changes; a hard-edged shadow costs almost nothing and reads better on a small, bright screen. */
.touch #hud #speedo #kmh {
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.5),
    0 -1px 0 rgba(0, 0, 0, 0.25);
}
.touch #hud #speedo.boost #kmh {
  text-shadow:
    2px 2px 0 #e01cd0,
    -2px 2px 0 #e01cd0,
    2px -2px 0 #e01cd0,
    -2px -2px 0 #e01cd0;
}
.touch #hud #score,
.touch #hud #chip,
.touch #hud #xp,
.touch #rule,
.touch #speedo > small,
.touch #speedo .nlab {
  text-shadow: 0 2px 0 #05030f;
}
.touch #rtime {
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}
.touch #hud #hearts svg,
.touch .rlock i,
.touch .rlock.locked i {
  filter: none;
}
.touch #banner {
  text-shadow:
    0 3px 0 var(--ord),
    0 6px 0 rgba(0, 0, 0, 0.45);
}
.touch #banner small {
  text-shadow: 0 2px 0 #000;
}
.touch .dmgN {
  text-shadow:
    0 2px 0 #05030f,
    0 -1px 0 #05030f;
}
.touch .fd {
  text-shadow: none;
}
