/* ---------- Tokens (matched to Bluebook) ---------- */
:root {
  --bar: #d5e2f7;
  --ink: #1b1b1b;
  --blue: #324dc7;
  --blue-dark: #2640ad;
  --gray-bar: #f1f1f3;
  --line: #2a2a2a;
  --divider: #6b6b6b;
  --ui: "Roboto", "Segoe UI", Arial, sans-serif;
  --serif: "Noto Serif", "Georgia", serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--ui); color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
/* everything is selectable, including options */
body, #app, #app * { user-select: text; -webkit-user-select: text; }
button { font-family: inherit; }
button, .btn { cursor: pointer; }
::selection { background: #b9d2ff; }

/* ---------- Dashed Bluebook rules ---------- */
.dash-b::after, .dash-t::before { content: ""; position: absolute; left: 0; right: 0; height: 2px; background-image: repeating-linear-gradient(90deg, #111 0 9px, transparent 9px 12px); }
.dash-b::after { bottom: 0; } .dash-t::before { top: 0; }

/* ---------- Exam shell ---------- */
.exam { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #fff; overflow: hidden; }
.hdr { background: var(--bar); height: 80px; flex: none; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding: 10px 40px 0; position: relative; }
.hdr .l .title { font-size: 18px; font-weight: 500; letter-spacing: .1px; margin-top: 2px; }
.hdr .l .dir { font-size: 14px; margin-top: 12px; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; background: none; border: 0; padding: 0; color: var(--ink); position: relative; }
.hdr .c { text-align: center; padding-top: 2px; }
.hdr .timer { font-size: 20px; font-weight: 700; letter-spacing: .5px; line-height: 28px; }
.hdr .hide { margin-top: 6px; font-size: 12px; font-weight: 500; border: 1px solid #111; background: transparent; border-radius: 12px; padding: 1px 22px; height: 20px; line-height: 16px; }
.hdr .r { display: flex; justify-content: flex-end; gap: 26px; align-items: flex-start; padding-top: 6px; }
.tool { background: none; border: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--ink); min-width: 48px; }
.tool svg { height: 22px; width: auto; }
.tool.on svg { color: var(--blue); }
.tool.on { color: var(--blue); }

.main { flex: 1; min-height: 0; display: flex; position: relative; }
.preview-banner { flex: none; height: 34px; margin: 0 2%; display: flex; align-items: center; justify-content: center; border-radius: 0 0 18px 18px; background: #0c1b71; color: #fff; font-size: 12px; font-weight: 700; }
.main { background: #fff; }
.pane { flex: 1 1 0; min-width: 0; overflow: auto; position: relative; }
.pane.left { padding: 32px 40px 40px 42px; }
.pane.right { padding: 32px 40px 40px 38px; }
.pane.hidden { display: none; }
.pane.left .passage { max-width: 900px; margin-left: auto; margin-right: auto; }
.pane.right:not(.solo) > * { max-width: 666px; margin-left: auto; margin-right: auto; }
.pane.right:not(.solo):not(.spr-pane) > * { position: relative; left: -48px; top: -30px; }
/* single-pane (math) questions: centered column that slides right of the calculator, like Bluebook */
.pane.right.solo > * { max-width: 760px; margin-left: auto; margin-right: auto; transition: margin-left .35s ease, width .35s ease; }
.exam.calc-open .pane.right.solo > * { transition: none; }
.divider { flex: none; width: 3px; background: #777; position: relative; cursor: col-resize; touch-action: none; }
.divider::before { content: ""; position: absolute; left: -12px; right: -12px; top: 0; bottom: 0; }
.divider .handle { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #111; color: #fff; width: 22px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11px; }
.expand { position: absolute; top: 10px; width: 32px; height: 32px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); border: 0; display: flex; align-items: center; justify-content: center; z-index: 2; }
.pane.left .expand { right: 26px; }
.pane.right .expand { left: 18px; }

.ftr { background: var(--bar); height: 62px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 40px; position: relative; }
.ftr .who { font-size: 18px; font-weight: 500; min-width: 200px; }
.qnav { background: #1a1a1a; color: #fff; border: 0; border-radius: 6px; padding: 9px 16px; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; position: absolute; left: 50%; transform: translateX(-50%); }
.nav-btns { display: flex; gap: 14px; }
.pill { background: var(--blue); color: #fff; border: 0; border-radius: 22px; padding: 0 26px; height: 42px; font-size: 16px; font-weight: 700; min-width: 78px; }
.pill:hover { background: var(--blue-dark); }
.pill.ghost { background: #fff; color: var(--blue); border: 2px solid var(--blue); }
.pill[disabled] { opacity: .45; cursor: default; }

/* ---------- Question content ---------- */
.passage { font-family: var(--serif); font-size: 21px; line-height: 1.55; color: #111; }
.passage p { margin: 0 0 14px; }
.passage .src { font-style: italic; }
.passage ul { padding-left: 22px; margin: 8px 0 14px; }
.passage .blank { white-space: nowrap; }
.figimg { max-width: 100%; display: block; margin: 8px 0 16px; }
.qhead { display: flex; align-items: center; background: var(--gray-bar); height: 36px; margin-bottom: 0; position: relative; }
.qhead::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: #111; }
.qnum { background: #111; color: #fff; width: 32px; height: 36px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px; }
.mark { display: flex; align-items: center; gap: 6px; background: none; border: 0; margin-left: 14px; font-size: 14.5px; font-weight: 500; color: #111; }
.mark.on { color: #b3261e; }
.mark.on svg path { fill: #b3261e; stroke: #b3261e; }
.abc { margin-left: auto; margin-right: 6px; width: 28px; height: 26px; border: 2px solid #111; border-radius: 4px; background: #fff; display: flex; align-items: center; justify-content: center; padding: 0; }
.abc.on { background: var(--blue); border-color: var(--blue); }
.abc.on svg * { stroke: #fff; fill: #fff; }
.prompt { font-family: var(--serif); font-size: 16px; line-height: 1.7; margin: 8px 0 10px; color: #111; }
.prompt p { margin: 0 0 12px; }
.math-stem { font-family: var(--serif); font-size: 20px; line-height: 1.55; color: #111; }
.math-stem .math-expression { font-size: 1.35em; margin: 0 0 42px; }
.math-stem .math-prompt { font-size: 20px; line-height: 1.5; margin: 0 0 10px; }
.math-stem > p:not(.math-expression):not(.math-prompt):not(.math-equations) { font-size: 14px; line-height: 1.45; color: #444; }
.math-stem .math-table { border-collapse: collapse; margin: 0 0 14px; font-size: .92em; line-height: 1.25; }
.math-stem .math-table caption { caption-side: top; padding: 0 0 4px; font-weight: 600; }
.math-stem .math-table th, .math-stem .math-table td { border: 1px solid #555; padding: 5px 10px; text-align: center; }
.exam.math-exam .choice .txt math { font-size: 22px; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice-row { display: flex; align-items: center; gap: 8px; }
.choice { flex: 1; display: flex; align-items: center; gap: 14px; border: 1.5px solid #858585; border-radius: 10px; padding: 12px 16px; background: #fff; font-family: var(--serif); font-size: 16px; line-height: 1.5; min-height: 52px; cursor: pointer; text-align: left; color: #222; position: relative; }
.choice:hover { border-color: #000; box-shadow: 0 0 0 1px #000 inset; }
.choice .ltr { flex: none; width: 26px; height: 26px; border: 1.5px solid #666; border-radius: 50%; font-family: var(--ui); font-weight: 500; font-size: 14px; display: flex; align-items: center; justify-content: center; background: transparent; }
.choice .txt { flex: 1; min-width: 0; }
.choice .txt img { max-width: 100%; display: block; }
.choice .txt svg { max-width: 100%; display: block; height: auto; }
.exam.math-exam .choice .txt .math-option { font-size: 22px; }
.choice.sel { border-color: var(--blue); box-shadow: 0 0 0 1.5px var(--blue) inset; background: #f3f5ff; }
.choice.sel .ltr { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice.struck .txt { opacity: .5; }
.choice.struck::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 2px; background: #111; pointer-events: none; }
.choice.struck .ltr { opacity: .45; }
/* letters-only choices (choice text lives in the question image) */
.lettersnote { font: 13px var(--ui); color: #555; margin: 0 0 10px; }
.choices.letters { flex-direction: row; flex-wrap: wrap; gap: 12px 18px; }
.choices.letters .choice-row { flex: 0 0 auto; }
.choices.letters .choice { flex: none; min-width: 64px; justify-content: center; }
.choices.letters .txt { display: none; }
.choices.letters .choice.struck .ltr { text-decoration: line-through; opacity: .5; }
/* image (math) choices: line-through can't reach pixels, so draw the line across the image itself — not the box */
.choice.struck .txt .imgwrap::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #111; transform: translateY(-50%); pointer-events: none; }
.choice.correct { border-color: #1e8a3c; box-shadow: 0 0 0 1.5px #1e8a3c inset; background: #effaf2; }
.choice.correct .ltr { background: #1e8a3c; border-color: #1e8a3c; color: #fff; }
.choice.wrong { border-color: #c62828; box-shadow: 0 0 0 1.5px #c62828 inset; background: #fdf0f0; }
.choice.wrong .ltr { background: #c62828; border-color: #c62828; color: #fff; }
.strike { flex: none; width: 22px; height: 22px; margin: 0 2px 0 0; border-radius: 50%; border: 1.5px solid #666; background: transparent; font-size: 11px; line-height: 1; position: relative; padding: 0; font-family: var(--ui); font-weight: 500; }
.strike::after { content: ""; position: absolute; left: -4px; right: -4px; top: 50%; height: 1.5px; background: #222; }
.strike-undo { flex: none; border: 0; background: none; padding: 0 2px; text-decoration: underline; font: 500 14px var(--ui); color: #111; }
.spr-entry { position: relative; min-height: 250px; }
.spr-answer { width: 130px; }
.pane.left.spr-directions-pane > * { max-width: 440px; margin-left: 116px; margin-right: 0; }
.pane.right.spr-pane > * { max-width: 900px; margin-left: 78px; margin-right: 0; }
.spr input { font: 400 16px var(--serif); border: 1.5px solid #888; border-radius: 7px; padding: 8px 10px; width: 75px; height: 41px; background: transparent; }
.spr input:focus { outline: none; border-color: var(--blue); }
.spr .prev { margin-top: 38px; font: 700 16px/1.2 var(--serif); color: #222; }
.spr .prev b { font: inherit; margin-left: 8px; color: #111; }
.spr .hint { font-size: 13px; color: #555; margin-top: 12px; line-height: 1.5; max-width: 420px; }
.keypad { width: 100%; border: 1px solid #777; background: #ffff; }
.spr-pane .keypad { position: absolute; left: 164px; top: 0; width: 230px; }
.keypad header { height: 36px; background: #292929; color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; font: 500 13px var(--ui); }
.keypad header button { border: 0; color: #fff; background: none; font-size: 24px; }
.keypad .keys { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; padding: 7px; }
.keypad .keys button { min-height: 32px; border: 1px solid #d2d2d2; border-radius: 7px; background: #f8f8f8; font: 400 19px var(--ui); color: #222; }
.keypad .keys button:nth-child(-n+9) { grid-column: span 4; }
.keypad .keys button:nth-child(10), .keypad .keys button:nth-child(11), .keypad .keys button:nth-child(13), .keypad .keys button:nth-child(14) { grid-column: span 2; }
.keypad .keys button:nth-child(12) { grid-column: span 4; }
.keypad.closed { display: none; }
.keypad-toggle { margin-top: 32px; padding: 7px 16px; border: 0; border-radius: 20px; background: #292929; color: #fff; font: 500 14px var(--ui); }
.spr-directions { max-width: 640px; margin: 0 auto; font: 16px/1.45 var(--serif); color: #333; }
.spr-directions h3 { margin: 0 0 18px; font-size: 18px; }
.spr-directions ul { padding-left: 24px; margin: 0 0 22px; }
.spr-directions li { margin: 0 0 6px; }
.spr-examples { max-width: 600px; margin: 18px auto 0; text-align: center; }
.spr-example-title { margin-bottom: 4px; }
.spr-examples table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spr-examples th, .spr-examples td { border: 1px solid #888; padding: 8px 10px; }
.imgwrap { position: relative; line-height: 0; overflow: hidden; width: 100%; }
.imgwrap img { display: block; mix-blend-mode: multiply; user-select: none; -webkit-user-select: none; }
.exam.math-exam .imgwrap { width: min(100%, calc(var(--natw, 100%) * 1.6)) !important; }
.imgwrap .ocr { position: absolute; inset: 0; overflow: hidden; pointer-events: auto; }
/* scanned passages may grow past their natural width when the pane allows it (expanded pane, wide tablet) */
.pane.left .passage .imgwrap { width: min(100%, calc(var(--natw, 100%) * 1.5)) !important; }
.imgwrap .ocr span { position: absolute; color: transparent; white-space: pre; line-height: 1; transform-origin: 0 0; cursor: text; }
.imgwrap .ocr span::selection { background: rgba(60,110,230,.35); color: transparent; }

mark.hl { background: #fff3a3; color: inherit; border-radius: 2px; padding: 0; }
mark.hl.blue { background: #bfe0ff; }
mark.hl.pink { background: #ffc9e2; }
mark.hl.ul { background: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
mark.hl.note { box-shadow: 0 -2px 0 #324dc7 inset; }
.hltb { position: absolute; z-index: 50; background: #fff; border: 0; border-radius: 28px; box-shadow: 0 3px 12px rgba(0,0,0,.25); padding: 8px; display: flex; align-items: center; gap: 8px; }
.hltb button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #777; background: transparent; font-weight: 700; font-size: 13px; padding: 0; }
.hltb button.y { background: #f1edcf; } .hltb button.b { background: #d5e2e9; } .hltb button.p { background: #efd6e4; }
.hltb button.underline-tool, .hltb button.delete-tool, .hltb button.note-tool { width: 40px; border: 0; border-radius: 0; font-size: 18px; }
.hltb button svg { width: 22px; height: 22px; fill: none; stroke: #222; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ---------- Popovers ---------- */
.pop { position: absolute; z-index: 40; background: #fff; border: 1px solid #999; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.28); }
.navpop { bottom: 70px; left: 50%; transform: translateX(-50%); width: 620px; max-width: 94vw; padding: 18px 20px 14px; }
.navpop h4 { margin: 0 0 12px; text-align: center; font-size: 16px; font-weight: 500; padding-bottom: 12px; border-bottom: 1px solid #ccc; }
.navpop .legend { display: flex; justify-content: center; gap: 18px; font-size: 13px; margin-bottom: 14px; flex-wrap: wrap; }
.navpop .grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 10px 8px; margin-bottom: 14px; }
.nbtn { height: 36px; border: 1.5px dashed #324dc7; background: #fff; color: var(--blue); font-weight: 700; font-size: 14px; border-radius: 4px; position: relative; padding: 0; }
.nbtn.done { border-style: solid; background: var(--blue); color: #fff; }
.nbtn.cur { outline: 2px solid #111; outline-offset: 2px; }
.nbtn .flag { position: absolute; top: -9px; right: -5px; color: #c62828; font-size: 13px; }
.navpop .go { display: block; margin: 0 auto; background: #fff; border: 2px solid var(--blue); color: var(--blue); border-radius: 20px; padding: 7px 22px; font-weight: 700; font-size: 14px; }
.dirpop { top: 66px; left: 40px; width: 520px; padding: 18px 20px; font-size: 14px; line-height: 1.55; z-index: 60; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: 330px; background: #fff; border-left: 2px solid #111; z-index: 45; box-shadow: -6px 0 18px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.drawer h3 { margin: 0; padding: 16px 18px; font-size: 17px; font-weight: 500; border-bottom: 1px solid #ccc; display: flex; justify-content: space-between; }
.drawer .body { padding: 14px 18px; overflow: auto; flex: 1; font-size: 14px; }
.drawer .item { border: 1px solid #ddd; border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.drawer .item q { display: block; font-family: var(--serif); font-size: 13.5px; margin-bottom: 6px; quotes: none; }
.drawer textarea { width: 100%; min-height: 54px; font: 14px var(--ui); border: 1px solid #aaa; border-radius: 6px; padding: 6px; }
.scratchdrawer { position: absolute; right: 0; top: 0; bottom: 0; width: 330px; background: #fff; border-left: 2px solid #111; z-index: 45; box-shadow: -6px 0 18px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.scratchdrawer h3 { margin: 0; padding: 16px 18px; font-size: 17px; font-weight: 500; border-bottom: 1px solid #ccc; display: flex; justify-content: space-between; }
.scratchdrawer .body { padding: 14px 18px; overflow: auto; flex: 1; display: flex; }
.scratchdrawer textarea { flex: 1; width: 100%; resize: none; font: 14px var(--ui); line-height: 1.55; border: 1px solid #aaa; border-radius: 6px; padding: 10px; }
.scratchdrawer textarea:focus { outline: none; border-color: var(--blue); }
.moremenu { top: 52px; right: 40px; width: 220px; padding: 6px 0; z-index: 60; }
.moremenu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 16px; font-size: 14px; }
.moremenu button:hover { background: #f1f3fb; }
.refsheet { position: absolute; z-index: 44; top: 84px; right: 24px; width: min(760px, 70vw); height: calc(100% - 170px); background: #fff; border: 2px solid #111; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.35); display: flex; flex-direction: column; }
.refsheet header, .calc header { background: var(--bar); padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 500; border-radius: 8px 8px 0 0; cursor: move; }
.refsheet .body { padding: 18px 24px; overflow: auto; font-family: var(--serif); font-size: 14.5px; line-height: 1.6; }
.refsheet .shapes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 20px; }
.refsheet .shapes div { padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
.xbtn { background: none; border: 0; font-size: 20px; line-height: 1; padding: 0 4px; }
.calc { position: absolute; z-index: 44; top: 19.5vh; left: 9vw; width: 390px; height: min(645px, 74vh); background: #fff; border: 1px solid #aaa; border-radius: 2px; box-shadow: 0 4px 16px rgba(0,0,0,.22); display: flex; flex-direction: column; resize: both; overflow: hidden; min-width: 320px; min-height: 340px; }
.calc .cbody { flex: 1; min-height: 0; }
.calc[hidden] { display: none; }
.calc header { touch-action: none; }
.calc header { background: #292929; color: #fff; padding: 5px 10px; border-radius: 0; }
.calc header .xbtn { color: #fff; }
.calc iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 0 0 8px 8px; }
.calc.dragging iframe, .calc:active iframe { pointer-events: none; }

/* ---------- Review page ---------- */
.review { flex: 1; overflow: auto; padding: 32px 20px; text-align: center; }
.review h2 { font-size: 30px; font-weight: 500; margin: 0 0 24px; }
.review p.sub { color: #333; margin: 0 auto 26px; max-width: 800px; line-height: 1.5; }
.review .box { border: 1px solid #e3e3e3; border-radius: 10px; background: #fff; max-width: 1024px; margin: 0 auto 22px; padding: 22px; text-align: left; box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.review .box .top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; font-size: 15px; font-weight: 500; }
.review .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 16px 12px; }

/* ---------- Home / menus ---------- */
.site { min-height: 100vh; min-height: 100dvh; background: #f6f8fd; }
.topnav { display: flex; align-items: center; }
.site-top { background: var(--bar); padding: 22px 40px; display: flex; align-items: center; gap: 14px; }
.site-top .logo, .site-top h1 { cursor: pointer; }
.site-top .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.site-top h1 { margin: 0; font-size: 20px; font-weight: 500; }
.site-top .spacer { flex: 1; }
.site-top a.link { color: var(--blue); font-weight: 500; font-size: 14px; text-decoration: none; margin-left: 18px; cursor: pointer; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 36px 24px 80px; }
.crumbs { font-size: 14px; color: #444; margin-bottom: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--blue); cursor: pointer; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.wrap h2 { font-size: 30px; font-weight: 500; margin: 0 0 6px; }
.wrap .lead { color: #444; margin: 0 0 28px; font-size: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 16px; }
.card { background: #fff; border: 1.5px solid #cfd6ea; border-radius: 14px; padding: 20px 22px; text-align: left; font-size: 17px; font-weight: 500; color: var(--ink); display: flex; flex-direction: column; gap: 6px; min-height: 104px; transition: .12s; }
.card:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(50,77,199,.16); transform: translateY(-1px); }
.card small { font-size: 13.5px; font-weight: 400; color: #555; line-height: 1.4; }
.card .bar { height: 6px; border-radius: 3px; background: #e5e9f5; margin-top: auto; overflow: hidden; }
.card .bar i { display: block; height: 100%; background: var(--blue); }
.card.mix { background: linear-gradient(135deg, #324dc7, #4a63dc); color: #fff; border-color: transparent; }
.card.mix small { color: #dfe5ff; }
.card.big { min-height: 150px; font-size: 22px; }
.sec-title { font-size: 14px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #555; margin: 30px 0 12px; }
.tests { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 14px; }
.tcard { background: #fff; border: 1.5px solid #cfd6ea; border-radius: 12px; padding: 16px 18px; text-align: left; display: flex; flex-direction: column; gap: 4px; }
.tcard:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(50,77,199,.16); }
.tcard b { font-size: 16px; font-weight: 500; } .tcard span { font-size: 13px; color: #555; }
.tcard .st { margin-top: 8px; font-size: 13px; font-weight: 700; }
.tcard .st.ok { color: #1e8a3c; } .tcard .st.prog { color: #b36b00; }
.tcard .row { display: flex; gap: 8px; margin-top: 10px; }
.tcard .row button { flex: 1; font-size: 13px; font-weight: 700; border-radius: 16px; padding: 6px 0; border: 2px solid var(--blue); background: var(--blue); color: #fff; }
.tcard .row button.o { background: #fff; color: var(--blue); }
.tcard.locked { background: #f1f2f6; border-color: #d8dbe5; opacity: .78; }
.tcard.locked:hover { border-color: #d8dbe5; box-shadow: none; }
.tcard.locked .st.locked-label { color: #6d7280; }
.tcard.locked .row button { background: #d8dbe5; border-color: #d8dbe5; color: #4d5260; }
.tcard.free-active { border-color: #9ab4ef; }

/* ---------- Results ---------- */
.score { display: flex; gap: 22px; align-items: center; background: #fff; border: 1.5px solid #cfd6ea; border-radius: 16px; padding: 24px 28px; margin: 8px 0 28px; flex-wrap: wrap; }
.score .big { font-size: 56px; font-weight: 700; color: var(--blue); line-height: 1; }
.score .meta { font-size: 16px; line-height: 1.6; }
.score .acts { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.wlist { display: flex; flex-direction: column; gap: 12px; }
.witem { background: #fff; border: 1.5px solid #e2c3c3; border-radius: 12px; padding: 14px 18px; display: flex; gap: 16px; align-items: center; }
.witem .n { width: 36px; height: 36px; border-radius: 8px; background: #c62828; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.witem .info { flex: 1; font-size: 14.5px; line-height: 1.5; }
.witem .info .q { font-family: var(--serif); color: #333; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.witem .ans b.r { color: #c62828; } .witem .ans b.g { color: #1e8a3c; }
.perfect { background: #effaf2; border: 1.5px solid #9fd5ae; border-radius: 12px; padding: 20px; text-align: center; font-size: 18px; }

/* ---------- My notes ---------- */
.nlist { display: flex; flex-direction: column; gap: 12px; }
.ncard { background: #fff; border: 1.5px solid #cfd6ea; border-radius: 12px; padding: 16px 18px; display: flex; gap: 16px; align-items: flex-start; }
.ncard .info { flex: 1; min-width: 0; }
.ncard .meta { font-size: 12.5px; font-weight: 700; letter-spacing: .2px; color: #555; text-transform: uppercase; margin-bottom: 8px; }
.ncard .txt { font-family: var(--serif); font-size: 15px; line-height: 1.6; color: #222; white-space: pre-wrap; }
.ncard .pill { flex: none; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #111; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 100; }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 90; display: flex; align-items: center; justify-content: center; }
.dialog { background: #fff; border-radius: 12px; padding: 26px 28px; max-width: 460px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.dialog h3 { margin: 0 0 10px; font-weight: 500; } .dialog p { line-height: 1.5; margin: 0 0 20px; }
.dialog .acts { display: flex; gap: 10px; justify-content: flex-end; }

@media (max-width: 900px) {
  .hdr { padding: 8px 14px 0; } .ftr { padding: 0 14px; }
  .main { flex-direction: column; } .divider { width: auto; height: 4px; }
  .pane.left, .pane.right { padding: 24px 18px; }
  .spr-entry { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .spr-entry { min-height: 0; }
  .spr-answer { width: auto; }
  .pane.left.spr-directions-pane > * { max-width: none; margin-left: 0; }
  .spr .prev { margin-top: 14px; }
  .keypad-toggle { margin-top: 16px; }
  .pane.right.spr-pane > * { max-width: none; margin-left: 0; }
  .spr-pane .keypad { position: static; max-width: 360px; width: 100%; }
  .hdr .r .tool span { display: none; }
}

.origrow { margin-top: 26px; }
.origbtn { background: none; border: 0; padding: 0; color: var(--blue); font: 500 13px var(--ui); text-decoration: underline; }

.site { display: flex; flex-direction: column; }
.site .wrap { flex: 1; width: 100%; }
.foot { text-align: center; font-size: 12px; color: #6b7280; padding: 18px 0 24px; }
.foot a { color: inherit; }
.foot a:hover { color: var(--blue); }

/* ---------- Account ---------- */
.site-top { position: relative; }
.acct { margin-left: 22px; width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: var(--blue); color: #fff; font: 700 15px var(--ui); display: flex; align-items: center; justify-content: center; padding: 0; }
.acct:hover, .acct[aria-expanded="true"] { background: var(--blue-dark); box-shadow: 0 0 0 3px rgba(50,77,199,.2); }
.acctmenu { top: 70px; right: 40px; width: 260px; padding: 6px 0; z-index: 60; }
.acctmenu[hidden] { display: none; }
.acctmenu .who { padding: 10px 16px 12px; border-bottom: 1px solid #e3e7f2; display: flex; flex-direction: column; gap: 3px; font-size: 14px; overflow-wrap: anywhere; }
.acctmenu .who span { color: #555; font-size: 13px; }
.acctmenu .who .plan { margin-top: 6px; align-self: flex-start; background: #eef1fc; color: var(--blue); font-weight: 500; font-size: 12px; border-radius: 10px; padding: 2px 10px; }
.acctmenu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 16px; font-size: 14px; color: var(--ink); }
.acctmenu button:hover, .acctmenu button:focus-visible { background: #f1f3fb; outline: none; }

/* checkbox row (sign-up form + consent dialog) */
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; color: #333; cursor: pointer; margin: 0 0 12px; }
.check input { appearance: none; -webkit-appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid #8a93ad; border-radius: 5px; background: #fff; display: grid; place-content: center; cursor: pointer; transition: .12s; }
.check input::after { content: ""; width: 10px; height: 6px; border: solid #fff; border-width: 0 0 2.4px 2.4px; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .12s; }
.check input:checked { background: var(--blue); border-color: var(--blue); }
.check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }
.check input:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(50,77,199,.3); }
.check a { color: var(--blue); font-weight: 500; }
.check.invalid input { border-color: #c62828; }
.dialog.consent { width: min(480px, 92vw); }
.dialog.consent .check { margin-bottom: 14px; }
.consent-err { color: #c62828; font-size: 13.5px; margin: 4px 0 14px !important; }

/* ---------- Touch screens (phones, iPads) ---------- */
@media (pointer: coarse) {
  .strike { width: 28px; height: 28px; font-size: 12px; }
  .hltb { padding: 8px; gap: 8px; }
  .hltb button { width: 38px; height: 38px; font-size: 15px; }
  .hltb button.wide { padding: 0 12px; }
  /* iOS zooms the page when focusing a field with text under 16px */
  .drawer textarea, .scratchdrawer textarea, .dialog textarea { font-size: 16px !important; }
}
/* tablets: give the passage the room the desktop padding would take */
@media (pointer: coarse) and (min-width: 641px) {
  .pane.left { padding: 44px 20px 32px 22px; }
  .pane.right { padding: 44px 22px 32px 22px; }
}

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  /* site chrome: brand + account on the first row, page links on the second */
  .site-top { padding: 12px 16px 10px; flex-wrap: wrap; gap: 6px 10px; }
  .site-top .logo { width: 34px; height: 34px; font-size: 14px; }
  .site-top h1 { font-size: 17px; }
  .site-top .spacer { display: none; }
  .acct { order: 2; margin-left: auto; width: 34px; height: 34px; }
  .topnav { order: 3; width: 100%; gap: 22px; overflow-x: auto; }
  .site-top .topnav a.link { margin-left: 0; padding: 4px 0; white-space: nowrap; }
  .acctmenu { top: 54px; right: 12px; width: min(260px, calc(100vw - 24px)); }
  .wrap { padding: 22px 16px 56px; }
  .wrap h2 { font-size: 24px; }
  .wrap .lead { font-size: 15px; margin-bottom: 20px; }
  .card { min-height: 0; padding: 16px 18px; }
  .card.big { min-height: 108px; font-size: 20px; }
  .score { padding: 18px; gap: 14px; }
  .score .big { font-size: 44px; }
  .score .acts { margin-left: 0; width: 100%; }
  .score .acts .pill { flex: 1 1 auto; }
  .witem, .ncard { flex-wrap: wrap; gap: 10px 14px; padding: 14px; }
  .witem .info, .ncard .info { flex: 1 1 calc(100% - 60px); }
  .witem > .pill, .ncard > .pill { width: 100%; }

  /* exam header: title truncates, tools shrink to icons */
  .hdr { height: auto; min-height: 58px; padding: 8px 10px 6px; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 8px; }
  .hdr .l { min-width: 0; }
  .hdr .l .title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hdr .l .dir { margin-top: 6px; font-size: 13px; }
  .hdr .timer { font-size: 17px; line-height: 22px; }
  .hdr .hide { margin-top: 3px; padding: 0 12px; }
  .hdr .r { gap: 2px; padding-top: 2px; }
  .tool { min-width: 32px; }
  .tool svg { height: 20px; }

  /* exam footer: question navigator sits in the flow so it can't cover Back/Next */
  .ftr { height: 58px; padding: 0 10px; gap: 8px; }
  .ftr .who { display: none; }
  .qnav { position: static; transform: none; font-size: 14px; padding: 8px 12px; white-space: nowrap; }
  .nav-btns { gap: 8px; margin-left: auto; }
  .pill { padding: 0 18px; height: 40px; font-size: 15px; min-width: 0; }

  .pane.left, .pane.right { padding: 18px 14px 28px; }
  /* scanned passages/figures stay legible: keep a readable minimum width and let the pane scroll sideways */
  .pane .passage .imgwrap { min-width: min(var(--natw, 100%), 560px); }
  .passage { font-size: 18px; line-height: 1.55; }
  .choice { padding: 10px 12px; gap: 10px; font-size: 15.5px; }
  .spr input { width: 100%; max-width: 240px; }

  /* floating tools become full-width sheets */
  .calc { left: 8px !important; right: 8px; top: auto !important; bottom: 66px; width: auto; height: 52vh; height: 52dvh; min-width: 0; min-height: 0; resize: none; }
  .calc header { cursor: default; }
  .refsheet { left: 8px; right: 8px; top: 64px; width: auto; height: calc(100% - 132px); }
  .refsheet .body { padding: 14px 16px; }
  .navpop { bottom: 64px; padding: 14px 12px 12px; }
  .navpop .grid { grid-template-columns: repeat(5, 1fr); }
  .dirpop { left: 10px; right: 10px; top: 60px; width: auto; max-height: 70vh; overflow: auto; }
  .moremenu { right: 10px; top: 56px; }
  .drawer, .scratchdrawer { width: 100%; }
  .dialog { padding: 20px; margin: 0 12px; }
  .dialog .acts { flex-wrap: wrap; }
  .origview img { min-width: 860px; }
  .review { padding: 24px 14px; }
  .review h2 { font-size: 22px; }
  .review .box { padding: 16px; }
  .review .grid { grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 12px 8px; }
}
.math-figure { margin: 0 auto 18px; max-width: 540px; }
.math-figure svg { display: block; width: min(100%, 540px); height: auto; color: #111; }
