/* Palette lifted from the lecture notes so the site and the PDFs feel like one
   thing: adlblue #1F4E79, adlgreen #1B6B4A, adlred #A93226, adlamber #9A5B00.
   The PGM notes use the same values, so the two trainers look like siblings. */
:root{
  --blue:#1F4E79; --blue-l:#EAF1F8; --slate:#3D4552; --grey:#6B7382;
  --rule:#D9DEE7; --green:#1B6B4A; --green-l:#E9F4EE; --amber:#9A5B00;
  --amber-l:#FDF4E4; --red:#A93226; --red-l:#FBEDEB; --paper:#FBFCFD;
  /* surfaces and text, so that a dark palette can swap them all at once */
  --card:#fff; --card-2:#f2f5f9; --code-bg:#eef1f5; --input-dis:#fafbfc;
  --header-bg:#1F4E79; --header-fg:#fff; --nav-fg:#cddcea; --nav-on-bg:#fff; --nav-on-fg:#1F4E79;
  --btn-bg:#1F4E79; --btn-fg:#fff; --btn-hover:#173c5e; --on-accent:#fff;
  --shadow:rgba(0,0,0,.16);
  --radius:8px;
  color-scheme:light;
}
/* Dark palette. The header keeps the notes' blue; the accent blue, green, red
   and amber are lightened so they read on a dark ground, and their pale tints
   become dark tints. Figures are excluded: they are drawings that assume
   paper, and stay on a white card (see img.fig). */
:root[data-theme="dark"]{
  --blue:#86add3; --blue-l:#25313d; --slate:#c5ccd4; --grey:#8d98a4;
  --rule:#353d47; --green:#79b79a; --green-l:#233029; --amber:#cfa662;
  --amber-l:#332d1e; --red:#d4887f; --red-l:#382927; --paper:#14181d;
  --card:#1c2128; --card-2:#222931; --code-bg:#262e38; --input-dis:#191e24;
  --header-bg:#1a3552; --header-fg:#b7c3cf; --nav-fg:#93a5b7; --nav-on-bg:#9fb3c6; --nav-on-fg:#14243a;
  --btn-bg:#5f86ad; --btn-fg:#0f1620; --btn-hover:#6f95ba; --on-accent:#0f1620;
  --shadow:rgba(0,0,0,.45);
  color-scheme:dark;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --blue:#86add3; --blue-l:#25313d; --slate:#c5ccd4; --grey:#8d98a4;
    --rule:#353d47; --green:#79b79a; --green-l:#233029; --amber:#cfa662;
    --amber-l:#332d1e; --red:#d4887f; --red-l:#382927; --paper:#14181d;
    --card:#1c2128; --card-2:#222931; --code-bg:#262e38; --input-dis:#191e24;
    --header-bg:#1a3552; --header-fg:#b7c3cf; --nav-fg:#93a5b7; --nav-on-bg:#9fb3c6; --nav-on-fg:#14243a;
    --btn-bg:#5f86ad; --btn-fg:#0f1620; --btn-hover:#6f95ba; --on-accent:#0f1620;
    --shadow:rgba(0,0,0,.45);
    color-scheme:dark;
  }
}
*{box-sizing:border-box}
html,body{margin:0}
body{
  background:var(--paper); color:var(--slate);
  font:15px/1.55 "Segoe UI",system-ui,-apple-system,sans-serif;
}
.wrap{max-width:1000px;margin:0 auto;padding:0 20px}
header{background:var(--header-bg);color:var(--header-fg);box-shadow:0 1px 4px var(--shadow)}
.bar{display:flex;align-items:center;gap:18px;height:56px}
.brand{font-weight:700;letter-spacing:.2px}
.brand span{font-weight:400;opacity:.7}
nav{margin-left:auto;display:flex;gap:4px}
nav button{
  background:transparent;border:0;color:var(--nav-fg);padding:7px 13px;
  border-radius:6px;cursor:pointer;font:inherit;font-size:14px;
}
nav button:hover{background:rgba(255,255,255,.12);color:var(--header-fg)}
nav button.on{background:var(--nav-on-bg);color:var(--nav-on-fg);font-weight:600}
main{padding:26px 20px 60px}
footer{display:flex;align-items:center;gap:14px;padding:14px 20px 30px;
  color:var(--grey);font-size:13px;border-top:1px solid var(--rule);margin-top:20px}
.spacer{flex:1}

