/* ═══════════════════════════════════════════════════════
   SBAC FIAB REVIEW · Make & Support Inferences (Literary)
   style.css — the SBAC Place Value FIAB stylesheet, re-themed
   purple (so a reading review never gets confused with a math
   one), with the math item styles (grid / entry / symbol pad)
   replaced by the reading ones:
     • story panel + two-column quiz layout (from R.A.D. Quiz 1)
     • passage screen — the full story before its questions
     • EBSR Part A / Part B blocks
     • excerpt-style long answer choices (whole sentences)
═══════════════════════════════════════════════════════ */
:root {
  --primary:      #6b21a8;
  --primary-dark: #4c1d95;
  --secondary:    #fbbf24;
  --secondary-dk: #d99e09;
  --teal:         #1abc9c;
  --teal-dark:    #148f77;
  --card-bg:      #ffffff;
  --text:         #333;
  --locked-bg:    #e9ecef;
  --correct:      #27ae60;
  --correct-dk:   #1e8449;
  --danger:       #c0392b;
  --danger-dk:    #a93226;
  --fs:           1.05rem;
  /* the reading font — passages and answer choices are prose,
     so they get a serif face that is easier to read in long runs
     than the Comic Sans the rest of the site uses */
  --read-font:    Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

* { box-sizing: border-box; }

body {
  font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
  background: linear-gradient(135deg, #4c1d95 0%, #8b5cf6 100%);
  color: var(--text);
  margin: 0; padding: 0;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── CONTAINER ─────────────────────────────────────── */
.container {
  max-width: 820px;
  margin: 2rem auto;
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  min-height: 50vh;
  position: relative;
  z-index: 10;
}

h1 {
  text-align: center;
  color: var(--primary);
  letter-spacing: 1px;
  margin-top: 0;
  font-size: 1.75rem;
}

.welcome-sub {
  text-align: center;
  color: #888;
  font-size: 0.88rem;
  margin: -14px 0 26px;
  letter-spacing: 0.5px;
}

/* ── WELCOME: INFERENCE HERO ────────────────────────
   Shows the skill as an equation instead of describing
   it: text clue + what you know = the inference. */
.inf-hero {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  margin: 18px 0 22px;
  flex-wrap: nowrap;
}
.inf-card {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border-radius: 14px;
  padding: 12px 10px 11px;
  color: white;
  box-shadow: 0 4px 0 rgba(0,0,0,0.18);
  animation: infDrop 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.inf-card.c1 { background:#4c1d95; animation-delay:0.00s; }
.inf-card.c2 { background:#6b21a8; animation-delay:0.12s; }
.inf-card.c3 { background:#9333ea; animation-delay:0.24s; }

@keyframes infDrop {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .inf-card { animation: none; }
}

.inf-icon { font-size: 1.6rem; line-height: 1; }
.inf-label {
  font-size: 0.56rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.95;
  text-align: center;
  font-weight: bold;
  min-height: 2.2em;
  display: flex;
  align-items: center;
}
.inf-ex {
  font-family: var(--read-font);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0.94;
}
.inf-op {
  align-self: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  flex-shrink: 0;
}

.welcome-lead {
  font-size: 1.25rem;
  font-weight: bold;
  color: var(--primary);
  margin: 0 0 16px;
}

.inf-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.inf-chip {
  border-radius: 20px;
  padding: 6px 15px;
  font-size: 0.85rem;
  font-weight: bold;
  border: 2px solid;
}
.inf-chip.c1 { background:#faf5ff; border-color:#d8b4fe; color:#6b21a8; }
.inf-chip.c2 { background:#eef2ff; border-color:#a5b4fc; color:#3730a3; }
.inf-chip.c3 { background:#ecfdf5; border-color:#6ee7b7; color:#065f46; }
.inf-chip.c4 { background:#fff7ed; border-color:#fdba74; color:#9a3412; }

.welcome-note {
  font-size: 0.85rem;
  color: #8a93a3;
  margin: 0 0 22px;
}

@media (max-width: 600px) {
  .inf-hero { gap: 4px; }
  .inf-card { padding: 9px 5px 8px; border-radius: 10px; }
  .inf-icon { font-size: 1.2rem; }
  .inf-label { font-size: 0.46rem; }
  .inf-ex { font-size: 0.58rem; }
  .inf-op { font-size: 1.1rem; }
  .welcome-lead { font-size: 1.05rem; }
  .inf-chip { font-size: 0.76rem; padding: 5px 11px; }
}

/* ── BUTTONS ───────────────────────────────────────── */
.lgs-btn {
  display: inline-block;
  margin-top: 14px;
  background: var(--primary);
  color: white;
  border: none;
  padding: 16px 44px;
  border-radius: 14px;
  font-size: 1.2rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--primary-dark);
  transition: transform 0.1s;
}
.lgs-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--primary-dark); }

.start-btn {
  background: var(--primary);
  color: white;
  padding: 18px 28px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 5px 0 var(--primary-dark);
  transition: transform 0.1s;
  flex: 1 1 160px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.start-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--primary-dark); }
.start-btn.locked { background: #7f8c8d !important; box-shadow: 0 5px 0 #566573 !important; cursor: default; }
.start-btn.locked:hover { transform: none; box-shadow: 0 5px 0 #566573 !important; }

.form-btn-sub { font-size: 0.65em; font-weight: normal; opacity: 0.88; }

.score-btn {
  background: var(--secondary);
  color: #5a3000;
  padding: 12px 26px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: var(--fs);
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 5px 0 var(--secondary-dk);
  transition: transform 0.1s;
  margin-top: 10px;
}
.score-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 var(--secondary-dk); }

.ready-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 14px;
  background: var(--teal);
  color: white;
  font-size: 1.15rem;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--teal-dark);
  transition: transform 0.1s;
  margin-top: 10px;
}
.ready-btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--teal-dark); }

.resume-btn {
  background: #e67e22;
  color: white;
  padding: 13px 26px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-size: var(--fs);
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 5px 0 #a85813;
  transition: transform 0.1s;
}
.resume-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #a85813; }

.sign-in-btn {
  width: 100%;
  padding: 13px;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: var(--teal);
  color: white;
  font-size: 1.05rem;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--teal-dark);
  transition: transform 0.1s;
}
.sign-in-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--teal-dark); }

.action-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 13px 26px;
  border-radius: 12px;
  font-size: var(--fs);
  cursor: pointer;
  font-family: inherit;
  font-weight: bold;
  box-shadow: 0 4px 0 var(--primary-dark);
  transition: transform 0.1s;
}
.action-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 0 var(--primary-dark); }
.action-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--primary-dark); }
.action-btn:disabled { background: #ccc; cursor: not-allowed; box-shadow: none; transform: none; }

#confirm-btn { background: var(--teal); box-shadow: 0 4px 0 var(--teal-dark); }
#confirm-btn:hover:not(:disabled) { box-shadow: 0 6px 0 var(--teal-dark); }

.speak-btn {
  background: none;
  border: 2px solid #ccc;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 6px 10px;
  min-width: 42px;
  flex-shrink: 0;
}

/* ── LOGIN / STEPS ─────────────────────────────────── */
.step-card {
  background: #fafafa;
  border: 2px solid #ececec;
  border-radius: 16px;
  padding: 20px 22px 16px;
  margin-bottom: 16px;
}
.step-label {
  display: block;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--primary);
  margin-bottom: 14px;
}
.login-box label {
  font-size: var(--fs);
  font-weight: bold;
  color: #555;
  display: block;
  margin-bottom: 6px;
}
.login-box select,
.login-box input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 2px solid #ccc;
  font-size: var(--fs);
  font-family: inherit;
  margin-bottom: 14px;
}
.login-box select:focus,
.login-box input:focus { outline: none; border-color: var(--primary); }
.login-error {
  color: var(--danger);
  font-size: 0.95rem;
  font-weight: bold;
  text-align: center;
  min-height: 22px;
  margin-bottom: 4px;
}

