:root {
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #eef4ff;
  background: #090d20;
  color-scheme: dark;
  font-synthesis: none;
  --cyan: #42f0f0;
  --violet: #ab82ff;
  --line: #ffffff1b;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  width: 100vw;
  height: 100dvh;
  background: radial-gradient(
    ellipse at 70% 10%,
    #1a2748,
    #0e1528 50%,
    #080d1c
  );
}
button,
select {
  font: inherit;
  color: inherit;
}
button {
  min-height: 48px;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #18213be8;
  padding: 12px 19px;
  font-weight: 700;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover {
  background: #263653;
}
button:active,
.held {
  transform: scale(0.96);
  background: #394d72;
}
button:focus-visible,
select:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
.primary {
  background: var(--cyan);
  color: #0b1930;
  border-color: var(--cyan);
}
.primary:hover {
  background: #a0ffff;
}
.secondary {
  border-color: #ad85ff80;
}
.danger {
  color: #ffabc1;
}
.small {
  font-size: 12px;
  padding: 10px;
}
.icon-button {
  min-width: 48px;
}
#world {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px #05091660;
  background: linear-gradient(
    #090d2077,
    transparent 22%,
    transparent 74%,
    #090d20aa
  );
}
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: max(18px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right)) 12px;
  z-index: 20;
  pointer-events: none;
}
header > * {
  pointer-events: auto;
}
.wordmark {
  font-weight: 950;
  letter-spacing: 4px;
  font-size: 25px;
  font-style: italic;
}
.wordmark span {
  color: var(--cyan);
}
.wordmark small {
  display: block;
  font-size: 8px;
  letter-spacing: 6px;
  font-style: normal;
  font-weight: 500;
  color: #99a9c8;
  margin-top: 3px;
}
.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tag,
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 800;
  color: var(--cyan);
}
.tag {
  padding: 7px 9px;
  border: 1px solid #42f0f02a;
  border-radius: 5px;
  background: #08152590;
}
select {
  height: 48px;
  background: #101c32;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px;
  min-width: 60px;
}
main {
  position: relative;
  width: 100%;
  height: 100dvh;
}
.hud {
  position: absolute;
  top: 102px;
  left: 24px;
  display: flex;
  gap: 28px;
  pointer-events: none;
}
.stat small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  color: #aabbd5;
  font-weight: 700;
}
.stat strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat:first-child strong {
  color: var(--cyan);
}
#map-wrap {
  position: absolute;
  right: 22px;
  top: 97px;
  width: 148px;
  text-align: center;
  pointer-events: none;
}
#minimap {
  width: 145px;
  height: 120px;
}
#track-name {
  font-size: 8px;
  letter-spacing: 2px;
  color: #9aaccc;
}
.checkpoint-stat strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  font-size: 20px;
}
#checkpoint-arrow {
  display: inline-block;
  color: #ffc857;
  font-size: 18px;
  transform-origin: 50% 55%;
}
#offtrack {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border: 1px solid #ffc857aa;
  background: #0c1028cc;
  color: #ffc857;
  font-size: 13px;
  letter-spacing: 1px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
}
.countdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 32%;
  text-align: center;
  font-size: 110px;
  line-height: 1;
  font-style: italic;
  font-weight: 900;
  color: var(--cyan);
  text-shadow: 0 0 50px #42f0f066;
  pointer-events: none;
}
#speed {
  position: absolute;
  bottom: 200px;
  right: 28px;
  text-align: right;
}
#speed strong {
  font-size: 44px;
  font-style: italic;
  font-weight: 900;
  line-height: 1;
}
#speed > span {
  display: block;
  font-size: 9px;
  letter-spacing: 3px;
  color: #a4b4cc;
}
.charge-wrap {
  position: relative;
  width: 124px;
  margin-top: 10px;
  height: 9px;
}
.charge {
  height: 9px;
  width: 124px;
  border-radius: 5px;
  background: #ffffff26;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px #ffffff22;
}
.charge-mark {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: #f4f7ff;
  box-shadow: 0 0 6px #fff;
  pointer-events: none;
  z-index: 1;
}
.charge-wrap.ready .charge i {
  box-shadow: 0 0 10px var(--cyan);
}
.charge i {
  display: block;
  width: 0;
  background: var(--cyan);
  height: 100%;
}
.charge-wrap.charging .charge i,
.charge i.charging {
  background: linear-gradient(90deg, #7af0ff, #42f0f0);
  box-shadow: 0 0 12px #42f0f0;
}
#charge-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--cyan);
}
#charge-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.4px;
  color: #ffc857;
  text-shadow: 0 1px 4px #000;
  max-width: 160px;
}
#charge-hint.charging {
  color: #7af0ff;
}
#controls {
  position: absolute;
  bottom: max(54px, calc(env(safe-area-inset-bottom) + 40px));
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}
.steer-controls,
.action-controls {
  pointer-events: auto;
  background: #0b1224cc;
  border: 1px solid #b1d3fa33;
  border-radius: 22px;
  padding: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px #00000066;
}
.steer-controls {
  width: 35%;
  max-width: 260px;
}
#drive-area {
  height: 84px;
  border: 1px solid #b1d3fa44;
  border-radius: 20px;
  background: linear-gradient(130deg, #15304caa, #111832bb);
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.stick-dock {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1.5px solid #6edcfa66;
  background: radial-gradient(circle at 50% 38%, #1d3a5cee, #0f1a30dd);
  box-shadow:
    0 0 14px #42f0f022,
    inset 0 0 10px #0a1628;
  display: grid;
  place-items: center;
  flex: none;
}
.stick-dock i {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #d9fbff, #42f0f0 55%, #17a6c8);
  box-shadow: 0 0 10px #42f0f099;
}
#steer-hint {
  letter-spacing: 1px;
  font-size: 10px;
  color: #9fc8e8;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.arrows {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.arrows button {
  flex: 1;
  background: #142139a0;
  touch-action: none;
}
.action-controls {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.action-controls button {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  border-radius: 50%;
  min-width: 0;
  padding: 0;
  font-size: 10px;
  letter-spacing: 1.5px;
  font-weight: 800;
  transition:
    transform 0.12s ease,
    background 0.15s,
    box-shadow 0.15s;
}
#drift {
  width: 78px;
  height: 78px;
  border-color: #b388ff66;
  color: #dfcbff;
  background: radial-gradient(circle at 40% 30%, #241d3ee8, #120f22e0);
}
#drift.held {
  transform: scale(0.9);
  border-color: #c39bff;
  box-shadow:
    0 0 18px #ab82ff66,
    inset 0 0 12px #ab82ff22;
}
#turbo {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 40% 30%, #1c5f6fda, #0f2733e8);
  border-color: #42f0f088;
  color: var(--cyan);
}
#turbo.held {
  transform: scale(0.9);
  box-shadow:
    0 0 22px #00e5ff88,
    inset 0 0 14px #00e5ff22;
}
#turbo.charged {
  background: radial-gradient(circle at 40% 30%, #2b7f92, #123a49);
  border-color: #7cf0ff;
  box-shadow: 0 0 16px #00e5ff88;
  animation: turbo-ready 0.9s ease-in-out infinite;
}
#turbo.active {
  background: radial-gradient(circle at 40% 30%, #35a3b8, #15586a);
  box-shadow: 0 0 24px #00e5ffcc;
}
@keyframes turbo-ready {
  50% {
    box-shadow: 0 0 26px #00e5ff;
  }
}
#keyboard-hint {
  position: absolute;
  bottom: 29px;
  left: 24px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #8296b4;
}
footer {
  position: fixed;
  bottom: max(8px, env(safe-area-inset-bottom));
  left: 18px;
  right: 18px;
  font-size: 8px;
  letter-spacing: 1px;
  text-align: center;
  color: #a4b9d0;
  z-index: 5;
  pointer-events: none;
}
.intro-card {
  position: absolute;
  top: 29%;
  left: 24px;
  max-width: 330px;
  padding: 21px 24px;
  border: 1px solid #8cb8de44;
  border-radius: 18px;
  background: linear-gradient(130deg, #132942ed, #13172be8);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 70px #0004;
  z-index: 25;
  pointer-events: auto;
}
.intro-card h2 {
  font-size: 24px;
  letter-spacing: 0.5px;
  margin: 12px 0 8px;
}
.intro-card p {
  font-size: 13px;
  line-height: 1.6;
  color: #b3c4dd;
}
.intro-progress {
  height: 3px;
  background: #ffffff1a;
  margin: 15px 0;
}
.intro-progress i {
  height: 100%;
  display: block;
  width: 0;
  background: var(--cyan);
}
#intro-actions {
  display: flex;
  gap: 8px;
}
#intro-actions,
#intro-actions button {
  position: relative;
  z-index: 26;
  pointer-events: auto;
}
#intro-actions button {
  font-size: 12px;
  padding: 10px;
}
.overlay,
#panel {
  position: absolute;
  inset: 0;
  z-index: 46;
  pointer-events: auto;
  background: #080d1e99;
  backdrop-filter: blur(10px);
  padding: 100px 24px 40px;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay[hidden],
