/* ============================================================================
   Emotion Rating Study — stylesheet
   Aesthetic: refined editorial minimalism.
   Typography: Fraunces (display serif) + IBM Plex Sans (body/UI).
   Ground: warm off-white. Accent: deep academic green. One shadow, one radius.
   Goals: quiet, readable, deliberately non-consumer. Fades into background.
============================================================================ */

/* Fonts load once, non-blocking, from index.html (display=swap). The font
   stacks below carry full system fallbacks, so first paint never waits on
   fonts.googleapis.com. */

/* --- Design tokens --- */
:root {
  /* Color */
  --bg:            #FAFAF7;
  --bg-elevated:   #FFFFFF;
  --ink:           #0F0F0F;
  --ink-2:         #3A3A3A;
  --ink-3:         #6B6B6B;
  --ink-4:         #9B9A94;
  --rule:          #E0DFD9;
  --rule-strong:   #C9C7BF;
  --accent:        #2D4A2B;
  --accent-hover:  #1F3620;
  --accent-wash:   rgba(45, 74, 43, 0.08);
  --error:         #8B1E2D;

  /* Type */
  --font-display: 'Fraunces', 'Playfair Display', Georgia, serif;
  --font-body:    'IBM Plex Sans', -apple-system, system-ui, sans-serif;

  /* Scale (8-pt) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  /* Geometry */
  --radius:  2px;
  --radius-lg: 4px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 360ms;

  /* Layout */
  --max-width: 1200px;
  --max-narrow: 640px;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv05";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

/* --- Global stage (jsPsych injects into #jspsych-target) --- */
#jspsych-target { min-height: 100vh; }
.jspsych-content-wrapper,
.jspsych-content {
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}
.jspsych-display-element { background: var(--bg); }

/* --- Page shell used by consent, instructions, completion --- */
.survey-logo-header {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: clamp(var(--s-4), 2.4vw, var(--s-5)) var(--s-6) 0;
}
.institution-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(var(--s-4), 3vw, var(--s-6));
  flex-wrap: wrap;
}
.institution-logos img {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.logo-mit { height: 38px; }
.logo-harvard { height: 46px; }
.logo-northwestern { height: 30px; }

.stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.survey-logo-header + .stage {
  min-height: calc(100vh - 78px);
  min-height: calc(100dvh - 78px);
}
.stage-header {
  padding: var(--s-5) var(--s-6);
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--rule);
}
.stage-header__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.stage-header__meta {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.stage-body {
  padding: var(--s-8) var(--s-6);
  display: grid;
  place-items: center;
}
.stage-card {
  max-width: var(--max-narrow);
  width: 100%;
}
.stage-footer {
  padding: var(--s-5) var(--s-6);
  border-top: 1px solid var(--rule);
  display: flex; justify-content: flex-end;
}

/* --- Typography utilities --- */
.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 var(--s-3);
}
.title-xl {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-5);
  font-variation-settings: "opsz" 64;
}
.title-lg {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 3vw, 2rem);
  line-height: 1.15;
  margin: 0 0 var(--s-4);
  font-variation-settings: "opsz" 36;
}
.title-md {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.3;
  margin: 0 0 var(--s-2);
  font-variation-settings: "opsz" 14;
}
.prose {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 60ch;
}
.prose p + p { margin-top: var(--s-4); }
.prose strong { color: var(--ink); font-weight: 500; }
.prose ul { padding-left: 1.25rem; margin: var(--s-4) 0; }
.prose li + li { margin-top: var(--s-2); }

.rule {
  height: 1px;
  background: var(--rule);
  border: 0;
  margin: var(--s-6) 0;
}
.rule--short {
  width: 48px;
  height: 1px;
  background: var(--ink);
  border: 0;
  margin: 0 0 var(--s-5);
}

/* --- Button --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: var(--s-3) var(--s-5);
  min-height: 44px;
  min-width: 160px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #F6F6F1;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              opacity var(--dur-fast) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled {
  background: transparent;
  color: var(--ink-4);
  border-color: var(--rule);
  cursor: not-allowed;
}
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.btn--ghost {
  color: var(--ink-2);
  background: transparent;
  border-color: var(--rule);
}
.btn--ghost:hover:not(:disabled) {
  background: transparent;
  border-color: var(--ink);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

/* ============================================================================
   Rating trial — desktop (single screen, viewport-locked)
   Left: video. Right: emotion checkboxes. Continue in footer.
   Height is capped at 100vh with no page scroll — each element is sized so
   the whole trial fits in the viewport on typical laptop screens (>= ~680px).
============================================================================ */
.rating {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* dynamic viewport unit — avoids mobile URL-bar jumps */
  max-height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: 1fr auto;
}
.rating--with-logos {
  grid-template-rows: auto 1fr auto;
}
.rating--with-logos .survey-logo-header {
  padding-top: clamp(var(--s-3), 1.6vw, var(--s-4));
}
.rating--with-logos .rating-body {
  padding-top: var(--s-3);
}

.rating-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  gap: var(--s-5);
  padding: var(--s-4) var(--s-5) var(--s-3);
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  min-height: 0;       /* critical: lets the 1fr row cap children to this row's height */
  align-items: stretch;
}

/* --- Video column — height-constrained (aspect-ratio determines width) --- */
.video-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.video-frame {
  position: relative;
  /* Size the frame from its width; aspect-ratio derives height. We cap both
     dimensions so a tall viewport can shrink width (keeping 9:16) and a narrow
     one can shrink height — neither cap, on its own, distorts the ratio. */
  aspect-ratio: 9 / 16;
  width: min(34vw, 430px);
  max-height: 100%;
  background: #0B0B0B;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04), 0 20px 48px -20px rgba(0,0,0,0.18);
}
.video-frame video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #0B0B0B;
}
.video-frame__sound {
  position: absolute;
  right: var(--s-3);
  bottom: var(--s-3);
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none;
  border-radius: 999px;
  background: rgba(20,20,20,0.72);
  color: #F6F6F1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.video-frame__sound:hover { background: rgba(20,20,20,0.92); }
.video-frame__sound:active { transform: scale(0.96); }
.video-frame__sound svg { width: 18px; height: 18px; }

/* Thin, subtle progress bar along bottom of video frame — no numbers. */
.video-frame__progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255,255,255,0.12);
}
.video-frame__progress-fill {
  height: 100%;
  background: rgba(255,255,255,0.82);
  width: 0%;
  transition: width 120ms linear;
}

