:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #657282;
  --line: #dbe2ea;
  --paper: #f6f8fb;
  --panel: #ffffff;
  --blue: #246bfe;
  --blue-dark: #164fca;
  --green: #0b8f77;
  --yellow: #f4b740;
  --rose: #d85c72;
  --shadow: 0 22px 60px rgba(28, 40, 58, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(36, 107, 254, 0.16), transparent 30rem),
    linear-gradient(135deg, #eef5ff 0%, #f8fbf8 42%, #fff7f6 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: calc(100vh - 48px);
  margin: 24px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 470px;
  gap: 18px;
}

.forecast-panel,
.detail-panel {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(219, 226, 234, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.forecast-panel {
  min-height: 100%;
  padding: clamp(20px, 4vw, 42px);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.detail-panel {
  border-radius: 8px;
  padding: 24px;
  overflow: hidden;
}

.topbar,
.panel-header,
.temperature-row,
.quick-row {
  display: flex;
  align-items: center;
}

.topbar,
.panel-header {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 7vw, 5.2rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  font-size: 1.35rem;
}

.search {
  margin-top: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search input {
  min-width: 0;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(36, 107, 254, 0.12);
}

.search button,
.ghost-button,
.quick-row button {
  border-radius: 8px;
  font-weight: 800;
}

.search button {
  min-width: 108px;
  height: 52px;
  color: #fff;
  background: var(--blue);
}

.search button:hover,
.ghost-button:hover {
  background: var(--blue-dark);
  color: #fff;
}

.quick-row {
  min-height: 42px;
  margin-top: 16px;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-row button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: #edf2f7;
}

.hero-weather {
  position: relative;
  min-height: 360px;
  margin-top: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  align-items: center;
  gap: clamp(18px, 4vw, 42px);
}

.sky-art {
  position: relative;
  width: 100%;
  aspect-ratio: 1.2;
  min-height: 260px;
}

.sky-art .sun,
.sky-art .cloud,
.sky-art .rain {
  position: absolute;
  display: block;
}

.sun {
  width: 36%;
  aspect-ratio: 1;
  top: 14%;
  left: 15%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3b0, var(--yellow) 62%, #f07f4f);
  box-shadow: 0 0 80px rgba(244, 183, 64, 0.55);
}

.cloud {
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(72, 84, 104, 0.16);
}

.cloud::before,
.cloud::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.cloud-one {
  width: 58%;
  height: 21%;
  right: 8%;
  bottom: 31%;
}

.cloud-one::before {
  width: 38%;
  height: 150%;
  left: 12%;
  bottom: 20%;
}

.cloud-one::after {
  width: 45%;
  height: 190%;
  right: 13%;
  bottom: 13%;
}

.cloud-two {
  width: 35%;
  height: 14%;
  left: 8%;
  bottom: 18%;
  opacity: 0.86;
}

.cloud-two::before {
  width: 36%;
  height: 140%;
  left: 16%;
  bottom: 20%;
}

.cloud-two::after {
  width: 40%;
  height: 150%;
  right: 14%;
  bottom: 12%;
}

.sky-art .rain {
  width: 6px;
  height: 42px;
  bottom: 15%;
  border-radius: 99px;
  background: var(--blue);
  transform: rotate(16deg);
  opacity: 0;
}

.rain-one {
  left: 55%;
}

.rain-two {
  left: 70%;
}

.hero-weather.rainy .rain {
  opacity: 0.95;
}

.hero-weather.cloudy .sun {
  opacity: 0.42;
}

.hero-weather.stormy .sun {
  background: radial-gradient(circle at 35% 35%, #e8eef6, #8d99a8 70%);
  box-shadow: 0 0 70px rgba(80, 92, 109, 0.25);
}

.weather-copy {
  align-self: center;
}

.location {
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.condition {
  margin-top: 10px;
  color: var(--ink);
  font-size: 1.15rem;
}

.temperature-row {
  margin-top: 12px;
  align-items: flex-start;
}

#rainToday {
  font-size: clamp(5.4rem, 16vw, 11rem);
  line-height: 0.8;
  font-weight: 900;
}

.unit {
  margin-top: 10px;
  color: var(--blue);
  font-size: clamp(1.8rem, 5vw, 3.6rem);
  font-weight: 900;
}

.rain-note {
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.metrics-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.metrics-grid article,
.hour-card,
.day-row,
.history-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.metrics-grid article {
  min-height: 92px;
  padding: 16px;
}

.metrics-grid span,
.hour-card span,
.day-row span,
.history-row span,
.updated {
  color: var(--muted);
  font-size: 0.82rem;
}

.metrics-grid strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.ghost-button {
  min-height: 38px;
  padding: 0 12px;
  color: var(--blue);
  background: #e9f0ff;
}

.hourly-strip {
  margin-top: 18px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 84px;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.hour-card {
  min-height: 126px;
  padding: 14px 10px;
  display: grid;
  justify-items: center;
  align-content: space-between;
  text-align: center;
}

.rain-drop {
  width: 36px;
  height: 46px;
  border-radius: 50% 50% 54% 54%;
  background: #dce4ee;
  transform: rotate(45deg);
  box-shadow: 0 8px 16px rgba(36, 107, 254, 0.16);
}

.rain-drop.light {
  background: #9cc8ff;
}

.rain-drop.medium {
  background: linear-gradient(135deg, var(--blue), #6fc4ff);
}

.rain-drop.heavy {
  background: linear-gradient(135deg, #123b96, var(--blue));
}

.daily-title {
  margin-top: 24px;
}

.daily-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.rain-summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rain-summary article,
.history-summary article {
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbff;
}

.rain-summary span,
.rain-summary small,
.history-summary span,
.history-summary small {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.rain-summary strong,
.history-summary strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 1.45rem;
}

.radar-section {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.radar-map {
  position: relative;
  min-height: 320px;
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dce6f2;
}

.radar-tile-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
}

.radar-base-tile,
.radar-rain-tile {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.radar-base-tile {
  filter: saturate(0.82) contrast(0.96);
}

.radar-rain-tile {
  opacity: 0.82;
}

.radar-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 2px rgba(23, 33, 43, 0.45), 0 8px 18px rgba(23, 33, 43, 0.28);
  transform: translate(-50%, -50%);
}

.radar-loading {
  grid-column: 1 / -1;
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  padding: 18px;
}

.radar-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.radar-note {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.radar-link {
  flex: 0 0 auto;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--blue);
  background: #e9f0ff;
  font-weight: 800;
  font-size: 0.86rem;
  text-decoration: none;
}

.radar-link:hover {
  color: #fff;
  background: var(--blue-dark);
}

.history-section {
  margin-top: 26px;
  border-top: 1px solid var(--line);
  padding-top: 4px;
}

.history-summary {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.history-chart {
  height: 172px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(28px, 1fr));
  gap: 8px;
  align-items: end;
}

.history-bar {
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: end;
  text-align: center;
}

.history-bar span {
  width: 100%;
  min-height: 3px;
  border-radius: 99px 99px 0 0;
  background: linear-gradient(180deg, #123b96, var(--blue), #9cc8ff);
}

.history-bar small {
  color: var(--muted);
  font-size: 0.68rem;
  white-space: nowrap;
}

.history-list {
  max-height: 520px;
  margin-top: 12px;
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.year-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  overflow: hidden;
}

.year-row summary {
  min-height: 66px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(70px, 0.55fr) minmax(86px, 1fr) minmax(168px, auto);
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.year-row summary::-webkit-details-marker {
  display: none;
}

.year-row summary::before {
  content: "+";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-weight: 900;
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.year-row[open] summary::before {
  content: "-";
}

.year-row summary strong {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.year-row summary .range-bar {
  grid-column: 2;
}

.year-row summary span {
  grid-column: 3;
  color: var(--muted);
  font-size: 0.82rem;
}

.month-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.day-row,
.history-row {
  min-height: 62px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(108px, 0.8fr) minmax(72px, 1fr) minmax(128px, auto);
  align-items: center;
  gap: 10px;
}

.history-row {
  grid-template-columns: minmax(132px, 0.9fr) minmax(80px, 1fr) minmax(168px, auto);
}

.day-row strong,
.history-row strong {
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.range-bar {
  max-width: 100%;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, #9cc8ff, var(--blue), #123b96);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  max-width: min(520px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    order: 2;
  }

  .hero-weather {
    min-height: 300px;
    grid-template-columns: 1fr;
  }

  .sky-art {
    max-width: 420px;
    min-height: 220px;
    margin: 0 auto;
  }

  .weather-copy {
    text-align: center;
  }

  .temperature-row {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    margin: 10px auto;
  }

  .forecast-panel,
  .detail-panel {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
  }

  .search {
    grid-template-columns: 1fr;
  }

  .search button {
    width: 100%;
  }

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

  .day-row {
    grid-template-columns: minmax(72px, 0.9fr) minmax(80px, 1fr) auto;
    padding: 10px;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .year-row summary {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .year-row summary strong,
  .year-row summary .range-bar,
  .year-row summary span {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .year-row summary::before {
    grid-column: 2;
    justify-self: end;
  }

  .history-row span {
    justify-self: start;
  }

  .history-summary {
    grid-template-columns: 1fr;
  }

  .radar-map,
  .radar-loading {
    min-height: 260px;
  }

  .radar-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .radar-link {
    width: 100%;
  }
}


.month-detail {
  min-height: 0;
  padding: 0;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.month-detail summary {
  min-height: 62px;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(132px, 0.9fr) minmax(80px, 1fr) minmax(168px, auto);
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
}

.month-detail summary::-webkit-details-marker {
  display: none;
}

.month-detail summary::before {
  content: "+";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
}

.month-detail[open] summary::before {
  content: "-";
}

.month-detail summary strong {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
}

.month-detail summary .range-bar {
  grid-column: 2;
}

.month-detail summary span {
  grid-column: 3;
  color: var(--muted);
  font-size: 0.82rem;
}

.daily-rain-list {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.daily-rain-row {
  min-height: 48px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: minmax(98px, 0.75fr) minmax(72px, 1fr) minmax(92px, auto);
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: #f7fbff;
}

.daily-rain-row.dry {
  opacity: 0.62;
}

.daily-rain-row strong {
  white-space: nowrap;
}

.daily-rain-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  .month-detail summary,
  .daily-rain-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .month-detail summary strong,
  .month-detail summary .range-bar,
  .month-detail summary span {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .month-detail summary::before {
    grid-column: 1;
    justify-self: end;
  }
}


.empty-rain-month {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}
