/* Gel Electrophoresis Practice: a lab bench. Pale agarose-grey page, near-black gels with ethidium-orange bands on
   screen, a burnt-orange accent, and plain black-on-white gels on paper. */
:root {
  --bg: #eef1ee;
  --paper: #ffffff;
  --ink: #17211d;
  --muted: #4b5a53;
  --line: #cdd6d0;
  --edge: #8e9c95;
  --gel: #121719;
  --gel-edge: #3a4548;
  --well: #05080a;
  --band: #ffb15c;
  --band-lad: #f2c38f;
  --glow: #ff8a2a;
  --accent: #a3400f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e5d9;
  --e1: #0b6b7d;
  --ok: #17663a;
  --ok-soft: #dff1e6;
  --close: #7a5300;
  --close-soft: #f7ecd4;
  --bad: #a2261f;
  --bad-soft: #f8e1de;
  --focus: #1b5fd0;
  --head: "Gill Sans", "Gill Sans MT", "Seravek", "Trebuchet MS", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --r: 5px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --paper: #161d1b;
    --ink: #e4ece8;
    --muted: #a6b5ae;
    --line: #2b3734;
    --edge: #5b6b66;
    --gel: #07090a;
    --gel-edge: #3a4548;
    --accent: #ff9d5c;
    --accent-ink: #1a0d04;
    --accent-soft: #3a2416;
    --e1: #6fd0e0;
    --ok: #8adca6;
    --ok-soft: #142c1e;
    --close: #f0c56b;
    --close-soft: #352a12;
    --bad: #ff9c8f;
    --bad-soft: #3a1c18;
    --focus: #8ab8ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hero { padding: 22px 0 4px; max-width: 780px; }
h1 { font: 600 clamp(1.75rem, 5vw, 2.6rem)/1.08 var(--head); margin: 0 0 8px; letter-spacing: -0.01em; }
.lede { margin: 0 0 4px; color: var(--muted); max-width: 66ch; }
h2 { font: 600 1.35rem/1.25 var(--head); margin: 0 0 10px; }

/* settings beside the sheet on wide screens */
.tool { display: block; }
@media (min-width: 1020px) {
  .tool { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
  .setup { position: sticky; top: 12px; }
}
.setup { margin: 12px 0 6px; }
fieldset { border: 0; padding: 0; margin: 0 0 10px; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
@media (min-width: 1020px) { .toggles { display: grid; gap: 4px; } }
.tg { position: relative; display: block; cursor: pointer; }
.tg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tg span { display: flex; flex-direction: column; justify-content: center; min-height: 44px; padding: 5px 12px 5px 30px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--muted); line-height: 1.2; }
.tg span::before { content: ""; position: absolute; left: 12px; top: 50%; width: 11px; height: 11px; margin-top: -6px; border: 2px solid var(--edge); border-radius: 2px; }
.tg b { font-size: 0.95rem; font-weight: 600; }
.tg small { display: none; color: var(--muted); font-size: 0.84rem; }
@media (min-width: 1020px) { .tg small { display: block; } }
.tg input:checked + span { color: var(--ink); border-left-color: var(--accent); }
.tg input:checked + span::before { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 2px var(--paper); }
.tg input:focus-visible + span, .sg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--edge); border-radius: var(--r); overflow: hidden; }
.sg { position: relative; display: block; cursor: pointer; }
.sg + .sg { border-left: 1px solid var(--edge); }
.sg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sg span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 4px 6px; text-align: center; font-size: 0.92rem; font-weight: 600; background: var(--paper); line-height: 1.15; }
.sg input:checked + span { background: var(--ink); color: var(--bg); }
.setrow { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
label.inline { display: flex; align-items: center; gap: 8px; font-weight: 600; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; }
select { max-width: 100%; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 8px 16px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { padding: 6px 14px; }
.btn:hover { filter: brightness(0.95); }
.link { font: inherit; background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

.note { margin: 12px 0; padding: 10px 12px; border-left: 5px solid var(--close); background: var(--close-soft); }
.note.info { border-left-color: var(--e1); background: var(--paper); }
.note .link { min-height: 0; padding: 0; font-weight: 600; }

/* the sheet */
.sheet { margin: 12px 0 0; }
.sheet:focus { outline: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; border-bottom: 3px solid var(--ink); padding-bottom: 4px; }
.sheet-head h2 { margin: 0; font-size: 1.2rem; }
.code { font-family: var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.score { margin: 0; font-size: 0.95rem; color: var(--muted); }
.practice { margin: 6px 0 0; font-size: 0.93rem; color: var(--muted); }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-bottom: 1px solid var(--line); padding: 18px 0 10px; }
.q h3 { font: 600 1.15rem/1.3 var(--head); margin: 0 0 4px; }
.q h3 .qn { color: var(--accent); margin-right: 6px; }
.q .scen { margin: 0 0 10px; max-width: 70ch; }
.qbody { display: grid; gap: 14px; }
@media (min-width: 760px) { .qbody { grid-template-columns: minmax(0, 440px) minmax(0, 1fr); align-items: start; } }
.gelfig { margin: 0; min-width: 0; }
svg.gel { display: block; width: 100%; max-width: calc(var(--w) * 4.7px); height: auto; overflow: visible; }
.ln { white-space: nowrap; }
.legend { margin: 4px 0 0; font-size: 0.92rem; color: var(--muted); }
.sizes { margin: 6px 0 0; font-size: 0.95rem; overflow-wrap: anywhere; max-width: 440px; }

/* gel drawing (units: the ruler's mm) */
svg text { font-family: var(--sans); }
.gel .elec { font-size: 2.5px; fill: var(--muted); }
.gel .lane-no { font-size: 3px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.gel .gelbg { fill: var(--gel); stroke: var(--gel-edge); stroke-width: 0.3; }
.gel .well { fill: var(--well); stroke: var(--gel-edge); stroke-width: 0.25; }
.gel .band { fill: var(--band); filter: drop-shadow(0 0 0.7px var(--glow)); }
.gel .band.lad { fill: var(--band-lad); }
.gel .mark { font-size: 3.1px; font-weight: 800; fill: #ffffff; }
.gel .lsize { font-size: 2.45px; text-anchor: end; fill: var(--ink); font-variant-numeric: tabular-nums; }
.gel .lunit { font-size: 2.3px; text-anchor: end; fill: var(--muted); }
.gel .lunit.r { text-anchor: start; }
.gel .lead { fill: none; stroke: var(--edge); stroke-width: 0.15; }
.gel .rule, .gel .tick { fill: none; stroke: var(--ink); stroke-width: 0.16; }
.gel .rnum { font-size: 2.3px; fill: var(--ink); }

/* questions */
.part { margin: 0 0 14px; min-width: 0; }
.part > .prompt, .part legend { display: block; font-weight: 600; margin: 0 0 6px; }
.opts { display: grid; gap: 4px; }
.opt { position: relative; display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); cursor: pointer; }
.opt input { margin: 3px 0 0; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.opt .ot { min-width: 0; }
.opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.opt svg.map { display: block; margin-top: 4px; }
.ain { display: inline-flex; align-items: center; gap: 6px; }
.ain input { width: 8.5em; font-family: var(--mono); }
.ain .unit { color: var(--muted); }
.qfoot { display: flex; align-items: center; gap: 4px 16px; flex-wrap: wrap; }
.fbwrap:empty { display: none; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: 4px; max-width: 70ch; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.close { background: var(--close-soft); color: var(--close); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.part.is-right .ain input { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.part.is-wrong .ain input { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.part.is-close .ain input { border-color: var(--close); box-shadow: inset 0 0 0 1px var(--close); }
.work { margin-top: 4px; }
.work > summary { cursor: pointer; color: var(--muted); font-size: 0.93rem; padding: 10px 0; min-height: 44px; display: flex; align-items: center; list-style: none; }
.work > summary::-webkit-details-marker { display: none; }
.work > summary::before { content: "+"; margin-right: 6px; font-weight: 700; font-family: var(--mono); }
.work[open] > summary::before { content: "−"; }
.work .ans { margin: 0 0 2px; }
.steps { margin: 2px 0 10px; padding-left: 1.4em; font-size: 0.94rem; overflow-wrap: anywhere; }
svg.curve { display: block; width: 100%; max-width: 420px; height: auto; margin: 4px 0 10px; }
.curve .cgrid { fill: none; stroke: var(--line); stroke-width: 0.2; }
.curve .cbox { fill: none; stroke: var(--edge); stroke-width: 0.3; }
.curve .cnum { font-size: 3px; fill: var(--muted); text-anchor: middle; }
.curve .cnum.y { text-anchor: end; }
.curve .cax { font-size: 3.1px; fill: var(--ink); text-anchor: middle; }
.curve .cline { stroke: var(--ink); stroke-width: 0.4; }
.curve .cpt { fill: var(--ink); }
.curve .cread { fill: none; stroke: var(--accent); stroke-width: 0.4; stroke-dasharray: 1.2 0.8; }
.curve .cx { fill: var(--accent); }
svg.map.lin { width: 100%; max-width: 280px; height: auto; }
svg.map.circ { width: 72px; height: 72px; }
.map .mline { fill: none; stroke: var(--ink); stroke-width: 0.7; }
.map .mtick { stroke-width: 1; }
.map .mtick.e0 { stroke: var(--accent); }
.map .mtick.e1 { stroke: var(--e1); }
.map .mlab { font-size: 4px; font-weight: 700; text-anchor: middle; }
.map .mlab.e0 { fill: var(--accent); }
.map .mlab.e1 { fill: var(--e1); }
.sheet-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 0; }

.share { margin: 10px 0 8px; }
.print-row { display: flex; align-items: flex-end; gap: 8px 10px; flex-wrap: wrap; }
.print-row label, .share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; }
.share-out input { width: 100%; }
.recent { margin-top: 12px; border-top: 1px solid var(--line); }
.recent summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 4px 0; }
.recent small { display: block; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 8px 0 10px; }

.toast { position: fixed; left: 50%; bottom: 16px; transform: translate(-50%, 160%); background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r); max-width: calc(100% - 32px); transition: transform 0.2s; z-index: 20; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* content */
.content { padding: 22px 0 8px; max-width: 820px; }
.content h2 { margin-top: 30px; }
.content p { max-width: 68ch; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 11px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.sources { font-size: 0.92rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 22px; }

footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 16px 0 28px; color: var(--muted); font-size: 0.92rem; }
.indep { margin: 0 0 10px; }
.sb-footer p { margin: 6px 0; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }

@media (max-width: 600px) {
  .hero { padding-top: 14px; }
  .toggles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  .tg .long { display: none; }
  .tg span { padding: 5px 4px; text-align: center; align-items: center; border-left-width: 1px; font-size: 0.9rem; }
  .tg span::before { display: none; }
  .tg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
}
.tg .short { display: none; }
@media (max-width: 600px) { .tg .short { display: block; } }

/* print: worksheet, graph paper and key only; gels in black on white */
.print-root { display: none; }
@page { margin: 0.4in 0.55in; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; --paper: #fff; --edge: #555; }
  body { background: #fff; color: #000; font: 10.5pt/1.38 var(--sans); }
  main, footer, .toast, .skip { display: none !important; }
  .print-root { display: block; }
  svg { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  table.pt { width: 100%; border-collapse: collapse; }
  table.pt > tbody > tr > td, table.pt > thead > tr > td { padding: 0; }
  .prun { font: 8.5pt var(--sans); color: #444; text-align: right; padding-bottom: 6pt !important; }
  .ph { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2pt solid #000; margin-bottom: 6pt; }
  .ph h2 { font: 600 15pt var(--head); margin: 0; }
  .ph p { margin: 0; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 4pt 0 6pt; }
  .plabel { margin: 0 0 6pt; font-size: 9pt; font-style: italic; }
  .pq { list-style: none; margin: 0; padding: 0; }
  .pq > li { break-inside: avoid; page-break-inside: avoid; padding: 5pt 0 4pt; border-bottom: 0.75pt solid #999; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12pt; align-items: start; }
  .pq h3 { grid-column: 1 / -1; font: 600 11.5pt var(--head); margin: 0 0 2pt; }
  .pq .pscen { grid-column: 1 / -1; margin: 0 0 3pt; }
  .pq .pgel { width: min-content; }
  .pq svg.gel { width: calc(var(--w) * 0.74mm); height: calc(var(--h) * 0.74mm); max-width: none; }
  .pq .plegend { margin: 2pt 0 0; font-size: 8.5pt; }
  .pparts { min-width: 0; }
  .pparts .pp { margin: 0 0 9pt; break-inside: avoid; }
  .pparts .pp p { margin: 0 0 3pt; }
  .pparts ol.popts { margin: 0; padding-left: 15pt; list-style: upper-alpha; }
  .pparts ol.popts li { margin: 0 0 2pt; }
  .pparts .pline { margin-top: 14pt !important; }
  .psizes { font-size: 9pt; margin: 3pt 0 0 !important; }
  .pparts ol.popts.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 6pt 14pt; padding-left: 13pt; }
  .gel .elec, .gel .lunit { fill: #333; }
  .gel .lane-no, .gel .lsize, .gel .rnum, .gel .mark { fill: #000; }
  .gel .gelbg { fill: #fff; stroke: #000; stroke-width: 0.35; }
  .gel .well { fill: #fff; stroke: #000; stroke-width: 0.3; }
  .gel .band, .gel .band.lad { fill: #000; filter: none; }
  .gel .lead { stroke: #777; }
  .gel .rule, .gel .tick { stroke: #000; }
  .map .mtick.e0, .map .mtick.e1 { stroke: #000; }
  .map .mlab.e0, .map .mlab.e1 { fill: #000; }
  .map .mline { stroke: #000; }
  svg.map.lin { width: 52mm; height: auto; display: block; }
  svg.map.circ { width: 20mm; height: 20mm; display: block; }
  .ppaper { break-before: page; page-break-before: always; }
  .ppaper svg.semilog { display: block; width: 100%; height: auto; max-height: 8.6in; }
  .semilog .g1 { stroke: #aaa; stroke-width: 0.12; fill: none; }
  .semilog .g2 { stroke: #666; stroke-width: 0.2; fill: none; }
  .semilog .g3 { stroke: #000; stroke-width: 0.35; fill: none; }
  .semilog .gn { font-size: 3.1px; text-anchor: middle; fill: #000; }
  .semilog .gn.y { text-anchor: end; }
  .semilog .gax { font-size: 3.4px; text-anchor: middle; fill: #000; }
  .pkey { break-before: page; page-break-before: always; }
  .pk { margin: 0; padding-left: 18pt; }
  .pk > li { padding: 4pt 0 5pt; border-bottom: 0.75pt solid #bbb; }
  .pk .pkp { break-inside: avoid; page-break-inside: avoid; }
  .pk h3 { font: 600 10.5pt var(--head); margin: 0; break-after: avoid; page-break-after: avoid; }
  .pk p { margin: 1pt 0 0; }
  .pk .pka { font-weight: 700; }
  .pk ul { margin: 1pt 0 0; padding-left: 13pt; font-size: 9pt; line-height: 1.35; }
  .pk svg.curve { width: 80mm; height: auto; margin: 2pt 0; }
  .curve .cgrid { stroke: #bbb; }
  .curve .cbox, .curve .cline { stroke: #000; }
  .curve .cpt { fill: #000; }
  .curve .cread { stroke: #000; }
  .curve .cx { fill: #000; }
  .curve .cnum, .curve .cax { fill: #000; }
}
