:root {
  --bg: #07080a;
  --panel: #12141a;
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f2f2f2;
  --muted: #a8aeb8;
  --teal: #8bdbcf;
  --red: #e33021;
  --cyan: #178fbe;
  --display: "Bangers", Impact, system-ui, sans-serif;
  --body: "Roboto", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  touch-action: none;
}

#game-root,
#game-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Boot */
#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background:
    radial-gradient(800px 400px at 50% 30%, rgba(23, 143, 190, 0.2), transparent 60%),
    var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#boot-screen.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-logo {
  width: min(420px, 78vw);
  height: auto;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
}

.boot-tag {
  margin: 0;
  font-family: var(--display);
  letter-spacing: 0.06em;
  color: var(--teal);
  font-size: 1.15rem;
}

.boot-status {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.boot-bar {
  width: min(280px, 70vw);
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.35rem;
}

.boot-bar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--teal));
  transition: width 0.15s linear;
}

/* HUD */
.hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud.is-hidden {
  display: none;
}

.hud-top {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
}

.hud-back {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hud-back:hover {
  background: rgba(139, 219, 207, 0.2);
}

.hud-logo {
  height: 36px;
  width: auto;
  opacity: 0.95;
}

.hud-title {
  font-family: var(--display);
  letter-spacing: 0.08em;
  font-size: 1.35rem;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
}

.hud-help {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  pointer-events: none;
}

kbd {
  display: inline-block;
  min-width: 1.25em;
  padding: 0.05em 0.35em;
  margin: 0 0.1em;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  font-family: inherit;
  font-size: 0.85em;
  color: #fff;
  text-align: center;
}

.prompt {
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(227, 48, 33, 0.95), rgba(155, 16, 8, 0.95));
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  box-shadow: 0 10px 30px rgba(227, 48, 33, 0.35);
  pointer-events: none;
  animation: pulse 1.4s ease-in-out infinite;
}

.prompt.is-hidden {
  display: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: translateX(-50%) scale(1);
  }
  50% {
    transform: translateX(-50%) scale(1.03);
  }
}

/* Panel */
.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.55);
}

.panel-backdrop.is-hidden {
  display: none;
}

.panel {
  position: fixed;
  z-index: 30;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  display: grid;
  grid-template-columns: minmax(200px, 340px) 1fr;
  gap: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.panel.is-hidden {
  display: none;
}

.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.65rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.panel-art-wrap {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.08), transparent 55%),
    #0a0a0c;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 1rem;
}

.panel-art-wrap img {
  max-width: 100%;
  max-height: 360px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.45));
}

.panel-body {
  padding: 1.35rem 1.5rem 1.5rem;
}

.panel-kicker {
  margin: 0 0 0.25rem;
  color: var(--red);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.8rem;
}

.panel-body h2 {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.panel-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1rem;
  margin: 0 0 1rem;
}

.panel-stats div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
}