*[hidden] {
  display: none !important;
}
.panel-card {
  width: min(650px, 100%);
  background: linear-gradient(145deg, #18253ef5, #10172bf5);
  border: 1px solid #94b2d333;
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 30px 100px #0005;
}
.panel-card h1 {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 8px 0 16px;
}
.panel-card h2 {
  font-size: 18px;
  margin: 22px 0 12px;
}
.muted {
  color: #9fb1cf;
  line-height: 1.6;
  font-size: 12px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.actions button {
  flex: 1;
}
.notice {
  font-size: 11px;
  line-height: 1.7;
  color: #a8bdd6;
  border-top: 1px solid var(--line);
  padding-top: 15px;
  margin-top: 20px;
}
.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  align-items: end;
  gap: 9px;
  margin: 25px 0;
}
.podium-item {
  text-align: center;
  border: 1px solid #ffffff20;
  background: #ffffff06;
  border-radius: 13px;
  padding: 15px 8px;
}
.podium-item.winner {
  padding-top: 30px;
  border-color: #42f0f066;
  background: #42f0f00a;
}
.podium-item .number {
  font-size: 35px;
  font-weight: 900;
  font-style: italic;
  color: var(--violet);
}
.podium-item.winner .number {
  color: var(--cyan);
}
.podium-item p {
  font-size: 11px;
  margin: 6px 0;
}
.result-stats {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.result-stats strong {
  display: block;
  font-size: 22px;
}
.result-stats small {
  font-size: 9px;
  letter-spacing: 1px;
  color: #9fb1cf;
}
#panel.garage-panel,
.overlay.garage-panel,
.garage-panel {
  align-items: center;
  justify-content: flex-end;
  background: linear-gradient(90deg, transparent 0 42%, #080d1ecc 78%);
  backdrop-filter: none;
  padding: 88px 28px 36px;
}
#panel.garage-panel .panel-card,
.garage-panel .panel-card {
  width: min(480px, 42vw);
  max-width: 520px;
  max-height: calc(100dvh - 120px);
  overflow: auto;
  margin-left: auto;
}
@media (max-width: 1024px) {
  #panel.garage-panel,
  .overlay.garage-panel,
  .garage-panel {
    justify-content: flex-end;
    align-items: stretch;
    background: linear-gradient(transparent 8%, #080d1ef2 46%);
    padding: 38vh 18px 24px;
  }
  #panel.garage-panel .panel-card,
  .garage-panel .panel-card {
    width: min(640px, 100%);
    max-width: none;
    margin: 0 auto;
    max-height: calc(62dvh - 24px);
  }
}
@media (max-width: 800px) {
  #panel.garage-panel,
  .overlay.garage-panel {
    justify-content: flex-end;
    background: linear-gradient(transparent 12%, #080d1ef2 50%);
    backdrop-filter: blur(10px);
  }
  #panel.garage-panel .panel-card,
  .garage-panel .panel-card {
    width: min(530px, 100%);
  }
}
.car-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.car-option {
  padding: 14px 6px;
  border-radius: 10px;
  font-size: 12px;
}
.car-option.active {
  border-color: var(--cyan);
  background: #42f0f014;
  color: var(--cyan);
}
.car-symbol {
  font-size: 24px;
  margin-bottom: 5px;
  display: block;
  opacity: 0.8;
}
.cosmetic-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.cosmetic-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 12px;
}
.swatch {
  height: 16px;
  border-radius: 4px;
  margin-bottom: 12px;
}
.cosmetic-item button {
  padding: 8px;
  font-size: 10px;
  width: 100%;
  margin-top: 10px;
}
.balance {
  font-weight: 850;
  color: var(--cyan);
  font-size: 22px;
}
.challenge-list {
  display: grid;
  gap: 10px;
}
.challenge-item {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: space-between;
}
.challenge-item p {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}
.challenge-item small {
  display: block;
  margin-top: 5px;
  color: #91a6c5;
  font-size: 10px;
}
.goals {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.goals button {
  font-size: 10px;
  padding: 10px;
}
.loading {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, #172b45, #080c1d);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #aac3e1;
}
.loading p {
  font-size: 12px;
}
.spinner {
  width: 35px;
  height: 35px;
  border: 2px solid #ffffff20;
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-top: 32px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
#banner {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90vw;
  padding: 12px 18px;
  background: #382139f5;
  border: 1px solid #ffb6cb66;
  border-radius: 10px;
  font-size: 12px;
}
#ui.in-panel #controls,
#ui.in-panel #speed,
#ui.in-panel #hud,
#ui.in-panel #keyboard-hint,
#ui.in-panel #map-wrap {
  display: none;
}
#ui.in-panel .intro-card {
  display: none;
}
@media (max-width: 600px) {
  header {
    padding: 14px 16px;
  }
  .wordmark {
    font-size: 20px;
    letter-spacing: 3px;
  }
  .tag {
    display: none;
  }
  .hud {
    left: 18px;
    top: 91px;
    gap: 19px;
  }
  .stat strong {
    font-size: 22px;
  }
  .stat small {
    font-size: 8px;
  }
  #map-wrap {
    right: 9px;
    top: 95px;
    width: 103px;
  }
  #minimap {
    width: 103px;
    height: 86px;
  }
  #track-name {
    font-size: 6px;
  }
  #controls {
    left: 16px;
    right: 16px;
    bottom: max(57px, calc(env(safe-area-inset-bottom) + 40px));
  }
  .steer-controls {
    width: 39%;
  }
  .action-controls {
    gap: 10px;
  }
  .action-controls button {
    font-size: 9px;
    letter-spacing: 1.2px;
  }
  #drift {
    width: 66px;
    height: 66px;
  }
  #turbo {
    width: 84px;
    height: 84px;
  }
  #drive-area {
    height: 76px;
    gap: 7px;
  }
  .stick-dock {
    width: 40px;
    height: 40px;
  }
  .stick-dock i {
    width: 17px;
    height: 17px;
  }
  #steer-hint {
    font-size: 8px;
  }
  #keyboard-hint {
    display: none;
  }
  #speed {
    bottom: 200px;
    right: 20px;
  }
  #speed strong {
    font-size: 36px;
  }
  .intro-card {
    top: 27%;
    left: 16px;
    max-width: calc(100% - 120px);
    padding: 16px;
  }
  .intro-card h2 {
    font-size: 19px;
  }
  .intro-card p {
    font-size: 11px;
  }
  .intro-card .eyebrow {
    font-size: 8px;
  }
  .intro-card button {
    font-size: 10px !important;
    padding: 9px !important;
  }
  .overlay {
    padding: 84px 14px 45px;
  }
  .panel-card {
    padding: 20px;
    border-radius: 20px;
  }
  .panel-card h1 {
    font-size: 26px;
  }
  .garage-panel {
    padding-top: 35vh;
    align-items: flex-start;
    background: linear-gradient(transparent 20%, #080d1e 60%);
  }
  .garage-panel .panel-card {
    max-height: 60dvh;
  }
  .garage-panel .panel-card h1 {
    margin-top: 4px;
  }
  .car-grid {
    gap: 5px;
  }
  .car-option {
    font-size: 10px;
  }
  .cosmetic-item {
    padding: 9px;
  }
  .challenge-item {
    padding: 12px;
  }
  .challenge-item button {
    font-size: 11px;
    padding: 10px;
  }
  .result-stats strong {
    font-size: 18px;
  }
  footer {
    font-size: 7px;
    letter-spacing: 0;
    left: 10px;
    right: 10px;
  }
}
@media (max-height: 560px) and (orientation: landscape) {
  header {
    padding: 8px 18px;
  }
  .wordmark {
    font-size: 18px;
  }
  .wordmark small {
    display: none;
  }
  .hud {
    top: 70px;
    gap: 22px;
  }
  .stat strong {
    font-size: 20px;
  }
  .stat small {
    font-size: 8px;
  }
  #map-wrap {
    top: 65px;
    width: 100px;
  }
  #minimap {
    width: 100px;
    height: 80px;
  }
  #controls {
    bottom: 28px;
  }
  #drive-area {
    height: 58px;
  }
  .stick-dock {
    width: 34px;
    height: 34px;
  }
  .stick-dock i {
    width: 15px;
    height: 15px;
  }
  .arrows {
    display: none;
  }
  #drift {
    width: 54px;
    height: 54px;
  }
  #turbo {
    width: 68px;
    height: 68px;
  }
  #keyboard-hint {
    display: none;
  }
  #speed {
    bottom: 120px;
  }
  #speed strong {
    font-size: 28px;
  }
  .intro-card {
    top: 35%;
    left: 25%;
    padding: 12px 18px;
    max-width: 290px;
  }
  .intro-card h2 {
    font-size: 17px;
    margin: 5px 0;
  }
  .intro-card p {
    font-size: 11px;
    margin: 8px 0;
  }
  .intro-progress {
    margin: 8px 0;
  }
  .intro-card button {
    min-height: 38px;
  }
  .overlay {
    padding: 68px 14px 30px;
  }
  .garage-panel {
    padding-top: 70px;
  }
  .garage-panel .panel-card {
    max-height: calc(100dvh - 100px);
    width: 50%;
  }
  .podium {
    margin: 15px 0;
  }
  .panel-card {
    padding: 20px;
  }
  footer {
    font-size: 7px;
  }
}
@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
  .spinner {
    animation-duration: 2s;
  }
}

