*,
*::before,
*::after {
  box-sizing: border-box;
}

@keyframes windSwing {
  0% {
    transform: rotate(calc(var(--wind-angle, 0deg) - 5deg));
  }
  50% {
    transform: rotate(calc(var(--wind-angle, 0deg) + 5deg));
  }
  100% {
    transform: rotate(calc(var(--wind-angle, 0deg) - 5deg));
  }
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Poppins', Arial, sans-serif;
  background: radial-gradient(ellipse at top left, #e3e7ea 0%, #aeb4b9 100%);
  color: #222;
}

.container {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  grid-template-rows: 1fr 1fr;
  gap: 20px 20px;
  padding: 20px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.card {
  background: #e3e3e3;
  border-radius: 24px;
  box-shadow: 6px 8px 12px rgba(0, 0, 0, 0.18);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.card-large {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 24px 32px;
}

.city-time {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.city-time h1 {
  font-size: 3rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
}

.city-time .time {
  font-size: 6.8rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.city-time .date {
  font-size: 1.8rem;
  font-weight: 400;
  color: #333;
}

.weather-left {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 14px;
  min-width: 200px;
}

.weather-temp {
  font-size: 6rem;
  font-weight: 700;
  color: #222;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.weather-temp .unit {
  color: #222;
  font-weight: 600;
  font-size: 4rem;
}

.weather-feels {
  font-size: 1.6rem;
  color: #555;
  font-weight: 700;
}

.weather-sun {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.weather-sun-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 600;
}

.weather-sun-row img {
  width: 40px;
  height: 40px;
}

.weather-sun-row .time-value {
  font-weight: 500;
  color: #333;
  margin-left: auto;
}

.weather-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 24px;
}

.weather-icon img {
  width: 180px;
  height: 180px;
  object-fit: contain;
}

.weather-desc {
  font-size: 1.3rem;
  font-weight: 600;
}

.weather-precipitation {
  font-size: 1.1rem;
  color: #0066cc;
  font-weight: 600;
  margin-top: 4px;
}

.weather-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

.weather-info-row {
  display: grid;
  grid-template-columns: 40px auto;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
}

.weather-info-row .icon {
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.weather-info-row .icon img {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.weather-info-row .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #222;
}

.weather-info-row .label {
  font-size: 0.9rem;
  color: #555;
}

.weather-info-row #wind-direction-icon {
  animation: windSwing 3s ease-in-out infinite;
  transform-origin: center;
}

.forecast-card,
.hourly-card {
  justify-content: flex-start;
  gap: 16px;
  overflow: hidden;
}

.forecast-title,
.hourly-title {
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.forecast-item {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 16px;
  padding: 1px 12px;
  display: grid;
  grid-template-columns: 64px 120px 1fr 100px 90px;
  align-items: center;
  gap: 12px;
}

.forecast-item img {
  width: 64px;
  height: 64px;
}

.forecast-item .date {
  font-size: 1.4rem;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
}

.forecast-item .temp {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.forecast-item .precipitation {
  font-size: 1rem;
  color: #0066cc;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  flex: 1;
  align-content: stretch;
}

.hourly-item {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 20px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 5px;
  min-height: 0;
}

.hourly-item .hour {
  font-size: 1.6rem;
  font-weight: 700;
}

.hourly-item img {
  width: 64px;
  height: 64px;
}

.hourly-item .temp {
  font-size: 1.8rem;
  font-weight: 700;
}

.hourly-item .precipitation {
  font-size: 1rem;
  color: #0066cc;
  font-weight: 600;
}

.hourly-item .wind {
  font-size: 1.1rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hourly-item .wind img,
.wind-arrow {
  width: 32px;
  height: 32px;
  animation: windSwing 3s ease-in-out infinite;
  transform-origin: center;
}

.error-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 14px 24px;
  border-radius: 14px;
  background: #ff6b6b;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 1200px) {
  .container {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(4, auto);
    height: auto;
    padding: 24px;
  }

  .card-large {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }

  .weather-left,
  .weather-right {
    align-items: center;
  }

  .weather-info-row {
    grid-template-columns: auto;
    grid-template-rows: auto;
    text-align: center;
  }

  .forecast-list,
  .hourly-list {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}
