/* Derivatives: layout only. Tokens and base elements come from ../shared/base.css.
   Math is set in KaTeX's own face on purpose: it should look like the textbook. */

/* mode tabs: Mixed or one rule */
.rules { margin-bottom: 20px; }
.rules button { min-height: 40px; font-size: 0.95rem; }

.score-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* question card: d/dx[...] is the hero */
.question { background: var(--math); padding: 28px 24px 24px; margin-bottom: 16px; }
/* KaTeX's strut hangs ~15px below the line. The bottom padding holds it, so the box has nothing to
   scroll vertically and a mouse wheel over the equation cannot clip its top. Spacing below is unchanged. */
.math-hero { text-align: center; margin: 4px 0 8px; padding-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.math-hero .katex-display { margin: 0; }
.math-hero .katex { font-size: clamp(1.9rem, 1.2rem + 3vw, 2.7rem); }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.option, .option:disabled {
  display: flex; align-items: center; gap: 12px;
  min-height: 68px; padding: 10px 16px 10px 12px;
  background: var(--card); color: var(--ink); border-color: var(--line);
  text-align: left; opacity: 1;
}
.option:hover:not(:disabled), .option:focus-visible:not(:disabled) { border-color: var(--ink); background: var(--card); }
.option .key {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-2); background: var(--paper-deep);
}
.option .math { flex: 1; overflow-x: auto; overflow-y: hidden; }
.option .katex { font-size: 1.3rem; }
.option.correct, .option.correct:hover { background: var(--right-bg); border-color: var(--right); color: var(--right); }
.option.correct .key { background: var(--right); color: var(--right-bg); }
.option.chosen-wrong, .option.chosen-wrong:hover { background: var(--wrong-bg); border-color: var(--wrong); color: var(--wrong); }
.option.chosen-wrong .key { background: var(--wrong); color: var(--wrong-bg); }
.option:disabled { cursor: default; }

/* feedback */
.feedback-card { margin-bottom: 16px; }
.feedback-card .feedback { font-size: 1.1rem; line-height: 1.5; }
.why { margin: 16px 0 20px; line-height: 1.6; }
.why .used { display: block; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.why .katex { font-size: 1.05em; }
.next-btn { width: 100%; }

.hint { text-align: center; color: var(--ink-3); font-size: 0.9rem; margin-bottom: 20px; }

/* reference */
.reference-toggle { text-align: center; margin-bottom: 16px; }
.reference h2 { margin-bottom: 14px; }
.reference td { font-size: 1.05rem; padding: 10px; }

@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; }
  .question { padding: 22px 16px 18px; }
  .option .katex { font-size: 1.15rem; }
}
@media (hover: none) { .hint { display: none; } }
