:root {
  --bg: #111111;
  --panel: #171717;
  --panel-soft: #1b1b1b;
  --panel-elevated: #222222;
  --text: #f2f2f2;
  --text-soft: #d7d7d7;
  --muted: #919191;
  --muted-2: #6f6f6f;
  --border: #2d2d2d;
  --border-strong: #3b3b3b;
  --highlight: rgba(255, 214, 102, 0.25);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --content-width: 760px;
  --rail-width: 430px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
button, input { font: inherit; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 {
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.055em;
  line-height: 1.02;
  margin-bottom: 14px;
}
h2 {
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1.32;
  letter-spacing: -0.02em;
  margin-bottom: 0;
}
h3 {
  font-size: 17px;
  letter-spacing: -0.015em;
  margin-bottom: 0;
}
.hidden { display: none !important; }
.app-shell { width: 100%; min-height: 100vh; }

/* Landing screen */
.start-card {
  width: min(760px, calc(100vw - 40px));
  margin: 72px auto;
  background: #171717;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: clamp(28px, 4vw, 52px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 13px;
}
.brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ededed;
  color: #111;
  font-weight: 850;
  flex: 0 0 auto;
}
.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: 8px;
  text-transform: uppercase;
}
.lead {
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.65;
  max-width: 62ch;
}
.small { font-size: 13px; }
.muted { color: var(--muted); }
.primary-button {
  border: 1px solid #585858;
  background: #e9e9e9;
  color: #111;
  font-size: 14px;
  font-weight: 760;
  padding: 12px 17px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.primary-button:hover { background: #fff; transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }

/* Trial shell */
.study-screen { min-height: 100vh; }
.study-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - var(--content-width)) / 2));
  background: rgba(17, 17, 17, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.top-title {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -0.01em;
}
.top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}
.condition-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  color: var(--muted);
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  white-space: nowrap;
}
.progress-pill {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.progress-pill::before {
  content: "Trial";
  color: var(--muted);
  font-weight: 500;
  margin-right: 6px;
}
.study-layout { min-height: calc(100vh - 50px); }
.conversation-column {
  width: min(var(--content-width), calc(100vw - 40px));
  margin: 0 auto;
  padding: 0 0 54px;
}
.chat-turn { display: block; margin: 0; }
.message-card,
.judgement-card,
.sources-card {
  border: 0;
  box-shadow: none;
}
.message-card {
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.user-message {
  margin-top: 52px;
  margin-bottom: 30px;
}
.user-message h2 {
  font-size: 20px;
  color: var(--text-soft);
  font-weight: 560;
  line-height: 1.5;
}
.user-message h2::before {
  content: "Question";
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
}
.assistant-message {
  background: transparent;
}
.assistant-message::before {
  content: "Answer";
  display: inline-block;
  color: var(--text);
  border-bottom: 2px solid var(--text-soft);
  padding-bottom: 12px;
  margin-bottom: 18px;
  font-size: 14px;
  font-weight: 750;
}
.answer-text {
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  color: #f4f4f4;
  font-size: 19px;
  line-height: 1.72;
  margin-bottom: 18px;
}
.inline-citation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  margin-left: 5px;
  transform: translateY(-1px);
  border: 0;
  background: #252525;
  color: #dcdcdc;
  border-radius: 6px;
  padding: 0 6px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 12px;
  font-weight: 760;
  cursor: pointer;
}
.inline-citation:hover,
.inline-citation:focus-visible {
  background: #353535;
  color: #fff;
  outline: none;
}
.sources-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border: 1px solid var(--border);
  background: #202020;
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 12px 6px 7px;
  font-size: 13px;
  font-weight: 720;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.sources-badge:hover,
.sources-badge:focus-visible {
  background: #282828;
  border-color: #454545;
  transform: translateY(-1px);
  outline: none;
}
.source-logos {
  display: inline-flex;
  align-items: center;
  min-width: 28px;
}
.source-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #111;
  background: #e6e6e6;
  border: 2px solid #202020;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}
.source-logo + .source-logo { margin-left: -7px; }

/* Sources rail. It is aligned to the right edge and collapsed by default. */
.sources-rail {
  position: fixed;
  z-index: 80;
  top: 50px;
  right: 0;
  width: min(var(--rail-width), 92vw);
  height: calc(100vh - 50px);
  background: #121212;
  border-left: 1px solid var(--border);
  overflow: auto;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  box-shadow: -26px 0 64px rgba(0, 0, 0, 0.38);
}
body.sources-open .sources-rail { transform: translateX(0); }
.sources-card {
  background: transparent;
  border-radius: 0;
  padding: 0 0 34px;
}
.sources-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 50px;
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 18, 18, 0.96);
  backdrop-filter: blur(12px);
}
.rail-close {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.rail-close:hover,
.rail-close:focus-visible {
  background: #222;
  color: #fff;
  outline: none;
}
.source-count {
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}
.margin-help {
  margin: 18px 22px;
  color: var(--muted);
  line-height: 1.45;
  max-width: 360px;
}
.evidence-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0;
}
.evidence-item {
  position: relative;
  border: 0;
  border-radius: 0;
  padding: 14px 22px 16px;
  background: transparent;
  transition: background 0.15s ease;
}
.evidence-item.active { background: #181818; }
.evidence-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 16px;
  width: 2px;
  border-radius: 999px;
  background: #d7d7d7;
}
.evidence-header {
  width: 100%;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 11px;
  align-items: flex-start;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 0;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.evidence-header:hover .evidence-title {
  color: #fff;
  text-decoration: underline;
}
a.evidence-header .evidence-title::after {
  content: "↗";
  display: inline;
  margin-left: 5px;
  color: var(--muted-2);
  font-size: 11px;
}
.citation-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e6e6e6;
  color: #111;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-weight: 850;
  font-size: 11px;
  flex: 0 0 auto;
  margin-top: 2px;
}
.evidence-title {
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 570;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.evidence-title::before {
  content: attr(data-domain);
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.2;
  margin-bottom: 3px;
}
.evidence-text,
.evidence-text-empty {
  margin: 6px 0 0 35px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.evidence-bullets {
  margin: 7px 0 0 35px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.evidence-bullets li {
  margin: 0 0 6px;
}
.evidence-bullets li:last-child {
  margin-bottom: 0;
}
.evidence-text-empty {
  color: var(--muted-2);
  font-style: normal;
}
mark {
  color: #fff;
  background: var(--highlight);
  border-radius: 4px;
  padding: 0 2px;
  font-weight: 700;
}

/* Judgement panel */
.judgement-card {
  margin: 46px 0 0;
  padding: 22px;
  background: #171717;
  border: 1px solid var(--border);
  border-radius: 16px;
}
.judgement-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
#response-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 14px 0;
  background: #141414;
}
#response-form legend {
  font-weight: 690;
  padding: 0 6px;
  line-height: 1.35;
  color: var(--text-soft);
}
#response-form label {
  color: var(--text-soft);
  cursor: pointer;
}
.scale {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.scale label {
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  place-items: center;
  padding: 7px 4px;
  background: #101010;
  text-align: center;
  gap: 3px;
}
.scale input { accent-color: #fff; }
.scale span { font-weight: 760; }
.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.radio-grid label,
.radio-row label {
  border: 1px solid var(--border);
  background: #101010;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.radio-row label { min-width: 120px; }
input[type="radio"] { accent-color: #fff; }

/* Make selected radio/rating options visually obvious on the dark UI.
   The JS-added .choice-selected class is the robust path; :has() is a CSS fallback/enhancement. */
.scale label,
.radio-grid label,
.radio-row label,
.checkbox-grid label,
.motivation-column label {
  position: relative;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.scale label.choice-selected,
.scale label:has(input:checked),
.radio-grid label.choice-selected,
.radio-grid label:has(input:checked),
.radio-row label.choice-selected,
.radio-row label:has(input:checked),
.checkbox-grid label.choice-selected,
.checkbox-grid label:has(input:checked),
.motivation-column label.choice-selected,
.motivation-column label:has(input:checked) {
  background: #ededed;
  border-color: #ffffff;
  color: #111111;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24), 0 10px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}

.scale label.choice-selected::after,
.scale label:has(input:checked)::after,
.radio-grid label.choice-selected::after,
.radio-grid label:has(input:checked)::after,
.radio-row label.choice-selected::after,
.radio-row label:has(input:checked)::after,
.checkbox-grid label.choice-selected::after,
.checkbox-grid label:has(input:checked)::after,
.motivation-column label.choice-selected::after,
.motivation-column label:has(input:checked)::after {
  content: "✓";
  position: absolute;
  top: 7px;
  right: 9px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #111111;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.scale label.choice-selected .muted,
.scale label:has(input:checked) .muted,
.radio-grid label.choice-selected .muted,
.radio-grid label:has(input:checked) .muted,
.radio-row label.choice-selected .muted,
.radio-row label:has(input:checked) .muted,
.checkbox-grid label.choice-selected .muted,
.checkbox-grid label:has(input:checked) .muted,
.motivation-column label.choice-selected .muted,
.motivation-column label:has(input:checked) .muted {
  color: #555555;
}

.scale label.choice-selected input[type="radio"],
.scale label:has(input:checked) input[type="radio"],
.radio-grid label.choice-selected input[type="radio"],
.radio-grid label:has(input:checked) input[type="radio"],
.radio-row label.choice-selected input[type="radio"],
.radio-row label:has(input:checked) input[type="radio"],
.checkbox-grid label.choice-selected input[type="checkbox"],
.checkbox-grid label:has(input:checked) input[type="checkbox"],
.motivation-column label.choice-selected input[type="checkbox"],
.motivation-column label:has(input:checked) input[type="checkbox"] {
  accent-color: #111111;
}

.next-button { margin-top: 8px; }

@media (max-width: 900px) {
  .study-header {
    padding: 0 18px;
  }
  .condition-chip { display: none; }
  .conversation-column {
    width: min(calc(100vw - 32px), var(--content-width));
  }
  .radio-grid { grid-template-columns: 1fr; }
  .scale { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .top-title { font-size: 13px; }
  .user-message { margin-top: 32px; }
  .answer-text { font-size: 17px; }
  .judgement-card { padding: 16px; }
  .scale { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Post-example NASA-TLX and post-study survey */
.post-example-column {
  padding-top: 52px;
}
.tlx-card,
.survey-card {
  margin-top: 0;
}
.tlx-intro {
  line-height: 1.55;
  margin-bottom: 18px;
}
.tlx-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}
.tlx-slider {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px;
  background: #141414;
  color: var(--text-soft);
}
.tlx-slider span {
  font-weight: 720;
}
.tlx-slider small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
}
.tlx-slider input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  accent-color: #f0f0f0;
}
.tlx-anchors {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}
.tlx-anchors span:last-child {
  text-align: right;
}
.tlx-slider output {
  justify-self: end;
  min-width: 42px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text);
  background: #101010;
  text-align: center;
  font-size: 12px;
  font-weight: 780;
}
.tlx-scale-legend {
  display: flex;
  justify-content: space-between;
  margin: 12px 2px 8px;
}
.progress-pill.no-prefix::before {
  content: "";
  display: none;
}
.verification-motivation-field {
  margin-top: 18px;
}

.motivation-behavior-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 4px 0 10px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #101010;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.01em;
}
.motivation-behavior-pill.clicked {
  border-color: rgba(112, 184, 255, 0.55);
  background: rgba(72, 142, 220, 0.16);
  color: #d7eaff;
}
.motivation-behavior-pill.not-clicked {
  border-color: rgba(205, 205, 205, 0.28);
  background: rgba(255, 255, 255, 0.06);
  color: #efefef;
}
.motivation-column-desc {
  margin: -3px 0 10px;
  line-height: 1.35;
}

.motivation-word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.motivation-column {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #141414;
  padding: 14px;
}
.motivation-column h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}
.motivation-column label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #101010;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.motivation-column label + label {
  margin-top: 8px;
}
.motivation-column input[type="checkbox"] {
  accent-color: #ffffff;
}
.motivation-column label.choice-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.motivation-help {
  margin-top: 10px;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 100px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #101010;
  color: var(--text-soft);
  padding: 12px;
  font: inherit;
}
textarea:focus-visible {
  outline: 2px solid #555;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .tlx-grid { grid-template-columns: 1fr; }
}
.optional-label {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
}
@media (max-width: 760px) {
  .motivation-word-grid { grid-template-columns: 1fr; }
}


/* Pre-trial familiarity and fake online-search step */
.pretrial-card .pretrial-question-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #101010;
  padding: 16px;
  margin: 16px 0 18px;
}
.pretrial-question-box h2 {
  color: var(--text-soft);
  font-size: 20px;
  font-weight: 560;
  line-height: 1.48;
}
.search-card {
  padding: 28px;
}
.search-query {
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1.55;
  margin: 16px 0 22px;
}
.fake-search-steps {
  display: grid;
  gap: 10px;
  margin: 18px 0 18px;
}
.fake-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.fake-step::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #333;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.02);
}
.fake-step.active { color: var(--text); }
.fake-step.active::before {
  background: #ededed;
  animation: pulse 0.7s ease-in-out infinite alternate;
}
.fake-step.done { color: var(--text-soft); }
.fake-step.done::before { background: #868686; }
.search-loader {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: #262626;
}
.search-loader::after {
  content: "";
  display: block;
  height: 100%;
  width: 38%;
  border-radius: inherit;
  background: #ededed;
  animation: loader-slide 1.05s ease-in-out infinite;
}
@keyframes loader-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(275%); }
}
@keyframes pulse {
  from { opacity: .55; transform: scale(.9); }
  to { opacity: 1; transform: scale(1.08); }
}