/* --- Prompt column --- */
.prompt {
  display: flex;
  flex-direction: column;
  justify-content: center;  /* vertically center with the video column */
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  gap: var(--s-3);
}
.prompt__q {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: clamp(0.95rem, 1.1vw, 1.05rem);
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--ink);
  margin: 0;
  max-width: 48ch;
}
.prompt__hint {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink-3);
  margin: 0;
}
.prompt__hint strong { color: var(--ink-2); font-weight: 500; }

/* --- Chip grid --- */
.emo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.emo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  background: var(--bg-elevated);
  color: var(--ink-2);
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  user-select: none;
  text-align: center;
}
.emo:hover:not(:has(input:checked)) {
  border-color: var(--ink-3);
  color: var(--ink);
}
.emo:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: #F6F6F1;
}
.emo:has(input:checked):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.emo input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.emo__label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
}
.emo:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* "None of the above" and "Other" span the full width as quieter options. */
.emo--special {
  grid-column: 1 / -1;
  background: transparent;
  border-style: dashed;
  border-color: var(--rule-strong);
  color: var(--ink-3);
}
.emo--special:hover:not(:has(input:checked)) {
  border-color: var(--ink-3);
  border-style: dashed;
  color: var(--ink);
}
.rating--choice .emo--special[data-option-id="none"]:not(:has(input:checked)) {
  background: #ECECEA;
  border-color: #D4D4D0;
  border-style: solid;
  color: var(--ink-2);
}
.rating--choice .emo--special[data-option-id="none"]:hover:not(:has(input:checked)) {
  background: #E2E2DF;
  border-color: #BEBEB8;
  border-style: solid;
}
.emo-other-field {
  grid-column: 1 / -1;
  margin-top: -2px;
  padding: 4px 0 0;
  display: none;
}
.emo-other-field.is-visible { display: block; }
.emo-other-field input[type="text"] {
  width: 100%;
  padding: 10px var(--s-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  font: 400 14px/1.4 var(--font-body);
  color: var(--ink);
}
.emo-other-field input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

/* --- Footer with Continue button --- */
.rating-footer {
  border-top: 1px solid var(--rule);
  padding: 10px var(--s-5) 12px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--s-4);
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
  background: var(--bg);
}
.rating-footer .btn { min-height: 40px; min-width: 140px; padding: 10px var(--s-5); }
.watch-gate {
  margin-right: auto;
  width: min(220px, 34vw);
  min-width: 168px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  color: var(--ink-3);
}
.watch-gate__label {
  font: 600 11px/1.1 var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.watch-gate__time {
  font: 600 12px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
}
.watch-gate__track {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
}
.watch-gate__fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform: scaleX(0);
  transform-origin: left center;
  background: var(--accent);
  transition: transform 180ms linear, background var(--dur-fast) var(--ease);
}
.watch-gate[data-state="complete"] .watch-gate__fill {
  background: #2f8a5f;
}
.watch-gate[data-state="complete"] .watch-gate__time {
  color: #2f8a5f;
}
.rating-footer__note {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  text-align: right;
}
.rating-footer__note:empty { display: none; }
.rating--voice .rating-footer {
  display: none;
}
.rating--voice {
  background: #0B0B0B;
}
.rating--voice .rating-body {
  display: block;
  max-width: none;
  height: 100%;
  padding: 0;
}
.rating--voice .video-col {
  height: 100%;
}
.rating--voice .video-frame {
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0 auto;
  border-radius: 0;
  box-shadow: none;
}
.rating--voice .video-frame video {
  object-fit: contain;
}
.rating--voice .prompt {
  display: none;
}
.rating--voice-recording .prompt {
  display: none;
}

/* --- Why (free text) overlay — appears inline after multi-select on ~1/10 trials --- */
.why {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}
.why__label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}
.why__label em {
  font-style: normal;
  font-weight: 400;
  color: var(--ink-3);
  font-size: 12px;
  margin-left: var(--s-2);
}
.why textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  font: 400 14px/1.45 var(--font-body);
  color: var(--ink);
  resize: vertical;
}
.why textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

