*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a1a;
  line-height: 1.6;
  font-size: 16px;
}

.container {
  max-width: 90ch;
  margin: 1rem auto;
  padding: 0 1rem;
}

/* ── Progress ──────────────────────────────────────────── */
.progress-bar {
  font-size: 0.875rem;
  color: #555;
  margin-bottom: 0.75rem;
}

.progress-track {
  height: 4px;
  background: #dde1e7;
  border-radius: 2px;
  margin-top: 0.4rem;
}

.progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Instruction banner ────────────────────────────────── */
.instruction-banner {
  background: #fefce8;
  border: 1px solid #fde047;
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: #713f12;
}

/* ── Instructions block ────────────────────────────────── */
.instructions {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.instructions h3 { margin-bottom: 0.5rem; font-size: 1.05rem; }
.instructions p  { margin-bottom: 0.35rem; font-size: 0.9rem; }
.instructions ul,
.instructions ol { padding-left: 1.5rem; margin-bottom: 0.35rem; font-size: 0.9rem; }
.instructions li { margin-bottom: 0.15rem; }
.instructions strong { font-weight: 600; }

/* ── Audio row ─────────────────────────────────────────── */
.audio-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* ── Unified rating card (no-reference pages) ──────────── */
.rating-card {
  background: #fff;
  border-radius: 10px;
  padding: 1rem 1.25rem 0.75rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.rating-card .audio-player {
  background: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin-bottom: 0.75rem;
}

.rating-card .audio-player audio {
  width: 100%;
}

.rating-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0 0 0.75rem;
}

.rating-card .score-section {
  background: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin-bottom: 0;
}

.audio-player {
  flex: 1;
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.audio-label {
  display: block;
  font-weight: 600;
  font-size: 0.8rem;
  color: #444;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.audio-player audio {
  width: 100%;
  display: block;
}

/* ── Score section ─────────────────────────────────────── */
.score-section {
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.score-section h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.score-options {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.score-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}

.score-option:hover { background: #f0f4ff; }

.score-option input[type="radio"] {
  cursor: pointer;
  accent-color: #2563eb;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.score-option:has(input:checked) {
  background: #eff6ff;
  outline: 1px solid #bfdbfe;
}

.score-label { font-size: 0.95rem; }

/* ── Keyboard shortcut badges (score options & audio labels) ── */
kbd.shortcut-key {
  display: inline-block;
  background: linear-gradient(180deg, #fafbfc 0%, #f0f2f5 100%);
  color: #374151;
  border: 1px solid #d1d5db;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.08rem 0.38rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.4;
  vertical-align: middle;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

.score-option kbd.shortcut-key {
  margin-right: 0.3rem;
  min-width: 1.2em;
  text-align: center;
}

.audio-label kbd.shortcut-key {
  margin-left: 0.35rem;
  font-size: 0.65rem;
}

/* ── Transcript ────────────────────────────────────────── */
.transcript-section {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.transcript-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.transcript-text {
  font-size: 1.05rem;
  line-height: 1.7;
}

/* *word* → <em> rendered as bold underline */
.transcript-text em, .transcript-text p em {
  font-style: normal;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Error message ─────────────────────────────────────── */
.error-message {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: #dc2626;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ── Submit row ────────────────────────────────────────── */
.submit-row {
  display: flex;
  justify-content: flex-end;
}

.submit-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.submit-btn:hover  { background: #1d4ed8; }
.submit-btn:active { background: #1e40af; }

/* ── Shortcut legend ─────────────────────────────────────── */
.shortcut-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 0.8rem;
  color: #6b7280;
}

.shortcut-legend .legend-icon {
  font-size: 0.95rem;
  margin-right: 0.5rem;
  color: #9ca3af;
}

.shortcut-legend .legend-group {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  white-space: nowrap;
}

.shortcut-legend .legend-plus {
  color: #d1d5db;
  font-size: 0.7rem;
}

.shortcut-legend .legend-desc {
  color: #6b7280;
  margin-left: 0.15rem;
}

.shortcut-legend .legend-sep {
  color: #e5e7eb;
  margin: 0 0.45rem;
  font-size: 0.9rem;
  user-select: none;
}

.shortcut-legend kbd.shortcut-key {
  display: inline-block;
  background: linear-gradient(180deg, #fafbfc 0%, #f0f2f5 100%);
  color: #374151;
  border: 1px solid #d1d5db;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.08rem 0.38rem;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.5;
  vertical-align: middle;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

kbd {
  display: inline-block;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.8rem;
  font-family: inherit;
}

/* ── Login page ────────────────────────────────────────── */
.login-section {
  background: #fff;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  max-width: 38ch;
  margin: 4rem auto 0;
}

.login-section h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
}

.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}

.form-group input[type="email"] {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input[type="email"]:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ── Complete page ─────────────────────────────────────── */
.complete-section {
  background: #fff;
  border-radius: 10px;
  padding: 2.5rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  text-align: center;
  max-width: 44ch;
  margin: 4rem auto 0;
}

.complete-section h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.complete-section p  { color: #555; margin-bottom: 1.5rem; }

.prolific-btn {
  display: inline-block;
  background: #7c3aed;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  padding: 0.7rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  transition: background 0.15s;
}

.prolific-btn:hover { background: #6d28d9; }

/* ── Two-column layout (dual-audio pages) ────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.two-col-audio {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.two-col-audio .audio-player {
  flex: none;
}

.two-col-audio .audio-player audio {
  width: 100%;
}

.two-col-scores .score-section {
  margin-bottom: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 700px) {
  .audio-row { flex-direction: column; }
  .audio-row.single-audio .audio-player { max-width: 100%; }
  .submit-row { justify-content: stretch; }
  .submit-btn { width: 100%; justify-content: center; }
  .two-col {
    grid-template-columns: 1fr;
  }
  .two-col-audio {
    flex-direction: row;
  }
  .two-col-audio .audio-player {
    flex: 1;
  }
}
