:root {
  --card-strong: rgba(250, 251, 255, 0.97);
  --line: rgba(23, 39, 81, 0.08);
  --text: #1a2852;
  --muted: #62739a;
  --shadow: 0 20px 50px rgba(42, 72, 91, 0.18);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 28%),
    linear-gradient(135deg, #dff3d9 0%, #bde0ab 40%, #b5d6ee 100%);
}
body { overflow: hidden; }
button, input { font: inherit; }
.hidden { display: none !important; }

.glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 430px);
  min-height: 100vh;
}
.map-pane { position: relative; overflow: hidden; }
.map-backdrop {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 255, 255, 0.65), transparent 17%),
    radial-gradient(circle at 76% 32%, rgba(247, 248, 188, 0.42), transparent 18%),
    linear-gradient(135deg, rgba(111, 199, 134, 0.22), rgba(43, 102, 197, 0.14));
}

.topbar {
  position: absolute; z-index: 30; top: 18px; left: 18px; right: 18px;
  display: flex; align-items: center; gap: 18px; padding: 12px 14px; border-radius: 999px;
}
.brand {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); white-space: nowrap;
}
.brand-mark {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, #294fe8, #5f90ff); color: #fff; font-weight: 800; font-size: 24px;
}
.brand-text { display: flex; flex-direction: column; line-height: .95; font-size: 14px; }
.brand-text strong { font-size: 18px; }