.genre-preference {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-2);
  padding-top: var(--s-3);
  border-top: 1px solid var(--rule);
}
.genre-preference__label {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
  max-width: 48ch;
}
.genre-preference__options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.genre-preference__option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
  user-select: none;
  text-align: center;
}
.genre-preference__option:hover:not(:has(input:checked)) {
  border-color: var(--ink-3);
  color: var(--ink);
}
.genre-preference__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}
.genre-preference__option span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1.2;
  white-space: nowrap;
}
.genre-preference__option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: #F6F6F1;
}
.genre-preference__option:has(input:checked):hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.genre-preference__option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.political-followup {
  display: grid;
  gap: var(--s-5);
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}
.political-followup__group {
  display: grid;
  gap: var(--s-3);
}
.political-followup__options {
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.political-followup__options--ideology {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.political-followup__options--reactions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* ============================================================================
   Config-driven choice trial
============================================================================ */
.rating--choice .choice-prompt {
  justify-content: center;
  gap: var(--s-5);
  overflow: auto;
  padding-right: 2px;
}
.rating--choice .prompt__q {
  font-size: clamp(1.42rem, 1.65vw, 1.58rem);
  line-height: 1.25;
  max-width: none;
}
.rating--choice .emo {
  min-height: 54px;
  padding: 10px 16px;
}
.rating--choice .emo__label {
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}
.rating--choice .emo--tone-positive:not(.emo--special) {
  background: #EFF8EC;
  border-color: #D7EAD0;
  color: #24412A;
}
.rating--choice .emo--tone-negative:not(.emo--special) {
  background: #FAEEEE;
  border-color: #EED6D6;
  color: #4A2828;
}
.rating--choice .emo--tone-positive:not(.emo--special):hover:not(:has(input:checked)) {
  border-color: #AFCFA6;
  background: #E6F3E1;
}
.rating--choice .emo--tone-negative:not(.emo--special):hover:not(:has(input:checked)) {
  border-color: #D7B1AE;
  background: #F6E5E4;
}
.rating--choice .emo--tone-positive:not(.emo--special):has(input:checked) {
  background: #2F6B3D;
  border-color: #1E4D2B;
  color: #FFFFFF;
}
.rating--choice .emo--tone-negative:not(.emo--special):has(input:checked) {
  background: #9A3E3E;
  border-color: #742A2A;
  color: #FFFFFF;
}
.rating--choice .emo--tone-positive:not(.emo--special):has(input:checked):hover {
  background: #285C35;
  border-color: #173E22;
}
.rating--choice .emo--tone-negative:not(.emo--special):has(input:checked):hover {
  background: #873434;
  border-color: #642222;
}
.rating--choice .emo--special[data-option-id="none"]:has(input:checked) {
  background: #686868;
  border-color: #505050;
  border-style: solid;
  color: #FFFFFF;
}
.rating--choice .emo--special[data-option-id="none"]:has(input:checked):hover {
  background: #595959;
  border-color: #444444;
}
.inactivity-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: var(--s-5);
  background: rgba(15, 15, 15, 0.62);
  backdrop-filter: blur(2px);
}
.inactivity-modal[hidden] {
  display: none;
}
.inactivity-modal__card {
  width: min(420px, 100%);
  padding: var(--s-7) var(--s-6);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
  text-align: center;
}
.inactivity-modal__card h2 {
  margin: 0 0 var(--s-5);
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.1;
}
.choice-question {
  display: grid;
  gap: var(--s-3);
}
.choice-question__options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.choice-question__options--four-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.choice-question__options--expanded-emotions {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.rating--choice .choice-question__options--expanded-emotions .emo {
  min-height: 42px;
  padding: 7px 10px;
}
.rating--choice .choice-question__options--expanded-emotions .emo__label {
  font-size: 16px;
}
.choice-text-field {
  grid-column: 1 / -1;
}
.choice-text-field input[type="text"] {
  width: 100%;
  padding: 12px var(--s-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  font: 400 18px/1.35 var(--font-body);
  color: var(--ink);
}
.choice-text-field input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}

@media (max-width: 760px) {
  .rating--choice {
    min-height: 100dvh;
    height: auto;
    max-height: none;
    overflow: auto;
  }
  .rating--choice .rating-body {
    grid-template-columns: 1fr;
    padding: var(--s-4);
  }
  .rating--choice .video-frame {
    width: min(72vw, 320px);
    max-height: 52dvh;
  }
  .choice-question__options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rating--choice .prompt__q {
    font-size: 1.34rem;
  }
  .rating--choice .emo {
    min-height: 48px;
    padding: 9px 12px;
  }
  .rating--choice .emo__label {
    font-size: 17px;
  }
  .rating--choice .choice-question__options--expanded-emotions .emo {
    min-height: 42px;
    padding: 7px 9px;
  }
  .rating--choice .choice-question__options--expanded-emotions .emo__label {
    font-size: 15px;
  }
  .rating--choice .rating-footer {
    position: sticky;
    bottom: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .rating--choice .watch-gate {
    width: auto;
    min-width: 150px;
    flex: 1 1 150px;
  }
}

/* ============================================================================
   Viewer Scrolling feed
============================================================================ */
.scroll-feed {
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  background: #050505;
  color: #F6F6F1;
}
.scroll-feed__rail {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.scroll-feed__item {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #050505;
}
.scroll-feed__video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #050505;
}
.scroll-feed__spacer {
  height: 0;
  flex-shrink: 0;
}
.scroll-feed__media-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 14px;
  justify-items: center;
  text-align: center;
  padding: 24px;
  background: rgba(5, 5, 5, 0.72);
  color: #F6F6F1;
}
.scroll-feed__media-overlay[hidden] { display: none; }
.scroll-feed__media-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(246, 246, 241, 0.28);
  border-top-color: #F6F6F1;
  animation: scroll-feed-spin 0.9s linear infinite;
}
@keyframes scroll-feed-spin { to { transform: rotate(360deg); } }
.scroll-feed__media-message {
  margin: 0;
  font-size: 0.95rem;
  max-width: 30ch;
}
.scroll-feed__media-message:empty { display: none; }
.scroll-feed__media-actions {
  display: grid;
  gap: 10px;
}
.scroll-feed__media-btn {
  font: inherit;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid #F6F6F1;
  background: #F6F6F1;
  color: #050505;
  cursor: pointer;
}
.scroll-feed__media-btn[hidden] { display: none; }
.scroll-feed__media-btn--ghost {
  background: transparent;
  color: #F6F6F1;
}
.scroll-feed__actions {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 72px));
  z-index: 4;
  display: grid;
  gap: 12px;
}
.scroll-feed__reaction {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 999px;
  background: rgba(0,0,0,0.42);
  color: #F6F6F1;
  backdrop-filter: blur(8px);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.scroll-feed__reaction:active {
  transform: scale(0.96);
}
.scroll-feed__reaction-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scroll-feed__reaction[data-reaction="like"].is-selected .scroll-feed__reaction-icon {
  fill: currentColor;
}
.scroll-feed__reaction.is-selected {
  background: #F6F6F1;
  color: #050505;
  border-color: #F6F6F1;
}
.scroll-feed__reaction[data-reaction="like"].is-selected {
  background: #F34E68;
  border-color: #F34E68;
  color: #FFFFFF;
}
.scroll-feed__reaction[data-reaction="dislike"].is-selected {
  background: #F6F6F1;
  border-color: #F6F6F1;
  color: #050505;
}
.scroll-feed__status {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
  transition: opacity 400ms ease;
}
.scroll-feed__status.is-dismissed {
  opacity: 0;
  visibility: hidden;
}

/* TikTok-style creator/caption overlay: bottom-left, over a gradient scrim,
   kept clear of the reaction rail on the right. Plain text only. */
.scroll-feed__meta {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  right: 84px;
  bottom: max(52px, calc(env(safe-area-inset-bottom) + 40px));
  z-index: 3;
  color: #F6F6F1;
  pointer-events: none;
  text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
}
.scroll-feed__item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 132px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to top, rgba(5, 5, 5, 0.62), rgba(5, 5, 5, 0));
}
.scroll-feed__meta-handle {
  margin: 0 0 4px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scroll-feed__meta-caption {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.4;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  /* Tappable: clamped captions expand upward like TikTok's. */
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* Expanded caption grows upward (the block is bottom-anchored), capped at
   roughly half the screen with internal scroll for extreme captions. */
.scroll-feed__meta.is-expanded .scroll-feed__meta-caption {
  display: block;
  -webkit-line-clamp: unset;
  max-height: 45vh;
  max-height: 45dvh;
  overflow-y: auto;
  background: rgba(5, 5, 5, 0.6);
  border-radius: 10px;
  padding: 10px 12px;
  margin-left: -12px;
  backdrop-filter: blur(6px);
}

/* End-of-feed sentinel card: activating it completes the session. */
.scroll-feed__item--end {
  display: grid;
  place-items: center;
}
.scroll-feed__end {
  text-align: center;
  color: #F6F6F1;
  padding: 24px;
}
.scroll-feed__end-title {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
}
.scroll-feed__end-copy {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(246, 246, 241, 0.75);
}
.scroll-feed__sound-toggle {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 10px));
  right: max(14px, env(safe-area-inset-right));
  z-index: 6;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  background: rgba(0,0,0,0.52);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24);
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
}
.scroll-feed__sound-toggle.is-unmuted {
  background: rgba(246,246,241,0.94);
  color: #111111;
}
.scroll-feed__pause-toggle {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 10px));
  left: max(14px, env(safe-area-inset-left));
  z-index: 6;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  background: rgba(0,0,0,0.52);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24);
  backdrop-filter: blur(10px);
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.scroll-feed__pause-toggle:disabled {
  opacity: 0.35;
  cursor: default;
}
.scroll-feed__pause-toggle[hidden] { display: none; }
.scroll-feed__pause-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 5, 5, 0.82);
  backdrop-filter: blur(6px);
}
.scroll-feed__pause-overlay[hidden] { display: none; }
.scroll-feed__pause-card {
  max-width: 420px;
  text-align: center;
  color: #F6F6F1;
  display: grid;
  gap: 14px;
  justify-items: center;
}
.scroll-feed__pause-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 700;
}
.scroll-feed__pause-copy {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: rgba(246, 246, 241, 0.85);
}
.scroll-feed__pause-overlay[data-pause-kind="attention_warning"] .scroll-feed__pause-title {
  color: #FFB4B4;
}
.scroll-feed__pause-resume {
  font: inherit;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 999px;
  border: 1px solid #F6F6F1;
  background: #F6F6F1;
  color: #050505;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scroll-feed__hint {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  background: rgba(0,0,0,0.34);
  color: rgba(246,246,241,0.82);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  backdrop-filter: blur(8px);
}
.scroll-feed__hint-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scroll-feed__attention-check {
  position: fixed;
  top: max(14px, calc(env(safe-area-inset-top) + 10px));
  left: 50%;
  z-index: 10;
  width: min(420px, calc(100vw - 28px));
  padding: 13px 14px 11px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: 15px;
  background: rgba(246,246,241,0.96);
  color: #111111;
  box-shadow: 0 12px 34px rgba(0,0,0,0.34);
  font-family: var(--font-body);
  text-align: left;
  cursor: pointer;
  transform: translateX(-50%);
  animation: scroll-attention-enter 180ms ease-out both;
  -webkit-tap-highlight-color: transparent;
}
.scroll-feed__attention-check[hidden] {
  display: none;
}
.scroll-feed__attention-check:active {
  transform: translateX(-50%) scale(0.985);
}
.scroll-feed__attention-kicker,
.scroll-feed__attention-copy {
  display: block;
}
.scroll-feed__attention-kicker {
  margin-bottom: 2px;
  color: rgba(17,17,17,0.58);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.scroll-feed__attention-copy {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
}
.scroll-feed__attention-progress {
  display: block;
  height: 4px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(17,17,17,0.14);
}
.scroll-feed__attention-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #3C2A78;
  transform-origin: left center;
  animation: scroll-attention-countdown var(--attention-check-duration, 5000ms) linear forwards;
}
.scroll-feed__attention-check.is-paused .scroll-feed__attention-progress-fill {
  animation-play-state: paused;
}
@keyframes scroll-attention-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes scroll-attention-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
.emo--political {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 8px 12px;
}
.emo--political .emo__label {
  line-height: 1.25;
  letter-spacing: 0;
}

