:root {
  --bg0: #050b12;
  --bg1: #0a1624;
  --glass: rgba(12, 22, 36, 0.55);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text: #f4f7fb;
  --muted: rgba(226, 236, 248, 0.62);
  --soft: rgba(226, 236, 248, 0.42);
  --accent: #7dd3fc;
  --accent-2: #fbbf24;
  --good: #34d399;
  --warn: #f59e0b;
  --cold: #60a5fa;
  --hot: #fb7185;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 28px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg0);
  overflow-x: hidden;
  min-height: 100%;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.sky-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 15% -10%, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(900px 600px at 90% 10%, rgba(251, 191, 36, 0.14), transparent 55%),
    radial-gradient(800px 500px at 50% 100%, rgba(99, 102, 241, 0.18), transparent 60%),
    linear-gradient(180deg, #071018 0%, #0b1828 45%, #08111b 100%);
  transition: filter 1s ease;
}

.aurora {
  position: absolute;
  inset: -20% -10% auto;
  height: 55%;
  background:
    radial-gradient(ellipse at 30% 60%, rgba(52, 211, 153, 0.12), transparent 50%),
    radial-gradient(ellipse at 70% 40%, rgba(96, 165, 250, 0.16), transparent 55%),
    radial-gradient(ellipse at 50% 80%, rgba(167, 139, 250, 0.12), transparent 50%);
  filter: blur(30px);
  animation: drift 18s ease-in-out infinite alternate;
}

.stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.2px 1.2px at 10% 20%, rgba(255,255,255,.8), transparent),
    radial-gradient(1px 1px at 30% 70%, rgba(255,255,255,.55), transparent),
    radial-gradient(1.4px 1.4px at 70% 30%, rgba(255,255,255,.7), transparent),
    radial-gradient(1px 1px at 85% 60%, rgba(255,255,255,.5), transparent),
    radial-gradient(1.2px 1.2px at 50% 15%, rgba(255,255,255,.65), transparent),
    radial-gradient(1px 1px at 20% 40%, rgba(255,255,255,.4), transparent),
    radial-gradient(1.3px 1.3px at 60% 80%, rgba(255,255,255,.55), transparent),
    radial-gradient(1px 1px at 92% 18%, rgba(255,255,255,.45), transparent);
  opacity: 0.55;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.45;
  animation: float 14s ease-in-out infinite;
}
.orb-a {
  width: 280px; height: 280px; left: -60px; top: 18%;
  background: radial-gradient(circle, rgba(56,189,248,.45), transparent 70%);
}
.orb-b {
  width: 340px; height: 340px; right: -80px; top: 8%;
  background: radial-gradient(circle, rgba(251,191,36,.28), transparent 70%);
  animation-delay: -4s;
}
.orb-c {
  width: 260px; height: 260px; left: 35%; bottom: -40px;
  background: radial-gradient(circle, rgba(129,140,248,.3), transparent 70%);
  animation-delay: -7s;
}

.fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.55;
}

@keyframes drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.05); }
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(20px, -24px, 0); }
}

.app {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  border: 1px solid var(--glass-border);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.brand-mark svg { width: 34px; height: 34px; }
.brand-title {
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
}
.brand-sub {
  color: var(--muted);
  font-size: 0.86rem;
}

.top-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.12);
  border: 1px solid rgba(125, 211, 252, 0.22);
  color: #dbeafe;
  font-size: 0.84rem;
  font-weight: 600;
  backdrop-filter: blur(12px);
}
.chip-soft {
  background: rgba(255,255,255,0.06);
  border-color: var(--glass-border);
  color: var(--muted);
  font-family: var(--mono);
  font-weight: 500;
}

.grid {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
}

.hero {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  padding: 28px;
  position: relative;
  overflow: hidden;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: auto -20% -40% 20%;
  height: 70%;
  background: radial-gradient(circle, rgba(125,211,252,.16), transparent 65%);
  pointer-events: none;
}

.loc {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.pin {
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(125,211,252,.15), 0 0 24px rgba(125,211,252,.55);
}
.loc h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  letter-spacing: -0.04em;
  font-weight: 800;
}
.loc p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.now {
  display: flex;
  align-items: flex-end;
  gap: 22px;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}