h1{font-size:24px;margin:0 0 6px;color:var(--blue)}
h2{font-size:18px;margin:30px 0 12px;color:var(--blue)}
p.lead{color:var(--grey);margin:0 0 24px}

/* ---------------------------------------------------------- home cards */
.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:16px}
.card{
  background:var(--card);border:1px solid var(--rule);border-radius:var(--radius);
  padding:18px 18px 16px;cursor:pointer;transition:.12s;
}
.card:hover{border-color:var(--blue);box-shadow:0 2px 10px var(--shadow)}
.card h3{margin:0 0 6px;color:var(--blue);font-size:16px}
.card p{margin:0;color:var(--grey);font-size:13.5px}

/* ---------------------------------------------------------- questions */
.q{
  background:var(--card);border:1px solid var(--rule);border-left:4px solid var(--rule);
  border-radius:var(--radius);padding:16px 18px;margin:0 0 16px;
}
.q.right{border-left-color:var(--green)}
.q.wrong{border-left-color:var(--red)}
.qhead{display:flex;gap:10px;align-items:baseline;margin-bottom:8px}
.qnum{font-weight:700;color:var(--blue)}
.tag{
  font-size:11px;letter-spacing:.4px;text-transform:uppercase;color:var(--grey);
  border:1px solid var(--rule);border-radius:20px;padding:1px 8px;
}
.stem{margin:0 0 12px}
.opts{display:flex;flex-direction:column;gap:6px}
.opt{
  display:flex;gap:10px;align-items:flex-start;padding:7px 11px;cursor:pointer;
  border:1px solid var(--rule);border-radius:6px;background:var(--card);
}
.opt:hover{border-color:var(--blue);background:var(--blue-l)}
.opt .box{
  flex:0 0 auto;width:17px;height:17px;border:2px solid var(--grey);
  margin-top:2px;display:grid;place-items:center;font-size:11px;color:var(--on-accent);
}
.opt.multi .box{border-radius:4px}
.opt.one   .box{border-radius:50%}
.opt.sel{border-color:var(--blue);background:var(--blue-l)}
.opt.sel .box{background:var(--blue);border-color:var(--blue)}
.opt.sel .box::after{content:"\2713"}
.opt.ok   {border-color:var(--green);background:var(--green-l)}
.opt.ok   .box{background:var(--green);border-color:var(--green)}
.opt.got  .box::after{content:"\2713"}
.opt.bad  {border-color:var(--red);background:var(--red-l)}
.opt.bad  .box{background:var(--red);border-color:var(--red)}
.opt .why{margin-left:auto;font-size:12px;font-weight:600;white-space:nowrap}
.opt.ok  .why{color:var(--green)}
.opt.bad .why{color:var(--red)}
.locked .opt{cursor:default}
.locked .opt:hover{border-color:inherit;background:inherit}
.locked .opt.ok:hover{background:var(--green-l)}
.locked .opt.bad:hover{background:var(--red-l)}

/* ---------------------------------------------------------- ordering */
.order{display:flex;flex-direction:column;gap:6px}
.row{
  display:flex;gap:10px;align-items:center;border:1px solid var(--rule);
  border-radius:6px;padding:7px 10px;background:var(--card);
}
.row.drag{opacity:.4}
.row .grip{color:var(--grey);cursor:grab;user-select:none;font-size:15px}
.row .pos{
  flex:0 0 auto;width:22px;height:22px;border-radius:50%;background:var(--blue-l);
  color:var(--blue);display:grid;place-items:center;font-size:12px;font-weight:700;
}
.row .txt{flex:1}
.row .mv{display:flex;flex-direction:column;gap:1px}
.row .mv button{
  border:1px solid var(--rule);background:var(--card);color:var(--grey);width:22px;
  height:15px;line-height:8px;cursor:pointer;border-radius:3px;font-size:10px;padding:0;
}
.row .mv button:hover{border-color:var(--blue);color:var(--blue)}
.row.ok{border-color:var(--green);background:var(--green-l)}
.row.ok .pos{background:var(--green);color:var(--on-accent)}
.row.bad{border-color:var(--red);background:var(--red-l)}
.row.bad .pos{background:var(--red);color:var(--on-accent)}
.row .should{font-size:12px;color:var(--red);font-weight:600;white-space:nowrap}

