/* The question card — ONE definition, four consumers.
 *
 * A question renders identically in the pupil app, the review console, the tutor console and the
 * parent portal, so these rules live in one file rather than being copied into each. They were
 * extracted from styles.css when replay reached the tutor and parent screens; a second copy would
 * be a second place for a child's question to look wrong.
 *
 * SELF-CONTAINED ON PURPOSE. Every colour is a --qc-* token defined here, never a token borrowed
 * from the host page. The four consumers have four different palettes and two of them have dark
 * mode; depending on whatever `--paper` happens to mean on the current page is how a card ends up
 * white-on-white somewhere nobody looked.
 *
 * LIGHT IS THE DEFAULT, INCLUDING WHEN THE OS IS DARK. The pupil app has no dark mode — styles.css
 * contains no prefers-color-scheme at all — so a card that went dark on a child's machine would be
 * the only dark thing on an otherwise light page. Dark is therefore opt-in: a page adds
 * `data-qc-dark` to <html> to say "I have a dark mode, follow the OS with me". console.html and
 * parent.html do; index.html and review.html deliberately do not.
 *
 * COLOUR IS SET EXPLICITLY, NEVER INHERITED. `.answer` is a <button>, and a button does not
 * inherit `color` from its parent — that exact omission shipped invisible text twice in this
 * codebase. Every element here that shows text names its own colour.
 */

:root{
  --qc-surface:#fffdfa;      --qc-ink:#182136;        --qc-muted:#636974;
  --qc-line:#dedbd3;         --qc-shadow:0 18px 50px rgba(20,33,61,.1);
  --qc-answer-bg:#ffffff;    --qc-hover:#4bbac5;
  --qc-selected-line:#14213d;--qc-selected-bg:#f0f2f5;
  --qc-correct-line:#42a67a; --qc-correct-bg:#eaf7f1; --qc-correct-ink:#1f6b4a;
  --qc-wrong-line:#e06a4a;   --qc-wrong-bg:#fff0ec;   --qc-wrong-ink:#a8412a;
  --qc-pill-bg:#f7c9b6;      --qc-pill-ink:#182136;
  --qc-key-bg:#f7f3ea;       --qc-note-bg:#f7f3ea;    --qc-accent-ink:#14213d;
  --qc-highlight-bg:#f5c95d; --qc-highlight-ink:#182136;
}

/* Dark, only where a page has said it has one. */
@media (prefers-color-scheme:dark){
  :root[data-qc-dark]{
    --qc-surface:#1a2032;      --qc-ink:#eef1f6;        --qc-muted:#98a2b8;
    --qc-line:#333c55;         --qc-shadow:0 18px 50px rgba(0,0,0,.38);
    --qc-answer-bg:#131826;    --qc-hover:#5ec6d1;
    --qc-selected-line:#c2c9d6;--qc-selected-bg:#252d43;
    --qc-correct-line:#4fd0b6; --qc-correct-bg:#12332e; --qc-correct-ink:#6fdcc4;
    --qc-wrong-line:#f08a6b;   --qc-wrong-bg:#3a2018;   --qc-wrong-ink:#f5a48b;
    --qc-pill-bg:#43302a;      --qc-pill-ink:#f7c9b6;
    --qc-key-bg:#252d43;       --qc-note-bg:#252d43;    --qc-accent-ink:#f79a7d;
    --qc-highlight-bg:#4a3d16; --qc-highlight-ink:#f7e3a8;
  }
}

/* ---- the card ---------------------------------------------------------------------------- */
.question-card{background:var(--qc-surface);color:var(--qc-ink);border:1px solid var(--qc-line);
  box-shadow:var(--qc-shadow);border-radius:14px;padding:clamp(26px,5vw,52px)}
.question-card h2{color:var(--qc-ink);font-size:clamp(25px,4vw,38px);line-height:1.22;
  margin:22px 0 9px;letter-spacing:-.7px}
.question-label{display:flex;gap:10px;align-items:center;font-size:10px;text-transform:uppercase;
  letter-spacing:1.3px;color:var(--qc-muted)}
#subject-pill,.subject-pill{background:var(--qc-pill-bg);padding:6px 10px;border-radius:4px;
  color:var(--qc-pill-ink);font-weight:800}
.instruction{font-size:12px;color:var(--qc-muted);margin-bottom:26px}

/* ---- answers ----------------------------------------------------------------------------- */
.answers{display:grid;gap:10px}
.answer{border:1.5px solid var(--qc-line);background:var(--qc-answer-bg);color:var(--qc-ink);
  border-radius:9px;padding:15px 18px;display:flex;align-items:center;gap:14px;text-align:left;
  cursor:pointer;transition:.15s}
