:root {
  color-scheme: light;
  --bg: #f7f4ec;
  --panel: #fffaf0;
  --panel-strong: #10291f;
  --ink: #14231b;
  --muted: #67736b;
  --line: rgba(20, 35, 27, 0.13);
  --leaf: #2f7d4f;
  --leaf-dark: #155c38;
  --moss: #9bbf63;
  --gold: #e9b44c;
  --terracotta: #d46a4c;
  --shadow: 0 18px 50px rgba(28, 46, 35, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(155, 191, 99, 0.28), transparent 28rem),
    linear-gradient(135deg, #f7f4ec 0%, #eef2df 48%, #f8efe7 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(14rem, 21rem) minmax(18rem, 42rem);
  gap: 1rem;
  align-items: center;
  padding: 1rem clamp(1rem, 3vw, 2.4rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-strong);
  color: #f5e8c8;
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(16, 41, 31, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.03rem;
  letter-spacing: 0.02em;
}

.brand small {
  color: var(--muted);
  margin-top: 0.1rem;
}

.city-search {
  display: flex;
  min-width: 0;
  background: rgba(255, 250, 240, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem;
  box-shadow: 0 8px 28px rgba(28, 46, 35, 0.08);
  backdrop-filter: blur(12px);
}

.city-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
}

.city-search button {
  border: 0;
  border-radius: 7px;
  padding: 0.72rem 1rem;
  background: var(--leaf-dark);
  color: #fff7e8;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(22rem, 28rem);
  gap: 1rem;
  height: calc(100vh - 5rem);
  padding: 0 clamp(1rem, 3vw, 2.4rem) 1rem;
}

.map-panel,
.side-panel {
  min-height: 0;
}

.map-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #dfe9d3;
  box-shadow: var(--shadow);
}

#map {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 32rem;
  background: #cfe2d7;
  touch-action: manipulation;
}

.country-shape {
  cursor: pointer;
  vector-effect: non-scaling-stroke;
  transition:
    fill 160ms ease,
    fill-opacity 160ms ease,
    stroke 160ms ease;
}

.country-shape:hover,
.country-shape:focus {
  stroke: #10291f;
  stroke-width: 2;
  outline: none;
}

.city-point {
  fill: var(--terracotta);
  stroke: #10291f;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.map-legend {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 10px 28px rgba(20, 35, 27, 0.12);
  font-size: 0.78rem;
}

.map-status {
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: 600;
  max-width: calc(100% - 2rem);
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.58rem 0.8rem;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 0 8px 24px rgba(20, 35, 27, 0.14);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.map-status[hidden] {
  display: none;
}

.legend-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.35rem;
  border-radius: 999px;
  vertical-align: -0.05rem;
}

.legend-dot.exact {
  background: var(--leaf);
}

.legend-dot.near {
  background: var(--gold);
}

.legend-dot.dim {
  background: #7d9084;
}

.side-panel {
  overflow: auto;
  padding-right: 0.25rem;
}

.climate-card,
.filters,
.regions,
.plants {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.86);
  box-shadow: 0 10px 32px rgba(28, 46, 35, 0.08);
}

.climate-card {
  padding: 1.1rem;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--leaf-dark);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  line-height: 1.02;
}

.climate-card p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}

.metric-grid div {
  min-width: 0;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.45);
}

.metric-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.metric-grid strong {
  display: block;
  margin-top: 0.18rem;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.filters {
  margin-top: 0.75rem;
  padding: 0.9rem;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.74rem;
  background: #fffdf7;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  font-size: 0.84rem;
}

.chip.active {
  border-color: rgba(21, 92, 56, 0.32);
  background: var(--leaf-dark);
  color: #fff8e8;
}

.country-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.country-filter button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--leaf-dark);
  cursor: pointer;
  font-weight: 850;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.95rem 0.45rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.76rem;
  white-space: nowrap;
}

.plants .section-title {
  align-items: flex-start;
}

.plants .section-title span {
  max-width: 68%;
  white-space: normal;
  text-align: right;
}

.regions,
.plants {
  margin-top: 0.75rem;
}

.regions-list,
.plants-list {
  display: grid;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem 0.9rem;
}

.region-card,
.plant-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  padding: 0.78rem;
}

.region-card {
  cursor: pointer;
}

.region-card.active {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 2px rgba(212, 106, 76, 0.14);
}

.region-card:hover,
.plant-card:hover {
  border-color: rgba(47, 125, 79, 0.45);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.card-top strong {
  display: block;
  line-height: 1.25;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 0.22rem 0.48rem;
  background: rgba(47, 125, 79, 0.12);
  color: var(--leaf-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.subtle {
  color: var(--muted);
  font-size: 0.8rem;
}

.plant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
}

.plant-meta span {
  border-radius: 999px;
  background: rgba(16, 41, 31, 0.07);
  padding: 0.26rem 0.48rem;
  color: #31453a;
  font-size: 0.72rem;
  font-weight: 750;
}

.empty {
  color: var(--muted);
  line-height: 1.45;
  padding: 0.5rem 0.2rem;
}

.loading {
  opacity: 0.72;
}

@media (max-width: 980px) {
  .topbar,
  .layout {
    grid-template-columns: 1fr;
  }

  .layout {
    height: auto;
  }

  .map-panel {
    min-height: 58vh;
  }

  .side-panel {
    overflow: visible;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0.8rem;
  }

  .city-search {
    display: grid;
  }

  .city-search button {
    width: 100%;
  }

  .layout {
    padding: 0 0.8rem 0.8rem;
  }

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

  .map-legend {
    right: 0.65rem;
    left: 0.65rem;
    bottom: 0.65rem;
  }
}