#shortcut-hint {
  position: absolute;
  top: 170px;
  left: 24px;
  font-size: 10px;
  letter-spacing: 1px;
  color: #ffd384;
  background: #182037bb;
  border: 1px solid #ffd38455;
  padding: 9px 12px;
  border-radius: 8px;
  pointer-events: none;
  max-width: 75vw;
}
#ui.in-panel #shortcut-hint {
  display: none;
}
@media (max-height: 560px) {
  #shortcut-hint {
    top: 120px;
    font-size: 8px;
    padding: 6px;
  }
}

/* 0.3.0 mobile typography and touch targets */
.stat small,
.tag,
.eyebrow,
#keyboard-hint,
#shortcut-hint,
#charge-label,
footer,
.wordmark small {
  font-size: max(12px, 0.75rem);
}
#drift,
#turbo,
#left,
#right,
.icon-button,
#controls button {
  min-width: 64px;
  min-height: 64px;
}
#steer-plane {
  position: absolute;
  inset: 0 50% 0 0;
  z-index: 2;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
body.left-handed #steer-plane {
  inset: 0 0 0 50%;
}
body.in-panel #steer-plane {
  pointer-events: none;
}
body.in-panel #panel,
body.in-panel .overlay {
  z-index: 48;
  pointer-events: auto;
}
body.in-panel #tip-line {
  display: none;
}
#speed-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  background:
    repeating-linear-gradient(
      98deg,
      transparent 0 9%,
      #9af7ffcc 10%,
      transparent 11% 100%
    ),
    repeating-linear-gradient(
      82deg,
      transparent 0 13%,
      #ffffffaa 14%,
      transparent 15% 100%
    ),
    radial-gradient(
      ellipse at center,
      transparent 28%,
      #00e5ff33 78%,
      #7cf0ff66 100%
    );
  mix-blend-mode: screen;
  transform: perspective(420px) scale(1.15);
  transform-origin: center;
  transition: opacity 0.12s linear;
}
#speed-lines.on {
  opacity: 0.92;
}
#speed-lines.on.light {
  opacity: 0.4;
}
#perf-hud {
  position: absolute;
  top: 110px;
  right: 16px;
  font-size: 12px;
  color: #9fef9f;
  pointer-events: none;
  z-index: 30;
  text-shadow: 0 0 4px #000;
}
#tip-line {
  position: absolute;
  top: 28%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  padding: 10px 16px;
  background: #0c1428cc;
  border: 1px solid #42f0f055;
  border-radius: 10px;
  pointer-events: none;
  z-index: 18;
  max-width: 80vw;
  text-align: center;
}
#offtrack {
  font-size: 12px;
}

