:root {
  --ink: #17201c;
  --muted: #5b675f;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #d8d1c3;
  --green: #315f4b;
  --green-soft: #dce9df;
  --amber: #8b5b18;
  --amber-soft: #f7e7c4;
  --red: #8d3f35;
  --red-soft: #f3ddd8;
  --shadow: 0 20px 50px rgb(39 46 41 / 10%);
  font-family: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, textarea { font: inherit; }
button { min-height: 44px; }

.lab-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 52px 0 72px; }
.lab-heading { max-width: 850px; margin-bottom: 32px; }
.lab-kicker { margin: 0 0 8px; color: var(--green); font-size: .76rem; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 820px; margin-bottom: 18px; font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 500; letter-spacing: -.04em; line-height: 1.02; }
h2 { margin-bottom: 8px; font-size: clamp(1.55rem, 3vw, 2.25rem); letter-spacing: -.025em; }
h3 { margin-bottom: 14px; font-size: 1rem; }
.lab-intro { max-width: 720px; color: var(--muted); font-size: 1.12rem; line-height: 1.55; }
.lab-disclosure { display: inline-block; margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .86rem; }

.lab-input, .lab-results, .lab-map-section, .lab-debug, .lab-metrics { margin-top: 24px; padding: clamp(20px, 4vw, 34px); border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.lab-input { display: grid; grid-template-columns: minmax(200px, .75fr) minmax(300px, 1.35fr); gap: 30px; }
.lab-input p { color: var(--muted); line-height: 1.55; }
label { display: block; margin-bottom: 8px; font-weight: 700; }
textarea { width: 100%; resize: vertical; min-height: 150px; padding: 16px; border: 1px solid #aea798; border-radius: 16px; color: var(--ink); background: #fff; line-height: 1.5; }
textarea:focus, button:focus-visible, summary:focus-visible { outline: 3px solid #8cbaa3; outline-offset: 3px; }
.lab-form-actions, .lab-debug-actions, .lab-map-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
button { padding: 10px 17px; border: 1px solid var(--green); border-radius: 999px; color: #fff; background: var(--green); cursor: pointer; font-weight: 720; }
button:hover { background: #254b3b; }
button:disabled { cursor: wait; opacity: .62; }
#input-count { color: var(--muted); font-size: .82rem; }
.lab-status { grid-column: 1 / -1; min-height: 1.4em; margin: 0; color: var(--green); font-weight: 650; }
.lab-status[data-state="error"] { color: var(--red); }

.lab-section-heading { margin-bottom: 22px; }
.lab-result-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.lab-list { display: grid; gap: 10px; }
.lab-result { min-height: 74px; padding: 14px; border-radius: 16px; background: var(--green-soft); }
.lab-result[data-kind="low"] { background: var(--amber-soft); }
.lab-result[data-kind="unsupported"] { background: var(--red-soft); }
.lab-result strong { display: block; margin-bottom: 5px; }
.lab-result p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.4; }
.lab-empty { margin: 0; color: var(--muted); font-size: .9rem; }

.lab-map-section { padding-bottom: 24px; }
.lab-map-heading { margin-top: 0; }
.lab-map-status { max-width: 440px; margin: 0; color: var(--muted); font-size: .88rem; text-align: right; }
.lab-map { width: 100%; height: min(58vh, 580px); min-height: 390px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: #dfe8e2; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.lab-poi-evidence { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(260px, 1.3fr); gap: 16px 24px; margin-top: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.lab-poi-evidence[hidden] { display: none; }
.lab-poi-evidence h3 { margin: 0; }
.lab-poi-evidence-list { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.lab-poi-card { padding: 14px; border-radius: 14px; background: var(--green-soft); }
.lab-poi-card[data-state="warning"] { background: var(--amber-soft); }
.lab-poi-card[data-state="unknown"] { background: #eeeae1; }
.lab-poi-card strong { display: block; margin-bottom: 5px; }
.lab-poi-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.lab-evidence-marker { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid #fff; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 12px rgb(23 32 28 / 28%); font-family: "Noto Color Emoji", "Apple Color Emoji", sans-serif; font-size: 20px; line-height: 1; }
.lab-evidence-marker--origin { width: 24px; height: 24px; border-color: var(--green); color: var(--green); font-family: inherit; font-size: 18px; font-weight: 800; }

.lab-criteria-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lab-criterion { padding: 16px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.lab-criterion h3 { margin-bottom: 7px; }
.lab-criterion dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; font-size: .84rem; }
.lab-criterion dt { color: var(--muted); }
.lab-criterion dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.lab-default { margin: 11px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; line-height: 1.45; }
.lab-parameters { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.lab-parameters h4 { margin: 0 0 7px; font-size: .82rem; }
.lab-parameters ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .79rem; line-height: 1.55; }

.lab-metrics dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 22px; }
.lab-metric { padding: 13px; border-radius: 14px; background: #eeeae1; }
.lab-metric dt { color: var(--muted); font-size: .74rem; }
.lab-metric dd { margin: 5px 0 0; font-size: 1.05rem; font-weight: 760; overflow-wrap: anywhere; }
.lab-passes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 22px; }
.lab-pass { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.lab-pass strong { display: block; margin-bottom: 5px; }
.lab-pass p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.lab-pass .lab-pass-reasons { margin-top: 4px; color: var(--amber); }
.lab-debug-actions { justify-content: flex-start; }
.lab-debug-actions button { color: var(--green); background: transparent; }
details { margin-top: 18px; }
summary { cursor: pointer; font-weight: 700; }
pre { max-height: 480px; overflow: auto; padding: 16px; border-radius: 16px; background: #18211d; color: #eff6f1; font: .78rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .lab-shell { width: min(100% - 20px, 720px); padding-top: 28px; }
  .lab-input, .lab-result-columns { grid-template-columns: 1fr; }
  .lab-criteria-grid { grid-template-columns: 1fr; }
  .lab-metrics dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-passes { grid-template-columns: 1fr; }
  .lab-map-heading { align-items: flex-start; flex-direction: column; }
  .lab-map-status { text-align: left; }
  .lab-map { min-height: 360px; }
  .lab-poi-evidence { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
