:root {
  --bg-top: #bde9ff;
  --bg-mid: #f8fbff;
  --bg-bottom: #ffe8cc;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.75);
  --text-main: #1a3553;
  --text-soft: #3a5b78;
  --accent: #ff8a3d;
  --accent-soft: #ffd7b8;
  --shadow: 0 24px 60px rgba(37, 76, 112, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Segoe UI Variable", "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text-main);
}

body {
  background: radial-gradient(circle at 8% 20%, #ffffff 0%, transparent 35%),
    radial-gradient(circle at 85% 12%, #fff4cf 0%, transparent 32%),
    linear-gradient(160deg, var(--bg-top) 0%, var(--bg-mid) 52%, var(--bg-bottom) 100%);
  padding: 28px 16px;
  overflow-x: hidden;
}

.sky-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.sky-layer-back::before,
.sky-layer-front::before,
.sky-layer-front::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.44);
  filter: blur(1px);
  animation: drift 26s linear infinite;
}

.sky-layer-back::before {
  width: 210px;
  height: 74px;
  top: 10%;
  left: -24%;
}

.sky-layer-front::before {
  width: 160px;
  height: 58px;
  top: 33%;
  left: -30%;
  animation-duration: 18s;
}

.sky-layer-front::after {
  width: 260px;
  height: 84px;
  top: 60%;
  left: -34%;
  animation-duration: 30s;
}

.app {
  width: min(1080px, 100%);
  margin: 0 auto;
  backdrop-filter: blur(5px);
  position: relative;
  z-index: 2;
}

.weather-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.weather-fx__sun,
.weather-fx__fog,
.weather-fx__rain,
.weather-fx__snow,
.weather-fx__flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 500ms ease;
}

.weather-fx__sun::before,
.weather-fx__sun::after {
  content: "";
  position: absolute;
}

.weather-fx__sun::before {
  width: 280px;
  height: 280px;
  top: 5%;
  right: 7%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 232, 144, 0.9) 0%, rgba(255, 232, 144, 0) 70%);
  filter: blur(1px);
  animation: sunPulse 6s ease-in-out infinite;
}

.weather-fx__sun::after {
  width: 460px;
  height: 460px;
  top: -3%;
  right: -2%;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 214, 96, 0.25) 0deg,
    rgba(255, 214, 96, 0.05) 15deg,
    rgba(255, 214, 96, 0) 30deg
  );
  animation: sunRays 20s linear infinite;
}

.weather-fx__fog {
  background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12) 0%,
      rgba(255, 255, 255, 0.26) 35%,
      rgba(255, 255, 255, 0.14) 70%,
      rgba(255, 255, 255, 0.05) 100%
    ),
    linear-gradient(
      90deg,
      rgba(220, 232, 242, 0.14) 0%,
      rgba(220, 232, 242, 0.32) 45%,
      rgba(220, 232, 242, 0.08) 100%
    );
  filter: blur(2px);
  animation: fogDrift 26s linear infinite;
}

.weather-fx__rain {
  background-image:
    repeating-linear-gradient(
      -74deg,
      rgba(196, 223, 241, 0.35) 0 2px,
      rgba(196, 223, 241, 0) 2px 14px
    ),
    repeating-linear-gradient(
      -78deg,
      rgba(162, 201, 226, 0.28) 0 1px,
      rgba(162, 201, 226, 0) 1px 11px
    );
  background-size: 220px 220px, 180px 180px;
  animation: rainMove 600ms linear infinite;
}

.weather-fx__snow {
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.92) 0 2px, transparent 3px),
    radial-gradient(circle at 25% 65%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 45% 40%, rgba(245, 250, 255, 0.95) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 15%, rgba(255, 255, 255, 0.85) 0 1.8px, transparent 3px),
    radial-gradient(circle at 82% 50%, rgba(255, 255, 255, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 93% 78%, rgba(245, 250, 255, 0.8) 0 2px, transparent 3px);
  background-size: 340px 340px;
  animation: snowMove 10s linear infinite;
}

.weather-fx__flash {
  background: rgba(240, 247, 255, 0.75);
  mix-blend-mode: screen;
  animation: lightning 8s steps(1, end) infinite;
}

.app-header {
  margin-bottom: 18px;
  animation: rise 0.9s ease;
}

.badge {
  display: inline-block;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.88);
  color: var(--text-soft);
  font-weight: 700;
  letter-spacing: 0.2px;
}

h1 {
  margin: 12px 0 6px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0;
  color: var(--text-soft);
  max-width: 65ch;
  font-size: clamp(1rem, 2vw, 1.15rem);
}

.status-card,
.search-card,
.current-weather,
.hourly,
.daily,
.app-footer {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  margin-top: 18px;
}

.status-card {
  padding: 16px 18px;
  font-weight: 650;
  color: var(--text-soft);
}

.search-card {
  padding: 14px 16px;
}

.city-search {
  display: grid;
  gap: 8px;
}

.city-search__label {
  font-weight: 700;
  color: var(--text-soft);
}

.city-search__controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.city-search__actions {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}

.city-search input,
.city-search button {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-main);
  font: inherit;
}

.city-search input {
  padding: 11px 12px;
  min-width: 0;
}

.city-search input:focus,
.city-search button:focus {
  outline: 2px solid rgba(255, 138, 61, 0.35);
  outline-offset: 1px;
}

.city-search button {
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #ffd8b8 0%, #ffc38d 100%);
}

.city-search__ghost {
  background: rgba(255, 255, 255, 0.72);
}

.city-search button:disabled {
  opacity: 0.7;
  cursor: default;
}