.daily-card {
  margin: 12px 0 18px;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid #42f0f088;
  background: linear-gradient(145deg, #163a4ef0, #1a1634f0);
  box-shadow:
    0 0 0 1px #ffc85733,
    0 16px 40px #0005;
}
.daily-card h2 {
  margin: 0 0 6px;
  color: #ffc857;
  letter-spacing: 1px;
}
.daily-card .primary {
  width: 100%;
  margin-top: 10px;
}
.sound-toggle {
  margin-top: 12px;
  width: 100%;
}
.sound-toggle.is-on {
  border-color: #42f0f088;
  background: #12353fcc;
}
.sound-toggle.is-off {
  border-color: #ff6d9166;
  background: #2a1520cc;
}

.hud-garage {
  min-height: 48px;
  min-width: auto;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid #42f0f066;
  background: #0b1224ee;
  color: #d7fbff;
  letter-spacing: 1.4px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.hud-garage:hover,
.hud-garage:focus-visible {
  border-color: #42f0f0;
  box-shadow: 0 0 0 1px #42f0f055;
}
body.in-garage .hud-garage,
body.in-panel .hud-garage {
  display: none !important;
}
body.in-panel header {
  z-index: 60;
}
.panel-card {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}
#panel .actions button[data-testid="garage"],
.actions button[data-testid="garage"] {
  border-color: #42f0f088;
  background: #102033;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
}
#pad-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 16;
  background: radial-gradient(circle at 50% 70%, #7cf6ff99, #42f0f000 62%);
}
#pad-flash.slow {
  background: radial-gradient(circle at 50% 70%, #ff8aae88, #ff6d9100 62%);
}
#pad-cue {
  position: fixed;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  z-index: 18;
  pointer-events: none;
  font-weight: 950;
  font-size: clamp(28px, 6vw, 54px);
  letter-spacing: 4px;
  color: #7cf6ff;
  text-shadow: 0 0 18px #42f0f0cc, 0 2px 0 #041018;
}
#pad-cue.slow {
  color: #ff9fb6;
  text-shadow: 0 0 18px #ff6d91cc, 0 2px 0 #041018;
}
/* pad-cue lives outside #ui, so #ui.in-panel does not hide it; keep race HUD off in garage/panels */
body.in-garage #pad-cue,
body.in-garage #pad-flash,
body.in-panel #pad-cue,
body.in-panel #pad-flash {
  display: none !important;
}
#final-lap-flag {
  position: absolute;
  left: 50%;
  top: 86px;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: none;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #ffd166;
  background: #0b1224cc;
  border: 1px solid #ffd16655;
  border-radius: 6px;
  padding: 5px 10px;
}
.fatal-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050916d8;
  pointer-events: auto;
}
.fatal-overlay[hidden] {
  display: none;
}
.fatal-card {
  width: min(420px, 90vw);
  background: #10182c;
  border: 1px solid #42f0f044;
  border-radius: 14px;
  padding: 28px 24px;
  text-align: center;
}
.fatal-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
}
.fatal-card p {
  margin: 0 0 22px;
  color: #b7c4dc;
}
.fatal-card button {
  min-width: 180px;
  background: #42f0f0;
  color: #041018;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.credits { margin-top: 10px; }
.credits-panel { margin-top: 6px; font-size: 11px; line-height: 1.45; max-height: 36vh; overflow: auto; }
.credits-panel[hidden] { display: none; }
/* 0.5.0 retention UI */
.rt-feed {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  top: 34%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
body.in-garage .rt-feed,
body.in-panel .rt-feed {
  display: none;
}
.rt-pop {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: clamp(13px, 2.2vw, 20px);
  color: #fff;
  text-shadow: 0 0 10px #42f0f0aa, 0 2px 0 #0008;
  animation: rt-pop 0.25s ease-out;
}
.rt-pop.bank {
  color: #ffd36b;
}
.rt-pop.lost,
.rt-pop.behind {
  color: #ff8aa8;
}
.rt-pop.ahead {
  color: #7dffb0;
}
.rt-pop.toast {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: #0b1430d9;
  border: 1px solid #42f0f055;
  text-shadow: none;
}
@keyframes rt-pop {
  from {
    transform: scale(1.35);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rt-pop {
    animation: none;
  }
}
.rt-summary,
.rt-challenges,
.rt-level {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}
.rt-line {
  margin: 0;
  font-size: 13px;
}
.rt-line.good {
  color: #7dffb0;
}
.rt-line.big {
  font-size: 18px;
  font-weight: 800;
  color: #ffd36b;
}
.rt-xp-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 11px;
  opacity: 0.8;
}
.rt-bar {
  height: 6px;
  border-radius: 3px;
  background: #ffffff1f;
  overflow: hidden;
}
.rt-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #42f0f0, #b46bff);
}
.rt-chal-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 2px 8px;
  align-items: center;
  font-size: 12px;
}
.rt-chal-row .rt-bar {
  grid-column: 1 / -1;
}
.rt-chal-row.done {
  opacity: 0.7;
}
.rt-challenges h3 {
  margin: 6px 0 0;
  font-size: 13px;
}
.rt-cosmetic {
  font-size: 11px;
}
/* 0.5.1: the player's podium slot */
.podium-item.you {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}