.temp-wrap {
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.temp {
  font-size: clamp(5.2rem, 10vw, 7.5rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.9;
  background: linear-gradient(180deg, #fff 20%, #b6d4f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 10px 40px rgba(125,211,252,.15);
}
.temp-unit {
  margin-top: 14px;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--muted);
}
.now-side { padding-bottom: 12px; }
.condition {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.feels, .hi-lo {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.98rem;
}

.icon-stage {
  position: absolute;
  right: -10px;
  top: 40px;
  width: min(280px, 42%);
  height: 220px;
  opacity: 0.95;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.35));
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  position: relative;
  z-index: 1;
}
.stat {
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.stat-label {
  color: var(--soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat-value {
  margin-top: 8px;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.stat-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.panel {
  padding: 22px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.panel-tag {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: var(--mono);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
}

.sunmoon { min-height: 320px; }
.sun-arc-wrap { margin-top: 4px; }
.sun-arc {
  width: 100%;
  height: auto;
  display: block;
}
.arc-track {
  fill: none;
  stroke: rgba(255,255,255,0.1);
  stroke-width: 3;
  stroke-linecap: round;
}
.arc-progress {
  fill: none;
  stroke: url(#arcGrad);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 420;
  stroke-dashoffset: 420;
  transition: stroke-dashoffset 1.2s ease;
}
.sun-dot {
  fill: #fbbf24;
  filter: drop-shadow(0 0 10px rgba(251,191,36,.8));
  transition: cx 1.2s ease, cy 1.2s ease;
}
.horizon {
  stroke: rgba(255,255,255,0.12);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}
.sun-times {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: -6px;
}
.t-label {
  color: var(--soft);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.t-value {
  margin-top: 4px;
  font-size: 1.2rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.align-right { text-align: right; }
.solar-noon { text-align: center; }

.moon-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.moon-sphere {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e8eef8, #9fb0c8 45%, #4b5d78);
  position: relative;
  overflow: hidden;
  box-shadow:
    inset -8px -6px 16px rgba(0,0,0,.35),
    0 0 30px rgba(186, 210, 255, 0.25);
}
.moon-shade {
  position: absolute;
  inset: 0;
  background: #0a1220;
  transform-origin: center;
}
.moon-phase {
  font-size: 1.1rem;
  font-weight: 750;
}
.moon-meta, .moon-next {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.hourly { grid-column: 1 / -1; }
.hourly-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(86px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.hour-card {
  scroll-snap-align: start;
  padding: 14px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.07);
  text-align: center;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  transition: transform .2s ease, border-color .2s ease;
}
.hour-card:hover {
  transform: translateY(-3px);
  border-color: rgba(125,211,252,0.35);
}
.hour-card.now {
  border-color: rgba(125,211,252,0.45);
  background: linear-gradient(180deg, rgba(125,211,252,0.16), rgba(255,255,255,0.03));
}
.hour-time {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.hour-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
}
.hour-temp {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.hour-pop {
  font-size: 0.72rem;
  color: var(--accent);
  font-family: var(--mono);
}

.week {
  grid-column: 1 / 2;
}
.week-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.day-row {
  display: grid;
  grid-template-columns: 92px 42px 1fr 72px 72px;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.05);
}
.day-row.today {
  border-color: rgba(125,211,252,0.28);
  background: rgba(125,211,252,0.08);
}
.day-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.day-icon { font-size: 1.3rem; text-align: center; }
.day-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  position: relative;
  overflow: hidden;
}
.day-bar {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #fbbf24 55%, #fb7185);
}
.day-min, .day-max {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}
.day-min { color: var(--muted); }

.comfort, .details { }
.meters { display: flex; flex-direction: column; gap: 14px; }
.meter-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
.meter-top strong {
  color: var(--text);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 1s ease;
}
.bar-warm i {
  background: linear-gradient(90deg, #60a5fa, #fbbf24, #fb7185);
}
.tips {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.18);
  color: #d1fae5;
  font-size: 0.92rem;
  line-height: 1.45;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.detail span {
  color: var(--soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.detail strong {
  font-size: 1.05rem;
  font-weight: 750;
}

.footer {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--soft);
  font-size: 0.84rem;
}
.footer .dot { opacity: 0.5; }

.loader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(5, 11, 18, 0.72);
  backdrop-filter: blur(10px);
  transition: opacity .45s ease, visibility .45s ease;
}
.loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-weight: 600;
}
.loader-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .hero {
    grid-column: auto;
    grid-row: auto;
    min-height: auto;
  }
  .hourly, .week { grid-column: auto; }
  .icon-stage {
    position: relative;
    right: auto;
    top: auto;
    width: 160px;
    height: 120px;
    margin: -10px 0 10px auto;
  }
}

@media (max-width: 640px) {
  .app { width: min(100% - 20px, 1240px); padding-top: 18px; }
  .hero { padding: 20px; border-radius: 22px; }
  .panel { padding: 18px; border-radius: 22px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .day-row {
    grid-template-columns: 72px 34px 1fr 52px 52px;
    gap: 6px;
    padding: 10px;
  }
  .temp { font-size: 4.6rem; }
  .topbar { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .aurora, .orb, .loader-ring { animation: none; }
  * { transition: none !important; }
}
