/* Hill Climb Racing - Stylesheet */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0d1117;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #fff;
}

#gameContainer {
  position: relative;
  width: 100%;
  height: 100%;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* UI Overlay Screens */
.ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Garage / Main Menu Screen */
#garageScreen {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 28px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.78) 0%, rgba(15, 23, 42, 0.15) 30%, rgba(15, 23, 42, 0.35) 55%, rgba(15, 23, 42, 0.88) 90%);
  pointer-events: auto;
  overflow-y: auto;
}

.garage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-title {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 1.5px;
  color: #ffb703;
  text-shadow: 0 3px 0 #d48b04, 0 6px 0 #78350f, 0 8px 16px rgba(0, 0, 0, 0.85);
  margin: 0;
  line-height: 1.1;
  transform: skewX(-4deg);
}

.game-title .title-racing {
  display: inline-block;
  background: linear-gradient(135deg, #e63946, #d90429);
  color: #fff;
  padding: 1px 12px;
  border-radius: 8px;
  font-style: italic;
  text-shadow: 0 2px 0 #7f1d1d;
  box-shadow: 0 4px 10px rgba(230, 57, 70, 0.5);
  margin-left: 4px;
}

.title-subtitle {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #fde047;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-top: 2px;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coin-badge {
  background: linear-gradient(180deg, rgba(254, 240, 138, 0.25) 0%, rgba(202, 138, 4, 0.25) 100%);
  border: 2px solid #ffd700;
  border-bottom: 4px solid #b45309;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 19px;
  font-weight: 900;
  color: #ffd700;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.coin-icon {
  font-size: 18px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.record-badge {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.2) 0%, rgba(2, 132, 199, 0.2) 100%);
  border: 2px solid #38bdf8;
  border-bottom: 4px solid #0369a1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 800;
  color: #e0f2fe;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.trophy-icon {
  font-size: 16px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-bottom: 4px solid rgba(0, 0, 0, 0.35);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-2px);
}

/* Vehicle Showcase Navigation Bar */
.showcase-nav-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 10px 0;
  position: relative;
  z-index: 10;
}

.vehicle-nav-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  border: 3px solid #ffffff;
  border-bottom: 5px solid #0369a1;
  color: #ffffff;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.vehicle-nav-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.65);
}

.vehicle-nav-btn:active {
  transform: translateY(2px) scale(0.98);
}

.showcase-info-card {
  background: rgba(15, 23, 42, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-bottom: 4px solid rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-radius: 18px;
  padding: 8px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 260px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.showcase-vname {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #fde047;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.85);
}

.showcase-vstats {
  display: flex;
  gap: 12px;
  margin: 2px 0 4px 0;
}

.vstat-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.vstat-label {
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
}

.vstat-bar {
  width: 44px;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid #334155;
}

.vstat-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #4ade80);
  border-radius: 3px;
}

.showcase-vaction {
  margin-top: 2px;
}

/* Garage Content Sections */
.garage-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 6px 0;
  z-index: 10;
}

.section-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #e2e8f0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.panel-hint {
  font-size: 11px;
  color: #94a3b8;
}

/* Workshop Panel (The 4 iconic upgrades) */
.workshop-panel {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #334155;
  border-radius: 18px;
  padding: 12px 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.upgrades-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 860px) {
  .upgrades-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.upgrade-card {
  background: rgba(30, 41, 59, 0.85);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.upgrade-card:hover {
  border-color: #4cc9f0;
  transform: translateY(-2px);
}

.upgrade-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.upgrade-name {
  font-size: 13px;
  font-weight: 900;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 4px;
}

.upgrade-lvl {
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
}

/* Segmented LED Pip Bar */
.upgrade-led-bar {
  display: flex;
  gap: 3px;
  width: 100%;
  padding: 2px 0;
}

.led-pip {
  flex: 1;
  height: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.led-pip.active {
  background: linear-gradient(180deg, #00f5d4 0%, #00bbf9 100%);
  border-color: #00f5d4;
  box-shadow: 0 0 6px rgba(0, 245, 212, 0.75);
}

.upgrade-desc {
  font-size: 10px;
  color: #94a3b8;
  line-height: 1.25;
  height: 24px;
  overflow: hidden;
}

/* Catalog Scroller (Stages & Vehicles) */
.catalog-scroller {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.catalog-card {
  min-width: 180px;
  max-width: 200px;
  background: rgba(30, 41, 59, 0.88);
  border: 2px solid #334155;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.catalog-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
}

.catalog-card.selected {
  border-color: #38bdf8;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.45);
  background: rgba(15, 23, 42, 0.95);
}

.catalog-card.locked {
  opacity: 0.72;
}

.card-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 4px;
  color: #f8fafc;
}

.card-desc {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 8px;
  line-height: 1.3;
}

.card-record {
  font-size: 11px;
  font-weight: 800;
  color: #ffd700;
  margin-bottom: 8px;
}

.card-action {
  margin-top: auto;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.8px;
}

.selected-badge {
  background: #38bdf8;
  color: #0f172a;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

/* 3D Action Buttons */
.btn {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  font-weight: 900;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-select {
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  border-bottom: 3px solid #0369a1;
  color: #fff;
}
.btn-select:hover {
  background: #0284c7;
}

.btn-buy {
  background: linear-gradient(180deg, #f59e0b, #d97706);
  border-bottom: 3px solid #92400e;
  color: #0f172a;
  font-weight: 900;
}
.btn-buy:hover {
  background: #d97706;
}

.btn-upgrade {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border-bottom: 3px solid #047857;
  color: #ffffff;
  margin-top: 2px;
  font-weight: 900;
}
.btn-upgrade:hover {
  background: #059669;
}
.btn-upgrade.disabled {
  background: #475569;
  border-bottom: 3px solid #334155;
  color: #94a3b8;
  cursor: not-allowed;
}

/* Garage Footer & Big 3D Start Button */
.garage-footer {
  display: flex;
  justify-content: center;
  padding-top: 10px;
  z-index: 10;
}

.btn-start {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  padding: 14px 68px;
  border-radius: 36px;
  border: 3px solid #bbf7d0;
  border-bottom: 6px solid #14532d;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.55);
  transition: all 0.2s ease;
  letter-spacing: 1.5px;
  position: relative;
  overflow: hidden;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  animation: pulseGlow 2.5s infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.55);
  }
  50% {
    box-shadow: 0 10px 35px rgba(34, 197, 94, 0.85);
  }
}

.btn-start:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.1);
}

.btn-start:active {
  transform: translateY(3px) scale(0.98);
  border-bottom-width: 2px;
}

.btn-start:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.6);
}

/* In-Game Floating Top Action Buttons */
.hud-top-actions {
  display: none;
  position: absolute;
  top: 110px;
  right: 20px;
  gap: 10px;
  z-index: 50;
  pointer-events: auto;
}

.hud-btn {
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid #4cc9f0;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 10px rgba(76, 201, 240, 0.25);
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.hud-btn:hover {
  background: #4cc9f0;
  color: #0f172a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 201, 240, 0.5);
}

.hud-btn:active {
  transform: scale(0.95);
}

.hud-back-btn {
  border-color: #f59e0b;
}

.hud-back-btn:hover {
  background: #f59e0b;
  color: #0f172a;
}

/* On-Screen Touch Pedals (HUD) */
#hudControls {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 0;
  width: 100%;
  padding: 0 32px;
  justify-content: space-between;
  pointer-events: none;
}

.pedal-btn {
  pointer-events: auto;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.4);
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease, filter 0.1s ease;
  backdrop-filter: blur(8px);
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-touch-callout: none !important;
  outline: none !important;
}

