/* preview_runner_html — the authoring preview's mini-runner.
   Every rule is scoped :where(.pr-shell) so it adds no specificity. The root
   rule is a bare class because the form root IS .pr-shell. */

.pr-shell {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #1e293b;
  padding: 18px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
:where(.pr-shell) .pr-validation-banner {
  background: #fef9c3; color: #854d0e;
  border: 1px solid #fde047;
  padding: 10px 14px; border-radius: 8px;
  font-size: 0.88rem; line-height: 1.45;
}
/* Scoring-failure panel. The preview refuses IN the
   runner — no native alert() — and the sentence it shows carries a
   reference code, never the exception text. */
:where(.pr-shell) .pr-error-banner {
  background: #fee2e2; color: #991b1b;
  border: 1px solid #fecaca;
  padding: 10px 14px; border-radius: 8px;
  font-size: 0.88rem; line-height: 1.45;
}

:where(.pr-shell) .pr-topline {
  display: flex; gap: 12px; align-items: center;
  padding: 6px 0; font-size: 0.85rem; color: #475569;
}
:where(.pr-shell) .pr-progress {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; color: #64748b;
}
:where(.pr-shell) .pr-timer {
  margin-left: auto; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem; font-weight: 700; color: #0f172a;
  padding: 4px 10px; border: 1px solid #e2e8f0; border-radius: 999px; background: #f8fafc;
}
:where(.pr-shell) .pr-timer.warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }
:where(.pr-shell) .pr-timer.expired { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

:where(.pr-shell) .pr-q-card {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 14px;
}
:where(.pr-shell) .pr-q-prompt {
  font-size: 1.05rem; font-weight: 600; color: #0f172a; line-height: 1.45;
  white-space: pre-wrap;
}
:where(.pr-shell) .pr-q-type {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: #64748b; text-transform: uppercase;
  letter-spacing: .1em; font-weight: 600;
}
:where(.pr-shell) .pr-q-image-wrap { display: flex; }
:where(.pr-shell) .pr-q-image {
  max-width: 100%; max-height: 320px; border-radius: 8px;
  border: 1px solid #e2e8f0;
}
:where(.pr-shell) .pr-q-image-loading { color: #94a3b8; font-style: italic; font-size: 0.85rem; }

/* Materials preview block — mirrors learner T-PREFLIGHT.
     Read-only batched media.get_media_urls is permitted here. */
:where(.pr-shell) .pr-materials {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 14px 18px; display: flex; flex-direction: column; gap: 10px;
}
:where(.pr-shell) .pr-materials-h {
  font-size: 0.78rem; font-weight: 700; color: #475569; text-transform: uppercase;
  letter-spacing: .08em;
}
:where(.pr-shell) .pr-material-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border: 1px solid #e2e8f0; border-radius: 8px;
  background: #f8fafc;
}
:where(.pr-shell) .pr-material-kind {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: #64748b; text-transform: uppercase;
  letter-spacing: .08em; flex: 0 0 auto;
  padding: 2px 8px; border-radius: 999px; background: #ffffff;
  border: 1px solid #cbd5e1;
}
:where(.pr-shell) .pr-material-title {
  flex: 1 1 auto; color: #0f172a; font-weight: 600; line-height: 1.4;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
:where(.pr-shell) .pr-material-action {
  flex: 0 0 auto; color: #1d4ed8; font-size: 0.85rem; text-decoration: none;
  padding: 4px 10px; border: 1px solid #bfdbfe; border-radius: 8px;
  background: #eff6ff;
}
:where(.pr-shell) .pr-material-action:hover { background: #dbeafe; border-color: #93c5fd; }
:where(.pr-shell) .pr-material-pending { color: #94a3b8; font-size: 0.85rem; font-style: italic; }
:where(.pr-shell) .pr-material-embed-iframe {
  width: 100%; max-width: 480px; aspect-ratio: 16 / 9;
  border: 1px solid #cbd5e1; border-radius: 8px;
}

:where(.pr-shell) .pr-answers { display: flex; flex-direction: column; gap: 8px; }
:where(.pr-shell) .pr-answer {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 8px;
  cursor: pointer; user-select: none;
}
:where(.pr-shell) .pr-answer:hover { background: #f8fafc; border-color: #94a3b8; }
:where(.pr-shell) .pr-answer.selected { background: #eff6ff; border-color: #1d4ed8; }
:where(.pr-shell) .pr-answer-control { flex: 0 0 auto; padding-top: 2px; }
:where(.pr-shell) .pr-answer-text { color: #334155; line-height: 1.4; }

:where(.pr-shell) .pr-nav {
  display: flex; gap: 8px; align-items: center;
}
:where(.pr-shell) .pr-nav-btn {
  padding: 7px 14px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #ffffff; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: #334155;
}
:where(.pr-shell) .pr-nav-btn:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
:where(.pr-shell) .pr-nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }
:where(.pr-shell) .pr-nav-spacer { flex: 1 1 auto; }
:where(.pr-shell) .pr-submit-btn {
  padding: 7px 16px; border: 1px solid #1d4ed8; border-radius: 8px;
  background: #1d4ed8; cursor: pointer; font-size: 0.9rem; font-weight: 700; color: #ffffff;
}
:where(.pr-shell) .pr-submit-btn:hover { background: #1e40af; border-color: #1e40af; }

/* Result card */
:where(.pr-shell) .pr-result-card {
  background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 22px 24px; display: flex; flex-direction: column; gap: 12px;
}
:where(.pr-shell) .pr-result-headline {
  font-size: 1.4rem; font-weight: 800; line-height: 1.2;
}
:where(.pr-shell) .pr-result-headline.passed { color: #166534; }
:where(.pr-shell) .pr-result-headline.failed { color: #991b1b; }
:where(.pr-shell) .pr-result-score {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem; color: #334155;
}
:where(.pr-shell) .pr-result-aside { font-size: 0.85rem; color: #64748b; line-height: 1.5; }
:where(.pr-shell) .pr-result-actions { display: flex; gap: 8px; padding-top: 4px; }
:where(.pr-shell) .pr-restart-btn {
  padding: 7px 14px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #ffffff; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: #334155;
}
:where(.pr-shell) .pr-restart-btn:hover { background: #f1f5f9; border-color: #94a3b8; }

:where(.pr-shell) .pr-empty {
  padding: 30px; text-align: center; color: #64748b;
  background: #f8fafc; border-radius: 10px; border: 1px dashed #cbd5e1;
}
