/* Global Styling */
html,
body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(to right, gold, yellow, #15ff00);
  height: 100%;
  color: #fff;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
}

.screen.active {
  display: flex;
}

/* Loading Screen */
#loading-screen {
  background: linear-gradient(to bottom, #00ff00, gold);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.click-to-start {
  margin-top: 20px;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  text-align: center;
}

#loading-screen.ready .click-to-start {
  opacity: 1;
}

.click-to-start h1 {
  margin: 0;
  font-size: 2rem;
  text-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.donut {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 10px solid rgba(255, 255, 255, 0.15);
  border-top: 10px solid #0057ff;
  animation: rotate 1s linear infinite;
}

.donut .logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 120px;
  transform: translate(-50%, -50%);
  border-radius: 18px;
}

@keyframes rotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.progress-container {
  width: min(60%, 500px);
  height: 22px;
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid #fff;
  margin-top: 24px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.progress-bar {
  height: 100%;
  background: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.15),
      rgba(255, 255, 255, 0.15) 10px,
      transparent 10px,
      transparent 20px
    ),
    linear-gradient(95deg, #0069d9, #ff0080);
  width: 0;
  transition: width 0.2s linear;
}

/* Landing Page */
#landing-page {
  width: 100%;
  height: 100vh;
  background: linear-gradient(to right, gold, yellow, #00ff00);
  color: #000000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#landing-page-header {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10;
  backdrop-filter: blur(4px);
}

.icon-button {
  background: rgba(0, 0, 0, 0.25);
  border: none;
  color: white;
  justify-content: center;
  align-items: center;
  display: flex;
  font-size: 1.35em;
  width: 42px;
  height: 42px;
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  margin: 0 5px;
  transition: background-color 0.3s, transform 0.2s;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.18);
}

.top-left-controls {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.icon-button:hover {
  background: rgba(0, 0, 0, 0.42);
  transform: scale(1.08);
}

#landing-page-header h2 {
  font-size: 1.18em;
  color: white;
  margin: 0;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.player-info {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.1);
  padding: 8px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.player-info button {
  background: #ffd700;
  color: #222;
  border: none;
  border-radius: 15px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.3s, transform 0.2s;
  font-weight: 700;
}

.player-info button:hover {
  background: #ffc107;
  transform: translateY(-1px);
}

.player-info span {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.95em;
  color: white;
}

.player-info i {
  color: #ff9800;
}

#landing-page main {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: calc(100% - 140px);
  padding: 0 20px;
  box-sizing: border-box;
  margin-top: 72px;
  margin-bottom: 80px;
}

.main-content-area {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 20px;
  width: 100%;
  max-width: 1400px;
  height: 100%;
}

.vehicle-interaction-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex: 1 1 auto;
}

.vehicle-details-container {
  text-align: center;
  background: rgba(0, 0, 0, 0.42);
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 900px;
  color: white;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: row;
}

#vehicle-name {
  font-size: 1.95em;
  margin-top: 0;
  margin-bottom: 6px;
  color: #ffd700;
}

#selected-vehicle-indicator {
  font-size: 0.62em;
  color: #2ecc71;
  font-weight: bold;
  vertical-align: middle;
  display: inline-block;
}

#vehicle-description {
  font-size: 0.96em;
  margin-bottom: 12px;
  color: #f0f0f0;
}

.vehicle-meta-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.vehicle-meta-pill {
  background: rgba(255, 255, 255, 0.14);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
}

.lock-pill.locked {
  background: rgba(231, 76, 60, 0.82);
}

.lock-pill.unlocked {
  background: rgba(46, 204, 113, 0.82);
}

.vehicle-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px;
  width: 100%;
  min-height: 380px;
}

.carousel-arrow {
  background: rgba(0, 0, 0, 0.3);
  border: none;
  color: white;
  font-size: 2em;
  padding: 15px;
  border-radius: 50%;
  height: 64px;
  width: 64px;
  cursor: pointer;
  margin: 0 10px;
  transition: background-color 0.3s, transform 0.2s;
  flex-shrink: 0;
}

.carousel-arrow:hover {
  background: rgba(0, 0, 0, 0.5);
  transform: scale(1.06);
}

#vehicle-showcase {
  width: min(980px, calc(100vw - 220px));
  min-height: 380px;
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
  align-items: center;
}

.vehicle-card {
  position: relative;
  height: 340px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.14);
  border: 3px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.22),
    0 8px 20px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease,
    opacity 0.22s ease;
}

.vehicle-card.center-card {
  transform: scale(1.06);
  /* border-color: rgba(255, 255, 255, 0.45); */
  border: 5px solid rgb(0, 162, 255);
  background: rgba(0, 0, 0, 0.22);
}

.vehicle-card.side-card {
  opacity: 0.92;
}

.vehicle-card::before {
  content: "";
  position: absolute;
  bottom: 16px;
  left: 12%;
  width: 76%;
  height: 24px;
  background: rgba(0, 0, 0, 0.24);
  border-radius: 50%;
  filter: blur(8px);
}

.vehicle-viewer {
  width: 92%;
  height: 210px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 900px;
}

.vehicle-model {
  width: 190px;
  height: 105px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.45s ease;
}

.vehicle-card.center-card .vehicle-model {
  animation: idleFloat 2.8s ease-in-out infinite;
}

@keyframes idleFloat {
  0%,
  100% {
    transform: rotateX(10deg) rotateY(-24deg) translateY(0);
  }
  50% {
    transform: rotateX(10deg) rotateY(-10deg) translateY(-8px);
  }
}