/* ============================================================================
   Mobile / narrow viewports (<768px)
   Keep the viewport-locked single-screen structure: video on top, prompt below.
   The whole screen still fits without page scroll; the prompt column gets
   internal scroll if needed.
============================================================================ */
@media (max-width: 767.98px) {
  .rating-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 45%) minmax(0, 55%);
    gap: var(--s-3);
    padding: var(--s-3) var(--s-4);
  }
  .video-frame {
    /* On mobile the column is full-width. aspect-ratio will shrink width to
       maintain 9:16 when max-height (45vh row cap) kicks in. */
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
  }
  .prompt__q  { font-size: 1.25rem; }
  .emo-grid   { grid-template-columns: 1fr 1fr; }
  .genre-preference__options { flex-direction: column; }
  .political-followup__options--ideology,
  .political-followup__options--reactions { grid-template-columns: 1fr; }
  .stage-body { padding: var(--s-6) var(--s-4); }

  .rating--voice-recording .rating-footer {
    display: none;
  }
}

/* Short viewports — tighten further so everything fits on a ~600px-tall laptop. */
@media (max-height: 720px) {
  .rating-body { padding: 10px var(--s-4) 8px; gap: var(--s-4); }
  .prompt      { gap: var(--s-2); }
  .prompt__q   { font-size: 0.95rem; }
  .emo-grid    { gap: 6px; }
  .emo         { min-height: 32px; padding: 4px 12px; }
  .emo__label  { font-size: 12px; }
  .genre-preference { padding-top: var(--s-2); }
  .genre-preference__label { font-size: 13px; }
  .genre-preference__options { gap: 6px; }
  .genre-preference__option { min-height: 32px; padding: 4px 10px; }
  .genre-preference__option span { font-size: 12px; }
  .political-followup { gap: var(--s-3); }
  .political-followup__group { gap: var(--s-2); }
  .emo--political { min-height: 32px; padding: 5px 10px; }
  .rating--choice .choice-question__options--expanded-emotions .emo { min-height: 34px; padding: 5px 8px; }
  .rating--choice .choice-question__options--expanded-emotions .emo__label { font-size: 13px; }
  .video-frame { width: min(31vw, 380px); }
}

