:root {
  --env-ink: #17334f;
  --env-muted: #607086;
  --env-line: rgba(33, 84, 129, .17);
  --env-blue: #286aa6;
  --env-teal: #16898d;
  --env-green: #4c8b62;
  --env-amber: #e0a431;
  --env-orange: #e9783f;
  --env-red: #c84650;
  --env-paper: rgba(255, 255, 255, .94);
}

.environment-page main {
  display: grid;
  width: min(1380px, calc(100% - 28px));
  gap: 18px;
  margin: 0 auto 34px;
}

.environment-page .svc-hero {
  width: min(1380px, calc(100% - 28px));
}

.environment-tabs {
  display: grid;
  width: min(1380px, calc(100% - 28px));
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin: 0 auto 18px;
  padding: 10px;
  border: 1px solid var(--env-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 26px rgba(23, 51, 79, .08);
}

.environment-tabs a {
  display: flex;
  min-width: 0;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 11px;
  border: 1px solid rgba(37, 94, 145, .17);
  border-radius: 13px;
  background: #f4f8fc;
  color: #24558c;
  font-size: .84rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.environment-tabs a:hover,
.environment-tabs a:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(22, 137, 141, .48);
  background: #e9f6f5;
}

.environment-tabs a.is-current {
  border-color: transparent;
  background: linear-gradient(135deg, #315a9c, #148a8f);
  color: #fff;
  box-shadow: 0 8px 18px rgba(35, 87, 145, .22);
}

.environment-page .svc-controls,
.env-panel {
  margin: 0;
  border: 1px solid var(--env-line);
  border-radius: 20px;
  background: var(--env-paper);
  box-shadow: 0 12px 30px rgba(31, 61, 91, .08);
}

.environment-page .svc-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 14px;
  padding: 18px;
}

.env-place-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 10px;
}

