:root {
  --bg: #f4f1ec;
  --card: #ffffff;
  --text: #14221f;
  --muted: #5c6b68;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --line: rgba(20, 34, 31, 0.12);
  --fill: #e8efe9;
  --shadow: 0 1px 2px rgba(20, 34, 31, 0.06);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tabbar: 64px;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121917;
    --card: #1c2422;
    --text: #eef3f1;
    --muted: #9aa8a4;
    --accent: #2dd4bf;
    --accent-text: #07221f;
    --danger: #f97066;
    --warn: #f6b56a;
    --ok: #3ccb86;
    --line: rgba(238, 243, 241, 0.12);
    --fill: #24302d;
    --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Geist, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
body {
  padding-top: var(--safe-t);
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  padding-bottom: calc(var(--tabbar) + var(--safe-b) + 16px);
}
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }
header.top { padding: 8px 0 20px; }
header.top p.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
h1 { margin: 0; font-size: 32px; line-height: 1.1; letter-spacing: -0.03em; }
.lede { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
h2 {
  margin: 28px 0 12px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
h3 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
input[type="text"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  appearance: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 1px;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 500;
}
.toggle:last-child { border-bottom: 0; }
.toggle span { flex: 1; padding-right: 8px; }
.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch {
  flex: 0 0 auto;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--fill);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  transition: transform 0.15s ease;
}
.toggle input:checked + .switch {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle input:checked + .switch::after { transform: translateX(20px); }
@media (prefers-color-scheme: dark) {
  .switch::after { background: #0e1514; }
  .toggle input:checked + .switch::after { background: #07221f; }
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  color: var(--accent-text);
  background: var(--accent);
}
.btn.secondary {
  background: var(--fill);
  color: var(--text);
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-row { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.score {
  text-align: center;
  padding: 12px 8px 4px;
}
.score .num {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.score .band {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
}
.band.weak { background: color-mix(in srgb, var(--danger) 16%, var(--card)); color: var(--danger); }
.band.okay { background: color-mix(in srgb, var(--warn) 18%, var(--card)); color: var(--warn); }
.band.strong { background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--ok); }
.fixes { margin: 0; padding-left: 20px; }
.fixes li { margin: 0 0 8px; }
.snippet {
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 8px;
}
.muted { color: var(--muted); font-size: 15px; }
.tiny { color: var(--muted); font-size: 13px; margin: 0; }
ol.steps { margin: 0; padding-left: 22px; }
ol.steps li { margin: 0 0 8px; }
.saved-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}
.saved-item:last-of-type { border-bottom: 0; }
.saved-item .meta { color: var(--muted); font-size: 14px; }
.qrbox {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  max-width: 280px;
  margin: 0 auto;
}
#homescreen-tip[hidden], .panel[hidden], #score-card[hidden], #saved-card[hidden],
#review-link-card[hidden], #qr-card[hidden], #maps-btn[hidden] { display: none; }
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar button {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.tabbar button[aria-selected="true"] {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}
a.inline { color: var(--accent); font-weight: 600; }
