:root {
  --site-bg: #eef1f5;
  --site-surface: #ffffff;
  --site-surface-tinted: #f1f5f9;
  --site-surface-muted: #f8fafc;
  --site-border: #cbd5e1;
  --site-border-strong: #94a3b8;
  --site-text: #0f172a;
  --site-text-muted: #475569;
  --site-accent: #1d4ed8;
  --site-accent-hover: #1e3a8a;
  --site-accent-disabled: #94a3b8;
  --site-warning-bg: #fef2f2;
  --site-warning-text: #991b1b;
  --site-warning-border: #fca5a5;
  --site-warning-rail: #dc2626;
  color-scheme: light;
}
html, body {
  height: 100%;
}
body {
  margin: 0;
  overflow: hidden;
  background: var(--site-bg);
  color: var(--site-text);
  display: flex;
  flex-direction: column;
}
.ps-player-page {
  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;
  padding: 24px;
  overflow: hidden;
}
.ps-player-screen {
  height: 100%;
  min-height: 0;
}
.ps-player-screen[hidden] {
  display: none;
}
.ps-player-center-screen {
  display: grid;
  place-items: center;
}
.ps-player-card {
  width: min(56rem, 100%);
  align-self: stretch;
  max-height: 100%;
  padding: 24px 32px;
  border: 1px solid var(--site-border);
  border-radius: 14px;
  background: var(--site-surface);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  min-height: 0;
}
.ps-player-card--auto {
  align-self: center;
  max-height: 100%;
}
.ps-player-card > .ps-player-non-prolific-warning,
.ps-player-card > .ps-player-card-title,
.ps-player-card > .ps-player-rule,
.ps-player-card > .ps-player-consent-checkboxes,
.ps-player-card > .ps-player-consent-button-row,
.ps-player-card > .ps-player-card-actions {
  flex: 0 0 auto;
}
/* Reusable action region: one full-width primary button per page (consent's */
/* Cancel link is the only allowed extra, handled by .ps-player-consent-button-row). */
.ps-player-card-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ps-player-card-actions form {
  display: contents;
}

.ps-player-card-title {
  margin: 0;
}
.ps-player-instructions-title-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}
.ps-player-instructions-title-step {
  flex: 0 0 auto;
  color: var(--site-text-muted);
  white-space: nowrap;
}
.ps-player-rule {
  border: 0;
  border-top: 1px solid var(--site-border);
  margin: 0;
  width: 100%;
}

.ps-player-non-prolific-warning {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--site-warning-border);
  border-left: 4px solid var(--site-warning-rail);
  border-radius: 8px;
  background: var(--site-warning-bg);
  color: var(--site-warning-text);
}
.ps-player-non-prolific-warning-text {
  flex: 1 1 auto;
  min-width: 0;
}
.ps-player-non-prolific-warning strong {
  color: var(--site-warning-rail);
  font-weight: 700;
  margin-right: 0.4em;
}
.ps-player-non-prolific-warning .ps-player-notice-action {
  flex: 0 0 auto;
  margin: 0;
}