/* NASA-TLX sliders: no numeric output; untouched sliders start visually unselected. */
.tlx-slider input[type="range"].tlx-untouched::-webkit-slider-thumb { opacity: 0; }
.tlx-slider input[type="range"].tlx-untouched::-moz-range-thumb {
  opacity: 0;
  border-color: transparent;
  background: transparent;
}
.tlx-slider:has(input.tlx-untouched) {
  border-style: dashed;
}
.tlx-slider:has(input.tlx-untouched)::after {
  content: "Touch to rate";
  grid-column: 1 / -1;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: -2px;
}

/* Final survey: multi-select research assistants. */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.checkbox-grid label {
  border: 1px solid var(--border);
  background: #101010;
  border-radius: 12px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  cursor: pointer;
}
.checkbox-grid input[type="checkbox"] { accent-color: #ffffff; }
.other-text-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-soft);
}
.other-text-row input[type="text"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #101010;
  color: var(--text-soft);
  padding: 11px 12px;
}
.other-text-row input[type="text"]:focus-visible {
  outline: 2px solid #555;
  outline-offset: 2px;
}
@media (max-width: 760px) {
  .checkbox-grid { grid-template-columns: 1fr; }
}
/* Keep selected research-assistant checkboxes visible after the base checkbox-grid rules. */
.checkbox-grid label.choice-selected,
.checkbox-grid label:has(input:checked) {
  background: #ededed;
  border-color: #ffffff;
  color: #111111;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.24), 0 10px 28px rgba(0, 0, 0, 0.28);
  transform: translateY(-1px);
}
.checkbox-grid label.choice-selected input[type="checkbox"],
.checkbox-grid label:has(input:checked) input[type="checkbox"] {
  accent-color: #111111;
}

