*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green-dark: #1b5e20;
  --green: #2e7d32;
  --bg: #f0f4f0;
  --card: #fff;
  --text: #212121;
  --muted: #5f6b5f;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--green-dark); }

.intro { padding: 1.15rem 1.25rem 0.4rem; max-width: 860px; margin: 0 auto; }
.intro h1 {
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--green-dark);
  letter-spacing: -0.3px;
  line-height: 1.15;
}
.intro p { color: var(--muted); margin-top: .4rem; max-width: 64ch; line-height: 1.55; }

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
  margin: .85rem auto;
  max-width: 860px;
}

label.field { display: block; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .35rem; }
select, button { font: inherit; font-size: 16px; }
select {
  width: 100%;
  min-height: 44px;
  padding: .55rem .7rem;
  border: 1px solid #cfd8d0;
  border-radius: 8px;
  background: #fff;
}

.row-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .7rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: .45rem .85rem;
  background: var(--green); color: #fff; text-decoration: none;
  font-weight: 700; font-size: .9rem; border-radius: 8px; border: 0; cursor: pointer;
}
.btn:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; color: var(--green-dark); border: 1px solid #c8dccb; }
.btn.ghost:hover { background: #eef6f0; }
#gps-status { font-size: .8rem; color: var(--muted); margin-top: .45rem; }

.aqi-card { border-radius: 12px; padding: 1rem 1.1rem; margin-top: .7rem; }
.aqi-kicker { font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; margin-bottom: .45rem; }
.aqi-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: .4rem 1.1rem;
  align-items: center;
}
.gauge { position: relative; width: 220px; }
.gauge-svg { display: block; width: 220px; height: 148px; }
.gauge-readout {
  position: absolute;
  left: 0; right: 0; bottom: 6px;
  text-align: center;
  pointer-events: none;
}
.aqi-num { font-size: 2.15rem; font-weight: 900; line-height: 1; letter-spacing: -1px; }
.aqi-label { font-size: .82rem; font-weight: 800; margin-top: .12rem; color: #1b3a22; }
.aqi-copy p { font-size: .95rem; line-height: 1.5; }
.metrics { list-style: none; margin: .7rem 0 0; display: grid; gap: .25rem; }
.metrics li { font-size: .9rem; }
.gauge-legend {
  display: flex; flex-wrap: wrap; gap: .35rem .55rem;
  justify-content: center;
  margin: .35rem 0 0;
  font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase;
  color: var(--muted);
}
.gl { display: inline-flex; align-items: center; gap: .28rem; }
.gl::before { content: ''; width: .55rem; height: .55rem; border-radius: 50%; }
.gl-good::before { background: #2e7d32; }
.gl-mod::before { background: #f9a825; }
.gl-usg::before { background: #ef6c00; }
.gl-unh::before { background: #c62828; }
.gl-vunh::before { background: #6a1b9a; }
.gl-haz::before { background: #4e1c1c; }

.aqi-good { background: #e8f5e9; border: 1px solid #81c784; }
.aqi-mod { background: #fffde7; border: 1px solid #fbc02d; }
.aqi-usg { background: #fff3e0; border: 1px solid #fb8c00; }
.aqi-unh { background: #ffebee; border: 1px solid #e53935; }
.aqi-vunh { background: #f3e5f5; border: 1px solid #8e24aa; }
.aqi-haz { background: #4e1c1c; color: #fff; border: 1px solid #4e1c1c; }
.aqi-haz a { color: #ffccbc; }
.aqi-haz .aqi-label { color: #fff; }
.aqi-haz .gauge-legend { color: #ffccbc; }
.aqi-none { background: #f5f5f5; border: 1px solid #e0e0e0; }

.hour-row { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .3rem; margin-top: .5rem; }
.hour-cell {
  min-width: 58px;
  text-align: center;
  border-radius: 8px;
  padding: .4rem .25rem;
  font-size: .75rem;
}
.hour-cell strong { display: block; font-size: 1rem; margin-top: .15rem; }

#smoke-hint {
  margin-top: .75rem;
  padding: .75rem .9rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 10px;
}
#smoke-hint p { font-size: .92rem; line-height: 1.5; }

.cal-grid { display: grid; gap: .65rem; margin-top: .7rem; }
.cal-card, .alert-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem .9rem;
  background: #fafcfa;
}
.cal-card.on { background: #e8f5e9; border-color: #a5d6a7; }
.cal-kicker { font-size: .7rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--green-dark); }
.cal-card h3, .alert-card h3, #aqi-hours h3 { font-size: 1.02rem; margin: .15rem 0 .35rem; color: var(--green-dark); }
.cal-card p, .alert-card p { font-size: .9rem; line-height: 1.5; color: #333; }

.panel h2 { font-size: 1.12rem; color: var(--green-dark); margin-bottom: .5rem; }
.fine { font-size: .8rem; color: var(--muted); margin-top: .55rem; line-height: 1.5; }
.rules li { margin: .4rem 0 .4rem 1.1rem; line-height: 1.5; font-size: .93rem; }

footer {
  text-align: center;
  padding: 1.6rem 1rem 2.4rem;
  color: #5a6a62;
  font-size: .85rem;
}
.footer-links { display: flex; flex-wrap: wrap; gap: .4rem 1rem; justify-content: center; margin-bottom: .7rem; }
.footer-links a { color: var(--green-dark); }

@media (max-width: 700px) {
  .intro h1 { font-size: 1.35rem; }
  .aqi-hero { grid-template-columns: 1fr; justify-items: center; }
  .aqi-copy { text-align: center; }
  .metrics { justify-items: center; }
}
