/* Mistake notebook (js/ailp-notebook.js): the #notebook page, its home tile and the "Notebook (n)" link on a course page. */

/* Subject colours, as on the home folders */
.nb-sec { --nb-c: var(--accent); }
.nb-sec.fa { --nb-c: #2f7a63; } .nb-sec.ma { --nb-c: #34609f; } .nb-sec.pc { --nb-c: #6c49a0; } .nb-sec.tax { --nb-c: #a9562a; } .nb-sec.law { --nb-c: #8f3450; }
:root[data-theme="dark"] .nb-sec.fa { --nb-c: #5cc3a3; } :root[data-theme="dark"] .nb-sec.ma { --nb-c: #79a3e8; } :root[data-theme="dark"] .nb-sec.pc { --nb-c: #b595e3; }
:root[data-theme="dark"] .nb-sec.tax { --nb-c: #e5935f; } :root[data-theme="dark"] .nb-sec.law { --nb-c: #e5809e; }

/* ---------- the page ---------- */
.nb-head { padding-bottom: 0; }
.nb-stats { max-width: 460px; margin: 22px auto 18px; }
.nb-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: space-between; align-items: center; margin: 0 0 8px; }
.nb-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.nb-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  border: 1.5px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink);
  font-size: 0.86rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.nb-chip span { font: 600 0.75rem var(--mono); color: var(--muted); }
.nb-chip:hover { border-color: var(--ink); }
.nb-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.nb-chip[aria-pressed="true"] span { color: inherit; opacity: 0.75; }
.nb-chip.zero:not([aria-pressed="true"]) { color: var(--muted); }
.nb-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.nb-chip:focus:not(:focus-visible) { outline: none; }
/* Open / Fixed: a joined pair */
.nb-seg { gap: 0; flex-wrap: nowrap; }
.nb-seg .nb-chip { border-radius: 0; }
.nb-seg .nb-chip:first-child { border-radius: 99px 0 0 99px; }
.nb-seg .nb-chip:last-child { border-radius: 0 99px 99px 0; margin-left: -1.5px; }

/* A subject */
.nb-sec { margin: 28px 0 0; }
.nb-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 0 0 10px; margin: 0 0 14px; border-bottom: 3px double var(--line); }
.screen .nb-sec-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; }
.nb-sec-head h2::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--nb-c); }
.nb-sec-head h2:focus { outline: none; }
.nb-sec-head h2:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.nb-sec-n { margin-right: auto; color: var(--muted); font-size: 0.85rem; }
.nb-sec .ailp-btn.small, .nb-done .ailp-btn.small { min-height: 40px; }
.nb-none { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* Most common slips */
.nb-common { margin: 0 0 16px; padding: 14px 16px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.screen .nb-common h3 { margin: 0 0 6px; font: 700 0.72rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nb-common ol { list-style: none; margin: 0; padding: 0; }
.nb-common li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.nb-common li:first-child { border-top: 0; padding-top: 4px; }
.nb-cnt { flex: none; min-width: 2.6em; padding: 2px 8px; border-radius: 99px; background: var(--bad-soft); color: var(--ink); font: 700 0.8rem var(--mono); text-align: center; }
.nb-ct { flex: 1 1 180px; min-width: 0; font-size: 0.92rem; line-height: 1.4; }
.nb-ct small { display: block; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.nb-ct small.nb-from { margin-top: 2px; font-style: italic; }

/* A slip */
.nb-list { display: grid; gap: 12px; }
.nb-card { min-width: 0; padding: 16px 18px; background: var(--card); border-left: 4px solid var(--bad); border-radius: 18px; box-shadow: var(--shadow); scroll-margin-top: 90px; }
.nb-card.fixed { border-left-color: var(--good); }
.nb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.nb-meta > span:first-child { overflow-wrap: anywhere; }
.nb-badge { padding: 1px 8px; border: 1px solid var(--line); border-radius: 99px; font: 700 0.66rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.nb-qk { display: block; margin: 10px 0 0; font: 700 0.68rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.screen .nb-q { margin: 6px 0 12px; font-size: 1.02rem; line-height: 1.4; overflow-wrap: anywhere; }
.nb-qk + .nb-q { margin-top: 2px; }
.nb-ans { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin: 0 0 12px; }
.nb-ans > div { min-width: 0; padding: 8px 12px; border-radius: 12px; }
.nb-ans span { display: block; color: var(--muted); font-size: 0.74rem; font-weight: 600; }
.nb-ans b { display: block; font: 700 1rem/1.35 var(--mono); overflow-wrap: anywhere; }
.nb-got { background: var(--bad-soft); }
.nb-want { background: var(--good-soft); }
.nb-want b { color: var(--good); }
.nb-how, .nb-rule { margin: 0 0 10px; font-size: 0.92rem; line-height: 1.45; }
.nb-lab { display: block; margin: 0 0 2px; font: 700 0.68rem var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.nb-how p, .nb-rule p { margin: 0; overflow-wrap: anywhere; }
.nb-how p { font-family: var(--mono); font-size: 0.86rem; }
.nb-last { margin: 0 0 10px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; font-size: 0.9rem; }
.nb-last summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.nb-last[open] summary { margin-bottom: 8px; }
.nb-last-q { margin: 0 0 8px; overflow-wrap: anywhere; }
.nb-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 12px; }
.nb-acts .ailp-link { min-height: 40px; padding: 0 4px; }
.nb-note { color: var(--muted); font-size: 0.82rem; }
.nb-note.ok { color: var(--good); font-weight: 600; }
.nb-more { display: flex; margin: 14px auto 0; min-height: 44px; }
.nb-more small { color: var(--muted); font-weight: 400; }
.nb-empty { text-align: center; }
.nb-empty-act { justify-content: center; }
a.ailp-btn.nb-a { text-decoration: none; }
/* For screen readers: what a button just did */
.nb-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* After a retry */
.nb-done .review-list .rl-txt small { display: block; color: var(--muted); font-size: 0.8rem; }
.nb-done .mock-review { max-width: 560px; margin-left: auto; margin-right: auto; }
.nb-done .mock-review ol { margin: 8px 0 0; padding-left: 20px; }
.nb-done .mock-review li { margin: 0 0 10px; }
.nb-done .mr-a span, .nb-done .mr-how { overflow-wrap: anywhere; }

/* ---------- the home tile ---------- */
.home-tools .nb-tile {
  position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, border-color 0.15s;
}
.home-tools .nb-tile:hover { transform: translateY(-2px); box-shadow: var(--lift); border-color: var(--ink); }
.home-tools .nb-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.nb-tile-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--soft); color: var(--muted); }
.nb-tile.has-open .nb-tile-ic { background: var(--bad-soft); color: var(--bad); }
.nb-tile-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nb-tile-k { font: 700 0.68rem var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.nb-tile-tx strong { font-size: 1.02rem; line-height: 1.3; }
.nb-tile-s { color: var(--muted); font-size: 0.82rem; line-height: 1.35; }

/* ---------- the course page link ("Exam ready?" row) ---------- */
.eb-btns a.nb-path { text-decoration: none; color: var(--ink); border-color: color-mix(in srgb, var(--bad) 55%, var(--line)); }

/* ---------- phones ---------- */
@media (max-width: 600px) {
  .nb-filters { flex-direction: column; align-items: stretch; }
  .nb-seg { align-self: flex-start; }
  .nb-chip { padding: 6px 12px; }
  .nb-card { padding: 14px 14px 14px 13px; }
  .nb-common { padding: 12px 14px; }
}
@media (max-width: 360px) {
  .nb-chip { padding: 6px 10px; font-size: 0.82rem; }
  .nb-sec-head .nb-retry { width: 100%; }
}
