/* —— Collision Avoidance HD (game.html only; loaded after styles.css) —— */
.page-game-hd .vhd-header { padding-bottom: 0.75rem; }
.page-game-hd .vhd-header p:not(.wordmark):not(.tagline):not(.game-eyebrow) { max-width: 70ch; }
.page-game-hd .vhd-main { padding-bottom: 2.5rem; }

.page-game-hd .canvas-wrap.vhd-stage {
  position: relative;
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 16 / 10;
  max-height: 80vh;
  max-height: 80svh;
  margin: 0 auto;
  background: #9fb4c8 radial-gradient(circle at 50% 30%, #c9d7e3, #8aa0b6);
  border-radius: var(--radius);
  overflow: hidden;
  touch-action: none;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  -webkit-user-select: none;
  user-select: none;
}
.page-game-hd .canvas-wrap.vhd-stage canvas#game-canvas {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: none;
}
@media (max-width: 760px) {
  .page-game-hd .canvas-wrap.vhd-stage { aspect-ratio: 360 / 560; max-height: 74vh; max-height: 74svh; border-radius: 12px; }
  .page-game-hd .vhd-header h1 { font-size: 1.6rem; }
  .page-game-hd .vhd-header p:not(.wordmark):not(.tagline):not(.game-eyebrow) { font-size: 0.9rem; }
}
@media (max-width: 760px) and (orientation: landscape) {
  .page-game-hd .canvas-wrap.vhd-stage { aspect-ratio: 16 / 9; max-height: 86vh; max-height: 86svh; }
}