.current-weather {
  padding: 22px;
  animation: rise 0.7s ease;
}

.current-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-end;
}

.location {
  margin: 0;
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 800;
}

.condition {
  margin: 4px 0 0;
  font-size: 1rem;
  color: var(--text-soft);
  font-weight: 650;
}

.client-ip {
  margin: 6px 0 0;
  font-size: 0.92rem;
  color: var(--text-soft);
  opacity: 0.92;
}

.temp-wrap {
  text-align: right;
}

.temp {
  margin: 0;
  font-size: clamp(2.3rem, 8vw, 4.5rem);
  line-height: 0.95;
  font-weight: 800;
  color: #143a66;
}

.feels-like {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-weight: 600;
}

.metrics-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metrics-grid article {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.85) 0%,
    rgba(255, 255, 255, 0.6) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 16px;
  padding: 12px;
}

.metrics-grid h3 {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.metrics-grid p {
  margin: 8px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.hourly,
.daily {
  padding: 18px;
  animation: rise 0.9s ease;
}

h2 {
  margin: 4px 0 14px;
  font-size: clamp(1.15rem, 2.5vw, 1.6rem);
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.hour-card,
.day-card {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 10px 12px;
}

.hour-card p,
.day-card p {
  margin: 3px 0;
}

.hour-card .hour-time,
.day-card .day-name {
  font-weight: 700;
  color: var(--text-soft);
}

.hour-card .hour-temp,
.day-card .day-temp {
  font-size: 1.2rem;
  font-weight: 800;
}

.daily-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
}

.app-footer {
  padding: 14px 16px;
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.hidden {
  display: none;
}

body[data-weather-theme="sunny"] {
  --bg-top: #a9e6ff;
  --bg-mid: #fdf9d8;
  --bg-bottom: #ffd8a8;
}

body[data-weather-theme="sunny"] .weather-fx__sun {
  opacity: 1;
}

body[data-weather-theme="cloudy"] {
  --bg-top: #cedae4;
  --bg-mid: #e8eef3;
  --bg-bottom: #d7e2ed;
  --text-main: #233b52;
}

body[data-weather-theme="cloudy"] .sky-layer-back::before,
body[data-weather-theme="cloudy"] .sky-layer-front::before,
body[data-weather-theme="cloudy"] .sky-layer-front::after {
  background: rgba(239, 246, 252, 0.68);
}

body[data-weather-theme="fog"] {
  --bg-top: #d7dce2;
  --bg-mid: #e4e8ed;
  --bg-bottom: #cbd5df;
  --text-main: #223344;
}

body[data-weather-theme="fog"] .weather-fx__fog {
  opacity: 1;
}

body[data-weather-theme="drizzle"] {
  --bg-top: #b8d7e8;
  --bg-mid: #d7ebf4;
  --bg-bottom: #c5d8e8;
}

body[data-weather-theme="drizzle"] .weather-fx__rain {
  opacity: 0.4;
  animation-duration: 900ms;
}

body[data-weather-theme="drizzle"] .weather-fx__fog {
  opacity: 0.35;
}

body[data-weather-theme="rain"] {
  --bg-top: #9dc4db;
  --bg-mid: #bad7e8;
  --bg-bottom: #9abbd3;
  --text-main: #1c3349;
  --text-soft: #35526c;
}

body[data-weather-theme="rain"] .weather-fx__rain {
  opacity: 0.7;
}

body[data-weather-theme="rain"] .weather-fx__fog {
  opacity: 0.25;
}

body[data-weather-theme="snow"] {
  --bg-top: #e3f1fb;
  --bg-mid: #f7fcff;
  --bg-bottom: #e8f3fb;
  --text-main: #1f3b54;
}

body[data-weather-theme="snow"] .weather-fx__snow {
  opacity: 0.75;
}

body[data-weather-theme="storm"] {
  --bg-top: #8ca2ba;
  --bg-mid: #a2b7cc;
  --bg-bottom: #7e95ad;
  --text-main: #10253c;
  --text-soft: #2a4560;
}

body[data-weather-theme="storm"] .weather-fx__rain {
  opacity: 0.85;
  animation-duration: 500ms;
}

body[data-weather-theme="storm"] .weather-fx__flash {
  opacity: 1;
}

body[data-weather-theme="storm"] .weather-fx__fog {
  opacity: 0.2;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(145vw);
  }
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes sunPulse {
  0%,
  100% {
    transform: scale(0.94);
    opacity: 0.84;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

@keyframes sunRays {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes fogDrift {
  from {
    transform: translateX(-8%);
  }
  to {
    transform: translateX(8%);
  }
}

@keyframes rainMove {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: -32px 180px, -20px 140px;
  }
}

@keyframes snowMove {
  from {
    background-position: 0 -20px;
  }
  to {
    background-position: -30px 320px;
  }
}

@keyframes lightning {
  0%,
  83%,
  100% {
    opacity: 0;
  }
  84% {
    opacity: 0.35;
  }
  85% {
    opacity: 0;
  }
  88% {
    opacity: 0.55;
  }
  89% {
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .hourly-list {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .daily-list {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }
}

@media (max-width: 700px) {
  body {
    padding: 20px 12px;
  }

  .current-main {
    flex-direction: column;
    align-items: flex-start;
  }

  .temp-wrap {
    text-align: left;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hourly-list {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .daily-list {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .city-search__controls {
    grid-template-columns: 1fr;
  }

  .city-search__actions {
    grid-auto-flow: row;
  }
}

@media (max-width: 420px) {
  .metrics-grid,
  .hourly-list,
  .daily-list {
    grid-template-columns: 1fr;
  }
}
