/* AIDE Customs — pilot styles */
:root {
  --ink: #0a1a2f;
  --ink-2: #324a6d;
  --muted: #6a7a8e;
  --line: #d8dee8;
  --line-2: #eef1f6;
  --bg: #f5f7fb;
  --paper: #ffffff;
  --accent: #0b5cab;
  --accent-2: #083f78;
  --warn: #a55a00;
  --ok: #1b6a3a;
  --fail: #a32020;
  --shadow: 0 1px 2px rgba(10,26,47,.04), 0 2px 12px rgba(10,26,47,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PT Sans", "Inter", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand-mark { font-weight: 700; letter-spacing: 0.04em; color: var(--accent-2); }
.brand-sub { color: var(--muted); margin-left: 12px; font-size: 13px; }
.topnav a { margin-left: 18px; color: var(--ink-2); font-size: 14px; }

.main { padding: 36px 0 64px; min-height: calc(100vh - 140px); }

.foot { background: var(--paper); border-top: 1px solid var(--line); padding: 14px 0; font-size: 13px; color: var(--muted); }
.foot .wrap { display: flex; justify-content: space-between; }

h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.01em; }
h3 { font-size: 17px; margin: 0 0 10px; letter-spacing: -0.005em; }
.lead { color: var(--ink-2); font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fineprint { font-size: 12px; color: var(--muted); margin-top: 18px; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 28px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.center-card { max-width: 520px; margin: 24px auto; }

.hero { text-align: left; padding: 8px 0 20px; }

form label { display: block; margin: 14px 0 6px; font-size: 14px; color: var(--ink-2); }
form input[type=text], form input[type=password], form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
  font-family: inherit;
  background: #fcfdff;
  color: var(--ink);
}
form input[type=text]:focus, form input[type=password]:focus, form textarea:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(11,92,171,.15);
}
button, .btn {
  background: var(--accent);
  color: white;
  border: 1px solid var(--accent);
  padding: 10px 22px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 18px;
}
button:hover { background: var(--accent-2); }
button.ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  margin-left: 12px;
}
button.ghost:hover { background: var(--line-2); }
form.inline { display: inline-block; margin: 0; }

.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input { flex: 1 1 160px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; }
.row-form button { margin: 0; padding: 8px 14px; }

.alert.error { background: #fdecec; color: var(--fail); border: 1px solid #f5c2c2; padding: 10px 14px; border-radius: 6px; margin-bottom: 10px; }

.block-list { padding-left: 22px; margin: 12px 0 18px; }
.block-list li { margin: 6px 0; }

/* Runner */
.runner .topbar { background: var(--paper); }
.runner-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; gap: 24px; }
.block-num { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; }
.progress { flex: 1; min-width: 200px; }
.progress-bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.progress-text { font-size: 12px; color: var(--muted); margin-top: 4px; text-align: right; }

.question-text { font-size: 17px; color: var(--ink); margin: 8px 0 22px; line-height: 1.6; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  background: #fcfdff;
  transition: border-color .12s, background .12s;
}
.option:hover { border-color: var(--accent); background: #f4f8fd; }
.option input[type=radio] { margin-top: 4px; accent-color: var(--accent); }
.option input[type=radio]:checked + .opt-letter { background: var(--accent); color: white; border-color: var(--accent); }
.opt-letter {
  display: inline-block; width: 24px; height: 24px; line-height: 22px; text-align: center;
  font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink-2); background: white;
  flex: 0 0 24px;
}
.opt-text { flex: 1; }

