:root {
  --green: #167c5a;
  --green-dark: #0f5d45;
  --green-soft: #e7f6ef;
  --ink: #10231d;
  --muted: #66756f;
  --line: #dbe7e1;
  --bg: #f5faf7;
  --card: #ffffff;
  --danger: #c0392b;
  --shadow: 0 20px 60px rgba(15, 93, 69, 0.14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #dff5ea 0, transparent 35%), var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.hero {
  padding: 24px clamp(18px, 4vw, 64px) 56px;
  background:
    linear-gradient(135deg, rgba(22, 124, 90, 0.98), rgba(11, 76, 61, 0.95)),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.22), transparent 30%);
  color: white;
}

.nav,
.hero-grid,
main,
footer {
  max-width: 1180px;
  margin: 0 auto;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
}

.nav-links {
  display: flex;
  gap: 18px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 34px;
  align-items: center;
  padding-top: 58px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #6ed1a7;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lead {
  max-width: 680px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button.is-loading {
  position: relative;
  overflow: hidden;
}

.button.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  animation: shimmer 1.2s linear infinite;
}

.button.primary {
  color: white;
  background: var(--green);
  box-shadow: 0 12px 30px rgba(22, 124, 90, 0.24);
}

.hero .button.primary {
  background: white;
  color: var(--green-dark);
}

.button.secondary {
  color: var(--green-dark);
  background: #eef7f2;
}

.hero .button.secondary {
  color: white;
  background: rgba(255, 255, 255, 0.14);
}

.button.full { width: 100%; }

.hero-card {
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(16px);
}

.mini-label,
.card-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card .mini-label { color: rgba(255, 255, 255, 0.72); }

.hero-card strong {
  display: block;
  margin: 8px 0 24px;
  font-size: 30px;
}

.mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-grid span {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  font-weight: 700;
}

main { padding: 34px clamp(18px, 4vw, 64px) 56px; }

.panel {
  margin-top: 28px;
  padding: clamp(20px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.section-heading h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.035em;
}

.section-heading p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  margin: 24px 0 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 16px;
  font: inherit;
  background: white;
}

input::placeholder,
textarea::placeholder {
  color: #9aaba3;
  opacity: 1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 22px;
}

.chip,
.map-action-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--green-dark);
  background: white;
  font-weight: 800;
  cursor: pointer;
}

.map-shell {
  margin: 22px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: #f7fbf9;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.map-toolbar h3 {
  margin: 0;
  font-size: 22px;
}

.map-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.map-action-button.active {
  color: white;
  background: var(--green);
}

.map-status,
.map-note {
  color: var(--muted);
  font-size: 13px;
}

.air-map {
  height: min(56vh, 520px);
  min-height: 340px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.air-map.picking { cursor: crosshair; }

.map-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid white;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.map-marker.user { background: #1a73e8; }
.map-marker.station { background: #f2b705; }

.popup-title {
  margin: 0 0 4px;
  font-weight: 800;
}

.popup-meta {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
}

.card h3 {
  margin: 8px 0 16px;
  font-size: 22px;
}

.metric {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 12px 0 6px;
}

.metric span {
  color: var(--green);
  font-size: 58px;
  font-weight: 900;
  letter-spacing: -0.08em;
}

.level {
  display: inline-flex;
  padding: 7px 11px;
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 800;
}

.details {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf2ef;
  padding-bottom: 8px;
}

dt { color: var(--muted); }
dd { margin: 0; font-weight: 800; text-align: right; }

.advice,
.weather-current,
.ai-answer {
  color: var(--muted);
  line-height: 1.6;
}

.forecast-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.forecast-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  background: #f2f8f5;
}

.forecast-item span {
  color: var(--muted);
  font-size: 14px;
}

.ai-card textarea { margin-bottom: 12px; }

.ai-answer {
  min-height: 120px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: #f2f8f5;
  white-space: pre-wrap;
}

.ai-answer.thinking {
  color: var(--green-dark);
  background:
    radial-gradient(circle at 10% 20%, rgba(110, 209, 167, 0.35), transparent 28%),
    linear-gradient(135deg, #eefaf4, #ffffff);
  border: 1px solid #cfeee0;
  box-shadow: inset 0 0 0 1px rgba(22, 124, 90, 0.06);
}

.thinking-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 80px;
  font-weight: 800;
}

.thinking-orb {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(22, 124, 90, 0.36);
  animation: pulse 1.35s ease-in-out infinite;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--green);
  animation: bounce-dot 1.1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.32s; }

@keyframes pulse {
  0%, 100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(22, 124, 90, 0.36); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 12px rgba(22, 124, 90, 0); }
}

@keyframes bounce-dot {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
  40% { transform: translateY(-5px); opacity: 1; }
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.loading,
.error {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 800;
}

.loading {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  margin: 0;
  color: var(--green-dark);
  background: var(--green-soft);
  box-shadow: 0 16px 42px rgba(15, 93, 69, 0.18);
}

.error {
  color: var(--danger);
  background: #fff0ee;
}

.hidden { display: none; }

.api-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

code,
.inline-code {
  display: block;
  padding: 12px;
  border-radius: 14px;
  background: #0f231d;
  color: #d9f7e8;
  overflow-x: auto;
}

.mcp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.mcp-output {
  min-height: 180px;
  overflow: auto;
  border-radius: 18px;
  padding: 16px;
  background: #0f231d;
  color: #d9f7e8;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(18px, 4vw, 64px) 40px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 880px) {
  .hero-grid,
  .cards,
  .api-grid {
    grid-template-columns: 1fr;
  }

  .nav,
  .map-toolbar,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-box {
    grid-template-columns: 1fr;
  }

  .nav-links {
    flex-wrap: wrap;
  }
}