/* Perplexity-like submitted-query loading state */
.loading-conversation {
  padding-top: 36px;
}
.loading-user-turn .user-message {
  margin-top: 20px;
  margin-bottom: 34px;
}
.loading-user-turn .user-message h2 {
  font-size: 24px;
  line-height: 1.38;
  color: #f1f1f1;
  letter-spacing: -0.025em;
}
.loading-assistant-message::before {
  content: none;
  display: none;
}
.loading-assistant-message {
  min-height: 380px;
}
.loading-answer-label {
  display: inline-block;
  color: var(--text);
  border-bottom: 2px solid var(--text-soft);
  padding-bottom: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 750;
}
.assistant-loading-header {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  width: fit-content;
  color: var(--text-soft);
  font-size: 16px;
  font-weight: 740;
  margin: 0 0 18px;
}
.assistant-orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #ffffff 0 12%, transparent 14%),
    conic-gradient(from 210deg, #e7e7e7, #777, #303030, #e7e7e7);
  box-shadow: 0 0 18px rgba(255,255,255,0.13);
  animation: assistant-orb-spin 1.35s linear infinite;
}
.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  transform: translateY(2px);
}
.thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.35;
  animation: thinking-dot 1.05s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots i:nth-child(3) { animation-delay: 0.32s; }