.pedal-btn * {
  pointer-events: none !important;
}

.pedal-btn span.pedal-hint {
  font-size: 11px;
  opacity: 0.8;
  margin-top: 2px;
  font-weight: normal;
}

.pedal-brake {
  background: radial-gradient(circle, #e63946 0%, #b71c1c 100%);
  color: #fff;
}

.pedal-gas {
  background: radial-gradient(circle, #2a9d8f 0%, #1e6f5c 100%);
  color: #fff;
}

.pedal-btn:active, .pedal-btn.active {
  filter: brightness(1.35);
  border-color: #fff;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.7);
}

/* Modals (Game Over & Pause) */
.modal-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(10px);
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  z-index: 100;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 16px;
}

.modal-card {
  box-sizing: border-box;
  width: 90%;
  max-width: 420px;
  max-height: 94vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: #1e293b;
  border: 2px solid #334155;
  border-radius: 20px;
  padding: 22px 20px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-gameover {
  max-width: 400px;
  width: 90%;
  padding: 18px 20px 20px 20px;
  box-sizing: border-box;
}

.modal-gameover .modal-title {
  font-size: 24px;
  margin-bottom: 2px;
  line-height: 1.1;
}

.modal-gameover .modal-subtitle {
  font-size: 12px;
  margin-bottom: 8px;
  color: #94a3b8;
}

/* Crash Snapshot Frame (Strictly inside card width) */
.crash-photo-container {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0 12px 0;
  box-sizing: border-box;
  overflow: hidden;
}

.polaroid-card {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  background: #0f172a;
  border: 2px solid #334155;
  border-radius: 14px;
  padding: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transform: none !important; /* Strictly aligned within card width */
}

.polaroid-tape {
  display: none !important;
}

.polaroid-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(230, 57, 70, 0.95);
  border: 1px solid #ff4d6d;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 5;
  transform: none !important;
}

.polaroid-image-frame {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 140px;
  max-height: 150px;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.polaroid-img {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: 10px;
}

.polaroid-caption {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  text-align: center;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  box-sizing: border-box;
}

.modal-gameover .record-pill {
  margin: 4px auto 8px auto;
  font-size: 12px;
  padding: 3px 12px;
}

.modal-gameover .stats-summary {
  padding: 8px 14px;
  margin-bottom: 12px;
  gap: 6px;
  border-radius: 10px;
}

.modal-gameover .summary-row {
  font-size: 13px;
}

.modal-gameover .modal-actions {
  margin-top: auto;
}

.modal-gameover .btn-modal {
  padding: 10px;
  font-size: 14px;
  border-radius: 10px;
}
  font-size: 13px;
  font-weight: bold;
  color: #1e293b;
  text-align: center;
  letter-spacing: 0.3px;
}

@keyframes popIn {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-title {
  font-size: 32px;
  font-weight: 900;
  color: #e63946;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.modal-subtitle {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 24px;
}

.record-pill {
  display: none;
  background: linear-gradient(90deg, #ffd700, #ff9e00);
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  padding: 6px 16px;
  border-radius: 16px;
  margin: 0 auto 18px auto;
  width: fit-content;
  letter-spacing: 1px;
}

.stats-summary {
  background: #0f172a;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  color: #cbd5e1;
}

.summary-row strong {
  color: #fff;
  font-weight: 800;
}

.modal-actions {
  display: flex;
  gap: 14px;
}

.btn-modal {
  flex: 1;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
}

.btn-retry {
  background: #10b981;
  color: #fff;
}
.btn-retry:hover {
  background: #059669;
}

.btn-garage {
  background: #3b82f6;
  color: #fff;
}
.btn-garage:hover {
  background: #2563eb;
}
