/* The exam screen of AP Exam Prep (exam.js, "the exam screen"; Dr. Nick, October 22, 2026). Every timed part runs on it:
   a bar across the top (part, timer, calculator), the question, and a bar across the bottom (the list of questions, Back,
   Next). Laid out like the digital exam in Bluebook, in the site's own colors. Loaded after practice.css. */

/* While a part runs, the site header scrolls away and the exam's own top bar stays at the top of the window. */
body:has(main.bb) .top { position: static; }
main.bb { display: flex; flex-direction: column; min-height: calc(100vh - 24px); padding-bottom: 0; }
main.bb > .card { flex: none; margin-bottom: 16px; }
/* The bottom bar sits at the bottom of the window even when the question is short. */
main.bb > .bb-bot { margin-top: auto; }

.bb-top { position: sticky; top: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px 18px; margin: 0 0 16px; padding: 12px 18px; background: var(--card); border: 1px solid var(--line); border-bottom: 3px solid var(--navy); border-radius: var(--r); box-shadow: 0 4px 14px rgba(31, 46, 61, 0.08); }
.bb-part { min-width: 0; }
.bb-part b { display: block; font-family: var(--serif); font-weight: 700; font-size: 22px; line-height: 1.1; color: var(--navy); }
.bb-part small { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mute); }
.bb-time { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 120px; min-height: 56px; }
.bb-time .clock { font-size: 28px; line-height: 1.05; }
.bb-tbtn { background: none; border: 1px solid rgba(31, 46, 61, 0.22); border-radius: 99px; padding: 3px 12px; font: 600 11.5px var(--sans); color: var(--navy); cursor: pointer; }
.bb-tbtn:hover { background: rgba(31, 46, 61, 0.06); }
.bb-tools { display: flex; justify-content: flex-end; gap: 8px; }
.bb-tool { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1.5px solid var(--navy); border-radius: var(--r-btn); background: var(--panel); font: 600 13px var(--sans); color: var(--navy); cursor: pointer; }
.bb-tool:hover { background: var(--navy); color: var(--on-navy); }
.bb-ico { width: 15px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.bb-alert { margin: -6px 0 14px; padding: 10px 14px; border-radius: var(--r); background: var(--terra-tint); color: #6E2A16; font-size: 14px; font-weight: 600; }

/* The question */
.bb-qhead { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bb-num { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 4px; background: var(--navy); color: var(--on-navy); font-weight: 700; font-size: 14px; }
.bb-flag { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid rgba(31, 46, 61, 0.22); border-radius: var(--r-btn); background: transparent; font: 600 12.5px var(--sans); color: var(--navy); cursor: pointer; }
.bb-flag:hover { background: rgba(31, 46, 61, 0.06); }
.bb-flag.on { border-color: var(--terra); color: #8A341C; background: var(--terra-tint); }
.bb-flag.on .bb-ico { fill: var(--terra); stroke: var(--terra); }

/* A choice and its cross-out button */
.xc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.xc > .choice { width: 100%; min-width: 0; }
.x-out { flex: none; width: 46px; height: 34px; border: 1px solid rgba(31, 46, 61, 0.22); border-radius: 99px; background: var(--card); font: 600 12px var(--sans); color: var(--navy); cursor: pointer; }
.x-out { position: relative; font-size: 13.5px; font-weight: 700; }
.x-out:not(.on)::after { content: ""; position: absolute; left: 14px; right: 14px; top: calc(50% - 0.5px); border-top: 1.5px solid currentColor; }
.x-out:hover { background: rgba(31, 46, 61, 0.08); }
.x-out.on { border-color: var(--navy); background: var(--navy); color: var(--on-navy); font-size: 11.5px; }
.xc.out > .choice { opacity: 0.5; }
.xc.out > .choice > span { text-decoration: line-through; text-decoration-thickness: 1.5px; }
.xc.out > .choice > b { text-decoration: line-through; }
/* Graph choices: the cross-out button sits in the corner of its graph. */
.choices.gc .xc { position: relative; display: block; }
.choices.gc .x-out { position: absolute; top: 6px; right: 6px; height: 28px; width: 42px; }

/* The bar across the bottom */
.bb-bot { position: sticky; bottom: 0; z-index: 30; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 0; padding: 10px 18px; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--r) var(--r) 0 0; box-shadow: 0 -4px 14px rgba(31, 46, 61, 0.08); }
.bb-who { font-size: 13px; font-weight: 600; color: var(--mute); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-nav { position: relative; display: flex; justify-content: center; }
.bb-navbtn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border: 0; border-radius: var(--r-btn); background: var(--navy); color: var(--on-navy); font: 600 13.5px var(--sans); cursor: pointer; white-space: nowrap; }
.bb-navbtn.bb-here { cursor: default; background: transparent; color: var(--navy); border: 1px solid rgba(31, 46, 61, 0.22); }
.bb-caret { font-size: 11px; }
.bb-move { display: flex; justify-content: flex-end; gap: 8px; }
.bb-move .btn { min-width: 84px; }

/* The list of questions, above the question button, and on the review page */
.bb-pop { position: absolute; bottom: calc(100% + 14px); left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow: auto; padding: 16px 18px 18px; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: var(--r); box-shadow: 0 12px 34px rgba(31, 46, 61, 0.22); }
.bb-pop-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bb-pop-head b { font-family: var(--serif); font-size: 20px; color: var(--navy); }
.bb-x { border: 0; background: none; font-size: 24px; line-height: 1; color: var(--navy); cursor: pointer; padding: 0 4px; }
.bb-pop-foot { margin-top: 14px; display: flex; justify-content: center; }
.bb-key { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 12px; font-size: 12.5px; color: var(--mute); }
.bb-key span { display: inline-flex; align-items: center; gap: 6px; }
.bb-key i.bb-cell { width: 18px; height: 18px; min-width: 0; padding: 0; cursor: default; }
.bb-key .bb-ico { color: var(--terra); fill: var(--terra); stroke: var(--terra); }
.bb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 8px; }
.bb-cell { position: relative; display: inline-flex; align-items: center; justify-content: center; height: 40px; min-width: 40px; border: 1.5px dashed rgba(31, 46, 61, 0.45); border-radius: 4px; background: var(--panel); font: 600 13.5px var(--sans); color: var(--navy); cursor: pointer; }
.bb-cell:hover { background: rgba(31, 46, 61, 0.06); }
.bb-grid.frq .bb-cell { border-style: solid; border-color: rgba(31, 46, 61, 0.3); }
.bb-cell.done { border-style: solid; border-color: var(--navy); background: var(--navy); color: var(--on-navy); }
.bb-cell.cur { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--terra); }
.bb-cell .bb-ico { position: absolute; top: -7px; right: -5px; width: 12px; height: 14px; fill: var(--terra); stroke: var(--terra); }

/* The review page of a part */
.bb-check { padding: 30px 34px; }
.bb-check h1 { font-family: var(--serif); font-size: 34px; line-height: 1.05; margin: 0 0 10px; color: var(--navy); }
.bb-check .bb-grid { margin: 6px 0 18px; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); }
.bb-check .bb-cell { height: 46px; }

