/* Tree test, participant side. One light theme (Ticinocom identity: Exo 2, red-pink call to
   action, light grey page, white surfaces, 10 px corners). Large text, 44 px targets, keyboard
   first. The font is served from this origin: no request leaves the server. */
@font-face {
  font-family: "Exo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/exo2-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Exo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/exo2-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --ink: #333333;
  --ink-strong: #24292E;
  --muted: #56606A;
  --line: #D9DEE3;
  --control: #6B7680;
  --brand: #D92B4B;
  --brand-hover: #B8203C;
  --brand-ink: #CC3366;
  --brand-tint: #FCE9ED;
  --on-brand: #FFFFFF;
  --sky: #2FAED6;
  --sky-soft: #E3F4FA;
  --warn-bg: #FFF4E5;
  --warn-ink: #7A4A00;
  --focus: #0B5CAD;
  --shadow: 0 1px 2px rgba(20, 30, 40, .12), 0 2px 8px rgba(20, 30, 40, .06);
  --r: 10px;
  --font: "Exo 2", "Segoe UI", system-ui, -apple-system, sans-serif;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: 12rem; scroll-padding-bottom: 10rem; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.page { max-width: 44rem; margin: 0 auto; padding: 20px 0 4rem; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.page > * { flex: none; }
h1, h2 { color: var(--ink-strong); line-height: 1.15; margin: 0; font-weight: 800; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
p { margin: 0; max-width: 65ch; }
.muted { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--ink-strong); }
.stack { display: flex; flex-direction: column; gap: 1.1rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--ink-strong); color: #fff; padding: .5rem 1rem; border-radius: var(--r); }
.skip-link:focus { left: .5rem; z-index: 10; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
/* focus moved to a heading for screen readers: no ring on it */
h1[tabindex="-1"]:focus-visible { outline: none; }

/* buttons */
.btn, button.btn {
  font: inherit; font-weight: 700; min-height: 52px; min-width: 44px; padding: .7rem 1.4rem; border-radius: var(--r);
  border: 2px solid var(--brand); background: var(--brand); color: var(--on-brand); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-align: center;
}
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.sec { background: var(--surface); color: var(--ink-strong); border-color: var(--control); }
.btn.sec:hover { background: var(--bg); }
.btn.quiet { background: transparent; color: var(--ink-strong); border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn.quiet:hover { background: var(--bg); }
.btn.small { min-height: 40px; padding: .3rem .8rem; font-size: .95rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { background: var(--brand); border-color: var(--brand); }
.btn.quiet:disabled:hover { background: transparent; border-color: transparent; }
.btn.wide { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; align-items: center; }
.actions > .btn { flex: 1 1 14rem; }
.actions > .btn.quiet { flex: 0 1 auto; }

/* welcome, resume */
.panel { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: clamp(20px, 4vw, 32px); display: flex; flex-direction: column; gap: 1.1rem; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.facts li { background: var(--sky-soft); color: var(--ink-strong); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: .95rem; }
.intro { display: flex; flex-direction: column; gap: .9rem; }
.intro p { max-width: 62ch; }
.intro p.lead { font-size: 1.1rem; color: var(--ink-strong); }
.intro p.block { padding-left: 14px; border-left: 4px solid var(--sky); }
.intro p.privacy { font-size: .95rem; color: var(--muted); }
.instructions { border: 2px solid var(--line); border-radius: var(--r); padding: 0 16px; }
.instructions summary { cursor: pointer; font-weight: 700; color: var(--ink-strong); padding: 12px 0; min-height: 48px; display: flex; align-items: center; list-style: none; }
.instructions summary::-webkit-details-marker { display: none; }
.instructions summary::before { content: ""; width: 10px; height: 10px; border-right: 3px solid var(--control); border-bottom: 3px solid var(--control); transform: rotate(-45deg); margin: 0 14px 0 4px; flex: none; }
.instructions[open] summary::before { transform: rotate(45deg); margin-top: -4px; }
.instructions .intro { padding: 4px 0 18px; }
.restart { background: var(--warn-bg); color: var(--warn-ink); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: .6rem; }
.restart p { font-weight: 600; color: inherit; }

/* progress: a bar plus the count */
.task-head { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 8px 0 10px; margin: -20px 0 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-bottom: 8px; }
.bar > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.progress { font-size: .9rem; font-weight: 700; color: var(--muted); margin: 0 0 8px; }
.situation { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 16px 14px 18px; border-left: 5px solid var(--brand); }
.situation p { font-size: 1.15rem; font-weight: 600; color: var(--ink-strong); max-width: none; }
.menu-hint { font-size: .95rem; margin: 0 0 10px; }

/* the tree: a nested list; only the opened branch shows its children */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; margin-bottom: 16px; }
.tree ul { margin-left: 18px; padding-left: 12px; border-left: 2px solid var(--line); }
.tree li { margin: 2px 0; }
.tree .row {
  font: inherit; width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 2px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-strong); text-align: left; cursor: pointer;
  font-size: 1.05rem; font-weight: 500;
}
.tree .row:hover { background: var(--bg); }
.tree .row .chev { flex: none; width: 12px; height: 12px; border-right: 3px solid var(--control); border-bottom: 3px solid var(--control); transform: rotate(-45deg); margin: 0 4px 0 2px; }
.tree .row[aria-expanded="true"] .chev { transform: rotate(45deg); margin-top: -4px; }
.tree .leaf > .row .chev { visibility: hidden; }
.tree .row .label { flex: 1; min-width: 0; }
.tree .row .mark { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-size: .95rem; font-weight: 800; }
.tree .on-path > .row { background: var(--sky-soft); font-weight: 700; }
.tree .current > .row { background: var(--brand-tint); border-color: var(--brand); }
@media (max-width: 400px) { .tree ul { margin-left: 10px; padding-left: 8px; } }

/* the choice bar, stuck to the bottom while the tree scrolls */
.selbar { position: sticky; bottom: 0; margin-top: auto; z-index: 2; background: var(--surface); border-radius: var(--r) var(--r) 0 0; box-shadow: 0 -2px 10px rgba(20, 30, 40, .10); padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px)); margin: 0 calc(-1 * var(--gutter)) -4rem; display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 46rem) { .selbar { margin-left: 0; margin-right: 0; } }
.sel-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.choice-line { font-size: 1rem; color: var(--ink-strong); min-width: 0; overflow-wrap: anywhere; }
.choice-line b { font-weight: 800; }
.choice-line.empty { color: var(--muted); font-size: .95rem; }
.sel-actions { display: flex; gap: 8px; }
.sel-actions .btn { flex: 1 1 0; min-width: 0; padding-left: .8rem; padding-right: .8rem; }
.sel-actions .btn.sec { flex: 0 1 auto; font-size: .95rem; padding-left: .7rem; padding-right: .7rem; }

/* questions: one card each */
.qhead { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.2rem; }
form.qform { gap: 1rem; }
.q { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px 20px 20px; border: 2px solid transparent; margin: 0; min-width: 0; }
fieldset.q { padding: 18px 20px 20px; }
.q legend { padding: 0; float: left; width: 100%; margin-bottom: 14px; }
.q legend + * { clear: both; }
.q > label { display: block; margin-bottom: 14px; }
.q-label { font-weight: 700; color: var(--ink-strong); font-size: 1.05rem; }
.q .tag { display: inline-block; margin-left: 10px; vertical-align: middle; font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--bg); border-radius: 999px; padding: 2px 10px; }
.choices { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 600; cursor: pointer; }
.choice:hover { border-color: var(--control); }
.choice input { width: 22px; height: 22px; margin: 0; accent-color: var(--brand); flex: none; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
@media (min-width: 30rem) { .choices.cols { display: grid; grid-template-columns: 1fr 1fr; } }
textarea {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%; min-height: 6.5rem; padding: .6rem .8rem;
  border: 2px solid var(--line); border-radius: 8px; resize: vertical; display: block;
}
textarea:hover { border-color: var(--control); }
.q-error { margin-top: 10px; color: var(--brand-ink); font-weight: 700; font-size: .95rem; }
.q.invalid { border-color: var(--brand); }
.alert { border-radius: 8px; padding: 12px 14px; font-weight: 600; background: var(--warn-bg); color: var(--warn-ink); }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-bottom: 2px solid #E0B000; padding: 6px 12px; text-align: center; font-weight: 700; margin: 0 calc(-1 * var(--gutter)); }

/* thanks */
.done-mark { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-ink); display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; }

/* admin */
.admin { max-width: 70rem; }
.admin h2 { margin-top: 1.5rem; }
.admin table { border-collapse: collapse; width: 100%; background: var(--surface); font-size: .95rem; }
.admin th, .admin td { text-align: left; border-bottom: 1px solid var(--line); padding: .4rem .5rem; vertical-align: top; }
.admin th { background: var(--bg); }
.admin .num { text-align: right; white-space: nowrap; }
.admin ul { padding-left: 1.2rem; margin: 0; }
.admin .paths { margin: .2rem 0 0; }
.admin .paths summary { cursor: pointer; color: var(--focus); }
.admin .paths ol { margin: .4rem 0 0; padding-left: 1.4rem; }
.admin .paths li { margin: .15rem 0; }
.admin .bad { color: var(--brand-ink); }
.admin .ok { color: #1F7A3F; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .95em; }

@media (prefers-reduced-motion: no-preference) {
  .tree .row, .btn, .choice { transition: background-color 120ms ease, border-color 120ms ease; }
  .tree .row .chev { transition: transform 120ms ease; }
}
