:root {
  --ink: #17202a;
  --muted: #5d6874;
  --line: #dce2e8;
  --paper: #ffffff;
  --wash: #f4f7f9;
  --accent: #175f67;
  --accent-dark: #10484e;
  --error: #a4262c;
}

* { box-sizing: border-box; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

.debug-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 9px 16px;
  color: #4b3500;
  background: #fff0b8;
  border-bottom: 1px solid #dfc35e;
  text-align: center;
  font-size: .9rem;
  font-weight: 700;
}

.page-shell,
#jspsych-target {
  width: min(920px, calc(100% - 32px));
  margin: 48px auto;
}

.card {
  padding: clamp(24px, 5vw, 52px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(23, 32, 42, 0.07);
}

h1, h2 { line-height: 1.2; }
h1 { margin: 0 0 20px; font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.035em; }
h2 { margin: 0 0 12px; font-size: 1.25rem; }

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.consent-box,
.passage-box {
  margin: 28px 0;
  padding: 22px;
  border-left: 4px solid var(--accent);
  background: #f6fafa;
  border-radius: 4px 10px 10px 4px;
}

.notice { color: #7b5300; font-size: .92rem; }
.instruction-placeholder { margin: 22px 0; padding: 14px 16px; background: #fff8df; border-radius: 7px; }
.instruction-copy { margin: 28px 0; }
.instruction-copy li + li { margin-top: 8px; }
.checkbox-row { display: flex; gap: 12px; align-items: flex-start; margin: 28px 0; }
.checkbox-row input { width: 18px; height: 18px; margin-top: 4px; flex: none; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
label { display: grid; gap: 7px; font-weight: 650; }
.optional { color: var(--muted); font-weight: 400; }

input[type="text"], input[type="email"], select, textarea {
  width: 100%;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #b9c2ca;
  border-radius: 7px;
  font: inherit;
}

textarea { resize: vertical; min-height: 150px; }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid rgba(23, 95, 103, .25);
  outline-offset: 2px;
}

.primary-button {
  margin-top: 28px;
  padding: 12px 24px;
  color: white;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 720;
  cursor: pointer;
}
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.secondary-button {
  padding: 11px 22px;
  color: var(--accent-dark);
  background: white;
  border: 1px solid #8ca8ab;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.secondary-button:hover { background: #f1f7f7; }
.secondary-button:disabled { opacity: .45; cursor: not-allowed; }
.error { padding: 12px 14px; color: var(--error); background: #fff2f2; border-radius: 6px; }

.study-card { text-align: left; }
.trial-meta { display: flex; justify-content: space-between; gap: 16px; color: var(--muted); font-size: .9rem; }
.progress-track { height: 7px; margin: 12px 0 32px; overflow: hidden; background: #e5e9ed; border-radius: 999px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.passage-box { white-space: pre-wrap; font-family: Georgia, "Times New Roman", serif; font-size: 1.08rem; }
.question-prompt { margin: 28px 0 16px; font-size: 1.18rem; }
.choice-list { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
.choice-row, .likert-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 450;
  cursor: pointer;
}
.choice-row:hover, .likert-option:hover { border-color: #8ca8ab; background: #fafcfc; }
.choice-row input, .likert-option input { flex: none; margin-top: 5px; }
.rating-section { margin-top: 34px; padding-top: 28px; border-top: 1px solid var(--line); }
.rating-section legend { margin-bottom: 14px; font-weight: 700; }
.likert-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.likert-option { display: grid; place-items: center; gap: 4px; padding: 12px 6px; text-align: center; font-size: .84rem; }
.saving-note { margin-left: 14px; color: var(--muted); font-size: .9rem; }
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.form-actions .primary-button { margin-top: 0; }
.form-actions .saving-note { margin-left: 0; }
.feedback-form { margin-top: 28px; }
.character-count { margin: 6px 0 0; color: var(--muted); font-size: .85rem; text-align: right; }
.completion { text-align: center; }
.completion .completion-mark { color: var(--accent); font-size: 3rem; line-height: 1; }
.email-form { max-width: 520px; margin: 28px auto 0; text-align: left; }
.email-form .primary-button { display: inline-block; }

@media (max-width: 660px) {
  .page-shell, #jspsych-target { width: min(100% - 20px, 920px); margin: 16px auto; }
  .card { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .likert-grid { grid-template-columns: 1fr; }
  .likert-option { display: flex; justify-content: flex-start; text-align: left; }
  .trial-meta { display: block; }
}
