:root {
  --bg: #e9f1f7;
  --surface: #ffffff;
  --surface-soft: #f4f8fc;
  --sidebar: #2b3a4a;
  --sidebar-line: #3d4e60;
  --line: #dce6f0;
  --line-strong: #b7cce3;
  --ink: #1c2733;
  --ink-soft: #566878;
  --ink-muted: #8698a8;
  --accent: #5d7896;
  --accent-dark: #46607a;
  --accent-soft: #e4edf6;
  --ivory: #f6f3ec;
  --highlight: #fbe7a2;
  --radius: 12px;
  --sans: "Plus Jakarta Sans", system-ui, sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

/* display rules below would otherwise win against the hidden attribute */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--ink-muted); font-size: 13px; }

/* a fixed frame: the conversation and each page scroll inside it, so the question box stays put */
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100vh;
}

/* sidebar */
.sidebar {
  background: var(--sidebar);
  color: #dce6f0;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent);
  border-radius: 9px;
  font-weight: 600; color: #fff;
}
.brand strong { display: block; font-size: 15px; color: #fff; }
.brand small { display: block; margin-top: 2px; font-size: 11px; line-height: 1.35; color: #9fb3c6; text-wrap: balance; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  text-align: left;
  background: none; border: 0;
  color: #c3d3e2;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 14px;
}
.nav-item:hover { background: var(--sidebar-line); color: #fff; }
.nav-item.is-active { background: var(--accent); color: #fff; font-weight: 500; }

.side-block { display: flex; flex-direction: column; gap: 9px; }
.side-recent { flex: 1; min-height: 0; overflow-y: auto; }
.side-label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ba1b6;
}

.subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.subject {
  background: none;
  border: 1px solid var(--sidebar-line);
  color: #c3d3e2;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
}
.subject:hover { border-color: #6f8aa3; color: #fff; }
.subject.is-active { background: #fff; color: var(--sidebar); border-color: #fff; font-weight: 500; }

.recent { display: flex; flex-direction: column; gap: 4px; }
.recent button {
  text-align: left;
  background: none; border: 0;
  color: #b7c9da;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 6px 8px;
  border-radius: 7px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent button:hover { background: var(--sidebar-line); color: #fff; }

.side-foot { border-top: 1px solid var(--sidebar-line); padding-top: 14px; }
.swatches { display: flex; gap: 6px; margin-top: 8px; }
.swatch {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid transparent;
  padding: 0;
}
.swatch.is-active { border-color: #fff; }

/* main */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}

.modes { display: flex; gap: 4px; background: var(--surface); padding: 3px; border-radius: 10px; border: 1px solid var(--line); }
.mode {
  border: 0; background: none;
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
.mode:hover { background: var(--surface-soft); }
.mode.is-active { background: var(--accent); color: #fff; font-weight: 500; }

.ghost {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 13.5px;
}
.ghost:hover { border-color: var(--accent); color: var(--accent-dark); }

/* thread */
.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 8px;
  display: flex; flex-direction: column; gap: 22px;
}

.welcome { max-width: 640px; margin: 6vh auto 0; text-align: center; }
.welcome h1 { font: 600 30px/1.2 var(--serif); margin-bottom: 12px; }
.welcome p { color: var(--ink-soft); margin: 0 auto 22px; }
.starters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.starter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 13px;
  color: var(--ink-soft);
}
.starter:hover { border-color: var(--accent); color: var(--accent-dark); }

.turn { display: flex; flex-direction: column; gap: 12px; max-width: 820px; width: 100%; align-self: center; }
.asked {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 14px 14px 4px 14px;
  max-width: 78%;
  font-size: 14.5px;
}

.answer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.answer-body { font: 400 15.5px/1.7 var(--serif); color: #23303d; }
.answer-body p { margin: 0 0 12px; }
.answer-body ul, .answer-body ol { margin: 0 0 12px; padding-left: 20px; }
.answer-body li { margin-bottom: 5px; }
.answer-body h3 { font: 600 15px var(--sans); margin: 16px 0 8px; }
.answer-body code {
  font: 400 13px var(--mono);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.answer-body pre {
  background: var(--sidebar);
  color: #dce6f0;
  padding: 13px 15px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 0 0 12px;
}
.answer-body pre code { background: none; border: 0; color: inherit; font-size: 12.5px; padding: 0; }

.cite {
  font: 500 11px var(--mono);
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid #cfe0ef;
  border-radius: 5px;
  padding: 1px 5px;
  margin-left: 2px;
  vertical-align: 1px;
}
.cite:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.status { display: flex; align-items: center; gap: 9px; color: var(--ink-muted); font-size: 13.5px; }
.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.answer-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.chip {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.timing { margin-left: auto; font: 400 11.5px var(--mono); color: var(--ink-muted); }
.chip.grounding { margin-left: auto; }
.chip.grounding:disabled { cursor: default; opacity: 0.75; }
.chip.is-on { background: #fdf3e0; border-color: #e0b874; color: #7a5312; }
.unchecked { background: #fdf3e0; border-bottom: 1.5px dotted #c98a2e; }

/* sources under an answer */
.sources { display: flex; flex-wrap: wrap; gap: 8px; }
.source-pill {
  display: flex; align-items: baseline; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  text-align: left;
  max-width: 260px;
}
.source-pill:hover { border-color: var(--accent); }
.source-pill b { font: 500 11px var(--mono); color: var(--accent-dark); }
.source-pill span {
  font-size: 12.5px; color: var(--ink-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.trace { margin-top: 14px; }
.trace summary { font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.trace table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 12.5px; }
.trace th {
  text-align: left; font: 500 11px var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); padding: 6px 8px;
  border-bottom: 1px solid var(--line);
}
.trace td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.trace td.num, .trace th.num { font-family: var(--mono); text-align: right; }
.bar { height: 5px; background: var(--accent-soft); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 5px; background: var(--accent); }

.refusal {
  background: var(--ivory);
  border: 1px solid #e6dcc8;
  border-radius: var(--radius);
  padding: 18px 20px;
}
.refusal h3 { font: 600 15px var(--sans); margin-bottom: 6px; }
.refusal p { margin: 0 0 12px; color: #6b6153; font-size: 14px; }

/* composer */
.composer {
  display: flex; gap: 10px;
  padding: 14px 28px 22px;
  background: linear-gradient(to top, var(--bg) 62%, rgba(233, 241, 247, 0));
}
.composer input {
  flex: 1;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 11px;
  padding: 13px 16px;
  font: 400 15px var(--sans);
  color: var(--ink);
}
.composer input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.composer button {
  background: var(--accent);
  color: #fff; border: 0;
  border-radius: 11px;
  padding: 0 24px;
  font-weight: 500;
}
.composer button:hover { background: var(--accent-dark); }
.composer button:disabled { background: var(--line-strong); cursor: not-allowed; }

/* drawer */
.drawer {
  position: fixed; top: 0; right: 0;
  width: 400px; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 20;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.drawer-title { font-weight: 600; font-size: 14px; }
.icon { background: none; border: 0; color: var(--ink-muted); font-size: 15px; }
.icon:hover { color: var(--ink); }
.drawer-body { padding: 20px; overflow-y: auto; }
.passage {
  font: 400 14.5px/1.72 var(--serif);
  color: #23303d;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 15px 16px;
  white-space: pre-wrap;
}
/* words the question matched: drawn by the app, always the same quiet blue */
.evidence { background: #e1ecf7; border-bottom: 1.5px solid #9fb8d3; }
/* highlights the reader makes: their colour, their note */
mark.mine { color: inherit; border-radius: 2px; cursor: pointer; }
mark.mine.has-note { border-bottom: 2px dotted rgba(28, 39, 51, 0.45); }
.meta { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.meta .book { font-weight: 600; font-size: 14.5px; }
.meta .where { font-size: 13px; color: var(--ink-soft); }
.meta .page { font: 400 11.5px var(--mono); color: var(--ink-muted); }

/* library + evaluation */
.cards { padding: 24px 28px; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); overflow-y: auto; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card h3 { font-size: 15px; margin-bottom: 4px; }
.card .by { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tag {
  font-size: 11.5px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 3px 10px;
}
.card .foot { display: flex; justify-content: space-between; font: 400 11.5px var(--mono); color: var(--ink-muted); }

.eval { padding: 24px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.metrics { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.metric b { display: block; font: 600 26px var(--sans); }
.metric span { font-size: 12.5px; color: var(--ink-soft); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.panel h3 { font-size: 15px; margin-bottom: 4px; }
.panel > p { margin: 0 0 14px; color: var(--ink-soft); font-size: 13.5px; }
.panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel th {
  text-align: left; font: 500 11px var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-muted); padding: 8px; border-bottom: 1px solid var(--line);
}
.panel td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.panel td.num { font-family: var(--mono); text-align: right; }
.panel tr.best td { background: var(--accent-soft); }
.notes { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--ink-soft); }
.notes li { margin-bottom: 8px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; min-height: 100vh; }
  .main { overflow: visible; }
  .composer { position: sticky; bottom: 0; z-index: 4; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; }
  .side-recent, .side-foot { display: none; }
  .nav { flex-direction: row; }
  .thread, .composer, .cards, .eval { padding-left: 16px; padding-right: 16px; }
  .drawer { width: 100%; }
  .welcome h1 { font-size: 24px; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .modes { flex-wrap: wrap; }
  .asked { max-width: 90%; }
  .source-pill { max-width: 100%; }
}

/* study modes, suggestions, practice, highlights, progress */
/* flex-start, or the mode buttons' box stretches to the width of a longer hint */
.mode-group { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.mode-hint { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.side-hint { margin: 8px 0 0; font-size: 11.5px; line-height: 1.45; color: #8ba1b6; }

.note-line { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-muted); }
.note-line b { color: var(--ink-soft); font-weight: 500; }

.suggest { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.suggest-label { font-size: 13px; color: #6b6153; }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion {
  background: var(--surface);
  border: 1px solid #e0d3b8;
  color: #5b4a2b;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
}
.suggestion:hover { border-color: var(--accent); color: var(--accent-dark); }

.clarify { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 18px 20px; }
.clarify h3 { font: 600 15px var(--sans); margin-bottom: 10px; }

.strategies { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.strategies span { font-size: 13px; color: var(--ink-soft); }

.answer.collapsed .answer-body { max-height: 8.2em; overflow: hidden; }
.answer.collapsed .sources, .answer.collapsed .trace, .answer.collapsed .answer-foot, .answer.collapsed .strategies { display: none; }
.expand { margin-top: 8px; background: none; border: 0; color: var(--accent-dark); font-size: 13px; padding: 0; }

.practice { border-top: 1px solid var(--line); padding: 14px 0; }
.practice:first-child { border-top: 0; padding-top: 0; }
.practice-q { font: 600 15px/1.5 var(--serif); margin: 0 0 10px; }
.practice textarea {
  width: 100%; min-height: 64px; resize: vertical;
  border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 11px; font: 400 14px var(--sans); color: var(--ink);
}
.practice textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.practice-a { margin-top: 10px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; font: 400 14.5px/1.6 var(--serif); }
.practice-a p { margin: 0 0 10px; }
.grade { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 400 13px var(--sans); color: var(--ink-soft); }
.grade .chip.is-picked { background: var(--accent); color: #fff; border-color: var(--accent); }
.practice .actions { display: flex; gap: 8px; margin-top: 8px; }

.drawer-legend { margin: 12px 0 0; font-size: 12px; color: var(--ink-muted); line-height: 1.5; }
.drawer-legend .evidence { padding: 0 3px; }
.drawer-notes { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.drawer-notes h4 { margin: 0; font: 600 12px var(--sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-muted); }

.mark-tools {
  position: fixed; z-index: 30;
  background: var(--sidebar); color: #fff;
  border-radius: 10px; padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  min-width: 190px;
}
.mark-tools .row { display: flex; gap: 6px; align-items: center; }
.mark-tools .swatch { width: 22px; height: 22px; }
.mark-tools button.text { background: none; border: 1px solid #52667a; color: #e4edf6; border-radius: 7px; padding: 4px 9px; font-size: 12.5px; }
.mark-tools button.text:hover { border-color: #fff; color: #fff; }
.mark-tools textarea { width: 240px; min-height: 60px; border-radius: 7px; border: 0; padding: 7px 8px; font: 400 13px var(--sans); }
.mark-tools .quote { font-size: 12px; color: #c3d3e2; max-width: 240px; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.item .bar-colour { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.item .body { flex: 1; min-width: 0; }
.item .quote-text { font: 400 14px/1.55 var(--serif); margin: 0 0 4px; }
.item .meta-line { font-size: 12px; color: var(--ink-muted); }
.item .note-text { font-size: 13px; color: var(--ink-soft); margin: 4px 0 0; }
.item .icon { font-size: 13px; }
.topics { display: flex; flex-direction: column; gap: 14px; }
.topics h4 { margin: 0 0 6px; font: 600 13px var(--sans); color: var(--ink-soft); }
.topic-row { display: flex; flex-wrap: wrap; gap: 6px; }
.topic { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--ink-soft); }
.topic:hover { border-color: var(--accent); color: var(--accent-dark); }
.topic.weak { border-color: #e0b874; background: #fdf3e0; color: #7a5312; }
.empty { color: var(--ink-muted); font-size: 13.5px; margin: 0; }
.row-key { display: inline-block; width: 1.4em; font: 500 12px var(--mono); color: var(--ink-muted); }

/* each page fills the frame below its header and scrolls on its own */
.cards, .eval, .topics-page { flex: 1; min-height: 0; }
.cards { align-content: start; }

/* a button that reads as a link, for small actions inside a line of text */
.link { background: none; border: 0; padding: 0; color: var(--accent-dark); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; }
.link:hover { color: var(--ink); }
.subject-hint { font-size: 13px; }
.drawer-notes:empty { display: none; }

/* landing page */
.welcome-topics { margin-top: 26px; }
.welcome-label { margin: 0 0 10px !important; font-size: 12.5px; color: var(--ink-muted) !important; }
.welcome-topics .topic-row { justify-content: center; }
.topic.more { background: none; border-style: dashed; }

/* "not quite": the reasoning, then more or done */
.why { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-strong); }
.why p { margin: 0 0 8px; }
.why-actions { display: flex; align-items: center; gap: 8px; }
.why-actions .icon { margin-left: auto; }

/* quiz */
.quiz { display: flex; flex-direction: column; }
.quiz-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.quiz-score { color: var(--ink-soft); font-size: 12.5px; }
.q { padding: 16px 0; border-bottom: 1px solid var(--line); }
.q-text { font: 600 15px/1.55 var(--serif); margin: 0 0 10px; }
.q textarea { width: 100%; min-height: 64px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; font: 400 14px var(--sans); resize: vertical; }
.q .actions { display: flex; gap: 8px; margin-top: 8px; }
.options { display: grid; gap: 7px; }
.option {
  display: flex; gap: 10px; align-items: baseline; text-align: left;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 9px 12px; font-size: 14px; color: var(--ink);
}
.option b { font: 500 12px var(--mono); color: var(--ink-muted); }
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.option:disabled { cursor: default; }
.option.right { border-color: #7fae8a; background: #e9f4ec; }
.option.wrong { border-color: #d49a9a; background: #faeaea; }
input.blank {
  width: 11em; margin: 0 4px; padding: 2px 6px;
  border: 0; border-bottom: 2px solid var(--accent); background: var(--accent-soft);
  font: 500 14px var(--sans); color: var(--ink);
}
input.blank:focus { outline: none; background: #d7e5f3; }
input.blank.right { border-color: #5f9a6d; background: #e9f4ec; }
input.blank.wrong { border-color: #c27a7a; background: #faeaea; }
.q-feedback { margin-top: 10px; padding: 10px 12px; border-radius: 9px; background: var(--surface-soft); border: 1px solid var(--line); font: 400 14px/1.6 var(--serif); }
.q-feedback p { margin: 0 0 8px; }
.q-feedback p:last-child { margin-bottom: 0; }
.q-feedback.right { background: #eef6f0; border-color: #bcd9c3; }
.q-feedback.wrong { background: #fbf1f0; border-color: #e8c9c6; }
.q-feedback .grade { font-family: var(--sans); }
.quiz-result { padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.quiz-result p { margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.quiz-result .score { font: 600 28px var(--sans); color: var(--ink); }

/* topics */
.topic-search { display: flex; gap: 8px; flex: 1; max-width: 560px; }
.topic-search input { flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; font: 400 14px var(--sans); background: var(--surface); }
.topic-search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.topic-search button { border: 0; border-radius: 9px; padding: 9px 14px; background: var(--accent); color: #fff; font-size: 13.5px; }
.topics-page { padding: 22px 28px 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.lead { margin: 0; color: var(--ink-soft); font-size: 14px; max-width: 760px; }
.book-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; }
.book-block h3 { font-size: 15px; margin-bottom: 8px; }
.chapter { border-top: 1px solid var(--line); }
.chapter summary, .chapter-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 2px; font-size: 14px; color: var(--ink); cursor: pointer;
}
.chapter summary { list-style: none; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::before { content: "▸"; color: var(--ink-muted); margin-right: 8px; font-size: 11px; }
.chapter[open] summary::before { content: "▾"; }
.chapter summary span { flex: 1; }
.chapter small, .chapter-row small { color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.chapter .topic-row { padding: 2px 0 12px 18px; }
.chapter-row { width: 100%; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; }
.chapter-row:hover, .chapter summary:hover { color: var(--accent-dark); }
.topic small { color: var(--ink-muted); margin-left: 4px; }
.topic.whole { border-style: dashed; }
.results-title { font-size: 15px; margin-top: 8px; }
.passage-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.topic-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reader-head { display: flex; flex-direction: column; gap: 8px; }
.reader-head h2 { font: 600 24px/1.25 var(--serif); }
.reader-head .muted { margin: 0; }
.reader-head .topic-actions { margin-top: 2px; }
.back { align-self: flex-start; font-size: 13px; }
.reader-passage { display: flex; gap: 12px; align-items: flex-start; }
.reader-passage .passage { flex: 1; min-width: 0; }
.page-label { font: 400 11.5px var(--mono); color: var(--ink-muted); padding-top: 16px; min-width: 3.4em; text-align: right; }
.more-passages { align-self: center; }
/* the start of a passage that repeats the end of the one above it */
.repeat { display: none; }

/* my learning */
.score-item { align-items: center; }
.score-badge { font: 600 15px var(--mono); color: #3f6a4c; background: #e9f4ec; border-radius: 8px; padding: 6px 9px; }
.score-badge.low { color: #8a4b45; background: #faeaea; }
.item .chip { align-self: center; white-space: nowrap; }

@media (max-width: 900px) {
  .topics-page { padding-left: 16px; padding-right: 16px; }
  .topic-search { max-width: none; flex-basis: 100%; }
  .nav { flex-wrap: wrap; }
  .nav-item { white-space: nowrap; }
  .reader-passage { flex-direction: column; gap: 4px; }
  .page-label { padding-top: 0; text-align: left; }
  input.blank { width: 8em; }
}