.perplexity-search-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 22px;
}
.perplexity-step {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #151515;
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 680;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.perplexity-step::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3a3a3a;
}
.perplexity-step.active {
  color: #ffffff;
  background: #242424;
  border-color: #555555;
  transform: translateY(-1px);
}
.perplexity-step.active::before {
  background: #f1f1f1;
  box-shadow: 0 0 0 5px rgba(255,255,255,0.07);
  animation: pulse 0.7s ease-in-out infinite alternate;
}
.perplexity-step.done {
  color: var(--text-soft);
  border-color: #353535;
}
.perplexity-step.done::before {
  background: #8d8d8d;
}
.source-skeleton-list {
  display: grid;
  gap: 12px;
  max-width: 640px;
  margin-top: 8px;
}
.source-skeleton-card {
  opacity: 0;
  transform: translateY(8px);
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #161616;
  padding: 13px 14px;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.source-skeleton-card.visible {
  opacity: 1;
  transform: translateY(0);
}
.source-skeleton-card span,
.source-skeleton-card b,
.source-skeleton-card em {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, #242424, #393939, #242424);
  background-size: 220% 100%;
  animation: shimmer 1.25s ease-in-out infinite;
}
.source-skeleton-card span {
  width: 76px;
  height: 10px;
  margin-bottom: 10px;
}
.source-skeleton-card b {
  width: min(460px, 82%);
  height: 13px;
  margin-bottom: 9px;
}
.source-skeleton-card em {
  width: min(560px, 96%);
  height: 11px;
  opacity: .78;
}
@keyframes assistant-orb-spin {
  to { transform: rotate(360deg); }
}
@keyframes thinking-dot {
  0%, 80%, 100% { opacity: 0.28; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-4px); }
}
@keyframes shimmer {
  0% { background-position: 160% 0; }
  100% { background-position: -80% 0; }
}

