:root {
  --bg-deep: #070d19;
  --bg-mid: #0c1729;
  --card-bg: rgba(16, 28, 49, 0.72);
  --card-bg-hover: rgba(22, 38, 66, 0.84);
  --card-border: rgba(148, 184, 255, 0.14);
  --card-border-strong: rgba(148, 184, 255, 0.28);
  --text-primary: #f1f6ff;
  --text-secondary: #9bb0d1;
  --text-muted: #6980a5;
  --accent-sky: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-amber: #fbbf24;
  --accent-emerald: #34d399;
  --accent-rose: #fb7185;
  --shadow-lg: 0 20px 45px -15px rgba(0, 0, 0, 0.55);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 80% 50% at 15% -10%, rgba(56, 189, 248, 0.18), transparent),
    radial-gradient(ellipse 70% 50% at 88% 5%, rgba(99, 102, 241, 0.16), transparent),
    radial-gradient(ellipse 90% 60% at 50% 105%, rgba(16, 185, 129, 0.08), transparent),
    linear-gradient(180deg, #070d19 0%, #0b1526 55%, #070d19 100%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1340px;
  margin: 0 auto;
  padding: 24px 20px 56px;
}

/* Topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 22px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.24), rgba(129, 140, 248, 0.24));
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: grid;
  place-items: center;
  color: var(--accent-sky);
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(52, 211, 153, 0.14);
  color: var(--accent-emerald);
  border: 1px solid rgba(52, 211, 153, 0.32);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.brand-sub {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.clock-box {
  padding: 7px 13px;
  border-radius: var(--radius-md);
  background: rgba(8, 15, 29, 0.6);
  border: 1px solid var(--card-border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.clock-box strong {
  color: var(--text-primary);
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--card-border-strong);
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s ease;
}

.btn:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--accent-sky);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--card-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: var(--card-border-strong);
}

.spin svg {
  animation: rotate360 0.8s linear infinite;
}

@keyframes rotate360 {
  to { transform: rotate(360deg); }
}

/* Grid System */
.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 22px;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Hero Card */
.hero-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.temp-display {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hero-icon {
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 20px rgba(56, 189, 248, 0.25));
}