.panel-stats dt {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.panel-stats dd {
  margin: 0.15rem 0 0;
  font-weight: 700;
  color: var(--teal);
  font-size: 0.95rem;
}

.panel-blurb {
  margin: 0 0 1.15rem;
  color: var(--muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), #9b1008);
  color: #fff;
}

.btn-primary.is-hidden {
  display: none;
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.btn-ghost:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.btn-ghost.is-hidden {
  display: none !important;
}

.btn-drive {
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #178fbe, #0a5a7a 50%, #5eff00);
  color: #041208;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  padding: 0.75rem 1.25rem;
}

.btn-drive:hover {
  filter: brightness(1.08);
}

.btn-drive.is-hidden {
  display: none;
}

/* Difficulty picker on car panel */
.panel-diff {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-diff__label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
  font-weight: 700;
}

.panel-diff__btns {
  display: flex;
  gap: 0.4rem;
}

.panel-diff__btn {
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #ddd;
  border-radius: 8px;
  padding: 0.45rem 0.35rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.panel-diff__btn:hover {
  border-color: rgba(139, 219, 207, 0.45);
  color: #fff;
}

.panel-diff__btn.is-active {
  background: linear-gradient(135deg, rgba(23, 143, 190, 0.85), rgba(94, 255, 0, 0.55));
  color: #041208;
  border-color: transparent;
}

.ghud-place {
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.2rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ghud-place.is-leader {
  color: #ffee00;
  border-color: rgba(255, 238, 0, 0.45);
}

.ghud-diff {
  pointer-events: auto;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.55);
  color: #ddd;
  cursor: pointer;
}

.ghud-diff.is-easy {
  color: #8bdbcf;
  border-color: rgba(139, 219, 207, 0.4);
}

.ghud-diff.is-medium {
  color: #ffcc33;
  border-color: rgba(255, 204, 51, 0.4);
}

.ghud-diff.is-hard {
  color: #ff6b5a;
  border-color: rgba(227, 48, 33, 0.5);
}

.ghud-finish.is-win {
  border-color: rgba(94, 255, 0, 0.55);
}

.ghud-finish.is-loss {
  border-color: rgba(255, 120, 80, 0.4);
}

.ghud-place.is-hidden,
.ghud-diff.is-hidden {
  display: none !important;
}

/* NPC talk dialog — must sit ABOVE game HUD (z-index 12) as bottom-center card */
.npc-dialog-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 80 !important;
  background: rgba(0, 0, 0, 0.6);
  margin: 0;
  padding: 0;
  border: 0;
}

#npc-dialog.npc-dialog,
.npc-dialog {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  /* Clear help bar + safe area; never top-left under GARAGE/WALK */
  bottom: 5.5rem !important;
  transform: translateX(-50%) !important;
  z-index: 90 !important;
  width: min(440px, calc(100vw - 1.5rem)) !important;
  max-width: calc(100vw - 1.5rem);
  margin: 0 !important;
  background: linear-gradient(180deg, #1a1e28 0%, #0d1016 100%);
  border: 1px solid rgba(139, 219, 207, 0.35);
  border-radius: 16px;
  padding: 1.15rem 1.25rem 1.25rem;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  pointer-events: auto;
  box-sizing: border-box;
}

@media (max-width: 720px) {
  #npc-dialog.npc-dialog,
  .npc-dialog {
    bottom: max(6.5rem, calc(env(safe-area-inset-bottom, 0px) + 5.5rem)) !important;
  }
}

.npc-dialog.is-hidden,
.npc-dialog-backdrop.is-hidden,
#npc-dialog.is-hidden,
#npc-dialog-backdrop.is-hidden {
  display: none !important;
}

.npc-dialog-close {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.npc-dialog-close:hover {
  opacity: 1;
}

.npc-dialog-role {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}

.npc-dialog-name {
  margin: 0.2rem 0 0.65rem;
  font-family: var(--display);
  font-size: 1.65rem;
  letter-spacing: 0.04em;
  color: #fff;
}

.npc-dialog-line {
  margin: 0 0 1rem;
  color: #d8dde6;
  line-height: 1.45;
  font-size: 0.98rem;
  min-height: 3.2em;
}

.npc-dialog .btn-drive {
  width: 100%;
}

/* Game HUD */
#game-hud {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.ghud-left {
  position: absolute;
  top: 4.2rem;
  left: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ghud-right {
  position: absolute;
  top: 4.2rem;
  right: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  pointer-events: auto;
}

.ghud-zone,
.ghud-mode {
  font-family: var(--display);
  letter-spacing: 0.08em;
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ghud-zone {
  color: var(--teal);
  font-size: 1.05rem;
}

.ghud-mode {
  color: #fff;
  font-size: 0.95rem;
}

.ghud-speed {
  font-family: var(--display);
  font-size: 1.8rem;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  line-height: 1;
}

.ghud-speed small {
  font-size: 0.7rem;
  margin-left: 0.25rem;
  color: var(--muted);
}

.ghud-lap {
  font-family: var(--display);
  color: var(--red);
  background: rgba(0, 0, 0, 0.55);
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  letter-spacing: 0.06em;
}

.ghud-assist {
  pointer-events: auto;
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ghud-assist.is-on {
  color: #8bdbcf;
  border-color: rgba(139, 219, 207, 0.45);
  background: rgba(10, 40, 36, 0.75);
}

.ghud-assist.is-off {
  color: #c8c8c8;
}

.ghud-assist:active {
  transform: scale(0.96);
}

.ghud-btn {
  pointer-events: auto;
  border: 0;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
}

#minimap {
  position: absolute;
  right: 0.85rem;
  bottom: 5.5rem;
  width: 180px;
  height: 140px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  pointer-events: none;
}

.ghud-toast {
  position: absolute;
  left: 50%;
  top: 5.5rem;
  transform: translateX(-50%);
  max-width: min(520px, 90vw);
  text-align: center;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid rgba(139, 219, 207, 0.35);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}

.ghud-toast.is-hidden,
.ghud-speed.is-hidden,
.ghud-lap.is-hidden,
.ghud-timer.is-hidden,
.ghud-countdown.is-hidden,
.ghud-boost.is-hidden,
.ghud-assist.is-hidden,
.ghud-banner.is-hidden,
.ghud-finish.is-hidden {
  display: none !important;
}

.ghud-records {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.45);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  max-width: 220px;
  line-height: 1.3;
}

.ghud-timer {
  font-family: var(--body);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  text-align: right;
  line-height: 1.35;
}

.ghud-timer span {
  color: var(--teal);
  font-variant-numeric: tabular-nums;
}

.ghud-countdown {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-size: clamp(4rem, 18vw, 8rem);
  color: #fff;
  text-shadow:
    0 0 24px rgba(227, 48, 33, 0.8),
    0 6px 0 #000;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.ghud-countdown.pop {
  animation: cd-pop 0.45s ease-out;
}

@keyframes cd-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.4);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.12);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.ghud-boost {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 1.8rem;
  color: #5eff00;
  text-shadow: 0 0 18px rgba(94, 255, 0, 0.7);
  letter-spacing: 0.08em;
  animation: boost-pulse 0.4s ease-in-out infinite alternate;
}

.ghud-banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  letter-spacing: 0.08em;
  color: #fff;
  text-align: center;
  padding: 0.55rem 1.4rem;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(227, 48, 33, 0.92), rgba(23, 143, 190, 0.92));
  border: 2px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  text-shadow: 0 2px 0 #000;
  white-space: nowrap;
}

