/* AP Prep quizzes (quiz.php): the guide list's look (index.php), plus the quiz itself and its printable copy.
   WCAG 2.2 AA: text at 4.5:1 or better in light and dark, focus rings at 3:1, targets at least 24px, and right and
   wrong shown by words and marks as well as colour. */
:root {
  --ink: #1b2533; --muted: #4f5b6b; --bg: #f3f5f8; --card: #ffffff; --line: #d5dce5; --navy: #1f3557; --teal: #0b6575;
  --btn-ink: #ffffff; --focus: #b35c00; --shadow: 0 1px 2px rgba(20, 35, 60, .08), 0 4px 14px rgba(20, 35, 60, .06);
  --good: #146c2e; --good-bg: #e6f4ea; --bad: #a3261b; --bad-bg: #fbe9e7; --pick: #e8f1f8;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e6ebf2; --muted: #a9b4c2; --bg: #11161d; --card: #1a212b; --line: #2f3a48; --navy: #9fc0ea; --teal: #6fcfdc;
    --btn-ink: #0d1520; --focus: #ffb35c; --shadow: none;
    --good: #7fd99a; --good-bg: #16301f; --bad: #ff9b8f; --bad-bg: #3a1c19; --pick: #1d2c3b; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; line-height: 1.55; }
a { color: var(--teal); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--ink); padding: 8px 12px; }
.skip:focus { left: 8px; top: 8px; z-index: 10; }
header.top { max-width: 48rem; margin: 0 auto; padding: 40px 16px 4px; }
.bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; max-width: 14rem; margin-bottom: 20px; }
.bar span { flex: 1; } .bar span:nth-child(1) { background: #1f3557; } .bar span:nth-child(2) { background: #84b9c4; } .bar span:nth-child(3) { background: #0b6575; }
.kicker { margin: 0 0 6px; color: var(--teal); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .85rem; }
.kicker a { color: inherit; }
h1 { margin: 0 0 10px; color: var(--navy); font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; font-size: clamp(1.9rem, 5.5vw, 2.6rem); line-height: 1.15; }
.lead { margin: 0; color: var(--muted); font-size: 1.05rem; }
main { max-width: 48rem; margin: 0 auto; padding: 18px 16px 32px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin: 0 0 20px; }
.h-small { margin: 0 0 8px; font-size: 1.1rem; color: var(--navy); }
.muted { color: var(--muted); }
.small { font-size: .92rem; margin: 14px 0 0; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 18px; border-radius: 8px; font: inherit; font-weight: 600;
  text-decoration: none; border: 2px solid var(--teal); cursor: pointer; }
.btn.primary { background: var(--teal); color: var(--btn-ink); }
.btn.secondary { color: var(--teal); background: transparent; }
.btn.link { border-color: transparent; background: transparent; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; padding: 8px 6px; margin-left: auto; font-weight: 500; }
.btn:hover { text-decoration: underline; }

/* Start */
.resume { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 16px; }
.resume p { margin: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; font-weight: 600; margin-bottom: 6px; }
.opt { display: flex; gap: 10px; align-items: center; min-height: 36px; cursor: pointer; }
.opt input { width: 20px; height: 20px; margin: 0; accent-color: var(--teal); flex: none; }
.opt.check { margin-top: 10px; }
.sec-pick { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 4px 0 0 30px; }
.sec-pick label { color: var(--muted); font-size: .95rem; }
select { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--muted); border-radius: 6px; min-height: 40px; padding: 4px 8px; max-width: 100%; }