.options.scale { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.scale-opt { flex: 1 1 200px; padding: 10px 12px; }

textarea { min-height: 220px; resize: vertical; }
.wordcount { margin-top: 6px; font-size: 13px; }

.actions { margin-top: 22px; display: flex; align-items: center; gap: 16px; }
.actions button { margin: 0; }

.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--line-2); color: var(--ink-2); letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 12px;
}
.badge.ok { background: #e2f3e9; color: var(--ok); }
.badge.fail { background: #fceaea; color: var(--fail); }
.badge.pending { background: #fff3df; color: var(--warn); }

/* Done page */
.done-card .result-block { margin-top: 18px; }
.composite-row { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.composite-num { font-size: 22px; font-weight: 600; color: var(--accent-2); }
.composite-row.big .composite-num { font-size: 28px; }

table.result { width: 100%; border-collapse: collapse; margin-top: 8px; }
table.result td, table.result th { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: left; }
table.result th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
table.result td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
table.result tr.composite td { border-top: 2px solid var(--ink-2); padding-top: 14px; font-size: 17px; }
table.sessions tr:hover { background: var(--line-2); }

/* Admin */
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 10px 0 4px; flex-wrap: wrap; }
.two-track { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-top: 18px; }
@media (max-width: 900px) { .two-track { grid-template-columns: 1fr; } }
.track-a-card { background: linear-gradient(180deg, #fafcff, #f3f7fc); }
.track-b-card { background: linear-gradient(180deg, #fffbf5, #fff5e7); border-color: #f0d8a8; }
.track-b-card h3 { color: var(--warn); }
.narrative {
  margin: 14px 0;
  padding: 12px 16px;
  background: #fff;
  border-left: 3px solid var(--warn);
  font-size: 14px;
  color: var(--ink-2);
  border-radius: 0 6px 6px 0;
}
.indicators td { vertical-align: top; }
.responses td { vertical-align: top; font-size: 13px; }
.responses pre { background: var(--line-2); padding: 8px; border-radius: 4px; font-size: 12px; max-height: 200px; overflow: auto; white-space: pre-wrap; }
pre.raw { font-size: 11px; max-height: 200px; overflow: auto; background: var(--line-2); padding: 6px; border-radius: 4px; }

.tag { display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 4px; margin-left: 4px; font-weight: 500; letter-spacing: 0.02em; }
.tag.ok { background: #e2f3e9; color: var(--ok); }
.tag.fail { background: #fceaea; color: var(--fail); }
.tag.warn { background: #fff3df; color: var(--warn); }

.codes summary { cursor: pointer; color: var(--muted); margin-top: 14px; }
details summary { cursor: pointer; }

/* ===================== T1 extensions ===================== */

/* Consent block on /start */
.consent-block { margin: 22px 0 10px; padding: 18px 20px; background: var(--line-2); border-radius: 8px; border-left: 3px solid var(--accent); }
.consent-block h3 { margin-top: 0; }
.consent-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* Baseline phase */
.baseline-phase .card { max-width: 700px; margin: 16px auto; }
.stroop-word {
  font-size: 64px; font-weight: 700; text-align: center;
  padding: 36px 0; margin: 18px 0;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  user-select: none;
}
.stroop-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0; }
.stroop-btn { background: #fcfdff; color: var(--ink); border: 1px solid var(--line); padding: 12px 22px; font-size: 16px; border-radius: 6px; cursor: pointer; }
.stroop-btn:hover { border-color: var(--accent); background: #f4f8fd; }
.stroop-btn:active { background: var(--line-2); }
.reading-passage { font-size: 17px; line-height: 1.7; padding: 18px 22px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.arith-expr { font-size: 44px; text-align: center; padding: 24px 0; font-variant-numeric: tabular-nums; font-weight: 600; }

/* IAT */
.iat-stim {
  font-size: 48px; text-align: center; padding: 36px 0; margin: 14px 0 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; font-weight: 600;
  user-select: none;
}
.iat-row { display: flex; justify-content: space-between; gap: 24px; margin: 12px 0; }
.iat-side {
  flex: 1; padding: 18px 16px; text-align: center;
  border: 2px solid var(--line); border-radius: 8px; background: #fcfdff;
  transition: background .1s, border-color .1s;
}
.iat-left { border-color: #b8c8e0; }
.iat-right { border-color: #b8c8e0; }
.iat-side kbd {
  display: inline-block; padding: 4px 12px; font-size: 18px; font-weight: 600;
  background: var(--ink-2); color: white; border-radius: 5px; font-family: ui-monospace, monospace;
  margin-bottom: 8px;
}
.iat-label { font-size: 14px; color: var(--ink-2); font-weight: 500; }
.iat-side.flash { background: #e2f3e9; border-color: var(--ok); }
.iat-hint { text-align: center; margin: 8px 0; }

/* Webcam preview (set inline by webcam.js) — additional polish */
video[autoplay] { box-shadow: 0 4px 16px rgba(10,26,47,.15); }
