:root {
  --bg: #faf7f2;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --accent: #b0447b;
  --accent-dim: #d79fbd;
  --border: #d9d2c7;
  --danger: #b23c3c;
  --ok: #2b8458;
}
* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--fg); margin: 0; line-height: 1.45;
}
header {
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
}
header h1 { font-size: 1.1rem; margin: 0; }
nav a, nav button.link {
  margin-left: 12px; color: var(--accent); text-decoration: none; background: none; border: none; cursor: pointer; font: inherit;
}
main { max-width: 960px; margin: 20px auto; padding: 0 16px; }
section { margin-bottom: 24px; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
form label { display: block; margin: 8px 0; }
form input, form select, form textarea {
  display: block; width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 4px; background: #fff;
}
form button, button {
  padding: 10px 16px; background: var(--accent); color: #fff; border: none; border-radius: 4px; cursor: pointer;
}
form button:disabled, button:disabled { background: var(--accent-dim); cursor: not-allowed; }
.err { color: var(--danger); background: #f9e7e7; padding: 8px; border-radius: 4px; }
body.auth main { max-width: 420px; }
#cycle-banner {
  padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: 6px;
}

/* Capture */
.capture #viewport {
  position: relative; aspect-ratio: 3 / 4; background: #000; border-radius: 8px; overflow: hidden; max-width: 420px;
}
.capture video { width: 100%; height: 100%; object-fit: cover; }
.capture #overlay { position: absolute; inset: 0; pointer-events: none; }
.capture .box { position: absolute; border: 3px solid #fff; border-radius: 6px; font-size: 0.8rem; color: #fff; padding: 2px 6px; background: rgba(0,0,0,0.4); }
.capture .box.box1 { left: 42%; top: 8%; width: 16%; height: 64%; writing-mode: vertical-rl; text-orientation: mixed; display: flex; align-items: flex-start; justify-content: center; }
.capture .box.box2 { left: 42%; top: 76%; width: 16%; height: 16%; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 0.7rem; line-height: 1.1; }
.capture .hint { font-size: 0.9rem; color: var(--muted); margin: 8px 0; }
#checks { list-style: none; padding: 0; margin: 12px 0; }
#checks li { padding: 6px 10px; border-radius: 4px; background: #f1ede4; margin-bottom: 6px; font-size: 0.95rem; color: var(--muted); }
#checks li.ok  { background: #e2f2ea; color: var(--ok); }
#checks li.bad { background: #f9e7e7; color: var(--danger); }
#upload-status { margin-top: 12px; min-height: 1.4em; font-size: 0.95rem; }
button.secondary { background: #fff; color: var(--accent); border: 1px solid var(--accent); margin: 8px 0; }
.fallback-note {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(0,0,0,0.65); padding: 16px; text-align: center; font-size: 0.95rem;
}
.fallback-note p { max-width: 260px; margin: 0; }
#file-fallback { display: none; }
.preview { display: block; max-width: 100%; border: 1px solid var(--border); border-radius: 6px; margin: 10px 0; }
.capture #viewport.mode-file { aspect-ratio: 3 / 2; }

.test-picker { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 12px 0; background: #fff; }
.test-picker legend { padding: 0 6px; font-size: 0.95rem; color: var(--muted); }
.test-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  flex: 1 1 auto; min-width: 96px; padding: 10px 12px;
  background: #fff; color: var(--accent);
  border: 2px solid var(--accent); border-radius: 999px;
  font-weight: 600; cursor: pointer; transition: background 120ms, color 120ms;
}
.pill:hover { background: #f3e6ec; }
.pill.active { background: var(--accent); color: #fff; }
.pill.alt { color: var(--muted); border-color: var(--border); font-weight: 500; }
.pill.alt.active { background: var(--muted); color: #fff; border-color: var(--muted); }
