:root {
  color-scheme: light;
  --text: #10253b;
  --muted: #587087;
  --blue: #087cf0;
  --blue-deep: #075dbd;
  --cyan: #33b8f2;
  --warm: #ff5f45;
  --cold: #278fe8;
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.76);
  --shadow: 0 18px 60px rgba(26, 83, 125, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 20px;
  --safe-top: max(14px, env(safe-area-inset-top));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #dff3ff;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 255, 255, 0.98), transparent 31%),
    linear-gradient(155deg, #b7e8ff 0%, #edf8ff 43%, #cfe8ff 100%);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

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

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(5px);
  opacity: 0.56;
  animation: drift 18s ease-in-out infinite alternate;
}

.orb-one {
  width: 46vw;
  height: 46vw;
  top: 4%;
  right: -16%;
  background: radial-gradient(circle at 32% 32%, #fff6bb, #8fdcff 70%);
}

.orb-two {
  width: 42vw;
  height: 42vw;
  top: 50%;
  left: -20%;
  background: radial-gradient(circle at 60% 40%, #c7fff1, #80bfff 70%);
  animation-delay: -6s;
}

.orb-three {
  width: 32vw;
  height: 32vw;
  bottom: -12%;
  right: 2%;
  background: radial-gradient(circle at 44% 30%, #ffd8d1, #91d3ff 72%);
  animation-delay: -11s;
}

@keyframes drift {
  from { transform: translate3d(-2%, -2%, 0) scale(0.96); }
  to { transform: translate3d(4%, 4%, 0) scale(1.08); }
}

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

.topbar {
  position: sticky;
  top: 10px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 24px), 1040px);
  min-height: 68px;
  margin: var(--safe-top) auto 0;
  padding: 10px 12px 10px 13px;
  border-radius: 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  filter: drop-shadow(0 5px 9px rgba(21, 115, 183, 0.22));
}

.brand span,
.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 22px rgba(18, 82, 126, 0.1), inset 0 1px 0 #fff;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.82);
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.is-spinning svg {
  animation: spin 0.9s linear infinite;
}

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

.app-shell {
  width: min(calc(100% - 24px), 1040px);
  margin: 14px auto 0;
}

.search-panel {
  position: relative;
  z-index: 30;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.64);
}

.search-field {
  display: grid;
  min-height: 58px;
  grid-template-columns: 24px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  padding: 0 17px;
}

.search-field > svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: var(--blue);
  stroke-width: 2.1;
  stroke-linecap: round;
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 14px 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 17px;
}

.search-field input::placeholder {
  color: #688096;
  opacity: 0.86;
}

.search-spinner {
  display: none;
  width: 19px;
  height: 19px;
  border: 2px solid rgba(8, 124, 240, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.search-spinner.visible {
  display: block;
}

.search-results {
  max-height: min(360px, 50vh);
  padding: 4px 8px 9px;
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  overflow: auto;
  overscroll-behavior: contain;
}

.search-result {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.search-result:active,
.search-result[aria-selected="true"] {
  background: rgba(255, 255, 255, 0.68);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result strong {
  font-size: 16px;
}

.search-result small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.result-country {
  flex: none;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--blue-deep);
  background: rgba(8, 124, 240, 0.1);
  font-size: 11px;
  font-weight: 750;
}

.status-banner {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  color: #604b00;
  background: rgba(255, 244, 183, 0.72);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
}

.hero {
  position: relative;
  margin-top: 14px;
  padding: clamp(22px, 5vw, 40px);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.hero::after {
  position: absolute;
  width: 260px;
  height: 260px;
  top: -110px;
  right: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 174, 0.82), rgba(255, 255, 255, 0));
  content: "";
  pointer-events: none;
}

.hero-topline {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  letter-spacing: -0.045em;
}

h1 {
  margin-bottom: 4px;
  font-size: clamp(31px, 7vw, 48px);
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(24px, 4.5vw, 34px);
  line-height: 1.1;
}

.weather-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.rating-badge {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 67px;
  min-height: 67px;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.48);
  box-shadow: inset 0 1px 0 #fff, 0 9px 22px rgba(42, 98, 133, 0.1);
}

.rating-badge span {
  font-size: 26px;
  font-weight: 850;
  line-height: 0.9;
}

.rating-badge small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.current-weather {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 145px;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
}

.current-visual {
  display: grid;
  width: clamp(92px, 24vw, 138px);
  height: clamp(92px, 24vw, 138px);
  flex: none;
  place-items: center;
}

.weather-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 16px rgba(30, 84, 122, 0.18));
}

