:root {
  color-scheme: dark;
  --bg: #18202a;
  --bg-soft: #212c38;
  --panel: rgba(248, 250, 252, 0.93);
  --panel-muted: rgba(226, 232, 240, 0.94);
  --text: #f8fafc;
  --ink: #17202a;
  --muted: #667085;
  --accent: #15aabf;
  --accent-strong: #0b7285;
  --warm: #f59f00;
  --line: rgba(255, 255, 255, 0.18);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(21, 170, 191, 0.28), transparent 28rem),
    linear-gradient(135deg, #18202a 0%, #243241 52%, #34495d 100%);
  color: var(--text);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.screen {
  height: 100dvh;
  padding: clamp(14px, 2.1vw, 34px);
  padding-bottom: 74px;
  overflow: hidden;
}

.search-view {
  height: 100%;
  display: grid;
  place-items: center;
}

.search-panel {
  width: min(760px, 100%);
  display: grid;
  gap: clamp(16px, 2.3vh, 26px);
  padding: clamp(22px, 4vh, 46px);
  background: var(--panel);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: #8ee7f1;
  font-size: clamp(0.9rem, 1.2vw, 1.1rem);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.search-panel .eyebrow {
  color: var(--accent-strong);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.search-label {
  color: var(--muted);
  font-weight: 800;
}

.search-row,
.compact-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input {
  min-width: 0;
  width: 100%;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 12px 18px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--accent);
}

button {
  min-height: 48px;
  border-radius: 8px;
  padding: 0 24px;
  background: var(--accent);
  color: #04242b;
  font-weight: 900;
}

button:focus-visible {
  outline: 3px solid #99e9f2;
  outline-offset: 3px;
}

.weather-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: clamp(8px, 1.4vh, 18px);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(320px, 440px);
  gap: 24px;
  align-items: end;
}

.compact-search input {
  background: rgba(255, 255, 255, 0.93);
}

.status {
  min-height: 24px;
  color: #d8f7fb;
  font-size: clamp(0.9rem, 1.7vh, 1.12rem);
  font-weight: 700;
}

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(180px, 1fr));
  min-height: 0;
  gap: clamp(10px, 1.4vw, 20px);
  align-items: stretch;
}

.card {
  min-height: 0;
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: clamp(7px, 1.15vh, 16px);
  padding: clamp(12px, 1.35vw, 22px);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  border: 5px solid var(--temperature-color, rgba(255, 255, 255, 0.56));
  box-shadow: var(--shadow), 0 0 22px var(--temperature-color, rgba(255, 255, 255, 0.2));
}

.card.today {
  background: var(--bg);
  border-color: var(--temperature-color, rgba(245, 159, 0, 0.55));
}

.day-name {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #cbd5e1;
  font-size: clamp(0.78rem, 1.55vh, 1rem);
  font-weight: 850;
}

.weather-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: clamp(66px, 11vh, 110px);
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg);
}

.weather-icon span,
.weather-icon::before,
.weather-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.weather-icon span {
  width: clamp(70px, 9vw, 132px);
  height: clamp(70px, 9vw, 132px);
}

.icon-sun span {
  border-radius: 999px;
  background: #f59f00;
  box-shadow: 0 0 0 14px rgba(245, 159, 0, 0.18), 0 0 38px rgba(245, 159, 0, 0.42);
}

.icon-cloud span,
.icon-partly span,
.icon-rain span,
.icon-drizzle span,
.icon-snow span,
.icon-storm span {
  width: clamp(92px, 11vw, 168px);
  height: clamp(44px, 5.2vw, 76px);
  margin-top: clamp(18px, 3vh, 34px);
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: -34px 3px 0 -8px #e2e8f0, 34px 5px 0 -10px #d8eef2, 0 16px 28px rgba(23, 32, 42, 0.16);
}

.icon-cloud span::before,
.icon-partly span::before,
.icon-rain span::before,
.icon-drizzle span::before,
.icon-snow span::before,
.icon-storm span::before {
  content: "";
  position: absolute;
  left: 18%;
  bottom: 34%;
  width: 44%;
  height: 90%;
  border-radius: 999px;
  background: #f8fafc;
}

.icon-cloud span::after,
.icon-partly span::after,
.icon-rain span::after,
.icon-drizzle span::after,
.icon-snow span::after,
.icon-storm span::after {
  content: "";
  position: absolute;
  right: 16%;
  bottom: 28%;
  width: 36%;
  height: 76%;
  border-radius: 999px;
  background: #eef6f8;
}

.icon-partly::before {
  width: clamp(58px, 7vw, 108px);
  height: clamp(58px, 7vw, 108px);
  transform: translate(-44%, -28%);
  border-radius: 999px;
  background: #f59f00;
  box-shadow: 0 0 0 11px rgba(245, 159, 0, 0.18);
}

