:root {
  --ink: #1b1f24;
  --muted: #5d6570;
  --line: #d9dde3;
  --blue: #2f4bd0;
  --blue-soft: #e9edfc;
  --green: #1f7a4d;
  --red: #b3261e;
  --amber: #b86e00;
  --serif: Georgia, 'Times New Roman', serif;
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: #fff; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; border-radius: 999px; border: 1px solid var(--line); background: #fff; padding: .45rem 1.1rem; color: var(--ink); }
/* The site is an app, not a page to copy from: a click or double click doesn't
   highlight anything, show a text cursor or leave a caret, even with the browser's
   caret browsing (F7) on. Reading text and text boxes are the exception. An open
   dialog starts out selectable again, so it's named too. */
body, dialog { -webkit-user-select: none; user-select: none; cursor: default; caret-color: transparent; }
.passage, .stem, .feedback, .explained, .typed, .card, .myword, .chat, .chances { -webkit-user-select: text; user-select: text; cursor: auto; }
input, textarea { -webkit-user-select: text; user-select: text; caret-color: auto; }
/* controls stay unselectable inside reading text too, and on a phone a tap doesn't
   flash grey, two quick taps don't zoom and a long press doesn't pop up a menu */
a, button, .button, summary, label, select { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; -webkit-touch-callout: none; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
button.outline { border-color: var(--blue); color: var(--blue); }
button.ghost { border: 0; background: none; padding: .2rem .5rem; }
button.big { padding: .75rem 2rem; font-size: 1.05rem; }
h1 { font-size: 1.8rem; margin: .3rem 0 .5rem; }
h2 { font-size: 1.1rem; }

.page { max-width: 860px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.brand { font-weight: 700; color: var(--ink); letter-spacing: .02em; }
.brand::before { content: ''; display: inline-block; width: 1.3em; height: 1.3em; margin-right: .45em; vertical-align: -.3em; background: url(/logo.svg) center / contain no-repeat; }
.nav { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.nav a { color: var(--blue); text-decoration: none; font-weight: 600; }
.nav a:hover { text-decoration: underline; }
.nav .brand { margin-right: auto; }
.lede { color: var(--muted); margin-top: 0; }

.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; border: 0; padding: 0; margin: 1.5rem 0 0; }
.modes legend, .pick legend { padding: 0; margin-bottom: .5rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.mode { position: relative; display: grid; gap: .2rem; border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; cursor: pointer; }
.mode input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.mode small { color: var(--muted); line-height: 1.35; }
.mode:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.mode:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.pick { display: none; border: 0; padding: 0; margin: 1.25rem 0 0; }
.pick .hint { color: var(--muted); font-size: .9rem; margin: .5rem 0 0; }
.only, .inpool { display: none; align-items: center; gap: .35rem; font-size: .9rem; cursor: pointer; }
#build[data-mode=endless] .pick { display: block; }
#build[data-mode=endless] .skill .count { display: none; }
#build[data-mode=endless][data-pick=one] .only,
#build[data-mode=endless][data-pick=pool] .inpool { display: inline-flex; }
.setall { display: flex; gap: .4rem; align-items: center; margin: 1.5rem 0 .5rem; color: var(--muted); font-size: .9rem; }
.chip { padding: .2rem .8rem; font-size: .85rem; }
.domain { margin-top: 1.5rem; }
.domain h2 { margin-bottom: .4rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.skill { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 1rem; border: 0; border-top: 1px solid var(--line); margin: 0; padding: .7rem 0; }
.skill legend { float: left; font-weight: 600; padding: 0; }
.skill .count { color: var(--muted); font-size: .85rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: .3rem .85rem; font-size: .9rem; }
.seg input:checked + span { background: var(--blue); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: -3px; }
.error { color: var(--red); min-height: 1.5em; }

.startbar { display: flex; align-items: center; gap: 1rem; margin: 1.25rem 0 1.5rem; }
.loading .elapsed { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: .4rem 1.5rem; }
.progress li { display: grid; grid-template-columns: 1fr auto 6.5rem; gap: .75rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.progress .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress .stage { justify-self: end; color: var(--muted); }
.progress .stage::before { content: ''; display: inline-block; width: .5rem; height: .5rem; margin-right: .4rem; border-radius: 50%; background: var(--line); vertical-align: middle; }
.progress .writing .stage, .progress .checking .stage { color: var(--blue); }
.progress .writing .stage::before, .progress .checking .stage::before { background: var(--blue); animation: pulse 1.2s ease-in-out infinite; }
.progress .rewriting .stage { color: var(--amber); }
.progress .rewriting .stage::before { background: var(--amber); animation: pulse 1.2s ease-in-out infinite; }
.progress .ready .stage { color: var(--blue); font-weight: 600; }
.progress .ready .stage::before { background: var(--blue); }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .progress .stage::before { animation: none !important; } }
.warmup { border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.25rem 1.25rem; }
.warmup h2 { margin-top: 0; display: flex; gap: .75rem; align-items: baseline; }
.warmup .tag { color: var(--muted); font-weight: 400; font-size: .85rem; }
.warmup .choices { margin-bottom: 1rem; }
.warmup .feedback { margin: 0 0 1rem; }

.exam { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; }
.top, .bottom { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: .6rem 1.25rem; background: #f4f6f9; }
.top { border-bottom: 2px dashed var(--line); font-weight: 600; }
.bottom { border-top: 2px dashed var(--line); }
.clock { display: flex; flex-direction: column; align-items: center; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.clock button { font-size: .75rem; font-weight: 400; border: 1px solid var(--line); }
.tally { font-weight: 600; font-variant-numeric: tabular-nums; }
.end { display: flex; justify-content: flex-end; gap: .5rem; }
.qcount { font-weight: 600; }
.step { display: flex; gap: .5rem; justify-content: flex-end; }
.navbtn { background: var(--ink); color: #fff; border-color: var(--ink); }

.split { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.split > section { overflow: auto; padding: 2rem 2.25rem; }
.split .passage { border-right: 3px solid var(--line); }
.passage { font-family: var(--serif); font-size: 1.05rem; line-height: 1.65; white-space: pre-line; }
.qhead { display: flex; align-items: center; gap: 1rem; background: #f4f6f9; border-bottom: 2px dashed var(--line); margin: -.5rem 0 1rem; }
.qnum { background: var(--ink); color: #fff; padding: .3rem .75rem; font-weight: 700; }
.flag { border: 0; background: none; padding: 0; }
.flag::before { content: '⚑ '; color: var(--muted); }
.flag[aria-pressed=true]::before { color: var(--red); }
.stem { font-family: var(--serif); font-size: 1.05rem; }
.choices { display: grid; gap: .7rem; }
.choice { position: relative; display: flex; gap: .8rem; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem; cursor: pointer; font-family: var(--serif); }
.choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.choice .letter, .explained .letter { flex: none; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border: 1.5px solid var(--ink); border-radius: 50%; font: 600 .85rem system-ui, sans-serif; }
.choice:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue); }
.choice:has(input:checked) .letter { background: var(--blue); border-color: var(--blue); color: #fff; }
.choice:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

.choice:has(input:disabled), .choice input:disabled { cursor: default; }
.choices .choice.key { border-color: var(--green); box-shadow: 0 0 0 2px var(--green); background: #e8f5ee; }
.choices .choice.key .letter { background: var(--green); border-color: var(--green); color: #fff; }
.choices .choice.miss { border-color: var(--red); box-shadow: 0 0 0 2px var(--red); background: #fbeceb; }
.choices .choice.miss .letter { background: var(--red); border-color: var(--red); color: #fff; }
.feedback { margin-top: 1rem; border-radius: 10px; padding: .8rem 1rem; font-size: .95rem; }
.feedback p { margin: 0; }
.feedback p + p { margin-top: .5rem; }
.feedback.ok { background: #e8f5ee; }
.feedback.bad { background: #fbeceb; }
.waiting { grid-column: 1 / -1; display: grid; place-content: center; justify-items: center; gap: .5rem; color: var(--muted); }

/* Math: one column, a figure above the question, and a field for typed answers */
.solo { display: grid; overflow: auto; }
.solo > .question { width: 100%; max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem; }
[data-section=math] .stem { white-space: pre-line; }
.fig { margin: 0 0 1.25rem; }
.passage .fig { white-space: normal; }
.fig svg { display: block; max-width: 100%; height: auto; margin: 0 auto; font: 13px system-ui, -apple-system, 'Segoe UI', sans-serif; }
.fig text { fill: var(--ink); }
.fig .var { font: italic 16px var(--serif); }
.fig .grid { stroke: #e3e6ea; }
.fig .axis { stroke: var(--ink); stroke-width: 1.2; }
.fig .curve { fill: none; stroke: var(--ink); stroke-width: 2; }
.fig .curve.thin { stroke-width: 1.4; }
.fig .dashed { stroke-dasharray: 6 5; }
.fig .shade { fill: var(--blue); fill-opacity: .15; stroke: none; }
.fig .dot, .fig .pt, .fig marker path { fill: var(--ink); }
.fig .pt.open { fill: #fff; stroke: var(--ink); stroke-width: 1.5; }
.fig .mark { fill: none; stroke: var(--ink); stroke-width: 1.3; }
.fig .bar { stroke: var(--ink); stroke-width: .8; }
.fig .bar.s0 { fill: #6b7480; }
.fig .bar.s1 { fill: #d3d7dd; }
.fig figcaption { text-align: center; color: var(--muted); font-size: .88rem; margin-top: .4rem; }
.ftable { width: auto; margin: 0 auto; }
.ftable th, .ftable td { border: 1px solid var(--ink); padding: .35rem 1rem; text-align: center; text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--ink); }
.ftable th { background: #f4f6f9; }
.entry { display: grid; gap: .5rem; }
.entry label { display: flex; align-items: center; gap: .75rem; font-weight: 600; }
.entry input { width: 8rem; padding: .5rem .7rem; border: 1.5px solid var(--ink); border-radius: 6px; font: 1.2rem var(--serif); }
.entry input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.entry .preview { min-height: 1.6em; }
.entry .hint { margin: 0; color: var(--muted); font-size: .88rem; }
.formulas { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 1rem 0; }
.formulas dt { font-weight: 600; }
.formulas dd { margin: 0; }
.result .typed p { margin: .6rem 0 0; }

dialog { border: 0; border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); padding: 1.25rem 1.5rem; max-width: 520px; }
dialog::backdrop { background: rgba(0, 0, 0, .25); }
.dhead { display: flex; justify-content: space-between; align-items: center; }
.dhead h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, 2.6rem); gap: .6rem; margin: 1rem 0 1.25rem; }
.cell { width: 2.6rem; height: 2.6rem; padding: 0; border-radius: 6px; border: 1.5px dashed var(--muted); color: var(--blue); font-weight: 600; position: relative; }
.cell.answered { border: 1.5px solid var(--blue); background: var(--blue); color: #fff; }
.cell.current { outline: 2px solid var(--ink); outline-offset: 2px; }
.cell.pending { border-style: dotted; color: var(--muted); opacity: .6; }
.cell.marked::after { content: '⚑'; position: absolute; top: -.7rem; right: -.4rem; color: var(--red); font-size: .9rem; }
.review { overflow: auto; }
.summary { font-weight: 600; }

.score { font-size: 2.2rem; font-weight: 700; margin: .2rem 0 1rem; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.actions { display: flex; gap: .6rem; margin: 1.5rem 0 2rem; }
.result { border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; padding: .6rem 1rem; }
.result summary { display: flex; gap: 1rem; align-items: center; cursor: pointer; font-weight: 600; }
.result .tag { color: var(--muted); font-weight: 400; font-size: .9rem; flex: 1; }
.result .ok { color: var(--green); }
.result .bad { color: var(--red); }
.result .omit { color: var(--amber); }
.result .passage { background: #f8f9fb; border-radius: 8px; padding: 1rem; margin-top: .8rem; }
.explained { list-style: none; padding: 0; display: grid; gap: .6rem; }
.explained li { display: flex; gap: .8rem; padding: .6rem .8rem; border-radius: 8px; }
.explained li p { margin: 0; }
.explained li.key { background: #e8f5ee; }
.explained li.picked:not(.key) { background: #fbeceb; }
.explained .why { color: var(--muted); font-size: .92rem; margin-top: .25rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1.5rem 0 0; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .85rem; }
.stat strong { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
.bytype td + td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bytype small { color: var(--muted); }
.bytype tfoot td { font-weight: 600; border-bottom: 0; }
.stat strong small { font-size: .9rem; font-weight: 400; color: var(--muted); }
.stat .delta { display: block; margin-top: .15rem; font-size: .8rem; }
.stat .delta.up { color: var(--green); }
.stat .delta.down { color: var(--red); }

.button { display: inline-block; border: 1px solid var(--blue); border-radius: 999px; padding: .45rem 1.1rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.button.primary { background: var(--blue); color: #fff; }
.button.outline { background: #fff; color: var(--blue); }
.kicker { display: block; margin: 0; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); }
.statcard { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; margin: 1.25rem 0 0; padding: .9rem 1rem .9rem 1.25rem; border-radius: 12px; background: var(--blue-soft); color: var(--ink); text-decoration: none; }
.statcard strong { font-size: 1.1rem; }
a.statcard:hover .button { background: #2440b8; }
.focus { background: var(--blue-soft); border-radius: 12px; padding: 1rem 1.25rem 1.1rem; margin: 1.25rem 0 0; }
.focus h2 { font-size: 1.5rem; margin: .1rem 0 0; }
.focus p { margin: .5rem 0 0; }
.focus .hint, .chart .hint { color: var(--muted); font-size: .92rem; }

.chart { margin: 2rem 0 0; }
.chart h2 { margin: 0; }
.chart .hint { margin: .25rem 0 .75rem; }
.bar { display: grid; grid-template-columns: clamp(8.5rem, 32%, 15rem) 1fr; gap: .75rem; align-items: center; margin: 0 -.4rem; padding: .35rem .4rem; border-radius: 6px; }
.bar:hover { background: #f4f6f9; }
.bar:focus-visible, .trend:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.bar .name { font-size: .92rem; line-height: 1.3; }
.bar .name small { display: block; color: var(--muted); font-size: .8rem; }
.plot { position: relative; height: 14px; margin-right: 2.25rem; }
.track, .fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.track { background: #eef0f3; }
.fill { background: #8a939e; }
.bar.worst .track { background: var(--blue-soft); }
.bar.worst .fill { background: var(--blue); }
.untried { margin-top: .75rem; }
.untried .fill { background: #c3c8cf; }
.val { position: absolute; top: 50%; transform: translate(.4rem, -50%); font-size: .85rem; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; margin: .5rem 0; color: var(--muted); font-size: .85rem; }
.legend .key { display: inline-block; vertical-align: middle; margin-right: .4rem; }
.legend .key.line { width: 16px; height: 2px; background: var(--blue); }
.legend .key.dot { width: 8px; height: 8px; border-radius: 50%; background: #8a939e; }
.trend { border-radius: 6px; }
.trend svg { display: block; overflow: visible; }
.trend .grid { stroke: #e6e8ec; }
.trend .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.trend .cross { stroke: var(--muted); }
.trend .proj { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.trend .dot, .trend .end { stroke: #fff; stroke-width: 2; }
.trend .dot { fill: #8a939e; }
.trend .end { fill: var(--blue); }
.tip { position: fixed; z-index: 10; pointer-events: none; max-width: 18rem; padding: .45rem .65rem; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); font-size: .85rem; line-height: 1.35; }
.tip strong { font-size: 1rem; }
.how { margin: 2rem 0 0; color: var(--muted); font-size: .92rem; }
.how summary { cursor: pointer; color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; overflow: auto; }
  .split > section { overflow: visible; padding: 1.25rem; }
  .split .passage { border-right: 0; border-bottom: 3px solid var(--line); }
  .skill { grid-template-columns: 1fr; gap: .4rem; }
  .skill .seg { justify-self: start; }
  .modes { grid-template-columns: 1fr; }
  .top { grid-template-columns: 1fr auto auto; gap: .5rem; }
  .bottom { grid-template-columns: auto 1fr; padding: .6rem .75rem; }
  .top > div:last-child:empty, .bottom > div:first-child { display: none; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .focus .button + .hint { display: block; margin-top: .5rem; }
}
.tabs { display: inline-flex; margin: .25rem 0 1rem; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.tabs a { padding: .3rem .95rem; font-size: .9rem; color: var(--ink); text-decoration: none; }
.tabs a[aria-current] { background: var(--blue); color: #fff; }
.nobr { white-space: nowrap; }
.fig text { paint-order: stroke; stroke: #fff; stroke-width: 3px; stroke-linejoin: round; }
.fig .bar.s2 { fill: #fff; }
.fig .l1 { stroke-dasharray: 7 4; }
.fig .l2 { stroke: #8a939e; }
.fig .l3 { stroke: #8a939e; stroke-dasharray: 2 3; }
.fig .dot.l2, .fig .dot.l3 { fill: #8a939e; stroke: none; }
/* the page you're on, in the nav, reads as where you are rather than a link */
.nav a[aria-current] { color: var(--ink); }
/* five links and the brand don't fit a phone on one line */
.nav { flex-wrap: wrap; row-gap: .3rem; }
@media (max-width: 560px) {
  .nav { column-gap: .85rem; font-size: .92rem; }
  .nav .brand { flex-basis: 100%; }
}
