/* Stand Here field test. Built to be read outdoors: big type, high contrast, large targets. */
:root {
  --ground: #f2f3f0;
  --card: #ffffff;
  --ink: #14171a;
  --muted: #586068;
  --line: #d3d7d2;
  --primary: #14171a;
  --primary-ink: #ffffff;
  --done: #1b7648;
  --skip: #945600;
  --warn: #b3261e;
  --focus: #2b67d6;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101213;
    --card: #1a1d1f;
    --ink: #eef0ec;
    --muted: #a3aaaf;
    --line: #30353a;
    --primary: #eef0ec;
    --primary-ink: #101213;
    --done: #4fb884;
    --skip: #e2a44d;
    --warn: #ff8a80;
    --focus: #8ab0ff;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.page {
  max-width: 560px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: calc(env(safe-area-inset-top, 0px) + 18px) calc(env(safe-area-inset-bottom, 0px) + 32px);
  display: grid;
  gap: 18px;
}
h1 { font-size: 1.6rem; line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-size: 1.05rem; margin: 0; }
p { margin: 0; }
.lede { color: var(--muted); max-width: 60ch; }
.fine { color: var(--muted); font-size: 0.88rem; }
code { font-size: 0.9em; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.btn {
  min-height: 52px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1.5px solid var(--ink);
  background: transparent;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.warn { border-color: var(--warn); color: var(--warn); }
.btn:disabled { opacity: 0.4; cursor: default; }
.actions { display: grid; gap: 10px; }

/* home */
.sensors { display: grid; gap: 10px; }
.sensor-status { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.92rem; }
.sensor-status span { display: inline-flex; gap: 6px; align-items: baseline; }
.sensor-status b { font-weight: 600; }
.bar { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.progress strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.next { font-size: 0.95rem; }

.spots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.spot-row {
  display: grid;
  grid-template-columns: 1.6rem 76px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
}
.spot-row .num { font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; color: var(--muted); }
.spot-row img { width: 76px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--line); }
.spot-row .txt { display: grid; gap: 2px; min-width: 0; }
.spot-row .txt strong { font-weight: 600; line-height: 1.25; }
.spot-row .txt span { color: var(--muted); font-size: 0.88rem; }
.spot-row .meta { display: grid; justify-items: end; gap: 4px; font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip { font-size: 0.78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1.5px solid currentColor; }
.chip.done { color: var(--done); }
.chip.skip { color: var(--skip); }

/* spot */
.crumbs { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.back { font-weight: 600; text-decoration: none; padding: 8px 0; }
.back::before { content: "\2039\00a0"; }
.plate { margin: 0; display: grid; gap: 6px; }
.plate img { width: 100%; height: auto; border-radius: 6px; background: #000; }
.cap { max-width: 62ch; }
.cap.es { color: var(--muted); font-size: 0.92rem; }
.nav { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; }
.dial {
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--ground);
}
.needle, .north { position: absolute; inset: 0; transition: transform 0.25s ease-out; }
.needle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 46px solid var(--ink);
}
.needle::after {
  content: "";
  position: absolute;
  left: calc(50% - 3px);
  top: 50px;
  width: 6px;
  height: 36px;
  border-radius: 3px;
  background: var(--ink);
}
.north span { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); font-size: 0.75rem; font-weight: 700; color: var(--muted); }
.nav-txt { display: grid; gap: 4px; }
.big { font-size: 1.45rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.link { font-weight: 600; }
.done-note { border-left: 4px solid var(--done); padding-left: 12px; }
.approx-note { border-left: 4px solid var(--skip); padding-left: 12px; }
.areas { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.area-btn {
  min-height: 46px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1.5px solid var(--line);
  background: var(--card);
  font-weight: 600;
  cursor: pointer;
}
.area-btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

/* camera */
.cam { position: fixed; inset: 0; background: #000; color: #fff; overflow: hidden; touch-action: none; z-index: 5; }
.stage { position: absolute; inset: 0; overflow: hidden; }
.stage video, .stage .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.overlay { position: absolute; transform-origin: 50% 50%; pointer-events: none; user-select: none; -webkit-user-select: none; max-width: none; }
.gesture { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.cam-top, .cam-bottom { position: absolute; left: 0; right: 0; pointer-events: none; }
.cam-top > *, .cam-bottom > * { pointer-events: auto; }
.cam-top {
  top: 0;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 28px;
  background: linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0));
}
.cam-title { flex: 1; display: grid; gap: 2px; min-width: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); pointer-events: none; }
.cam-title strong { font-size: 1rem; line-height: 1.2; }
.cam-title span { font-size: 0.9rem; opacity: 0.92; }
.cam-tools { display: grid; gap: 8px; justify-items: end; }
.cam-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.cam-btn.on { background: #fff; color: #000; }
.cam-msg {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(env(safe-area-inset-top, 0px) + 96px);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  font-size: 0.92rem;
}
.cam-bottom {
  bottom: 0;
  display: grid;
  gap: 14px;
  padding: 36px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.66));
}
.opacity { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; font-size: 0.9rem; font-weight: 600; }
.opacity input { width: 100%; accent-color: #fff; height: 32px; }
.cam-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.cam-row .cam-btn:first-child { justify-self: start; }
.cam-row .cam-btn:last-child { justify-self: end; }
.shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 5px solid #fff;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
}
.shutter:active { background: rgba(255, 255, 255, 0.7); }
.flash { animation: flash 0.28s ease-out; }
@keyframes flash { from { background: rgba(255, 255, 255, 0.85); } to { background: #000; } }

/* review */
.compare { position: relative; margin-inline: auto; overflow: hidden; border-radius: 8px; background: #000; touch-action: pan-y; cursor: ew-resize; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; }
.compare .handle { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); pointer-events: none; }
.compare .tag { position: absolute; bottom: 10px; padding: 3px 8px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 0.85rem; font-weight: 700; pointer-events: none; }
.compare .tag.l { left: 10px; }
.compare .tag.r { right: 10px; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.choices { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.choices span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-weight: 600;
  background: var(--ground);
}
.choices input:checked + span { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.choices input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.scale { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }
.options { display: grid; gap: 8px; }
.options label {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--ground);
}
.options input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--primary); }
details.card summary { cursor: pointer; }
details.card ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.next { font-weight: 600; }
.note { display: grid; gap: 6px; }
textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 10px; background: var(--ground); resize: vertical; }

/* results */
.res { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.res th, .res td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.res th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.res td.n { font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
details.danger { border-top: 1px solid var(--line); padding-top: 12px; }
details.danger summary { cursor: pointer; font-weight: 600; color: var(--warn); }
details.danger[open] { display: grid; gap: 10px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 24px);
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 600;
  z-index: 10;
}

body.locked .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 190px); }

/* phone held sideways: one compact control row so the view stays clear */
@media (orientation: landscape) and (max-height: 540px) {
  .cam-top {
    padding: calc(env(safe-area-inset-top, 0px) + 6px) calc(env(safe-area-inset-right, 0px) + 12px) 18px calc(env(safe-area-inset-left, 0px) + 12px);
  }
  .cam-tools { grid-auto-flow: column; }
  .cam-bottom {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 18px calc(env(safe-area-inset-right, 0px) + 16px) calc(env(safe-area-inset-bottom, 0px) + 8px) calc(env(safe-area-inset-left, 0px) + 16px);
  }
  .cam-row { grid-template-columns: auto auto auto; }
  .shutter { width: 62px; height: 62px; border-width: 4px; }
  .cam-msg { top: calc(env(safe-area-inset-top, 0px) + 58px); left: calc(env(safe-area-inset-left, 0px) + 12px); right: calc(env(safe-area-inset-right, 0px) + 12px); }
  body.locked .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
}

@media (prefers-reduced-motion: reduce) {
  .needle, .north { transition: none; }
  .flash { animation: none; }
}