.answer:hover{border-color:var(--qc-hover);transform:translateX(3px)}
.answer.selected{border-color:var(--qc-selected-line);background:var(--qc-selected-bg)}
.answer.correct{border-color:var(--qc-correct-line);background:var(--qc-correct-bg)}
.answer.correct::after{content:"✓";margin-left:auto;color:var(--qc-correct-ink);font-weight:800;font-size:16px}
.answer.wrong{border-color:var(--qc-wrong-line);background:var(--qc-wrong-bg)}
.answer.wrong::after{content:"✗";margin-left:auto;color:var(--qc-wrong-ink);font-weight:800;font-size:16px}
.answer-key{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;
  background:var(--qc-key-bg);color:var(--qc-ink);font-weight:800;font-size:11px;flex:none}
.feedback{min-height:28px;margin:16px 0 5px;font-size:12px;font-weight:700}
.feedback.good{color:var(--qc-correct-ink)}
.feedback.bad{color:var(--qc-wrong-ink)}

/* ---- the teacher's explanation ------------------------------------------------------------ */
.wrong-explanation{background:var(--qc-note-bg);border-radius:9px;padding:13px 17px;margin:0 0 14px}
.wrong-explanation .label{display:block;font:800 9px "DM Sans";letter-spacing:1.3px;
  text-transform:uppercase;color:var(--qc-muted);margin-bottom:6px}
.wrong-explanation .body{display:block;font-size:13px;line-height:1.55;color:var(--qc-ink)}
.wrong-explanation .source{display:block;font-size:10px;color:var(--qc-muted);margin-top:7px}

/* ---- comprehension passages --------------------------------------------------------------- */
.passage-panel{background:var(--qc-surface);color:var(--qc-ink);border:1px solid var(--qc-line);
  border-radius:12px;padding:18px 22px;margin-bottom:16px}
.passage-panel summary{cursor:pointer;list-style:none;font-weight:800;font-size:12px;color:var(--qc-accent-ink)}
.passage-panel summary::-webkit-details-marker{display:none}
.passage-panel[open] summary::after{content:" (collapse)";color:var(--qc-muted);font-weight:400;font-size:10px}
.passage-panel h3{color:var(--qc-ink);font-size:16px;margin:10px 0 8px}
.passage-body{font-size:13px;line-height:1.8;color:var(--qc-ink);max-height:260px;overflow-y:auto;padding-right:6px}
.line-num{display:inline-block;width:22px;color:var(--qc-muted);font-size:10px;user-select:none}
.blank-active{background:var(--qc-highlight-bg);color:var(--qc-highlight-ink);padding:1px 6px;
  border-radius:4px;font-weight:800}
.blank-placeholder{color:var(--qc-muted);font-weight:700}

/* ---- diagrams, tables, images -------------------------------------------------------------- */
.question-media{margin:14px 0}
.question-table{border-collapse:collapse;font-size:13px;color:var(--qc-ink)}
.question-table th,.question-table td{border:1px solid var(--qc-line);padding:8px 12px;text-align:left}
.question-table th{background:var(--qc-key-bg)}
.question-diagram{max-width:320px}
.question-diagram svg{width:100%;height:auto}
.question-image{max-width:100%;border-radius:8px}

/* ---- typed answers -------------------------------------------------------------------------- */
.free-response{margin:8px 0 16px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.free-response input{flex:1;min-width:140px;border:1.5px solid var(--qc-line);border-radius:9px;
  padding:13px 16px;font-size:15px;background:var(--qc-answer-bg);color:var(--qc-ink)}
.free-response input:disabled{background:var(--qc-key-bg);color:var(--qc-ink)}
.free-response #free-response-unit,.free-response .free-response-unit{font-size:13px;
  color:var(--qc-muted);font-weight:700}
.free-response #free-response-feedback,.free-response .free-response-feedback{flex-basis:100%;
  font-size:12px;color:var(--qc-accent-ink);font-weight:700;margin:0}

/* ---- session replay -------------------------------------------------------------------------- */
.replay-list{display:flex;flex-direction:column;gap:22px}
.replay-card{padding-top:22px}
.replay-card-head{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.replay-q-num{font:800 12px Nunito;color:var(--qc-muted)}
.replay-card .question-label{margin-left:auto;margin-right:0}
.replay-outcome{font-size:11px;font-weight:800;padding:4px 10px;border-radius:99px}
.replay-outcome.is-correct{background:var(--qc-correct-bg);color:var(--qc-correct-ink)}
.replay-outcome.is-incorrect{background:var(--qc-wrong-bg);color:var(--qc-wrong-ink)}
.replay-drifted{color:var(--qc-muted);font-size:12px;font-style:italic;margin:0}

/* Moved here from styles.css's shared media query when this file was extracted — otherwise the
   console and the parent portal would have inherited the desktop padding on a phone. */
@media (max-width:480px){
  .question-card{padding:24px 18px}
}

/* Per-question time. Tutor-facing only — the parent portal passes showTimings:false, because a
   stopwatch beside a wrong answer says something different from what that screen is for. */
.replay-time{font:700 11px Nunito;color:var(--qc-muted);margin-left:auto}
.replay-time + .replay-outcome{margin-left:10px}
.replay-card-head .replay-time ~ .question-label{margin-left:0}
