:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #67748a;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(35, 47, 72, 0.12);
  --shadow: 0 24px 70px rgba(34, 46, 72, 0.16);
  --blue: #2475d6;
  --teal: #0d9c9a;
  --coral: #e76f51;
  --amber: #f5a524;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.9) 0 13rem, transparent 13.1rem),
    linear-gradient(145deg, #d7ebff 0%, #f8fbff 39%, #ffe3d0 100%);
}

body[data-day="night"] {
  color: #edf4ff;
  background:
    radial-gradient(circle at 82% 14%, rgba(255, 244, 194, 0.82) 0 4.8rem, transparent 4.9rem),
    linear-gradient(145deg, #101827 0%, #213854 50%, #314e58 100%);
}

body[data-day="night"] .current-weather,
body[data-day="night"] .forecast-section,
body[data-day="night"] .top-panel {
  --ink: #edf4ff;
  --muted: #b9c6d8;
  --panel: rgba(20, 31, 48, 0.72);
  --panel-strong: rgba(27, 41, 62, 0.92);
  --line: rgba(255, 255, 255, 0.14);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

button,
input {
  font: inherit;
}

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

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
}

.top-panel {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 4px 0 10px;
  backdrop-filter: blur(18px);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px 48px 48px;
  gap: 10px;
}

.search-box,
.icon-btn {
  height: 48px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: 0 10px 28px rgba(43, 63, 96, 0.1);
}

.reset-btn {
  color: var(--coral);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border-radius: 8px;
}

.search-box svg,
.icon-btn svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box svg {
  color: var(--blue);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.search-box input::placeholder {
  color: #7d8aa0;
}

.icon-btn {
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--teal);
  cursor: pointer;
}

.icon-btn:active {
  transform: translateY(1px);
}

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

.area-picker[hidden] {
  display: none !important;
}

.area-picker select,
.area-picker input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  padding: 0 12px;
  outline: 0;
}

.area-picker input {
  grid-column: 1 / -1;
}

.area-picker select:disabled,
.area-picker input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.current-weather,
.forecast-section {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.current-weather {
  margin-top: 8px;
  padding: 18px;
  border-radius: 8px;
}

.place-line,
.section-title,
.daily-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.place {
  margin: 0;
  font-size: clamp(20px, 7vw, 34px);
  font-weight: 800;
  line-height: 1.1;
}

.muted,
.condition,
.section-title span {
  color: var(--muted);
}

.muted {
  margin: 6px 0 0;
  font-size: 13px;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(13, 156, 154, 0.28);
  border-radius: 999px;
  padding: 5px 9px;
  color: #087a78;
  background: rgba(13, 156, 154, 0.11);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.weather-main {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.weather-icon {
  display: grid;
  place-items: center;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.42)),
    rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 18px 38px rgba(55, 78, 115, 0.12);
  font-size: 54px;
}

.temp-line {
  display: flex;
  align-items: flex-start;
  line-height: 0.9;
}

.temp-line span {
  font-size: clamp(68px, 22vw, 126px);
  font-weight: 850;
  letter-spacing: 0;
}

.temp-line small {
  margin-top: 9px;
  color: var(--muted);
  font-size: 24px;
  font-weight: 800;
}

.condition {
  margin: 10px 0 0;
  font-size: 16px;
}

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

.metrics-grid article {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.54);
}

.metrics-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.forecast-section {
  margin-top: 14px;
  padding: 16px;
  border-radius: 8px;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 17px;
}

.section-title span {
  font-size: 12px;
}

.hourly-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 76px;
  gap: 10px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
}

.hour-card {
  scroll-snap-align: start;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.52);
}

.hour-card time,
.daily-date {
  color: var(--muted);
  font-size: 12px;
}

.hour-card .mini-icon,
.daily-icon {
  font-size: 25px;
  line-height: 1;
}

.hour-card strong {
  font-size: 20px;
}

.hour-card span {
  color: var(--blue);
  font-size: 12px;
}

.daily-list {
  display: grid;
  gap: 8px;
}

.daily-item {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.5);
}

.daily-left {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.daily-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 750;
}

.daily-temp {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 800;
}

.daily-pop {
  color: var(--blue);
  font-size: 12px;
}

.error-box {
  margin: 14px 0 0;
  border: 1px solid rgba(231, 111, 81, 0.34);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 241, 236, 0.9);
  color: #9b321a;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 30px;
  }

  .current-weather {
    padding: 24px;
  }

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

  .weather-main {
    grid-template-columns: 140px minmax(0, 1fr);
  }

  .weather-icon {
    width: 140px;
    font-size: 70px;
  }
}

@media (max-width: 380px) {
  .app-shell {
    padding-inline: 10px;
  }

  .weather-main {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .weather-icon {
    width: 92px;
    font-size: 44px;
  }

  .metrics-grid {
    gap: 8px;
  }
}