.icon-rain::after,
.icon-drizzle::after {
  left: 50%;
  bottom: 11%;
  width: clamp(74px, 8vw, 118px);
  height: clamp(28px, 3.4vh, 44px);
  transform: translateX(-50%);
  background: repeating-linear-gradient(115deg, transparent 0 12px, #15aabf 12px 17px, transparent 17px 28px);
}

.icon-drizzle::after {
  opacity: 0.65;
  width: clamp(58px, 6.6vw, 96px);
}

.icon-snow::after {
  left: 50%;
  bottom: 10%;
  width: clamp(86px, 8vw, 122px);
  height: clamp(30px, 3.4vh, 46px);
  transform: translateX(-50%);
  background: radial-gradient(circle, #9bdcf2 0 4px, transparent 5px);
  background-size: 28px 24px;
}

.icon-fog span {
  width: clamp(112px, 13vw, 184px);
  height: clamp(70px, 9vh, 112px);
  background: repeating-linear-gradient(180deg, transparent 0 17px, #e2e8f0 17px 27px, transparent 27px 40px);
}

.icon-storm::after {
  left: 50%;
  bottom: 6%;
  width: clamp(38px, 4vw, 58px);
  height: clamp(58px, 7vh, 84px);
  transform: translateX(-42%) skewX(-10deg);
  clip-path: polygon(45% 0, 100% 0, 63% 43%, 94% 43%, 28% 100%, 45% 55%, 8% 55%);
  background: #f59f00;
}

.card .weather-icon > span {
  transform: scale(0.7);
}

.card .icon-partly::before {
  transform: translate(-44%, -28%) scale(0.7);
}

.card .icon-rain::after,
.card .icon-drizzle::after,
.card .icon-snow::after {
  transform: translateX(-50%) scale(0.7);
}

.card .icon-storm::after {
  transform: translateX(-42%) skewX(-10deg) scale(0.7);
}

.summary {
  align-self: start;
  display: grid;
  align-content: start;
  gap: clamp(2px, 0.35vh, 4px);
}

.condition {
  min-height: 1.15em;
  color: var(--text);
  font-size: clamp(1.4rem, 3.15vh, 2.15rem);
  font-weight: 900;
  line-height: 1.08;
}

.temp {
  align-self: start;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.temp strong {
  color: var(--text);
  font-size: clamp(3rem, 5.1vh, 4rem);
  line-height: 0.95;
}

.temp span {
  color: #cbd5e1;
  font-size: clamp(1rem, 1.75vh, 1.2rem);
  font-weight: 850;
}

.facts {
  align-self: stretch;
  display: grid;
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: clamp(4px, 0.85vh, 9px);
  margin: 0;
  min-height: 0;
}

.fact {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding-top: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-size: clamp(0.76rem, 1.5vh, 0.98rem);
  font-weight: 750;
}

.fact dt,
.fact dd {
  margin: 0;
}

.fact dt {
  color: #cbd5e1;
}

.fact dd {
  text-align: right;
}

.place-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  border-top: 1px solid var(--line);
  background: rgba(13, 19, 26, 0.88);
  color: #edf8fa;
  backdrop-filter: blur(12px);
  font-size: clamp(1rem, 1.5vw, 1.45rem);
  font-weight: 850;
  text-align: center;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .cards {
    grid-template-columns: repeat(5, minmax(148px, 1fr));
  }
}

@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .screen {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  .weather-view {
    height: auto;
  }

  .now-panel {
    grid-template-columns: 1fr;
  }

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

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

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

  .card {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .screen {
    padding: 18px;
    padding-bottom: 92px;
  }

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

  button {
    width: 100%;
  }
}

.now-panel {
  --temperature-color: #15aabf;
  min-height: clamp(125px, 17vh, 185px);
  display: grid;
  grid-template-columns: clamp(135px, 13vw, 190px) minmax(180px, 0.7fr) minmax(420px, 1.3fr);
  gap: clamp(12px, 1.6vw, 24px);
  align-items: center;
  padding: clamp(10px, 1.25vw, 18px);
  border: 5px solid var(--temperature-color);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow), 0 0 22px var(--temperature-color);
}

.now-icon {
  min-height: clamp(105px, 14vh, 155px);
  height: 100%;
}

.now-icon span {
  transform: scale(0.92);
}

.now-main {
  display: grid;
  gap: 2px;
  align-content: center;
}

.now-main span {
  color: #cbd5e1;
  font-size: clamp(0.78rem, 1.2vw, 1rem);
  font-weight: 900;
  text-transform: uppercase;
}

.now-main strong {
  color: var(--text);
  font-size: clamp(2.1rem, 4.4vw, 4.3rem);
  line-height: 0.95;
  font-weight: 950;
}

.now-main em {
  color: var(--text);
  font-size: clamp(1rem, 1.55vw, 1.55rem);
  font-style: normal;
  font-weight: 900;
  line-height: 1.05;
}

.now-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 0.8vw, 12px);
  margin: 0;
}

.now-facts div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding-left: clamp(8px, 0.8vw, 14px);
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.now-facts dt,
.now-facts dd {
  margin: 0;
}

.now-facts dt {
  color: #cbd5e1;
  font-size: clamp(0.72rem, 0.95vw, 0.9rem);
  font-weight: 850;
}

.now-facts dd {
  color: var(--text);
  font-size: clamp(1rem, 1.45vw, 1.45rem);
  font-weight: 950;
  line-height: 1;
}

@media (max-width: 900px) {
  .now-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .now-facts {
    grid-template-columns: 1fr;
  }
}
