:root {
  /* Proton e.MAS brand palette */
  --supernova: #22afe5;
  --turquoise: #58c3c0;
  --stellar: #2c4c69;
  --eclipse: #20323b;
  --melon: #f04e63;
  --maroon: #3e0018;

  --bg: #0b171c;
  --bg-2: #16272e;
  --panel: #eaf4f6;
  --ink: #16272e;
  --pink: #f04e63;
  --cyan: #22afe5;
  --purple: #2c4c69;
  --yellow: #58c3c0;
  --white: #f4fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  padding: 18px;
  overflow-x: hidden;
  color: var(--white);
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(circle at 50% 0%, #2c4c69 0%, #16272e 40%, #0a1418 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 1360px);
  margin: 0 auto;
}

.title-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  width: 100%;
  margin: 0 auto 16px;
}

.title-left {
  justify-self: start;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.header-evolve-logo {
  display: block;
  width: clamp(72px, 9vw, 104px);
  height: auto;
  object-fit: contain;
  padding-left: 16px;
  border-left: 2px solid rgba(255, 255, 255, 0.4);
}

.title-center {
  justify-self: center;
  text-align: center;
}

.title-right {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.kicker {
  margin: 0;
  color: #8fd8f2;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: right;
}

.game-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand-logo {
  display: block;
  width: clamp(178px, 25vw, 244px);
  height: auto;
  object-fit: contain;
  filter:
    drop-shadow(3px 3px 0 #000)
    drop-shadow(0 0 8px rgba(34, 175, 229, 0.22));
}

.neon-dash-title {
  color: #fff;
  font-size: clamp(1.4rem, 3.4vw, 2.4rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.12em;
  text-shadow:
    3px 3px 0 #000,
    0 0 12px rgba(34, 175, 229, 0.6),
    0 0 22px rgba(88, 195, 192, 0.4);
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag,
.sound-toggle {
  padding: 7px 9px;
  border: 3px solid #fff;
  background: #1c3340;
  box-shadow: 4px 4px 0 #000;
  color: #8fd8f2;
  font-size: 0.66rem;
  font-weight: 700;
  white-space: nowrap;
}

.sound-toggle {
  cursor: pointer;
}

.sound-toggle[aria-pressed="false"] {
  background: #1a2c34;
  color: #f7909e;
}

.arcade-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 280px;
  gap: 22px;
  align-items: start;
  justify-content: center;
}

.game-column {
  min-width: 0;
}

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 4px solid #fff;
  outline: 4px solid #2c4c69;
  background: #000;
  box-shadow:
    8px 8px 0 #000,
    0 0 34px rgba(34, 175, 229, 0.28);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.panel {
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 0, 8, 0.72);
}

.card {
  width: min(100%, 420px);
  max-height: 100%;
  overflow: auto;
  padding: 18px;
  border: 4px solid var(--ink);
  background: var(--panel);
  box-shadow: 8px 8px 0 #000;
  color: var(--ink);
  scrollbar-width: thin;
}

.card.compact {
  width: min(100%, 380px);
}

/* The landscape frame is wide but short: give the garage card more
   width and a more compact height so all controls stay on-screen. */
.garage-card {
  width: min(100%, 560px);
  padding: 10px 18px 12px;
}

.garage-card h2 {
  margin: 2px 0 6px;
  font-size: clamp(1.1rem, 3.2vw, 1.55rem);
}

.garage-card .small-kicker {
  font-size: 0.64rem;
}

.garage-card .loading-bar {
  margin: 5px 0 8px;
}

.garage-card .car-slide {
  padding: 4px 10px 2px;
}

.garage-card .car-slide img {
  height: 92px;
}

.garage-card .car-slide strong {
  margin-top: 2px;
}

.garage-card .carousel-tools {
  margin: 8px 0;
}

/* These two are redundant with the car label + kicker; hiding them
   keeps the whole card inside the short landscape frame. */
.garage-card .selected-colour,
.garage-card .swipe-note {
  display: none;
}

.small-kicker {
  margin: 0;
  color: #22afe5;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-align: center;
}

.card h2 {
  margin: 6px 0 14px;
  font-size: clamp(1.45rem, 4.5vw, 2.05rem);
  letter-spacing: 0.08em;
  text-align: center;
}

label {
  display: block;
  margin: 8px 0 6px;
  font-weight: 700;
}

input {
  width: 100%;
  padding: 12px;
  border: 3px solid var(--ink);
  outline: none;
  background: #fff;
  box-shadow: 4px 4px 0 #000;
}

input:focus {
  border-color: #22afe5;
  box-shadow:
    4px 4px 0 #000,
    0 0 0 3px #8fd8f2;
}

.rules {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: #2c4c69;
  font-size: 0.78rem;
  font-weight: 700;
}

.rules span::before {
  content: "▸ ";
  color: #f04e63;
}

.pixel-btn,
.mini-btn,
.control,
.round-button {
  cursor: pointer;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 #000;
  font-weight: 700;
}

.pixel-btn:active,
.mini-btn:active,
.control:active,
.round-button:active,
.sound-toggle:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #000;
}

.pixel-btn {
  width: 100%;
  padding: 12px;
  background: var(--yellow);
  color: var(--ink);
  text-transform: uppercase;
}

.pixel-btn.alt {
  background: #e2f5f8;
}

.mini-btn {
  padding: 5px 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.68rem;
}

.button-row {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.result-box {
  padding: 8px 10px;
  border: 3px solid var(--ink);
  background: #fff;
}

.result-box div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #9892bd;
}

.result-box div:last-child {
  border-bottom: 0;
}

.result-box span {
  color: #4f4a76;
}

/* Garage carousel */
.loading-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #22afe5;
  font-size: 0.7rem;
  font-weight: 700;
}

.loading-bar {
  height: 10px;
  margin: 6px 0 14px;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #fff;
}

.loading-bar span {
  display: block;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      90deg,
      #f04e63 0 12px,
      #58c3c0 12px 24px
    );
  animation: loadingGlow 1.4s linear infinite;
}

