:root {
  --mint: #2cc3ab;
  --mint-soft: #e3f7f3;
  --purple: #6C22A6;
  --purple-soft: #f1e7fa;
  --ink: #111;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #ffffff;
  --good: #d6f3df;
  --bad: #fde2e2;
  --warn: #fff3cd;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.container { max-width: 1100px; margin: 0 auto; padding: 16px 20px; }
.muted { color: var(--muted); }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 13px; }

.page-header { background: var(--mint-soft); border-bottom: 2px solid var(--mint); position: sticky; top: 0; z-index: 10; }
.page-header h1 { margin: 0 0 4px 0; font-size: 22px; }
.page-header p { margin: 0; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.score-summary { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 240px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.score-line { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; font-size: 14px; }
.score-line strong { font-weight: 700; }
.pass { color: #057a55; }
.fail { color: #c81e1e; }

.instructions-block details { background: #fafafa; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.instructions-block summary { cursor: pointer; font-weight: 600; color: var(--purple); }
.instructions-html { padding-top: 8px; }

.section-block { margin: 22px 0 30px; }
.section-header { background: var(--mint-soft); border-left: 4px solid var(--mint); padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.section-header h2 { margin: 0; font-size: 18px; }
.section-memo { margin-top: 6px; font-size: 14px; color: #1f2937; }

.question-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: white; }
.question-card.reviewed { border-left: 4px solid var(--mint); }
.question-card.pending { border-left: 4px solid #f59e0b; }
.q-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.q-number { font-weight: 700; font-size: 16px; color: var(--purple); }
.q-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { background: #eef2ff; color: #1e3a8a; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.badge.marks-badge { background: var(--purple-soft); color: var(--purple); }
.badge.auto { background: var(--good); color: #065f46; }
.badge.manual { background: var(--mint-soft); color: #065f46; }
.badge.needs { background: var(--warn); color: #92400e; }

.q-body { margin: 6px 0 10px; }
.q-text { white-space: pre-wrap; }
.q-extra { margin-top: 6px; font-size: 14px; }

.mcq-options { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 6px; }
.mcq-options li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; gap: 8px; }
.mcq-options li.correct { background: var(--good); border-color: #86efac; }
.mcq-options li.student-correct { background: var(--good); border-color: #34d399; box-shadow: inset 0 0 0 2px #34d399; }
.mcq-options li.student-wrong { background: var(--bad); border-color: #fca5a5; box-shadow: inset 0 0 0 2px #f87171; }
.mcq-options li.student { background: var(--purple-soft); border-color: #d8b4fe; }
.opt-letter { font-weight: 700; min-width: 24px; }
.opt-text { flex: 1; }
.opt-tag { font-size: 11px; background: rgba(0,0,0,0.06); padding: 2px 6px; border-radius: 999px; }
.opt-tag.correct-tag { background: #34d399; color: white; }

.written-answer { margin-top: 8px; padding: 10px; background: #f9fafb; border-radius: 8px; }
.written-answer .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.written-answer .value { white-space: pre-wrap; }

.q-marking { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding-top: 10px; border-top: 1px dashed var(--line); }
.q-marking label { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.q-marking input[type="number"] { width: 80px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.q-marking input[type="text"] { flex: 1; min-width: 200px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.comment-input { flex: 1; min-width: 240px; }
.comment-input input { width: 100%; }

.actions-bar { position: sticky; bottom: 0; background: white; border-top: 1px solid var(--line); padding: 12px 0; margin-top: 24px; display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.action-msg { flex: 1; font-size: 14px; }
.action-msg.success { color: #057a55; }
.action-msg.error { color: #c81e1e; }
.btn { padding: 9px 18px; border-radius: 8px; font-weight: 600; border: 1px solid transparent; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--purple); color: white; }
.btn-primary:hover { background: #581c87; }
.btn-secondary { background: white; color: var(--purple); border-color: var(--purple); }
.btn-secondary:hover { background: var(--purple-soft); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 30px; max-width: 480px; text-align: center; }

@media (max-width: 700px) {
  .header-row { flex-direction: column; align-items: stretch; }
  .score-summary { min-width: 0; }
  .q-marking { flex-direction: column; align-items: stretch; }
  .comment-input input { width: 100%; }
}
