/* ============================================================
   QUESTION CONSOLE  (core/question-console.js)

   Lutfi's "Quantum Dawn Question Console" design, as a look for the
   question sheets. The design's sizes are kept for a laptop; a short
   laptop screen (720 px) gets tighter spacing, a phone held upright the
   design's own narrow layout, and a phone held sideways a compact card
   with no stage rail (its facts move into the header).

   Every rule starts .sheet-console .qc: the console's parts still carry
   the plain sheet's class names (sheetOption, sheetAction, sheetMeter...)
   as hooks, and this keeps the plain sheet's styling for them out.
   ============================================================ */
:root { --qc-ready: 1; }

.sheet.sheet-console {
  padding: max(16px, env(safe-area-inset-top, 0px)) 20px max(16px, env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(7, 17, 28, 0.74), rgba(7, 17, 28, 0.88));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sheet-console .qc {
  --qc-accent: #eac784;
  --qc-accent-rgb: 234, 199, 132;
  --qc-muted: #a0afc0;
  --qc-line: rgba(171, 200, 228, 0.17);
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1104px, 100%);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #465769;
  border-radius: 22px;
  background: linear-gradient(120deg, rgba(17, 30, 45, 0.98), rgba(8, 16, 29, 0.98));
  box-shadow: 0 28px 90px #0008, 0 0 60px #55c5f509;
  color: #eff4f9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: normal;
  text-align: left;
}
.sheet-console .qc * { box-sizing: border-box; }
.sheet-console .qc p { margin: 0; line-height: 1.65; }
.sheet-console .qc h1, .sheet-console .qc h2, .sheet-console .qc h3, .sheet-console .qc h4 {
  font-family: inherit; text-transform: none; color: inherit; text-shadow: none;
}
.sheet-console .qc button { font: inherit; cursor: pointer; }
.sheet-console .qc button:disabled { cursor: default; }
.sheet-console .qc button:focus-visible,
.sheet-console .qc summary:focus-visible { outline: 3px solid #92e5ed; outline-offset: 4px; }
.sheet-console .qc .qc-eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--qc-accent);
}

