:root {
  --ink: #1d1d1f;
  --muted: #5f6368;
  --accent: #1f5fbf;
  --line: #d0d4da;
  --bg: #ffffff;
  /* room taken by the progress bar, question, hint and labels on a pair screen */
  --chrome: 170px;
}
html, body { background: var(--bg); color: var(--ink); margin: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

/* jsPsych centres content vertically (margin: auto), which leaves a band of white space above short
   screens. Anchor everything to the top instead. */
.jspsych-display-element { font-size: 18px; }
.jspsych-content-wrapper { margin: 0; align-items: flex-start; }
.jspsych-content { margin: 0 auto; max-width: none; width: 100%; padding: 0 12px 16px; box-sizing: border-box; }
#jspsych-progressbar-container { margin-bottom: 0.4em; padding: 6px 0; }

/* text screens */
.panel { max-width: 720px; margin: 1.5rem auto 0; text-align: left; line-height: 1.5; }
.panel h1 { font-size: 1.5rem; margin: 0 0 0.75rem; }
.consent { font-size: 1.1rem; }
.small { font-size: 0.85rem; color: var(--muted); }
.note { max-width: 640px; margin: 2rem auto 0; text-align: center; line-height: 1.5; }
#jspsych-html-button-response-btngroup { margin-top: 0.75rem; }
.jspsych-btn-group-flex { flex-wrap: wrap; gap: 0.5rem; }
.jspsych-btn { font-size: 1rem; padding: 0.6rem 1.2rem; }
.jspsych-survey-multi-choice-question { text-align: left; max-width: 720px; margin: 1.25rem auto; }
#jspsych-survey-multi-choice-preamble .panel { margin-top: 1rem; }

/* the pair screen: two screenshots, each one a button */
.question { font-size: 1.3rem; font-weight: 600; margin: 0.3rem 0 0.1rem; line-height: 1.3; }
.hint { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.5rem; line-height: 1.35; }
#jspsych-html-button-response-btngroup:has(.pair-btn) {
  display: flex; flex-direction: row; justify-content: center; align-items: flex-start; gap: 2vw; flex-wrap: nowrap; margin-top: 0;
}
button.pair-btn {
  /* side by side: as wide as possible while both fit the window height */
  width: min(47vw, calc((100vh - var(--chrome)) * 1.6));
  width: min(47vw, calc((100dvh - var(--chrome)) * 1.6));
  flex: 0 0 auto; padding: 5px; margin: 0;
  background: #fff; border: 2px solid var(--line); border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
button.pair-btn img { width: 100%; height: auto; aspect-ratio: 16 / 10; display: block; border-radius: 4px; pointer-events: none; }
button.pair-btn .lbl { font-size: 0.95rem; color: var(--muted); line-height: 1.2; }
button.pair-btn .lbl-stack { display: none; }
button.pair-btn:not([disabled]):hover, button.pair-btn:not([disabled]):focus-visible { border-color: var(--accent); }
button.pair-btn:not([disabled]):hover .lbl { color: var(--accent); }
button.pair-btn[disabled] { cursor: default; opacity: 1; }

/* narrow or upright screens (phones, tablets held upright): one above the other.
   Keep this query in step with STACKED in experiment.js. */
@media (max-width: 699px), (max-aspect-ratio: 1/1) {
  :root { --chrome: 150px; }
  .jspsych-display-element { font-size: 16px; }
  .question { font-size: 1.1rem; }
  .hint { font-size: 0.8rem; margin-bottom: 0.35rem; }
  #jspsych-html-button-response-btngroup:has(.pair-btn) { flex-direction: column; align-items: center; gap: 8px; }
  button.pair-btn {
    width: min(96vw, calc((100vh - var(--chrome)) / 2 * 1.6));
    width: min(96vw, calc((100dvh - var(--chrome)) / 2 * 1.6));
    padding: 3px; gap: 2px;
  }
  button.pair-btn .lbl { font-size: 0.8rem; }
  button.pair-btn .lbl-side { display: none; }
  button.pair-btn .lbl-stack { display: inline; }
  .panel, .note { margin-top: 1rem; }
}
