:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --ink: #1b2330;
  --muted: #5c6673;
  --line: #e4ddd1;
  --brand: #1e6fb8;
  --brand-deep: #14507f;
  --header-a: #17527e;
  --header-b: #1e6fb8;

  --low: #2e9d63;
  --moderate: #b57b0e;
  --high: #ce6a1f;
  --veryhigh: #b0422e;
  --extreme: #8e1f3c;

  --low-bg: #e4f3ea;
  --low-ink: #1f7a4a;
  --moderate-bg: #f9efda;
  --moderate-ink: #8a5f08;
  --high-bg: #fbe9da;
  --high-ink: #9e4a16;
  --veryhigh-bg: #f8e2dd;
  --veryhigh-ink: #933520;
  --extreme-bg: #f3dfe4;
  --extreme-ink: #7c1830;

  --shadow: 0 1px 2px rgba(27, 35, 48, 0.06), 0 4px 14px rgba(27, 35, 48, 0.05);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--brand);
}

:where(button, summary, input, a):focus-visible {
  outline: 2px solid #1e6fb8;
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(180deg, var(--header-a), var(--header-b));
  color: #fff;
  padding: 1.4rem 0;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* Language switcher */
.lang-sw {
  display: flex;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 0.2rem;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: #dceaf7;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-btn:hover {
  color: #fff;
}

.lang-btn[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-deep);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.brand-icon {
  width: 34px;
  height: 34px;
  fill: #aed6f2;
  flex: 0 0 auto;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.brand-text p {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: #dceaf7;
}

/* Location control */
.loc-ctrl {
  position: relative;
}

.loc-button {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.loc-button:hover {
  background: rgba(255, 255, 255, 0.22);
}

.loc-pin {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.loc-chevron {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  transition: transform 0.15s ease;
}

.loc-button[aria-expanded="true"] .loc-chevron {
  transform: rotate(180deg);
}

.loc-button.locating .loc-pin {
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loc-button .loc-fallback {
  color: #ffe2b8;
  font-weight: 400;
  font-size: 0.85rem;
}

.loc-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 19rem;
  max-width: 82vw;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(27, 35, 48, 0.18);
  padding: 1rem;
  z-index: 20;
}

.loc-panel[hidden] {
  display: none;
}

.loc-title {
  margin: 0 0 0.2rem;
  font-weight: 700;
}

.loc-hint {
  margin: 0 0 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.loc-form input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
}

.loc-form input::placeholder {
  color: #96a0ac;
}

.loc-results {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 12rem;
  overflow-y: auto;
}

.loc-results[hidden] {
  display: none;
}

.loc-result {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--ink);
}

.loc-result:hover,
.loc-result:focus-visible {
  background: #eef4fb;
}

.loc-result .loc-result-region {
  color: var(--muted);
  font-size: 0.8rem;
}

.loc-panel-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}

.loc-action {
  width: 100%;
  text-align: left;
  background: #f6f3ec;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--ink);
}

.loc-action:hover {
  background: #efe9dd;
}

.loc-note {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.loc-note[hidden] {
  display: none;
}

/* ---------- Main ---------- */
main.wrap {
  padding-top: 1.6rem;
  padding-bottom: 3rem;
}

.hero-liner {
  max-width: 42rem;
  margin: 0 0 1.4rem;
  font-size: 1.02rem;
  color: #46525f;
}

.hero-liner strong {
  color: var(--ink);
}

section.block {
  margin-top: 2.4rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 1.02rem;
  margin: 0 0 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #3a4552;
}

/* Banner */
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 0 0 1.2rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  font-size: 0.92rem;
}

.banner[hidden] {
  display: none;
}

.banner p {
  margin: 0;
}

.banner.warn {
  background: #fdf3e2;
  color: #8a5a08;
  border: 1px solid #f0d5a4;
}

.banner.error {
  background: #f9e6e7;
  color: #96233a;
  border: 1px solid #efc6cb;
}

.banner.info {
  background: #eaf1f9;
  color: #1d5a8f;
  border: 1px solid #c5d8ec;
}

.banner-btn {
  border: 0;
  background: currentColor;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}

/* ---------- Status card ---------- */
.status-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.4rem 1.4rem 1.2rem;
}

.status-card.loading .wb-num,
.status-card.loading .cond-line,
.status-card.loading .status-action {
  opacity: 0.45;
}

.status-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.risk-badge {
  display: inline-block;
  padding: 0.32rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
}

.status-card:not(.risk-set) .risk-badge {
  background: #eef1f5;
  color: #5c6673;
}

.risk-low {
  --c: var(--low);
  --cbg: var(--low-bg);
  --cink: var(--low-ink);
}

.risk-moderate {
  --c: var(--moderate);
  --cbg: var(--moderate-bg);
  --cink: var(--moderate-ink);
}

.risk-high {
  --c: var(--high);
  --cbg: var(--high-bg);
  --cink: var(--high-ink);
}

.risk-veryhigh {
  --c: var(--veryhigh);
  --cbg: var(--veryhigh-bg);
  --cink: var(--veryhigh-ink);
}

.risk-extreme {
  --c: var(--extreme);
  --cbg: var(--extreme-bg);
  --cink: var(--extreme-ink);
}

.risk-set .risk-badge {
  background: var(--cbg);
  color: var(--cink);
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #37b26c;
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot,
  .loc-button.locating .loc-pin,
  .meter-marker {
    animation: none !important;
    transition: none !important;
  }
}

.status-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.4rem;
  align-items: end;
}