.vehicle-body {
  position: absolute;
  width: 160px;
  height: 54px;
  bottom: 20px;
  left: 15px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--car-color1), var(--car-color2));
  box-shadow: inset 0 4px 10px rgba(255, 255, 255, 0.18),
    0 8px 14px rgba(0, 0, 0, 0.22);
}

.vehicle-cabin {
  position: absolute;
  width: 86px;
  height: 40px;
  left: 42px;
  bottom: 58px;
  border-radius: 14px 14px 10px 10px;
  background: linear-gradient(180deg, #d8f6ff, #9fd5dd);
  box-shadow: inset 0 3px 8px rgba(255, 255, 255, 0.35);
}

.vehicle-wheel {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #666, #222 55%, #000 70%);
  bottom: 5px;
  border: 4px solid #777;
}

.vehicle-wheel.left {
  left: 30px;
}

.vehicle-wheel.right {
  right: 18px;
}

.vehicle-label {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.vehicle-mini-name {
  color: white;
  font-weight: 800;
  font-size: 1rem;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.lock-badge,
.price-badge,
.selected-badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.lock-badge {
  background: rgba(231, 76, 60, 0.92);
  color: white;
}

.price-badge {
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}

.selected-badge {
  background: rgba(46, 204, 113, 0.94);
  color: white;
}

.vehicle-speed-tag {
  position: absolute;
  bottom: 16px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.vehicle-actions {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

#purchase-vehicle-button,
#select-vehicle-button {
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 1.08em;
  font-weight: bold;
  border-radius: 25px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.1s;
}

#purchase-vehicle-button {
  background-color: #2ecc71;
  box-shadow: 0 4px 0 #27ae60;
}

#purchase-vehicle-button:hover {
  background-color: #29b765;
}

#purchase-vehicle-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #27ae60;
}

#select-vehicle-button {
  background-color: #3498db;
  box-shadow: 0 4px 0 #2c80b9;
}

#select-vehicle-button:hover {
  background-color: #2f8fcd;
}

#select-vehicle-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #2c80b9;
}

#purchase-vehicle-button:disabled,
#select-vehicle-button:disabled {
  background-color: #aaa !important;
  box-shadow: 0 4px 0 #888 !important;
  cursor: not-allowed;
  opacity: 0.8;
}

.right-panel {
  width: 340px;
  min-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.controls-panel,
.info-panel {
  background: rgba(0, 0, 0, 0.22);
  padding: 20px;
  border-radius: 15px;
  color: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.22);
}

.controls-panel h3,
.info-panel h3 {
  margin-top: 0;
  color: #ffd700;
  font-size: 1.4em;
  margin-bottom: 16px;
}

.control-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
}

.control-key {
  min-width: 90px;
  text-align: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(255, 215, 0, 0.25);
}

.control-text {
  font-size: 0.95em;
  color: #f4f4f4;
}

.info-panel p {
  line-height: 1.5;
  margin: 0 0 12px;
}

#landing-page footer {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 15px 25px;
  box-sizing: border-box;
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 10;
}

#start-game-button {
  background-color: #e67e22;
  color: white;
  border: none;
  padding: 18px 35px;
  font-size: 1.3em;
  font-weight: bold;
  border-radius: 30px;
  cursor: pointer;
  text-transform: uppercase;
  z-index: 8;
  box-shadow: 0 5px 0 #d35400;
  transition: background-color 0.2s, transform 0.1s, box-shadow 0.1s,
    opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

#start-game-button:hover:not(:disabled) {
  background-color: #d35400;
}

#start-game-button:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #d35400;
}

#start-game-button:disabled {
  background-color: #95a5a6 !important;
  box-shadow: 0 5px 0 #7f8c8d !important;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Notification System */
#notification-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: auto;
  max-width: 90%;
}

.notification-item {
  padding: 12px 20px;
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  max-width: 400px;
  text-align: left;
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95em;
}

.notification-item.show {
  opacity: 1;
  transform: translateY(0);
}

.notification-item.hide {
  opacity: 0;
  transform: translateY(-20px);
}

.notification-item i {
  font-size: 1.2em;
}

.notification-info {
  background-color: #3498db;
}

.notification-success {
  background-color: #2ecc71;
}

.notification-warning {
  background-color: #f39c12;
}

.notification-error {
  background-color: #e74c3c;
}

/* Responsive */
@media (max-width: 1180px) {
  .main-content-area {
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
    padding-bottom: 20px;
  }

  .right-panel {
    width: 100%;
    max-width: 900px;
    min-width: 0;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .controls-panel,
  .info-panel {
    flex: 1 1 320px;
  }

  #vehicle-showcase {
    width: 100%;
  }
}

@media (max-width: 860px) {
  #landing-page-header {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
  }

  #landing-page-header h2 {
    order: 3;
    width: 100%;
  }

  #vehicle-showcase {
    grid-template-columns: 1fr;
    max-width: 340px;
  }

  .vehicle-card.side-card {
    display: none;
  }

  .carousel-arrow {
    height: 56px;
    width: 56px;
    font-size: 1.6rem;
  }

  .vehicle-carousel {
    gap: 8px;
  }
}

.vehicle-viewer {
  width: 100%;
  height: 210px;
  position: relative;
}

.vehicle-canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
}

.vehicle-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
}

.vehicle-name-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vehicle-cost-line {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff3b0;
}

.vehicle-status-line {
  font-size: 0.86rem;
  font-weight: 700;
}

.status-owned {
  color: #b9ffcb;
}

.status-locked {
  color: #ffd2d2;
}

.vehicle-bottom-row {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-action-btn {
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
  color: white;
}

.purchase-card-btn {
  background: #2ecc71;
}

.select-card-btn {
  background: #3498db;
}

.selected-card-btn {
  background: #95a5a6;
  cursor: default;
}

.vehicle-speed-tag {
  position: static;
}