.weather-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: clamp(52px, 14vw, 86px);
  filter: drop-shadow(0 10px 14px rgba(30, 84, 122, 0.15));
}

.current-temp {
  font-size: clamp(64px, 18vw, 112px);
  font-weight: 250;
  letter-spacing: -0.085em;
  line-height: 0.9;
}

.today-range {
  display: grid;
  align-self: center;
  gap: 6px;
  margin-left: auto;
  font-size: 16px;
  font-weight: 750;
}

.today-range span::before {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  content: "";
}

.today-range .max::before { background: var(--warm); }
.today-range .min::before { background: var(--cold); }

.stat-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.33);
}

.stat small,
.stat strong {
  display: block;
}

.stat small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat strong {
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.long-summary {
  position: relative;
  z-index: 1;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.64);
  color: #304b63;
  font-size: 14px;
  line-height: 1.55;
}

.trend-card {
  margin-top: 14px;
  padding: clamp(20px, 4.5vw, 34px);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-max { background: var(--warm); }
.legend-min { background: var(--cold); }

.temperature-chart {
  width: 100%;
  margin-top: 16px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.temperature-chart svg {
  display: block;
  width: max(720px, 100%);
  height: 215px;
  overflow: visible;
}

.chart-grid-line {
  stroke: rgba(53, 91, 119, 0.12);
  stroke-width: 1;
}

.chart-max-line,
.chart-min-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.chart-max-line { stroke: var(--warm); }
.chart-min-line { stroke: var(--cold); }

.chart-max-dot { fill: var(--warm); }
.chart-min-dot { fill: var(--cold); }

.chart-value {
  fill: var(--text);
  font-size: 11px;
  font-weight: 750;
  text-anchor: middle;
}

.chart-day {
  fill: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
}

.forecast-section {
  margin-top: 26px;
}

.forecast-heading {
  padding: 0 5px 12px;
}

.day-count {
  flex: none;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--blue-deep);
  background: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.forecast-group + .forecast-group {
  margin-top: 24px;
}

.group-title {
  margin: 0 5px 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.forecast-grid {
  display: grid;
  gap: 9px;
}

.day-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 91px;
  grid-template-columns: 74px 58px minmax(0, 1fr) auto 14px;
  grid-template-areas:
    "identity icon condition temperature chevron"
    "identity icon meta temperature chevron";
  align-items: center;
  gap: 0 8px;
  padding: 13px 13px 13px 15px;
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.day-card:active {
  transform: scale(0.98);
  background: var(--glass-strong);
}

.day-card.is-today {
  border-color: rgba(8, 124, 240, 0.34);
  background: rgba(235, 249, 255, 0.67);
}

.day-identity { grid-area: identity; }
.day-weather-icon { grid-area: icon; }
.day-condition { grid-area: condition; }
.day-meta { grid-area: meta; }
.day-temperature { grid-area: temperature; }
.card-chevron { grid-area: chevron; }

.day-identity strong,
.day-identity small {
  display: block;
}

.day-name {
  font-size: 15px;
  line-height: 1.2;
  text-transform: capitalize;
}

.day-date {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.day-weather-icon {
  display: grid;
  width: 55px;
  height: 55px;
  place-items: center;
}

.day-weather-icon .weather-fallback {
  font-size: 34px;
}

.day-condition {
  align-self: end;
  overflow: hidden;
  padding-bottom: 3px;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.day-meta {
  display: flex;
  align-self: start;
  gap: 11px;
  color: var(--muted);
  font-size: 11px;
}

.day-meta > span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rain-meta svg {
  width: 12px;
  height: 12px;
  fill: rgba(39, 143, 232, 0.18);
  stroke: var(--cold);
  stroke-width: 1.8;
}

.wind-meta i {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: solid var(--muted);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.day-temperature {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 17px;
}

.temp-max { color: var(--warm); }
.temp-min { color: var(--cold); }

.card-chevron {
  color: rgba(37, 73, 102, 0.44);
  font-size: 24px;
  font-weight: 500;
}

.footer {
  display: flex;
  width: min(calc(100% - 24px), 1040px);
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 26px auto calc(12px + var(--safe-bottom));
  padding: 11px 15px;
  border-radius: 19px;
  color: var(--muted);
  font-size: 11px;
}

.footer a {
  flex: none;
  color: var(--blue-deep);
  font-weight: 750;
  text-decoration: none;
}

.loading-view {
  margin-top: 14px;
  text-align: center;
}

.loading-view p {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.hero-skeleton,
.chart-skeleton,
.card-skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
}

.hero-skeleton::after,
.chart-skeleton::after,
.card-skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 22%, rgba(255, 255, 255, 0.66) 42%, transparent 62%);
  content: "";
  animation: shimmer 1.45s infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.hero-skeleton {
  height: 390px;
  border-radius: var(--radius-xl);
}

.chart-skeleton {
  height: 260px;
  margin-top: 14px;
  border-radius: var(--radius-xl);
}

.cards-skeleton {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.card-skeleton {
  height: 91px;
  border-radius: var(--radius-md);
}

.error-view {
  margin-top: 14px;
  padding: 40px 24px;
  border-radius: var(--radius-xl);
  text-align: center;
}

.error-view h1 {
  margin: 12px auto 10px;
  font-size: 27px;
}

.error-view p {
  max-width: 470px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.error-icon {
  font-size: 58px;
}

.primary-button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(180deg, #2398ff, #0572de);
  box-shadow: 0 10px 22px rgba(5, 114, 222, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.day-dialog {
  width: min(calc(100% - 24px), 540px);
  max-height: min(760px, calc(100dvh - 36px));
  margin: auto;
  padding: 24px;
  border-radius: 30px;
  color: var(--text);
  overflow: auto;
}

.day-dialog::backdrop {
  background: rgba(25, 47, 67, 0.3);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.dialog-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
}

.dialog-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 105px;
  align-items: center;
  gap: 14px;
  padding-top: 10px;
}

.dialog-hero h2 {
  margin: 4px 0 8px;
  text-transform: capitalize;
}

.dialog-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.dialog-icon {
  width: 105px;
  height: 105px;
}

.dialog-range {
  display: flex;
  gap: 13px;
  margin-top: 15px;
  font-size: 25px;
  font-weight: 750;
}

.dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 20px;
}

.dialog-stat {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.36);
}

.dialog-stat small,
.dialog-stat strong {
  display: block;
}

.dialog-stat small {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dialog-stat strong {
  font-size: 18px;
}

@media (min-width: 700px) {
  .topbar,
  .app-shell,
  .footer {
    width: min(calc(100% - 40px), 1040px);
  }

  .topbar {
    top: 16px;
  }

  .app-shell {
    margin-top: 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .forecast-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-card {
    grid-template-columns: 70px 54px minmax(0, 1fr) auto 12px;
  }
}

@media (max-width: 430px) {
  .day-card {
    grid-template-columns: 65px 51px minmax(0, 1fr) auto 11px;
    padding-left: 13px;
  }

  .day-condition {
    max-width: 117px;
  }

  .day-weather-icon {
    width: 49px;
    height: 49px;
  }

  .chart-legend {
    display: none;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --text: #eff8ff;
    --muted: #a9bed0;
    --blue: #58adff;
    --blue-deep: #8fcaff;
    --glass: rgba(13, 36, 55, 0.56);
    --glass-strong: rgba(20, 48, 70, 0.76);
    --glass-border: rgba(255, 255, 255, 0.16);
    --shadow: 0 18px 60px rgba(0, 9, 24, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  html,
  body {
    background: #071b2b;
  }

  body {
    background:
      radial-gradient(circle at 8% 6%, rgba(49, 102, 139, 0.52), transparent 31%),
      linear-gradient(155deg, #0d2e46 0%, #071a2a 50%, #102b45 100%);
  }

  .icon-button,
  .search-field,
  .rating-badge,
  .stat,
  .dialog-stat {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(10, 36, 56, 0.38);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .search-result:active,
  .search-result[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.1);
  }

  .long-summary {
    color: #c6dae9;
  }

  .hero::after {
    opacity: 0.35;
  }

  .chart-grid-line {
    stroke: rgba(218, 238, 255, 0.12);
  }

  .chart-value { fill: var(--text); }
  .chart-day { fill: var(--muted); }
}
