:root {
  --ink: #10160f;
  --ink-2: #182116;
  --paper: #f3ead8;
  --muted: #b7c2b0;
  --gold: #e4b36a;
  --peach: #f0a36c;
  --dew: #7fd4c1;
  --dew-deep: #1f6f62;
  --rain: #6aa8ff;
  --rain-deep: #2b5ea8;
  --glass: rgba(20, 30, 22, 0.62);
  --stroke: rgba(243, 234, 216, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --sans: "Figtree", "Segoe UI", system-ui, sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
}

body {
  min-height: 100dvh;
  line-height: 1.45;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(228, 179, 106, 0.28), transparent 55%),
    radial-gradient(700px 480px at 110% 8%, rgba(127, 212, 193, 0.16), transparent 50%),
    radial-gradient(800px 600px at 50% 120%, rgba(42, 90, 160, 0.22), transparent 55%),
    linear-gradient(180deg, #141c13 0%, #0d130c 100%);
  transition: background 0.6s ease;
}

body.is-storm .atmosphere {
  background:
    radial-gradient(800px 480px at 20% -10%, rgba(90, 140, 210, 0.28), transparent 55%),
    radial-gradient(700px 500px at 100% 20%, rgba(40, 70, 120, 0.35), transparent 50%),
    linear-gradient(180deg, #10161c 0%, #0b1014 100%);
}

body.is-hot .atmosphere {
  background:
    radial-gradient(900px 520px at 8% -8%, rgba(240, 163, 108, 0.38), transparent 52%),
    radial-gradient(600px 400px at 90% 0%, rgba(228, 179, 106, 0.18), transparent 50%),
    linear-gradient(180deg, #1a1710 0%, #10140e 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.shell {
  position: relative;
  z-index: 2;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px max(0px, env(safe-area-inset-right)) max(64px, env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left));
}

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

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

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

.mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background:
    radial-gradient(circle at 32% 34%, var(--gold) 0 7px, transparent 8px),
    linear-gradient(160deg, #2a4634, #1b2d22);
  box-shadow: inset 0 0 0 1px var(--stroke);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 620;
  letter-spacing: -0.02em;
}

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

.search-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 280px;
  min-width: 0;
  justify-content: flex-end;
}

.now-place {
  flex: none;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--paper);
  white-space: nowrap;
}

.search {
  position: relative;
  width: min(320px, 100%);
  flex: 1 1 180px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 14px 10px 16px;
  backdrop-filter: blur(16px);
}

.search-icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  flex: none;
}

#city-query {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--paper);
  font: 500 1rem var(--sans);
  min-width: 0;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}

#city-query::-webkit-search-decoration,
#city-query::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

#city-query::placeholder { color: #8c9788; }

.clear-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.suggest {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  list-style: none;
  background: #1a2319;
  border: 1px solid var(--stroke);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.suggest li button {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--paper);
  font: 500 0.92rem var(--sans);
  padding: 12px 16px;
  cursor: pointer;
}

.suggest li button:hover,
.suggest li button:focus {
  background: rgba(228, 179, 106, 0.12);
  outline: none;
}

.suggest .meta {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.status {
  min-height: 1.3em;
  margin: 14px 0 6px;
  color: var(--gold);
  font-size: 0.88rem;
}

.status:empty {
  display: none;
  min-height: 0;
  margin: 0;
}

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 280px);
  gap: 22px;
  margin-top: 8px;
  align-items: stretch;
}

.hero-main {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025));
  border: 1px solid var(--stroke);
  border-radius: 28px;
  padding: 28px 30px 26px;
  box-shadow: var(--shadow);
}