/* ---------------------------------------------------------- dropdowns */
.dd{position:relative;display:inline-block;vertical-align:baseline;margin:0 3px}
.dd-btn{
  font:inherit;background:var(--card);border:1px solid var(--blue);color:var(--blue);
  border-radius:5px;padding:2px 22px 2px 9px;cursor:pointer;min-width:110px;
  line-height:1.45;
  text-align:left;position:relative;
}
.dd-btn::after{content:"\25be";position:absolute;right:8px;color:var(--grey)}
.dd-btn.dd-empty{color:var(--grey);border-style:dashed}
.dd-btn.ok{border-color:var(--green);background:var(--green-l);color:var(--green)}
.dd-btn.bad{border-color:var(--red);background:var(--red-l);color:var(--red)}
/* a right pick of yours: the caret, useless on a marked card, becomes a tick */
.dd-btn.got{padding-right:30px}
.dd-btn.got::after{content:"\2713";font-weight:700;color:var(--green);right:9px}
/* the same tick after a right number box or ordering row */
.tick{color:var(--green);font-weight:700;margin-left:6px}
.row .tick{margin-left:0}
.dd-menu{
  position:absolute;z-index:40;top:calc(100% + 3px);left:0;min-width:240px;
  max-width:460px;background:var(--card);border:1px solid var(--rule);border-radius:6px;
  box-shadow:0 6px 22px var(--shadow);padding:4px;max-height:320px;overflow:auto;
}
.dd-menu[hidden]{display:none}
.dd-opt{padding:6px 9px;border-radius:4px;cursor:pointer}
.dd-opt:hover{background:var(--blue-l)}
.dd-opt.pick{background:var(--blue-l);font-weight:600}
.blanks{line-height:2.4}
/* The inline correction after a wrong blank. It needs breathing room on both
   sides or it reads as one word with the text that follows it. */
/* The wrong pick stays red (its dropdown); the correction is green so it reads as
   the answer, and its border is dashed so it does not look like a right pick of
   yours -- those are solid and carry a tick (.got / .tick). */