.wb-num {
  font-size: clamp(2.8rem, 12vw, 3.9rem);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.risk-set .wb-num {
  color: var(--c);
}

.wb-unit {
  font-size: 0.55em;
  font-weight: 600;
  margin-left: 0.15em;
  color: var(--muted);
}

.wb-label {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.status-side {
  padding-bottom: 0.3rem;
}

.cond-line {
  margin: 0 0 0.15rem;
  font-size: 1.02rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cond-line .cond-unit {
  font-size: 0.8em;
  color: var(--muted);
  font-weight: 600;
}

.status-action {
  margin: 1.3rem 0 1.2rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: #f6f3ec;
  border: 1px solid var(--line);
  font-size: 0.98rem;
}

.status-action strong {
  margin-right: 0.25rem;
}

.meter-wrap {
  margin-top: 0.2rem;
}

.meter {
  height: 10px;
  border-radius: 999px;
  position: relative;
  background: linear-gradient(
    90deg,
    var(--low) 0,
    var(--low) 61%,
    var(--moderate) 61%,
    var(--moderate) 69.5%,
    var(--high) 69.5%,
    var(--high) 78%,
    var(--veryhigh) 78%,
    var(--veryhigh) 83.5%,
    var(--extreme) 83.5%
  );
  opacity: 0.9;
}

.meter-marker {
  position: absolute;
  top: -4px;
  left: 2%;
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: #1b2330;
  box-shadow: 0 0 0 2px #fff;
  transition: left 0.6s ease;
}

.risk-set .meter-marker {
  background: var(--c);
}

.meter-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.status-foot {
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px dashed var(--line);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- Chips ---------- */
.chips-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.chip {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.chip summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 0.95rem;
  cursor: pointer;
  list-style: none;
  font-size: 0.95rem;
}

.chip summary::-webkit-details-marker {
  display: none;
}

.chip-name {
  font-weight: 600;
}

.chip[open] summary {
  border-bottom: 1px solid var(--line);
}

.chip-value {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #eef2f6;
  color: #5c6673;
  font-size: 0.72rem;
  font-weight: 800;
  font-style: italic;
  flex: 0 0 auto;
}

.chip > p {
  margin: 0;
  padding: 0.75rem 0.95rem 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

/* ---------- Intro / notes ---------- */
.intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.8rem;
}

.note {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0.6rem 0 0;
  line-height: 1.5;
}

.peak-callout {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: var(--veryhigh-bg);
  color: var(--veryhigh-ink);
  border: 1px solid #edc9be;
  font-size: 0.95rem;
  font-weight: 600;
}

.peak-callout[hidden] {
  display: none;
}

.peak-callout .peak-level {
  font-weight: 700;
}

/* ---------- Charts ---------- */
.chart-wrap {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 10px 4px;
  box-shadow: var(--shadow);
}

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

.tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: #1b2330;
  color: #fff;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
}

/* ---------- Next days ---------- */
.days-strip {
  display: flex;
  gap: 0.7rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
}

.day-card {
  flex: 0 0 auto;
  min-width: 6.4rem;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.55rem 0.75rem;
  box-shadow: var(--shadow);
}

.day-card .d-week {
  font-weight: 700;
  font-size: 0.9rem;
}

.day-card .d-date {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.day-card .d-value {
  font-size: 1.25rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.day-card .d-unit {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.day-card .d-level {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.day-card.lvl-low { border-top-color: var(--low); }
.day-card.lvl-moderate { border-top-color: var(--moderate); }
.day-card.lvl-high { border-top-color: var(--high); }
.day-card.lvl-veryhigh { border-top-color: var(--veryhigh); }
.day-card.lvl-extreme { border-top-color: var(--extreme); }

.day-card.lvl-low .d-value { color: var(--low-ink); }
.day-card.lvl-moderate .d-value { color: var(--moderate-ink); }
.day-card.lvl-high .d-value { color: var(--high-ink); }
.day-card.lvl-veryhigh .d-value { color: var(--veryhigh-ink); }
.day-card.lvl-extreme .d-value { color: var(--extreme-ink); }

.day-card.no-data .d-value {
  color: var(--muted);
}

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  gap: 0.7rem;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.faq-item summary {
  cursor: pointer;
  padding: 0.95rem 1.05rem;
  font-weight: 600;
  list-style: none;
  color: var(--ink);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "+";
  display: inline-block;
  width: 1.2em;
  color: var(--muted);
  font-weight: 700;
}

.faq-item[open] summary::before {
  content: "\2212";
}

.faq-item div {
  padding: 0 1.05rem 0.95rem;
}

.faq-item p {
  margin: 0 0 0.6rem;
  font-size: 0.93rem;
  color: #46525f;
}

.faq-item p:last-child {
  margin-bottom: 0;
}

/* ---------- Methodology ---------- */
.method-list {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}

.method-list div {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.5rem 1rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--line);
}

.method-list dt {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
}

.method-list dd {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.disclaimer {
  margin: 1.2rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 10px;
  background: #eef1f5;
  color: #46525f;
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: #efe9de;
  padding: 1.4rem 0 2.2rem;
}

.footer-inner p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-inner .disclaimer {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
}

.recent-searches {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.recent-searches[hidden] {
  display: none;
}

.recent-lead {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.recent-chip {
  border: 1px solid var(--line);
  background: #f6f3ec;
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.28rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.recent-chip:hover {
  background: #efe9dd;
  border-color: #d6cdbe;
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .status-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .chips-row {
    grid-template-columns: 1fr;
  }

  .method-list div {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

@media (max-width: 380px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .loc-ctrl,
  .loc-button {
    width: 100%;
  }

  .loc-button {
    justify-content: center;
  }

  .loc-panel {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 0.5rem;
    border-radius: 10px;
  }
}