/* ============================================================================
   Consent / Instructions / Completion
============================================================================ */
.consent, .instructions, .completion, .comprehension-check {
  max-width: var(--max-narrow);
  width: 100%;
}
.instructions.voice-instructions {
  max-width: 1120px;
}
.consent h1, .instructions h1, .completion h1, .comprehension-check h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 var(--s-5);
  font-variation-settings: "opsz" 64;
}
.completion-code {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
  margin: var(--s-5) 0;
  padding: var(--s-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: #F0F7F0;
}
.completion-code span {
  grid-column: 1 / -1;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.completion-code strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.35rem, 6vw, 2rem);
  letter-spacing: 0.08em;
  overflow-wrap: anywhere;
}
.completion-code .btn {
  min-height: 40px;
}
.consent .agree-row {
  display: flex; align-items: center; gap: var(--s-3);
  margin: var(--s-6) 0;
  padding: var(--s-4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.consent .agree-row input[type="checkbox"] {
  width: 18px; height: 18px; accent-color: var(--accent);
}
.consent .agree-row label {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.welcome-guard {
  margin-top: var(--s-5);
  padding: var(--s-4);
  border: 1px solid #B8CDBA;
  border-radius: calc(var(--radius) + 4px);
  background: #F0F7F0;
}
.welcome-guard--phone {
  border-color: #D7C58B;
  background: #FFF9E8;
}
.welcome-guard h2 {
  margin: 0 0 var(--s-2);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}
.welcome-guard p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.welcome-guard__confirmation {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
  margin-top: var(--s-4);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  cursor: pointer;
}
.welcome-guard__confirmation input {
  width: 19px;
  height: 19px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}
.welcome-guard__field {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-4);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}
.welcome-guard__field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--ink);
  font: 16px/1.4 var(--font-body);
}
.welcome-guard__field input:focus {
  outline: 2px solid #6D9B72;
  outline-offset: 2px;
  border-color: #6D9B72;
}
.welcome-guard__field input[aria-invalid="true"] {
  border-color: var(--error);
}
.welcome-guard .welcome-guard__error {
  margin-top: var(--s-3);
  color: var(--error);
  font-weight: 500;
}
.instructions__numbered {
  counter-reset: step;
  padding: 0;
  list-style: none;
  margin: var(--s-5) 0 0;
}
.instructions__numbered li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: var(--s-5);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-2);
}
.instructions__numbered li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-display);
  font-variation-settings: "opsz" 14;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-4);
}
.instructions__numbered li em {
  font-style: italic;
  color: var(--ink);
  font-weight: 500;
}
.instructions__numbered li strong {
  color: var(--ink);
  font-weight: 500;
}
.instructions__numbered li p {
  margin: 0;
}
.instructions__numbered li p + p {
  margin-top: var(--s-4);
}
.instruction-highlight {
  padding: 0.04em 0.18em 0.08em;
  border-radius: 0.24em;
  background: #DDF1DF;
  color: var(--ink);
  font-weight: inherit;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.instructions:not(.voice-instructions) .prose {
  font-size: 17px;
  line-height: 1.65;
}
.viewer-emotions-intro-page .consent h1,
.viewer-emotions-intro-page .instructions h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
}
.viewer-emotions-intro-page .prose {
  font-size: 18.75px;
}
.viewer-emotions-intro-page .instructions:not(.voice-instructions) .prose {
  font-size: 21.25px;
}
.viewer-emotions-intro-page .instructions__numbered li {
  font-size: 21.25px;
}
.viewer-emotions-intro-page .instructions__numbered li::before {
  font-size: 16.25px;
}
.viewer-emotions-intro-page .eyebrow {
  font-size: 15px;
}
.viewer-emotions-intro-page .btn {
  font-size: 18.75px;
}
.comprehension-check__intro {
  max-width: 58ch;
  margin: 0 0 var(--s-6);
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.6;
}
.comprehension-question {
  min-width: 0;
  margin: 0;
  padding: var(--s-5);
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) + 4px);
  background: rgba(255,255,255,0.42);
}
.comprehension-question + .comprehension-question {
  margin-top: var(--s-5);
}
.comprehension-question legend {
  width: 100%;
  margin: 0 0 var(--s-4);
  padding: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}