.ps-player-consent-greeting {
  margin: 0;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--site-text-muted);
}
.ps-player-consent-body {
  width: 100%;
  margin-inline: auto;
  display: grid;
  gap: 1rem;
  text-align: left;
}
.ps-player-consent-body > * {
  margin: 0;
}
.ps-player-consent-body p {
  font-family: var(--font-body);
}
.ps-player-consent-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}
.ps-player-consent-list li {
  font-family: var(--font-body);
}
.ps-player-consent-list strong {
  font-weight: 700;
}
.ps-player-consent-list a {
  color: var(--site-accent);
  text-decoration: underline;
}
/* Canonical scroll region — bordered scrollable area with bottom fade. */
/* Used by consent body, instructions body, quiz questions, survey fields. */
.ps-player-scroll-wrap {
  position: relative;
  /* flex-basis: auto so the wrap counts its content for sizing inside an auto-height */
  /* card (instructions/done). flex-grow: 1 lets it fill leftover space inside a */
  /* stretched card (consent/quiz/survey). flex-shrink: 1 + min-height: 0 lets it */
  /* shrink past content size when the card is height-capped — that's what triggers */
  /* the inner overflow-y: auto to actually scroll. */
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.ps-player-scroll {
  width: 100%;
  overflow-y: auto;
  border: 1px solid var(--site-border);
  border-radius: 10px;
  padding: 20px 24px;
  box-sizing: border-box;
  background: var(--site-surface);
}
.ps-player-scroll-fade {
  position: absolute;
  bottom: 1px;
  left: 1px;
  right: 1px;
  height: 36px;
  background: linear-gradient(to top, var(--site-surface) 25%, transparent);
  border-bottom-left-radius: 9px;
  border-bottom-right-radius: 9px;
  pointer-events: none;
  transition: opacity 200ms ease;
  opacity: 1;
}
.ps-player-scroll-wrap[data-at-bottom="true"] .ps-player-scroll-fade {
  opacity: 0;
}
.ps-player-scroll-prompt {
  margin: 0;
  text-align: center;
  font-style: italic;
  color: var(--site-text-muted);
}
.ps-player-scroll-prompt[hidden] {
  display: none;
}

.ps-player-consent-checkboxes {
  width: 100%;
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--site-surface-tinted);
  border: 1px solid var(--site-border);
  text-align: left;
}
.ps-player-consent-checkbox-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 6px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--site-text);
  transition: background 120ms ease;
}
.ps-player-consent-checkbox-row:hover:not(:has(input[disabled])) {
  background: rgba(30, 64, 175, 0.06);
}
.ps-player-consent-checkbox-row:has(input[disabled]) {
  cursor: not-allowed;
  color: var(--site-text-muted);
}
.ps-player-consent-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: 2px solid var(--site-border-strong);
  border-radius: 6px;
  background: var(--site-surface);
  cursor: inherit;
  display: grid;
  place-items: center;
  transition: border-color 200ms ease, background-color 120ms ease, transform 120ms ease;
}
.ps-player-consent-checkbox:disabled {
  background: var(--site-surface-muted);
  border-color: var(--site-border);
}
.ps-player-consent-checkbox:not(:disabled):hover {
  border-color: var(--site-accent);
}
.ps-player-consent-checkbox:checked {
  background: var(--site-accent);
  border-color: var(--site-accent);
}
.ps-player-consent-checkbox:checked::after {
  content: "";
  width: 12px;
  height: 7px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.ps-player-consent-checkbox[data-just-unlocked="true"] {
  animation: ps-checkbox-unlock 600ms ease;
}
@keyframes ps-checkbox-unlock {
  0%   { border-color: var(--site-border); }
  30%  { border-color: var(--site-accent); transform: scale(1.06); }
  60%  { border-color: var(--site-accent); transform: scale(1); }
  100% { border-color: var(--site-border-strong); }
}

.ps-player-consent-button-row {
  width: 100%;
  display: flex;
  gap: 16px;
  align-items: center;
}
.ps-player-consent-button-row > .ps-player-agree-button {
  flex: 1 1 auto;
  width: auto;
}
.ps-player-cancel-link {
  background: none;
  border: 0;
  padding: 8px 4px;
  color: var(--site-text-muted);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ps-player-cancel-link:hover {
  color: var(--site-text);
}
.ps-player-agree-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  width: 100%;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 10px;
  background: var(--site-accent);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
  box-sizing: border-box;
}
.ps-player-agree-button:hover:not([disabled]) {
  background: var(--site-accent-hover);
}
.ps-player-agree-button[disabled] {
  background: var(--site-accent-disabled);
  cursor: not-allowed;
}
.ps-player-button-spinner {
  display: none;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ps-spin 0.6s linear infinite;
}
.ps-player-agree-button[data-busy="true"] .ps-player-button-spinner {
  display: inline-block;
}
@keyframes ps-spin {
  to { transform: rotate(360deg); }
}

#desktop-required-screen {
  display: none;
}
@media (max-width: 1023px), (pointer: coarse), (hover: none) {
  #intro-screen {
    display: none !important;
  }
  #desktop-required-screen {
    display: grid;
  }
}
/* Survey form - labels, textareas, and radio choice pills */
.ps-player-survey-field {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--site-text);
}
.ps-player-survey-field--choice {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.ps-player-survey-label {
  display: inline;
  padding: 0;
}
.ps-player-survey-required {
  color: #b91c1c;
  margin-left: 0.25em;
  font-weight: 700;
}
.ps-player-survey-choice {
  display: grid;
  gap: 6px;
}
.ps-player-survey-choice-scale {
  display: grid;
  gap: 6px;
}
.ps-player-survey-choice-scale--likert {
  grid-template-columns: repeat(10, 1fr);
}
.ps-player-survey-choice-scale--compact {
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  max-width: 18rem;
}
.ps-player-survey-choice-option {
  position: relative;
  display: block;
  cursor: pointer;
}
.ps-player-survey-choice-option input[type="radio"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.ps-player-survey-choice-option-label {
  display: block;
  padding: 8px 0;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  background: var(--site-surface);
  color: var(--site-text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  user-select: none;
  transition: background-color 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}
.ps-player-survey-choice-option:hover .ps-player-survey-choice-option-label {
  border-color: var(--site-accent);
}
.ps-player-survey-choice-option input[type="radio"]:focus-visible + .ps-player-survey-choice-option-label {
  outline: 2px solid var(--site-accent);
  outline-offset: 2px;
}
.ps-player-survey-choice-option input[type="radio"]:checked + .ps-player-survey-choice-option-label {
  background: var(--site-accent);
  border-color: var(--site-accent);
  color: var(--site-surface);
}
.ps-player-likert-endpoints {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 400;
  font-size: 14px;
  color: var(--site-text-muted);
}
.ps-player-likert-endpoints > span:last-child {
  text-align: right;
}
.ps-player-survey-form textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  background: var(--site-surface);
  color: var(--site-text);
  font-family: var(--font-body);
  font-weight: 400;
  resize: vertical;
  box-sizing: border-box;
}
.ps-player-survey-form textarea:focus {
  outline: 2px solid var(--site-accent);
  outline-offset: 1px;
  border-color: var(--site-accent);
}

/* Anchor-styled-as-primary-button (used for "Submit to Prolific" link) */
.ps-player-agree-button--link {
  text-decoration: none;
  display: inline-flex;
  line-height: 1;
}

/* Quiz */
.ps-player-quiz-card {
  gap: 14px;
}
.ps-player-quiz-card > .ps-player-quiz-meta,
.ps-player-quiz-card > .ps-player-alert {
  flex: 0 0 auto;
}
.ps-player-quiz-meta {
  margin: 0;
  color: var(--site-text-muted);
}
.ps-player-alert {
  padding: 12px 16px;
  border: 1px solid var(--site-warning-border);
  border-left: 4px solid var(--site-warning-rail);
  border-radius: 8px;
  background: var(--site-warning-bg);
  color: var(--site-warning-text);
}
/* Form shell — flex-column form whose scroll region grows to fill the card. */
/* Used by quiz, survey. Pair with .ps-player-scroll-wrap inside. */
.ps-player-card-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
}
/* Quiz/survey scroll content — vertical stack of fields/questions. */
.ps-player-scroll--stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.ps-player-quiz-question {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.ps-player-quiz-prompt {
  padding: 0;
  margin: 0 0 4px 0;
  font-weight: 650;
  color: var(--site-text);
}
.ps-player-quiz-options {
  display: grid;
  gap: 8px;
}
.ps-player-quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  background: var(--site-surface);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.ps-player-quiz-option:hover {
  border-color: var(--site-accent);
  background: rgba(29, 78, 216, 0.04);
}
.ps-player-quiz-option:has(input[type="radio"]:checked) {
  border-color: var(--site-accent);
  background: rgba(29, 78, 216, 0.08);
}
.ps-player-quiz-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 2px solid var(--site-border-strong);
  border-radius: 50%;
  background: var(--site-surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  cursor: inherit;
}
.ps-player-quiz-option input[type="radio"]:checked {
  border-color: var(--site-accent);
}
.ps-player-quiz-option input[type="radio"]:checked::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--site-accent);
}
.ps-player-quiz-option-text {
  flex: 1 1 auto;
}
/* Generic legacy button (kept for /sorry) */
.ps-player-button,
.ps-player-copy-button {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--site-border-strong);
  border-radius: 10px;
  background: var(--site-surface);
  color: var(--site-text);
  cursor: pointer;
  font-weight: 600;
}
.ps-player-button[disabled] {
  cursor: default;
  opacity: 0.55;
}
.ps-player-button:hover:not([disabled]),
.ps-player-copy-button:hover {
  border-color: var(--site-accent);
  color: var(--site-accent);
}