.ghud-banner.pop {
  animation: banner-in 0.45s ease-out;
}

@keyframes banner-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

.ghud-finish {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 25;
  pointer-events: auto;
  width: min(400px, calc(100vw - 2rem));
  padding: 1.35rem 1.5rem 1.4rem;
  border-radius: 18px;
  background: linear-gradient(165deg, #1c2230 0%, #0a0c10 100%);
  border: 2px solid rgba(255, 238, 0, 0.45);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  text-align: center;
}

.ghud-finish__kicker {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #ffee00;
  font-weight: 800;
}

.ghud-finish__title {
  margin: 0.25rem 0 0.35rem;
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: 0.06em;
  color: #fff;
  text-shadow: 0 0 24px rgba(227, 48, 33, 0.55);
}

.ghud-finish__car {
  margin: 0 0 0.85rem;
  color: var(--teal);
  font-weight: 700;
}

.ghud-finish__stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0 0 0.75rem;
}

.ghud-finish__stats div {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 0.55rem 0.4rem;
}

.ghud-finish__stats dt {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.ghud-finish__stats dd {
  margin: 0.2rem 0 0;
  font-family: var(--display);
  font-size: 1.45rem;
  color: #fff;
  letter-spacing: 0.04em;
}

.ghud-finish__note {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: #c8c8c8;
  min-height: 1.2em;
}

.ghud-finish .btn-drive {
  width: 100%;
}

.ghud-banner.is-hidden,
.ghud-finish.is-hidden {
  display: none !important;
}

@keyframes boost-pulse {
  from {
    opacity: 0.75;
    transform: translateX(-50%) scale(1);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) scale(1.08);
  }
}