.env-field {
  display: grid;
  min-width: 0;
  gap: 6px;
  color: #3d5570;
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.env-field input,
.env-field select,
.env-filter {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(37, 94, 145, .28);
  border-radius: 12px;
  background: #fff;
  color: var(--env-ink);
  font: 750 .96rem/1.25 system-ui, sans-serif;
}

.env-field input,
.env-field select { padding: 0 13px; }
.env-filter { padding: 0 13px; }

.env-submit,
.env-location,
.env-refresh {
  min-height: 46px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #315a9c, #16898d);
  color: #fff;
  font: 850 .9rem/1 system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 7px 17px rgba(37, 94, 145, .2);
}

.env-location {
  border: 1px solid rgba(37, 94, 145, .22);
  background: #eef5fb;
  color: #285684;
  box-shadow: none;
}

.env-submit:hover,
.env-submit:focus-visible,
.env-refresh:hover,
.env-refresh:focus-visible { filter: brightness(1.08); }

.env-location:hover,
.env-location:focus-visible { background: #e0f1f2; }

.env-place-results {
  position: absolute;
  z-index: 1200;
  display: grid;
  width: min(600px, calc(100vw - 48px));
  max-height: 280px;
  gap: 3px;
  margin-top: 5px;
  overflow: auto;
  padding: 7px;
  border: 1px solid rgba(37, 94, 145, .25);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(23, 51, 79, .2);
}

.env-place-results:empty { display: none; }
.env-place-results button {
  padding: 10px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--env-ink);
  font: 750 .9rem/1.25 system-ui, sans-serif;
  text-align: left;
  cursor: pointer;
}
.env-place-results button:hover,
.env-place-results button:focus-visible { background: #edf6f7; }

.env-status-wrap { min-width: 230px; text-align: right; }
.env-selected { margin: 0; color: var(--env-ink); font-weight: 850; }
.env-status { margin: 4px 0 0; color: var(--env-muted); font-size: .82rem; }
.env-status[data-tone="error"] { color: #a92e3e; }
.env-status[data-tone="success"] { color: #11736d; }

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

.env-metric {
  position: relative;
  min-width: 0;
  min-height: 132px;
  overflow: hidden;
  padding: 17px;
  border: 1px solid var(--env-line);
  border-radius: 18px;
  background: linear-gradient(150deg, #fff, #eef6fb);
  box-shadow: 0 9px 23px rgba(31, 61, 91, .08);
}

.env-metric::after {
  position: absolute;
  right: -25px;
  bottom: -30px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--metric-color, var(--env-blue)) 15%, transparent);
  content: "";
}

.env-metric span,
.env-metric small,
.env-metric strong { position: relative; z-index: 1; display: block; }
.env-metric span { color: #53677e; font-size: .75rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.env-metric strong { margin-top: 8px; color: var(--metric-color, var(--env-blue)); font-size: clamp(1.45rem, 3.1vw, 2.45rem); line-height: 1.05; }
.env-metric small { margin-top: 7px; color: var(--env-muted); line-height: 1.35; }

.env-panel { padding: clamp(17px, 2.4vw, 25px); }
.env-section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.env-section-head h2 { margin: 3px 0 0; color: var(--env-ink); font-size: clamp(1.18rem, 2vw, 1.65rem); }
.env-section-head p { margin: 0; color: #735436; font-size: .73rem; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
.env-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e6f2f5;
  color: #286273;
  font-size: .72rem;
  font-weight: 850;
}

.env-day-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.env-day-card {
  padding: 14px;
  border: 1px solid var(--env-line);
  border-radius: 15px;
  background: #f8fbfd;
}
.env-day-card h3 { margin: 0 0 10px; color: var(--env-ink); font-size: .92rem; }
.env-day-card p { margin: 6px 0 0; color: var(--env-muted); font-size: .79rem; line-height: 1.35; }
.env-day-card strong { color: var(--day-color, var(--env-blue)); font-size: 1.35rem; }

.env-detail-grid,
.env-source-grid,
.env-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.env-detail-grid article,
.env-source-grid article,
.env-guide-grid article {
  padding: 15px;
  border: 1px solid var(--env-line);
  border-radius: 15px;
  background: #f8fbfd;
}
.env-detail-grid h3,
.env-source-grid h3,
.env-guide-grid h3 { margin: 0; color: var(--env-ink); font-size: .95rem; }
.env-detail-grid p,
.env-source-grid p,
.env-guide-grid p { margin: 8px 0 0; color: var(--env-muted); font-size: .84rem; line-height: 1.55; }
.env-source-grid a { color: #1b6597; font-weight: 800; }

.env-horizontal {
  display: grid;
  grid-auto-columns: minmax(150px, 1fr);
  grid-auto-flow: column;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
}
.env-hour {
  min-height: 135px;
  padding: 13px;
  border: 1px solid var(--env-line);
  border-top: 5px solid var(--risk-color, var(--env-blue));
  border-radius: 14px;
  background: #fff;
  scroll-snap-align: start;
}
.env-hour strong,
.env-hour span,
.env-hour small { display: block; }
.env-hour strong { color: var(--env-ink); font-size: .84rem; }
.env-hour span { margin-top: 8px; color: var(--risk-color, var(--env-blue)); font-size: 1.35rem; font-weight: 900; }
.env-hour small { margin-top: 6px; color: var(--env-muted); line-height: 1.35; }

.env-best-hours { display: flex; flex-wrap: wrap; gap: 7px; }
.env-best-hours span {
  padding: 7px 10px;
  border: 1px solid rgba(42, 125, 114, .22);
  border-radius: 999px;
  background: #eaf7f3;
  color: #1d7167;
  font-size: .8rem;
  font-weight: 850;
}

.env-map-wrap { position: relative; }
.env-map {
  width: 100%;
  height: min(620px, 68vh);
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--env-line);
  border-radius: 18px;
  background: #dcecf2;
}
.env-map .leaflet-control-layers { max-width: min(290px, 76vw); font: 750 .78rem/1.35 system-ui, sans-serif; }
.env-map-note {
  position: absolute;
  z-index: 500;
  right: 12px;
  bottom: 12px;
  max-width: min(420px, calc(100% - 24px));
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(15, 38, 60, .86);
  color: #fff;
  font-size: .7rem;
  line-height: 1.35;
  pointer-events: none;
}
.env-date-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.env-date-buttons button {
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(37, 94, 145, .24);
  border-radius: 999px;
  background: #f1f6fb;
  color: #2a5b89;
  font: 850 .78rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.env-date-buttons button.is-active { border-color: transparent; background: #275f9f; color: #fff; }

.airport-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
}
.airport-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
}
.airport-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--env-line);
  border-left: 5px solid var(--flight-color, var(--env-green));
  border-radius: 15px;
  background: #fff;
}
.airport-code { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 14px; background: #edf4fa; color: #24598c; font-size: .84rem; font-weight: 900; }
.airport-card h3 { margin: 0; color: var(--env-ink); font-size: .93rem; }
.airport-card p { margin: 5px 0 0; color: var(--env-muted); font-size: .8rem; line-height: 1.4; }
.airport-values { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.airport-values span { padding: 4px 7px; border-radius: 8px; background: #f0f5f8; color: #33526f; font-size: .72rem; font-weight: 800; }
.airport-raw { grid-column: 1/-1; overflow: hidden; color: #6d7784; font: 650 .67rem/1.35 ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }

.climate-chart {
  display: grid;
  min-height: 300px;
  grid-template-columns: repeat(31, minmax(12px, 1fr));
  align-items: end;
  gap: 3px;
  overflow-x: auto;
  padding: 22px 5px 8px;
  border-bottom: 1px solid var(--env-line);
}
.climate-bar {
  position: relative;
  display: grid;
  min-width: 14px;
  height: 250px;
  align-items: end;
}
.climate-bar span {
  display: block;
  width: 100%;
  min-height: 2px;
  border-radius: 5px 5px 0 0;
  background: linear-gradient(#e46e4d, #e0a431);
}
.climate-bar i {
  position: absolute;
  right: 0;
  left: 0;
  height: 2px;
  background: #286aa6;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .75);
}
.climate-bar small { margin-top: 5px; color: #637286; font-size: .6rem; text-align: center; }
.climate-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; color: var(--env-muted); font-size: .78rem; }
.climate-legend span::before { display: inline-block; width: 12px; height: 4px; margin-right: 5px; border-radius: 4px; background: #e9783f; content: ""; vertical-align: middle; }
.climate-legend span:last-child::before { height: 2px; background: #286aa6; }
.climate-ranking { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.climate-rank-card { padding: 14px; border: 1px solid var(--env-line); border-radius: 14px; background: #f7fafc; }
.climate-rank-card h3 { margin: 0; color: var(--env-ink); font-size: .9rem; }
.climate-rank-card ol { margin: 10px 0 0; padding-left: 22px; color: var(--env-muted); font-size: .82rem; line-height: 1.7; }

.env-callout {
  padding: 14px 16px;
  border: 1px solid rgba(213, 137, 37, .3);
  border-radius: 14px;
  background: #fff7e6;
  color: #704d21;
  font-size: .84rem;
  line-height: 1.55;
}

.env-loading {
  min-height: 120px;
  background: linear-gradient(90deg, #eff4f8 25%, #f9fbfd 37%, #eff4f8 63%);
  background-size: 400% 100%;
  animation: env-shimmer 1.35s ease infinite;
}
@keyframes env-shimmer { to { background-position: -100% 0; } }

@media (max-width: 1060px) {
  .environment-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .env-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .env-day-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .airport-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .environment-page main,
  .environment-page .svc-hero,
  .environment-tabs { width: min(100% - 18px, 1380px); }
  .environment-tabs {
    display: flex;
    overflow-x: auto;
    padding: 7px;
    scroll-snap-type: x proximity;
  }
  .environment-tabs a { flex: 0 0 min(220px, 76vw); scroll-snap-align: start; }
  .environment-page .svc-controls { grid-template-columns: 1fr; }
  .env-place-form { grid-template-columns: 1fr; }
  .env-place-form .env-submit,
  .env-place-form .env-location { width: 100%; }
  .env-status-wrap { min-width: 0; text-align: left; }
  .env-day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .env-detail-grid,
  .env-source-grid,
  .env-guide-grid { grid-template-columns: 1fr; }
  .airport-toolbar { grid-template-columns: 1fr; }
  .airport-list { grid-template-columns: 1fr; }
  .env-map { min-height: 420px; height: 64vh; }
  .climate-ranking { grid-template-columns: 1fr; }
}

@media (max-width: 470px) {
  .env-summary-grid,
  .env-day-grid { grid-template-columns: 1fr; }
  .env-metric { min-height: 112px; }
  .env-map { min-height: 390px; }
  .airport-card { grid-template-columns: 46px minmax(0, 1fr); padding: 12px; }
  .airport-code { width: 46px; height: 46px; }
}

@media (prefers-reduced-motion: reduce) {
  .env-loading { animation: none; }
  .environment-tabs a { transition: none; }
}

