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

:root {
  --sky: #0a1628;
  --sky-mid: #0d2145;
  --horizon: #1a3a6b;
  --accent: #4fc3f7;
  --accent-warm: #ffb347;
  --white: #e8f4ff;
  --muted: rgba(232,244,255,0.45);
  --glass: rgba(255,255,255,0.06);
  --glass-border: rgba(255,255,255,0.12);
  --rain: #7ab8d4;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--sky);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated sky background */
.sky-bg {
  position: fixed; inset: 0; z-index: 0;
  background: linear-gradient(175deg, #020b18 0%, #0a1628 30%, #0d2145 60%, #1a3a6b 100%);
  overflow: hidden;
}

.stars {
  position: absolute; inset: 0;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: white;
  animation: twinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: var(--min-op, 0.2); transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

.aurora {
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 120%;
  height: 60%;
  background: radial-gradient(ellipse at 40% 80%, rgba(79,195,247,0.08) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 90%, rgba(100,181,246,0.06) 0%, transparent 50%);
  filter: blur(40px);
  animation: aurora-drift 8s ease-in-out infinite;
}
@keyframes aurora-drift {
  0%, 100% { transform: translateX(0) scaleY(1); }
  50% { transform: translateX(3%) scaleY(1.05); }
}

/* Layout */
.app {
  position: relative; z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 0 40px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 32px 24px 0;
}
.logo {
  font-family: 'Bebas Neue', cursive;
  font-size: 22px;
  letter-spacing: 4px;
  color: var(--accent);
  opacity: 0.85;
}
.date-tag {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
}

/* Search */
.search-wrap {
  padding: 20px 24px 0;
  position: relative;
}
.search-wrap input {
  width: 100%;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 50px 14px 18px;
  color: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 300;
  outline: none;
  transition: border-color 0.3s, background 0.3s;
  backdrop-filter: blur(10px);
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.09);
}
.search-btn {
  position: absolute;
  right: 34px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 6px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.search-btn:hover { opacity: 1; }

/* Main weather card */
.main-card {
  margin: 24px 24px 0;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 32px 28px 28px;
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  animation: card-in 0.6s cubic-bezier(0.16,1,0.3,1) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.main-card::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,195,247,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.location-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.location-icon { font-size: 13px; opacity: 0.7; }
.location-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.temp-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin: 8px 0 4px;
}
.temp-big {
  font-family: 'Bebas Neue', cursive;
  font-size: 96px;
  line-height: 1;
  color: var(--white);
  letter-spacing: -2px;
}
.temp-unit {
  font-family: 'Bebas Neue', cursive;
  font-size: 32px;
  color: var(--accent);
  margin-top: 14px;
  margin-left: 2px;
}

.condition-text {
  font-size: 17px;
  font-weight: 300;
  font-style: italic;
  color: var(--accent);
  margin-bottom: 24px;
  letter-spacing: 0.3px;
}

.weather-icon-wrap {
  position: absolute;
  top: 28px; right: 28px;
  font-size: 64px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(79,195,247,0.4));
  animation: icon-float 4s ease-in-out infinite;
}
@keyframes icon-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-8px) rotate(2deg); }
}

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  border-top: 1px solid var(--glass-border);
  padding-top: 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-label {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.stat-value {
  font-size: 17px;
  font-weight: 500;
  color: var(--white);
}
.stat-icon { font-size: 14px; margin-bottom: 2px; }

/* UV & AQI bar */
.extra-row {
  margin: 16px 24px 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  animation: card-in 0.6s 0.15s cubic-bezier(0.16,1,0.3,1) both;
}
.extra-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
  backdrop-filter: blur(10px);
}
.extra-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.bar-track {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 4px;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s cubic-bezier(0.16,1,0.3,1);
}
.bar-val {
  font-family: 'Bebas Neue', cursive;
  font-size: 28px;
  letter-spacing: 1px;
}
.bar-label { font-size: 11px; color: var(--muted); }

/* Hourly forecast */
.section-title {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 20px 24px 10px;
}
.hourly-scroll {
  display: flex;
  gap: 10px;
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
  animation: card-in 0.6s 0.25s cubic-bezier(0.16,1,0.3,1) both;
}
.hourly-scroll::-webkit-scrollbar { display: none; }
.hour-card {
  flex: 0 0 72px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 14px 8px;
  text-align: center;
  backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s;
  cursor: default;
}
.hour-card.now {
  background: rgba(79,195,247,0.15);
  border-color: rgba(79,195,247,0.4);
}
.hour-time { font-family: 'DM Mono', monospace; font-size: 10px; color: var(--muted); }
.hour-icon { font-size: 22px; margin: 8px 0 6px; }
.hour-temp { font-size: 15px; font-weight: 500; }

/* Daily forecast */
.daily-list {
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: card-in 0.6s 0.35s cubic-bezier(0.16,1,0.3,1) both;
}
.day-row {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  backdrop-filter: blur(10px);
}
.day-name { font-size: 14px; font-weight: 500; width: 44px; }
.day-icon { font-size: 20px; }
.day-desc { font-size: 12px; color: var(--muted); flex: 1; }
.day-temps {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  display: flex;
  gap: 8px;
}
.day-high { color: var(--white); font-weight: 500; }
.day-low { color: var(--muted); }

/* Loading state */
.loading {
  text-align: center;
  padding: 60px 24px;
  font-size: 14px;
  color: var(--muted);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* Error state */
.error-msg {
  text-align: center;
  padding: 20px 24px;
  font-size: 13px;
  color: rgba(255,160,130,0.8);
  background: rgba(255,100,80,0.08);
  border: 1px solid rgba(255,100,80,0.2);
  border-radius: 14px;
  margin: 16px 24px;
}

/* Temp toggle */
.toggle-wrap {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  margin-top: 16px;
  justify-content: flex-end;
}
.toggle-btn {
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--muted);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.toggle-btn.active {
  background: rgba(79,195,247,0.2);
  border-color: var(--accent);
  color: var(--accent);
}