/* HUD overlay */
.page-game-hd .vhd-hud.game-hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; margin: 0;
  display: flex; justify-content: flex-start; gap: 0.5rem; padding: 0.6rem 3.4rem 0.6rem 0.6rem; pointer-events: none;
}
.page-game-hd .vhd-hud .stat {
  background: rgba(10, 18, 32, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 999px; padding: 0.28rem 0.75rem;
  color: rgba(244, 241, 234, 0.8); font-size: 0.78rem; letter-spacing: 0.02em; text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.page-game-hd .vhd-hud .stat strong { color: #fff; font-size: 1rem; font-variant-numeric: tabular-nums; margin-left: 0.2rem; }
.page-game-hd .vhd-speedo {
  position: absolute; right: 0.8rem; bottom: 0.7rem; z-index: 3; pointer-events: none;
  display: flex; align-items: baseline; gap: 0.25rem; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.55);
  font-variant-numeric: tabular-nums; opacity: 0; transition: opacity 0.3s;
}
.page-game-hd .vhd-speedo strong { font-size: 2rem; font-weight: 800; line-height: 1; }
.page-game-hd .vhd-speedo span { font-size: 0.8rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.08em; }
.page-game-hd .vhd-stage.is-playing .vhd-speedo { opacity: 1; }
.page-game-hd .vhd-pop {
  position: absolute; left: 50%; top: 22%; z-index: 4; transform: translate(-50%, 0); pointer-events: none;
  font-weight: 900; font-size: 1.35rem; color: #fff; letter-spacing: 0.03em; white-space: nowrap;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 0 18px rgba(244, 140, 6, 0.9); opacity: 0;
}
.page-game-hd .vhd-pop.go { animation: vhdPop 1.1s ease-out forwards; }
.page-game-hd .vhd-pop.bad { text-shadow: 0 2px 0 rgba(0,0,0,0.35), 0 0 18px rgba(208, 0, 0, 0.9); }
@keyframes vhdPop {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  70% { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(0.98); }
}
.page-game-hd .vhd-mute {
  position: absolute; top: 0.55rem; right: 0.6rem; z-index: 6; width: 2.3rem; height: 2.3rem; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2); background: rgba(10, 18, 32, 0.55); color: #fff; font-size: 1rem; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.page-game-hd .vhd-mute[aria-pressed="true"] { opacity: 0.75; }

/* Loading overlay */
.page-game-hd .vhd-loading {
  position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.6rem;
  background: radial-gradient(circle at 50% 40%, #1d3350 0%, #0f1c2e 70%); transition: opacity 0.5s, visibility 0.5s;
}
.page-game-hd .vhd-loading img { width: 112px; height: 112px; border-radius: 50%; box-shadow: 0 0 0 4px rgba(232,93,4,0.35), 0 10px 30px rgba(0,0,0,0.5); animation: vhdPulse 1.8s ease-in-out infinite; }
.page-game-hd .vhd-duesy { font-size: 1.4rem; font-weight: 800; font-style: italic; color: var(--orange-hot); letter-spacing: 0.02em; }
.page-game-hd .vhd-bar { width: min(260px, 70%); height: 6px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; }
.page-game-hd .vhd-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #e85d04, #f48c06); transition: width 0.2s; }
.page-game-hd .vhd-load-msg { color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }
.page-game-hd .vhd-loading.done { opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes vhdPulse { 50% { transform: scale(1.05); } }

/* Start / score cards: glass panels that leave the car visible */
.page-game-hd .vhd-card.score-screen {
  z-index: 5; inset: auto 0 0 0; top: auto; max-height: 64%; justify-content: flex-end;
  background: linear-gradient(180deg, rgba(15, 28, 46, 0) 0%, rgba(15, 28, 46, 0.78) 22%, rgba(15, 28, 46, 0.94) 100%);
  padding: 2.2rem 1rem 1rem;
}
.page-game-hd #score-screen.vhd-card { max-height: 100%; top: 0; justify-content: center; background: linear-gradient(180deg, rgba(15,28,46,0.25) 0%, rgba(15,28,46,0.86) 34%, rgba(15,28,46,0.95) 100%); }
.page-game-hd .vhd-card h2 { font-size: 1.3rem; }
.page-game-hd .vhd-hd { display: inline-block; font-size: 0.7em; vertical-align: 0.15em; padding: 0.05em 0.4em; border-radius: 6px; background: var(--orange); color: #fff; }
.page-game-hd .vhd-card .start-blurb { max-width: 40ch; font-size: 0.9rem; margin-bottom: 0.35rem; }
.page-game-hd .vhd-card .start-controls { font-size: 0.8rem; margin-bottom: 0.5rem; }
.page-game-hd .vhd-start .leaderboard-preview .leaderboard-list { max-height: 7.2rem; }
.page-game-hd .vhd-round-stats { font-size: 0.82rem; color: var(--orange-hot) !important; margin-bottom: 0.5rem !important; }
.page-game-hd #btn-start:disabled { opacity: 0.55; cursor: wait; }
@media (min-width: 761px) {
  .page-game-hd .vhd-card.score-screen {
    inset: 0 auto 0 0; top: 0; width: min(380px, 38%); max-height: none; justify-content: center; padding: 1.25rem 1.4rem;
    background: linear-gradient(90deg, rgba(15, 28, 46, 0.93) 0%, rgba(15, 28, 46, 0.86) 78%, rgba(15, 28, 46, 0) 100%);
    align-items: flex-start; text-align: left;
  }
  .page-game-hd #score-screen.vhd-card { width: min(420px, 42%); background: linear-gradient(90deg, rgba(15,28,46,0.95) 0%, rgba(15,28,46,0.9) 80%, rgba(15,28,46,0) 100%); }
  .page-game-hd .vhd-card .leaderboard { max-width: 300px; }
  .page-game-hd .vhd-start .leaderboard-preview .leaderboard-list { max-height: 9.5rem; }
  .page-game-hd .vhd-card .score-actions { justify-content: flex-start; }
}

/* Touch pad: left / brake / right */
.page-game-hd .touch-pad.vhd-touch { grid-template-columns: 1fr 0.8fr 1fr; max-width: 420px; margin-top: 0.75rem; }
.page-game-hd .touch-pad .vhd-brake { font-size: 1rem; background: rgba(208, 0, 0, 0.14); border-color: rgba(208, 0, 0, 0.35); }
.page-game-hd .touch-pad button { touch-action: none; }
@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .page-game-hd .touch-pad.vhd-touch { max-width: 360px; opacity: 0.85; }
}

.page-game-hd .vhd-credits { max-width: 1100px; margin: 1.25rem auto 0; color: var(--muted); font-size: 0.82rem; }
.page-game-hd .vhd-credits summary { cursor: pointer; color: var(--cream); font-weight: 600; }
.page-game-hd .vhd-credits ul { margin: 0.6rem 0 0 1.1rem; display: grid; gap: 0.35rem; }
.page-game-hd .vhd-credits a { color: var(--orange-hot); }

/* Phones: the wrapped nav is tall, so let it scroll away on the game page to leave room for the stage */
@media (max-width: 760px) {
  .page-game-hd .site-nav { position: relative; }
}
.page-game-hd .vhd-stage .vhd-hud { transition: opacity 0.3s; }
.page-game-hd .vhd-stage:not(.is-playing) .vhd-hud { opacity: 0; }
@media (max-width: 760px) {
  .page-game-hd #score-screen.vhd-card { padding: 0.8rem 0.9rem; justify-content: flex-start; }
  .page-game-hd #score-screen .big-score { font-size: 2rem; margin: 0; }
  .page-game-hd #score-screen h2 { font-size: 1.15rem; margin-bottom: 0.1rem; }
  .page-game-hd #score-screen > p { font-size: 0.82rem; margin-bottom: 0.4rem; }
  .page-game-hd #score-screen .leaderboard-list { max-height: 8.6rem; }
  .page-game-hd #score-screen .leaderboard-list li { padding: 0.12rem 0.4rem; font-size: 0.72rem; }
  .page-game-hd #score-screen .score-actions .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
  .page-game-hd .vhd-start .score-brand { display: none; }
}
@media (max-width: 760px) {
  .page-game-hd .vhd-start.vhd-card { max-height: 58%; padding-top: 1.6rem; }
  .page-game-hd .vhd-start .start-blurb { font-size: 0.8rem; }
  .page-game-hd .vhd-start .start-controls { font-size: 0.74rem; margin-bottom: 0.3rem; }
  .page-game-hd .vhd-start .leaderboard-preview .leaderboard-list { max-height: 6.4rem; }
}
@media (max-width: 760px) {
  .page-game-hd .vhd-start.vhd-card { max-height: none; justify-content: flex-start; padding-top: 2rem; }
}

/* —— Pass 6: pre-race garage (compact; fits a phone stage with no scrolling) —— */
.page-game-hd .vhd-garage { width: 100%; max-width: 340px; margin: 0.15rem auto 0.4rem; text-align: center; }
.page-game-hd .vhd-garage-eyebrow { margin: 0 0 0.25rem; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-hot); font-weight: 700; }
.page-game-hd .vhd-garage-row { display: flex; align-items: center; gap: 0.4rem; }
.page-game-hd .vhd-garage-arrow {
  flex: 0 0 auto; width: 2.3rem; height: 2.3rem; border-radius: 50%; border: 1px solid rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 0 0.15rem;
  touch-action: manipulation;
}
.page-game-hd .vhd-garage-arrow:hover, .page-game-hd .vhd-garage-arrow:focus-visible { background: rgba(232, 93, 4, 0.35); border-color: var(--orange-hot); }
.page-game-hd .vhd-garage-label { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.5rem; justify-content: center; text-align: left; }
.page-game-hd .vhd-garage-gen {
  flex: 0 0 auto; font-weight: 900; font-size: 1.05rem; color: #fff; background: var(--orange); border-radius: 7px; padding: 0.12rem 0.42rem; letter-spacing: 0.02em;
}
.page-game-hd .vhd-garage-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.page-game-hd .vhd-garage-text strong { color: #fff; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-game-hd .vhd-garage-trim { color: var(--muted); font-size: 0.74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-game-hd .vhd-garage.is-loading .vhd-garage-trim { color: var(--orange-hot); }
.page-game-hd .vhd-garage-dots { display: flex; justify-content: center; gap: 0.3rem; margin-top: 0.35rem; }
.page-game-hd .vhd-garage-dots button {
  width: 0.5rem; height: 0.5rem; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,0.28); cursor: pointer;
  box-sizing: content-box; background-clip: content-box; border: 0.2rem solid transparent; margin: -0.2rem;
}
.page-game-hd .vhd-garage-dots button.on { background-color: var(--orange-hot); }
.page-game-hd .vhd-start .leaderboard-preview .leaderboard-list li:nth-child(n+7) { display: none; }
.page-game-hd .vhd-start .leaderboard-preview .leaderboard-list { max-height: none; overflow: visible; }
.page-game-hd .vhd-start #btn-start { min-width: 9rem; }
@media (max-width: 760px) {
  .page-game-hd .vhd-start.vhd-card { padding: 1.4rem 0.9rem 0.8rem; }
  .page-game-hd .vhd-start h2 { display: none; }
  .page-game-hd .vhd-start .start-blurb { display: none; }
  .page-game-hd .vhd-start .start-controls { font-size: 0.7rem; margin-bottom: 0.25rem; }
  .page-game-hd .vhd-start .leaderboard-preview { margin: 0 auto 0.45rem; }
  .page-game-hd .vhd-start .leaderboard-preview .leaderboard-title { font-size: 0.72rem; margin-bottom: 0.15rem; }
  .page-game-hd .vhd-start .leaderboard-preview .leaderboard-list li { padding: 0.1rem 0.4rem; font-size: 0.7rem; }
  .page-game-hd .vhd-start .leaderboard-preview .leaderboard-list .lb-car { width: 1.25rem; height: 0.78rem; font-size: 0.52rem; }
  .page-game-hd .vhd-start .leaderboard-preview { max-width: 250px; margin-bottom: 0.3rem; }
  .page-game-hd .vhd-start #btn-start { padding: 0.62rem 1.6rem; font-size: 1rem; }
  .page-game-hd #score-screen .score-actions { gap: 0.4rem; }
}
@media (min-width: 761px) {
  .page-game-hd .vhd-garage { margin-left: 0; }
  .page-game-hd .vhd-garage-eyebrow { text-align: left; }
  .page-game-hd .vhd-garage-dots { justify-content: flex-start; padding-left: 2.7rem; }
}