/* Virtual controls */
#vpad {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

#vpad.is-visible {
  display: block;
}

.vpad-stick {
  pointer-events: auto;
  position: absolute;
  left: 1rem;
  bottom: 1.25rem;
  width: 130px;
  height: 130px;
  touch-action: none;
}

.vpad-base {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.18);
}

.vpad-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: 0;
  border-radius: 50%;
  background: rgba(139, 219, 207, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
  touch-action: none;
}

.vpad-actions {
  pointer-events: auto;
  position: absolute;
  right: 1rem;
  bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.vpad-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(227, 48, 33, 0.75);
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.vpad-btn.is-hidden {
  display: none !important;
}

.vpad-btn--exit {
  background: rgba(30, 30, 40, 0.88);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.vpad-btn--assist {
  width: auto;
  min-width: 64px;
  height: 44px;
  border-radius: 999px;
  padding: 0 0.75rem;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  background: rgba(20, 40, 38, 0.88);
  border-color: rgba(139, 219, 207, 0.35);
  color: #c8c8c8;
}

.vpad-btn--assist.is-on {
  color: #8bdbcf;
  border-color: rgba(139, 219, 207, 0.65);
  background: rgba(10, 50, 45, 0.9);
}

.vpad-btn.is-down {
  filter: brightness(1.2);
  transform: scale(0.96);
}

@media (max-width: 720px) {
  #minimap {
    width: 96px;
    height: 76px;
    right: 0.55rem;
    top: auto;
    bottom: auto;
    /* Top-right under HUD — clear of car + stick */
    top: 7.2rem;
    opacity: 0.82;
  }

  #game-hud.is-driving #minimap {
    width: 88px;
    height: 70px;
    top: 6.6rem;
    opacity: 0.75;
  }

  .hud-help {
    font-size: 0.68rem;
    bottom: 0.5rem;
  }

  /* Hide keyboard help while racing — frees bottom of screen */
  body.is-driving .hud-help {
    display: none !important;
  }

  body.is-driving .ghud-left {
    top: 3.6rem;
    left: 0.5rem;
    gap: 0.2rem;
  }

  body.is-driving .ghud-right {
    top: 3.6rem;
    right: 0.5rem;
    gap: 0.25rem;
  }

  body.is-driving .ghud-records {
    font-size: 0.62rem;
    max-width: 150px;
  }

  body.is-driving .ghud-speed {
    font-size: 1.35rem;
    padding: 0.15rem 0.5rem;
  }

  body.is-driving .ghud-zone,
  body.is-driving .ghud-mode {
    font-size: 0.85rem;
    padding: 0.2rem 0.45rem;
  }

  body.is-driving .ghud-timer {
    font-size: 0.68rem;
    padding: 0.25rem 0.4rem;
  }

  body.is-driving .ghud-lap {
    font-size: 0.85rem;
  }

  body.is-driving .ghud-assist {
    font-size: 0.7rem;
    padding: 0.3rem 0.55rem;
  }

  .vpad-stick {
    left: 0.65rem;
    bottom: 1rem;
    width: 118px;
    height: 118px;
  }

  .vpad-actions {
    right: 0.65rem;
    bottom: 1.1rem;
    gap: 0.5rem;
  }

  .panel {
    grid-template-columns: 1fr;
    width: min(100vw - 1rem, 480px);
  }

  .panel-art-wrap {
    min-height: 200px;
  }

  .hud-logo {
    display: none;
  }

  .hide-mobile {
    display: none;
  }

  .panel-stats {
    grid-template-columns: 1fr;
  }
}