@keyframes loadingGlow {
  from {
    transform: translateX(-24px);
  }

  to {
    transform: translateX(0);
  }
}

.car-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 3px solid var(--ink);
  background:
    linear-gradient(180deg, #f7fbff 0%, #dfe7ef 72%, #b4bdc8 72%, #d4dbe2 100%);
  box-shadow: inset 0 -20px 0 rgba(43, 51, 74, 0.08);
  touch-action: pan-y;
  cursor: grab;
}

.car-carousel:active {
  cursor: grabbing;
}

.car-track {
  display: flex;
  transition: transform 280ms steps(8, end);
  will-change: transform;
}

.car-slide {
  flex: 0 0 100%;
  min-width: 100%;
  padding: 12px 12px 8px;
  text-align: center;
}

.car-slide img {
  display: block;
  width: 100%;
  height: 164px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  image-rendering: pixelated;
  filter: drop-shadow(7px 8px 0 rgba(0, 0, 0, 0.18));
}

.car-slide strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
}

.carousel-tools {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.round-button {
  width: 42px;
  height: 38px;
  padding: 0;
  background: #fff;
  color: var(--ink);
}

.car-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.car-dot {
  width: 11px;
  height: 11px;
  padding: 0;
  border: 2px solid var(--ink);
  background: #fff;
  cursor: pointer;
}

.car-dot.active {
  background: #f04e63;
  box-shadow: 2px 2px 0 #000;
}

.selected-colour {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 3px solid var(--ink);
  background: #fff;
  font-size: 0.78rem;
}

.selected-colour span {
  color: #565178;
}

.swipe-note {
  margin: 9px 0;
  color: #625b8d;
  font-size: 0.68rem;
  text-align: center;
}

.ride-summary {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px;
  border: 3px solid var(--ink);
  background: #fff;
}

.ride-summary img {
  width: 82px;
  height: 54px;
  object-fit: contain;
  image-rendering: pixelated;
}

.ride-summary span {
  display: block;
  color: #625b8d;
  font-size: 0.64rem;
}

.ride-summary strong {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
}

/* Leaderboard rail */
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 22px;
  align-self: stretch;
}

