:root{
  --bg-deep: #dce2e8;
  --bg-mid: #e4e9ee;
  --paper: #ffffff;
  --paper-elevated: #fafbfc;
  --ink: #0f1419;
  --ink-soft: #3d4a57;
  --muted: #5c6b7a;
  --line: rgba(15, 20, 25, 0.12);
  --line-strong: rgba(15, 20, 25, 0.18);
  --accent: #1e5a6e;
  --accent-hover: #164a5c;
  --accent-soft: rgba(30, 90, 110, 0.1);
  --accent-border: rgba(30, 90, 110, 0.45);
  --panel-passage: #f4f6f8;
  --panel-options: rgba(30, 90, 110, 0.06);
  --danger: #9b1c1c;
  --radius: 0px;
  --radius-sm: 0px;
  --shadow-card: none;
  --maxw: 640px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

html, body { height: 100%; }
body {
  margin: 0;
  background: #f5f7f9;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page{
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}
.page--task{
  padding: 16px 12px;
}

.shell{
  width: 100%;
  max-width: var(--maxw);
}
.shell--task{
  max-width: 640px;
}

.content{
  background: transparent;
  padding: 28px 24px;
}
.content--task{
  padding: 32px 28px 36px;
}

.noscript{
  padding: 14px 16px;
  border: 1px solid rgba(155, 28, 28, 0.25);
  background: rgba(155, 28, 28, 0.06);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 0.95rem;
}

/* jsPsych: explicit text color (avoids “blank white” if CDN defaults clash) */
.jspsych-display-element{
  font-family: var(--font);
  color: var(--ink);
  background-color: transparent;
}
.jspsych-content{
  max-width: 100%;
  margin: 0 auto;
  text-align: left;
  color: var(--ink);
}

.jspsych-instructions-nav{
  margin-top: 2.75rem !important;
  padding-top: 0.75rem;
}
.jspsych-instructions-nav .jspsych-btn{
  min-width: 6.5rem;
}

/* Survey */
.jspsych-survey-multi-choice-preamble{
  margin-bottom: 1.25rem !important;
}
.jspsych-survey-multi-choice-question{
  margin-top: 1.25rem !important;
  padding-top: 1.25rem !important;
  border-top: 1px solid var(--line);
}
.jspsych-survey-multi-choice-question:first-of-type{
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: none !important;
}
.jspsych-survey-multi-choice-question .jspsych-survey-multi-choice-question-text{
  margin-bottom: 1rem !important;
  line-height: 1.5 !important;
  font-size: 1rem !important;
  font-weight: 600;
  color: var(--ink-soft);
}
.jspsych-survey-multi-choice-option{
  margin: 0.6rem 0 !important;
  line-height: 1.45 !important;
  color: var(--ink);
}

/* Phase screens: eyebrow + tinted panel (directions, fullscreen, transitions) */
.phase-flow{
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.25rem 0 1rem;
}
.phase-flow__eyebrow{
  margin: 0 0 0.85rem 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.phase-panel{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 1.75rem 1.75rem 1.85rem;
}
.phase-panel__title{
  margin: 0 0 0.65rem 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.3;
}
.phase-panel__body{
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
.phase-panel__body strong{
  color: var(--ink);
  font-weight: 600;
}

/* Directions: numbered list */
.instruction-points{
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.instruction-points li{
  margin: 0;
  padding: 0 0 0 2.4rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
  position: relative;
  counter-increment: step;
}
.instruction-points li::before{
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05em;
  width: 1.65rem;
  height: 1.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}
.instruction-points li strong{
  color: var(--ink);
  font-weight: 600;
}

.landing-screen{
  padding-bottom: 0.25rem;
}

/* Space between stimulus and button — tight for phase screens */
#jspsych-html-button-response-btngroup{
  margin-top: 1rem !important;
  padding-top: 0 !important;
}
/* Task trials: more air above the response buttons */
#jspsych-html-button-response-stimulus:has(.trial--task) + #jspsych-html-button-response-btngroup{
  margin-top: 2.25rem !important;
  padding-top: 2rem !important;
}

/* Task trial: passages vs options */
.trial--task{
  width: 100%;
  max-width: 100%;
  margin: 0;
  text-align: left;
}
.trial__panel{
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.2rem 1.2rem;
  margin-bottom: 1.15rem;
  border: 1px solid var(--line);
}
.trial__panel:last-child{
  margin-bottom: 0;
}
.trial__panel--passages{
  background: #f4f6f8;
  border-left: 3px solid var(--line-strong);
}
.trial__options-split{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  align-items: stretch;
}
.trial__option-box{
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.15rem 1.2rem;
  border: 1px solid var(--line);
  background: var(--panel-options);
  border-top: 3px solid var(--accent);
  min-width: 0;
}
.trial__option-box .trial__mark{
  align-self: flex-start;
  margin-right: 0;
}
.trial__p{
  margin: 0 0 0.9rem 0;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink);
}
.trial__p:last-child{
  margin-bottom: 0;
}
.trial__optline{
  margin: 0 0 0.85rem 0;
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--ink);
}
.trial__optline:last-child{
  margin-bottom: 0;
}
.trial__optline--split{
  margin: 0;
  flex: 1;
}
.trial__mark{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  margin-right: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--paper);
  border-radius: 6px;
  vertical-align: middle;
  position: relative;
  top: -0.05em;
}
.trial__mark--q{
  background: #1e5a6e;
}
.trial__mark--p{
  background: #2d4a5c;
}

.fixation{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  font-size: 2rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0;
  user-select: none;
}
.trial__kbd{
  display: inline-block;
  min-width: 1.35em;
  padding: 0.12em 0.45em;
  font-family: var(--font);
  font-size: 0.88em;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--line);
  vertical-align: 0.08em;
}

.phase-panel .trial__kbd{
  font-size: 0.95em;
}

/* Buttons */
.jspsych-btn{
  border-radius: 0 !important;
  border: 1px solid var(--line-strong) !important;
  background: var(--paper) !important;
  color: var(--ink) !important;
  padding: 14px 22px !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  min-height: 48px;
  box-shadow: none !important;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.jspsych-btn:hover{
  border-color: var(--accent-border) !important;
}

.btn-primary{
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: var(--paper) !important;
}
.btn-primary:hover{
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.btn-secondary{
  background: var(--paper-elevated) !important;
  border-color: var(--line-strong) !important;
  color: var(--ink-soft) !important;
  font-weight: 600 !important;
}
.btn-secondary:hover{
  border-color: var(--accent-border) !important;
  color: var(--ink) !important;
}

.callout{
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--accent-soft);
}
.callout--warn{
  border-color: rgba(155, 28, 28, 0.25);
  background: rgba(155, 28, 28, 0.06);
}
.callout__title{
  font-weight: 600;
  margin: 0 0 8px 0;
  font-size: 1rem;
}
.callout__text{
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Demographics custom form */
.demo-form{
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.demo-form__field{
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.demo-form__label{
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.demo-form__input,
.demo-form__select{
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.demo-form__input:focus,
.demo-form__select:focus{
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.demo-form__select{
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233d4a57' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.2rem;
}
.demo-form__error{
  margin: 0;
  font-size: 0.9rem;
  color: var(--danger);
}

/* Countdown */
.countdown-panel{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 2rem;
  box-shadow: none !important;
}
.countdown-banner{
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  margin: 0;
}
.countdown-number{
  font-size: 4rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
  line-height: 1;
}