.place-kicker {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.place {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 620;
  letter-spacing: -0.03em;
  margin: 4px 0 18px;
}

.temp-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.glyph {
  width: 64px;
  height: 64px;
  margin-right: 6px;
  flex: none;
}

.glyph svg { width: 100%; height: 100%; }

.temp {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(5.2rem, 12vw, 7.4rem);
  font-weight: 700;
  line-height: 0.82;
  letter-spacing: -0.05em;
}

.deg {
  font-family: var(--serif);
  font-size: 1.6rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.desc {
  margin-top: 18px;
  font-size: 1.2rem;
  font-weight: 600;
}

.feels {
  color: var(--muted);
  margin-top: 4px;
}

.dew {
  background:
    radial-gradient(circle at 80% 0%, rgba(127, 212, 193, 0.28), transparent 50%),
    linear-gradient(180deg, #1c332c, #14241f);
  border: 1px solid rgba(127, 212, 193, 0.28);
  border-radius: 28px;
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

.dew-label {
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--dew);
  font-weight: 700;
}

.dew-value {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 7vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 18px 0;
}

.dew-unit {
  font-size: 1.3rem;
  margin-left: 4px;
  color: var(--dew);
}

.dew-note {
  color: #c5e6dc;
  font-size: 0.92rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0 28px;
}

.stat {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 16px 18px;
  backdrop-filter: blur(12px);
}

.stat.highlight {
  border-color: rgba(127, 212, 193, 0.35);
  background: rgba(31, 111, 98, 0.22);
}

.stat-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat-value {
  margin-top: 8px;
  font-size: 1.28rem;
  font-weight: 650;
}

.chart-panel,
.map-panel,
.week-panel {
  background: rgba(16, 24, 17, 0.55);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  margin-bottom: 18px;
}

.chart-panel-top {
  margin-top: 8px;
}

.chart-temps {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 0 5.71% 0 5.71%;
  margin-bottom: -6px;
  position: relative;
  z-index: 2;
}
.chart-temp {
  text-align: center;
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.chart-temp .hi { color: #c5c9c2; }
.chart-temp .slash { color: #9aa89a; margin: 0 1px; }
.chart-temp .lo { color: #8ec6ff; }

.chart-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 4px;
  padding: 0 5.71%;
}

.chart-day {
  text-align: center;
}

.chart-day-name {
  color: var(--paper);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.chart-day-dew {
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
  margin-top: 2px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

h2 {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 620;
}

.panel-sub,
.legend {
  color: var(--muted);
  font-size: 0.86rem;
}

.legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.legend-swatch.chance { background: linear-gradient(180deg, #8ec6ff, #3d7ad4); }
.legend-swatch.temp { background: #9aa09a; }
.legend-swatch.dew-ok { background: #22c55e; }
.legend-swatch.dew-warm { background: #f59e0b; }
.legend-swatch.dew-hot { background: #ef4444; }

.chart-wrap {
  width: 100%;
  min-height: 280px;
}

.chart-wrap svg { width: 100%; height: auto; display: block; }

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.day {
  background: rgba(255,255,255,0.035);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 14px 12px 16px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day.is-today {
  background: rgba(228, 179, 106, 0.1);
  border-color: rgba(228, 179, 106, 0.38);
}

.day-name {
  font-size: 1.12rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper);
  font-weight: 800;
}

.day-glyph { width: 42px; height: 42px; }
.day-glyph svg { width: 100%; height: 100%; }

.day-temps {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 620;
}

.day-temps span { color: var(--muted); font-size: 1rem; }

.day-cond {
  font-size: 0.88rem;
  color: var(--paper);
  min-height: 2.5em;
}

.day-precip {
  margin-top: auto;
  font-size: 0.82rem;
  color: #c9d9f2;
}

.day-precip strong { color: var(--rain); font-weight: 700; }

.foot {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 10px;
}

.skel {
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: shine 1.2s linear infinite;
  border-radius: 8px;
  color: transparent !important;
}

@keyframes shine {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .week {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }
  .day {
    flex: 0 0 148px;
    scroll-snap-align: start;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(calc(100% - 16px), 1120px);
    padding-top: 2px;
    padding-bottom: max(40px, env(safe-area-inset-bottom));
  }
  .top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand place"
      "search search";
    column-gap: 10px;
    row-gap: 6px;
    align-items: center;
  }
  .brand { grid-area: brand; min-width: 0; }
  .tag { display: none; }
  .mark { width: 28px; height: 28px; border-radius: 9px; }
  .wordmark { font-size: 1rem; }
  .chart-panel-top { margin-top: 0; }
  .status { min-height: 0; margin: 0; }
  .search-cluster { display: contents; }
  .now-place {
    grid-area: place;
    font-size: 0.98rem;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .search { grid-area: search; width: 100%; flex: none; }
  .search-field { padding: 8px 12px; }
  .panel-head { margin-bottom: 2px; }
  .hero-main { padding: 22px 18px; border-radius: 22px; }
  .temp { font-size: clamp(3.6rem, 22vw, 5rem); }
  .chart-panel,
  .map-panel,
  .week-panel { padding: 14px 12px 12px; }
  .chart-temps {
    margin-bottom: 0;
    gap: 0;
  }
  .chart-temp {
    font-size: 0.78rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.15;
  }
  .chart-temp .hi { font-size: 0.9rem; }
  .chart-temp .slash { display: none; }
  .chart-temp .lo { font-size: 0.78rem; }
  .chart-days, .chart-temps { padding-left: 5.71%; padding-right: 5.71%; }
  .chart-day-name { font-size: 0.78rem; font-weight: 800; }
  .chart-day-dew { font-size: 0.78rem; margin-top: 1px; }
  .chart-wrap { min-height: 220px; }
  .legend { font-size: 0.75rem; gap: 6px; }
  .day-name { font-size: 1.05rem; }
}

.radar-map {
  height: min(52vw, 360px);
  min-height: 240px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: #f7f4ec;
}

.radar-toggle {
  border: 1px solid var(--stroke);
  background: var(--glass);
  color: var(--paper);
  font: 700 0.88rem var(--sans);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
}

.leaflet-container {
  background: #ffffff;
  font-family: var(--sans);
}

.leaflet-control-zoom a {
  background: #ffffff !important;
  color: #1a2319 !important;
  border: 1px solid rgba(16, 22, 15, 0.2) !important;
}

@media (max-width: 560px) {
  .radar-map { height: 260px; min-height: 220px; }
}
