:root {
  --sky: #57c8c7;
  --sky-dark: #42b3b2;
  --road: #8d8794;
  --road-dark: #78727e;
  --lane: rgba(255, 255, 255, 0.9);
  --accent: #e89a5a;
  --accent-dark: #cf7f40;
  --title: #f3df55;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Trebuchet MS", Arial, sans-serif;
  background: radial-gradient(
    circle at top left,
    #85e5df 0%,
    var(--sky) 45%,
    var(--sky-dark) 100%
  );
}

.car-layout {
  width: 100vw;
  height: 100vh;
  padding: 0;
}

#game.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  box-shadow: none;
  border: none;
  border-radius: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.02)
  );
}

#game.game-shell::before {
  content: "";
  position: absolute;
  left: -36px;
  bottom: -10px;
  width: 96px;
  height: 220px;
  background: rgba(255, 255, 255, 0.75);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
  z-index: 0;
}

#road {
  position: absolute;
  top: 12px;
  bottom: 12px;
  width: min(74vw, 780px);
  min-width: 420px;
  border-radius: 24px;
  background:
    linear-gradient(
      to right,
      transparent 0 24.5%,
      rgba(255, 255, 255, 0.06) 24.5% 25.5%,
      transparent 25.5% 49.5%,
      rgba(255, 255, 255, 0.06) 49.5% 50.5%,
      transparent 50.5% 74.5%,
      rgba(255, 255, 255, 0.06) 74.5% 75.5%,
      transparent 75.5% 100%
    ),
    linear-gradient(to bottom, var(--road) 0%, var(--road-dark) 100%);
  border-left: 5px solid rgba(255, 255, 255, 0.85);
  border-right: 5px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
  left: 50%;
  transform: translateX(-50%);
}

#road::before {
  content: "";
  position: absolute;
  left: -48px;
  top: 118px;
  width: 220px;
  height: 58%;
  background: linear-gradient(to bottom, #87818e 0%, #75707b 100%);
  border-left: 5px solid rgba(255, 255, 255, 0.85);
  border-right: 5px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px 0 0 20px;
}

.line {
  position: absolute;
  width: 5px;
  height: 42px;
  background: var(--lane);
  border-radius: 10px;
  transform: translateX(-50%);
}

#score,
.title-panel,
.action-buttons {
  position: absolute;
  z-index: 3;
}

#score {
  top: 18px;
  right: 18px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  color: white;
  font-size: 1rem;
  font-weight: 700;
}

.title-panel {
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  color: white;
  transition: opacity 0.25s ease;
}

.title-panel.hidden {
  opacity: 0;
  pointer-events: none;
}

.title-panel h1 {
  margin: 0;
  color: var(--title);
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  line-height: 1;
  letter-spacing: 0.05em;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.12);
}

.action-buttons {
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.car {
  position: absolute;
  width: 78px;
  height: 128px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.16),
    0 8px 14px rgba(0, 0, 0, 0.24);
}

.car::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 8px;
  width: 28px;
  height: 18px;
  background: rgba(220, 240, 255, 0.92);
  border-radius: 10px 10px 5px 5px;
  box-shadow: 0 30px 0 rgba(220, 240, 255, 0.75);
}

.car::after {
  content: "";
  position: absolute;
  inset: 12px -4px;
  border-left: 4px solid #1f1f1f;
  border-right: 4px solid #1f1f1f;
  border-radius: 12px;
}

.car.use-image {
  background: transparent !important;
  border: none;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35));
}

.car-sprite {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

#player .car-sprite,
.enemy .car-sprite {
  width: 100%;
  height: 100%;
  margin: 0;
}

.car.use-image::before,
.car.use-image::after {
  display: none;
}

#player {
  bottom: 20px;
  z-index: 2;
  background: linear-gradient(to bottom, #f25c54, #cc3127);
}

.enemy {
  z-index: 1;
  background: linear-gradient(to bottom, #ffbd59, #f18c2d);
}

#startBtn,
.back-link {
  width: 190px;
  padding: 14px 18px;
  border: none;
  border-radius: 10px;
  text-align: center;
  text-decoration: none;
  color: white;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(113, 67, 30, 0.25);
}

#startBtn {
  background: linear-gradient(to bottom, var(--accent), var(--accent-dark));
}

.back-link {
  background: linear-gradient(to bottom, #4e89d8, #2f68b7);
}

#startBtn:hover,
.back-link:hover {
  filter: brightness(1.04);
}

@media (max-width: 640px) {
  #road {
    width: calc(100vw - 16px);
    min-width: auto;
  }

  .title-panel h1 {
    font-size: 2rem;
  }

  #startBtn,
  .back-link {
    width: 160px;
    font-size: 1rem;
  }
}
