:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #f5f7fb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  color: white;
  background: #2357c6;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7cfdd;
  border-radius: 6px;
  padding: 0.75rem;
  background: white;
}

label,
legend {
  font-weight: 650;
}

h1 {
  margin-top: 0;
}

h2 {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.05rem;
}

.copy,
.trial-instructions,
.instruction-list {
  line-height: 1.7;
}

.instruction-list {
  padding-left: 1.25rem;
}

.trial-instructions {
  border-bottom: 1px solid #dce2ee;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

.page {
  width: min(760px, calc(100% - 2rem));
  margin: 3rem auto;
}

.panel {
  border: 1px solid #dce2ee;
  border-radius: 8px;
  padding: 2rem;
  background: white;
  box-shadow: 0 12px 28px rgb(15 23 42 / 8%);
}

.hidden {
  display: none;
}

.muted {
  color: #5f6b7d;
}

.error {
  min-height: 1.5rem;
  color: #b42318;
  font-weight: 650;
}

#token-form,
#trial-form {
  display: grid;
  gap: 1rem;
}

#token-form {
  margin-top: 1.5rem;
}

.progress {
  display: flex;
  justify-content: flex-end;
  color: #5f6b7d;
  font-weight: 650;
}

.transcription {
  border-left: 4px solid #2357c6;
  padding: 0.75rem 1rem;
  background: #eef3ff;
  line-height: 1.6;
}

audio {
  width: 100%;
  margin: 1rem 0 1.25rem;
}

.rating-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.rating-option {
  display: grid;
  gap: 0.25rem;
  align-content: start;
  min-height: 4.5rem;
  border: 1px solid #c7cfdd;
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
}

.rating-option:has(input:checked) {
  border-color: #2357c6;
  background: #eef3ff;
}

.rating-option input {
  width: auto;
  margin: 0 auto;
}

.rating-value {
  font-size: 1.5rem;
  font-weight: 750;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

@media (max-width: 640px) {
  .page {
    margin: 1rem auto;
  }

  .panel {
    padding: 1.25rem;
  }

  .rating-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rating-option {
    min-height: auto;
  }
}


.scale-reference {
  border: 1px solid #dce2ee;
  border-radius: 8px;
  padding: 1rem;
  background: #fafbff;
}

.scale-reference h2 {
  margin-top: 0;
}

.scale-reference dl {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.5rem 0.75rem;
  margin: 0;
  line-height: 1.5;
}

.scale-reference dt {
  font-weight: 750;
}

.scale-reference dd {
  margin: 0;
}

.extra-question {
  display: grid;
  gap: 0.5rem;
}

.extra-question.hidden {
  display: none;
}

.debug-info {
  border: 1px solid #f0c36d;
  border-radius: 6px;
  padding: 0.75rem;
  background: #fff8e6;
  color: #533f03;
  white-space: pre-wrap;
}


/* Compact landscape trial layout */
.page {
  width: min(1180px, calc(100% - 1.5rem));
  margin: 1rem auto;
}

.panel {
  padding: 1.25rem;
}

#trial-screen.panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.9fr);
  gap: 0.85rem 1.25rem;
  align-items: start;
}

#trial-screen.hidden {
  display: none;
}

#trial-screen .progress {
  grid-column: 1 / -1;
  justify-content: flex-start;
  font-size: 0.95rem;
}

#trial-instructions,
#transcription-label,
#transcription,
#audio-player,
#sample-id,
.debug-info {
  grid-column: 1;
}

#trial-form,
#trial-error {
  grid-column: 2;
}

#sample-id {
  display: none;
}

h1 {
  margin-bottom: 0.5rem;
}

h2 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.98rem;
}

.trial-instructions {
  margin-bottom: 0.35rem;
  padding-bottom: 0.5rem;
  font-size: 0.95rem;
}

.trial-instructions p,
.copy p {
  margin: 0.35rem 0;
}

.transcription {
  margin: 0;
  padding: 0.65rem 0.8rem;
}

audio {
  margin: 0.6rem 0 0;
}

#trial-form {
  gap: 0.65rem;
}

.rating-options {
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-top: 0.45rem;
}

.rating-option {
  grid-template-columns: auto 2rem 1fr;
  gap: 0.55rem;
  align-items: center;
  min-height: 0;
  padding: 0.55rem 0.7rem;
  text-align: left;
}

.rating-option input {
  margin: 0;
}

.rating-value {
  font-size: 1.15rem;
  line-height: 1;
  text-align: center;
}

