/* Color Garages styles */

:root {
  --road-asphalt: #334155;
  --road-curb: #64748b;
  --c-red: #ef4444;
  --c-blue: #3b82f6;
  --c-green: #10b981;
  --c-yellow: #facc15;
}

.garage-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0.5rem 1rem 1rem;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
}

/* Garages Row */
.garages-street {
  width: 100%;
  max-width: 620px;
  margin-bottom: 0.85rem;
}

.garages-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  width: 100%;
}

.garage-box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border: 3px solid #cbd5e1;
  border-radius: 1.25rem 1.25rem 0.5rem 0.5rem;
  padding: 0.35rem 0.25rem 0.5rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease;
  box-sizing: border-box;
  overflow: hidden;
  min-height: 140px;
}

.garage-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.garage-box:active {
  transform: translateY(1px) scale(0.97);
}

.garage-box:focus-visible {
  outline: 3px solid var(--game-focus, #ffb300);
  outline-offset: 2px;
}

/* Drag over highlight per garage color */
.garage-box.drag-hover {
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.garage-red.drag-hover {
  border-color: var(--c-red);
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.35);
}

.garage-blue.drag-hover {
  border-color: var(--c-blue);
  box-shadow: 0 10px 22px rgba(59, 130, 246, 0.35);
}

.garage-green.drag-hover {
  border-color: var(--c-green);
  box-shadow: 0 10px 22px rgba(16, 185, 129, 0.35);
}

.garage-yellow.drag-hover {
  border-color: var(--c-yellow);
  box-shadow: 0 10px 22px rgba(250, 204, 21, 0.35);
}

/* Parked state */
.garage-box.is-parked {
  cursor: default;
}

.garage-box.is-parked:hover {
  transform: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Roof & Color accents */
.garage-red    { border-top-color: var(--c-red); }
.garage-blue   { border-top-color: var(--c-blue); }
.garage-green  { border-top-color: var(--c-green); }
.garage-yellow { border-top-color: var(--c-yellow); }

.garage-roof {
  width: 100%;
  height: 12px;
  border-radius: 9999px;
  margin-bottom: 4px;
}

.garage-red .garage-roof    { background: var(--c-red); }
.garage-blue .garage-roof   { background: var(--c-blue); }
.garage-green .garage-roof  { background: var(--c-green); }
.garage-yellow .garage-roof { background: var(--c-yellow); }

/* Garage light indicator */
.garage-light {
  font-family: var(--font-emoji);
  font-size: 1.1rem;
  line-height: 1;
  margin-bottom: 4px;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.garage-box.is-parked .garage-light {
  filter: drop-shadow(0 0 6px #10b981);
  transform: scale(1.2);
}

/* Interior Stall & Shutter Door */
.garage-interior {
  position: relative;
  width: 100%;
  height: 72px;
  background: #1e293b;
  border-radius: 0.65rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.parked-car {
  font-family: var(--font-emoji);
  font-size: 2.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.garage-door {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    #94a3b8,
    #94a3b8 10px,
    #64748b 10px,
    #64748b 14px
  );
  border-radius: 0.65rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.3);
}

.door-handle {
  width: 22px;
  height: 4px;
  background: #334155;
  border-radius: 2px;
}

/* Door opened state */
.garage-box.door-open .garage-door {
  transform: translateY(-90%);
}

/* Garage Label */
.garage-label {
  font-size: 0.76rem;
  font-weight: 800;
  color: #334155;
  margin-top: 6px;
  text-align: center;
  line-height: 1.15;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* Incorrect wobble */
.garage-box.wobble {
  animation: gentle-wobble 0.4s ease-in-out;
  border-color: #ef4444;
}

@keyframes gentle-wobble {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Roadway Stage */
.roadway-stage {
  position: relative;
  width: 100%;
  max-width: 580px;
  height: 160px;
  background: var(--road-asphalt);
  border: 4px solid var(--road-curb);
  border-radius: 1.5rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  box-sizing: border-box;
}

.road-markings {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    #ffffff,
    #ffffff 24px,
    transparent 24px,
    transparent 44px
  );
  opacity: 0.7;
}

/* Incoming Vehicle */
.incoming-vehicle {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: grab;
  touch-action: none;
  z-index: 10;
  border: none;
  background: transparent;
  padding: 0;
}

.incoming-vehicle:focus-visible {
  outline: 3px solid var(--game-focus, #ffb300);
  border-radius: 1rem;
}

.incoming-vehicle.is-entering {
  animation: car-drive-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes car-drive-in {
  0% { transform: translateY(40px) scale(0.7); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.incoming-vehicle.dragging {
  cursor: grabbing;
  opacity: 0.92;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.45));
  animation: none !important;
  transform: none !important;
}

.incoming-vehicle.driving-away {
  animation: drive-up 0.5s ease-in forwards;
  pointer-events: none;
}

@keyframes drive-up {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-70px) scale(0.7); opacity: 0; }
}

.incoming-vehicle.vehicle-honk .vehicle-emoji {
  animation: honk-bounce 0.35s ease-out;
}

@keyframes honk-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.2) rotate(-4deg); }
  70% { transform: scale(0.95) rotate(3deg); }
  100% { transform: scale(1); }
}

.vehicle-emoji {
  font-family: var(--font-emoji);
  font-size: 4.5rem;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
  animation: engine-idle 0.6s ease-in-out infinite alternate;
}

/* Green tint filter for car_green */
.tint-green .vehicle-emoji,
.parked-car.tint-green {
  filter: hue-rotate(105deg) saturate(1.2) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

@keyframes engine-idle {
  0% { transform: translateY(0); }
  100% { transform: translateY(-3px); }
}

.vehicle-name {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.55);
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  margin-top: 4px;
  backdrop-filter: blur(4px);
}

/* Action Controls Bar */
.action-bar {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1rem;
  min-height: 48px;
}

.action-pill-btn {
  padding: 0.65rem 1.6rem;
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: pop-btn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action-pill-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.action-pill-btn:active {
  transform: translateY(1px) scale(0.98);
}

.action-pill-btn:focus-visible {
  outline: 3px solid var(--game-focus, #ffb300);
  outline-offset: 2px;
}

.again-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

@keyframes pop-btn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Sparks & Celebration */
.sparks-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 50;
}

.sparkle {
  position: absolute;
  font-family: var(--font-emoji);
  font-size: 1.5rem;
  animation: burst 0.85s ease-out forwards;
}

@keyframes burst {
  0% { transform: translate(0, 0) scale(0.5); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.35); opacity: 0; }
}

/* Responsive adjustments for narrow screens */
@media (max-width: 520px) {
  .garage-field {
    padding: 0.35rem 0.5rem 0.65rem;
  }
  .garages-row {
    gap: 0.35rem;
  }
  .garage-box {
    min-height: 125px;
    padding: 0.25rem 0.15rem 0.35rem;
  }
  .garage-interior {
    height: 56px;
  }
  .parked-car {
    font-size: 2.2rem;
  }
  .garage-label {
    font-size: 0.65rem;
  }
  .roadway-stage {
    height: 130px;
  }
  .vehicle-emoji {
    font-size: 3.6rem;
  }
  .vehicle-name {
    font-size: 0.85rem;
  }
  .action-pill-btn {
    padding: 0.55rem 1.2rem;
    font-size: 1rem;
  }
}

/* Responsive adjustments for short / landscape screens */
@media (max-height: 600px) {
  .garage-field {
    padding: 0.25rem 0.5rem 0.5rem;
    justify-content: flex-start;
  }
  .garages-street {
    margin-bottom: 0.35rem;
  }
  .garages-row {
    gap: 0.35rem;
  }
  .garage-box {
    min-height: 85px;
    padding: 0.2rem 0.15rem 0.25rem;
    border-radius: 0.75rem 0.75rem 0.4rem 0.4rem;
  }
  .garage-roof {
    height: 8px;
    margin-bottom: 2px;
  }
  .garage-light {
    font-size: 0.85rem;
    margin-bottom: 2px;
  }
  .garage-interior {
    height: 44px;
    border-radius: 0.4rem;
  }
  .parked-car {
    font-size: 1.8rem;
  }
  .garage-label {
    font-size: 0.62rem;
    margin-top: 2px;
  }
  .roadway-stage {
    height: 95px;
    border-radius: 1rem;
  }
  .vehicle-emoji {
    font-size: 2.5rem;
  }
  .vehicle-name {
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    margin-top: 2px;
  }
  .action-bar {
    margin-top: 0.4rem;
    min-height: 36px;
  }
  .action-pill-btn {
    padding: 0.4rem 1.1rem;
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vehicle-emoji,
  .action-pill-btn,
  .sparkle,
  .incoming-vehicle.is-entering,
  .incoming-vehicle.driving-away,
  .incoming-vehicle.vehicle-honk .vehicle-emoji,
  .garage-box.wobble {
    animation: none !important;
  }
  .garage-box,
  .garage-door,
  .parked-car,
  .action-pill-btn {
    transition-duration: 0.01ms !important;
  }
}