.blankfix{white-space:nowrap;margin:0 7px 0 4px;font-weight:600}
.blankfix .ar{margin-right:5px;color:var(--grey);font-weight:400}
.blankfix .to{color:var(--green);background:var(--green-l);border:1.5px dashed var(--green);
  border-radius:6px;padding:3px 9px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
.blankfix.tight{margin-right:0}
.blanks .dd{margin:0 2px}
/* a dropdown and the punctuation that ends its sentence, kept on one line */
.blanks .glued{white-space:nowrap}
.blanks .glued .dd{margin-right:0}
/* a reference to another question inside an explanation: hover shows that
   question's stem, so the pointer is not dead on a card */
.qref{border-bottom:1px dotted var(--blue);cursor:help;color:var(--blue)}
.assign-row{display:flex;gap:12px;align-items:center;padding:5px 0;flex-wrap:wrap}
.assign-row .lab{flex:1;min-width:220px}
.answer-was{font-size:12.5px;color:var(--red);margin-top:4px}
.answer-was.blankfix{font-size:inherit;color:inherit;margin-top:0}

/* ------------------------------------------------- written / self-marked */
.q.pending{border-left-color:var(--amber)}
textarea.note{
  font:inherit;width:100%;border:1px solid var(--rule);border-radius:6px;
  padding:9px 11px;resize:vertical;line-height:1.5;background:var(--card);color:var(--slate);
}
textarea.note:focus{outline:0;border-color:var(--blue)}
textarea.note:disabled{background:var(--input-dis);color:var(--slate)}
/* Device sync panel, opened from the footer. */
.syncpanel{
  border:1px solid var(--rule);border-radius:var(--radius);background:var(--card);
  padding:16px 18px;margin:0 0 24px;max-width:640px;
}
.syncpanel h4{margin:0 0 8px;color:var(--blue);font-size:15px}
.syncpanel p.muted{margin:8px 0;font-size:13px;color:var(--grey)}
.syncpanel ol{margin:10px 0;padding-left:20px;font-size:13.5px}
.syncpanel li{margin:5px 0}
.syncpanel code{background:var(--blue-l);padding:1px 5px;border-radius:4px}
.syncrow{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:12px 0}
input.tok{
  flex:1 1 260px;font:inherit;font-size:13.5px;padding:8px 10px;
  border:1px solid var(--rule);border-radius:6px;background:var(--paper);color:var(--slate);
}
input.tok:focus{outline:none;border-color:var(--blue)}
button.go.small{padding:8px 14px;font-size:13.5px}
.syncmsg{
  margin:10px 0 0;font-size:13px;color:var(--green);
  background:var(--green-l);border-radius:5px;padding:7px 10px;
}
.syncmsg.bad{color:var(--red);background:var(--red-l)}

/* The papers' figures, as SVG. White ground because the drawings assume paper,
   and a tap opens the file full size -- useful on a phone. */
.figs{margin:12px 0}
.figlink{display:block;margin:10px 0;text-decoration:none}
/* They are vector, so scaling a small diagram up costs nothing and makes the
   labels legible -- at PDF size they are unreadable on screen. */
img.fig{
  display:block;width:100%;max-width:720px;height:auto;margin:0 auto;
  background:#fff;border:1px solid var(--rule);border-radius:6px;padding:10px;
}
.expl img.fig{background:#fff}
.selfmark{display:flex;gap:10px;align-items:center;margin-top:12px;flex-wrap:wrap}
.sm-q{font-size:13.5px;color:var(--grey)}
button.sm{
  font:inherit;font-size:13.5px;border-radius:6px;padding:6px 14px;cursor:pointer;
  background:var(--card);border:1px solid var(--rule);color:var(--slate);
}
button.sm.right:hover,button.sm.right.on{
  border-color:var(--green);background:var(--green-l);color:var(--green);font-weight:600}
button.sm.wrong:hover,button.sm.wrong.on{
  border-color:var(--red);background:var(--red-l);color:var(--red);font-weight:600}
.pill.a{background:var(--amber-l);color:var(--amber)}
.sub.warn{color:var(--amber)}
table.xt{border-collapse:collapse;margin:8px 0;font-size:13.5px}
table.xt td,table.xt th{border-bottom:1px solid var(--rule);padding:5px 12px 5px 0;
  text-align:left;vertical-align:top}
table.xt th{color:var(--blue)}
ul.xl,ol.xl{margin:8px 0;padding-left:22px}
ul.xl li,ol.xl li{margin:3px 0}
pre.code{
  background:var(--code-bg);border:1px solid var(--rule);border-radius:6px;padding:10px 12px;
  overflow-x:auto;font:12.5px/1.5 Consolas,monospace;margin:8px 0;
}

/* ---------------------------------------------------------- numeric */
/* One box per quantity the question asks for, each with the label that says
   which quantity it is -- so "give the resolution, the parameters and the
   MACs" is three boxes and not a puzzle about how to type three numbers into
   one. The label column is fixed so the boxes line up down the card. */
.nums{margin:12px 0;display:flex;flex-direction:column;gap:8px}
.numrow{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.numlab{
  flex:0 0 240px;font-size:13.5px;color:var(--slate);text-align:right;
}
.numrow input.num{flex:0 1 190px;max-width:190px}
.numrow .answer-was{margin-top:0;white-space:nowrap}
@media (max-width:640px){
  .numrow{gap:4px}
  .numlab{flex:1 1 100%;text-align:left}
}
input.num{
  font:inherit;border:1px solid var(--rule);border-radius:6px;padding:7px 10px;
  width:100%;max-width:460px;background:var(--card);color:var(--slate);
}
input.num.ok{border-color:var(--green);background:var(--green-l)}
input.num.bad{border-color:var(--red);background:var(--red-l)}
.hint{font-size:12.5px;color:var(--grey);margin-top:8px}
/* the comment at the end of a pseudo-code line (\hfill{\itshape ...} on paper) */
.cmt{color:var(--grey);font-style:italic}

/* ---------------------------------------------------------- misc */
.expl{
  margin-top:14px;padding:12px 14px;background:var(--blue-l);
  border-radius:6px;font-size:14px;
}
.expl > p:first-child{margin-top:0}
.expl > p:last-child{margin-bottom:0}
.expl h4{margin:0 0 6px;font-size:12px;letter-spacing:.5px;text-transform:uppercase;
  color:var(--blue)}
button.go{
  background:var(--btn-bg);color:var(--btn-fg);border:0;border-radius:6px;padding:10px 20px;
  font:inherit;font-weight:600;cursor:pointer;
}
button.go:hover{background:var(--btn-hover)}
button.go.ghost{background:var(--card);color:var(--blue);border:1px solid var(--blue)}
button.go.ghost:hover{background:var(--blue-l)}
button.go[disabled]{opacity:.45;cursor:not-allowed}
button.link{background:0;border:0;color:var(--blue);cursor:pointer;font:inherit;
  font-size:13px;text-decoration:underline;padding:0}
button.link.danger{color:var(--red)}
.controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:0 0 22px}
/* Weeks and question types side by side, each a labelled column, so it reads
   as two filters rather than as a row of unexplained boxes. */
.filters{display:flex;gap:22px;align-items:flex-start;flex-wrap:wrap;margin:0 0 6px}
.filt{display:flex;flex-direction:column;gap:6px;min-width:190px}
.filt-h{font-size:14px;font-weight:600;color:var(--slate)}
.filt-n{font-size:12.5px;color:var(--grey)}
.filt select.plain{min-width:190px;padding:4px 6px}
.filt-n button.link{font-size:12.5px}
.controls label{font-size:14px;color:var(--grey)}
select.plain,input.plain{
  font:inherit;border:1px solid var(--rule);border-radius:6px;padding:7px 10px;background:var(--card);color:var(--slate);
}
.score{
  display:flex;gap:26px;align-items:center;background:var(--card);border:1px solid var(--rule);
  border-radius:var(--radius);padding:16px 20px;margin:0 0 22px;flex-wrap:wrap;
}
.score .big{font-size:30px;font-weight:700;color:var(--blue);line-height:1}
.score .sub{font-size:13px;color:var(--grey)}
.bar-t{flex:1;min-width:180px;height:9px;background:var(--red-l);border-radius:5px;overflow:hidden}
.bar-t i{display:block;height:100%;background:var(--green)}
table.list{width:100%;border-collapse:collapse;font-size:14px;background:var(--card);
  border:1px solid var(--rule);border-radius:var(--radius);overflow:hidden}
table.list th,table.list td{padding:9px 13px;text-align:left;border-bottom:1px solid var(--rule)}
table.list th{background:var(--blue-l);color:var(--blue);font-size:12px;
  text-transform:uppercase;letter-spacing:.4px}
table.list tr:last-child td{border-bottom:0}
table.list tr.click{cursor:pointer}
table.list tr.click:hover td{background:var(--blue-l)}
.weekhead{display:flex;align-items:baseline;gap:10px;margin:26px 0 10px}
.weekhead h2{margin:0}
.weekhead span{color:var(--grey);font-size:13px}
.empty{color:var(--grey);padding:30px 0}
.pill{font-size:12px;border-radius:20px;padding:2px 9px;font-weight:600}
.pill.g{background:var(--green-l);color:var(--green)}
.pill.r{background:var(--red-l);color:var(--red)}
.katex{font-size:1.02em}
code{background:var(--code-bg);border-radius:3px;padding:1px 4px;font-size:.92em}

/* a question's point value, so the weighting is visible on the card */
.tag.pts{border-color:var(--amber);color:var(--amber);background:var(--amber-l)}

/* "missed" is a mistake, not a note: red, like every other thing you got
   wrong. Before this it inherited the row's green, because the row is green
   when the option was one of the right ones. */
.opt.ok .why.missed{color:var(--red)}

/* ---------------------------------------------------------- dark mode */
/* The toggle lives in the nav. Its glyph flips with the theme; the stored
   choice wins over the system setting, and a third click returns to "system". */
button.theme{
  background:transparent;border:1px solid rgba(255,255,255,.35);color:var(--header-fg);
  border-radius:6px;cursor:pointer;font:inherit;font-size:13px;padding:5px 10px;
  margin-left:6px;white-space:nowrap;
}
button.theme:hover{background:rgba(255,255,255,.12)}
/* Drawings assume paper: keep them on a white card in both themes, and give
   the card a little more presence on a dark page so it does not glare. */
:root[data-theme="dark"] img.fig,
:root[data-theme="dark"] .expl img.fig{background:#eef0f2;border-color:#4a5563}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) img.fig,
  :root:not([data-theme="light"]) .expl img.fig{background:#eef0f2;border-color:#4a5563}
}
span.or{margin:0 10px;color:var(--grey)}
.tag.seen{border-color:var(--green);color:var(--green);background:var(--green-l)}
/* self-marking a written answer: 0 .. points, one button each */
button.sm.pick{min-width:40px;padding:6px 0;text-align:center}
button.sm.pick:hover{border-color:var(--blue);color:var(--blue)}
button.sm.pick.on{border-color:var(--blue);background:var(--blue);color:var(--on-accent);font-weight:600}
.q.partial{border-left-color:var(--amber)}
/* practice: the "only what I have not seen" tick, a third column of .filters */
.filt label.chk{display:flex;gap:8px;align-items:flex-start;max-width:250px;
  font-size:13.5px;line-height:1.35;color:var(--slate);cursor:pointer}
.filt label.chk input{margin:2px 0 0;flex:0 0 auto}
input[type=checkbox]{accent-color:var(--blue)}