.search-wrap { position: relative; flex: 1; display: flex; align-items: center; gap: 10px; }
.search-field {
  flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 16px; height: 52px;
  border-radius: 999px; background: rgba(245, 248, 255, 0.9); border: 1px solid rgba(126, 145, 192, 0.18);
}
.search-field svg, .locate-btn svg { width: 20px; height: 20px; fill: #7190ff; flex: none; }
.search-field input { width: 100%; border: 0; background: transparent; outline: none; color: var(--text); }
.search-field input::placeholder { color: #8292b8; }

.locate-btn, .save-btn, .link-btn, .layer-chip {
  border: 0; cursor: pointer; transition: transform .2s ease, background .2s ease, color .2s ease;
}
.locate-btn {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #6c8cff, #5070eb);
}
.locate-btn svg { fill: #fff; }

.search-results {
  position: absolute; top: calc(100% + 10px); left: 0; right: 62px; overflow: hidden; border-radius: 24px;
  background: rgba(255, 255, 255, 0.94); box-shadow: 0 20px 48px rgba(27, 43, 88, 0.18); border: 1px solid rgba(126, 145, 192, 0.18);
}
.search-result { display: block; width: 100%; padding: 14px 18px; text-align: left; border: 0; background: transparent; cursor: pointer; }
.search-result:hover { background: rgba(84, 123, 246, 0.08); }
.search-result strong { display: block; font-size: 15px; }
.search-result span { color: var(--muted); font-size: 13px; }

.map { position: absolute; inset: 0; z-index: 1; }
.leaflet-container { background: #d8efe5; font: inherit; }
.leaflet-control-attribution {
  background: rgba(255,255,255,.75); border-radius: 999px; padding: 4px 10px !important;
}

.map-controls, .map-city-card { position: absolute; z-index: 25; }
.map-controls { left: 18px; bottom: 24px; display: flex; align-items: flex-end; gap: 14px; }
.layer-stack {
  display: flex; flex-wrap: wrap; gap: 10px; padding: 10px; border-radius: 24px; max-width: min(62vw, 560px);
}
.layer-chip {
  padding: 11px 16px; border-radius: 999px; background: rgba(30, 44, 85, 0.08); color: var(--text); font-weight: 700;
}
.layer-chip.is-active, .layer-chip:hover {
  background: linear-gradient(135deg, #587df7, #55c9b7); color: #fff; transform: translateY(-1px);
}
.legend { min-width: 170px; padding: 14px 16px; border-radius: 20px; }
.legend-title, .eyebrow, .map-city-eyebrow {
  color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 700;
}
.legend-value { margin-top: 4px; font-size: 22px; font-weight: 800; }

.map-city-card { top: 92px; left: 18px; padding: 16px 18px; border-radius: 24px; min-width: 220px; max-width: 320px; }
.map-city-name { font-size: 28px; font-weight: 800; line-height: 1; }
.map-city-meta, .section-meta, .place-subtitle, .stat-sub, .hourly-meta, .hourly-time, .daily-desc, .daily-rain, .saved-city-meta, .empty-state {
  color: var(--muted);
}

.sidebar {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, rgba(245,247,252,.88), rgba(240,244,251,.96));
  border-left: 1px solid rgba(255,255,255,.45);
}
.sidebar-inner {
  height: 100vh; overflow-y: auto; padding: 22px 22px 28px; display: grid; align-content: start; gap: 18px;
}
.hero-card, .panel-card {
  background: var(--card-strong); border-radius: 30px; border: 1px solid var(--line); box-shadow: 0 16px 30px rgba(33, 51, 98, 0.08);
}
.hero-card {
  padding: 22px;
  background:
    radial-gradient(circle at top right, rgba(112, 141, 255, 0.16), transparent 28%),
    radial-gradient(circle at bottom left, rgba(84, 208, 180, 0.18), transparent 32%), var(--card-strong);
}
.hero-head, .section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hero-head h1, .section-head h2 { margin: 0; }
.hero-head h1 { font-size: clamp(26px, 3vw, 38px); }
.place-subtitle { margin: 6px 0 0; font-size: 14px; }
.save-btn, .link-btn {
  padding: 11px 16px; border-radius: 999px; background: rgba(84, 123, 246, 0.1); color: #4565da; font-weight: 700;
}
.link-btn { padding-inline: 0; background: transparent; }

.hero-main { margin-top: 20px; display: grid; gap: 20px; }
.hero-icon-wrap { display: flex; align-items: center; gap: 18px; }
.hero-icon {
  width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center; font-size: 50px;
  background: linear-gradient(135deg, rgba(109, 134, 255, 0.18), rgba(84, 208, 180, 0.16));
}
.hero-temp { font-size: clamp(48px, 7vw, 68px); font-weight: 800; line-height: .95; }
.hero-summary { margin-top: 6px; font-size: 16px; color: var(--muted); }

.hero-metrics, .panel-grid { display: grid; gap: 12px; }
.hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-box, .panel-stat {
  padding: 16px 18px; border-radius: 18px; background: rgba(242, 246, 252, 0.84); border: 1px solid rgba(113, 130, 177, 0.12);
}
.metric-box span, .panel-stat .section-meta { font-size: 13px; }
.metric-box strong, .stat-value { display: block; margin-top: 8px; font-size: 22px; }

.panel-card { padding: 20px; }
.section-head { margin-bottom: 16px; }
.section-head h2 { font-size: 18px; }

.hourly-list {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(74px, 1fr);
  gap: 12px; overflow-x: auto; padding-bottom: 4px;
}
.hourly-item {
  padding: 14px 12px; border-radius: 22px; background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(237,242,250,.92));
  border: 1px solid rgba(113, 130, 177, 0.11); text-align: center;
}
.hourly-item strong { display: block; margin-top: 10px; font-size: 18px; }
.hourly-icon { margin-top: 12px; font-size: 24px; }

.panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.daily-list { display: grid; gap: 10px; }
.daily-item {
  display: grid; grid-template-columns: 1.3fr 72px 1fr 1fr; gap: 10px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.daily-item:first-child { border-top: 0; padding-top: 0; }
.daily-name, .saved-city-name { font-weight: 700; }
.daily-temp { text-align: right; font-weight: 800; }

.saved-places { display: grid; gap: 10px; }
.saved-place {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-radius: 18px;
  background: rgba(241, 245, 253, 0.84); border: 1px solid rgba(113, 130, 177, 0.1);
}
.saved-place button { border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.saved-remove { color: #8b96ba !important; font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1000; padding: 14px 18px;
  border-radius: 999px; background: rgba(26, 40, 82, 0.94); color: #fff; box-shadow: 0 16px 30px rgba(27, 43, 88, 0.3);
}

.weather-marker {
  width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, #567cf6, #54d0b4);
  border: 2px solid #fff; box-shadow: 0 0 0 10px rgba(84, 123, 246, 0.18);
}
.weather-pulse {
  width: 180px; height: 180px; margin-left: -90px; margin-top: -90px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(84, 208, 180, 0.18), rgba(84, 123, 246, 0.08), transparent 70%);
}

@media (max-width: 1180px) {
  body { overflow: auto; }
  .app-shell { grid-template-columns: 1fr; }
  .map-pane, .map, .map-backdrop { min-height: 52vh; }
  .sidebar-inner { height: auto; overflow: visible; padding-top: 16px; }
  .sidebar {
    border-left: 0; border-top: 1px solid rgba(255,255,255,.45); margin-top: -24px; border-radius: 30px 30px 0 0;
  }
  .map-city-card { top: auto; bottom: 122px; max-width: min(72vw, 320px); }
}

@media (max-width: 760px) {
  .topbar {
    top: 12px; left: 12px; right: 12px; padding: 10px; border-radius: 28px; gap: 10px;
  }
  .brand-text span { display: none; }
  .brand-text strong { font-size: 17px; }
  .search-field { height: 46px; padding-inline: 14px; }
  .locate-btn { width: 46px; height: 46px; }
  .map-pane, .map, .map-backdrop { min-height: 47vh; }
  .map-controls { left: 12px; right: 12px; bottom: 14px; display: grid; gap: 10px; }
  .layer-stack { max-width: none; overflow-x: auto; flex-wrap: nowrap; }
  .legend { min-width: 0; }
  .map-city-card { left: 12px; right: 12px; bottom: 136px; max-width: none; }
  .sidebar-inner { padding: 14px 14px 28px; }
  .hero-card, .panel-card { border-radius: 24px; }
  .hero-card, .panel-card, .panel-stat { padding: 16px; }
  .hero-metrics, .panel-grid, .daily-item { grid-template-columns: 1fr; }
  .hero-icon-wrap { align-items: flex-start; }
  .hero-icon { width: 80px; height: 80px; font-size: 42px; }
  .hourly-list { grid-auto-columns: minmax(82px, 1fr); }
  .daily-temp { text-align: left; }
}
