/* ---------- Tokens (matched to Bluebook) ---------- */
:root {
  --bar: #e7ecf8;
  --ink: #1b1b1b;
  --blue: #324dc7;
  --blue-dark: #2640ad;
  --gray-bar: #efefef;
  --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; 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; }
.pane { flex: 1 1 0; min-width: 0; overflow: auto; position: relative; }
.pane.left { padding: 52px 40px 40px 42px; }
.pane.right { padding: 52px 40px 40px 38px; }
.pane.hidden { display: none; }
.divider { flex: none; width: 4px; background: var(--divider); position: relative; cursor: col-resize; }
.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: 16px; line-height: 1.75; 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: 24px 0 18px; color: #111; }
.prompt p { margin: 0 0 12px; }
.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 #333; 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: #111; }
.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 #222; border-radius: 50%; font-family: var(--ui); font-weight: 500; font-size: 14px; display: flex; align-items: center; justify-content: center; background: #fff; }
.choice .txt { flex: 1; min-width: 0; }
.choice .txt img { max-width: 100%; display: block; }
.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 { text-decoration: line-through; opacity: .5; }
.choice.struck .txt img { opacity: .4; }
.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 #222; background: #fff; 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.on { background: #222; color: #fff; }
.spr label { font-family: var(--ui); font-size: 15px; font-weight: 500; display: block; margin-bottom: 8px; }
.spr input { font: 400 20px var(--serif); border: 2px solid #333; border-radius: 8px; padding: 10px 14px; width: 240px; }
.spr input:focus { outline: none; border-color: var(--blue); }
.spr .prev { margin-top: 14px; font-size: 14px; color: #444; }
.spr .prev b { font-family: var(--serif); font-size: 18px; margin-left: 8px; color: #111; }
.spr .hint { font-size: 13px; color: #555; margin-top: 12px; line-height: 1.5; max-width: 420px; }
.imgwrap { position: relative; line-height: 0; overflow: hidden; width: 100%; }
.imgwrap img { display: block; user-select: none; -webkit-user-select: none; }
.imgwrap .ocr { position: absolute; inset: 0; overflow: hidden; pointer-events: auto; }
.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: 1px solid #bbb; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25); padding: 6px; display: flex; gap: 6px; }
.hltb button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid #aaa; background: #fff; font-weight: 700; font-size: 13px; padding: 0; }
.hltb button.y { background: #fff3a3; } .hltb button.b { background: #bfe0ff; } .hltb button.p { background: #ffc9e2; }
.hltb button.wide { width: auto; padding: 0 8px; font-weight: 500; }

/* ---------- 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: 560px; 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: 90px; left: 60px; width: 520px; height: 520px; background: #fff; border: 2px solid #111; border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.35); display: flex; flex-direction: column; resize: both; overflow: hidden; min-width: 340px; min-height: 340px; }
.calc .cbody { flex: 1; min-height: 0; }

/* ---------- Review page ---------- */
.review { flex: 1; overflow: auto; padding: 40px 20px; text-align: center; }
.review h2 { font-size: 28px; font-weight: 500; margin: 0 0 10px; }
.review p.sub { color: #333; margin: 0 auto 26px; max-width: 640px; line-height: 1.5; }
.review .box { border: 1.5px solid #333; border-radius: 10px; max-width: 780px; margin: 0 auto 22px; padding: 22px; text-align: left; }
.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; background: #f6f8fd; }
.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(290px, 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(230px, 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); }

/* ---------- 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; }
  .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; }
