/* The front page: what the site is, one live question, and the way in. */
:root {
    --ink: #111; --muted: #555; --faint: #888; --rule: #e3e3e3;
    --ground: #f4f4f1; --panel: #fff; --accent: #2563EB; --accent-soft: #e8eefc;
    --ui: system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font: 16px/1.5 Georgia, "Times New Roman", serif;
    color: var(--ink); background: var(--ground);
}
a { color: var(--accent); }

.top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--rule);
}
.brand {
    font: 600 12px/1.6 var(--ui); letter-spacing: 0.09em; text-transform: uppercase;
    color: var(--muted);
}
/* the product under the umbrella brand: a plain label until it has a name */
.brand .product { color: var(--ink); }
.beta {
    display: inline-block; vertical-align: 1px; margin-left: 6px; padding: 0 7px;
    font: 600 10.5px/1.6 var(--ui); letter-spacing: 0.06em;
    color: var(--accent); background: var(--accent-soft); border-radius: 999px;
}
.top-links { display: flex; gap: 18px; align-items: center; }
.top-links a { font: 500 14px var(--ui); text-decoration: none; white-space: nowrap; }
.brand .product, .brand .beta { white-space: nowrap; }
.open-tool { font: 500 14px var(--ui); text-decoration: none; }

main { max-width: 900px; margin: 0 auto; padding: 0 16px; }

.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(24px, 4.2vw, 34px); line-height: 1.2; max-width: 30ch; }
.lede { margin-top: 12px; font-size: 17px; color: #333; max-width: 60ch; }

/* the live card */
.card {
    background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-head {
    position: sticky; top: 0; z-index: 2; background: var(--panel);
    border-radius: 10px 10px 0 0;
}
.card-bar {
    display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
    justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--rule);
}
.tabs { display: flex; gap: 4px; }
.tabs button, .chips button, #next {
    font: 500 14px var(--ui); border-radius: 6px; cursor: pointer;
}
.tabs button {
    padding: 6px 10px; border: 1px solid transparent; background: none; color: var(--muted);
}
.tabs button[aria-selected="true"] {
    color: var(--ink); background: var(--ground); border-color: var(--rule);
}
.student { display: flex; gap: 10px; align-items: center; font: 14px var(--ui); color: var(--muted); }
.student b { color: var(--ink); font-variant-numeric: tabular-nums; }
#next {
    padding: 7px 14px; border: 0; color: #fff; background: var(--accent);
}
#next:hover { background: #1d4ed8; }

.chips {
    display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto;
    border-bottom: 1px solid var(--rule);
}
.chips button {
    flex: none; padding: 4px 10px; border: 1px solid var(--rule); background: var(--panel);
}
.chips button[aria-pressed="true"] { color: #fff; background: var(--ink); border-color: var(--ink); }

.question { padding: 8px 18px 14px; min-height: 260px; transition: opacity .15s; }
.question.loading { opacity: .45; }
.question.fresh { animation: fresh 1.1s ease-out; }
@keyframes fresh { from { background: #fff8d6; } to { background: transparent; } }
.question .error { padding: 20px 0; color: var(--muted); font-family: var(--ui); }

.stem { padding: 10px 0 6px; }
.part {
    display: grid; grid-template-columns: 3.2em 1fr auto; gap: 0 8px;
    padding: 10px 0; border-top: 1px solid #f0f0ee;
}
.stem + .part { border-top: 0; }
.part .body { min-width: 0; }
.num { font: 600 14px/1.9 var(--ui); color: var(--muted); }
.marks { font: 13px/1.9 var(--ui); color: var(--faint); }
.eq { margin: 6px 0; overflow-x: auto; overflow-y: hidden; }
.graph { margin: 8px 0; }
.graph svg { max-width: 100%; height: auto; display: block; }
.memo { margin-top: 6px; color: var(--accent); overflow-x: auto; overflow-y: hidden; }
.memo-tag {
    display: inline-block; margin-right: 8px; padding: 0 6px; vertical-align: 2px;
    font: 600 10.5px/1.7 var(--ui); letter-spacing: .06em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft); border-radius: 4px;
}
.memo details { margin-top: 4px; color: var(--ink); }
.memo summary { font: 13px var(--ui); color: var(--muted); cursor: pointer; width: max-content; }
.memo details > div { padding: 2px 0 2px 12px; border-left: 2px solid var(--accent-soft); }

.card-foot {
    display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 14px;
    border-top: 1px solid var(--rule); font: 14px var(--ui);
}

.why {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; padding: 36px 0 12px;
}
.why h2 { font-size: 18px; line-height: 1.3; margin-bottom: 6px; }
.why p { color: #333; font-size: 15.5px; }

.cta { padding: 20px 0 32px; }
.cta .primary {
    display: inline-block; padding: 11px 22px; border-radius: 8px;
    font: 600 16px var(--ui); color: #fff; background: var(--accent); text-decoration: none;
}
.cta p { margin-top: 10px; color: var(--muted); font-size: 15px; }

.news { padding: 8px 0 40px; max-width: 680px; }
.news h2 { font-size: 20px; margin-bottom: 8px; }
.news ul { list-style: none; }
.news li { padding: 8px 0; border-top: 1px solid var(--rule); font-size: 15.5px; color: #333; }
.news time {
    display: block; font: 600 12px/1.6 var(--ui); letter-spacing: .04em; color: var(--faint);
}
.news b { font-family: var(--ui); font-weight: 600; font-size: .94em; color: var(--ink); }
.news p { margin-top: 6px; font-size: 14.5px; color: var(--muted); }

footer {
    padding: 18px 16px 28px; border-top: 1px solid var(--rule); background: var(--panel);
    font: 13.5px/1.6 var(--ui); color: var(--muted); text-align: center;
}
.disclaimer { font-size: 12px; color: var(--faint); }

/* the how-to page, on the same ground as the front page */
.home-link { text-decoration: none; }
.help { max-width: 760px; }
.help .toc {
    display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 16px; font: 14px var(--ui);
}
.help > section:not(.hero) {
    margin-bottom: 16px; padding: 20px 22px; background: var(--panel);
    border: 1px solid var(--rule); border-radius: 10px; scroll-margin-top: 12px;
}
.help h2 { font-size: 22px; line-height: 1.3; margin-bottom: 8px; }
.help h3 { font: 600 15px var(--ui); margin: 18px 0 6px; }
.help p, .help li { font-size: 16px; color: #222; }
.help p + p, .help p + ul, .help p + ol { margin-top: 8px; }
.help ol, .help ul { padding-left: 1.4em; }
.help li { margin: 6px 0; }
.help b { font-family: var(--ui); font-weight: 600; font-size: .93em; }
.help + footer { margin-top: 24px; }

@media (max-width: 680px) {
    /* the brand on one line, the links under it, rather than both broken mid-phrase */
    .top { flex-wrap: wrap; gap: 6px 16px; }
    .help > section:not(.hero) { padding: 16px 14px; }
    .hero { padding: 24px 0 16px; }
    .why { grid-template-columns: 1fr; gap: 14px; padding-top: 28px; }
    .question { padding: 6px 12px 12px; }
    .part { grid-template-columns: 2.8em 1fr auto; }
    .student { width: 100%; justify-content: space-between; }
}
