:root {
  color-scheme: light;
  --stage-w: 960px;
  --stage-h: 720px;
}

body {
  margin: 0;
  background: #fff;
  color: #111;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 48px;
}

h1 { font-size: 1.6rem; margin: 0.8em 0 0.3em; }
h2 { font-size: 1.1rem; margin: 1.6em 0 0.5em; padding-bottom: 2px; border-bottom: 1px solid #ccc; }
.small { color: #555; font-size: 0.9rem; }
.note { background: #fff6d6; border: 1px solid #e6d27a; padding: 6px 10px; }
.task { font-size: 1.1rem; }
.error { color: #b00020; min-height: 1.5em; margin: 0.6em 0; }
.result { font-size: 1.2rem; }

/* ------------------------------------------------------------------ form */
label { display: block; margin: 0.8em 0 0.2em; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row label { flex: 1 1 220px; }
input[type="text"] {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: 340px;
  margin-top: 2px;
  padding: 6px 8px;
  font: inherit;
  border: 1px solid #888;
  border-radius: 3px;
}
.venmo { display: flex; align-items: center; gap: 4px; max-width: 340px; margin-top: 2px; }
.venmo input[type="text"] { margin-top: 0; }
fieldset { margin: 1.2em 0; padding: 6px 14px 10px; border: 1px solid #bbb; border-radius: 3px; }
legend { padding: 0 4px; }
fieldset label { display: inline-flex; align-items: center; gap: 6px; margin: 0.3em 1.6em 0.3em 0; }
.consent { margin: 1.2em 0; padding: 4px 14px 10px; background: #f6f6f6; border: 1px solid #ddd; }
label.check { display: flex; align-items: flex-start; gap: 8px; }
label.check input { margin-top: 0.35em; }

button {
  padding: 8px 20px;
  font: inherit;
  color: #111;
  background: #eee;
  border: 1px solid #555;
  border-radius: 3px;
  cursor: pointer;
}
button:hover { background: #ddd; }
button:disabled { opacity: 0.5; cursor: default; }

/* ------------------------------------------------------------------ images */
#screen-trial {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px 0;
}
#screen-trial[hidden] { display: none; }

.trial-head {
  display: flex;
  justify-content: space-between;
  width: var(--stage-w);
  font-size: 0.95rem;
  color: #333;
}
#timer { width: var(--stage-w); height: 8px; margin: 4px 0 8px; background: #ddd; }
#timer-fill { width: 100%; height: 100%; background: #333; transform-origin: left center; }

#stage {
  position: relative;
  width: var(--stage-w);
  height: var(--stage-h);
  overflow: hidden;
  background: #e1e1e1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
#stage .layer { position: absolute; inset: 0; width: 100%; height: 100%; }
#stage .layer[hidden] { display: none; }
#overlay { cursor: default; }

#target-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.target-title { margin: 0; font-size: 1.05rem; }
#target-img { display: block; }
#target-caption { margin: 0; font-size: 1.15rem; font-weight: bold; min-height: 1.5em; }

#pause-view {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 1.25rem;
  background: #e1e1e1;
}

#trial-foot { width: var(--stage-w); min-height: 7em; text-align: center; }
#trial-msg { margin: 0.6em 0 0.2em; font-size: 1.05rem; min-height: 1.5em; }
#trial-note { margin: 0 0 0.6em; min-height: 1.3em; }

/* ------------------------------------------------------------------ connection problem */
#modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
}
#modal[hidden] { display: none; }
.modal-box { max-width: 420px; padding: 16px 20px; background: #fff; border: 1px solid #333; }