/* The break */
.clock.bb-break { font-size: 54px; margin: 10px 0 6px; }

/* The embedded calculator (only with a Desmos key) */
.bb-calc { position: fixed; top: 96px; right: 24px; z-index: 70; display: flex; flex-direction: column; width: min(460px, calc(100vw - 16px)); height: min(580px, calc(100vh - 110px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 40px rgba(31, 46, 61, 0.28); overflow: hidden; }
.bb-calc[hidden] { display: none; }
.bb-calc-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--navy); color: var(--on-navy); cursor: move; touch-action: none; user-select: none; }
.bb-calc-bar b { font-size: 13px; }
.bb-calc-x { border: 1px solid rgba(239, 232, 220, 0.4); border-radius: var(--r-btn); background: none; color: var(--on-navy); font: 600 12px var(--sans); padding: 4px 10px; cursor: pointer; }
.bb-calc-body { position: relative; flex: 1; min-height: 0; }
.bb-calc-msg { margin: 0; padding: 18px; font-size: 14px; color: var(--mute); }

@media (max-width: 860px) {
  .bb-check { padding: 22px 18px; }
}
@media (max-width: 620px) {
  .bb-top { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 8px 12px; }
  .bb-part { grid-column: 1 / -1; }
  .bb-time { flex-direction: row; align-items: center; gap: 10px; min-width: 0; min-height: 0; justify-self: start; }
  .bb-part b { font-size: 19px; }
  .bb-tool { padding: 7px 11px; }
  .bb-time .clock { font-size: 24px; }
  .bb-bot { grid-template-columns: auto 1fr; padding: 8px 10px; }
  .bb-who { display: none; }
  .bb-nav { justify-content: flex-start; position: static; }
  .bb-pop { left: 8px; right: 8px; transform: none; width: auto; }
  .bb-move .btn { min-width: 0; padding-left: 14px; padding-right: 14px; }
  .bb-calc { top: 8px; right: 8px; height: calc(100vh - 16px); }
  .bb-check h1 { font-size: 28px; }
}