.comprehension-option {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: var(--s-3);
  align-items: start;
  min-height: 52px;
  padding: 13px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.comprehension-option + .comprehension-option {
  margin-top: var(--s-3);
}
.comprehension-option:hover {
  border-color: var(--ink-4);
}
.comprehension-option:has(input:checked) {
  border-color: #6D9B72;
  background: #EDF7EE;
  box-shadow: 0 0 0 1px rgba(109,155,114,0.18);
}
.comprehension-option input {
  width: 19px;
  height: 19px;
  margin: 2px 0 0;
  accent-color: #517E57;
}
.comprehension-option span {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
.comprehension-option:focus-within {
  outline: 2px solid #6D9B72;
  outline-offset: 2px;
}
.comprehension-check__error {
  margin: var(--s-5) 0 0;
  padding: var(--s-4);
  border-left: 3px solid var(--error);
  background: rgba(179,38,30,0.06);
  color: var(--error);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}
.voice-instructions__steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-5);
}
.voice-instructions__step {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  align-items: start;
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
}
.voice-instructions__image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: #0B0B0B;
}
.voice-instructions__copy {
  display: grid;
  gap: var(--s-2);
}
.voice-instructions__step-number {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  margin: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #F6F6F1;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.voice-instructions__copy h2 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}
.voice-instructions__copy p:not(.voice-instructions__step-number) {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}
.voice-instructions__note {
  display: grid;
  gap: var(--s-3);
  max-width: 840px;
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.voice-instructions__note p {
  margin: 0;
}
.completion__code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 28px;
  letter-spacing: 0.12em;
  padding: var(--s-4) var(--s-5);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-wash);
  color: var(--accent);
  display: inline-block;
  margin: var(--s-4) 0 var(--s-6);
}

/* ============================================================================
   Loading / error states
============================================================================ */
.loading {
  display: grid; place-items: center;
  min-height: 50vh;
  color: var(--ink-3);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.loading::before {
  content: "";
  display: block;
  width: 14px; height: 14px;
  border: 1.5px solid var(--rule-strong);
  border-top-color: var(--ink-3);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
  margin-right: var(--s-3);
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-banner {
  border: 1px solid var(--error);
  color: var(--error);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  font-size: 13px;
  background: color-mix(in srgb, var(--error) 6%, transparent);
}

/* ============================================================================
   Subtle fade-in on trial transitions
============================================================================ */
.fade-in {
  animation: fade-in 360ms var(--ease) both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   Focus management — visible, not obnoxious.
============================================================================ */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Reduce motion for users who prefer it. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   Final questionnaire
============================================================================ */
.final-questionnaire {
  position: relative;
  min-height: 100vh;
  padding: clamp(var(--s-5), 4vw, var(--s-7));
  overflow: hidden;
}
.final-questionnaire--with-logos {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
}
.final-questionnaire--with-logos .survey-logo-header {
  position: relative;
  z-index: 1;
  padding-top: 0;
  margin-bottom: clamp(var(--s-5), 3vw, var(--s-7));
}
.final-questionnaire__backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(45, 74, 43, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(250, 250, 247, 0.96));
  pointer-events: none;
}
.final-questionnaire__shell {
  position: relative;
  z-index: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}
.final-questionnaire__hero {
  display: grid;
  gap: var(--s-3);
  max-width: 720px;
  margin-bottom: var(--s-7);
}
.final-questionnaire__hero .title-xl {
  margin-bottom: 0;
}
.final-questionnaire__hero .prose {
  margin: 0;
}
.final-questionnaire__sections {
  display: grid;
  gap: var(--s-7);
}
.survey-question {
  display: grid;
  gap: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.survey-question__head {
  display: grid;
  gap: var(--s-2);
  max-width: 780px;
}
.survey-question__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}
.survey-question__help {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.6;
}
.survey-question--compact-head {
  gap: var(--s-4);
}
.survey-question--compact-head .survey-question__head {
  max-width: 1080px;
  gap: var(--s-1);
}
.survey-question--compact-head .survey-question__title {
  max-width: 920px;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.28;
}
.survey-question--compact-head .survey-question__help {
  max-width: 920px;
  font-size: 13px;
  line-height: 1.5;
}
.survey-info {
  display: grid;
  gap: var(--s-3);
  max-width: 920px;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.65;
}
.survey-info__paragraph,
.survey-info__list {
  margin: 0;
}
.survey-info__list {
  padding-left: var(--s-5);
}
.survey-info__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
}
.survey-info__link,
.survey-pdf__fallback a {
  color: var(--accent);
  font-weight: 600;
}
.survey-pdf {
  display: grid;
  gap: var(--s-3);
}
.survey-pdf__frame {
  width: 100%;
  min-height: min(68vh, 760px);
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper);
}
.survey-pdf__fallback {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
}
.survey-choice-group {
  display: grid;
  gap: var(--s-3);
}
.survey-choice-group--multi-select {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.survey-question--inline .survey-choice-group {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.survey-question--grid .survey-choice-group {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.survey-choice {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.7);
  transition:
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
}
.survey-choice:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
}
.survey-choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.survey-choice__dot,
.survey-choice__check,
.survey-matrix__radio,
.survey-matrix__checkbox {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-elevated);
  box-shadow: inset 0 0 0 3px transparent;
  transition:
    box-shadow var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}
