/* Palette built around #006937. Text and fills checked for WCAG AA contrast on white. */
:root {
  --brand: #006937;
  --brand-strong: #004E29;
  --brand-deep: #003A1F;
  --brand-ink: #FFFFFF;
  --brand-soft: #E7F2EC;
  --brand-tint: #BFDCCB;
  --brand-line: #8CBFA2;
  --ground: #F2F5F3;
  --surface: #FFFFFF;
  --ink: #13221A;
  --muted: #4A5B52;
  --line: #D2DCD6;
  --line-soft: #E7EDE9;
  --control: #A9B8AF;
  --warn: #B45309;
  --warn-ink: #7A3206;
  --warn-soft: #FFF4E5;
  --reject: #9F2F12;
  --key: #1D4E89;
  --key-soft: #E8EFF8;
  --radius: 14px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 26px; color: var(--brand-deep); }
h2 { font-size: 18px; color: var(--brand-deep); }
p { margin: 0; }
strong { font-weight: 600; }
a { color: var(--brand); }
a:hover { color: var(--brand-strong); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Header */
.topbar { background: var(--brand); color: var(--brand-ink); border-bottom: 4px solid var(--brand-strong); }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 60px; }
.brand { font-weight: 600; font-size: 17px; display: flex; flex-direction: column; line-height: 1.25; }
.brand small { font-weight: 400; font-size: 13px; opacity: 0.88; }
.topbar a { color: var(--brand-ink); }
.link-btn { background: none; border: none; color: var(--brand-ink); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
.link-btn:hover { text-decoration-thickness: 2px; }

.devbar { background: var(--ink); color: var(--ground); font-size: 13px; padding: 6px 16px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.devbar strong { text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }
.devbar button { min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid #5B6762; background: transparent; color: var(--ground); font: inherit; cursor: pointer; }
.devbar button[aria-pressed="true"] { background: var(--ground); color: var(--ink); }
.devbar label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* Layout */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }
.narrow { max-width: 780px; }
.wide { max-width: 1120px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card.tight { padding: 16px; }
.eyebrow { font-size: 13px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.notice { background: var(--warn-soft); border: 1px solid var(--warn); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.info { background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--ink); }

/* Buttons and inputs */
.btn { min-height: 48px; padding: 0 22px; border: 2px solid var(--brand); border-radius: 10px; background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn:disabled { background: var(--line); border-color: var(--line); color: var(--muted); cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--brand); }
.btn.secondary:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-strong); }
.btn.secondary:disabled { background: var(--surface); border-color: var(--line); }
.btn.sm { min-height: 44px; padding: 0 16px; }
.btn.block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
fieldset { border: none; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 500; padding: 0; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 14px; border: 2px solid var(--control); border-radius: 10px; background: var(--surface); font-size: 15px; }
.choice input:checked + span { background: var(--brand-deep); border-color: var(--brand-deep); color: #FFFFFF; }
.choice input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.choice input:not(:disabled):hover + span { border-color: var(--brand); }
.scale .choice span { font-family: var(--mono); }
.anchors { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
textarea { width: 100%; min-height: 110px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--control); font: inherit; resize: vertical; background: var(--surface); color: var(--ink); }
textarea:focus-visible, .btn:focus-visible, .link-btn:focus-visible, .tlx-adj:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.topbar .link-btn:focus-visible { outline-color: #FFFFFF; }

/* Consent */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--brand-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; }
.fact strong { color: var(--brand-deep); }
.fact span { font-size: 14px; color: var(--muted); }
.consent-box { background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }

/* Instructions: reference gallery */
.ref-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.ref { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.ref img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--line-soft); }
.ref figcaption { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.ref figcaption strong { font-size: 16px; color: var(--brand-deep); }

/* Instructions: walkthrough */
.walk-caption { position: sticky; top: 0; z-index: 5; background: var(--brand-deep); color: #FFFFFF; border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 6px 18px rgba(0, 58, 31, 0.18); }
.walk-caption .muted { color: #CFE4D8; }
.walk-head { display: flex; gap: 12px; align-items: center; }
.walk-num { width: 36px; height: 36px; border-radius: 50%; background: #FFFFFF; color: var(--brand-deep); font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; }
.walk-title { font-size: 18px; font-weight: 600; }
.walk-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.walk-caption .btn { border-color: #FFFFFF; background: #FFFFFF; color: var(--brand-deep); }
.walk-caption .btn.secondary { background: transparent; color: #FFFFFF; }
.walk-caption .btn:disabled { opacity: 0.45; background: transparent; color: #FFFFFF; }
.walk-caption .btn:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand-soft); }
.dots { display: flex; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.3); }
.dot.done { background: rgba(255, 255, 255, 0.7); }
.dot.on { background: #FFFFFF; width: 26px; border-radius: 999px; }
.sample-label { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: -6px; }
.trial.demo { padding: 14px; border: 2px dashed var(--brand-line); border-radius: 18px; background: #FAFCFB; }
.trial.demo [data-region] { position: relative; scroll-margin-top: 230px; scroll-margin-bottom: 24px; transition: opacity 0.2s, box-shadow 0.2s; }
.trial.demo .card, .trial.demo fieldset, .trial.demo [data-region="next"] { opacity: 0.5; }
.trial.demo .hl, .trial.demo .hl .card { opacity: 1; }
.trial.demo .card:has(.hl) { opacity: 1; }
.trial.demo .hl { box-shadow: 0 0 0 3px var(--brand), 0 0 0 8px rgba(0, 105, 55, 0.18); border-radius: 12px; }
.trial.demo [data-hl]::before { content: attr(data-hl); position: absolute; top: -12px; right: -10px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #FFFFFF; font-size: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; z-index: 2; }
.trial.demo fieldset[data-region], .trial.demo [data-region="next"] { padding: 10px; margin: -10px; border-radius: 12px; }
.trial.demo .choice span { cursor: default; }
.trial.demo .btn.sim-ready { background: var(--brand); border-color: var(--brand); color: #FFFFFF; cursor: default; }

/* Reminders */
.reminders { margin: 0; padding: 0; list-style: none; counter-reset: rem; display: flex; flex-direction: column; gap: 10px; }
.reminders li { counter-increment: rem; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; padding: 10px 12px; border-radius: 10px; background: var(--ground); }
.reminders li::before { content: counter(rem); width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #FFFFFF; font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; }

/* Trial */
.progress { display: flex; flex-direction: column; gap: 6px; }
.bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > div { height: 100%; background: var(--brand); }
.trial { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; align-items: start; }
.figure { display: flex; flex-direction: column; gap: 10px; }
.figure img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; background: var(--line-soft); }
.legend-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.legend-bar div { flex: 1; height: 8px; border-radius: 999px; background: linear-gradient(90deg, #2B83BA, #ABDDA4, #FFFFBF, #FDAE61, #D7191C); }
.side { display: flex; flex-direction: column; gap: 14px; }
.pred { font-size: 26px; font-weight: 600; line-height: 1.25; color: var(--brand-deep); }
.meter { display: flex; flex-direction: column; gap: 4px; }
.meter-row { display: flex; justify-content: space-between; font-size: 14px; }
.meter-track { height: 10px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.meter-track > div { height: 100%; }
.evidence-ok { background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--brand-deep); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.decide { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.decide .choice span { min-height: 52px; font-size: 16px; font-weight: 600; font-family: var(--sans); }
.decide .accept input:checked + span { background: var(--brand); border-color: var(--brand); }
.decide .reject input:checked + span { background: var(--reject); border-color: var(--reject); }
.conf { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.conf .choice span { font-family: var(--mono); }
.attention { background: var(--key-soft); border: 1px solid var(--key); color: var(--key); border-radius: 10px; padding: 10px 12px; font-size: 15px; font-weight: 500; }
.answer-key { background: var(--key-soft); border: 1px dashed var(--key); color: var(--key); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }

/* NASA-TLX step scale */
.tlx { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; box-shadow: inset 0 1px 0 var(--line-soft); }
.tlx legend { display: flex; flex-direction: column; margin-bottom: 8px; }
.tlx legend strong { color: var(--brand-deep); }
.tlx-row { display: flex; align-items: center; gap: 8px; }
.tlx-adj { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--control); background: var(--surface); color: var(--brand-deep); font: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.tlx-adj:hover { border-color: var(--brand); }
.tlx-steps { flex: 1; display: grid; grid-template-columns: repeat(21, 1fr); gap: 2px; min-width: 0; }
.tlx-step { position: relative; height: 44px; display: flex; align-items: flex-end; cursor: pointer; }
.tlx-step input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.tlx-step span { display: block; width: 100%; height: 28px; background: var(--line-soft); border: 1px solid var(--line); border-radius: 3px; transition: height 0.12s, background 0.12s; }
.tlx-step.mid span { height: 34px; }
.tlx-step:hover span { border-color: var(--brand); }
.tlx-step.fill span { background: var(--brand-tint); border-color: var(--brand-line); }
.tlx-step.sel span { background: var(--brand); border-color: var(--brand-strong); height: 44px; }
.tlx-step input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.tlx-anchors { padding: 0 52px; }
.tlx .val { font-family: var(--mono); color: var(--ink); font-weight: 500; }
.tlx .val.empty { font-family: var(--sans); color: var(--muted); font-weight: 400; font-style: italic; }

/* Completion and researcher views */
.code { font-family: var(--mono); font-size: 32px; letter-spacing: 0.08em; background: var(--brand-soft); color: var(--brand-deep); border-radius: 10px; padding: 12px 18px; display: inline-block; }
.claim { background: var(--ground); border-left: 0; border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { background: var(--ground); border-radius: 12px; padding: 14px 16px; }
.tile .v { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 600; font-size: 13px; }
.pill.yes { background: var(--brand-soft); color: var(--brand-deep); }
.pill.no { background: var(--warn-soft); color: var(--reject); }

@media (max-width: 860px) {
  .trial { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 18px; }
  h1 { font-size: 22px; }
  .tlx-anchors { padding: 0; }
  .tlx-row { gap: 4px; }
  .tlx-steps { gap: 1px; }
  .tlx-adj { width: 40px; }
}

/* Keep the legend inside the highlighted box in the walkthrough. */
.trial.demo fieldset > legend { float: left; width: 100%; }
.trial.demo fieldset > legend + * { clear: both; }

/* Enlarge (zoom) */
.zoom-wrap { display: block; border-radius: 10px; }
.zoom-wrap.clickable { cursor: zoom-in; }
.zoom-wrap img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; border-radius: 10px; background: var(--line-soft); }
.ref .zoom-wrap, .ref .zoom-wrap img { border-radius: 0; }
.ref .zoom-wrap img { object-fit: cover; }
.fig-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-height: 36px; }
.zoom-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1.5px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-deep); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; flex: none; position: relative; }
.zoom-btn::after { content: ''; position: absolute; inset: -4px; }
button.zoom-btn:hover { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
button.zoom-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.zoom-dlg { width: min(1100px, 96vw); max-width: 96vw; max-height: 94vh; padding: 0; border: none; border-radius: var(--radius); background: var(--surface); color: var(--ink); display: none; flex-direction: column; overflow: hidden; }
.zoom-dlg[open] { display: flex; }
.zoom-dlg::backdrop { background: rgba(8, 24, 15, 0.72); }
.zoom-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.zoom-title { font-weight: 600; color: var(--brand-deep); }
.zoom-actions { display: flex; gap: 8px; margin-left: auto; }
.zoom-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.zoom-tabs button { min-height: 40px; padding: 0 12px; border-radius: 8px; border: 2px solid var(--control); background: var(--surface); font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); }
.zoom-tabs button[aria-pressed="true"] { background: var(--brand-deep); border-color: var(--brand-deep); color: #FFFFFF; }
.zoom-body { flex: 1; min-height: 0; overflow: auto; background: #E9EEEB; display: flex; align-items: center; justify-content: center; }
.zoom-body img { display: block; width: 100%; height: min(calc(94vh - 150px), 70vw); object-fit: contain; }
.zoom-body.zoomed { display: block; }
.zoom-body.zoomed img { width: 200%; height: auto; max-width: none; }
.zoom-cap { padding: 10px 14px; font-size: 14px; border-top: 1px solid var(--line); }
.zoom-cap .legend-bar { display: flex; max-width: 420px; }