.temp-value {
  font-size: 4.4rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(180deg, #ffffff 15%, #bae6fd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.temp-unit {
  font-size: 2rem;
  font-weight: 600;
}

.condition-label {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 4px;
}

.feels-like {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.today-extremes {
  text-align: right;
  background: rgba(7, 13, 25, 0.48);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
}

.today-extremes .hl-row {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.hl-max { color: var(--accent-amber); }
.hl-min { color: var(--accent-sky); }

.sun-times {
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Metrics 4-grid inside Hero */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.metric-tile {
  background: rgba(8, 15, 29, 0.52);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  transition: border-color 0.2s ease;
}

.metric-tile:hover {
  border-color: var(--card-border-strong);
}

.metric-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.metric-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.wind-arrow {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  color: var(--accent-sky);
  transition: transform 0.5s ease;
}

/* Air Quality Card */
.aqi-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(8, 15, 29, 0.55);
  border: 1px solid var(--card-border);
  margin-bottom: 14px;
}

.aqi-score-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aqi-circle {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 800;
  flex-shrink: 0;
}

.aqi-good { background: rgba(52, 211, 153, 0.18); color: #34d399; border: 1px solid rgba(52, 211, 153, 0.4); }
.aqi-fair { background: rgba(163, 230, 53, 0.18); color: #a3e635; border: 1px solid rgba(163, 230, 53, 0.4); }
.aqi-moderate { background: rgba(251, 191, 36, 0.18); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.4); }
.aqi-poor { background: rgba(251, 146, 60, 0.18); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.4); }
.aqi-very_poor, .aqi-hazardous { background: rgba(251, 113, 133, 0.2); color: #fb7185; border: 1px solid rgba(251, 113, 133, 0.45); }
.aqi-unknown { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }

.aqi-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.aqi-advice {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.pollutants-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.pollutant-item {
  background: rgba(8, 15, 29, 0.46);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.pollutant-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.pollutant-name {
  color: var(--text-secondary);
  font-weight: 600;
}

.pollutant-val {
  color: var(--text-primary);
  font-weight: 700;
}

.progress-track {
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

/* Beskydy Microclimate Strip */
.section-gap {
  margin-bottom: 20px;
}

.inversion-badge {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
}

.inv-active {
  background: rgba(251, 191, 36, 0.16);
  color: var(--accent-amber);
  border: 1px solid rgba(251, 191, 36, 0.38);
}

.inv-normal {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-sky);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.beskydy-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.station-card {
  background: rgba(8, 15, 29, 0.52);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.station-card:hover {
  transform: translateY(-2px);
  border-color: var(--card-border-strong);
}

.station-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.station-name {
  font-weight: 700;
  font-size: 0.96rem;
}

.station-elev {
  font-size: 0.75rem;
  color: var(--accent-sky);
  background: rgba(56, 189, 248, 0.11);
  padding: 2px 7px;
  border-radius: 999px;
}

.station-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.station-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.station-temp {
  font-size: 1.7rem;
  font-weight: 800;
}

.station-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 8px;
}

/* Charts Section */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tab-btn {
  padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(8, 15, 29, 0.55);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  border-color: var(--card-border-strong);
}

.tab-btn.active {
  background: rgba(56, 189, 248, 0.2);
  color: #ffffff;
  border-color: var(--accent-sky);
}

.range-selector {
  display: none;
  gap: 6px;
  margin-left: auto;
}

.range-selector.visible {
  display: flex;
}

.range-btn {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.range-btn.active {
  background: rgba(129, 140, 248, 0.22);
  color: #fff;
  border-color: var(--accent-indigo);
}

.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
  margin-top: 10px;
}

/* Hourly Quick Scroller */
.hourly-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 2px 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 184, 255, 0.25) transparent;
}

.hour-pill {
  min-width: 78px;
  background: rgba(8, 15, 29, 0.48);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  flex-shrink: 0;
}

.hour-time {
  font-size: 0.76rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hour-icon {
  width: 30px;
  height: 30px;
  margin: 0 auto 6px;
}

.hour-temp {
  font-size: 0.98rem;
  font-weight: 700;
}

.hour-pop {
  font-size: 0.72rem;
  color: var(--accent-sky);
  margin-top: 3px;
  min-height: 16px;
}

/* Bottom Split: 7-day Forecast + Radar */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 20px;
  margin-bottom: 20px;
}

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.daily-row {
  display: grid;
  grid-template-columns: 110px 38px 54px 1fr 82px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(8, 15, 29, 0.46);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}

.daily-day {
  font-weight: 600;
  font-size: 0.9rem;
}

.daily-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: block;
}

.daily-pop {
  font-size: 0.78rem;
  color: var(--accent-sky);
  font-weight: 600;
  text-align: center;
}

.temp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-min {
  font-size: 0.84rem;
  color: var(--text-secondary);
  width: 36px;
  text-align: right;
}

.t-max {
  font-size: 0.86rem;
  font-weight: 700;
  width: 36px;
}

.t-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.t-range {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8, #fbbf24, #fb7185);
}

.daily-wind {
  font-size: 0.76rem;
  color: var(--text-secondary);
  text-align: right;
}

/* Radar Frame */
.radar-frame-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  height: 430px;
  background: #08101e;
}

.radar-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Server Tracking Stats Footer */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.stat-box {
  background: rgba(8, 15, 29, 0.5);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.stat-box .s-lbl {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-box .s-val {
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 3px;
}

.footer-note {
  margin-top: 22px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-note a {
  color: var(--accent-sky);
  text-decoration: none;
}

/* Responsive */
@media (max-width: 1100px) {
  .hero-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }
  .beskydy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 680px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .beskydy-grid,
  .pollutants-grid,
  .stats-strip {
    grid-template-columns: 1fr;
  }
  .temp-value {
    font-size: 3.3rem;
  }
  .daily-row {
    grid-template-columns: 92px 32px 1fr;
  }
  .daily-pop,
  .daily-wind {
    display: none;
  }
}