.survey-choice__dot,
.survey-matrix__radio {
  border-radius: 999px;
}
.survey-choice__check,
.survey-matrix__checkbox {
  border-radius: 3px;
}
.survey-choice input:checked + .survey-choice__dot,
.survey-choice input:checked + .survey-choice__check,
.survey-matrix__cell input:checked + .survey-matrix__radio,
.survey-matrix__cell input:checked + .survey-matrix__checkbox {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, white);
  box-shadow: inset 0 0 0 5px var(--accent);
}
.survey-choice input:focus-visible + .survey-choice__dot,
.survey-choice input:focus-visible + .survey-choice__check,
.survey-matrix__cell input:focus-visible + .survey-matrix__radio,
.survey-matrix__cell input:focus-visible + .survey-matrix__checkbox {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.survey-choice--full {
  grid-column: 1 / -1;
}
.survey-choice__label {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}
.survey-number {
  display: grid;
  gap: var(--s-2);
  max-width: 220px;
}
.survey-number__input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s-4);
  border: 1px solid var(--rule-strong);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.survey-number__hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}
.survey-text {
  display: grid;
  gap: var(--s-2);
}
.survey-text__input {
  width: 100%;
  min-height: 52px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--rule-strong);
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}
.survey-text__input--multiline {
  min-height: 140px;
}
.survey-table-wrap {
  overflow-x: auto;
  padding-bottom: var(--s-2);
}
.survey-matrix {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.62);
}
.survey-matrix th,
.survey-matrix td {
  padding: var(--s-4) var(--s-3);
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
}
.survey-matrix thead th {
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 84%, white);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink-3);
  text-align: center;
}
.survey-matrix tbody th {
  width: 26%;
  min-width: 220px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  text-align: left;
}
.survey-matrix td {
  text-align: center;
}
.survey-matrix__cell {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 100%;
  min-height: 44px;
}
.survey-matrix__cell--checkbox {
  min-width: 72px;
}
.survey-matrix__cell input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.final-questionnaire__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  padding-top: var(--s-6);
  margin-top: var(--s-2);
  border-top: 1px solid var(--rule);
}
.final-questionnaire__error {
  margin: 0;
  color: var(--error);
  font-size: 14px;
}
.final-questionnaire__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .final-questionnaire {
    padding: var(--s-5) var(--s-4) var(--s-6);
  }
  .final-questionnaire__sections {
    gap: var(--s-6);
  }
  .survey-question--inline .survey-choice-group,
  .survey-question--grid .survey-choice-group {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .survey-logo-header {
    padding: var(--s-4) var(--s-4) 0;
  }
  .institution-logos {
    gap: var(--s-4);
  }
  .logo-mit { height: 32px; }
  .logo-harvard { height: 40px; }
  .logo-northwestern { height: 25px; }

  .final-questionnaire__hero {
    margin-bottom: var(--s-6);
  }
  .survey-question {
    gap: var(--s-4);
  }
  .survey-matrix {
    min-width: 680px;
  }
  .final-questionnaire__footer {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  .final-questionnaire__actions {
    display: grid;
    gap: var(--s-3);
    width: calc(100vw - (2 * var(--s-4)));
    justify-items: stretch;
  }
  .final-questionnaire__actions .btn {
    width: 100%;
    inline-size: 100%;
    min-width: calc(100vw - (2 * var(--s-4)));
    justify-self: stretch;
  }
}

/* ============================================================================
   Utilities + small additions
============================================================================ */

/* Screen-reader-only text — visually hidden but exposed to assistive tech. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Button row at the bottom of consent / instructions / completion cards. */
.card__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  margin-top: var(--s-6);
  flex-wrap: wrap;
}
.card__actions .btn { min-width: 180px; }
@media (max-width: 520px) {
  .card__actions { flex-direction: column-reverse; }
  .card__actions .btn { width: 100%; }
  .comprehension-question { padding: var(--s-4); }
  .comprehension-question legend { font-size: 18px; }
  .comprehension-option {
    grid-template-columns: 20px minmax(0, 1fr);
    padding: 12px;
  }
}

@media (max-width: 860px) {
  .voice-instructions__steps {
    grid-template-columns: 1fr;
  }
  .voice-instructions__image {
    aspect-ratio: 16 / 10;
  }
}

/* Sound toggle icon — swap between muted/unmuted paths. */
.video-frame__sound .sound-on-only  { display: none; }
.video-frame__sound .sound-off-only { display: inline; }
.video-frame__sound.is-unmuted .sound-on-only  { display: inline; }
.video-frame__sound.is-unmuted .sound-off-only { display: none; }

/* Tap-to-play overlay — only visible when autoplay was blocked. */
.video-frame__tap {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--s-3);
  background: rgba(0, 0, 0, 0.42);
  border: 0;
  color: #F6F6F1;
  cursor: pointer;
  padding: 0;
  font: inherit;
  z-index: 2;
}
.video-frame__tap.is-visible { display: flex; }
.video-frame__tap-circle {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 10px 32px -8px rgba(0, 0, 0, 0.5);
  transition: transform var(--dur-fast) var(--ease);
}
.video-frame__tap:hover .video-frame__tap-circle { transform: scale(1.04); }
.video-frame__tap:active .video-frame__tap-circle { transform: scale(0.97); }
.video-frame__tap-label {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #F6F6F1;
}