/* 0.6.0 floating virtual joystick (anchor wherever the thumb lands on the steer half) */
#stick {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  opacity: 1;
  transition: opacity 0.18s ease;
}
#stick[hidden] {
  display: block;
  opacity: 0;
}
#stick.done {
  opacity: 0;
}
.stick-base {
  position: absolute;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  border: 2px solid #6edcfa55;
  background: radial-gradient(circle at 50% 42%, #16324ecc, #0c1628bb);
  box-shadow:
    0 0 22px #0008,
    inset 0 0 18px #42f0f014;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
#stick.active .stick-base {
  border-color: #42f0f0aa;
  box-shadow:
    0 0 26px #42f0f033,
    inset 0 0 18px #42f0f01c;
}
.stick-knob {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #eaffff, #42f0f0 58%, #128aad);
  box-shadow:
    0 0 16px #42f0f0cc,
    0 4px 10px #0008;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
#stick.done .stick-knob {
  transition: transform 0.16s ease-out;
  transform: translate3d(0, 0, 0) !important;
}

/* 0.6.0 mobile perf: backdrop-filter costs a full-screen composite per frame on phone GPUs;
   the same panels already carry near-opaque backgrounds, so blur is dropped on coarse pointers */
@media (pointer: coarse) {
  .steer-controls,
  .action-controls,
  .intro-card,
  .overlay,
  #panel.garage-panel,
  .overlay.garage-panel,
  #banner,
  #tip-line,
  #shortcut-hint {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  /* without the blur, keep the HUD readable over the neon: slightly more opaque panels */
  .steer-controls,
  .action-controls {
    background: #0b1224ee;
  }
  #speed-lines {
    display: none;
  }
}