#resume-container {
  background: #fff8f0;
  border: 2px solid #f0c080;
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 16px;
  text-align: center;
}

.start-grid {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ── DIRECTIONS ────────────────────────────────────── */
.dir-section {
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 2px solid transparent;
}
.dir-section h3 { margin: 0 0 7px; font-size: var(--fs); }
.dir-section p  { margin: 0; font-size: 0.93rem; line-height: 1.65; color: #444; }
.dir-row { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin-bottom: 7px; }

.login-dir   { background: #eafaf1; border-color: #a9dfbf; }
.login-dir h3 { color: #1e8449; }
.form-dir    { background: #eaf2ff; border-color: #a9c4f5; }
.form-dir h3  { color: #2471a3; }
.story-dir   { background: #faf5ff; border-color: #d8b4fe; }
.story-dir h3 { color: #6b21a8; }
.attempts-dir { background: #fde8f0; border-color: #f48fb1; }
.attempts-dir h3 { color: #ad1457; }
.types-dir   { background: #eef2ff; border-color: #a5b4fc; }
.types-dir h3 { color: #4338ca; }
.read-dir    { background: #fff8e7; border-color: #ffc107; }
.read-dir h3  { color: #856404; }
.soak-dir    { background: #e8f8f8; border-color: #76d7c4; }
.soak-dir h3  { color: #0e6655; }
.timer-dir   { background: #f1fbe9; border-color: #8bc34a; }   /* light, like the other boxes (Marcos 10/6) */
.timer-dir h3 { color: #4a7a1f; }

.timer-chip {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 14px;
  font-size: 0.82rem;
  font-weight: bold;
  margin-top: 8px;
}
.chip-amber  { background: #fff3cd; border: 2px solid #ffc107; color: #856404; }
.chip-blue   { background: #e0e7ff; border: 2px solid #6366f1; color: #3730a3; }
.chip-purple { background: #f3e8ff; border: 2px solid #9333ea; color: #6b21a8; }
.chip-teal   { background: #d1ecf1; border: 2px solid #17a2b8; color: #0c5460; }
.chip-green  { background: #e2f4d3; border: 2px solid #8bc34a; color: #3d6b14; }

/* ── QUIZ SCREEN ───────────────────────────────────── */
.q-badge,
.passage-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
}
.q-badge-pill {
  background: var(--primary);
  color: white;
  border-radius: 50px;
  padding: 6px 18px;
  font-size: var(--fs);
  font-weight: bold;
}
.score-badge {
  background: var(--secondary);
  color: #5a3000;
  border-radius: 50px;
  padding: 6px 18px;
  font-size: var(--fs);
  font-weight: bold;
}

.streak-bar {
  text-align: center;
  font-size: 1.4rem;
  min-height: 34px;
  margin-bottom: 6px;
  transition: all 0.3s;
}

.progress-bar {
  height: 12px;
  background: #e9ecef;
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  width: 0%;
  transition: width 0.4s ease;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.timer-display {
  background: #2c3e50;
  color: #2ecc71;
  border-radius: 10px;
  padding: 6px 18px;
  font-size: 1.2rem;
  font-family: monospace;
  font-weight: bold;
  letter-spacing: 2px;
  min-width: 80px;
  text-align: center;
}
.timer-display.warning { color: #e74c3c; }

/* Reading lock bar (amber) */
.reading-timer-bar {
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.93rem;
  font-weight: bold;
  color: #856404;
}
.reading-timer-fill-wrap { flex: 1; height: 8px; background: #ffe69c; border-radius: 4px; overflow: hidden; }
.reading-timer-fill { height: 100%; background: var(--primary); width: 100%; border-radius: 4px; transition: width 0.25s linear; }
.reading-timer-count { min-width: 28px; text-align: right; font-size: var(--fs); }

/* Passage lock bar (purple — it gates a whole story, not one item) */
.passage-lock-bar {
  background: #f3e8ff;
  border: 2px solid #9333ea;
  border-radius: 10px;
  padding: 8px 16px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.93rem;
  font-weight: bold;
  color: #6b21a8;
}
.passage-lock-bar .reading-timer-fill-wrap { background: #e8d5f5; }
.passage-lock-bar .reading-timer-fill { background: #9333ea; }

/* Next soak bar (teal) */
.next-timer-bar {
  background: #d1ecf1;
  border: 2px solid #17a2b8;
  border-radius: 10px;
  padding: 8px 16px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.93rem;
  font-weight: bold;
  color: #0c5460;
}
.next-timer-fill-wrap { flex: 1; height: 8px; background: #bee5eb; border-radius: 4px; overflow: hidden; }
.next-timer-fill { height: 100%; background: #17a2b8; width: 100%; border-radius: 4px; transition: width 0.25s linear; }

.question-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
h2#question-text {
  font-size: 1.12rem;
  margin: 0;
  color: #2c3e50;
  line-height: 1.85;
  flex: 1;
}

.options-grid { display: grid; gap: 12px; }

.answer-row { display: flex; align-items: stretch; gap: 8px; }

button.choice-speak-btn {
  flex-shrink: 0;
  width: 40px;
  background: #faf5ff;
  border: 2px solid #ddd0f5;
  border-radius: 12px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex; align-items: center; justify-content: center;
}
button.choice-speak-btn:hover { background: #f0e4ff; transform: scale(1.1); }

.answer-row button.answer-btn { flex: 1; }

button.answer-btn {
  background: white;
  color: var(--primary);
  border: 3px solid #e0e0e0;
  padding: 13px 15px;
  border-radius: 14px;
  font-size: var(--fs);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
  transition: all 0.2s;
  box-shadow: 0 4px 0 #e0e0e0;
  white-space: normal;
  word-wrap: break-word;
  min-height: 54px;
  line-height: 1.8;
}
button.answer-btn:hover:not(:disabled) {
  background: #faf5ff;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #d8b4fe;
}
button.answer-btn.selected,
button.answer-btn.selected:hover:not(:disabled) { background: #fff9c4; border-color: #f9a825; border-width: 3px; font-weight: bold; box-shadow: 0 4px 0 #f57f17; }
button.answer-btn:disabled  { cursor: not-allowed; opacity: 0.78; }
button.answer-btn.locked-choice { background: var(--locked-bg); color: #999; cursor: not-allowed; border-color: #ccc; transform: none; box-shadow: none; }
button.answer-btn.correct   { background: #d4edda; border-color: #28a745; color: #155724; box-shadow: 0 4px 0 #28a745; }
button.answer-btn.incorrect { background: #f8d7da; border-color: #dc3545; color: #721c24; box-shadow: 0 4px 0 #dc3545; }

/* ── EXCERPT-STYLE CHOICES ──────────────────────────
   Evidence questions hand the student whole sentences
   out of the story. They read as quoted prose, not as
   short answers, so they get the reading face and a
   quote rule down the left edge. */
button.answer-btn.excerpt-choice {
  font-family: var(--read-font);
  font-size: 0.98rem;
  line-height: 1.7;
  color: #2f2a3a;
  border-left-width: 6px;
  border-left-color: #c4a5ea;
  padding: 12px 15px;
}
button.answer-btn.excerpt-choice strong {
  font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
  color: var(--primary);
}
button.answer-btn.excerpt-choice.correct   { border-left-color: #28a745; }
button.answer-btn.excerpt-choice.incorrect { border-left-color: #dc3545; }
button.answer-btn.excerpt-choice.selected  { border-left-color: #f57f17; }

.wrd { display: inline; }
.wrd.hl { background: #ffe01b; border-radius: 3px; padding: 0 2px; }

.feedback-box {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  display: none;
  font-size: var(--fs);
  border: 2px solid transparent;
  line-height: 1.6;
}
.feedback-box.correct   { display: block; background: #d4edda; border-color: #28a745; color: #155724; }
.feedback-box.incorrect { display: block; background: #f8d7da; border-color: #dc3545; color: #721c24; }
/* partial credit on an EBSR — amber, neither right nor wrong */
.feedback-box.partial   { display: block; background: #fff3cd; border-color: #ffc107; color: #856404; }
.feedback-box .fb-body { overflow: hidden; }

.controls {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ═══════════════════════════════════════════════════════
   EBSR — PART A + PART B
   Both parts sit on one screen, the way SBAC shows them,
   each in its own card so a student can see which half
   they are answering.
═══════════════════════════════════════════════════════ */
.options-grid.ebsr-item { gap: 18px; }

.ebsr-part {
  border: 3px solid #e4d5f7;
  border-radius: 16px;
  padding: 14px 16px 16px;
  background: #fdfbff;
}
.ebsr-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: white;
  border-radius: 6px;
  padding: 3px 12px;
  margin-bottom: 10px;
}
.ebsr-label.part-A { background: #6b21a8; }
.ebsr-label.part-B { background: #0e7490; }

.ebsr-q-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.ebsr-q {
  flex: 1;
  font-size: 1.02rem;
  line-height: 1.75;
  color: #2c3e50;
  font-weight: bold;
}
.ebsr-choices { display: grid; gap: 10px; }

/* ═══════════════════════════════════════════════════════
   RE-SHOWN EXCERPT ABOVE AN ITEM
═══════════════════════════════════════════════════════ */
.excerpt-box {
  background: #f7f3fd;
  border: 2px solid #ddd0f5;
  border-left: 6px solid #9333ea;
  border-radius: 0 12px 12px 0;
  padding: 12px 16px 6px;
  margin-bottom: 16px;
}
.excerpt-label {
  font-size: 0.68rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6b21a8;
  margin-bottom: 8px;
}
.excerpt-para {
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--read-font);
  font-size: 0.97rem;
  line-height: 1.8;
  color: #2f2a3a;
}

/* ═══════════════════════════════════════════════════════
   PASSAGE SCREEN — the whole story, before its questions
═══════════════════════════════════════════════════════ */
.passage-title-card {
  text-align: center;
  border-bottom: 3px solid #e4d5f7;
  padding-bottom: 12px;
  margin-bottom: 16px;
}
.passage-title {
  font-family: var(--read-font);
  font-size: 1.7rem;
  color: var(--primary);
  margin: 0 0 4px;
  line-height: 1.3;
}
.passage-source {
  font-size: 0.78rem;
  color: #999;
  margin: 0;
  letter-spacing: 0.4px;
}
.story-note {
  font-family: var(--read-font);
  font-size: 0.92rem;
  color: #6b21a8;
  background: #faf5ff;
  border-left: 4px solid #d8b4fe;
  border-radius: 0 8px 8px 0;
  padding: 9px 13px;
  margin: 0 0 16px;
  line-height: 1.6;
}
.passage-text { margin-bottom: 8px; }

.story-footnotes {
  border-top: 2px dashed #ddd0f5;
  margin-top: 14px;
  padding-top: 10px;
}
.footnote {
  font-family: var(--read-font);
  font-size: 0.86rem;
  color: #666;
  line-height: 1.6;
  margin-bottom: 3px;
}
.fn-word { font-style: italic; font-weight: bold; color: var(--primary); }

/* ═══════════════════════════════════════════════════════
   STORY PANEL + TWO-COLUMN QUIZ LAYOUT
   Copied from R.A.D. Online Quiz 1 so paragraph numbers
   and speaker buttons behave identically in both places.
═══════════════════════════════════════════════════════ */
.story-panel { display: none; }
.quiz-body { display: block; }
body.story-active .quiz-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
body.story-active .story-panel { display: block; }
body.story-active .container { max-width: 1160px; }
.story-panel { position: sticky; top: 14px; }
.story-panel-header {
  background: var(--primary); color: #fff; font-size: 0.9rem; font-weight: bold;
  padding: 8px 12px; border-radius: 12px 12px 0 0;
  display: flex; align-items: center; gap: 10px;
}
.story-scroll {
  background: #faf5ff; border: 2px solid #ddd0f5; border-top: none;
  border-radius: 0 0 12px 12px; padding: 14px 16px;
  max-height: calc(100vh - 150px); overflow-y: auto;
}
.story-scroll .story-note { font-size: 0.86rem; margin-bottom: 12px; }

.story-para {
  display: flex; gap: 10px; margin: 0 0 12px;
  font-family: var(--read-font);
  line-height: 1.85; font-size: 1rem; color: #2f2a3a;
}
.story-para:last-child { margin-bottom: 0; }
.para-speak-btn { font-size: 0.9rem; min-width: 34px; padding: 3px 6px; align-self: flex-start; background: #fff; }
.para-num {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff;
  font-size: 0.8rem; font-weight: bold; display: flex; align-items: center; justify-content: center;
  margin-top: 2px; flex-shrink: 0;
  font-family: "Comic Sans MS", "Comic Sans", cursive, sans-serif;
}
.para-text { flex: 1; min-width: 0; }

@media (max-width: 860px) {
  body.story-active .quiz-body { grid-template-columns: 1fr; }
  body.story-active .container { max-width: 820px; }
  .story-panel { position: static; margin-bottom: 16px; }
  .story-scroll { max-height: 42vh; }
}

/* ── SKILLS TO RETEACH (end screen) ────────────────── */
.skill-list {
  text-align: left;
  background: #eef2ff;
  border: 2px solid #a5b4fc;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0;
}
.skill-list h3 { margin: 0 0 12px; color: #3730a3; font-size: var(--fs); }
.skill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.skill-name  { flex: 0 0 42%; font-size: 0.88rem; font-weight: bold; color: #312e81; }
.skill-bar-wrap { flex: 1; height: 14px; background: #dbe1ff; border-radius: 7px; overflow: hidden; }
.skill-bar   { height: 100%; background: linear-gradient(90deg, #6366f1, #a5b4fc); border-radius: 7px; }
.skill-count { flex: 0 0 74px; text-align: right; font-size: 0.78rem; font-weight: bold; color: #4338ca; }
.mi-skill { color: #4338ca; }

/* ── END SCREEN ────────────────────────────────────── */
#final-percent {
  font-size: 5rem;
  font-weight: bold;
  color: var(--primary);
  display: block;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.6s ease, transform 0.6s ease;
  margin: 10px 0;
  text-align: center;
}
#final-percent.revealed { opacity: 1; transform: scale(1); }

.missed-list {
  text-align: left;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 12px;
  padding: 16px 20px;
  margin: 16px 0;
  max-height: 300px;
  overflow-y: auto;
}
.missed-list h3 { margin: 0 0 10px; color: #856404; font-size: var(--fs); }
.missed-item {
  background: white;
  border-left: 4px solid var(--danger);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  line-height: 1.6;
}
.missed-item .mi-label { color: var(--danger); font-weight: bold; font-size: 0.8rem; }

.end-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ── SCOREBOARD ────────────────────────────────────── */
.sb-summary-row { display: flex; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.sb-summary-card { flex: 1 1 120px; background: #f9f9f9; border: 2px solid #e0e0e0; border-radius: 14px; padding: 14px 12px; text-align: center; }
.sb-summary-label { font-size: 0.72rem; font-weight: 800; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.sb-summary-grade { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.sb-summary-score { font-size: 0.82rem; font-weight: 700; color: #555; }
.sb-summary-attempt { font-size: 0.68rem; color: #aaa; margin-top: 4px; }

.scoreboard-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.93rem; }
.scoreboard-table th, .scoreboard-table td { border-bottom: 2px solid #eee; padding: 9px 10px; text-align: center; }
.scoreboard-table th { color: var(--primary); }
.score-good { color: var(--correct);  font-weight: bold; }
.score-ok   { color: #f39c12;         font-weight: bold; }
.score-bad  { color: var(--danger);   font-weight: bold; }

/* ── INCOMPLETE-ANSWER NUDGE ───────────────────────── */
.answer-warning {
  margin-top: 10px;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  padding: 8px 14px;
  color: #856404;
  font-weight: bold;
  font-size: 0.9rem;
  text-align: center;
}

/* ── PIN MODAL ─────────────────────────────────────── */
#pin-modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  z-index: 500;
}
.pin-modal-inner {
  background: white;
  border-radius: 20px;
  padding: 2rem 2rem 1.5rem;
  max-width: 380px;
  width: 90%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  font-family: inherit;
  position: relative;
  z-index: 501;
}

/* ── CONFETTI ──────────────────────────────────────── */
#confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 99;
}

/* ── UTILITY ───────────────────────────────────────── */
.hidden { display: none !important; }

@media(max-width: 600px) {
  .container { margin: 10px; padding: 1.4rem; }
  h1 { font-size: 1.25rem; }
  button.answer-btn { font-size: 0.95rem; padding: 11px 12px; }
  button.answer-btn.excerpt-choice { font-size: 0.92rem; }
  .passage-title { font-size: 1.35rem; }
  .story-para { font-size: 0.95rem; }
  .ebsr-q { font-size: 0.97rem; }
  #final-percent { font-size: 3.5rem; }
}

/* ── CLOSED-TO-STUDENTS LOCK ── */
.lgs-btn.locked,
.lgs-btn.locked:hover { background: #b8b8b8; box-shadow: 0 5px 0 #8f8f8f; cursor: not-allowed; transform: none; filter: grayscale(1); }
.locked-note { color: #888; font-size: 0.95rem; margin: 14px 0 0; }

/* Finish screen (Marcos 10/14): Sign Out is quieter than the main buttons, and each button says where it goes */
.signout-btn { background:none; border:2px solid #ccc; border-radius:10px; color:#666; font-family:inherit;
               font-size:0.95rem; font-weight:700; padding:8px 16px; cursor:pointer; }
.signout-btn:hover { border-color:#999; color:#333; }
.signout-sub { display:block; font-size:0.8rem; font-weight:600; color:#888; margin-top:2px; }
