/* satori: plain CSS. Test screen imitates Bluebook's layout (header tools, split pane, footer nav). */
:root { --ink:#1b2b48; --mut:#5b6678; --line:#d6dce5; --blue:#324dc7; --blue2:#e8edff; --ok:#1d7a46; --bad:#b3261e; --warn:#b26a00; --bg:#f6f7f9; }
* { box-sizing: border-box; }
html, body { margin: 0; color: var(--ink); font: 16px/1.5 "Noto Sans", "Segoe UI", system-ui, sans-serif; background: #fff; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
.muted { color: var(--mut); } .small { font-size: .85rem; } .center { text-align: center; }
.loading { padding: 4rem; text-align: center; color: var(--mut); }
.page { max-width: 1080px; margin: 0 auto; padding: 1.5rem; } .page.narrow { max-width: 560px; }
.brand { font-weight: 800; letter-spacing: -.02em; margin: .2rem 0 1rem; } .brand small { font-weight: 400; color: var(--mut); font-size: 1rem; margin-left: .4rem; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.btn { border: 1px solid var(--ink); background: #fff; border-radius: 999px; padding: .45rem 1.1rem; margin: .15rem; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn:disabled { opacity: .4; cursor: default; }
.btn.danger { border-color: var(--bad); color: var(--bad); } .btn.tiny { padding: .1rem .7rem; font-size: .85rem; }
.btn.xl { border-radius: 12px; padding: 1rem 1.2rem; text-align: left; display: flex; flex-direction: column; font-weight: 700; min-width: 230px; flex: 1; }
.btn.xl small { font-weight: 400; opacity: .85; margin-top: .2rem; }
.row { display: flex; gap: .5rem; margin: 1rem 0; } .row input { flex: 1; }
input, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: .5rem .7rem; }
.cards { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 1rem; text-align: left; display: flex; flex-direction: column; }
.card span { color: var(--mut); font-size: .85rem; }
.filebtn { color: var(--blue); cursor: pointer; font-size: .9rem; }
.stats { display: flex; gap: .8rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.stat { flex: 1; min-width: 150px; border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: flex; flex-direction: column; }
.stat b { font-size: 1.8rem; line-height: 1.1; } .stat.big b { font-size: 2.4rem; color: var(--blue); }
.stat span { color: var(--mut); font-size: .85rem; } .stat em { font-style: normal; font-size: .78rem; }
.stat.warn { border-color: var(--warn); } .stat.warn b { color: var(--warn); }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.calib { background: var(--bg); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1.2rem; } .calib h3 { margin: 0 0 .5rem; font-size: 1rem; }
.calrow { display: flex; gap: 1rem; flex-wrap: wrap; } .calrow div { display: flex; flex-direction: column; min-width: 120px; }
.calrow b { font-size: 1.3rem; } .calrow span { font-size: .8rem; color: var(--mut); }
table.skills { width: 100%; border-collapse: collapse; font-size: .9rem; }
.skills th, .skills td { padding: .35rem .4rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.skills tr.dom th { background: var(--bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.skills td.bad { color: var(--bad); font-weight: 700; }
.bar { display: inline-block; width: 80px; height: 8px; background: #eceff4; border-radius: 4px; margin-right: .4rem; vertical-align: middle; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); }
.tag { font-size: .7rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 .4rem; color: var(--mut); white-space: nowrap; }
.tag.ok { border-color: var(--ok); color: var(--ok); }
.history { margin: 1.2rem 0; } .hist { display: block; padding: .2rem 0; }
.form label { display: flex; flex-direction: column; margin-bottom: .8rem; font-size: .9rem; }
.gcard { border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; margin: .6rem 0; }
.gmeta { font-size: .8rem; color: var(--mut); margin-bottom: .4rem; }
li.right { color: var(--ok); font-weight: 700; } li.wrong { color: var(--bad); text-decoration: line-through; }
.why { font-weight: 400; color: var(--mut); font-size: .8rem; }
table.data { border-collapse: collapse; margin: .5rem 0; } table.data th, table.data td { border: 1px solid #999; padding: .25rem .9rem; text-align: center; }

/* ---------- Bluebook-style test ---------- */
.bb { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.bb-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .4rem 1.2rem; border-bottom: 2px dashed #9aa4b5; background: #fff; }
.bb-title b { display: block; font-size: 1.05rem; } .link { border: 0; background: none; padding: 0; font-size: .85rem; }
.bb-timer { text-align: center; } #clock { font-size: 1.25rem; font-weight: 700; display: block; min-height: 1.5rem; } #clock.low { color: var(--bad); }
.pill { border: 1px solid var(--ink); background: #fff; border-radius: 999px; padding: 0 .7rem; font-size: .75rem; }
.bb-tools { display: flex; justify-content: flex-end; gap: .2rem; }
.tool { border: 0; background: none; display: flex; flex-direction: column; align-items: center; font-size: .72rem; padding: .2rem .5rem; border-radius: 6px; }
.tool span { font-size: 1.2rem; line-height: 1.2; } .tool:hover { background: var(--bg); }
.bb-main { flex: 1; display: grid; grid-template-columns: 1fr; overflow: hidden; }
.bb-main.with-sp { grid-template-columns: minmax(300px, 1fr) 6px minmax(340px, 1fr); }
.bb-main.with-sp::before { content: ""; grid-column: 2; grid-row: 1; background: #e3e6ec; }
.bb-left { grid-column: 1; grid-row: 1; overflow: auto; padding: 1rem; display: flex; flex-direction: column; gap: .8rem; }
.bb-main:not(.with-sp) .bb-left { display: none; }
.bb-right { grid-column: 3; grid-row: 1; overflow: auto; padding: 1.2rem 2rem; max-width: 760px; }
.bb-main:not(.with-sp) .bb-right { grid-column: 1; margin: 0 auto; width: 100%; }
.qhead { display: flex; align-items: center; gap: .8rem; background: #eef0f4; border-bottom: 2px dashed #9aa4b5; padding: .2rem .5rem .2rem 0; margin-bottom: 1rem; }
.qnum { background: #000; color: #fff; font-weight: 700; padding: .15rem .6rem; }
.flag { border: 0; background: none; font-size: .9rem; } .flag.on { color: #c0392b; font-weight: 700; }
.abc { margin-left: auto; border: 1px solid var(--ink); background: #fff; border-radius: 4px; font-size: .75rem; padding: 0 .4rem; }
.abc.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.stem { font-size: 1.05rem; margin-bottom: 1rem; }
.choices { display: flex; flex-direction: column; gap: .6rem; }
.choice-row { display: flex; gap: .5rem; align-items: center; }
.choice { flex: 1; display: flex; align-items: center; gap: .9rem; text-align: left; border: 1px solid #1b2b48; border-radius: 8px; background: #fff; padding: .55rem .8rem; min-height: 3rem; }
.choice:hover { border-color: var(--blue); }
.choice.sel { border: 3px solid var(--blue); padding: calc(.55rem - 2px) calc(.8rem - 2px); }
.letter { width: 1.7rem; height: 1.7rem; border: 1.5px solid var(--ink); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex: none; }
.choice.sel .letter { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice-row.elim .choice { opacity: .45; } .choice-row.elim .ctext, .choice-row.elim .letter { text-decoration: line-through; }
.x { border: 1px solid var(--ink); border-radius: 50%; width: 1.8rem; height: 1.8rem; background: #fff; font-size: .75rem; text-decoration: line-through; padding: 0; }
.choice-row.elim .x { text-decoration: underline; border-radius: 4px; width: auto; padding: 0 .3rem; border: 0; }
.spr input { font-size: 1.3rem; width: 9rem; border: 1px solid var(--ink); border-radius: 6px; } .preview { margin: .5rem 0; }
.conf { margin-top: 1.4rem; display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .85rem; }
.conf span { color: var(--mut); margin-right: .2rem; }
.conf button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: .2rem .8rem; }
.conf button.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.conf button[data-conf=educated].on { background: #6b4fb3; border-color: #6b4fb3; } .conf button[data-conf=weak].on { background: #8a94a6; border-color: #8a94a6; }
.bb-bot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .5rem 1.2rem; border-top: 2px dashed #9aa4b5; background: #fff; }
.bb-bot > span:last-child { text-align: right; } .bb-bot .who { font-weight: 600; }
.navbtn { background: #000; color: #fff; border: 0; border-radius: 6px; padding: .35rem .9rem; font-weight: 600; }
.navpop { position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 4.2rem; background: rgba(0,0,0,.05); z-index: 20; }
.navpop-in { background: #fff; border-radius: 10px; box-shadow: 0 6px 30px rgba(0,0,0,.25); padding: 1rem 1.4rem; max-width: 560px; width: 92%; text-align: center; }
.navpop-in.static { box-shadow: none; border: 1px solid var(--line); margin: 1rem auto; }
.legend { display: flex; gap: 1rem; justify-content: center; font-size: .8rem; margin: .6rem 0; border-bottom: 1px solid var(--line); padding-bottom: .6rem; }
.legend i { display: inline-block; width: .9rem; height: .9rem; margin-right: .3rem; vertical-align: middle; font-style: normal; color: #c0392b; }
.legend i.cur::before { content: "📍"; font-size: .7rem; } .legend i.un { border: 1px dashed var(--ink); }
.grid { display: flex; flex-wrap: wrap; gap: .45rem; justify-content: center; margin: .6rem 0 1rem; }
.grid button { position: relative; width: 2.3rem; height: 2.3rem; border: 1px solid var(--blue); background: var(--blue); color: #fff; font-weight: 700; border-radius: 4px; }
.grid button.un { background: #fff; color: var(--blue); border: 1px dashed var(--ink); }
.grid button.cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.grid button i { position: absolute; top: -.6rem; right: -.4rem; color: #c0392b; font-style: normal; font-size: .85rem; }
.revpage { flex: 1; overflow: auto; text-align: center; padding: 2rem; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 30; }
.modal-in { background: #fff; border-radius: 10px; padding: 1.2rem 1.6rem; max-width: 640px; width: 92%; max-height: 85vh; overflow: auto; }
.refgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1rem; font-size: .95rem; }
#calcpanel { position: fixed; top: 70px; right: 20px; width: min(560px, 92vw); height: 70vh; background: #fff; border: 1px solid #888; border-radius: 8px; box-shadow: 0 6px 30px rgba(0,0,0,.25); z-index: 15; display: flex; flex-direction: column; }
.calchead { display: flex; justify-content: space-between; align-items: center; padding: .3rem .6rem; background: #000; color: #fff; cursor: move; border-radius: 8px 8px 0 0; touch-action: none; }
.calchead a { color: #cfd8ff; font-size: .8rem; } .calchead button { background: none; border: 0; color: #fff; }
#calcpanel iframe { flex: 1; border: 0; width: 100%; }

/* scratch pad */
.sp-host { flex: 1; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; min-height: 260px; background: #fff; }
.sp-bar { display: flex; align-items: center; gap: .5rem; padding: .3rem .5rem; border-bottom: 1px solid var(--line); font-size: .85rem; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: .15rem .7rem; } .seg button.on { background: var(--ink); color: #fff; }
.sp-tools button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: .1rem .5rem; } .sp-tools button.on { background: var(--blue2); border-color: var(--blue); }
.sp-count { margin-left: auto; color: var(--mut); font-weight: 600; } .sp-count.full { color: var(--ok); }
.sp-body { flex: 1; position: relative; min-height: 220px; }
.sp-canvas { position: absolute; inset: 0; } .sp-canvas[hidden] { display: none; }
.sp-text { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0 0 10px 10px; resize: none; font: 1.05rem/40px ui-monospace, Menlo, monospace; padding: 0 .8rem; background: repeating-linear-gradient(#fff 0 39px, #e8edf3 39px 40px); }

/* results */
.rlist { display: flex; flex-direction: column; gap: .4rem; }
.ritem { border: 1px solid var(--line); border-radius: 8px; } .ritem summary { display: grid; grid-template-columns: 2rem 1.5rem 1fr auto auto 3rem; gap: .5rem; align-items: center; padding: .4rem .7rem; cursor: pointer; font-size: .9rem; }
.ritem.ok .mark { color: var(--ok); } .ritem.no .mark { color: var(--bad); font-weight: 700; }
.ritem.confERR { border-color: var(--bad); background: #fff7f6; } .ritem .cf { color: var(--mut); } .ritem.confERR .cf { color: var(--bad); font-weight: 700; }
.rbody { padding: .4rem 1rem 1rem; border-top: 1px solid var(--line); }
.expl, .steps { background: var(--bg); border-radius: 8px; padding: .6rem .8rem; margin: .6rem 0; font-size: .95rem; }
.fix { width: 4rem; padding: .1rem .3rem; } pre.typed { background: #fbfbfd; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; }
canvas.ink { border: 1px solid var(--line); border-radius: 8px; max-width: 100%; }

@media (max-width: 820px) {
  .bb-main.with-sp { grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  .bb-main.with-sp::before { display: none; }
  .bb-right { grid-column: 1; grid-row: 1; padding: 1rem; } .bb-left { grid-column: 1; grid-row: 2; min-height: 340px; }
  .bb-top { grid-template-columns: 1fr auto; } .bb-tools { grid-column: 1 / -1; justify-content: flex-start; }
  .tool { font-size: .65rem; }
}

.nomath { white-space: nowrap; }

fieldset.dom { border: 1px solid var(--line); border-radius: 10px; margin: .5rem 0; padding: .4rem .9rem .6rem; }
fieldset.dom legend { padding: 0 .3rem; } label.sk { display: block; padding: .15rem 0; } label.chip { border: 1px solid var(--line); border-radius: 999px; padding: .2rem .8rem; margin-right: .3rem; }
.bad { color: var(--bad); }

/* settings sections */
.setsec { border: 1px solid var(--line); border-radius: 12px; padding: .6rem 1rem .8rem; margin: 1rem 0; }
.setsec h3 { margin: .2rem 0 .5rem; }

/* ---------- dark mode ---------- */
[data-theme=dark] { --ink:#e4e8f0; --mut:#9aa4b5; --line:#343b48; --blue:#7b93ff; --blue2:#25304f; --ok:#4cc38a; --bad:#ff7a70; --warn:#f0b04a; --bg:#1c2129; --card:#161a20; color-scheme: dark; }
[data-theme=dark] body, [data-theme=dark] html { background: #111418; color: var(--ink); }
[data-theme=dark] .btn, [data-theme=dark] .card, [data-theme=dark] .choice, [data-theme=dark] .x, [data-theme=dark] .pill, [data-theme=dark] .abc,
[data-theme=dark] .conf button, [data-theme=dark] .seg button, [data-theme=dark] .sp-tools button, [data-theme=dark] input, [data-theme=dark] textarea,
[data-theme=dark] .bb-top, [data-theme=dark] .bb-bot, [data-theme=dark] .modal-in, [data-theme=dark] .navpop-in, [data-theme=dark] #calcpanel { background: var(--card); color: var(--ink); }
[data-theme=dark] .btn { border-color: var(--ink); } [data-theme=dark] .btn.primary { background: var(--blue); border-color: var(--blue); color: #0b0f18; }
[data-theme=dark] .btn.danger { border-color: var(--bad); color: var(--bad); }
[data-theme=dark] .choice { border-color: #8a94a6; } [data-theme=dark] .letter { border-color: var(--ink); }
[data-theme=dark] .choice.sel .letter { color: #0b0f18; }
[data-theme=dark] .qhead { background: #222833; } [data-theme=dark] .qnum { background: var(--ink); color: #111418; }
[data-theme=dark] .navbtn { background: var(--ink); color: #111418; }
[data-theme=dark] .grid button { color: #0b0f18; } [data-theme=dark] .grid button.un { background: var(--card); color: var(--blue); border-color: var(--ink); }
[data-theme=dark] .conf button.on { background: var(--ink); color: #111418; border-color: var(--ink); }
[data-theme=dark] .seg button.on { background: var(--ink); color: #111418; }
[data-theme=dark] .bar { background: #2a313d; }
[data-theme=dark] .ritem.confERR { background: #2a1716; }
[data-theme=dark] pre.typed { background: var(--card); }
[data-theme=dark] .bb-main.with-sp::before { background: #2a313d; }
[data-theme=dark] table.data th, [data-theme=dark] table.data td { border-color: #6b7486; }
/* scratch pad and figures stay on white paper so ink and black-line SVGs stay visible */
[data-theme=dark] .sp-host { background: #fff; color: #1b2b48; border-color: #6b7486; }
[data-theme=dark] .sp-bar { color: #1b2b48; } [data-theme=dark] .sp-bar button, [data-theme=dark] .sp-text { background: #fff; color: #1b2b48; }
[data-theme=dark] .sp-bar .seg button.on { background: #1b2b48; color: #fff; }
[data-theme=dark] .passage svg, [data-theme=dark] .stem svg, [data-theme=dark] .rbody svg, [data-theme=dark] .gcard svg { background: #fff; border-radius: 6px; }
[data-theme=dark] canvas.ink { background: #fff; }
[data-theme=dark] .choice.sel { border-color: var(--blue); } [data-theme=dark] .choice:hover { border-color: var(--blue); }