.side-leaderboard {
  min-height: 430px;
  overflow: hidden;
  border: 4px solid #181430;
  outline: 3px solid #b9ecf2;
  background: #dbeef7;
  box-shadow:
    8px 8px 0 #000,
    0 0 26px rgba(34, 175, 229, 0.18);
  color: #181430;
}

.scoreboard-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border-bottom: 4px solid #181430;
  background:
    linear-gradient(135deg, #e6e0ff 0%, #bfe8f2 100%);
}

.scoreboard-kicker {
  margin: 0 0 2px;
  color: #22afe5;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.scoreboard-top h2 {
  margin: 0;
  font-size: 1.8rem;
  letter-spacing: 0.08em;
}

.leaderboard {
  min-height: 320px;
  max-height: 560px;
  margin: 0;
  padding: 10px 12px 14px 44px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #22afe5 #dbeef7;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.95) 0 34px,
      rgba(233, 243, 255, 0.96) 34px 68px
    );
}

.leaderboard::-webkit-scrollbar {
  width: 10px;
}

.leaderboard::-webkit-scrollbar-track {
  background: #dbeef7;
  border-left: 2px solid #181430;
}

.leaderboard::-webkit-scrollbar-thumb {
  background: #22afe5;
  border: 2px solid #181430;
}

.leaderboard li {
  min-height: 34px;
  padding: 7px 4px;
  border-bottom: 1px dashed #8587ab;
  font-size: 0.74rem;
}

.leaderboard li::marker {
  color: #22afe5;
  font-weight: 700;
}