.rating-label {
  font-weight: 500;
  line-height: 1.35;
}

.scale-reference {
  display: none;
}

.extra-question {
  gap: 0.4rem;
}

.extra-question-label {
  font-weight: 650;
}

.extra-radio-group {
  display: grid;
  gap: 0.4rem;
}

.extra-radio-group--emotion-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.extra-radio-group--emotion-grid .extra-radio-option:first-child {
  grid-column: 1 / -1;
  justify-content: center;
  min-height: 3rem;
}

.extra-radio-option {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid #c7cfdd;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
}

.extra-radio-option:has(input:checked) {
  border-color: #2357c6;
  background: #eef3ff;
}

.extra-radio-option input {
  width: auto;
}

@media (max-width: 700px) {
  .extra-radio-group--emotion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

textarea {
  min-height: 4.5rem;
}

.actions {
  position: sticky;
  bottom: 0;
  padding-top: 0.35rem;
  background: white;
}

.error {
  min-height: 1rem;
  margin: 0;
}

@media (max-width: 900px) {
  #trial-screen.panel {
    grid-template-columns: 1fr;
  }

  #trial-instructions,
  #transcription-label,
  #transcription,
  #audio-player,
  #sample-id,
  .debug-info,
  #trial-form,
  #trial-error {
    grid-column: 1;
  }
}


/* Revised landscape layout with top progress/help row */
.page {
  width: min(1280px, calc(100% - 1rem));
  margin: 0.5rem auto;
}

#trial-screen.panel {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 0.55rem 1rem;
  padding: 0.85rem 1rem;
}

#trial-screen .progress {
  display: grid;
  grid-template-columns: minmax(220px, 0.6fr) auto minmax(0, 1.4fr);
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid #dce2ee;
  padding-bottom: 0.45rem;
}

#trial-count {
  font-weight: 750;
}

.shortcut-help {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
  color: #4c596c;
  font-size: 0.82rem;
  line-height: 1.3;
}

.shortcut-help strong {
  color: #172033;
}

kbd {
  border: 1px solid #c7cfdd;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05rem 0.28rem;
  background: #f8fafc;
  color: #172033;
  font: 0.78rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.trial-instructions {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
  line-height: 1.55;
}

.trial-instructions h2 {
  margin-top: 0;
}

.trial-instructions p {
  margin: 0.25rem 0;
}

#transcription-label {
  margin-top: 0.4rem;
}

.transcription {
  line-height: 1.45;
}

audio {
  margin-top: 0.45rem;
}

#trial-form {
  gap: 0.45rem;
}

#trial-form legend {
  margin-bottom: 0.25rem;
}

.rating-options {
  gap: 0.32rem;
  margin-top: 0.25rem;
}

.rating-option {
  padding: 0.42rem 0.6rem;
  gap: 0.45rem;
}

.rating-label {
  font-size: 0.88rem;
  line-height: 1.28;
}

.extra-radio-option {
  padding: 0.42rem 0.6rem;
}

.extra-radio-group--emotion-grid {
  grid-template-columns: repeat(5, minmax(4.5rem, 1fr));
}

#comment-label {
  margin-top: 0.15rem;
}

.comment-help {
  margin: 0;
  color: #5f6673;
  font-size: 0.86rem;
  line-height: 1.45;
}

#comment {
  min-height: 3.5rem;
  resize: vertical;
}

.actions {
  padding-top: 0.2rem;
}

.actions button {
  padding: 0.62rem 1rem;
}

@media (max-width: 900px) {
  #trial-screen .progress {
    grid-template-columns: 1fr;
  }

  .shortcut-help {
    justify-content: flex-start;
  }
}


/* Pin the answer column to the subset-description row. */
#trial-screen .progress {
  grid-column: 1 / -1;
  grid-row: 1;
}

#trial-instructions {
  grid-column: 1;
  grid-row: 2;
}

#transcription-label {
  grid-column: 1;
  grid-row: 3;
}

#transcription {
  grid-column: 1;
  grid-row: 4;
}

#audio-player {
  grid-column: 1;
  grid-row: 5;
}

#sample-id,
.debug-info {
  grid-column: 1;
  grid-row: 6;
}

#trial-form {
  grid-column: 2;
  grid-row: 2 / span 5;
  align-self: start;
}

#trial-error {
  grid-column: 2;
  grid-row: 7;
}

@media (max-width: 900px) {
  #trial-screen .progress,
  #trial-instructions,
  #transcription-label,
  #transcription,
  #audio-player,
  #sample-id,
  .debug-info,
  #trial-form,
  #trial-error {
    grid-column: 1;
    grid-row: auto;
  }
}



