/* the fonts travel with the site, so it looks the same on a phone as on the computer it was made on */
@font-face { font-family: "Besley"; font-weight: 700; font-display: swap; src: url("fonts/besley-700.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url("fonts/fira-sans-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url("fonts/fira-sans-500.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url("fonts/fira-sans-600.woff2") format("woff2"); }
@font-face { font-family: "Fira Sans"; font-weight: 700; font-display: swap; src: url("fonts/fira-sans-700.woff2") format("woff2"); }
@font-face { font-family: "Fira Mono"; font-weight: 400; font-display: swap; src: url("fonts/fira-mono-400.woff2") format("woff2"); }
@font-face { font-family: "Fira Mono"; font-weight: 500; font-display: swap; src: url("fonts/fira-mono-500.woff2") format("woff2"); }
:root {
  color-scheme: dark;
  /* graphite, so the colours that mean something stand out: green for done, yellow for due, blue for the next action */
  --bg: #111519; --panel: #171c22; --raise: #1f252d; --line: #2a323c; --text: #e7eaee; --muted: #8d97a3; --ink: #0f1318;
  --accent: #8fb4f2; --done: #6fcf9a; --due: #e8c468; --easy: #6fcf9a; --med: #e8c468; --hard: #ee8b7b;
  --duck: #e8c468; --duck-shade: #d4ae4f; --beak: #ef9a5a; --beak-shade: #d9844a;
  --serif: "Besley", "C059", "Century Schoolbook", Georgia, serif;
  --sans: "Fira Sans", "Noto Sans", system-ui, sans-serif;
  --mono: "Fira Mono", "DejaVu Sans Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
/* always keep room for the scrollbar: otherwise the whole page shifts sideways when moving between a tall page and a short one */
html { scrollbar-gutter: stable; }
body { margin: 0; background: radial-gradient(1100px 520px at 50% -120px, #1a2029, transparent 72%) fixed, var(--bg); color: var(--text); font: 15px/1.5 var(--sans); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { width: min(1100px, 100% - 48px); margin: 0 auto; }
/* the bar that stays at the top of every page */
#top { position: sticky; top: 0; z-index: 4; background: rgba(17, 21, 25, .82); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s; }
#top.scrolled { border-bottom-color: var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .28); }
header { position: relative; display: flex; align-items: center; gap: 0 10px; height: 58px; }
h1 { font: 700 21px/1 var(--serif); margin: 0; white-space: nowrap; }
h1 a { text-decoration: none; }
[hidden] { display: none !important; }
#tabs { flex: 1; align-self: stretch; display: flex; gap: 2px; margin-left: 18px; }
#tabs a { display: flex; align-items: center; padding: 0 11px; color: var(--muted); font-size: 14.5px; text-decoration: none; white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent; transition: color .15s, box-shadow .15s; }
#tabs a:hover { color: var(--text); }
#tabs a.on { color: var(--text); box-shadow: inset 0 -2px 0 var(--text); }
#tabs a.group { margin-left: 14px; }   /* a little space where practising ends and reading begins, and after Today */
#tabs .short { display: none; }
#roadbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding-top: 24px; }
.overall { flex: 1; min-width: min(100%, 260px); }
.overall small { display: flex; flex-wrap: wrap; gap: 2px 26px; margin-bottom: 8px; font-size: 13.5px; color: var(--muted); }
.overall b { margin-left: 5px; font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--done); transition: width .2s; }
button, .btn { background: var(--raise); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer;
  font: inherit; font-size: 13.5px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--muted); }
button:disabled { cursor: default; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.primary:hover { border-color: var(--text); }
#findBtn, #meBtn, #menuBtn, #glossBtn { flex: none; display: flex; align-items: center; gap: 7px; white-space: nowrap; }
#findBtn, #menuBtn, #glossBtn { justify-content: center; width: 36px; height: 34px; padding: 0; color: var(--muted); }
#findBtn:hover, #menuBtn:hover, #glossBtn:hover { color: var(--text); }
#findBtn svg, #menuBtn svg, #glossBtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#glossBtn.on, #meBtn.on { color: var(--text); border-color: var(--muted); }
/* the menu button and its list are for phones; wider screens have the tab row */
#menuBtn { display: none; }
#menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: flex; flex-direction: column; min-width: 210px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
#menu[hidden] { display: none; }
#menu .label { margin: 8px 12px 2px; }
#menu .label:first-child { margin-top: 4px; }
#menu a { padding: 9px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 15px; }
#menu a:hover { color: var(--text); background: var(--raise); }
#menu a.on { color: var(--text); background: var(--raise); font-weight: 500; }

/* a glossary term in running text: tap for its definition */
.term { display: inline; padding: 0; background: none; border: 0; border-radius: 0; color: inherit; font: inherit; cursor: help;
  text-decoration: underline dotted color-mix(in srgb, currentColor 55%, transparent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.term:hover { border: 0; text-decoration-color: var(--accent); }
#termPop { position: fixed; z-index: 30; width: min(320px, calc(100vw - 16px)); padding: 12px 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); font-size: 14px; }
#termPop b { display: block; margin-bottom: 4px; font-size: 14.5px; }
#termPop p { margin: 0 0 10px; color: var(--text); line-height: 1.5; }
#termPop button { padding: 5px 10px; font-size: 13px; }

/* the Review page: one card at a time */
#review { max-width: 760px; padding: 36px 0 70px; }
#review > h2 { font: 700 clamp(28px, 4vw, 38px)/1.1 var(--serif); margin: 0 0 6px; }
.rcard { margin-top: 18px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.rhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.rhead b { font: 700 22px/1.25 var(--serif); }
.rcard p { margin: 0 0 12px; max-width: 70ch; }
.rcard .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.rguess { width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; resize: vertical; }
.rguess:focus { outline: none; border-color: var(--accent); }

/* the Glossary page */
#glossary { max-width: 820px; padding: 36px 0 70px; }
#glossary > h2 { font: 700 clamp(28px, 4vw, 38px)/1.1 var(--serif); margin: 0 0 6px; }
#glossFind { width: 100%; margin: 12px 0 10px; padding: 10px 12px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; }
#glossFind:focus { outline: none; border-color: var(--accent); }
.glossletters { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 18px; }
.glossletters button { min-width: 30px; padding: 4px 6px; font-size: 13px; }
#glossary.filtered .glossletters, #glossary.filtered .gletter { display: none; }
#glossList { margin: 0; }
.gletter { display: block; margin: 22px 0 6px; font: 700 22px/1 var(--serif); color: var(--muted); scroll-margin-top: 80px; }
.gterm { padding: 12px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 90px; }
.gterm dt { font-weight: 600; font-size: 16px; }
.gterm dd { margin: 4px 0 0; }
.gterm dd p { margin: 0 0 8px; max-width: 72ch; }
.gterm .gsee { color: var(--muted); font-size: 14px; }
.gterm.on { margin: 0 -14px; padding: 12px 14px; background: var(--panel); border-radius: 10px; box-shadow: inset 2px 0 0 var(--accent); }
kbd { font: 12px var(--mono); padding: 0 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
/* the dot on the stats button: green = saved somewhere safe, grey = this browser only, yellow = a problem */
#meBtn .pip { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
#meBtn.safe .pip { background: var(--done); }
#meBtn.warn .pip { background: var(--due); }

#next { margin: 22px 0 14px; padding: 22px 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
#next .info { flex: 1; min-width: min(100%, 280px); }
#next .kind { font-size: 13.5px; font-weight: 500; color: var(--accent); }
#next.review .kind { color: var(--due); }
#next .what { font: 700 29px/1.15 var(--serif); margin: 4px 0 6px; }
#next .sub { color: var(--muted); font-size: 14px; max-width: 68ch; }
#next button { font-size: 15.5px; padding: 11px 24px; border-radius: 10px; flex: none; }
#next.review button { background: var(--due); border-color: var(--due); }

#scroll { overflow-x: auto; padding: 14px 24px 70px; }
#tree { position: relative; width: 1100px; margin: 0 auto; }
#tree > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
#tree > svg path { fill: none; stroke: var(--line); stroke-width: 2; transition: stroke .4s, opacity .4s; }
#tree > svg path.far { opacity: .45; }
/* a line turns green once the topic above it has had all its core problems tried, and draws itself the moment that happens */
#tree > svg path.done { stroke: var(--done); opacity: .7; }
#tree > svg path.draw { stroke-dasharray: 1; animation: draw 1.1s ease-out; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
/* a topic is quiet until there is progress in it: colour on the tree always means something */
.node { position: absolute; width: 170px; height: 64px; margin-left: -85px; padding: 9px 12px 0; background: var(--panel); border: 1.5px solid var(--line);
  border-radius: 12px; cursor: pointer; text-align: center; font-weight: 500; font-size: 14px; color: var(--text); }
.node:hover { border-color: var(--muted); }
.node.open { border-color: var(--text); }
/* topics further down the tree stay faint until the ones above them are done: they still open when clicked */
.node.far { opacity: .5; }
.node.far:hover, .node.far.open { opacity: 1; }
.node.core { border-color: var(--done); }
.node.here { border-color: var(--due); box-shadow: 0 0 0 4px rgba(232, 196, 104, .16); animation: here 2.8s ease-in-out infinite; }
@keyframes here { 50% { box-shadow: 0 0 0 10px rgba(232, 196, 104, .05); } }
.node .ico { width: 15px; height: 15px; margin: 0 6px -2px 0; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.node.complete { background: var(--done); border-color: var(--done); color: var(--ink); }
.node .bar { margin-top: 7px; }
.node.complete .bar { background: rgba(15, 19, 24, .25); }
.node.complete .bar i { background: var(--ink); }
.node small { display: block; margin-top: 1px; font-weight: 400; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.node.complete small { color: var(--ink); }
.node .name, .node small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--panel); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .2s; overflow-y: auto; padding: 0 28px 80px; z-index: 5; }
/* the bar that stays at the top of the panel: Close is always in the same place, and the topic's name appears once its heading has scrolled away */
#panelTop { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -28px 8px; padding: 12px 28px;
  background: var(--panel); }
/* no line under it: the page's own top bar has one at the same height, and the two read as a single line cutting through the panel.
   What scrolls under the bar fades out instead. */
#panelTop::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 18px; background: linear-gradient(var(--panel), rgba(23, 28, 34, 0));
  opacity: 0; transition: opacity .2s; pointer-events: none; }
#panelTop.scrolled::after { opacity: 1; }
#panelTitle { font: 700 17px/1.2 var(--serif); opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#panelTop.scrolled #panelTitle { opacity: 1; }
#close { flex: none; }
#panel.show { transform: none; box-shadow: -24px 0 60px rgba(0, 0, 0, .35); }
#panel h2 { margin: 0 0 8px; font: 700 25px/1.2 var(--serif); }
#panel .blurb { color: var(--muted); margin: 0 0 18px; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
/* code too wide for its box scrolls sideways: a shadow on the right edge says there is more, and goes once you reach the end */
pre { --pre-bg: var(--bg); background: linear-gradient(to left, var(--pre-bg) 35%, transparent) right / 44px 100% no-repeat local,
    linear-gradient(to left, rgba(0, 0, 0, .55), transparent) right / 18px 100% no-repeat scroll, var(--pre-bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; font: 13px/1.55 var(--mono); margin: 10px 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }

pre .k { color: #c9a9ef; } pre .s { color: #ead28b; } pre .n { color: #f3a487; } pre .c { color: var(--muted); font-style: italic; }
pre .b { color: #9cc0f5; } pre .f { color: #7fd6a4; }
.lesson { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; }
.lesson summary { font-weight: 600; }
.lesson summary span { font-weight: 400; color: var(--done); margin-left: 8px; font-size: 13px; }
.lesson p { margin: 10px 0 0; }
pre input.blank { font: inherit; color: var(--text); background: var(--raise); border: 1px solid var(--accent); border-radius: 4px; padding: 0 4px; height: 20px; margin: -1px 0; vertical-align: baseline; }
pre input.blank.wrong { border-color: var(--hard); }
.lesson .peekbtn { margin-left: 8px; }

.prob { border-top: 1px solid var(--line); }
.prob.pre { margin-left: 22px; }
.prob summary { display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.prob summary:hover .title { text-decoration: underline; text-underline-offset: 3px; }
.prob .title { flex: 1; }
.prob.s-done .title { color: var(--muted); }
.dot { flex: none; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); }
.s-done .dot { background: var(--done); border-color: var(--done); }
.s-due .dot { background: var(--due); border-color: var(--due); }
.s-wait .dot { border-color: var(--done); }
.note { flex: none; font-size: 12px; color: var(--muted); }
.s-due .when { color: var(--due); }
.ext { flex: none; text-decoration: none; color: var(--muted); padding: 0 2px; }
.ext:hover { color: var(--text); }
.tag { flex: none; min-width: 52px; text-align: right; font-size: 12.5px; font-weight: 500; }
.E { color: var(--easy); } .M { color: var(--med); } .H { color: var(--hard); }

.probs { margin: 20px 0 8px; font-weight: 400; }
/* the problem you have open becomes a card of its own, so it is clear where it starts and ends */
.prob[open] { margin: 10px -14px 12px; padding: 0 14px 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.prob.pre[open] { margin-left: 8px; }
.prob[open] + .prob { border-top-color: transparent; }
.prob[open] > summary .title { font-weight: 600; }
.prob[open] pre { --pre-bg: var(--panel); }
.prob[open] input[type=text], .prob[open] textarea { background: var(--panel); }
.work { padding: 0 0 10px; }
.hops { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.hop { max-width: 49%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: none; border: 0; padding: 2px 0; color: var(--muted); font-size: 13px; }
/* the three things you do with a problem, in order */
.phase { padding: 14px 0 6px; border-top: 1px solid var(--line); }
.phase h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.phase .rule:last-child { margin-bottom: 4px; }
.hop:hover { color: var(--text); }
.gonext { margin-top: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.rule { color: var(--muted); font-size: 13px; margin: 8px 0 12px; }
.level { border-left: 2px solid var(--line); padding: 2px 0 2px 14px; margin: 12px 0; }
.level p { margin: 0 0 6px; }
.level ol { margin: 0; padding-left: 20px; }
.level li { margin-bottom: 4px; }
.hintbtn { width: 100%; margin: 2px 0 6px; text-align: left; border-style: dashed; }
.rate button { flex: 1; min-width: max-content; border-color: var(--muted); }
.rate button:hover { border-color: var(--text); }
.rate { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rate .label { width: 100%; margin: 0; }
.msg { margin: 10px 0 0; color: var(--done); font-size: 14px; }
.bad { color: var(--hard); }
.bigo { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bigo button { font-family: var(--mono); font-size: 13px; }
.bigo .right { border-color: var(--done); color: var(--done); }
.bigo .wrong { border-color: var(--hard); color: var(--hard); }
textarea, input[type=text] { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; }
.recall p { margin: 4px 0 8px; }
.recall button { margin-top: 8px; }
.notebox { margin-top: 18px; }
/* feedback on a problem's page, tucked away at the bottom of the card */
.fixbox { margin-top: 16px; padding-top: 10px; border-top: 1px dashed var(--line); }
.fixbox > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.fixbox > summary span { margin-left: 8px; color: var(--done); }
.fixbox[open] > summary { margin-bottom: 8px; }
.fixtags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.fixtags button { font-size: 12.5px; padding: 3px 9px; }
.fixbox .rule { margin: 6px 0 0; }
.fixrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.fixrow > button.reflink { justify-self: start; margin: 0; }
.fixrow small { grid-column: 1; color: var(--muted); }
.fixrow p { grid-column: 1; margin: 4px 0 0; white-space: pre-wrap; }
.fixrow .fixdel { grid-column: 2; grid-row: 1 / span 3; align-self: center; font-size: 13px; }
#pfix .actions { margin-top: 12px; display: flex; align-items: center; gap: 12px; }
#pfix .actions .rule { margin: 0; }
/* the front page */
#home { padding-bottom: 60px; }
#hero { padding: 56px 0 40px; display: grid; grid-template-columns: minmax(0, 760px) minmax(180px, 1fr); grid-template-areas: "text duck"; gap: 24px 48px; }
.herotext { grid-area: text; }
/* the duck beside the headline, with a speech bubble that points down at it */
.mascot { grid-area: duck; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.bubble { position: relative; max-width: 250px; margin: 0 0 14px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; font-size: 14.5px; }
.bubble::after { content: ""; position: absolute; left: 34%; bottom: -7px; width: 12px; height: 12px; background: var(--panel); border: solid var(--line); border-width: 0 1px 1px 0; transform: rotate(45deg); }
.duck { width: min(100%, 270px); }
.duck .d-float { animation: bob 4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.d-body { fill: var(--duck); } .d-wing { fill: var(--duck-shade); } .d-beak { fill: var(--beak); } .d-bill { fill: var(--beak-shade); }
.d-eye { fill: var(--ink); } .d-shine { fill: #fff; } .d-cheek { fill: var(--beak); opacity: .35; } .d-collar { fill: var(--text); }
.d-tie { fill: var(--accent); } .d-knot { fill: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.d-line { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; } .d-water { fill: none; stroke: var(--line); stroke-width: 3; stroke-linecap: round; }
/* on a narrow screen the duck sits small above the headline, talking sideways */
@media (max-width: 860px) {
  #hero { grid-template-columns: 1fr; grid-template-areas: "duck" "text"; padding-top: 28px; }
  .mascot { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; }
  .duck { width: 92px; flex: none; transform: scaleX(-1); }   /* face the bubble */
  .bubble { margin: 0; }
  .bubble::after { left: -7px; top: 40%; bottom: auto; border-width: 0 0 1px 1px; }
}
#hero h2 { font: 700 clamp(30px, 4.6vw, 44px)/1.12 var(--serif); margin: 0 0 16px; letter-spacing: -.012em; }
#hero p { margin: 0 0 26px; color: var(--muted); font-size: 16px; line-height: 1.6; max-width: 62ch; }
#heroNext { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
#heroNext > div { flex: 1; min-width: min(100%, 220px); }
#heroNext .label { margin: 0 0 2px; color: var(--accent); }
#heroNext b { font: 700 21px/1.2 var(--serif); }
#heroNext button, #heroNext .btn { font-size: 15px; padding: 10px 20px; border-radius: 10px; }
/* today's goal and the streak: the one thing meant to pull you back tomorrow. A soft glow in the corner turns green when the day is done. */
.goal { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 26px; margin-top: 12px; padding: 18px 22px; border: 1px solid var(--line); border-radius: 16px;
  background: radial-gradient(120% 150% at 0% 0%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 55%), var(--panel); }
.goal.all { border-color: color-mix(in srgb, var(--done) 45%, var(--line));
  background: radial-gradient(120% 150% at 0% 0%, color-mix(in srgb, var(--done) 14%, transparent), transparent 55%), var(--panel); }
/* one segment per part of the day, lit green as each is done */
.ringwrap { position: relative; flex: none; width: 84px; height: 84px; }
.goalring { width: 100%; height: 100%; transform: rotate(-90deg); fill: none; overflow: visible; }
.goalring circle { stroke: var(--line); stroke-width: 3.4; stroke-linecap: round; }
.goalring circle.on { stroke: var(--done); filter: drop-shadow(0 0 2.5px color-mix(in srgb, var(--done) 65%, transparent)); animation: lit .7s ease-out backwards; }
@keyframes lit { from { stroke: var(--line); filter: none; } }
.ringwrap span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ringwrap b { font: 700 27px/1 var(--serif); font-variant-numeric: tabular-nums; }
.ringwrap small { margin-top: 3px; color: var(--muted); font-size: 11.5px; }
.goal.all .ringwrap b { color: var(--done); }
.goal .tx { flex: 1; min-width: min(100%, 240px); display: flex; flex-direction: column; gap: 2px; }
.goal .tx > b { font-size: 16px; font-weight: 600; }
.goal .tx > span { color: var(--muted); font-size: 13.5px; }
/* each part with a tick that fills in */
.goal .parts { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.goal .part { display: inline-flex; align-items: center; gap: 7px; padding: 0; background: none; border: 0; color: var(--muted); font-size: 13.5px; }
.goal button.part:hover { color: var(--text); }
.goal .part svg { flex: none; width: 17px; height: 17px; padding: 2px; border: 1.5px solid var(--line); border-radius: 50%;
  fill: none; stroke: transparent; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.goal .part.on { color: var(--text); }
.goal .part.on svg { background: var(--done); border-color: var(--done); stroke: var(--ink); }
.goal .part small { color: var(--due); font-size: 12px; }
.goal .days { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.streakn { display: flex; align-items: center; gap: 9px; }
.streakn b { font: 700 32px/1 var(--serif); color: var(--due); font-variant-numeric: tabular-nums; }
.streakn span { display: flex; flex-direction: column; color: var(--muted); font-size: 13px; line-height: 1.3; }
.streakn small { font-size: 12px; }
/* the last seven days, filled where you solved or reviewed something */
.week { display: inline-flex; gap: 4px; vertical-align: -3px; }
.week i { width: 20px; height: 20px; border-radius: 5px; border: 1px solid var(--line); background: var(--raise); color: var(--muted);
  font: 500 10.5px/18px var(--sans); font-style: normal; text-align: center; }
.week i.on { background: var(--done); border-color: var(--done); color: var(--ink); }
.week i.now { border-color: var(--text); }
.overall .week { margin-left: 8px; gap: 3px; }
.overall .week i { width: 13px; height: 13px; border-radius: 3px; font-size: 0; }
#home > .label { margin: 0 0 10px; }
/* the Today page: the day's three things, one under the other, each ready to start */
#todayView { max-width: 860px; padding: 36px 0 70px; }
#todayView > h2 { font: 700 clamp(28px, 4vw, 38px)/1.1 var(--serif); margin: 0 0 2px; }
.tdate { margin: 0 0 16px; color: var(--muted); }
#todayView .goal { margin: 0 0 22px; }
.tsep { margin: 28px 0 24px; border: 0; border-top: 1px solid var(--line); }
.tpart { margin-bottom: 16px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.tpart.done { border-color: color-mix(in srgb, var(--done) 45%, var(--line)); }
.thead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.thead h3 { margin: 0; font: 700 20px/1.2 var(--serif); }
.tstate { font-size: 13px; color: var(--muted); }
.tpart.done .tstate { color: var(--done); font-weight: 500; }
.tpart h4 { margin: 0 0 6px; font-size: 17px; font-weight: 600; }
.tpart p { margin: 0 0 12px; max-width: 72ch; }
.tpart .tsub { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
/* the problem card sits open here, with its title as a heading that does not fold */
.tpart .prob, .tpart .prob[open] { margin: 0; padding: 0; background: none; border: 0; }
.tpart .prob > summary { pointer-events: none; padding-top: 0; list-style: none; }
.tpart .prob > summary::-webkit-details-marker { display: none; }
.tpart .prob > summary .title { font-size: 17px; }
#home .gcards { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.door { color: inherit; text-decoration: none; border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.door:hover { border-color: var(--muted); background: var(--raise); }
.door:first-child { grid-column: span 2; }
.door .bar { margin-top: 2px; }
#alsoToday { margin: 0 0 14px; }
#alsoToday .label { margin: 18px 0 8px; }
#alsoToday .gcards { grid-template-columns: 1fr 1fr; margin-bottom: 0; }
#moreTopics, #qsPick { display: none; }
#qsPick { width: 100%; padding: 10px 12px; background: var(--raise); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 16px; }
#insight { margin: 0 0 6px; max-width: 76ch; color: var(--muted); font-size: 13.5px; }
.quiz .what { font: 700 22px/1.25 var(--serif); margin: 10px 0 16px; }
.opts { display: grid; gap: 8px; }
.opts button { text-align: left; padding: 11px 15px; font-size: 15px; }
.opts .right { border-color: var(--done); color: var(--done); }
/* a mark as well as a colour, so right and wrong can be told apart without relying on green and red */
.opts .right::before { content: "✓  "; }
.opts .wrong::before { content: "✗  "; }
.opts .wrong { border-color: var(--hard); color: var(--hard); }

/* the timer: a ring that empties, the time left, and the problem it is for */
#chip { position: fixed; left: 18px; bottom: 18px; z-index: 6; display: none; align-items: center; gap: 12px; background: var(--raise); border: 1px solid var(--line);
  border-radius: 28px; padding: 8px 10px 8px 9px; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); max-width: calc(100vw - 36px); transition: border-color .3s; }
#chip.show { display: flex; }
#chip svg { width: 38px; height: 38px; flex: none; transform: rotate(-90deg); fill: none; stroke-width: 3.5; }
#chip circle { stroke: var(--line); }
#chip #chipRing { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 1; transition: stroke-dashoffset 1s linear, stroke .3s; }
#chip .when { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
#chipTime { font: 500 19px/1.15 var(--mono); }
#chipText { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
#chip button { border-radius: 14px; padding: 4px 12px; background: var(--panel); }
/* the last two minutes turn yellow, and the chip pulses once time is up */
#chip.low #chipRing { stroke: var(--due); }
#chip.low #chipTime, #chip.up #chipTime { color: var(--due); }
#chip.up { border-color: var(--due); animation: timeup 1.8s ease-in-out infinite; }
#chip.up #chipTime { font: 600 16px/1.3 var(--sans); }
#chip.up #chipText { color: var(--text); }
@keyframes timeup { 50% { box-shadow: 0 6px 20px rgba(0, 0, 0, .4), 0 0 0 8px rgba(232, 196, 104, .12); } }

/* ---- reference tabs ---- */
#ref, #qs, #games { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; padding: 30px 0 90px; }
/* a row that scrolls sideways fades out at whichever end has more to show */
.more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent); }
.more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 48px), transparent); }
.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, #000 48px, #000 calc(100% - 48px), transparent); }
#tabs, #refList, #gameList, #qsNav { scrollbar-width: none; }
#qsBody h2.long { font: 500 20px/1.4 var(--sans); margin-bottom: 14px; max-width: 72ch; }
#refList, #gameList, #qsNav { display: flex; flex-direction: column; align-self: start; position: sticky; top: 80px; }
#refList button, #gameList button, #qsNav button { text-align: left; background: none; border: 0; border-left: 2px solid var(--line); border-radius: 0; padding: 7px 14px; color: var(--muted); font-size: 14px; }
#refList button:hover, #gameList button:hover, #qsNav button:hover { color: var(--text); }
#refList button.on, #gameList button.on, #qsNav button.on { color: var(--text); border-left-color: var(--text); font-weight: 500; }
#refBody h2, #qsBody h2, #gameBody h2 { font: 700 30px/1.15 var(--serif); margin: 0 0 6px; }
#refBody .blurb, #gameBody .blurb { color: var(--muted); font-size: 16px; margin: 0 0 20px; max-width: 68ch; }
#refBody .backbtn { margin-bottom: 18px; }
.gback { display: none; margin-bottom: 14px; }
.ghops { margin: 26px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.ghops .hop { font-size: 14px; padding: 6px 0; }
.viz { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
#stage { display: flex; min-height: 340px; padding: 22px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.frame { margin: auto; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; }
#vcode { margin: 0; padding: 16px 0; border-radius: 14px; font-size: 12.5px; }
#vcode .ln { display: block; min-height: 1.55em; padding: 0 16px 0 14px; border-left: 2px solid transparent; transition: background .2s; }
#vcode .ln.on { background: rgba(242, 207, 107, .11); border-left-color: var(--due); }
#vcap { min-height: 4.6em; margin: 18px 0 12px; max-width: 74ch; font-size: 16.5px; line-height: 1.5; }
.vctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vctl button { min-width: 78px; }
#vrange { flex: 1; min-width: 140px; accent-color: var(--accent); }
#vcount { min-width: 92px; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.vrow { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.vlabel { font: 12.5px var(--mono); color: var(--muted); }
.vrow, .vcells { width: 100%; }
.vcells { display: flex; justify-content: center; gap: 5px; }
.vcell { flex: 0 1 42px; min-width: 0; display: flex; flex-direction: column; align-items: center; transition: opacity .25s; }
.vcell.wide { flex-basis: 66px; }
.vcell.none { flex-basis: 70px; }
.vcell i { height: 15px; font: 11px/15px var(--mono); color: var(--muted); }
.vcell b { display: grid; place-items: center; width: 100%; height: 42px; background: var(--bg); border: 1.5px solid var(--line); border-radius: 9px;
  font: 500 15px var(--mono); white-space: pre; transition: background .25s, border-color .25s, color .25s; }
.vcell.wide b { font-size: 12.5px; }
.vcell u { height: 18px; font-size: 12.5px; font-weight: 500; color: var(--due); text-decoration: none; white-space: nowrap; }
.vcell.hi b { border-color: var(--due); }
.vcell.acc b { border-color: var(--accent); background: rgba(143, 180, 242, .12); }
.vcell.ok b { background: var(--done); border-color: var(--done); color: var(--ink); }
.vcell.new b { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.vcell.dim { opacity: .35; }
.vcell.none b { border-style: dashed; color: var(--muted); font: 12.5px var(--sans); }
.vvars { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.vvars span { padding: 3px 10px; border: 1px solid var(--line); border-radius: 7px; font: 12.5px var(--mono); }

.vgraph { display: block; width: 100%; height: auto; overflow: visible; }
.vedge { stroke: var(--muted); stroke-width: 2; transition: stroke .25s, opacity .25s; }
.vedge.hi { stroke: var(--due); }
.vedge.acc { stroke: var(--accent); }
.vedge.ok { stroke: var(--done); }
.vedge.dim { opacity: .25; }
.vedge.ghost { opacity: 0; }
.vnode { transition: opacity .25s; }
.vnode circle { fill: var(--bg); stroke: var(--muted); stroke-width: 2; transition: fill .25s, stroke .25s; }
.vnode text { fill: var(--text); font: 500 14px var(--mono); text-anchor: middle; transition: fill .25s; }
.vnode.small text { font-size: 11px; }
.vnode text.vtag { fill: var(--due); font: 500 12.5px var(--sans); }
.vnode.hi circle { stroke: var(--due); stroke-width: 3; }
.vnode.acc circle { stroke: var(--accent); fill: #253446; }
.vnode.ok circle { fill: var(--done); stroke: var(--done); }
.vnode.new circle { fill: var(--accent); stroke: var(--accent); }
.vnode.ok text:not(.vtag), .vnode.new text:not(.vtag) { fill: var(--ink); }
.vnode.end circle { stroke-width: 5; }
.vnode.dim { opacity: .3; }
.vnode.ghost { opacity: 0; }

/* ---- questions tab ---- */
#qsNav .label, #refList .label, #gameList .label { margin: 16px 0 4px 14px; }
#qsNav .label:first-child, #refList .label:first-child, #gameList .label:first-child { margin-top: 0; }
#qsNav button { display: flex; justify-content: space-between; gap: 10px; }
#qsNav small { flex: none; font-size: 12px; font-variant-numeric: tabular-nums; }
.qfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 22px; font-size: 13px; color: var(--muted); }
.qfilters span { margin: 0 2px 0 10px; }
.qfilters span:first-child { margin-left: 0; }
.qfilters button { padding: 3px 10px; font-size: 13px; color: var(--muted); }
.qfilters button.on { color: var(--text); border-color: var(--text); }
.qmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.qmeta .tag { min-width: 0; }
.qmeta .was { margin-left: auto; }
.qprompt { margin: 0 0 12px; max-width: 72ch; font-size: 16.5px; }
#qsBody pre { max-width: 100%; margin: 0 0 16px; }
#qsBody .opts { max-width: 760px; }
#qsBody .opts button { line-height: 1.4; white-space: pre-line; }
#qsBody .level { max-width: 74ch; }
#qsBody .level p { margin-bottom: 10px; }
#qsBody .vctl { margin-top: 22px; }
.qsets { margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--line); }
.qsets summary { padding: 4px 0; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.qsets > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.qsets input { flex: 1; min-width: 180px; max-width: 300px; }
.qsets button.on { border-color: var(--done); color: var(--done); }

/* "Practise it first" on a system design question: one step at a time, then a score */
#dprac { margin: 6px 0 30px; padding: 18px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
#dprac p { margin: 0 0 12px; max-width: 72ch; }
.dhead { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dhead b { font: 700 19px/1.2 var(--serif); }
.dhead .tag { min-width: 0; text-align: left; }
#dprac .prompt { font-size: 16px; color: var(--text); padding-left: 12px; border-left: 2px solid var(--accent); }
#dprac .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; }
#dprac .rule { margin: 0; }
.dsteps { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px; padding: 0; list-style: none; counter-reset: step; }
.dsteps li { counter-increment: step; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--muted); }
.dsteps li::before { content: counter(step) ". "; }
.dsteps li.done { border-color: var(--done); color: var(--done); }
.dsteps li.on { border-color: var(--text); color: var(--text); font-weight: 500; }
.dnote { width: 100%; padding: 10px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: inherit; font-size: 14.5px; resize: vertical; }
.dnote:focus { outline: none; border-color: var(--accent); }
.dpoints { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.dpoints label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; background: var(--raise); border-radius: 8px; cursor: pointer; }
.dpoints input { margin-top: 4px; accent-color: var(--done); }
.dpoints label:has(input:checked) { box-shadow: inset 2px 0 0 var(--done); }
.dscore { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 12px; }
.dscore b { font: 700 24px/1.2 var(--serif); }
.dscore span { color: var(--muted); }
.dtable { border-collapse: collapse; margin-bottom: 12px; font-size: 14px; }
.dtable td { padding: 4px 18px 4px 0; border-bottom: 1px solid var(--line); }
.dtable tr.weak td { color: var(--due); }
#refList button small { margin-left: 8px; font-size: 11.5px; color: var(--done); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.facts h3 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.facts p { margin: 0; }
.facts table { width: 100%; border-collapse: collapse; }
.facts td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.facts td:last-child { padding-left: 14px; text-align: right; white-space: nowrap; font: 13px var(--mono); }
.practise { margin: 26px 0 0; color: var(--muted); }
.reflink { padding: 3px 10px; margin: 2px 2px 2px 0; font-size: 13px; }
/* ---- pop-ups: search ---- */
dialog { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 0; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); }
dialog::backdrop { background: rgba(8, 10, 13, .66); }

/* ---- the Progress page ---- */
#progressView { max-width: 900px; padding: 36px 0 70px; }
.phead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 16px; }
.phead h2 { margin: 0; font: 700 clamp(28px, 4vw, 38px)/1.1 var(--serif); }
#acct { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: 13.5px; }
#acct.warn span { color: var(--due); }
.pcard { margin-bottom: 16px; padding: 20px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.pcard > h3 { margin: 0 0 12px; font: 700 19px/1.2 var(--serif); }
#progressView .sub { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
/* how ready you are: the one big number, in a ring that sweeps from blue to green */
#ready { display: flex; flex-wrap: wrap; align-items: center; gap: 20px 32px; padding: 26px 28px;
  background: radial-gradient(90% 130% at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(80% 120% at 100% 100%, color-mix(in srgb, var(--done) 10%, transparent), transparent 60%), var(--panel); }
.rring { position: relative; flex: none; width: 150px; height: 150px; }
.rring svg { width: 100%; height: 100%; transform: rotate(-90deg); fill: none; }
.rring .track { stroke: var(--raise); stroke-width: 9; }
.rring .arc { stroke: url(#readyGrad); stroke-width: 9; stroke-linecap: round; filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 35%, transparent));
  animation: sweep 1.2s .1s cubic-bezier(.2, .7, .2, 1) backwards; }
@keyframes sweep { from { stroke-dasharray: 0 400; } }
.rring span { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.rring b { font: 700 40px/1 var(--serif); font-variant-numeric: tabular-nums; }
.rring small { margin-top: 4px; color: var(--muted); font-size: 13px; }
.rtext { flex: 1; min-width: min(100%, 260px); }
.rtext h3 { margin: 0 0 6px; font: 700 24px/1.2 var(--serif); }
.rtext p { margin: 0 0 6px; color: var(--muted); }
.rtext .rnext { color: var(--text); font-weight: 500; }
.rdream { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 6px; color: var(--muted); font-size: 13.5px; }
.rdream input { flex: 1; min-width: 180px; padding: 7px 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 14px; }
.rdream input:focus { outline: none; border-color: var(--accent); }
.rtext .rhow { font-size: 12.5px; }
/* everything done so far, counted */
#ptotals { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.ptile { padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.ptile b { display: block; font: 700 28px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.ptile span { color: var(--muted); font-size: 13px; }
/* one row per area: its share of being ready, a bar, and the numbers in words. A row leads to that area. */
.parea { display: grid; grid-template-columns: 170px minmax(0, 1fr); grid-template-areas: "name bar" "name text"; gap: 4px 16px; width: calc(100% + 16px);
  margin: 0 -8px; padding: 10px 8px; background: none; border: 0; border-radius: 8px; text-align: left; }
.parea:hover { background: var(--raise); border: 0; }
.pname { grid-area: name; display: flex; flex-direction: column; font-weight: 600; }
.pname small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.pbar { grid-area: bar; align-self: center; height: 10px; border-radius: 99px; background: var(--raise); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--done)); }
.ptext { grid-area: text; color: var(--muted); font-size: 13px; }
/* the goal block sits inside a card here, so it drops its own frame */
#ptoday .goal { margin: 0; padding: 0; border: 0; background: none; }
#heat { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; grid-template-rows: repeat(7, auto); gap: 3px; }
#heat i { aspect-ratio: 1; border-radius: 3px; background: var(--raise); }
/* one colour, brighter for more: a day with one problem, with two or three, with four or more */
#heat .l1, .key .l1 { background: #24473a; } #heat .l2, .key .l2 { background: #4b9272; } #heat .l3, .key .l3 { background: var(--done); }
#heat .q { background: none; box-shadow: inset 0 0 0 1.5px #4b9272; }
#heat .now { outline: 1.5px solid var(--text); outline-offset: 1px; }
#heat .off { visibility: hidden; }
.heatfoot { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.key { display: flex; align-items: center; gap: 3px; flex: none; }
.key i { width: 11px; height: 11px; border-radius: 3px; background: var(--raise); }
.key span { margin: 0 4px; }
.pace { padding: 0 0 16px; }
.pace p { margin: 0; }
#progressView .pace .sub { margin: 4px 0 10px; }
.pace label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
input[type=date] { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font: inherit; font-size: 14px; }
#progressView table { width: 100%; border-collapse: collapse; border-top: 1px solid var(--line); }
#progressView td { padding: 8px 0; border-bottom: 1px solid var(--line); }
#progressView td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#progressView .stuck { margin: 14px 0 0; color: var(--muted); font-size: 13.5px; }
/* one row per question set: its name, a bar split into right, wrong and not answered, and the numbers in words */
.skey { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; }
.skey i { width: 10px; height: 10px; border-radius: 2px; background: var(--line); }
.skey i:not(:first-child) { margin-left: 10px; }
.setrow { display: grid; grid-template-columns: 138px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: calc(100% + 16px); margin: 0 -8px; padding: 6px 8px;
  background: none; border: 0; border-radius: 6px; text-align: left; font-size: 14px; }
.setrow:hover { background: var(--raise); }
.sbar { display: flex; gap: 2px; height: 8px; }
.sbar i { min-width: 3px; border-radius: 2px; background: var(--line); }
.sbar .ok, .skey .ok { background: var(--done); }
.sbar .no, .skey .no { background: var(--hard); }
.setrow small { min-width: 150px; text-align: right; color: var(--text); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.setrow small b { font-weight: 400; color: var(--muted); }
#reset { margin-top: 6px; background: none; color: var(--muted); }
#reset:hover { color: var(--hard); border-color: var(--hard); }

#find { width: min(580px, calc(100vw - 24px)); margin-top: 11vh; }
#findIn { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 16px 20px; font-size: 17px; }
#findIn:focus { outline: none; border-bottom-color: var(--accent); }
#findList button { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left; background: none; border: 0; border-radius: 0; padding: 9px 20px; font-size: 15px; }
#findList button.on { background: var(--raise); }
#findList small { margin-left: auto; flex: none; color: var(--muted); font-size: 12.5px; }
#findList .dot { align-self: center; }
#find .rule { margin: 0; padding: 10px 20px 12px; }

/* ---- small rewards ---- */
#toast { position: fixed; left: 50%; bottom: 26px; z-index: 8; transform: translate(-50%, 24px); opacity: 0; pointer-events: none; width: max-content; max-width: min(540px, calc(100vw - 32px));
  background: var(--text); color: var(--ink); font-weight: 500; padding: 11px 18px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); transition: transform .25s, opacity .25s; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 9; pointer-events: none; }
.dot.pop { animation: pop .55s ease-out; }
@keyframes pop { 40% { transform: scale(2); } }
.opts.now .right { animation: nod .35s ease-out; }
@keyframes nod { 50% { transform: scale(1.015); } }
.opts.now .wrong { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ---- mock interview ---- */
.say { margin: 0 0 14px; padding-left: 22px; }
.say li { margin-bottom: 6px; }
.mockmeta .tag { min-width: 0; }
.mockmeta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13.5px; }

/* ---- questions: how the set is going ---- */
.qhead { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.qhead .ring { flex: none; width: 46px; height: 46px; transform: rotate(-90deg); }
.qhead .ring circle { fill: none; stroke: var(--line); stroke-width: 5; }
.qhead .ring circle + circle { stroke: var(--done); stroke-linecap: round; }
.qhead b { display: block; font: 700 19px/1.25 var(--serif); }
.qhead small { color: var(--muted); font-size: 13.5px; }
.qstrip { display: flex; gap: 2px; margin-bottom: 20px; }
.qstrip button { flex: 1; min-width: 0; height: 14px; padding: 0; border: 0; border-radius: 2px; background: var(--raise); }
.qstrip .ok { background: var(--done); }
.qstrip .no { background: var(--hard); }
.qstrip .cur { outline: 2px solid var(--text); outline-offset: 1px; }
.keys { margin: 14px 0 0; }
/* boxes in a system diagram take the same colours as the circles */
.vnode rect { fill: var(--bg); stroke: var(--muted); stroke-width: 2; transition: fill .25s, stroke .25s; }
.vnode.hi rect { stroke: var(--due); stroke-width: 3; }
.vnode.acc rect { stroke: var(--accent); fill: #253446; }
.vnode.ok rect { fill: var(--done); stroke: var(--done); }
.vnode.new rect { fill: var(--accent); stroke: var(--accent); }
.vnode.box text { font: 500 12.5px var(--sans); }
/* the panel beside the picture, when it holds a list of points and not code */
#vcode.text { white-space: pre-wrap; font: 14px/1.45 var(--sans); }
#vcode.text .ln { padding-top: 5px; padding-bottom: 5px; }
.facts.plain td:first-child { width: 38%; vertical-align: top; }
.facts.plain td:last-child { text-align: left; white-space: normal; font: inherit; font-size: 14px; color: var(--muted); padding-left: 18px; }
.vw { fill: var(--muted); font: 500 12.5px var(--mono); text-anchor: middle; paint-order: stroke; stroke: var(--panel); stroke-width: 6px; }

/* ---- games ---- */
.hud { display: flex; flex-wrap: wrap; gap: 4px 26px; margin: 2px 0 10px; font-size: 14px; color: var(--muted); }
.hud b { margin-left: 7px; color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.hud .lives { letter-spacing: 3px; color: var(--hard); }
.gtime { margin-bottom: 14px; }
.gtime i { background: var(--accent); transition: width .2s linear; }
.gtime.low i { background: var(--hard); }
#gStage { display: flex; min-height: 430px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
#gStage > * { margin: auto; }
#gStage.flat { min-height: 230px; padding: 28px 16px; }
/* the front page of the tab: a card for each game */
.gcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 26px; }
#gameBody h3.label { margin: 0 0 8px; }
.gcard { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; text-align: left; background: var(--panel); border-radius: 12px; }
.gcard b { font: 700 18px/1.2 var(--serif); }
.gcard span { flex: 1; color: var(--muted); font-size: 14px; line-height: 1.4; }
.gcard small { color: var(--due); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.gcard.wide { grid-column: 1 / -1; border-color: var(--accent); }
.gcard.wide b { font-size: 22px; }
#gStage.live .vnode { cursor: pointer; }
#gStage.live .vnode:hover circle { stroke: var(--text); }
/* a wrong pick: red, with a shake */
.vnode.bad circle { stroke: var(--hard); fill: #4a2a26; animation: shake .3s; }
/* an unseen circle over each node, bigger than the one drawn, so nodes are easy to hit with a finger */
.vnode circle.vhit { fill: transparent !important; stroke: none !important; animation: none; }
.ghelp { margin-top: 12px; }
/* the grid runner: squares for the boxes, and dark ones for the walls */
#gStage.live .vnode:hover rect { stroke: var(--text); }
.vnode.bad rect { stroke: var(--hard); fill: #4a2a26; animation: shake .3s; }
.vnode.wall rect { fill: var(--line); stroke: var(--line); }
#gStage.live .vnode.wall { cursor: default; }
/* the games that are not pictures: everything on the stage in one centred column */
.gcol { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 720px; }
.gcol pre { align-self: stretch; margin: 0; }
.gcol .rule, .gcol .label { margin: 0; }
.gask { font: 700 26px/1.25 var(--serif); text-align: center; max-width: 30ch; }
.gask b { color: var(--due); }
.gkeys { margin-top: 12px; }
.gkeys button { padding: 10px 16px; font-size: 15px; }
.gkeys small, .gpick small { margin-left: 4px; color: var(--muted); font: 12px var(--mono); }
.primary small { color: inherit; opacity: .7; }
/* Halving: a row of boxes to look inside */
.hrow { display: flex; justify-content: center; gap: 5px; width: 100%; }
.hrow button { flex: 0 1 46px; min-width: 0; height: 46px; padding: 0; background: var(--bg); border-width: 1.5px; border-radius: 9px; color: var(--muted); font: 500 15px var(--mono); }
.hrow .seen { color: var(--text); border-color: var(--muted); }
.hrow .ok { background: var(--done); border-color: var(--done); color: var(--ink); }
.hrow .hi { border-color: var(--due); border-width: 3px; color: var(--text); }
.hrow .out { opacity: .3; }
/* quick picks: the answers, and the fuse that burns down under the question */
.gpick { grid-template-columns: 1fr 1fr; margin-top: 12px; }
.gpick.three { grid-template-columns: 1fr 1fr 1fr; }
.gpick small { margin: 0 6px 0 0; }
.gfuse { align-self: stretch; }
.gfuse i { background: var(--due); transition: width .2s linear; }
.gmsg { min-height: 3.1em; margin: 14px 0 12px; max-width: 72ch; font-size: 16px; }
.gresult { text-align: center; }
.gresult p { margin: 6px 0 0; }
.gscore { display: block; margin: 6px 0 2px; font: 700 64px/1 var(--serif); color: var(--due); font-variant-numeric: tabular-nums; }
button[aria-pressed=true] { border-color: var(--accent); color: var(--accent); }

@media (max-width: 860px) {
  #ref, #qs, #games { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-top: 18px; }
  #refList, #gameList, #qsNav { position: static; flex-direction: row; overflow-x: auto; }
  #refList button, #gameList button, #qsNav button { flex: none; border-left: 0; border-bottom: 2px solid var(--line); white-space: nowrap; }
  #refList button.on, #gameList button.on, #qsNav button.on { border-bottom-color: var(--text); }
  #qsNav .label, #refList .label, #gameList .label { flex: none; align-self: center; margin: 0 4px 0 14px; white-space: nowrap; }
  #qsNav .label:first-child, #refList .label:first-child, #gameList .label:first-child { margin-left: 0; }
  .viz, .facts { grid-template-columns: minmax(0, 1fr); }
  .facts { gap: 24px; }
  #stage { min-height: 0; padding: 18px 10px; }
  #gStage { min-height: 340px; padding: 10px 4px; }
  #gStage.flat { min-height: 0; padding: 22px 8px; }
  /* the question sets become one drop-down */
  #qsNav button, #qsNav .label { display: none; }
  #qsPick { display: block; }
  /* the list of games is the front page here, so the strip of names goes, and a round hides everything that is not the game */
  #gameList, #games.playing .blurb, #games.playing .gback { display: none; }
  .gback { display: inline-block; }
  #games.playing h2 { font-size: 17px; margin-bottom: 8px; }
  #games.playing .gmsg { margin: 10px 0 8px; font-size: 15px; }
}

/* eight tabs and three buttons need the short names sooner */
@media (max-width: 1400px) {
  #tabs .long { display: none; }
  #tabs .short { display: inline; }
}
/* narrower than this the tabs no longer fit in one row: the menu button takes their place */
@media (max-width: 1160px) {
  #tabs, #glossBtn { display: none; }
  #menuBtn { display: flex; }
  h1 { flex: 1; }
}

/* ---- phones ---- */
@media (max-width: 700px) {
  .wrap { width: calc(100% - 32px); }
  header { height: 56px; gap: 0 8px; }
  h1 { flex: 1; font-size: 20px; }
  #meBtn { padding: 5px 10px; }
  #hero { padding: 34px 0 28px; }
  #home .gcards { grid-template-columns: 1fr 1fr; }
  #hero p { font-size: 15.5px; }
  #heroNext > div, #heroNext button, #heroNext .btn { flex: none; width: 100%; text-align: center; }
  #heroNext > div { text-align: left; }
  #roadbar { padding-top: 16px; }
  .overall { flex-basis: 100%; }
  #next { margin-top: 16px; padding: 18px; }
  #next .what { font-size: 24px; }
  #next button { width: 100%; }
  /* the tree does not fit a phone: the same topics become a list, in the order you learn them */
  #scroll { overflow: visible; padding: 10px 16px 70px; }
  #tree { width: auto; height: auto !important; display: flex; flex-direction: column; gap: 8px; }
  #tree > svg { display: none; }
  .node { position: static; width: auto; height: auto; margin: 0; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: baseline; text-align: left; font-size: 15px; }
  #tree:not(.all) .node.far ~ .node.far ~ .node.far { display: none; }
  #moreTopics { display: block; width: 100%; margin-top: 10px; padding: 12px; }
  .node .bar { grid-row: 2; grid-column: 1 / -1; margin: 0; }
  .node small { margin: 0; font-size: 12.5px; }
  #panel { padding: 0 16px 90px; }
  #panelTop { margin: 0 -16px 4px; padding: 10px 16px; }
  .prob[open] { margin: 8px -8px 10px; padding: 0 10px 4px; }
  .prob.pre[open] { margin-left: 4px; }
  #panel h2 { font-size: 22px; }
  .prob.pre { margin-left: 12px; }
  .prob summary { position: relative; flex-wrap: wrap; gap: 2px 10px; padding: 11px 0 11px 22px; }
  .prob .dot { position: absolute; left: 0; top: 16px; }
  .prob .title { flex-basis: 100%; }
  .prob .tag { margin-left: auto; }
  #refBody h2, #qsBody h2, #gameBody h2 { font-size: 25px; }
  #vcap { min-height: 6em; font-size: 15.5px; }
  .vctl button { flex: 1; }
  #vrange { flex-basis: 55%; }
  .vcells { gap: 3px; }
  .ringwrap { width: 72px; height: 72px; }
  .ringwrap b { font-size: 23px; }
  .pcard { padding: 16px; }
  #ready { padding: 20px 18px; }
  .rring { width: 120px; height: 120px; margin: 0 auto; }
  .rring b { font-size: 32px; }
  #ptotals { grid-template-columns: 1fr 1fr; }
  .ptile:last-child { grid-column: 1 / -1; }
  .parea { grid-template-columns: 1fr; grid-template-areas: "name" "bar" "text"; }
  .gpick.three { grid-template-columns: 1fr 1fr; }
  .gask { font-size: 22px; }
  /* a game's buttons sit at the bottom of the screen, under the thumbs */
  .gkeys { position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
  .gkeys button { padding: 14px 8px; }
  .gkeys button:only-child { grid-column: 1 / -1; }
  #games.playing { padding-bottom: 170px; }
  #gStage .vnode text.vtag { font-size: 14.5px; font-weight: 600; }
  .gcards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gcard { padding: 12px; }
  .gcard b { font-size: 16px; }
  .gcard span { font-size: 13px; }
  pre { font-size: 12.5px; padding: 10px 12px; }
  .heatfoot { flex-direction: column; gap: 6px; }
  .pace { align-items: flex-start; }
  .setrow { grid-template-columns: 104px minmax(0, 1fr) auto; gap: 8px; }
  .setrow small { min-width: 0; }
  #heat { gap: 2px; }
  .qstrip { gap: 1px; }
  .keys { display: none; }
}
/* fingers need bigger targets than a mouse, and iOS zooms the page for text boxes under 16px */
@media (pointer: coarse) {
  button, .btn { padding: 9px 14px; }
  #refList button, #gameList button, #qsNav button { padding: 10px 12px; }
  .qfilters button { padding: 7px 12px; }
  .reflink { padding: 7px 12px; }
  textarea, input[type=text] { font-size: 16px; }
  pre input.blank { font-size: 16px; height: 26px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