.score-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.score-name {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: #68688b;
  font-size: 0.58rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-distance {
  color: #1f3a52;
  font-weight: 700;
  white-space: nowrap;
}

/* Side rails (banner + test-drive links) */
.side-rail-left {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
}

/* Clickable official-site banner */
.site-banner {
  display: block;
  width: 100%;
  padding: 8px;
  border: 3px solid #fff;
  background: linear-gradient(160deg, #2c4c69 0%, #16272e 100%);
  box-shadow: 4px 4px 0 #000;
  color: var(--white);
  text-decoration: none;
  text-align: center;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.site-banner:hover {
  transform: translate(-1px, -1px);
  box-shadow: 6px 6px 0 #000, 0 0 16px rgba(34, 175, 229, 0.45);
}

.site-banner:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 #000;
}

.site-banner-tag {
  display: block;
  margin-bottom: 6px;
  color: #58c3c0;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.site-banner-preview {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid #22afe5;
  image-rendering: auto;
}

.site-banner-cta {
  display: block;
  margin-top: 6px;
  color: #22afe5;
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Book-a-test-drive call to action */
.test-drive-banner {
  background: linear-gradient(160deg, #22afe5 0%, #2c4c69 100%);
  padding: 12px 10px;
}

.test-drive-banner:hover {
  box-shadow: 6px 6px 0 #000, 0 0 18px rgba(240, 78, 99, 0.5);
}

.test-drive-title {
  display: block;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.test-drive-cta {
  display: block;
  margin-top: 6px;
  color: #eaf4f6;
  font-size: 0.54rem;
  font-weight: 700;
}

/* Social links box */
.socials-box {
  padding: 10px 8px;
  border: 3px solid #fff;
  background: #14252c;
  box-shadow: 4px 4px 0 #000;
  text-align: center;
}

.socials-title {
  display: block;
  margin-bottom: 8px;
  color: #58c3c0;
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.socials-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.socials-links a {
  padding: 5px 6px;
  border: 2px solid #2c4c69;
  background: #0f1e24;
  color: #22afe5;
  font-size: 0.62rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}

.socials-links a:hover {
  background: #22afe5;
  color: #0f1e24;
}

.mascot {
  position: relative;
  z-index: 10;
  margin: 0;
  cursor: grab;
  text-align: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.mascot.is-dragging {
  z-index: 9999;
  cursor: grabbing;
}

.mascot img {
  display: block;
  width: auto;
  max-width: 86px;
  height: 126px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  image-rendering: pixelated;
  animation: mascotBounce 1.25s steps(2, end) infinite;
  transform-origin: center bottom;
  filter:
    drop-shadow(4px 5px 0 #000)
    drop-shadow(0 0 7px rgba(34, 175, 229, 0.18));
}

.mascot-2 img {
  animation-delay: -0.28s;
}

.mascot-3 img {
  animation-delay: -0.52s;
}

.mascot-4 img {
  animation-delay: -0.79s;
}

.mascot.is-dragging img {
  animation-play-state: paused;
}

.mascot-side-left .mascot:nth-child(2) img {
  height: 142px;
}

.mascot-side-right .mascot:nth-child(1) img {
  height: 136px;
}

.mascot-side-right .mascot:nth-child(2) img {
  height: 128px;
}

.mascot figcaption {
  display: none;
}

@keyframes mascotBounce {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }

  50% {
    transform: translateY(-8px) rotate(1deg);
  }
}

.countdown {
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
  color: #fff;
  font-size: min(24vw, 8rem);
  font-weight: 700;
  text-shadow:
    6px 6px 0 #000,
    0 0 18px #f04e63;
}

.drag-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  z-index: 2;
  padding: 6px 10px;
  transform: translateX(-50%);
  border: 2px solid #8fd8f2;
  background: rgba(15, 0, 28, 0.85);
  box-shadow: 3px 3px 0 #000;
  color: #8fd8f2;
  font-size: 0.72rem;
  white-space: nowrap;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.control {
  min-height: 56px;
  background: #eaf4f6;
  font-size: 1rem;
}

.control.center {
  background: #d9d6ff;
}

.controller-help {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 10px;
}

.controller-status {
  display: inline-block;
  padding: 5px 8px;
  border: 2px solid #58c3c0;
  background: #14252c;
  box-shadow: 3px 3px 0 #000;
  color: #f7909e;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
}

.controller-status.connected {
  color: #7fe0d6;
  border-color: #7fe0d6;
}

.help {
  margin: 0;
  color: #c1d7ff;
  font-size: 0.7rem;
  line-height: 1.45;
  text-align: center;
}

.hidden {
  display: none !important;
}

.site-footer {
  margin: 26px auto 6px;
  padding-top: 16px;
  border-top: 1px solid rgba(88, 195, 192, 0.22);
  color: #8fb6c4;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-align: center;
}

@media (max-width: 1120px) {
  .arcade-layout {
    grid-template-columns: 230px minmax(0, 1fr) 230px;
    gap: 16px;
  }
}

@media (max-width: 820px) {
  body {
    padding: 10px;
  }

  /* Stack the header so the logos and title never overlap. */
  .title-bar {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 10px;
  }

  .title-left,
  .title-center,
  .title-right {
    justify-self: center;
  }

  .title-right {
    align-items: center;
  }

  .kicker {
    text-align: center;
  }

  .header-actions {
    flex-direction: row;
  }

  .arcade-layout {
    grid-template-columns: minmax(0, 560px);
    gap: 16px;
    align-items: stretch;
  }

  .game-column {
    order: 1;
  }

  .right-rail {
    order: 2;
  }

  .side-rail-left {
    order: 3;
    flex-direction: row;
  }

  .side-rail-left .site-banner {
    flex: 1 1 0;
  }

  .side-leaderboard {
    min-height: auto;
  }

  .leaderboard {
    min-height: 220px;
  }
}

@media (max-width: 520px) {
  .title-bar {
    align-items: center;
  }

  .game-title {
    gap: 7px;
  }

  .header-brand-logo {
    width: clamp(140px, 44vw, 180px);
  }

  .neon-dash-title {
    font-size: clamp(1.1rem, 6vw, 1.6rem);
  }

  .header-actions {
    flex-direction: row;
    align-items: stretch;
  }

  /* Portrait phones: give the overlays room and letterbox the
     landscape game instead of squashing it. */
  .frame {
    aspect-ratio: 3 / 4;
  }

  canvas {
    object-fit: contain;
    background: #000;
  }

  .tag,
  .sound-toggle {
    padding: 5px 7px;
    font-size: 0.58rem;
    text-align: center;
  }

  .panel {
    padding: 10px;
  }

  .card {
    padding: 14px;
  }

  .car-slide img {
    height: 138px;
  }

  .ride-summary {
    grid-template-columns: 68px 1fr auto;
  }

  .ride-summary img {
    width: 68px;
    height: 48px;
  }
}
