/* Device-test pages: phone-first, one column, 44 px targets, no framework.
   Token names follow css/dashboard.css so pass/fail colours read the same way
   in both themes; values are local because the two pages never load together. */
:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5b6270;
  --line: #d9dde3;
  --accent: #1d5fd1;
  --on-accent: #ffffff;
  --pass: #1a7f4b;
  --fail: #c0392b;
  --skip: #8a6d1f;
  --pass-bg: #e3f4ea;
  --fail-bg: #fbe5e2;
  --skip-bg: #fbf1d9;
  --radius: 14px;
  --radius-sm: 9px;
  font-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --surface: #1a1d23;
    --text: #eef0f4;
    --muted: #a0a7b4;
    --line: #2c313a;
    --accent: #7fb0ff;
    --on-accent: #0b1a33;
    --pass: #6fd39a;
    --fail: #ff8b7e;
    --skip: #e4c26a;
    --pass-bg: #163124;
    --fail-bg: #3a1c19;
    --skip-bg: #35301a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 1rem/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
[hidden] { display: none !important; }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px 48px; }
h1 { font-size: 1.35rem; margin: 16px 0 4px; }
h2 { font-size: 1.1rem; margin: 24px 0 8px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

/* Sticky progress header */
.progress {
  position: sticky; top: 0; z-index: 5;
  background: var(--bg); padding: 10px 16px 8px; border-bottom: 1px solid var(--line);
}
.progress__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; max-width: 720px; margin: 0 auto; }
.progress__bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; max-width: 720px; margin: 6px auto 0; }
.progress__fill { height: 100%; width: 0; background: var(--accent); transition: width 200ms; }
.sync { font-size: 0.85rem; color: var(--muted); }
.sync.is-error { color: var(--fail); }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 14px 0;
}
.card.is-answered { border-color: color-mix(in srgb, var(--line) 40%, var(--pass)); }
.card__head { display: flex; align-items: flex-start; gap: 10px; }
.num {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--line); font-weight: 600; font-size: 0.9rem;
}
.card.is-answered .num { background: var(--pass-bg); color: var(--pass); }
.card__title { font-weight: 650; font-size: 1.05rem; margin: 3px 0 0; }
.badge {
  display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px;
  background: var(--skip-bg); color: var(--skip); margin-left: 6px; vertical-align: middle;
}
ol, ul { padding-left: 22px; margin: 6px 0 10px; }
li { margin: 4px 0; }
.label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
.failhint { background: var(--fail-bg); color: var(--fail); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.92rem; margin-top: 8px; }

/* Controls — every target ≥ 44 px */
.btn, .linkbtn, select, input, textarea {
  font: inherit; min-height: 44px; border-radius: var(--radius-sm);
}
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.linkbtn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600;
  padding: 11px 16px; margin: 8px 0 4px;
}
.linkbtn small { font-weight: 400; opacity: 0.85; white-space: nowrap; }
.status { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.status .btn { font-weight: 600; }
.status .btn[aria-pressed="true"][data-status="pass"] { background: var(--pass-bg); color: var(--pass); border-color: var(--pass); }
.status .btn[aria-pressed="true"][data-status="fail"] { background: var(--fail-bg); color: var(--fail); border-color: var(--fail); }
.status .btn[aria-pressed="true"][data-status="skip"] { background: var(--skip-bg); color: var(--skip); border-color: var(--skip); }
select, input, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 10px 12px;
}
textarea { min-height: 72px; resize: vertical; }
.field { margin-top: 10px; }
.field label { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.choice { display: grid; gap: 8px; }
.choice .btn { text-align: left; }
.choice .btn[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.saved { font-size: 0.82rem; color: var(--muted); margin-top: 8px; min-height: 1.2em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 140px; }
.banner { background: var(--pass-bg); color: var(--pass); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; font-weight: 600; }
.notice { background: var(--skip-bg); color: var(--skip); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0 0; }
.who .btn { min-height: 44px; padding: 6px 14px; flex: none; }

/* Results matrix */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 16px; }
.chip { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.9rem; }
.chip--pass { color: var(--pass); background: var(--pass-bg); border-color: transparent; }
.chip--fail { color: var(--fail); background: var(--fail-bg); border-color: transparent; }
.chip--skip { color: var(--skip); background: var(--skip-bg); border-color: transparent; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; white-space: nowrap; }
th { font-weight: 600; background: var(--surface); position: sticky; top: 0; }
th:first-child, td:first-child { position: sticky; left: 0; background: var(--surface); max-width: 220px; white-space: normal; z-index: 1; }
th .sub { display: block; font-weight: 400; color: var(--muted); font-size: 0.78rem; white-space: normal; max-width: 140px; }
.cell { display: inline-grid; place-items: center; width: 40px; height: 36px; border-radius: 8px; font-weight: 700; cursor: pointer; border: 0; font: inherit; }
.cell--pass { background: var(--pass-bg); color: var(--pass); }
.cell--fail { background: var(--fail-bg); color: var(--fail); }
.cell--skip { background: var(--skip-bg); color: var(--skip); }
.cell--none { background: transparent; color: var(--muted); }
.cell.has-note::after { content: "•"; font-size: 0.7rem; margin-left: 2px; }
.detail { white-space: pre-wrap; word-break: break-word; }
.faillist li { margin: 8px 0; }
.links a { word-break: break-all; }