/* ---- header ---- */
.sheet-console .qc .qc-top {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 23px 30px;
  border-bottom: 1px solid var(--qc-line);
}
.sheet-console .qc .qc-identity { display: flex; align-items: center; gap: 15px; min-width: 0; }
.sheet-console .qc .qc-emblem {
  flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center;
  border: 1px solid var(--qc-line); border-radius: 12px; background: #ffffff04;
  font-size: 27px; color: var(--qc-accent);
}
.sheet-console .qc .qc-idtext { min-width: 0; }
.sheet-console .qc .qc-titlerow { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; min-width: 0; }
.sheet-console .qc .qc-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: 0.2px; line-height: 1.3; }
.sheet-console .qc .qc-stageline { display: none; font-size: 12px; color: var(--qc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-console .qc .qc-timer { flex: 0 0 auto; display: flex; align-items: center; gap: 13px; }
.sheet-console .qc .qc-timer-icon { font-size: 25px; color: #89d4d9; }
.sheet-console .qc .qc-timer small { display: block; margin-bottom: 3px; font-size: 9px; letter-spacing: 1.8px; color: var(--qc-muted); }
.sheet-console .qc .qc-clock { font-size: 23px; font-weight: 500; font-variant-numeric: tabular-nums; }
.sheet-console .qc .qc-timer.is-urgent .qc-clock { color: #ffb4a3; }
.sheet-console .qc .qc-track {
  flex: 0 0 auto; height: 3px; margin: 0; border-radius: 0; background: #243040; overflow: hidden;
}
.sheet-console .qc .qc-track .sheetMeterFill {
  display: block; height: 100%;
  background: linear-gradient(90deg, #68d2d0, var(--qc-accent));
  transition: width 120ms linear;
}
.sheet-console .qc .qc-track .sheetMeterFill.is-low { background: linear-gradient(90deg, #ff8f7a, #ffb4a3); }

/* ---- the stage rail ---- */
.sheet-console .qc .qc-grid {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 205px minmax(0, 1fr);
}
.sheet-console .qc .qc-rail {
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  padding: 31px 25px;
  border-right: 1px solid var(--qc-line);
  background: linear-gradient(180deg, rgba(var(--qc-accent-rgb), 0.045), transparent);
}
.sheet-console .qc .qc-stage-number {
  margin: 10px 0; font-size: 60px; line-height: 1.2; font-weight: 300; letter-spacing: -3px; color: var(--qc-accent);
}
.sheet-console .qc .qc-stage-name { margin: 0 0 8px; font-size: 17px; line-height: 1.35; font-weight: 600; }
.sheet-console .qc .qc-stage-pos { font-size: 12px; color: var(--qc-muted); }
.sheet-console .qc .qc-steps { display: flex; gap: 7px; margin: 22px 0 27px; }
.sheet-console .qc .qc-steps i { flex: 1; height: 3px; background: #3c4959; }
.sheet-console .qc .qc-steps i.is-on { background: var(--qc-accent); box-shadow: 0 0 12px rgba(var(--qc-accent-rgb), 0.25); }
.sheet-console .qc .qc-meta { padding-top: 20px; border-top: 1px solid var(--qc-line); }
.sheet-console .qc .qc-meta + .qc-meta { margin-top: 18px; padding-top: 0; border-top: 0; }
.sheet-console .qc .qc-meta span { display: block; margin-bottom: 8px; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--qc-muted); }
.sheet-console .qc .qc-meta b { font-size: 14px; font-weight: 500; }
.sheet-console .qc .qc-orbital {
  position: relative; flex: 0 0 auto;
  width: 110px; height: 110px; margin: 36px auto 12px;
  border: 1px solid rgba(var(--qc-accent-rgb), 0.2); border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--qc-accent-rgb), 0.12), transparent 65%);
}
.sheet-console .qc .qc-orbital::before,
.sheet-console .qc .qc-orbital::after {
  content: ""; position: absolute; inset: 25px -5px;
  border: 1px solid rgba(var(--qc-accent-rgb), 0.45); border-radius: 50%;
  transform: rotate(-45deg);
}
.sheet-console .qc .qc-orbital::after { transform: rotate(45deg); }
.sheet-console .qc .qc-orbital i {
  position: absolute; inset: 48px; border-radius: 50%;
  background: var(--qc-accent); box-shadow: 0 0 22px rgba(var(--qc-accent-rgb), 0.6);
}
.sheet-console .qc .qc-rail-foot {
  margin-top: auto; padding-top: 22px;
  font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: #8191a7;
}

/* ---- the question ---- */
.sheet-console .qc .qc-work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.sheet-console .qc .qc-scroll {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 32px 34px 18px;
}
/* the same honest "there is more below" fade as the plain sheet */
.sheet-console .qc .qc-scroll.is-scrollable {
  mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent 100%);
}
.sheet-console .qc .qc-section-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 20px; }
.sheet-console .qc .qc-chip {
  margin: 0; padding: 7px 11px; white-space: nowrap; text-align: left;
  border: 1px solid var(--qc-line); border-radius: 20px;
  font-size: 10px; color: var(--qc-muted);
}
.sheet-console .qc .qc-prompt {
  margin: 0 0 25px; outline: none;
  font-size: 27px; font-weight: 550; line-height: 1.42; letter-spacing: -0.65px;
}
.sheet-console .qc .qc-prompt.is-long { font-size: 21px; letter-spacing: -0.3px; line-height: 1.5; }
.sheet-console .qc .qc-note {
  margin: 0 0 14px; padding: 11px 14px;
  border: 1px solid var(--qc-line); border-left-width: 3px; border-radius: 10px;
  font-size: 13px; line-height: 1.6; color: #d5dfea; background: #ffffff05;
}
.sheet-console .qc .qc-note.is-bad { border-color: rgba(255, 143, 122, 0.55); background: rgba(255, 120, 100, 0.08); color: #ffd3ca; }
.sheet-console .qc .qc-note.is-good { border-color: rgba(111, 211, 160, 0.55); background: rgba(80, 180, 130, 0.08); color: #d6f5e4; }
.sheet-console .qc .qc-label {
  display: block; margin: 0 0 12px;
  font-size: 10px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: #a9b9cc;
}

/* answers */
.sheet-console .qc .qc-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
.sheet-console .qc .qc-answer {
  display: flex; align-items: center; gap: 15px;
  width: 100%; min-height: 94px; padding: 19px;
  border: 1px solid #344357; border-radius: 12px;
  background: linear-gradient(135deg, #1b293b, #152132);
  color: #e5edf7; text-align: left; line-height: 1.45;
  transform: none;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}
.sheet-console .qc .qc-answer:hover:not(:disabled) { border-color: #7b91a9; background: #203248; }
.sheet-console .qc .qc-answer:active:not(:disabled) { transform: translateY(1px); }
.sheet-console .qc .qc-answer:disabled { opacity: 0.5; }
.sheet-console .qc .qc-letter {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 31px; min-width: 0; height: 33px;
  border: 1px solid #556376; border-radius: 7px; background: none;
  font-size: 13px; font-weight: 500; color: #bbcadb;
}
.sheet-console .qc .qc-answer-text { flex: 1 1 auto; min-width: 0; font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.sheet-console .qc .qc-mark { flex: 0 0 auto; margin-left: auto; font-size: 17px; }
.sheet-console .qc .qc-answer.is-correct,
.sheet-console .qc .qc-answer.is-correct:disabled {
  opacity: 1; border-color: #6fd3a0;
  background: linear-gradient(115deg, rgba(111, 211, 160, 0.17), #192638);
  box-shadow: inset 0 0 0 1px rgba(111, 211, 160, 0.2);
}
.sheet-console .qc .qc-answer.is-correct .qc-letter { background: #6fd3a0; border-color: #6fd3a0; color: #10261b; }
.sheet-console .qc .qc-answer.is-correct .qc-mark { color: #8fe3b6; }
.sheet-console .qc .qc-answer.is-wrong,
.sheet-console .qc .qc-answer.is-wrong:disabled {
  opacity: 1; border-color: #e58f8f;
  background: linear-gradient(115deg, rgba(229, 143, 143, 0.15), #211c28);
}
.sheet-console .qc .qc-answer.is-wrong .qc-letter { background: #e58f8f; border-color: #e58f8f; color: #2a1416; }
.sheet-console .qc .qc-answer.is-wrong .qc-mark { color: #ffb4a3; }
.sheet-console .qc .qc-answer.is-chosen { border-color: var(--qc-accent); }
.sheet-console .qc .qc-helper { margin: 0 0 4px; font-size: 12px; color: var(--qc-muted); }
.sheet-console .qc .qc-feedback { margin: 14px 0 0; }
.sheet-console .qc .qc-feedback .qc-note { margin: 0; padding: 14px 16px; font-size: 14px; }

/* ---- the answer box (runner.js's .wq, in the design's editor) ---- */
.sheet-console .qc .qc-node .wq {
  display: block; margin: 0; gap: 0;
  border: 1px solid #425366; border-radius: 12px; background: #0a1422; overflow: hidden;
}
.sheet-console .qc .wq-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 15px 18px 0; }
.sheet-console .qc .wq-label { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: #e0eaf5; }
.sheet-console .qc .wq-tip { font-size: 11px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--qc-muted); }
.sheet-console .qc .wq-symbols { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 17px; border-bottom: 1px solid var(--qc-line); }
.sheet-console .qc .wq-sym {
  min-width: 33px; min-height: 31px; padding: 0 6px;
  border: 1px solid #3a4b60; border-radius: 6px; background: #1b293b;
  color: #d5e0ed; font: 400 17px Georgia, "Times New Roman", serif;
}
.sheet-console .qc .wq-sym:hover { border-color: var(--qc-accent); color: var(--qc-accent); background: #1b293b; }
.sheet-console .qc .wq-sym:focus-visible { outline: 3px solid #92e5ed; outline-offset: 2px; }
.sheet-console .qc .wq-text {
  display: block; width: 100%; min-height: 172px; margin: 0;
  padding: 18px; border: 0; border-radius: 0; background: transparent;
  color: #e8f0fa; resize: vertical;
  /* 16px or more: a phone zooms the page into a smaller text box */
  font-family: inherit; font-size: 16px; font-weight: 400; line-height: 1.7;
}
.sheet-console .qc .wq-text::placeholder { color: #8494a9; }
.sheet-console .qc .wq-text:focus { outline: 2px solid rgba(146, 229, 237, 0.7); outline-offset: -4px; }
.sheet-console .qc .wq-meta { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px 14px; font-size: 11px; color: #93a5bb; }
.sheet-console .qc .wq-msg { color: #ffc1b8; font-weight: 700; }
.sheet-console .qc .wq-msg:empty { display: none; }
.sheet-console .qc .wq-msg:not(:empty) + .wq-hint { display: none; }
.sheet-console .qc .wq-count { margin-left: auto; font-variant-numeric: tabular-nums; }
.sheet-console .qc .qc-hint { margin: 13px 0 0; font-size: 12px; color: var(--qc-muted); }
@media (pointer: coarse) {
  /* a fingertip needs a bigger key than the design's 33 px */
  .sheet-console .qc .wq-sym { min-width: 40px; min-height: 38px; }
}

/* ---- marking ---- */
.sheet-console .qc .qc-marking {
  display: flex; align-items: center; gap: 18px; padding: 22px 24px;
  border: 1px solid var(--qc-line); border-radius: 12px; background: #101c2b;
}
.sheet-console .qc .qc-marking p { font-size: 15px; }
.sheet-console .qc .qc-marking .qc-sub { font-size: 12px; color: var(--qc-muted); }
.sheet-console .qc .qc-spinner {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(var(--qc-accent-rgb), 0.25); border-top-color: var(--qc-accent);
  animation: qc-spin 0.9s linear infinite;
}
@keyframes qc-spin { to { transform: rotate(360deg); } }

/* ---- the feedback ---- */
.sheet-console .qc .qc-review-question { margin: 0 0 18px; font-size: 12px; line-height: 1.6; color: var(--qc-muted); }
.sheet-console .qc .qc-review-question summary { cursor: pointer; color: #adbdcf; }
.sheet-console .qc .qc-review-question p { margin-top: 10px; font-size: 13px; color: #c9d5e2; }
.sheet-console .qc .qc-banner {
  display: flex; align-items: center; gap: 22px; margin: 0 0 21px; padding: 21px;
  border: 1px solid rgba(var(--qc-accent-rgb), 0.42); border-radius: 12px;
  background: linear-gradient(110deg, rgba(var(--qc-accent-rgb), 0.13), #182332);
}
.sheet-console .qc .qc-score { flex: 0 0 auto; padding-right: 23px; border-right: 1px solid rgba(var(--qc-accent-rgb), 0.42); }
.sheet-console .qc .qc-score b { font-size: 46px; font-weight: 400; line-height: 1; color: var(--qc-accent); }
.sheet-console .qc .qc-score b.is-word { font-size: 24px; font-weight: 600; }
.sheet-console .qc .qc-score span { font-size: 15px; color: #b9c4d3; }
.sheet-console .qc .qc-score small { display: block; margin-top: 8px; font-size: 9px; letter-spacing: 1.6px; text-transform: uppercase; color: #b9c4d3; }
.sheet-console .qc .qc-said { min-width: 0; }
.sheet-console .qc .qc-said h3 { margin: 0 0 6px; font-size: 17px; font-weight: 550; }
.sheet-console .qc .qc-said p { font-size: 13px; line-height: 1.6; color: #c9d1db; }
.sheet-console .qc .qc-review-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 15px; align-items: start; }
.sheet-console .qc .qc-card { min-width: 0; padding: 19px; border: 1px solid var(--qc-line); border-radius: 11px; background: #101c2b; }
.sheet-console .qc .qc-card h4 { margin: 0 0 13px; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #93d4d5; }
.sheet-console .qc .qc-yours h4 { color: var(--qc-accent); }
.sheet-console .qc .qc-formula { padding: 5px 0 15px; font-size: 23px; color: #eef3f7; overflow-x: auto; overflow-y: hidden; }
.sheet-console .qc .qc-model-text p { margin: 0 0 6px; font-size: 13px; line-height: 1.6; color: #c1cede; overflow-wrap: anywhere; }
.sheet-console .qc .qc-yours-text {
  padding-left: 12px; border-left: 2px solid #556a82;
  font-size: 13px; color: #c1cede; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---- the button bar ---- */
.sheet-console .qc .qc-actions {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 15px;
  margin: 0 34px; padding: 18px 0 20px;
  border-top: 1px solid var(--qc-line);
}
.sheet-console .qc .qc-caption { min-width: 0; font-size: 11px; line-height: 1.6; color: var(--qc-muted); }
.sheet-console .qc .qc-buttons { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.sheet-console .qc .qc-btn {
  padding: 12px 16px; border: 1px solid #465769; border-radius: 9px;
  background: transparent; color: #d5e0ed;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transform: none; transition: filter 0.15s, border-color 0.15s;
}
.sheet-console .qc .qc-btn:hover:not(:disabled) { border-color: #7b91a9; background: #ffffff08; }
.sheet-console .qc .qc-btn.qc-primary {
  padding: 13px 20px; border-color: #f3dfba;
  background: linear-gradient(110deg, #eecb8e, #f4ddb5);
  color: #152333; font-weight: 700; box-shadow: 0 4px 18px #0003;
}
.sheet-console .qc .qc-btn.qc-primary:hover:not(:disabled) {
  background: linear-gradient(110deg, #eecb8e, #f4ddb5); border-color: #f3dfba; filter: brightness(1.07);
}
/* the arrow is drawn, not written: the button reads as its words alone */
.sheet-console .qc .qc-btn.qc-primary::after { content: "\2192"; content: "\2192" / ""; margin-left: 20px; }
.sheet-console .qc .qc-btn:active:not(:disabled) { transform: translateY(1px); }
.sheet-console .qc .qc-buttons:empty { display: none; }

/* ============================================================
   Short laptop screens (1280 x 720 and the like)
   ============================================================ */
@media (max-height: 820px) {
  .sheet-console .qc .qc-top { padding: 16px 26px; }
  .sheet-console .qc .qc-emblem { width: 38px; height: 38px; font-size: 23px; }
  .sheet-console .qc .qc-rail { padding: 22px 22px; }
  .sheet-console .qc .qc-stage-number { margin: 6px 0; font-size: 48px; }
  .sheet-console .qc .qc-steps { margin: 16px 0 20px; }
  .sheet-console .qc .qc-meta { padding-top: 16px; }
  .sheet-console .qc .qc-orbital { width: 84px; height: 84px; margin: 24px auto 8px; }
  .sheet-console .qc .qc-orbital::before, .sheet-console .qc .qc-orbital::after { inset: 19px -4px; }
  .sheet-console .qc .qc-orbital i { inset: 36px; }
  .sheet-console .qc .qc-scroll { padding: 22px 30px 14px; }
  .sheet-console .qc .qc-section-top { margin-bottom: 14px; }
  .sheet-console .qc .qc-prompt { margin-bottom: 18px; font-size: 24px; }
  .sheet-console .qc .qc-prompt.is-long { font-size: 19px; }
  .sheet-console .qc .qc-answer { min-height: 72px; padding: 14px 16px; }
  .sheet-console .qc .wq-text { min-height: 120px; padding: 14px 18px; }
  .sheet-console .qc .wq-symbols { padding: 10px 17px; }
  .sheet-console .qc .qc-banner { padding: 16px 18px; margin-bottom: 16px; }
  .sheet-console .qc .qc-score b { font-size: 40px; }
  .sheet-console .qc .qc-actions { margin: 0 30px; padding: 13px 0 15px; }
  .sheet-console .qc .qc-btn.qc-primary { padding: 11px 18px; }
}

/* ============================================================
   The design's narrower layouts
   ============================================================ */
@media (max-width: 800px) {
  .sheet-console .qc .qc-grid { grid-template-columns: 155px minmax(0, 1fr); }
  .sheet-console .qc .qc-rail { padding: 25px 18px; }
  .sheet-console .qc .qc-scroll { padding: 25px 23px 16px; }
  .sheet-console .qc .qc-prompt { font-size: 23px; }
  .sheet-console .qc .qc-answer { padding: 14px; gap: 10px; }
  .sheet-console .qc .qc-review-grid { grid-template-columns: 1fr; }
  .sheet-console .qc .qc-actions { margin: 0 23px; }
}

/* a phone held upright: the rail becomes one line, answers one column */
@media (max-width: 590px) {
  .sheet.sheet-console { padding-left: 10px; padding-right: 10px; }
  .sheet-console .qc { border-radius: 14px; }
  .sheet-console .qc .qc-top { padding: 14px 16px; gap: 10px; }
  .sheet-console .qc .qc-identity { gap: 10px; }
  .sheet-console .qc .qc-eyebrow { font-size: 8px; letter-spacing: 1.4px; }
  .sheet-console .qc .qc-title { font-size: 12px; }
  .sheet-console .qc .qc-emblem, .sheet-console .qc .qc-timer-icon { display: none; }
  .sheet-console .qc .qc-clock { font-size: 20px; }
  .sheet-console .qc .qc-grid { display: flex; flex-direction: column; }
  .sheet-console .qc .qc-rail {
    flex: 0 0 auto; flex-direction: row; align-items: center; gap: 9px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--qc-line);
  }
  .sheet-console .qc .qc-rail-eyebrow, .sheet-console .qc .qc-stage-pos, .sheet-console .qc .qc-steps,
  .sheet-console .qc .qc-meta, .sheet-console .qc .qc-orbital, .sheet-console .qc .qc-rail-foot { display: none; }
  .sheet-console .qc .qc-stage-number { margin: 0; font-size: 22px; letter-spacing: 0; }
  .sheet-console .qc .qc-stage-name { margin: 0; font-size: 12px; }
  .sheet-console .qc .qc-work { flex: 1 1 auto; }
  .sheet-console .qc .qc-scroll { padding: 18px 16px 14px; }
  .sheet-console .qc .qc-section-top { gap: 5px; margin-bottom: 12px; }
  .sheet-console .qc .qc-section-top .qc-eyebrow { font-size: 9px; }
  .sheet-console .qc .qc-prompt { margin-bottom: 16px; font-size: 20px; }
  .sheet-console .qc .qc-prompt.is-long { font-size: 17px; }
  .sheet-console .qc .qc-answers { grid-template-columns: 1fr; gap: 9px; }
  .sheet-console .qc .qc-answer { min-height: 58px; padding: 12px 14px; }
  .sheet-console .qc .wq-tip { display: none; }
  .sheet-console .qc .wq-head { padding: 12px 14px 0; }
  .sheet-console .qc .wq-symbols { padding: 10px 12px; }
  .sheet-console .qc .wq-text { min-height: 130px; padding: 12px 14px; }
  .sheet-console .qc .wq-meta { padding: 8px 14px 10px; font-size: 10px; }
  /* the mark on its own row, so the feedback keeps the card's width */
  .sheet-console .qc .qc-banner { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px; }
  .sheet-console .qc .qc-score {
    display: flex; align-items: baseline; gap: 6px;
    padding: 0 0 10px; border-right: 0; border-bottom: 1px solid rgba(var(--qc-accent-rgb), 0.42);
  }
  .sheet-console .qc .qc-score b { font-size: 36px; }
  .sheet-console .qc .qc-score small { margin: 0 0 0 auto; }
  .sheet-console .qc .qc-actions { flex-direction: column; align-items: stretch; gap: 8px; margin: 0 16px; padding: 12px 0 14px; }
  .sheet-console .qc .qc-buttons { justify-content: stretch; }
  .sheet-console .qc .qc-btn { flex: 1 1 auto; }
}

/* a small phone upright (360 x 640): tighter, so the answers fit */
@media (max-width: 590px) and (max-height: 700px) {
  .sheet-console .qc .qc-top { padding: 10px 14px; }
  .sheet-console .qc .qc-rail { padding: 6px 16px; }
  .sheet-console .qc .qc-stage-number { font-size: 18px; }
  .sheet-console .qc .qc-scroll { padding: 12px 14px 10px; }
  .sheet-console .qc .qc-section-top { margin-bottom: 8px; }
  .sheet-console .qc .qc-prompt { margin-bottom: 12px; font-size: 18px; }
  .sheet-console .qc .qc-prompt.is-long { font-size: 16px; }
  .sheet-console .qc .qc-label { display: none; }
  .sheet-console .qc .qc-answers { gap: 7px; }
  .sheet-console .qc .qc-answer { min-height: 48px; padding: 9px 12px; }
  .sheet-console .qc .qc-letter { width: 26px; height: 27px; }
  .sheet-console .qc .qc-actions { padding: 9px 0 10px; }
}
@media (max-width: 380px) {
  .sheet-console .qc .qc-mode { display: none; }
  .sheet-console .qc .qc-titlerow { margin-top: 0; }
}

/* ============================================================
   A phone held sideways (or any very short window): the card is the
   whole screen, so there is no rail - the stage goes in the header -
   and only the question scrolls; the button stays in sight.
   ============================================================ */
@media (max-height: 500px) {
  .sheet.sheet-console { padding-top: max(8px, env(safe-area-inset-top, 0px)); padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)); }
  .sheet-console .qc { border-radius: 14px; }
  .sheet-console .qc .qc-top { padding: 8px 16px; gap: 12px; }
  .sheet-console .qc .qc-emblem, .sheet-console .qc .qc-timer-icon, .sheet-console .qc .qc-mode { display: none; }
  .sheet-console .qc .qc-titlerow { margin-top: 0; }
  .sheet-console .qc .qc-title { font-size: 13px; white-space: nowrap; }
  .sheet-console .qc .qc-stageline { display: inline; }
  .sheet-console .qc .qc-timer small { display: inline; margin: 0 8px 0 0; font-size: 8px; }
  .sheet-console .qc .qc-clock { font-size: 17px; }
  .sheet-console .qc .qc-grid { display: flex; flex-direction: column; }
  .sheet-console .qc .qc-rail { display: none; }
  .sheet-console .qc .qc-work { flex: 1 1 auto; }
  .sheet-console .qc .qc-scroll { padding: 10px 16px 8px; }
  .sheet-console .qc .qc-section-top { margin-bottom: 6px; }
  .sheet-console .qc .qc-section-top .qc-eyebrow { font-size: 9px; }
  .sheet-console .qc .qc-chip { padding: 3px 9px; }
  .sheet-console .qc .qc-prompt, .sheet-console .qc .qc-prompt.is-long { margin-bottom: 8px; font-size: 16px; line-height: 1.4; letter-spacing: 0; }
  .sheet-console .qc .qc-label { display: none; }
  .sheet-console .qc .qc-note { margin-bottom: 8px; padding: 7px 10px; font-size: 12px; }
  .sheet-console .qc .qc-answers { grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 8px; }
  .sheet-console .qc .qc-answer { min-height: 0; padding: 8px 11px; gap: 10px; }
  .sheet-console .qc .qc-letter { width: 25px; height: 26px; font-size: 12px; }
  .sheet-console .qc .qc-answer-text { font-size: 13.5px; line-height: 1.35; }
  .sheet-console .qc .qc-helper, .sheet-console .qc .qc-hint, .sheet-console .qc .wq-tip, .sheet-console .qc .wq-hint { display: none; }
  .sheet-console .qc .qc-feedback { margin-top: 6px; }
  .sheet-console .qc .qc-feedback .qc-note { padding: 8px 11px; font-size: 13px; }
  .sheet-console .qc .wq-head { padding: 8px 12px 0; }
  .sheet-console .qc .wq-symbols { gap: 4px; padding: 6px 10px; }
  .sheet-console .qc .wq-sym { min-width: 34px; min-height: 30px; font-size: 15px; }
  .sheet-console .qc .wq-text { min-height: 84px; padding: 9px 12px; line-height: 1.5; }
  .sheet-console .qc .wq-meta { padding: 5px 12px 7px; font-size: 10px; }
  .sheet-console .qc .qc-marking { padding: 12px 14px; }
  .sheet-console .qc .qc-review-question { margin-bottom: 8px; }
  .sheet-console .qc .qc-banner { gap: 14px; margin-bottom: 10px; padding: 10px 14px; }
  .sheet-console .qc .qc-score { padding-right: 14px; }
  .sheet-console .qc .qc-score b { font-size: 30px; }
  .sheet-console .qc .qc-score b.is-word { font-size: 18px; }
  .sheet-console .qc .qc-said h3 { font-size: 15px; margin-bottom: 3px; }
  .sheet-console .qc .qc-review-grid { grid-template-columns: 1fr; gap: 10px; }
  .sheet-console .qc .qc-card { padding: 12px 14px; }
  .sheet-console .qc .qc-formula { padding: 0 0 8px; font-size: 18px; }
  .sheet-console .qc .qc-actions { flex-direction: row; align-items: center; margin: 0 16px; padding: 7px 0 8px; }
  .sheet-console .qc .qc-caption { font-size: 10.5px; line-height: 1.4; }
  .sheet-console .qc .qc-btn { flex: 0 0 auto; padding: 8px 14px; }
  .sheet-console .qc .qc-btn.qc-primary { padding: 9px 16px; }
  .sheet-console .qc .qc-btn.qc-primary::after { margin-left: 12px; }
}
@media (max-height: 500px) and (max-width: 590px) {
  .sheet-console .qc .qc-answers { grid-template-columns: 1fr; }
}

/* ============================================================
   Settings: Large text, High contrast, Reduced motion
   ============================================================ */
body.a11y-large-text .sheet-console .qc .qc-prompt { font-size: 29px; }
body.a11y-large-text .sheet-console .qc .qc-prompt.is-long { font-size: 23px; }
body.a11y-large-text .sheet-console .qc .qc-answer-text { font-size: 17px; }
body.a11y-large-text .sheet-console .qc .qc-note,
body.a11y-large-text .sheet-console .qc .qc-feedback .qc-note { font-size: 15.5px; }
body.a11y-large-text .sheet-console .qc .qc-helper,
body.a11y-large-text .sheet-console .qc .qc-hint,
body.a11y-large-text .sheet-console .qc .qc-caption { font-size: 13.5px; }
body.a11y-large-text .sheet-console .qc .wq-text { font-size: 18px; }
body.a11y-large-text .sheet-console .qc .qc-said p,
body.a11y-large-text .sheet-console .qc .qc-model-text p,
body.a11y-large-text .sheet-console .qc .qc-yours-text { font-size: 15px; }
@media (max-height: 500px) {
  body.a11y-large-text .sheet-console .qc .qc-prompt,
  body.a11y-large-text .sheet-console .qc .qc-prompt.is-long { font-size: 18px; }
  body.a11y-large-text .sheet-console .qc .qc-answer-text { font-size: 15px; }
}
@media (max-width: 590px) {
  body.a11y-large-text .sheet-console .qc .qc-prompt { font-size: 22px; }
  body.a11y-large-text .sheet-console .qc .qc-prompt.is-long { font-size: 19px; }
}

body.a11y-high-contrast .sheet-console .qc { border-color: #ffffffaa; background: #050a14; }
body.a11y-high-contrast .sheet-console .qc .qc-answer { border-color: #cfd8ff; background: #0b0d18; color: #fff; }
body.a11y-high-contrast .sheet-console .qc .qc-answer.is-correct { border-color: #8fffc0; background: #062014; }
body.a11y-high-contrast .sheet-console .qc .qc-answer.is-wrong { border-color: #ffadad; background: #240a0e; }
body.a11y-high-contrast .sheet-console .qc .qc-card,
body.a11y-high-contrast .sheet-console .qc .qc-node .wq,
body.a11y-high-contrast .sheet-console .qc .qc-marking { border-color: #ffffff88; background: #000; }
body.a11y-high-contrast .sheet-console .qc .qc-helper,
body.a11y-high-contrast .sheet-console .qc .qc-hint,
body.a11y-high-contrast .sheet-console .qc .qc-caption,
body.a11y-high-contrast .sheet-console .qc .qc-chip,
body.a11y-high-contrast .sheet-console .qc .qc-stage-pos,
body.a11y-high-contrast .sheet-console .qc .wq-meta,
body.a11y-high-contrast .sheet-console .qc .qc-model-text p,
body.a11y-high-contrast .sheet-console .qc .qc-yours-text { color: #eef3fb; }

@media (prefers-reduced-motion: reduce) {
  .sheet-console .qc *, .sheet-console .qc *::before, .sheet-console .qc *::after { transition: none !important; }
  .sheet-console .qc .qc-spinner { animation-duration: 3s; }
}
body.a11y-reduced-motion .sheet-console .qc *,
body.a11y-reduced-motion .sheet-console .qc *::before,
body.a11y-reduced-motion .sheet-console .qc *::after { transition: none !important; }
body.a11y-reduced-motion .sheet-console .qc .qc-spinner { animation-duration: 3s; }