/* Explicit task-only phase before the judgement questionnaire. */
.task-section {
  padding-bottom: 22px;
}
.task-review-panel {
  margin: 30px 0 0;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #141414;
}
.task-review-panel p:last-child { margin-bottom: 0; }
.secondary-button {
  border: 1px solid var(--border-strong);
  background: #242424;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 740;
  padding: 11px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.secondary-button:hover,
.secondary-button:focus-visible {
  background: #303030;
  border-color: #555;
  color: #fff;
  transform: translateY(-1px);
  outline: none;
}
.questionnaire-card {
  margin-top: 72px;
  position: relative;
  background: #191919;
}
.section-divider {
  position: absolute;
  left: 0;
  right: 0;
  top: -44px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.section-divider::before,
.section-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
  flex: 1 1 auto;
}
.section-divider span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  background: #111;
}
@media (max-width: 640px) {
  .task-review-panel {
    align-items: stretch;
    flex-direction: column;
  }
  .secondary-button { width: 100%; }
}

/* Questionnaire areas use a distinct neutral-gray research-survey layer,
   while the Q+A/evidence task above remains the darker Perplexity-like interface. */
.questionnaire-card,
.tlx-card,
.survey-card {
  background: #242424;
  border-color: #4a4a4a;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.questionnaire-card fieldset,
.tlx-card fieldset,
.survey-card fieldset,
.questionnaire-card .tlx-slider,
.tlx-card .tlx-slider,
.survey-card .tlx-slider,
.questionnaire-card .motivation-column,
.tlx-card .motivation-column,
.survey-card .motivation-column {
  background: #1d1d1d;
  border-color: #444444;
}
.questionnaire-card .scale label,
.tlx-card .scale label,
.survey-card .scale label,
.tlx-card .motivation-column label,
.survey-card .checkbox-grid label,
.survey-card .radio-grid label {
  background: #151515;
  border-color: #3d3d3d;
}
.questionnaire-card .section-divider::before,
.questionnaire-card .section-divider::after {
  background: #505050;
}
.questionnaire-card .section-divider span {
  background: #2a2a2a;
  border-color: #505050;
  color: #dedede;
}
.questionnaire-card .eyebrow,
.tlx-card .eyebrow,
.survey-card .eyebrow {
  color: #b8b8b8;
}

.motivation-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 10px;
}
.motivation-pill-row .motivation-behavior-pill {
  margin: 0;
}
.motivation-behavior-pill.detail-pill {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #dcdcdc;
}
.motivation-word-grid.single-motivation-group {
  grid-template-columns: minmax(0, 1fr);
  max-width: 540px;
}
.motivation-word-grid.single-motivation-group .motivation-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.motivation-word-grid.single-motivation-group .motivation-column h4,
.motivation-word-grid.single-motivation-group .motivation-column .motivation-column-desc {
  grid-column: 1 / -1;
}
.motivation-word-grid.single-motivation-group .motivation-column label + label {
  margin-top: 0;
}
@media (max-width: 760px) {
  .motivation-word-grid.single-motivation-group .motivation-column {
    grid-template-columns: 1fr;
  }
}

