/* City Building Animation for Presentation Loading */
.city-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(to bottom, #0a0a1a 0%, #1a1a3a 50%, #2a2a4a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  z-index: 100000;
  overflow: hidden;
}

/* Stars background */
.city-stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #fff, transparent),
    radial-gradient(2px 2px at 40px 70px, rgba(255,255,255,0.8), transparent),
    radial-gradient(1px 1px at 90px 40px, #fff, transparent),
    radial-gradient(2px 2px at 160px 120px, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 230px 80px, #fff, transparent),
    radial-gradient(2px 2px at 300px 150px, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 350px 50px, #fff, transparent),
    radial-gradient(2px 2px at 420px 100px, rgba(255,255,255,0.8), transparent);
  background-size: 500px 200px;
  animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Moon */
.city-moon {
  position: absolute;
  top: 8%;
  right: 15%;
  width: clamp(40px, 8vw, 80px);
  height: clamp(40px, 8vw, 80px);
  background: radial-gradient(circle at 30% 30%, #fffde7, #ffd54f);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(255, 213, 79, 0.5), 0 0 60px rgba(255, 213, 79, 0.3);
}

/* City container */
.city-container {
  position: relative;
  width: 100%;
  height: 60%;
  min-height: 300px;
}

/* Ground */
.city-ground {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: linear-gradient(to bottom, #2a3a4a, #1a2a3a);
}

/* Buildings wrapper */
.city-buildings {
  position: absolute;
  bottom: 20px;
  left: 0;
  width: 100%;
  height: calc(100% - 20px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(2px, 0.5vw, 8px);
  padding: 0 2%;
}

/* Individual building */
.city-building {
  position: relative;
  background: linear-gradient(to bottom, #3a4a5a 0%, #2a3a4a 100%);
  border-radius: 4px 4px 0 0;
  animation: buildUp 2s ease-out forwards;
  transform-origin: bottom center;
  transform: scaleY(0);
}

.city-building::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 8px,
    rgba(0,0,0,0.1) 8px,
    rgba(0,0,0,0.1) 10px
  );
  border-radius: 4px 4px 0 0;
}

/* Windows */
.city-building .windows {
  position: absolute;
  top: 10%;
  left: 10%;
  right: 10%;
  bottom: 5%;
  display: grid;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
  grid-template-rows: repeat(var(--rows, 8), 1fr);
  gap: 3px;
}

.city-building .window {
  background: rgba(255, 223, 128, 0.1);
  border-radius: 1px;
  animation: windowLight 0.5s ease-out forwards;
  animation-delay: calc(var(--delay, 0) * 0.1s + 1.5s);
  opacity: 0;
}

.city-building .window.lit {
  background: rgba(255, 223, 128, 0.9);
  box-shadow: 0 0 5px rgba(255, 200, 100, 0.5);
}

@keyframes windowLight {
  to { opacity: 1; }
}

/* Building variations */
.city-building:nth-child(1) { --height: 35%; width: clamp(30px, 5vw, 60px); animation-delay: 0.1s; }
.city-building:nth-child(2) { --height: 55%; width: clamp(40px, 6vw, 70px); animation-delay: 0.3s; }
.city-building:nth-child(3) { --height: 75%; width: clamp(35px, 5vw, 55px); animation-delay: 0.5s; }
.city-building:nth-child(4) { --height: 45%; width: clamp(45px, 7vw, 80px); animation-delay: 0.2s; }
.city-building:nth-child(5) { --height: 85%; width: clamp(50px, 8vw, 90px); animation-delay: 0.7s; }
.city-building:nth-child(6) { --height: 65%; width: clamp(38px, 6vw, 65px); animation-delay: 0.4s; }
.city-building:nth-child(7) { --height: 50%; width: clamp(42px, 6vw, 72px); animation-delay: 0.6s; }
.city-building:nth-child(8) { --height: 70%; width: clamp(36px, 5vw, 58px); animation-delay: 0.8s; }
.city-building:nth-child(9) { --height: 40%; width: clamp(32px, 5vw, 52px); animation-delay: 0.35s; }
.city-building:nth-child(10) { --height: 60%; width: clamp(44px, 7vw, 75px); animation-delay: 0.55s; }

.city-building {
  height: var(--height);
}

@keyframes buildUp {
  0% { transform: scaleY(0); }
  60% { transform: scaleY(1.05); }
  100% { transform: scaleY(1); }
}

/* Crane */
.city-crane {
  position: absolute;
  bottom: 20px;
  right: 15%;
  width: clamp(60px, 10vw, 120px);
  height: clamp(150px, 30vh, 300px);
  z-index: 10;
}

.crane-tower {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 100%;
  background: linear-gradient(90deg, #ff6b35 0%, #f7931e 50%, #ff6b35 100%);
  animation: craneUp 1.5s ease-out forwards;
  transform-origin: bottom center;
}

.crane-arm {
  position: absolute;
  top: 0;
  left: 50%;
  width: clamp(80px, 15vw, 160px);
  height: 6px;
  background: linear-gradient(90deg, #ff6b35, #f7931e);
  transform-origin: left center;
  animation: craneArm 2s ease-out 1.5s forwards;
  opacity: 0;
}

.crane-cable {
  position: absolute;
  top: 6px;
  right: 10px;
  width: 2px;
  height: clamp(30px, 8vh, 60px);
  background: #666;
  animation: cableDrop 1s ease-out 2.5s forwards, cableSwing 3s ease-in-out 3.5s infinite;
  opacity: 0;
  transform-origin: top center;
}

.crane-hook {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 15px;
  border: 3px solid #f7931e;
  border-top: none;
  border-radius: 0 0 6px 6px;
}

@keyframes craneUp {
  0% { height: 0; }
  100% { height: 100%; }
}

@keyframes craneArm {
  0% { opacity: 0; transform: rotate(-90deg); }
  100% { opacity: 1; transform: rotate(0deg); }
}

@keyframes cableDrop {
  0% { opacity: 0; height: 0; }
  100% { opacity: 1; height: clamp(30px, 8vh, 60px); }
}

@keyframes cableSwing {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(5deg); }
  75% { transform: rotate(-5deg); }
}

/* Construction particles */
.city-particles {
  position: absolute;
  bottom: 40%;
  left: 50%;
  width: 200px;
  height: 100px;
  transform: translateX(-50%);
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #f7931e;
  border-radius: 50%;
  animation: particleFly 2s ease-out infinite;
}

.particle:nth-child(1) { left: 20%; animation-delay: 0s; }
.particle:nth-child(2) { left: 35%; animation-delay: 0.3s; }
.particle:nth-child(3) { left: 50%; animation-delay: 0.6s; }
.particle:nth-child(4) { left: 65%; animation-delay: 0.9s; }
.particle:nth-child(5) { left: 80%; animation-delay: 1.2s; }

@keyframes particleFly {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-80px) scale(0); opacity: 0; }
}

/* Loading text */
.city-loading-text {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  color: #fff;
  z-index: 20;
}

.city-loading-text h2 {
  font-size: clamp(18px, 4vw, 28px);
  font-weight: 600;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #4b5cf6, #7c8aff, #4b5cf6);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s linear infinite;
}

.city-loading-text p {
  font-size: clamp(12px, 2.5vw, 16px);
  color: rgba(255, 255, 255, 0.7);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

/* Progress bar */
.city-progress {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(200px, 50vw, 400px);
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}

.city-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4b5cf6, #7c8aff);
  border-radius: 2px;
  animation: progressIndeterminate 2s ease-in-out infinite;
  width: 30%;
}

@keyframes progressIndeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .city-buildings {
    gap: 2px;
    padding: 0 1%;
  }
  
  .city-crane {
    right: 5%;
  }
  
  .city-building:nth-child(9),
  .city-building:nth-child(10) {
    display: none;
  }
}

@media (max-height: 500px) {
  .city-container {
    height: 50%;
    min-height: 200px;
  }
  
  .city-loading-text {
    bottom: 15%;
  }
  
  .city-progress {
    bottom: 8%;
  }
}
