/* Visual language follows agxsearch.ai: a quiet canvas, pastel sticky notes with
   small tilts. Comic Neue sets the home page and logo, Andika the problems, Geist Mono the scores. */
@font-face { font-family: "Andika"; src: url("fonts/Andika-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("fonts/Andika-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("fonts/ComicNeue-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Comic Neue"; src: url("fonts/ComicNeue-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --ui-font: "Andika", system-ui, -apple-system, "Segoe UI", sans-serif;
  --home-font: "Comic Neue", "Comic Sans MS", "Chalkboard SE", sans-serif;
  --num-font: "Geist Mono", ui-monospace, monospace;
  --canvas: #fffdf0; --header: rgba(255, 253, 240, .92); --surface: #fff;
  --ink: #17243b; --ink-2: #2c3a52; --muted: #54647b; --line: #e2e4e0; --line-2: #7d899d;
  --accent: #2457b4; --accent-hover: #1d468f; --on-accent: #fff; --ring: #2457b4;
  --rule: #dbe7f3; --margin: #efb4b4;
  --n-yellow: #fff2b3; --n-blue: #dbeaff; --n-green: #d9f2e1; --n-pink: #ffdce8; --n-peach: #ffe2cc; --n-pale: #f1faf3;
  --note-ink: #1d2430; --note-ink-2: #2b3340; --note-muted: #475060; --note-link: #1d4fa8;
  --brandnote: #fff3a8; --brand-x: #3b7dd8;
  --note-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 10px 20px rgba(60, 40, 10, .25);
  --note-lift: 0 1px 1px rgba(0, 0, 0, .12), 0 16px 28px rgba(60, 40, 10, .3);
  --good: #17693e; --bad: #b0263a;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --canvas: #121822; --header: rgba(18, 24, 34, .9); --surface: #18212f;
    --ink: #e8edf7; --ink-2: #cfd9e8; --muted: #a9b8cc; --line: #2a3547; --line-2: #5d6e88;
    --accent: #a9c3ff; --accent-hover: #c9daff; --on-accent: #101b31; --ring: #8fb0f2;
    --rule: #2a3547; --margin: #6e3b45; --brand-x: #3b7dd8;
    --note-shadow: 0 1px 1px rgba(0, 0, 0, .45), 0 10px 22px rgba(0, 0, 0, .5);
    --note-lift: 0 2px 2px rgba(0, 0, 0, .45), 0 16px 28px rgba(0, 0, 0, .5);
    --good: #8fe0ae; --bad: #ff9aa8;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 16px/1.6 var(--ui-font); }
h1, h2, h3 { font-weight: 700; margin: 0; line-height: 1.25; }
h1 { font-size: clamp(28px, 5.5vw, 42px); line-height: 1.15; letter-spacing: -.015em; }
h2 { font-size: 24px; margin: 40px 0 10px; }
h3 { font-size: 18px; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: .18em; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
/* Text boxes show no focus ring when clicked: the caret marks where you're typing, as on the answer line.
   Checkboxes, buttons and links keep the ring, since keyboard users rely on it there. */
input:not([type="checkbox"]):not([type="radio"]):focus, input:not([type="checkbox"]):not([type="radio"]):focus-visible,
textarea:focus, textarea:focus-visible { outline: none; }

.site-header { position: sticky; top: 0; z-index: 30; background: var(--header); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.site-header-in { width: min(1120px, calc(100% - 32px)); margin: 0 auto; min-height: 60px; display: flex; align-items: center; gap: 14px; }
.brand { --ui-font: var(--home-font); min-height: 44px; padding: 4px 12px 6px; border: 0; border-radius: 2px; background: var(--brandnote); color: #1d2430; box-shadow: 1px 2px 4px rgba(60, 40, 10, .28); transform: rotate(-1.5deg); cursor: pointer; font: 700 20px/1 var(--ui-font); letter-spacing: -.01em; }
.brand span { color: var(--brand-x); }
.brand small { font-size: .62em; font-weight: 700; color: #6b7280; margin-left: 1px; letter-spacing: 0; }
.map-icon { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 9px; background: transparent; color: var(--ink); cursor: pointer; }
.brand { margin-right: auto; }
.map-icon:hover { background: rgba(127, 127, 127, .14); }
.map-icon[hidden] { display: none; }
.map-icon { position: relative; }
.map-icon[data-tip]:hover::after, .map-icon[data-tip]:focus-visible::after,
.has-tip[data-tip]:hover::after, .has-tip[data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 40;
  padding: 4px 9px; border-radius: 6px; background: var(--ink); color: var(--canvas); font: 700 13px/1.3 var(--ui-font); white-space: nowrap; pointer-events: none;
}
.map-icon:last-child[data-tip]:hover::after, .map-icon:last-child[data-tip]:focus-visible::after { left: auto; right: 0; transform: none; }
@media (hover: none) { .map-icon[data-tip]:hover::after, .has-tip[data-tip]:hover::after { content: none; } }
main { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.scope, .home-note { color: var(--muted); font-size: 14px; }

/* Sticky notes. Everything inside a note uses note ink, in both themes. */
.sticky {
  --r: -1deg;
  position: relative; padding: 20px 20px 18px; border-radius: 3px; background: var(--note, var(--n-yellow)); color: var(--note-ink);
  box-shadow: var(--note-shadow); transform: rotate(calc(var(--r) * var(--tilt, 1))); transition: transform .15s ease, box-shadow .15s ease;
  --ink: var(--note-ink); --muted: var(--note-muted); --accent: var(--note-link); --ring: var(--note-link);
}
/* Only notes you can click lift on hover; reading notes stay put. */
.sticky.lift { cursor: pointer; }
.sticky.lift:hover, .sticky.lift:focus-within { transform: rotate(0) translateY(-2px); box-shadow: var(--note-lift); }
.sticky p { margin: 0 0 6px; }
.sticky a, .sticky .text-btn { color: var(--note-link); }
.sticky.green { --note: var(--n-green); }
.sticky.pink { --note: var(--n-pink); }
.sticky.blue { --note: var(--n-blue); }
.sticky.peach { --note: var(--n-peach); }

.btn { min-height: 44px; padding: 0 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); cursor: pointer; font: 700 16px var(--ui-font); }
.btn:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.quiet:hover:not(:disabled) { background: rgba(127, 127, 127, .12); border-color: var(--ink); }
/* Inside notes, the main action keeps the site's blue (notes are always light, so the light-mode blue). */
.sticky .btn { --accent: #2457b4; --accent-hover: #1d468f; --on-accent: #fff; --ink: var(--note-ink); --line-2: var(--note-muted); }
.btn.danger { background: #b0263a; border-color: #b0263a; color: #fff; }
.btn.danger:hover:not(:disabled) { background: #8f1d2f; border-color: #8f1d2f; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.sticky .actions { margin: 12px 0 0; }
.text-btn { min-height: 44px; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-weight: 700; }

/* Home */
.home { --ui-font: var(--home-font); max-width: 860px; margin: 24px auto 0; text-align: center; font-family: var(--ui-font); font-size: 18px; }
.lede { max-width: 40rem; margin: 8px 0 0; color: var(--ink-2); font-size: 20px; }
.home .actions { justify-content: center; margin: 28px 0 40px; }
.home .btn { min-height: 52px; padding: 0 28px; font-size: 19px; }
.note-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; text-align: left; }
.note-board .sticky { min-height: 150px; }
.note-board .sticky:nth-child(2) { --r: .8deg; }
.note-board .sticky:nth-child(3) { --r: -.5deg; }
.note-board h2 { margin: 0 0 6px; font-size: 20px; }
.home-note { margin-top: 36px; }

/* Solving a problem */
.test-layout { max-width: 780px; margin: 0 auto; }
.solve { min-width: 0; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.tag { color: var(--bad); }
.statement { --r: -.6deg; padding: 28px 28px 26px; font-size: 21px; line-height: 1.5; margin-bottom: 26px; }
.statement sup { font-size: .7em; }
.figure { display: flex; justify-content: center; margin-top: 16px; }
.figure-art { display: block; max-width: 100%; height: auto; font-family: var(--ui-font); }

/* The one notebook: ruled paper for writing an answer, and for the leaderboard. */
.notebook {
  --ruled: 36px;
  padding: 14px 18px 14px 58px; border: 1px solid var(--line); border-radius: 4px; background:
    linear-gradient(90deg, transparent 42px, var(--margin) 42px, var(--margin) 44px, transparent 44px),
    repeating-linear-gradient(transparent 0, transparent calc(var(--ruled) - 1px), var(--rule) calc(var(--ruled) - 1px), var(--rule) var(--ruled)),
    var(--surface);
}
#answer-form { --ruled: 52px; padding-top: 0; padding-bottom: 0; cursor: text; }
#answer-form button { cursor: pointer; }
#answer-form button:disabled { cursor: not-allowed; }
/* Every row is exactly one ruled line tall, so the underline sits on a rule. */
.answer-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; }
.answer-row > * { flex-shrink: 0; }
.answer-row .btn { min-height: 40px; margin-block: 6px; }
.answer-row input { flex: 1 1 170px; min-width: 0; height: var(--ruled); padding: 0 4px; border: 0; border-bottom: 2px solid var(--accent); background: transparent; color: var(--ink); font: 500 22px var(--num-font); }
.answer-row input { caret-color: var(--accent); cursor: text; }
.answer-row input:focus, .answer-row input:focus-visible { outline: none; border-radius: 0; border-bottom-width: 3px; }
.answer-row input:focus::placeholder { color: transparent; }
.answer-row input:disabled { cursor: default; }
.answer-row input::placeholder { color: var(--muted); font: 400 16px var(--ui-font); opacity: 1; }
.form-note { color: var(--bad); min-height: 1.5em; margin: 6px 0 0; font-size: 15px; font-weight: 700; }
.hints { display: grid; gap: 14px; justify-items: start; margin-top: 16px; }
.hint { --note: var(--n-blue); --r: -.5deg; max-width: 34rem; padding: 14px 16px; }
.hint:nth-child(2) { --r: .6deg; }
.feedback { --r: .4deg; margin-top: 22px; }
.feedback.good { --note: var(--n-green); }
.feedback.bad { --note: var(--n-pink); }
.feedback.skipped { --note: var(--n-blue); }
.sticky .next-row { justify-content: flex-end; margin-top: 8px; }
.sticky .next-btn { min-height: 48px; padding: 0 22px; border-color: #2457b4; background: #2457b4; color: #fff; font-size: 18px; }
.sticky .next-btn:hover:not(:disabled) { border-color: #1d468f; background: #1d468f; }
.result { display: flex; align-items: center; gap: 10px; font-size: 24px; margin-bottom: 6px; }
.result-icon { flex: none; }


/* Tools: scratch paper and calculator open as floating windows, dragged by the title bar. */
.tools { margin-top: 10px; }
.tool-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-tab { min-height: 36px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: 700 14px var(--ui-font); }
.tool-tab:hover { border-color: var(--ink); }
.tool-tab[aria-pressed="true"] { background: var(--n-yellow); border-color: #c9a227; color: var(--note-ink); }
.tool-window { position: fixed; z-index: 40; display: flex; flex-direction: column; border-radius: 6px; background: #fffef8;
  border: 1px solid #d9d3b8; box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 18px 40px rgba(40, 30, 10, .28); color: var(--note-ink); }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 14px;
  border-radius: 6px 6px 0 0; background: var(--n-yellow); cursor: grab; touch-action: none; user-select: none; font: 700 15px var(--home-font); }
.tool-head:active { cursor: grabbing; }
.tool-close { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; background: transparent;
  color: var(--note-ink); cursor: pointer; font-size: 15px; }
.tool-close:hover { background: rgba(0, 0, 0, .08); }
.tool-body { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 12px; }
.calculator-window { width: 320px; }
.scratch-window { width: 560px; height: 420px; min-width: 300px; min-height: 260px; max-width: calc(100vw - 16px); max-height: calc(100vh - 80px); resize: both; overflow: hidden; }
.calc-top { padding: 8px 10px; border-radius: 6px; background: #fff; border: 1px solid #e4e2d6; }
.calc-top input { width: 100%; border: 0; background: transparent; color: var(--note-ink); font: 500 18px var(--num-font); outline: none; }
.calc-result { min-height: 24px; margin: 2px 0 0; color: var(--note-ink); font: 600 16px var(--num-font); text-align: right; overflow-wrap: anywhere; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 10px; }
.calc-key { min-height: 40px; padding: 0; border: 1px solid rgba(29, 36, 48, .2); border-radius: 7px; background: #f4f6fa; color: var(--note-ink); cursor: pointer; font: 700 15px var(--ui-font); }
.calc-key.digit { background: #fff; }
.calc-key.equals { border-color: #2457b4; background: #2457b4; color: #fff; }
.calc-key:hover { filter: brightness(.96); }
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.paper-wrap { position: relative; flex: 1; min-height: 0; }
.scratch-paper {
  display: block; width: 100%; height: 100%; border: 1px solid var(--line); border-radius: 4px; touch-action: none; cursor: crosshair; background:
    linear-gradient(90deg, transparent 42px, #efb4b4 42px, #efb4b4 44px, transparent 44px),
    repeating-linear-gradient(transparent 0, transparent 31px, #dbe7f3 31px, #dbe7f3 32px), #fff;
}
.scratch-paper.text-mode { cursor: text; }
.pad-text { position: absolute; min-width: 140px; padding: 2px 4px; border: 1px dashed #8aa6d6; border-radius: 3px; background: rgba(255, 255, 255, .9);
  color: #1f4a8c; font: 17px Andika, system-ui, sans-serif; outline: none; }
.scratch-window .tool-actions { justify-content: flex-start; }
.scratch-window .btn { min-height: 34px; padding: 0 14px; font-size: 14px; }
/* On a phone the windows dock at the bottom of the screen instead of floating. */
@media (max-width: 719px) {
  .tool-window { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto !important; resize: none; }
  .scratch-window { height: 55vh !important; }
  .tool-head { cursor: default; }
}

/* Results */
.continue-btn { margin-top: 14px; }
.map-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px 32px; align-items: flex-start; }
.map-head > div:first-child { flex: 1 1 320px; min-width: 0; }
.map-head .lede { margin: 8px 0 0; font-size: 16px; }
.level-found { --note: var(--n-peach); --r: 1.2deg; flex: 0 1 250px; font-weight: 700; }
.level-found b { display: block; font-size: 24px; line-height: 1.25; }
.level-found .scope { display: block; margin-top: 4px; font-weight: 400; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 22px; margin: 28px 0; }
.tile:nth-child(even) { --r: .8deg; }
.tile b { display: block; font: 600 34px/1.15 var(--num-font); }
.map-scroll { overflow-x: auto; padding: 6px 2px; }
.map { display: block; width: 100%; min-width: 980px; height: auto; }
.map .edge { fill: none; stroke: var(--line-2); stroke-width: 1; opacity: .55; }
.map .band-label { fill: var(--muted); font: 700 15px var(--ui-font); }
.map .node { cursor: pointer; }
.map .node rect { filter: drop-shadow(0 3px 4px rgba(60, 40, 10, .3)); }
.map .node text { font: 400 15px var(--ui-font); fill: #1d2430; }
.map .node.mastered rect { fill: var(--n-green); }
.map .node.likely rect { fill: var(--n-pale); stroke: #17693e; stroke-dasharray: 5 3; }
.map .node.gap rect { fill: var(--n-pink); }
.map .node.unknown rect { fill: var(--n-yellow); }
.map .node.selected rect { stroke: var(--accent); stroke-width: 2.5; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 18px; color: var(--muted); font-size: 14px; margin: 6px 0 18px; }
.skill-detail { --note: var(--n-blue); --r: -.4deg; max-width: 38rem; margin: 8px 0; }
.next-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 26px; margin: 16px 0 26px; }
.next-item { display: flex; flex-direction: column; gap: 6px; }
.next-item:nth-child(4n + 2) { --r: .8deg; --note: var(--n-blue); }
.next-item:nth-child(4n + 3) { --r: -.5deg; --note: var(--n-green); }
.next-item:nth-child(4n) { --r: 1.2deg; --note: var(--n-peach); }
.next-item p { flex: 1; margin: 0; }

/* Practice */
.subject-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 26px; list-style: none; margin: 18px 0 0; padding: 0; }
.subject-note { display: flex; flex-direction: column; --r: -.5deg; }
.subject-note:nth-child(even) { --r: .7deg; }
.subject-note h2 { margin: 0 0 2px; font-size: 21px; }
.subject-note .actions { margin-top: auto; padding-top: 12px; }
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.skill-chip { min-height: 34px; padding: 2px 10px; border: 1px solid var(--note-muted); border-radius: 999px; background: rgba(255, 255, 255, .55); color: var(--note-ink); cursor: pointer; font: 400 14px var(--ui-font); }
.skill-chip:hover { background: #fff; }
.practice-note { margin: 12px 0 0; font-weight: 700; }
.stop-focus { min-height: 32px; font-size: 14px; }

/* Accounts */
.auth { max-width: 520px; margin: 0 auto; }
.auth-note { --r: 0deg; display: flex; flex-direction: column; gap: 6px; margin: 18px 0; }
.auth-note:hover, .auth-note:focus-within { transform: none; }
.auth-note h2 { margin: 0 0 6px; font-size: 20px; }
.auth-note label, .auth-label { font-weight: 700; margin: 6px 0 0; }
.auth-note input:not([type="checkbox"]) { min-height: 44px; padding: 0 12px; border: 1px solid var(--note-muted); border-radius: 8px; background: #fff; color: var(--note-ink); }
.auth-note .btn { align-self: flex-start; }
.auth-note .check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.auth-note .form-note { color: var(--note-ink); }

/* Library, textbooks and wiki */
.learn-search { display: block; width: min(100%, 460px); min-height: 44px; margin: 16px 0 6px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--ink); }
.search-hits { list-style: none; margin: 8px 0 18px; padding: 0; }
.search-hits li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.book-note h2 a { color: inherit; text-decoration: none; }
.book-note h2 a:hover { text-decoration: underline; }
.book-note h2 { margin: 0 0 4px; font-size: 21px; }
.reader { max-width: 760px; margin: 0 auto; }
.crumbs { color: var(--muted); font-size: 14px; }
.wiki-lede { margin: 10px 0 0; max-width: none; }
.contents { margin: 8px 0 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.contents h2 { margin: 0 0 6px; font-size: 16px; }
.contents ul { margin: 0; padding-left: 20px; }
.wiki-section { scroll-margin-top: 76px; margin-top: 30px; }
.wiki-section h2 { margin: 0 0 10px; }
.worked { --note: var(--n-green); --r: -.3deg; margin-top: 18px; }
.worked h3 { margin-bottom: 6px; }
.worked ol { margin: 0 0 8px; padding-left: 22px; }
.terms dt { font-weight: 700; margin-top: 10px; }
.terms dd { margin: 0; }
.mistakes { display: grid; gap: 16px; list-style: none; margin: 0; padding: 0; }
.mistakes .sticky { --r: .3deg; }
.chapter-nav { display: flex; justify-content: space-between; gap: 16px; margin: 32px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); font-weight: 700; }
.chapter-list { list-style: none; margin: 18px 0 0; padding: 0; }
.chapter-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.chapter-list a { font-size: 18px; font-weight: 700; }
.chapter-list p { margin: 4px 0 0; }
.chapter-number { display: inline-block; min-width: 1.6em; color: var(--muted); font-family: var(--num-font); }
.read-link { margin-top: 6px; font-weight: 700; }

/* Leaderboard */
.board-head { display: flex; flex-wrap: wrap; gap: 18px 32px; align-items: flex-start; margin-bottom: 20px; }
.board-head > div:last-child { flex: 1 1 320px; min-width: 0; }
.score-note { --note: var(--n-peach); --r: -1.5deg; min-width: 140px; }
.score-note b { display: block; font: 600 34px/1.15 var(--num-font); }
.avatar-picker { max-height: 300px; overflow-y: auto; padding: 2px 6px 2px 2px; }
.avatar-group { margin: 8px 0 2px; font-size: 13px; font-weight: 700; }
.avatars { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 8px; }
.avatar-choice { width: 44px; height: 44px; padding: 0; font-size: 22px; line-height: 1; background: var(--surface); border: 1px solid var(--line); border-radius: 50%; cursor: pointer; }
.avatar-choice[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--n-blue); }
.board { --ruled: 40px; list-style: none; margin: 0; padding-top: 0; padding-bottom: 0; }
.board li { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.board li.you { background: var(--n-yellow); color: var(--note-ink); --muted: var(--note-muted); margin-left: -8px; padding-left: 8px; }
.board .rank { width: 2.5ch; color: var(--muted); text-align: right; font: 500 15px var(--num-font); }
.board .avatar { font-size: 20px; }
.board .who { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.board .stat { color: var(--muted); font-size: 15px; }
.board b { font: 600 16px var(--num-font); }
.history-lede { margin: 8px 0 0; }
.btn.quiet[aria-pressed="true"] { background: var(--n-yellow); color: var(--note-ink); border-color: #c9a227; }
.history-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 26px; list-style: none; margin: 8px 0 0; padding: 0; }
.history-note { --r: -.6deg; display: flex; flex-direction: column; gap: 4px; }
.history-note:nth-child(even) { --r: .7deg; }
.history-note.good { --note: var(--n-green); }
.history-note.bad { --note: var(--n-pink); }
.history-note.skipped { --note: var(--n-blue); }
.history-note .scope { flex: 1; }
.history-note a { min-height: 32px; font-weight: 700; }
.history-result { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.history-result .result-icon { width: 22px; height: 22px; }

@media (max-width: 820px) {
  .note-board { grid-template-columns: minmax(0, 1fr); }
  .statement { font-size: 20px; padding: 22px 20px; }
  :root { --tilt: .4; }
  .notebook { padding-left: 46px; background:
    linear-gradient(90deg, transparent 32px, var(--margin) 32px, var(--margin) 34px, transparent 34px),
    repeating-linear-gradient(transparent 0, transparent calc(var(--ruled) - 1px), var(--rule) calc(var(--ruled) - 1px), var(--rule) var(--ruled)),
    var(--surface); }
}
@media (prefers-reduced-motion: reduce) {
  .sticky, .sticky.lift:hover, .sticky.lift:focus-within { transition: none; transform: rotate(calc(var(--r) * var(--tilt, 1))); }
}

/* Admin page. */
a.brand { display: inline-flex; align-items: center; text-decoration: none; }
.admin-tag { padding: 2px 10px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-weight: 700; font-size: 14px; }
.admin h2 { font-size: 20px; margin: 36px 0 8px; }
.admin-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 18px 0 0; }
.admin-tile { --r: 0deg; display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.admin-tile b { font: 700 28px/1.1 var(--num-font); }
.admin-tile span { font-size: 14px; color: var(--note-muted); }
.admin-days { display: flex; align-items: flex-end; gap: 6px; height: 170px; padding: 8px 0 0; border-bottom: 1px solid var(--line); }
.admin-day { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.admin-bar { width: 100%; max-width: 32px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.admin-count { font: 600 11px var(--num-font); color: var(--muted); }
.admin-date { font: 400 11px var(--num-font); color: var(--muted); white-space: nowrap; }
.admin-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table .num { font-family: var(--num-font); white-space: nowrap; }
.admin-table .scope { display: block; font-size: 13px; }
.admin-problem { min-width: 260px; }
.admin-statement { display: block; margin-top: 4px; color: var(--ink-2); }
.admin-wrong { display: inline-block; margin: 0 4px 4px 0; padding: 1px 8px; border-radius: 6px; background: var(--n-pink); color: var(--note-ink); font-family: var(--num-font); white-space: nowrap; }
.admin-wrong i { font-style: normal; color: var(--note-muted); }
.admin-avatar { font-size: 20px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 220px; }
.admin-act { min-height: 36px; padding: 0 10px; font-size: 14px; }
.admin-search { display: flex; flex-direction: column; gap: 4px; max-width: 360px; margin: 0 0 12px; font-weight: 700; }
.admin-search input { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); font-weight: 400; }
.admin-link { display: inline-flex; align-items: center; text-decoration: none; }
.home-status { margin: -24px 0 36px; color: var(--muted); font-size: 16px; }
.walkthrough { --note: var(--n-green); --r: .3deg; max-width: 40rem; padding: 16px 20px; margin-top: 10px; }
.walkthrough h3 { margin: 0 0 6px; font-size: 19px; }
.walkthrough h4 { margin: 12px 0 4px; font-size: 16px; }
.walkthrough ol { margin: 0; padding-left: 22px; }
.walkthrough li { margin: 4px 0; }
.walkthrough-open { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 12px; margin-top: 12px; }
.learn-next { margin: 12px 0 4px; padding: 12px 14px; border-radius: 8px; background: rgba(255, 255, 255, .55); }
.learn-next p { margin: 0 0 4px; }
.learn-next ul { margin: 0 0 10px; padding-left: 20px; }
.learn-next li { margin: 4px 0; }
.learn-next .scope { display: block; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-icon { flex: none; }

/* Account area, laid out like the agx console: a sticky rail of note strips and a white panel. */
.account-page { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 32px; align-items: start; }
.side-rail { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 9px; }
.side-label { margin: 6px 0 6px 14px; color: var(--muted); font: 700 12px var(--home-font); letter-spacing: .1em; text-transform: uppercase; }
.side-rail > a { --edge: #ef7d7d; display: flex; align-items: center; min-height: 44px; padding: 0 14px; border-left: 8px solid var(--edge);
  border-radius: 1px 4px 4px 1px; background: rgba(255, 255, 255, .82); color: #33445f; box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
  font: 650 15px/18px var(--home-font); text-decoration: none; }
.side-rail > a:hover { background: #fff; }
.side-rail > a[aria-current="page"] { --edge: #f2b84b; background: #fff1a8; color: #142238; font-weight: 800;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 5px 10px rgba(60, 40, 10, .12); }
.side-rail > .rail-1 { --edge: #ef7d7d; }
.side-rail > .rail-2 { --edge: #6cc08b; }
.side-rail > .rail-0:not([aria-current]) { --edge: #6fa3e8; }
.side-who { margin-top: 28px; padding: 16px 12px 0; border-top: 1px solid var(--line); font-family: var(--home-font); }
.side-who p { margin: 0 0 4px; overflow-wrap: anywhere; }
.side-who p:last-child { margin-top: 12px; }
.text-action { padding: 0; border: 0; background: none; color: #33445f; font: 650 14px var(--home-font); cursor: pointer; text-decoration: none; }
.text-action:hover { text-decoration: underline; }
.account-panel { min-width: 0; padding: 6px 28px 28px; border: 1px solid #e4e6dc; border-radius: 6px; background: #fffef8;
  box-shadow: 0 1px 2px rgba(20, 30, 50, .05), 0 10px 30px rgba(20, 30, 50, .06); }
.panel-body { padding-top: 22px; }
.panel-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-top: 18px; }
.panel-tabs a { padding: 10px 16px; border-bottom: 3px solid transparent; color: #142238; font: 700 15px var(--home-font); text-decoration: none; }
.panel-tabs a[aria-selected="true"] { border-bottom-color: #142238; background: #fffbea; }
/* Inside the panel, notes lie flat, as console cards do. */
.account-panel .sticky { --r: 0deg; border-radius: 2px; box-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 6px 14px rgba(60, 40, 10, .12); }
.account-panel .sticky:hover, .account-panel .sticky:focus-within { transform: none; }
.account-panel h1 { margin-bottom: 14px; }
.account-panel .auth-note { max-width: 560px; margin-top: 0; }
.account-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.account-head h1 { margin: 0; }
.account-avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .15); font-size: 36px; }
.account-panel .stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; margin: 6px 0 10px; }
.account-panel .stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; }
.account-panel .stat b { font: 700 22px/1.2 var(--num-font); }
.account-panel .stat span { font-size: 14px; color: var(--note-muted); }
@media (max-width: 760px) {
  .account-page { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .side-rail { position: static; flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .side-label { display: none; }
  .side-who { width: 100%; margin-top: 4px; padding-top: 10px; }
  .account-panel { padding: 4px 16px 20px; }
}
.account-panel .stat b.word { font: 700 18px/1.25 var(--ui-font); }
/* Links styled as buttons look like buttons, not links. */
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.side-rail > .rail-3 { --edge: #b08ae0; }
.track-note { margin: 4px 0 2px; font-size: 15px; color: var(--note-ink-2); }
.tool-window.front { z-index: 41; }
/* Signed in: your avatar in a ring. Signed out: a small Sign in button. */
.header-avatar span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent), 0 1px 3px rgba(0, 0, 0, .15); font-size: 20px; line-height: 1; }
.header-avatar:hover span { box-shadow: 0 0 0 3px var(--accent), 0 1px 3px rgba(0, 0, 0, .15); }
.header-signin { min-height: 36px; margin-left: 4px; padding: 0 14px; border: 1px solid var(--accent); border-radius: 999px; background: transparent;
  color: var(--accent); cursor: pointer; font: 700 14px var(--home-font); }
.header-signin:hover { background: var(--accent); color: var(--on-accent); }
.header-avatar:hover { background: transparent; }
.leaderboard-page .board-head { align-items: center; margin: 14px 0 20px; }
.map-board-link { margin-top: 28px; }

/* Icon buttons: the same line icons as the header, with a hover label. Pressed means the tool or window is on. */
.has-tip { position: relative; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ink); cursor: pointer; }
.icon-btn:hover { background: rgba(127, 127, 127, .14); }
.icon-btn[aria-pressed="true"] { background: var(--n-yellow); border-color: #c9a227; color: var(--note-ink); }
.tool-window .icon-btn { color: var(--note-ink); }
.tool-tabs .icon-btn { width: 44px; height: 44px; border-color: var(--line-2); background: var(--surface); }
.tool-tabs .icon-btn[aria-pressed="true"] { background: var(--n-yellow); border-color: #c9a227; }
.paper-tools { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.tool-gap { flex: 1; }
.tool-close { color: var(--note-ink); }
.ghost-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px 0 10px; border: 1px solid var(--line-2);
  border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; font: 700 15px var(--ui-font); }
.ghost-btn:hover { border-color: var(--ink); }
.ghost-btn .icon { color: #b7861a; }
.angle-switch { display: inline-flex; padding: 2px; border: 1px solid rgba(29, 36, 48, .25); border-radius: 999px; background: #fff; cursor: pointer; }
.angle-switch span { padding: 4px 10px; border-radius: 999px; color: var(--note-muted); font: 700 12px var(--num-font); }
.angle-switch span[aria-pressed="true"] { background: var(--note-ink); color: #fff; }
.copy-link { margin-left: auto; width: 36px; height: 36px; color: var(--accent); }


/* ---- Design pass: one visual vocabulary ----
   Color means one thing everywhere: green mastered/correct, pink gap/wrong, blue hint/skipped/info, yellow a plain
   note, peach "you" (score, level), blank paper unknown. Stat numbers, note titles, selection and gaps share one style. */
:root { --note-gap: 24px; }
.home .lede { max-width: 620px; margin: 12px auto 0; }
.tiles, .note-board, .subject-board, .next-list, .history-board, .account-panel .stats { gap: var(--note-gap); }
.tile b, .score-note b, .account-panel .stat b, .admin-tile b { font: 600 32px/1.1 var(--num-font); }
.subject-note h2, .book-note h2, .note-board h2, .auth-note h2, .walkthrough h3 { font-size: 20px; }
.tile { display: flex; flex-direction: column; gap: 4px; }
.tile span { display: inline-flex; align-items: center; gap: 6px; }
.tile.likely { --note: var(--n-pale); outline: 1.5px dashed #17693e; outline-offset: -6px; }
.tile.unknown { --note: #fff; box-shadow: inset 0 0 0 1px var(--line-2), var(--note-shadow); }
.map .node.unknown rect { fill: #fffef8; stroke: var(--line-2); stroke-dasharray: 3 3; filter: none; }
.sticky.yellow { --note: var(--n-yellow); }
/* Header: the current page's icon stays, on a tiny sticky note like the logo. */
.map-icon[aria-current="page"] { background: var(--n-yellow); color: var(--note-ink); border-radius: 3px; transform: rotate(-2deg); box-shadow: 1px 2px 4px rgba(60, 40, 10, .22); }
.header-avatar[aria-current="page"] span { box-shadow: 0 0 0 3px var(--accent), 0 1px 3px rgba(0, 0, 0, .15); }
.header-signin { font: 700 15px var(--ui-font); }
.header-signin[aria-current="page"] { background: var(--n-yellow); border-color: #c9a227; color: var(--note-ink); }
/* Problem page: one help row under the answer line; notes span the column. */
.help-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.help-row .tool-tabs { display: contents; }
.help-sep { width: 1px; height: 24px; margin: 0 4px; background: var(--line-2); }
.tool-tabs .icon-btn { width: 40px; height: 40px; border-radius: 999px; }
.help-note { margin: 8px 0 0; }
.hint, .walkthrough { max-width: none; }
.hints { justify-items: stretch; }
.form-note:empty { min-height: 0; margin: 0; }
.statement .katex { white-space: nowrap; }
.learn-next { margin: 12px 0 4px; padding: 10px 0 0; border-top: 1px dashed rgba(29, 36, 48, .25); border-radius: 0; background: none; }
/* Practice: quieter chips, a check on mastered skills, short buttons. */
.skill-chip { border-color: rgba(29, 36, 48, .22); }
.skill-chip.mastered { background: var(--n-green); }
.skill-chip.mastered::before { content: "✓ "; color: #17693e; font-weight: 700; }
.subject-note .btn { white-space: nowrap; }
/* Leaderboard: the "you" row runs to the edge; the page keeps its ruled paper. */
.board li.you { margin-right: -18px; padding-right: 18px; }
.leaderboard-page .board-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin: 18px 0 24px; }
/* Library and wiki */
.contents { --ruled: 28px; border: 0; border-radius: 3px; background:
  repeating-linear-gradient(transparent 0, transparent 27px, var(--rule) 27px, var(--rule) 28px), var(--surface); box-shadow: var(--note-shadow); }
.contents li { line-height: 28px; }
.book-note h2 a { color: var(--note-ink); }
.wiki-level { display: inline-block; margin: 0 0 6px; padding: 2px 10px; border-radius: 999px; background: var(--n-blue); color: var(--note-ink); font-size: 14px; font-weight: 700; }
/* History cards: one quiet pill, a plain reading link. */
.history-note a[data-action="revisit"] { display: inline-flex; align-items: center; align-self: flex-start; min-height: 34px; padding: 0 14px; border: 1px solid rgba(29, 36, 48, .3);
  border-radius: 999px; background: rgba(255, 255, 255, .6); color: var(--note-ink); text-decoration: none; }
.history-note .read-link a { font-weight: 400; }
/* Fonts: Comic Neue is for the logo and the home page only. */
.tool-head, .side-label, .text-action, .panel-tabs a, .side-rail > a { font-family: var(--ui-font); }
.side-rail > a { font-weight: 700; }
.side-rail > a[aria-current="page"] { font-weight: 700; }
@media (max-width: 820px) {
  .note-board .sticky { min-height: 0; }
}
@media (max-width: 520px) {
  .answer-row input { flex-basis: 100%; }
  .answer-row .btn { flex: 1 1 0; }
}
/* While a docked tool is open on a phone, the page can scroll its answer line above it. */
@media (max-width: 719px) {
  .scratch-window { height: 45vh !important; }
  body.tool-docked main { padding-bottom: 47vh; }
}
.book-note h2 a::after { content: ""; position: absolute; inset: 0; }
.start-over { margin-top: 18px; }
.start-over .text-btn { color: var(--muted); font-size: 14px; }
.band { margin: 18px 0 6px; color: var(--muted); font-size: 14px; letter-spacing: .04em; }
.map-list { display: none; }
.map-chip { display: inline-flex; align-items: center; gap: 6px; }
.map-chip.mastered { background: var(--n-green); }
.map-chip.gap { background: var(--n-pink); }
.map-chip.likely { background: var(--n-pale); border-style: dashed; }
.map-chip.unknown { background: #fff; }
.map-chip.mastered::before { content: none; }
@media (max-width: 719px) {
  .map-scroll { display: none; }
  .map-list { display: block; }
}
/* Account rail: each strip keeps its own edge color; the current one is yellow. */
.side-rail > a[aria-current="page"] { --edge: inherit; }
.side-rail > .rail-0 { --edge: #6fa3e8; }
.side-rail > .rail-1 { --edge: #ef7d7d; }
.side-rail > .rail-2 { --edge: #6cc08b; }
.side-rail > .rail-3 { --edge: #b08ae0; }
/* Inside the account panel the map scales to fit instead of being cut off. */
.account-panel .map { min-width: 0; }
.account-panel .map-scroll { overflow: visible; }
/* Notes in the account panel tilt like everywhere else. */
.account-panel .sticky { --r: -.6deg; border-radius: 3px; box-shadow: var(--note-shadow); }
.account-panel .sticky:nth-child(even) { --r: .5deg; }
