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

:root {
  --white: #ffffff;
  --glass: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.2);
}

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: #000;
  color: var(--white);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.hero {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
  transition: background 0.8s ease;
  display: flex;
  flex-direction: column;
}

/* Richer, deeper gradients matching the premium night mode aesthetic */
.hero[data-code="0"], .hero[data-code="1"]  { background: linear-gradient(180deg, #0f2027 0%, #203a43 50%, #2c5364 100%); }
.hero[data-code="2"]  { background: linear-gradient(180deg, #141e30 0%, #243b55 100%); }
.hero[data-code="3"]  { background: linear-gradient(180deg, #232526 0%, #414345 100%); }
.hero[data-code="45"], .hero[data-code="48"] { background: linear-gradient(180deg, #2c3e50 0%, #3498db 100%); }
.hero[data-code="rain"]  { background: linear-gradient(180deg, #0f2027 0%, #203a43 100%); }
.hero[data-code="storm"] { background: linear-gradient(180deg, #000000 0%, #434343 100%); }

/* If daytime and clear, we can make it a rich deep blue anyway to fit the "image perfectly" as requested */
.hero[data-code="2"][data-time="day"] { background: linear-gradient(180deg, #1a365d 0%, #0f172a 100%); }


/* ── Typography & Top Level ── */
.header-info {
  margin-top: 8vh;
  text-align: center;
  z-index: 10;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.city-name {
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.city-subtitle {
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  margin-top: 0.2rem;
}

/* ── Split Info Row ── */
.weather-split {
  display: flex;
  justify-content: space-between;
  padding: 0 1.5rem;
  margin-top: 2.5rem;
  z-index: 10;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.split-left {
  text-align: left;
}

.temp-big {
  font-size: 5.5rem;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
}

.temp-sub {
  font-size: 1rem;
  color: rgba(255,255,255,0.85);
  margin-top: 0.5rem;
  font-weight: 500;
}

.humidity-stat {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.65);
  margin-top: 0.25rem;
  font-weight: 500;
}

.updated-at {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
  margin-top: 0.25rem;
  font-style: italic;
}

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

.loading-pulse {
  animation: pulse-opacity 1.2s ease-in-out infinite;
}

.error-banner {
  position: absolute;
  top: 4.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  white-space: nowrap;
}

.split-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 0.5rem;
}

.cond-text {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.1rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.cond-text span#scene-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}

.wind-desc {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

.wind-speed {
  font-size: 1.1rem;
  font-weight: 600;
}

.wind-arrow {
  display: inline-block;
  margin-left: 2px;
  transform: rotate(0deg);
  transition: transform 0.3s;
}

/* ── Scene Element ── */
.scene-image {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90vw;
  max-width: 600px;
  transform: translate(-50%, -50%);
  object-fit: contain;
  transition: opacity 0.6s ease;
  z-index: 1;
  pointer-events: none;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
}

.brand-watermark {
  position: absolute;
  right: 1.5rem;
  bottom: 85px; 
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  z-index: 10;
}

/* ── Forecast Container ── */
.forecast-container {
  position: absolute;
  bottom: 125px; 
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 500px;
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border-top: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 0.8rem 1.25rem;
  z-index: 15;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  overflow: hidden;
  max-height: 44px;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease, padding 0.3s ease;
  cursor: default;
}

.forecast-container:hover,
.forecast-container.expanded {
  max-height: 350px;
  padding: 1.25rem;
  background: rgba(30, 41, 59, 0.6);
}

.forecast-header {
  cursor: pointer;
  user-select: none;
}

.forecast-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  padding-bottom: 0.5rem;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.forecast-list::-webkit-scrollbar {
  width: 4px;
}
.forecast-list::-webkit-scrollbar-track {
  background: transparent;
}
.forecast-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
}

.forecast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 500;
}

.f-day { width: 90px; font-weight: 600; }
.f-icon { width: 35px; text-align: center; font-size: 1.2rem; }
.f-temp-bar {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-left: 0.5rem;
}
.f-min { color: rgba(255,255,255,0.6); width: 35px; text-align: right; font-size: 0.95rem; }
.f-bar {
  flex-grow: 1;
  height: 4px;
  background: rgba(0,0,0,0.3);
  border-radius: 2px;
  margin: 0 0.75rem;
  position: relative;
  overflow: hidden;
}
.f-bar-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #fde68a, #fb7185);
  border-radius: 2px;
}
.f-max { color: #fff; width: 35px; text-align: left; font-size: 0.95rem; font-weight: 600;}


/* ── City Nav (Now styled like the bottom navigation) ── */
.city-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(30px) saturate(200%);
  -webkit-backdrop-filter: blur(30px) saturate(200%);
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.city-nav::-webkit-scrollbar { display: none; }

.city-btn {
  flex: none;
  padding: 0.5rem 0.5rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

/* Add an icon via before pseudo for the tabs */
.city-btn::before {
  content: '📍';
  font-size: 1.2rem;
  opacity: 0.6;
  transition: all 0.2s;
}
.city-btn[data-city="dededo"]::before { content: '🏢'; }
.city-btn[data-city="merizo"]::before { content: '🚤'; }
.city-btn[data-city="hagatna"]::before { content: '⛪'; }
.city-btn[data-city="asan"]::before { content: '🌴'; }
.city-btn[data-city="barrigada"]::before { content: '📡'; }
.city-btn[data-city="yigo"]::before { content: '🌲'; }
.city-btn[data-city="mangilao"]::before { content: '🎓'; }

.city-btn:hover {
  color: rgba(255, 255, 255, 0.8);
}
.city-btn:hover::before {
  opacity: 0.8;
}

.city-btn.active {
  color: var(--white);
  font-weight: 600;
}
.city-btn.active::before {
  opacity: 1;
}

/* ── Responsive Fixes ── */
@media (max-width: 400px) {
  .temp-big { font-size: 4.5rem; }
  .city-name { font-size: 1.8rem; }
  .scene-image { width: 100vw; transform: translate(-50%, -50%); }
  .forecast-container { bottom: 110px; }
  .forecast-list { max-height: 160px; }
}

@media (max-height: 700px) {
  .scene-image { width: 50vh; transform: translate(-50%, -50%); max-width: 400px; }
  .forecast-container { bottom: 100px; }
  .forecast-list { max-height: 140px; }
  .weather-split { margin-top: 1rem; }
  .header-info { margin-top: 5vh; }
  .temp-big { font-size: 4rem; }
  .brand-watermark { bottom: 70px; }
}