.motivation-sentence-prompt {
  margin: 10px 0 6px;
  color: #eeeeee;
  font-size: 15px;
  font-weight: 760;
  line-height: 1.45;
}

.motivation-word-grid.single-motivation-group {
  max-width: 680px;
}

/* Post-trial questionnaire: keep workload and motivation visually distinct. */
.posttrial-form {
  display: grid;
  gap: 22px;
  margin: 0;
}
.posttrial-form .judgement-card {
  margin-top: 0;
}
.posttrial-box {
  background: #242424;
  border-color: #4a4a4a;
}
.posttrial-form fieldset.verification-motivation-field {
  min-inline-size: 0;
  padding: 22px;
  margin: 0;
}
.verification-motivation-field > legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.motivation-header legend {
  display: block;
  padding: 0;
  margin: 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
  line-height: 1.25;
}
.motivation-instruction {
  margin: 2px 0 10px;
  line-height: 1.55;
}
.motivation-debug-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 2px 0 12px;
  padding: 10px 12px;
  border: 1px dashed #555;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.motivation-debug-row .motivation-behavior-pill {
  margin: 0;
}
.motivation-debug-text {
  margin: 0;
}
.posttrial-actions {
  display: flex;
  justify-content: flex-end;
}
.posttrial-actions .next-button {
  margin-top: 0;
}

