/* Phase 0 test pages. Plain, phone-first, light and dark. */
:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e2e0da;
  --accent: #d9480f;
  --accent-text: #ffffff;
  --ok: #2b8a3e;
  --warn: #b35c00;
  --error: #c92a2a;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #201f1d;
    --text: #ecebe6;
    --muted: #9c9a94;
    --line: #34332f;
    --accent: #ff7a3d;
    --accent-text: #161614;
    --ok: #69db7c;
    --warn: #ffb057;
    --error: #ff8787;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 860px; margin: 0 auto; padding: 16px 16px calc(48px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.6rem; margin: 8px 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
a { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: 0.85em; }
pre { overflow-x: auto; background: var(--bg); padding: 8px; border-radius: 6px; max-height: 320px; }
.lede { font-size: 1.05rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }

.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.top nav { max-width: 860px; margin: 0 auto; display: flex; gap: 4px; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
.top nav a { flex: none; padding: 6px 10px; border-radius: 999px; text-decoration: none; color: var(--text); font-size: 0.9rem; }
.top nav a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 14px 0; }
.card.options, .card.actions { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.card.options label { display: flex; flex-direction: column; gap: 4px; font-size: 0.875rem; color: var(--muted); min-width: 0; flex: 1 1 180px; }
.card.signin { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }

input, select, button { font: inherit; color: inherit; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select {
  width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg);
}
label > input[type="text"] { margin-top: 6px; }
button {
  min-height: 44px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); font-weight: 600; cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button.link { background: none; border: none; color: var(--accent); padding: 0; min-height: 0; font-weight: 500; text-decoration: underline; }
.card.actions button { flex: 1 1 180px; }

.status { padding: 8px 12px; border-radius: 8px; background: var(--surface); border-left: 4px solid var(--line); margin: 10px 0; }
.status:empty { display: none; }
.status[data-kind="ok"] { border-left-color: var(--ok); }
.status[data-kind="warn"] { border-left-color: var(--warn); }
.status[data-kind="error"] { border-left-color: var(--error); color: var(--error); }
.error { color: var(--error); margin: 0; }
.who { margin: 0 0 6px; font-size: 0.875rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
table.metrics th { font-weight: 500; color: var(--muted); width: 45%; font-size: 0.9rem; }
table.metrics td { font-family: var(--mono); font-size: 0.85rem; overflow-wrap: anywhere; }
td[data-kind="ok"] { color: var(--ok); font-weight: 600; }
td[data-kind="error"] { color: var(--error); font-weight: 600; }
td[data-kind="info"] { color: var(--muted); }
table.runs td:first-child { width: 4.5em; font-family: var(--mono); }
table.files td { font-size: 0.9rem; overflow-wrap: anywhere; }
img.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 6px; display: block; margin-bottom: 4px; background: var(--bg); }

.map { width: 100%; height: 62vh; min-height: 320px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.pin-thumb { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); display: block; }

.plain { list-style: none; padding: 0; margin: 0; }
.log { list-style: none; padding: 0; margin: 0; font-family: var(--mono); font-size: 0.8rem; max-height: 320px; overflow-y: auto; }
.log li { padding: 3px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.log li[data-kind="ok"] { color: var(--ok); }
.log li[data-kind="warn"] { color: var(--warn); }
.log li[data-kind="error"] { color: var(--error); }

.tests { padding-left: 1.2em; }
.tests li { margin: 8px 0; }
.tests .muted { display: block; font-size: 0.9rem; }

.search { display: flex; gap: 8px; }
.search input { flex: 1; }
.search select { width: auto; flex: none; }
.results { list-style: none; padding: 0; margin: 0; }
.results li { border-bottom: 1px solid var(--line); }
.results button.result {
  width: 100%; text-align: left; background: none; color: var(--text); border: none; border-radius: 0;
  padding: 10px 2px; font-weight: 400; min-height: 48px;
}
.results li:last-child { border-bottom: none; padding-top: 8px; }