.ps-player-notice-action {
  margin: 0;
}
.ps-player-abandon-button {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--site-border-strong);
  border-radius: 999px;
  background: var(--site-surface);
  color: var(--site-text);
  cursor: pointer;
  font: inherit;
}
.ps-player-abandon-button:hover {
  border-color: var(--site-accent);
  color: var(--site-accent);
}

/* Shared gameplay shell for tutorial and study play pages. */
.ps-player-gameplay-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 16px;
  height: 100%;
  min-height: 0;
  padding: 16px;
  box-sizing: border-box;
}
.ps-player-gameplay-surface,
.ps-player-gameplay-sidebar {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--site-border);
  border-radius: 8px;
  background: var(--site-surface);
  overflow: hidden;
}
.ps-player-gameplay-surface {
  background: #111827;
}
.ps-player-gameplay-sidebar {
  display: grid;
  align-content: start;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: left;
}
.ps-player-control-panel {
  display: grid;
  align-content: start;
  inline-size: 100%;
  text-align: left;
}
.ps-player-gameplay-sidebar-section {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-block-end: 18px;
  border-bottom: 1px solid var(--site-border);
}
.ps-player-gameplay-sidebar-section + .ps-player-gameplay-sidebar-section {
  padding-block-start: 18px;
}
.ps-player-gameplay-sidebar-section:last-child {
  padding-block-end: 0;
  border-bottom: 0;
}
.ps-player-gameplay-sidebar-title {
  margin: 0;
  color: var(--site-text);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0;
}
.ps-player-iframe {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: transparent;
}
.ps-player-control-key-list {
  --ps-player-control-keycap-width: 42px;
  --ps-player-control-keycap-height: 38px;
  --ps-player-control-keycap-gap: 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  column-gap: 14px;
  row-gap: 14px;
  align-items: center;
}
.ps-player-control-key-section-spacer {
  grid-column: 1 / -1;
  height: 8px;
}
.ps-player-control-key-cell {
  display: grid;
  justify-self: stretch;
  place-items: center;
}
.ps-player-control-key-label {
  text-align: left;
}
.ps-player-gameplay-instructions p {
  margin: 0;
  max-width: 34ch;
}
.ps-player-gameplay-controls {
  min-width: 0;
}
.ps-player-gameplay-quit p {
  margin: 0;
  max-width: 34ch;
}
.ps-player-quit-button {
  width: 100%;
}
.ps-player-control-arrow-cluster {
  display: grid;
  grid-template-columns: repeat(3, var(--ps-player-control-keycap-width));
  grid-template-rows: repeat(2, var(--ps-player-control-keycap-height));
  gap: var(--ps-player-control-keycap-gap);
  justify-self: center;
}
.ps-player-control-arrow-cell {
  display: grid;
  place-items: center;
}
.ps-player-control-arrow-cell--up {
  grid-column: 2;
  grid-row: 1;
}
.ps-player-control-arrow-cell--left {
  grid-column: 1;
  grid-row: 2;
}
.ps-player-control-arrow-cell--down {
  grid-column: 2;
  grid-row: 2;
}
.ps-player-control-arrow-cell--right {
  grid-column: 3;
  grid-row: 2;
}
.ps-player-control-keycap-image {
  display: block;
  width: var(--ps-player-control-keycap-width);
  height: var(--ps-player-control-keycap-height);
  object-fit: contain;
}
@media (max-width: 900px) {
  .ps-player-gameplay-shell {
    grid-template-columns: 1fr;
  }
  .ps-player-gameplay-surface {
    min-height: 65vh;
  }
}
.ps-player-copy-button {
  min-width: 220px;
  min-height: 56px;
}
.ps-player-copy-status {
  min-height: 18px;
  color: var(--site-text-muted);
}