.instruction-content h2 {
  margin: 0.9rem 0 0.35rem;
  color: #172033;
  font-size: 1rem;
}

.instruction-content h2:first-child {
  margin-top: 0;
}

.instruction-content p {
  margin: 0.35rem 0;
}

.instruction-content ul {
  margin: 0.4rem 0;
  padding-left: 1.4rem;
}

.instruction-content li + li {
  margin-top: 0.25rem;
}

.instruction-lead {
  font-size: 1.02rem;
}

.instruction-callout {
  border-left: 4px solid #237a4b;
  padding: 0.65rem 0.8rem;
  background: #edf8f1;
  color: #174d32;
}

/* Training screen */
#token-screen,
#done-screen {
  max-width: 760px;
  margin-inline: auto;
}

#training-screen {
  padding: 1.25rem;
}

.training-header {
  max-width: 980px;
  margin-bottom: 1.25rem;
}

.training-header h1 {
  margin-bottom: 0.75rem;
}

.training-header .copy {
  color: #354052;
}

.training-samples {
  border-top: 1px solid #c7cfdd;
}

.training-sample {
  display: grid;
  grid-template-columns: 4.5rem minmax(180px, 1fr) minmax(210px, 0.9fr) minmax(200px, 1fr) minmax(200px, 1fr);
  gap: 1rem;
  align-items: center;
  border-bottom: 1px solid #c7cfdd;
  padding: 1rem 0;
}

.training-sample audio {
  min-width: 0;
  margin: 0;
}

.training-score {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.training-score-value {
  display: grid;
  place-items: center;
  width: 4rem;
  aspect-ratio: 1;
  border: 2px solid #1e4fa8;
  border-radius: 8px;
  background: #2357c6;
  color: white;
  font-size: 2rem;
  line-height: 1;
}

.training-status {
  color: #5f6b7d;
  font-size: 0.78rem;
  font-weight: 700;
}

.training-sample--listened .training-score-value {
  border-color: #237a4b;
  background: #e9f6ee;
  color: #155d38;
}

.training-sample--listened .training-status {
  color: #155d38;
}

.training-copy {
  align-self: stretch;
  border-left: 1px solid #dce2ee;
  padding-left: 1rem;
  line-height: 1.55;
}

.training-copy h2 {
  margin: 0 0 0.35rem;
  color: #5f6b7d;
  font-size: 0.78rem;
  text-transform: none;
}

.training-copy p {
  margin: 0;
}

.training-copy p + p {
  margin-top: 0.5rem;
}

.training-rubric {
  font-weight: 700;
}

.training-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid #dce2ee;
  padding: 0.85rem 0 0;
  background: white;
}

.training-footer p {
  margin: 0;
  color: #4c596c;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .training-sample {
    grid-template-columns: 4.5rem minmax(0, 1fr);
  }

  .training-score {
    grid-column: 1;
    grid-row: 1;
  }

  .training-rubric-cell {
    grid-column: 2;
    grid-row: 1;
  }

  .training-sample audio {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .training-transcription {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .training-explanation {
    grid-column: 1 / -1;
    grid-row: 4;
  }
}

@media (max-width: 700px) {
  #training-screen {
    padding: 1rem;
  }

  .training-sample {
    gap: 0.75rem;
  }

  .training-score-value {
    width: 3.5rem;
    font-size: 1.65rem;
  }

  .training-copy {
    border-left: 0;
    padding-left: 0;
  }

  .training-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .training-footer button {
    width: 100%;
  }
}

#consent-screen {
  max-width: 760px;
  margin-inline: auto;
}

#consent-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.secondary-button {
  border: 1px solid #2357c6;
  padding: 0.45rem 0.75rem;
  background: white;
  color: #2357c6;
}

.finish-token {
  border: 2px solid #2357c6;
  border-radius: 8px;
  padding: 1rem;
  background: #eef3ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

#training-review-button {
  justify-self: start;
}

@media (max-width: 900px) {
  #training-review-button {
    justify-self: start;
  }
}


.consent-fieldset {
  border: 0;
  padding: 0;
}

.consent-fieldset legend {
  margin-bottom: 0.5rem;
}

.consent-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.consent-radio-option {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid #c7cfdd;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  background: white;
  cursor: pointer;
}

.consent-radio-option:has(input:checked) {
  border-color: #2357c6;
  background: #eef3ff;
}

.consent-radio-option input {
  width: auto;
  margin: 0;
}

