:root {
  --bg: #172554;
  --bg-strong: #0f1d3c;
  --surface: #FFFFFF;
  --surface-soft: #E0F2FE;
  --surface-strong: #F8FBFF;
  --border: rgba(23, 37, 84, 0.14);
  --text: #FFFFFF;
  --card-text: #172554;
  --muted: #64748B;
  --muted-2: #64748B;
  --accent: #38BDF8;
  --accent-strong: #38BDF8;
  --accent-soft: rgba(56, 189, 248, 0.14);
  --lavender: #A78BFA;
  --lavender-soft: rgba(167, 139, 250, 0.16);
  --shadow: 0 24px 60px rgba(23, 37, 84, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 30%),
    linear-gradient(160deg, #172554 0%, #1c2d60 45%, #0f1d3c 100%);
  color: var(--card-text);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.page-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, #172554 0%, #1c2f69 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  color: var(--text);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #7dd3fc);
  color: var(--bg);
  font-size: 1.35rem;
  box-shadow: 0 16px 30px rgba(56, 189, 248, 0.38);
}

.brand-label,
.brand-subtitle {
  margin: 0;
}

.brand-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.75rem;
}

.search-form {
  display: flex;
  align-items: center;
  width: min(100%, 480px);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.search-form button {
  width: 58px;
  height: 58px;
  border: none;
  color: var(--text);
  background: linear-gradient(135deg, var(--accent), #7dd3fc);
}

.search-form input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  min-width: 0;
  padding: 0 18px 0 4px;
  font-size: 0.96rem;
}

.search-form input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.search-form input:focus {
  outline: none;
}

.weather-layout {
  display: grid;
  grid-template-columns: minmax(270px, 320px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 24px;
  margin-top: 24px;
}

.panel {
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-strong) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--card-text);
}

.panel-header {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 18px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(56, 189, 248, 0.26);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.current-main {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 18px;
}

.current-icon-wrap {
  display: grid;
  place-items: center;
  width: 102px;
  height: 102px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--surface-soft), #d9efff);
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.current-icon-wrap img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(56, 189, 248, 0.28));
}

.current-temp-block {
  min-width: 0;
}

.temperature {
  font-size: clamp(2.5rem, 5vw, 4rem);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.08em;
  margin-bottom: 8px;
  color: var(--card-text);
}

.current-condition {
  font-size: 1rem;
  font-weight: 600;
  color: var(--card-text);
}

.current-feels {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.location-block {
  margin-top: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.location-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--card-text);
}

.location-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.stats-stack {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f5fbff 0%, var(--surface-soft) 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
  font-size: 0.9rem;
  color: var(--card-text);
}

.meta-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.meta-label i {
  width: 16px;
  text-align: center;
  color: var(--accent);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.mini-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 126px;
  padding: 16px 12px;
  border-radius: 18px;
  background: linear-gradient(160deg, var(--surface-soft) 0%, #d5edff 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
}

.mini-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
}

.mini-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--card-text);
}

.mini-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.content-panel {
  min-width: 0;
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--card-text);
}

.section-date {
  font-size: 0.82rem;
  color: var(--muted);
}

.hourly-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(88px, 1fr));
  gap: 12px;
  min-width: 0;
}

.hourly-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 138px;
  padding: 12px 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAFF 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
}

.hourly-time {
  font-size: 0.78rem;
  color: var(--muted);
}

.hourly-card img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.hourly-temp {
  font-weight: 700;
  color: var(--card-text);
}

.overview-title {
  margin-top: 26px;
  margin-bottom: 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--card-text);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.overview-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAFF 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
}

.overview-label {
  color: var(--muted);
  font-size: 0.78rem;
}

.overview-value {
  margin-top: 16px;
  font-size: clamp(1.5rem, 2vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--card-text);
}

.overview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.8rem;
}

.overview-footer i {
  color: var(--accent);
}

.insights-wrapper {
  margin-top: 24px;
}

.insight-card {
  padding: 18px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAFF 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
}

.card-title {
  margin-bottom: 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--card-text);
}

.day-part {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
}

.day-part + .day-part {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 16px;
}

.day-part-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--lavender-soft);
  color: var(--lavender);
}

.day-part-label {
  color: var(--muted);
  font-size: 0.76rem;
}

.day-part-time {
  margin-top: 4px;
  font-weight: 600;
  color: var(--card-text);
}

.forecast-panel {
  min-width: 0;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.forecast-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F4FAFF 100%);
  border: 1px solid rgba(23, 37, 84, 0.08);
}

.forecast-item img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.forecast-day {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--card-text);
}

.forecast-text {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
}

.forecast-range {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--card-text);
}

.sources {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sources p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(23, 37, 84, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
  color: var(--text);
  opacity: 0;
  transform: translateY(8px);
  visibility: hidden;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

.toast.error {
  border-color: rgba(255, 118, 118, 0.35);
  background: rgba(58, 16, 16, 0.96);
}

@media (max-width: 1200px) {
  .weather-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .forecast-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .page-shell {
    padding: 18px;
  }

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

  .brand {
    justify-content: center;
  }

  .search-form {
    width: 100%;
    max-width: none;
  }

  .weather-layout {
    grid-template-columns: 1fr;
  }

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

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

  .current-main {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .current-icon-wrap {
    margin: 0 auto;
  }

  .section-top {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .hourly-strip {
    grid-template-columns: repeat(7, minmax(92px, 1fr));
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .mini-stats {
    grid-template-columns: 1fr 1fr;
  }
}