.voice-snippet-control {
  position: absolute;
  left: var(--s-3);
  right: var(--s-3);
  bottom: calc(var(--s-3) + 10px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #F6F6F1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.voice-snippet-control__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.voice-snippet-control__button {
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 999px;
  background: rgba(12, 12, 12, 0.66);
  color: #F6F6F1;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.voice-snippet-control__button.is-recording {
  background: #B3261E;
  border-color: #B3261E;
}
.voice-snippet-control__button--skip:not(:disabled) {
  background: #F6F6F1;
  border-color: #F6F6F1;
  color: #0B0B0B;
}
.voice-snippet-control__button:disabled {
  opacity: 0.7;
}
.voice-snippet-control__status {
  min-width: 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: rgba(246,246,241,0.72);
  text-align: right;
}
.rating--voice-recording .voice-snippet-control,
.rating--voice-emotions .voice-snippet-control {
  display: none;
}

@media (max-width: 767.98px) {
  .rating--voice:not(.rating--voice-recording):not(.rating--voice-emotions) .voice-snippet-control {
    left: max(18px, env(safe-area-inset-left));
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    min-height: 44px;
    font-size: 14px;
  }
  .voice-snippet-control__actions {
    gap: 8px;
  }
  .voice-snippet-control__button {
    min-height: 44px;
    padding: 0 14px;
  }
}

/* Fieldset reset so the emo grid renders cleanly without default chrome. */
.emo-grid {
  border: 0;
  padding: 0;
  margin: 0;
}

.voice-recorder {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: var(--s-5);
  border: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #F6F6F1;
}
.voice-recorder[hidden] { display: none; }
.voice-recorder__panel {
  width: min(620px, 100%);
  margin-top: clamp(28px, 12vh, 120px);
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5);
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(0,0,0,0.66);
  text-align: left;
  box-shadow: 0 22px 60px rgba(0,0,0,0.22);
}
.voice-recorder__prompt,
.voice-recorder__status {
  margin: 0;
  font-family: var(--font-body);
}
.voice-recorder__prompt {
  max-width: 520px;
  color: #F6F6F1;
  font-weight: 600;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.2;
  text-shadow: 0 2px 14px rgba(0,0,0,0.65);
}
.voice-recorder__status {
  max-width: 540px;
  color: rgba(246,246,241,0.82);
  text-shadow: 0 2px 14px rgba(0,0,0,0.65);
}
.voice-status__primary,
.voice-status__hint {
  display: block;
}
.voice-status__primary {
  margin-bottom: 0.75rem;
}
.voice-status__hint {
  color: rgba(246,246,241,0.72);
}
.voice-transcripts {
  display: grid;
  gap: var(--s-2);
  max-height: min(28vh, 230px);
  overflow: auto;
}
.voice-transcripts[hidden] { display: none; }
.voice-transcript {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-3);
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.10);
}
.voice-transcript strong {
  padding-top: 2px;
  color: rgba(246,246,241,0.62);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.voice-transcript p {
  margin: 0;
  color: #F6F6F1;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.42;
}
.voice-transcript__empty {
  color: rgba(246,246,241,0.55);
  font-style: italic;
}
.voice-recorder__controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}
.voice-recorder__controls .btn {
  min-width: 0;
}
.voice-recorder__controls .btn.is-recording {
  background: #B3261E;
  border-color: #B3261E;
}

.voice-emotion-picker {
  position: absolute;
  inset: 0;
  z-index: 7;
  display: grid;
  align-items: center;
  justify-items: center;
  padding: var(--s-5);
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #F6F6F1;
}
.voice-emotion-picker__panel {
  width: min(620px, 100%);
  display: grid;
  gap: var(--s-4);
  padding: var(--s-5);
  border: 1px solid rgba(255,255,255,0.13);
  background: rgba(0,0,0,0.66);
  box-shadow: 0 22px 60px rgba(0,0,0,0.22);
}
.voice-emotion-picker .prompt__q {
  max-width: 520px;
  color: #F6F6F1;
  font-weight: 600;
  font-size: clamp(1.25rem, 2.4vw, 1.85rem);
  line-height: 1.2;
  text-shadow: 0 2px 14px rgba(0,0,0,0.65);
}
.voice-emotion-picker .emo-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.voice-emotion-picker .emo {
  min-height: 42px;
  border-color: rgba(255,255,255,0.24);
  background: rgba(255,255,255,0.10);
  color: #F6F6F1;
}
.voice-emotion-picker .emo:hover:not(:has(input:checked)) {
  border-color: rgba(255,255,255,0.54);
  color: #F6F6F1;
}
.voice-emotion-picker .emo:has(input:checked) {
  border-color: #F6F6F1;
  background: #F6F6F1;
  color: #0B0B0B;
}
.voice-emotion-picker .emo--special {
  border-style: dashed;
  color: rgba(246,246,241,0.78);
}
.voice-emotion-picker__note {
  min-height: 1.2em;
  margin: 0;
  color: rgba(246,246,241,0.72);
  font-family: var(--font-body);
  font-size: 13px;
}
.voice-emotion-picker__note:empty {
  visibility: hidden;
}
.voice-emotion-picker__controls {
  display: flex;
  justify-content: flex-end;
}
.voice-emotion-picker__controls .btn {
  min-width: 160px;
}

@media (max-width: 767.98px) {
  .voice-recorder {
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  .voice-recorder__panel {
    margin-top: clamp(24px, 10vh, 84px);
    padding: 18px;
  }
  .voice-recorder__prompt {
    font-size: clamp(1.45rem, 8vw, 2.1rem);
  }
  .voice-transcript {
    grid-template-columns: 1fr;
    gap: var(--s-1);
  }
  .voice-emotion-picker {
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  }
  .voice-emotion-picker__panel {
    padding: 18px;
    gap: var(--s-3);
  }
  .voice-emotion-picker .prompt__q {
    font-size: clamp(1.35rem, 7vw, 1.9rem);
  }
  .voice-emotion-picker .emo {
    min-height: 40px;
    padding: 5px 10px;
  }
  .voice-emotion-picker__controls {
    display: grid;
    justify-content: stretch;
  }
  .voice-emotion-picker__controls .btn {
    width: 100%;
  }
}

/* --- Scroll-survey wait/recovery screens (thin-client flow) --- */
.scroll-wait {
  text-align: center;
}
.scroll-wait__spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto var(--s-4);
  border-radius: 50%;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  animation: scroll-wait-spin 0.9s linear infinite;
}
@keyframes scroll-wait-spin { to { transform: rotate(360deg); } }