/* Post-trial refinements: stable slider hint, thicker sliders, visible thumbs, inline validation. */
.form-error {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 96, 96, 0.75);
  border-radius: 12px;
  background: rgba(255, 58, 58, 0.11);
  color: #ffd7d7;
  font-size: 13px;
  font-weight: 760;
  box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.45);
  animation: validation-glow 1.1s ease-in-out infinite alternate;
}
.form-error.hidden {
  display: none;
}
.has-validation-error {
  border-color: rgba(255, 96, 96, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(255, 79, 79, 0.22), 0 18px 54px rgba(0, 0, 0, 0.36) !important;
}
.tlx-slider.needs-attention {
  border-color: rgba(255, 96, 96, 0.85) !important;
  box-shadow: 0 0 0 2px rgba(255, 79, 79, 0.20);
}
@keyframes validation-glow {
  from { box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.25); }
  to { box-shadow: 0 0 18px 2px rgba(255, 82, 82, 0.42); }
}

.tlx-slider::after {
  content: "\00a0";
  grid-column: 1 / -1;
  min-height: 14px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-top: -2px;
}
.tlx-slider:has(input.tlx-untouched)::after {
  content: "Touch to rate";
}
.tlx-slider:has(input.tlx-untouched) {
  border-style: solid;
}
.tlx-slider input[type="range"].tlx-untouched::-webkit-slider-thumb,
.tlx-slider input[type="range"].tlx-untouched::-moz-range-thumb {
  opacity: 1 !important;
  border-color: #f3f3f3 !important;
  background: #5e5e5e !important;
}
.tlx-slider input[type="range"] {
  height: 22px;
  background: transparent;
  accent-color: #f3f3f3;
}
.tlx-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: #d8d8d8;
}
.tlx-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border-radius: 50%;
  border: 2px solid #f3f3f3;
  background: #5e5e5e;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.38);
}
.tlx-slider input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: #d8d8d8;
}
.tlx-slider input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #f3f3f3;
  background: #5e5e5e;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.38);
}

/* Development-only complete-pool navigation. Hidden unless DEBUG=1. */
body.debug-mode {
  padding-bottom: 74px;
}
.debug-toolbar {
  position: fixed;
  z-index: 120;
  left: 14px;
  right: 14px;
  bottom: 14px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(25, 25, 25, 0.94);
  box-shadow: 0 18px 64px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(16px);
}
.debug-toolbar-main {
  min-width: 180px;
  display: grid;
  gap: 2px;
}
.debug-toolbar-main strong {
  color: #fff;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.debug-trial-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}
.debug-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.debug-toolbar button,
.debug-toolbar select {
  min-height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #111;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 720;
  padding: 0 12px;
}
.debug-toolbar button {
  cursor: pointer;
}
.debug-toolbar button:hover:not(:disabled),
.debug-toolbar select:hover {
  background: #1f1f1f;
  color: #fff;
}
.debug-toolbar button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.debug-toolbar select {
  width: min(620px, 54vw);
  border-radius: 12px;
}

@media (max-width: 760px) {
  .debug-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .debug-toolbar-controls {
    justify-content: stretch;
    flex-wrap: wrap;
  }
  .debug-toolbar select {
    width: 100%;
    order: -1;
  }
}

/* Debug review: compact controls for example, phase, and questionnaire-question navigation. */
.debug-toolbar #debug-jump {
  width: min(430px, 34vw);
}
.debug-toolbar #debug-phase {
  width: 170px;
}
.debug-toolbar #debug-question {
  width: min(300px, 24vw);
}
.debug-focus-flash {
  outline: 2px solid rgba(255, 255, 255, 0.72);
  outline-offset: 4px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.16), 0 18px 54px rgba(0, 0, 0, 0.36) !important;
  transition: outline-color 0.2s ease, box-shadow 0.2s ease;
}
@media (max-width: 980px) {
  .debug-toolbar #debug-jump,
  .debug-toolbar #debug-phase,
  .debug-toolbar #debug-question {
    width: 100%;
  }
}
