:root {
  color-scheme: light;
  --bg: #f4efe5;
  --bg-accent: #ffd36e;
  --surface: rgba(255, 251, 245, 0.82);
  --surface-strong: #fff9ef;
  --ink: #123047;
  --ink-soft: #486273;
  --line: rgba(18, 48, 71, 0.1);
  --blue: #1886ff;
  --blue-soft: #7fc2ff;
  --cyan: #b9ecff;
  --green: #227c52;
  --shadow: 0 18px 60px rgba(18, 48, 71, 0.14);
  --radius-lg: 28px;
  --radius-md: 18px;
}

body.theme-dark {
  color-scheme: dark;
  --bg: #0e1b26;
  --bg-accent: #1e3a52;
  --surface: rgba(18, 32, 44, 0.9);
  --surface-strong: #152634;
  --ink: #edf6ff;
  --ink-soft: #9fb6c8;
  --line: rgba(237, 246, 255, 0.12);
  --blue: #4db3ff;
  --blue-soft: #8bd4ff;
  --cyan: #1d7aa8;
  --green: #7cdda3;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 211, 110, 0.9), transparent 30%),
    radial-gradient(circle at top right, rgba(127, 194, 255, 0.6), transparent 26%),
    linear-gradient(160deg, #f9f3e8 0%, #eef8ff 55%, #f5efe3 100%);
}

body.theme-dark {
  background:
    radial-gradient(circle at top left, rgba(44, 88, 124, 0.65), transparent 30%),
    radial-gradient(circle at top right, rgba(10, 59, 96, 0.48), transparent 26%),
    linear-gradient(160deg, #09131b 0%, #10202d 55%, #0b1621 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent);
  pointer-events: none;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

body.app-mode .app-shell {
  width: min(1120px, calc(100% - 18px));
  padding-top: 14px;
  padding-bottom: 22px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 24px 4px 32px;
}

body.app-mode .hero {
  gap: 16px;
  align-items: center;
  padding: 8px 2px 16px;
}

.eyebrow,
.card-kicker,
.metric-label,
.location-label,
.legend,
.status,
.search-label {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.eyebrow {
  color: var(--green);
  margin-bottom: 10px;
  font-weight: 700;
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-family: "Instrument Serif", serif;
  font-size: clamp(3rem, 8vw, 5.6rem);
  line-height: 0.95;
  font-weight: 400;
}

body.app-mode h1 {
  max-width: 16ch;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
}

.hero-copy {
  max-width: 42ch;
  margin: 16px 0 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

body.app-mode .hero-copy {
  display: none;
}

body.app-mode .eyebrow {
  margin-bottom: 4px;
}

.layout {
  display: grid;
  gap: 18px;
}

.top-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 14px;
}

.theme-switcher,
.favorites,
.notifications {
  padding: 22px;
}

.theme-buttons,
.favorites-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.theme-button,
.favorite-chip,
.favorite-remove {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
}

body.theme-dark .theme-button,
body.theme-dark .favorite-chip,
body.theme-dark .favorite-remove {
  background: rgba(255, 255, 255, 0.05);
}

.theme-button {
  padding: 10px 14px;
  font-weight: 700;
}

.theme-button.is-active {
  background: linear-gradient(135deg, #0b7dff, #24b3ff);
  color: white;
  border-color: transparent;
}

.favorite-actions {
  margin-top: 18px;
}

.favorites-empty,
.location-meta {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.location-meta {
  margin-top: 8px;
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-chip,
.favorite-remove {
  padding: 10px 14px;
}

.favorite-chip {
  font-weight: 700;
}

.favorite-remove {
  padding-inline: 12px;
}

.install-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin: 0 4px 14px;
  padding: 18px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(24, 134, 255, 0.12), rgba(255, 211, 110, 0.24));
  border: 1px solid rgba(24, 134, 255, 0.12);
  box-shadow: var(--shadow);
}

.ios-card {
  background: linear-gradient(135deg, rgba(255, 211, 110, 0.2), rgba(255, 255, 255, 0.75));
}

.install-copy {
  margin: 0;
  color: var(--ink-soft);
  max-width: 38ch;
}

.site-footer {
  padding: 18px 6px 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

body.app-mode .site-footer {
  padding-top: 8px;
  font-size: 0.8rem;
  opacity: 0.7;
}

.site-footer p {
  margin: 0;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 4px 4px;
}

body.app-mode .quick-picks {
  gap: 8px;
  padding-bottom: 0;
}

.city-pill {
  border: 1px solid rgba(18, 48, 71, 0.08);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1.3fr;
  gap: 18px;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card::after {
  content: "";
  position: absolute;
  inset: auto -10% -35% auto;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(127, 194, 255, 0.28), transparent 70%);
  pointer-events: none;
}

.search-card,
.install-guide-card,
.current-card,
.radar-card,
.map-card,
.hourly-card,
.advice-card,
.daily-card {
  padding: 22px;
}

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

.install-step {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(18, 48, 71, 0.06);
}

.install-step h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.install-step p {
  margin: 0 0 8px;
  color: var(--ink-soft);
}

.install-note {
  margin: 16px 0 0;
  color: var(--ink-soft);
}

.search-form {
  display: grid;
  gap: 10px;
}

.search-row {
  display: flex;
  gap: 12px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 15px 18px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

input:focus {
  outline: 2px solid rgba(24, 134, 255, 0.18);
  border-color: rgba(24, 134, 255, 0.4);
}

button {
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  padding: 14px 18px;
  font-weight: 700;
}

.primary-button {
  border: none;
  color: white;
  background: linear-gradient(135deg, #0b7dff, #24b3ff);
  box-shadow: 0 12px 24px rgba(24, 134, 255, 0.24);
}

.ghost-button {
  border: 1px solid rgba(18, 48, 71, 0.12);
  background: rgba(255, 249, 239, 0.76);
  color: var(--ink);
}

.status {
  margin: 12px 2px 0;
  color: var(--ink-soft);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title,
.location-label {
  margin: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
}

.location-label,
.card-kicker,
.metric-label,
.legend,
.status,
.search-label {
  color: var(--ink-soft);
}

.current-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 20px;
}

.temperature {
  margin: 0;
  font-size: clamp(3rem, 7vw, 5rem);
  line-height: 0.9;
  font-weight: 700;
}

.summary {
  margin: 10px 0 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

.weather-badge {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(185, 236, 255, 0.9));
  box-shadow: inset 0 1px 0 white;
}

.weather-emoji {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

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

.metrics div,
.hour-chip {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(18, 48, 71, 0.06);
}

.metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
}

.rain-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
  min-height: 220px;
  margin-top: 22px;
}

.rain-bar {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.rain-bar-fill {
  width: 100%;
  min-width: 18px;
  border-radius: 999px 999px 12px 12px;
  background: linear-gradient(180deg, var(--cyan), var(--blue));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.rain-bar-label,
.rain-bar-value {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.rain-bar-label {
  min-height: 2.6em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  text-align: center;
  line-height: 1.1;
  font-weight: 700;
  transform: rotate(-18deg);
  transform-origin: center bottom;
}

.rain-bar.is-muted .rain-bar-label,
.rain-bar.is-muted .rain-bar-value {
  opacity: 0.45;
}

.rain-bar:not(.is-muted) .rain-bar-label {
  color: var(--ink);
}

.radar-map {
  width: 100%;
  height: 320px;
  margin-top: 22px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(18, 48, 71, 0.08);
}

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

.radar-time {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.map-note {
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.legend {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.hourly-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.hour-chip {
  display: grid;
  gap: 8px;
  text-align: center;
}

.hour-chip p {
  margin: 0;
}

.hour-time {
  font-weight: 700;
}

.hour-icon {
  font-size: 1.8rem;
}

.hour-rain {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.advice-card {
  background:
    radial-gradient(circle at top right, rgba(255, 211, 110, 0.35), transparent 32%),
    linear-gradient(135deg, rgba(255, 249, 239, 0.95), rgba(236, 247, 255, 0.92));
}

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

.daily-stats div {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(18, 48, 71, 0.06);
}

.daily-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 1.08rem;
}

.advice-text {
  margin: 22px 0 0;
  max-width: 34ch;
  font-size: 1.2rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .hero,
  .top-tools,
  .grid,
  .search-row,
  .install-card {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero {
    padding-top: 10px;
  }

  .ghost-button,
  .primary-button {
    width: 100%;
  }

  .current-main {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 20px, 1000px);
    padding-bottom: 28px;
  }

  body.app-mode .app-shell {
    width: min(100% - 12px, 1000px);
    padding-top: 8px;
    padding-bottom: 18px;
  }

  .search-card,
  .theme-switcher,
  .favorites,
  .notifications,
  .install-guide-card,
  .current-card,
  .radar-card,
  .map-card,
  .hourly-card,
  .advice-card,
  .daily-card {
    padding: 18px;
  }

  .metrics,
  .install-guide,
  .daily-stats {
    grid-template-columns: 1fr;
  }

  .rain-chart {
    gap: 7px;
    min-height: 180px;
  }

  .rain-bar-label,
  .rain-bar-value {
    font-size: 0.68rem;
  }

  .rain-bar-label {
    transform: rotate(-12deg);
  }

  .radar-map {
    height: 280px;
  }

  .radar-controls {
    grid-template-columns: 1fr;
    display: grid;
  }
}
