:root {
  color-scheme: light;
  --ink: #182823;
  --muted: #65736d;
  --line: #dce5df;
  --paper: #f5f7f4;
  --card: #fff;
  --green: #176449;
  --green-dark: #104d38;
  --pale-green: #e8f3ed;
  --amber: #83541c;
  --pale-amber: #fbf2e4;
  --red: #923c35;
  --pale-red: #faecea;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--green); text-underline-offset: 0.15em; }
code { font-size: 0.92em; }

.shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 18px max(32px, env(safe-area-inset-bottom));
}

.page-header { padding: 8px 2px 16px; }
.eyebrow { margin: 0 0 6px; color: var(--green); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.11em; }
h1 { margin: 0; font-size: clamp(2rem, 9vw, 2.9rem); letter-spacing: -0.045em; line-height: 1.04; }
.lede { max-width: 38rem; margin: 12px 0 0; color: var(--muted); font-size: 1.04rem; }

.card {
  margin: 12px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 3px 14px rgb(22 50 38 / 4%);
}

.privacy { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 16px; background: #edf4ef; }
.privacy-mark { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid #b8d1c2; border-radius: 50%; color: var(--green); font-weight: 800; }
.privacy h2 { margin: 0 0 6px; font-size: 1rem; letter-spacing: -0.01em; line-height: 1.3; }
.privacy p { margin: 6px 0 0; color: #43574c; font-size: 0.88rem; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.025em; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #b2c0b8; box-shadow: 0 0 0 4px #f1f4f2; }
.status-dot.ready { background: #2b916a; }
.muted { margin: 11px 0 15px; color: var(--muted); font-size: 0.93rem; }

.button {
  display: flex;
  width: 100%;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 0;
  border-radius: 13px;
  font: inherit;
  font-weight: 720;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.button:focus-visible { outline: 3px solid #7eb59a; outline-offset: 3px; }
.button:disabled { cursor: not-allowed; opacity: 0.48; }
.button-primary { background: var(--green); color: #fff; }
.button-primary:active { background: var(--green-dark); }
.button-secondary { background: #203d31; color: #fff; }
.button-stop { min-height: 42px; margin-top: 8px; border: 1px solid #e5c7c2; background: #fff8f7; color: var(--red); }
.button-tertiary { margin-top: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.consent-row { display: flex; align-items: flex-start; gap: 11px; margin: 14px 0 12px; padding: 12px; border: 1px solid #e1e8e3; border-radius: 12px; background: #fbfcfb; color: #43574c; font-size: 0.84rem; }
.consent-row input { width: 20px; height: 20px; flex: 0 0 20px; margin: 0; accent-color: var(--green); }

.live-status { min-height: 1.35em; margin: 11px 0 0; color: var(--muted); font-size: 0.87rem; }
.readings { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.reading { display: flex; min-width: 0; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid #e5ebe7; border-radius: 12px; background: #fbfcfb; }
.reading-wide { grid-column: 1 / -1; }
.reading-label { color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.reading strong { overflow-wrap: anywhere; font-size: 1.03rem; font-variant-numeric: tabular-nums; }
.reading-source { color: #7b8780; font-size: 0.72rem; }
.datum-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 0.78rem; }

.progress-wrap { margin: 17px 0 8px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 10px; overflow: hidden; border: 0; border-radius: 99px; background: #e8eeea; accent-color: var(--green); }
progress::-webkit-progress-bar { border-radius: 99px; background: #e8eeea; }
progress::-webkit-progress-value { border-radius: 99px; background: var(--green); }
progress::-moz-progress-bar { border-radius: 99px; background: var(--green); }

.gate { display: flex; align-items: flex-start; gap: 11px; margin: 14px 0 6px; padding: 13px; border-radius: 13px; background: #f0f3f1; }
.gate-icon { display: grid; width: 28px; height: 28px; flex: 0 0 28px; place-items: center; border-radius: 50%; background: #dce5df; color: var(--ink); font-weight: 800; }
.gate strong { display: block; }
.gate p { margin: 3px 0 0; color: var(--muted); font-size: 0.82rem; }
.gate.pass { background: var(--pale-green); }
.gate.pass .gate-icon { background: #cee7d7; color: var(--green-dark); }
.gate.fail { background: var(--pale-amber); }
.gate.fail .gate-icon { background: #f1dfc3; color: var(--amber); }
.run-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.run-summary > div { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 10px; border: 1px solid #e5ebe7; border-radius: 11px; background: #fbfcfb; }
.run-summary span { color: var(--muted); font-size: 0.69rem; }
.run-summary strong { font-size: 0.91rem; font-variant-numeric: tabular-nums; }

.table-wrap { max-height: 290px; margin-top: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.74rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
th, td { padding: 9px 8px; border-bottom: 1px solid #e9eeeb; text-align: right; }
th { position: sticky; top: 0; background: #f5f8f6; color: var(--muted); font-size: 0.68rem; }
th:first-child, td:first-child { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
.result-ok { color: var(--green); font-weight: 700; }
.result-error { color: var(--red); font-weight: 700; }
.fine-print { margin: 9px 0 0; color: #7b8780; font-size: 0.77rem; }

footer { padding: 10px 3px; color: var(--muted); font-size: 0.8rem; }
footer p { margin: 6px 0; }
.secure-note { color: var(--red); font-weight: 650; }

@media (min-width: 620px) {
  .shell { padding-right: 24px; padding-left: 24px; }
  .card { padding: 22px; }
  .privacy { padding: 18px; }
}
