:root { --ca: #2a9d8f; --cb: #8e5cc2; --cs: #8a8f98; --ctl: 40px; --human: #6189c5; --object: #d66422; --ink: #222; --muted: #666; --line: #e2e2e2; --bar: 56px; --gap: 12px; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid #bbb; background: #fff; padding: 8px 14px; }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--ink); color: #fff; border-color: var(--ink); padding: 10px 26px; }
button.ghost { border-color: transparent; color: var(--muted); }
kbd { border: 1px solid #ccc; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 0.85em; }
.hc { color: var(--human); font-weight: 600; } .oc { color: var(--object); font-weight: 600; }
.mobile-only { display: none; }
.todo { background: #fff3b0; } .err { color: #b00020; } .small { font-size: 0.9em; color: var(--muted); }

/* ---- intro: centred hero, white panels on grey ---- */
.intro { background: #f6f7f9; min-height: 100dvh; padding: 36px 16px 60px; }
.intro-wrap { max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.hero { text-align: center; padding: 8px 0 6px; }
.hero h1 { margin: 0; font-size: 2.1em; letter-spacing: -0.01em; } .hero .sub { margin: 8px 0 0; color: var(--muted); }
.panel { background: #fff; border-radius: 16px; padding: 26px 30px; box-shadow: 0 4px 24px #00000012; }
.panel > p:first-child { margin-top: 0; }
.panel h2 { margin: 26px 0 12px; font-size: 1.15em; } .panel h2:first-child { margin-top: 0; }
.question { font-weight: 600; background: #f5f6f8; border-left: 4px solid var(--cs); padding: 10px 14px; border-radius: 4px; }
input[type=range] { accent-color: var(--cs); }  /* neutral grey (the "Same" colour), not the human-mesh blue */
.panel .question { width: 80%; margin-left: auto; margin-right: auto; }
.example { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.example figure { margin: 0; }
.example .box { aspect-ratio: 1; display: grid; place-items: center; background: #f6f6f6; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.example .box video { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.example .box { position: relative; }
.example .stack, .example .stack img { position: absolute; inset: 0; width: 100%; height: 100%; }
.example .stack img { object-fit: contain; border: none; border-radius: 0; }  /* photo and mask fit identically */
.ex-vid.good .box { border: 3px solid #2e9e5b; } .ex-vid.bad .box { border: 3px solid #c0392b; }
.example figcaption { font-size: 0.9em; color: var(--muted); margin-top: 8px; text-align: center; line-height: 1.4; }
.badge { display: inline-block; font-weight: 700; padding: 1px 9px; border-radius: 999px; color: #fff; margin-right: 4px; font-size: 0.92em; }
.badge.good { background: #2e9e5b; } .badge.bad { background: #c0392b; }
.how { padding-left: 20px; margin: 0; } .how li { margin: 6px 0; }
.start-panel { text-align: center; } .start-panel .small { text-align: left; max-width: 760px; margin: 0 auto; }
button.big { padding: 13px 34px; font-size: 1.08em; border-radius: 10px; }
.start-panel button.big { margin-top: 18px; }
dialog#help .panel { box-shadow: none; padding: 0; }

.screen[hidden] { display: none !important; }
/* ---- review / thanks: centred card ---- */
.centered { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: #f6f7f9; }
.card { max-width: 520px; width: 100%; text-align: center; background: #fff; border-radius: 16px; padding: 36px 30px 28px;
  box-shadow: 0 6px 30px #0000001a; }
.card h1 { margin: 6px 0 10px; font-size: 1.8em; } .card p { margin: 8px 0; }
.icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 30px;
  color: #fff; background: var(--human); }
#thanks .icon { background: var(--object); }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 22px; }
dialog#help { max-width: 980px; width: calc(100% - 24px); max-height: calc(100dvh - 24px); border: none; border-radius: 14px; padding: 22px 24px; box-shadow: 0 10px 40px #0004; }
dialog#help::backdrop { background: #0006; }

/* ---- trial: desktop = videos stacked left, photo + question right ---- */
#bar { position: sticky; top: 0; z-index: 3; height: var(--bar); display: flex; align-items: center; gap: 18px; padding: 0 16px;
  background: #fffffff2; border-bottom: 1px solid var(--line); }
.prog { flex: 1; display: flex; align-items: center; gap: 12px; } .prog span { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 64px; }
.track { flex: 1; display: flex; gap: 3px; align-items: center; }
.seg { flex: 1; height: 10px; min-width: 3px; padding: 0; border: none; border-radius: 3px; background: #e6e6e6; cursor: pointer; transition: background 0.15s, height 0.15s; }
.seg:disabled { cursor: default; opacity: 1; }
.seg[data-choice=A] { background: var(--ca); } .seg[data-choice=B] { background: var(--cb); } .seg[data-choice=S] { background: var(--cs); }
.seg.cur { height: 18px; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); } .seg:not(:disabled):not(.cur):hover { filter: brightness(0.85); }
.vctl { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--ctl); padding: 0 4px; }
.speed { display: flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--muted); font-size: 0.9em; } .speed input { width: 120px; } #speed-val { min-width: 34px; }
.pause { padding: 6px 14px; border: 1px solid #c9c9c9; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; } .pause .ico { font-size: 0.8em; } .pause.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.layout { --v: min(calc((100dvh - var(--bar) - var(--ctl) - 4 * var(--gap)) / 2), 46vw);
  display: grid; grid-template-columns: var(--v) 1fr; gap: var(--gap) 24px; padding: var(--gap) 16px; }
.vids { position: relative; display: grid; gap: var(--gap); align-content: start; }
.vbox { position: relative; width: var(--v); aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
:root { --bw: 4px; }  /* A / B colour border of the videos */
.vbox.a { border: var(--bw) solid var(--ca); } .vbox.b { border: var(--bw) solid var(--cb); }
.vbox video { width: 100%; height: 100%; display: block; object-fit: contain; cursor: pointer; }
.tag.a { color: var(--ca); } .tag.b { color: var(--cb); }
.tag { position: absolute; top: 8px; left: 10px; z-index: 1; font-weight: 700; font-size: 1.3em; color: var(--ink); background: #ffffffd0; padding: 0 9px; border-radius: 6px; }
#loading { position: absolute; inset: 0 0 calc(var(--ctl) + var(--gap)) 0; display: grid; place-items: center; background: #ffffffb0; color: var(--muted); z-index: 2; }
#loading[hidden] { display: none; }
.side { display: flex; flex-direction: column; justify-content: center; gap: 12px; min-width: 0; }
/* the photo always fills the photo area (small crops are scaled up); photo and mask are fitted identically */
.imgbox { position: relative; height: calc(100dvh - var(--bar) - 260px); background: #f6f6f6; border-radius: 10px; }
.imgbox .stack { position: absolute; inset: 6px; }
.imgbox .stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stack { position: relative; display: block; line-height: 0; }
.stack .mask { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.6; pointer-events: none; }
.stack .mask[hidden] { display: none; }
.masks { position: absolute; top: 10px; right: 10px; z-index: 1; display: flex; align-items: center; gap: 5px; cursor: pointer;
  background: #ffffffe6; border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px 3px 8px; font-size: 0.88em; box-shadow: 0 1px 3px #0002; }
.choices { display: grid; grid-template-columns: 2fr 1fr 2fr; gap: 10px; }  /* A 40% / Same 20% / B 40% */
.choice { padding: 14px 10px; font-weight: 700; font-size: 1.05em; border: 2px solid var(--c, #c9c9c9); }
.choice.same { font-weight: 500; color: var(--muted); }
.choice.a { --c: var(--ca); color: var(--ca); } .choice.b { --c: var(--cb); color: var(--cb); } .choice.same { --c: var(--cs); }
.choice:hover { filter: brightness(0.95); } .choice.picked { background: var(--c); border-color: var(--c); color: #fff; }
.nav { display: flex; justify-content: space-between; }

/* ---- phones: photo on top, videos side by side, then question and buttons ---- */
@media (max-width: 760px) {
  :root { --bar: 48px; }
  #bar { padding: 0 8px 0 12px; gap: 8px; }
  .vctl { grid-column: 1 / -1; } .speed input { width: 90px; }
  .layout { display: flex; flex-direction: column; padding: 8px 10px; gap: 10px; }
  .side { display: contents; }
  .imgbox { order: 1; height: 32dvh; } .masks { top: 6px; right: 6px; }
  .vids { order: 3; grid-template-columns: 1fr 1fr; gap: 8px; } .vbox { width: 100%; }
  .question { order: 4; font-size: 0.92em; margin: 0; } .choices { order: 5; } .nav { order: 6; }
  .choice { padding: 12px 6px; font-size: 0.95em; }
  .example { grid-template-columns: 1fr 1fr; gap: 10px; } .ex-img { grid-column: 1 / -1; } .ex-img .box { aspect-ratio: 4 / 3; }
  .panel .question { width: auto; }
  .intro { padding: 18px 10px 40px; } .panel { padding: 18px 16px; } .hero h1 { font-size: 1.6em; }
  .desktop-only { display: none; } .mobile-only { display: list-item; }
}
#help-btn { display: inline-flex; align-items: center; gap: 6px; }
.qm { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.8em; font-weight: 700; line-height: 1; }