/* One question */
.status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
.status p { margin: 0; }
.q-count { font-weight: 700; color: var(--navy); }
.q-score { color: var(--muted); }
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 10px 0 18px; }
.meter span { display: block; height: 100%; width: 0; background: var(--teal); transition: width .2s; }
@media (prefers-reduced-motion: reduce) { .meter span { transition: none; } }
.q legend { font-weight: 400; margin-bottom: 14px; width: 100%; }
.q-sec { display: block; color: var(--teal); font-weight: 700; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; }
.q-text { display: block; font-size: 1.18rem; line-height: 1.5; }
.q-line { display: block; font-weight: 600; }
.q-passage { display: block; margin-top: 10px; padding: 6px 0 6px 14px; border-left: 4px solid var(--line); white-space: pre-line; font-size: 1.05rem; }
.q-text:focus { outline: none; }
.q-text:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
.choices { display: grid; gap: 10px; }
.choice { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: start; padding: 12px 14px; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 48px; }
.choice:hover { border-color: var(--teal); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--teal); }
.choice .letter { font-weight: 700; color: var(--muted); min-width: 1.2em; }
.choice .tag { display: block; font-size: .85rem; font-weight: 700; margin-top: 2px; }
.choice:has(input:checked) { border-color: var(--teal); background: var(--pick); }
.answered .choice { cursor: default; }
.answered .choice:hover { border-color: var(--line); }
.answered .choice input:disabled + .letter, .answered .choice input:disabled ~ .text { color: var(--ink); }
.answered .choice.is-right { border-color: var(--good); background: var(--good-bg); }
.choice.is-right .tag { color: var(--good); }
.answered .choice.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.choice.is-wrong .tag { color: var(--bad); }
.feedback { margin-top: 18px; padding: 14px 16px; border-radius: 10px; border-left: 6px solid var(--good); background: var(--good-bg); }
.feedback.wrong { border-left-color: var(--bad); background: var(--bad-bg); }
.feedback:focus { outline: none; }
.feedback:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.feedback p { margin: 0 0 6px; }
.feedback p:last-child { margin: 0; }
.feedback .verdict { font-weight: 700; font-size: 1.05rem; }
.feedback .ref { color: var(--muted); font-size: .92rem; }
.pick-first { margin: 10px 0 0; color: var(--bad); font-weight: 600; min-height: 0; }
.pick-first:empty { display: none; }

/* Results */
#h-results { margin: 0 0 6px; color: var(--navy); font-family: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif; font-size: 1.6rem; }
#h-results:focus, #h-setup:focus { outline: none; }
.r-score { font-size: 1.35rem; font-weight: 700; margin: 0 0 4px; }
#r-note { margin: 0; }
#results .h-small { margin-top: 24px; }
.by-sec { width: 100%; border-collapse: collapse; font-size: .95rem; }
.by-sec th, .by-sec td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.by-sec th { color: var(--muted); font-weight: 600; }
.by-sec .num { text-align: right; width: 4.5rem; font-variant-numeric: tabular-nums; }
.review { list-style: none; margin: 0; padding: 0; }
.review li { border-top: 1px solid var(--line); padding: 12px 0; }
.review p { margin: 0 0 4px; }
.review .rq { font-weight: 600; }
.review .rpassage { white-space: pre-line; padding-left: 12px; border-left: 3px solid var(--line); }
.review .yours { color: var(--bad); }
.review .right { color: var(--good); }
.review .why { color: var(--muted); }

.others ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.others a { display: inline-block; min-height: 24px; padding: 2px 0; }
footer { max-width: 48rem; margin: 0 auto; padding: 0 16px 40px; color: var(--muted); font-size: .9rem; }

/* Printable copy */
.print-note { margin: 16px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.name-line { margin: 18px 0 0; display: none; }
.name-line span { display: inline-block; width: 14em; border-bottom: 1px solid currentColor; margin: 0 1.2em 0 .3em; }
.name-line span.short { width: 4em; margin-right: .3em; }
.printable main { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 8px 24px 24px; margin-bottom: 20px; }
.p-sec { font-size: 1.1rem; color: var(--navy); margin: 26px 0 6px; padding-bottom: 4px; border-bottom: 2px solid var(--line); }
.p-q { margin: 14px 0; break-inside: avoid; }
.p-text { margin: 0 0 4px; font-weight: 600; }
.p-passage { margin: 0 0 6px 2.6em; padding-left: 10px; border-left: 3px solid var(--line); }
.p-num { display: inline-block; min-width: 2.2em; }
.p-choices { margin: 0; padding-left: 4.4em; }
.p-choices li { margin: 1px 0; padding-left: .3em; }
.p-key { margin-top: 36px; break-before: page; }
.p-key h2 { color: var(--navy); font-size: 1.3rem; }
.p-answers { padding-left: 2.6em; columns: 1; }
.p-answers li { margin: 0 0 6px; break-inside: avoid; }
.p-answers strong { display: inline-block; min-width: 1.4em; }
@media (max-width: 30rem) { .panel { padding: 16px; } .choice { padding: 10px 12px; } .btn.link { margin-left: 0; } }
@media print {
  :root { --ink: #000; --muted: #333; --navy: #000; --teal: #000; --line: #999; --card: #fff; --bg: #fff; }
  body { background: #fff; font-size: 11pt; line-height: 1.35; }
  .skip, .no-print, .others, footer, .bar { display: none !important; }
  header.top, main { max-width: none; padding: 0; }
  header.top { margin-bottom: 8px; }
  h1 { font-size: 20pt; }
  .kicker a { text-decoration: none; }
  .name-line { display: block; }
  .printable main { border: 0; padding: 0; border-radius: 0; }
  .p-q { margin: 8px 0; }
  .p-key { margin-top: 0; }
  .p-answers { font-size: 10pt; }
  a { color: #000; }
}
