/* Mitotic Index Practice: a microscope bench. Warm grey bench, near-black ink, an orcein crimson accent for actions
   and question numbers, and round fields of view drawn as a lit slide: the slide keeps its stain colors in both
   themes (toluidine blue or a red stain, by course), the way it looks down the eyepiece. On paper everything is
   black ink on white except the slides and the key marks. */
:root {
  --bg: #f3f2ee;
  --paper: #ffffff;
  --ink: #1d1b21;
  --muted: #4d4955;
  --line: #d9d6d0;
  --edge: #7a7680;
  --accent: #9a1d43;
  --accent-ink: #ffffff;
  --accent-soft: #f6e3e8;
  --info: #2d4f8a;
  --ok: #17663a;
  --ok-soft: #ddefe3;
  --close: #7a5300;
  --close-soft: #f6ecd2;
  --bad: #a3241d;
  --bad-soft: #f8e0dd;
  --focus: #1f6fd1;
  --head: "Gill Sans", "Gill Sans MT", Seravek, "Trebuchet MS", "Segoe UI", 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: 4px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16141a;
    --paper: #201d25;
    --ink: #ebe8ef;
    --muted: #b1abb9;
    --line: #36313d;
    --edge: #77707f;
    --accent: #f08aa6;
    --accent-ink: #2a0712;
    --accent-soft: #3a1823;
    --info: #9fbff0;
    --ok: #8adca6;
    --ok-soft: #14301f;
    --close: #f0c56b;
    --close-soft: #352a12;
    --bad: #ff9c8f;
    --bad-soft: #3a1c18;
    --focus: #8fb8ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
a { color: var(--info); text-underline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; font-weight: 700; }

/* the title sits beside one dividing cell in telophase (two chromatin masses and a forming cell plate); not an
   eyepiece ring, which microscopy-practice already uses (fresh-eyes 2026-10-27) */
.hero { position: relative; padding: 22px 0 14px 70px; }
.hero::before { content: ""; position: absolute; left: 0; top: 30px; width: 52px; height: 36px; border-radius: 7px;
  border: 3px solid var(--ink); box-sizing: border-box; background:
    radial-gradient(ellipse 4px 10px at 24% 50%, var(--accent) 0 95%, transparent 100%),
    radial-gradient(ellipse 4px 10px at 76% 50%, var(--accent) 0 95%, transparent 100%),
    repeating-linear-gradient(180deg, var(--accent) 0 3px, transparent 3px 6px) 50% 50% / 2px 22px no-repeat,
    var(--accent-soft); }
.hero h1 { font-size: clamp(27px, 4.4vw, 40px); margin: 0 0 8px; letter-spacing: -0.01em; max-width: 26ch; }
.lede { margin: 0; max-width: 66ch; }

/* ---------- controls ---------- */
.tool { display: grid; gap: 14px; }
.setup { border-top: 3px solid var(--ink); border-bottom: 1px solid var(--line); padding: 12px 0 4px; }
.ctl { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 12px; align-items: end; max-width: 760px; }
.fld-c { display: grid; gap: 3px; min-width: 0; font-size: 15px; color: var(--muted); }
.fld-c span { font-weight: 600; }
select, input { font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1.5px solid var(--edge); border-radius: var(--r); min-height: 44px; padding: 6px 10px; max-width: 100%; }
select { padding-right: 28px; }
.btn { font: 600 16px/1.2 var(--sans); min-height: 44px; padding: 10px 16px; border-radius: var(--r); border: 1.5px solid var(--ink); background: var(--paper); color: var(--ink); cursor: pointer; }
.btn:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { white-space: nowrap; min-height: 40px; padding: 7px 12px; font-size: 15px; }
.link { font: inherit; background: none; border: 0; padding: 8px 2px; color: var(--info); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; min-height: 44px; }
.more { display: flex; flex-wrap: wrap; gap: 0 22px; margin-top: 6px; }
.more details { min-width: 0; }
.more summary { cursor: pointer; padding: 10px 0; font-weight: 600; min-height: 44px; }
.tsum { font-weight: 400; color: var(--muted); }
.topics { border: 0; padding: 0; margin: 0 0 10px; }
.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 14px; }
.tg { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.tg input { min-height: 0; width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.tg b { display: block; font-weight: 600; }
.tg small { color: var(--muted); font-size: 14px; }
.rules .rl { margin: 0 0 12px; padding-left: 20px; max-width: 80ch; font-size: 15.5px; }
.rules .rl li { margin: 4px 0; }

/* ---------- the sheet ---------- */
.note { margin: 6px 0; padding: 10px 14px; border: 1px solid var(--bad); background: var(--bad-soft); border-radius: var(--r); }
#store-note { overflow-wrap: anywhere; }
.note.info { border-color: var(--info); background: var(--paper); }
.sheet { outline: none; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-top: 6px; }
.sheet-head h2 { margin: 0; font-size: 26px; }
.code { font-family: var(--mono); letter-spacing: 0.08em; }
.score { margin: 0; color: var(--muted); }
.sline { margin: 0 0 6px; color: var(--muted); font-size: 15px; }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-top: 1px solid var(--line); padding: 16px 0 18px; }
.qhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.qhead h3 { margin: 0; font-size: 21px; display: flex; gap: 10px; align-items: baseline; }
.qn { color: var(--accent); font-size: 26px; min-width: 1.2em; }
.scen { margin: 6px 0 10px; max-width: 72ch; }
.qbody { display: grid; gap: 14px 22px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) {
  .qbody { grid-template-columns: minmax(0, 540px) minmax(0, 1fr); }
  .q-root .qbody { grid-template-columns: 1fr; }
  .q-size .qbody { grid-template-columns: minmax(0, 620px) minmax(0, 1fr); }
  .q-table .qbody, .q-chi .qbody { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); }
}
.figview { min-width: 0; }
.fig { margin: 0; }
.figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 900px; }
.figs figcaption { font-size: 15px; margin-top: 2px; }
@media (max-width: 560px) { .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qparts { display: grid; gap: 10px; align-content: start; min-width: 0; }
.qparts.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.qparts.grid .qfoot, .qparts.grid .work { grid-column: 1 / -1; }
.part { margin: 0; padding: 0; border: 0; min-width: 0; }
.part .prompt, .part legend { display: block; font-weight: 600; font-size: 15.5px; margin-bottom: 3px; }
.ain { display: flex; align-items: center; gap: 8px; }
.ain input { width: 9em; }
.ain select { width: 100%; max-width: 13em; }
.unit { color: var(--muted); }
.part.is-right input, .part.is-right select { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
.part.is-wrong input, .part.is-wrong select { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.part.is-close input, .part.is-close select, .part.is-unread input { border-color: var(--close); box-shadow: 0 0 0 1px var(--close); }
.fb { margin: 4px 0 0; padding: 6px 10px; font-size: 15px; border-radius: var(--r); }
.fb.right { background: var(--ok-soft); }
.fb.right b { color: var(--ok); }
.fb.wrong { background: var(--bad-soft); }
.fb.wrong b { color: var(--bad); }
.fb.close, .fb.unread { background: var(--close-soft); }
.fb.close b, .fb.unread b { color: var(--close); }
.opts { display: grid; gap: 4px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.opt input { min-height: 0; width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.qfoot { display: flex; gap: 10px; }
.work summary { cursor: pointer; color: var(--info); padding: 8px 0; min-height: 44px; }
.work .ans { margin: 8px 0 2px; }
.work .steps { margin: 0 0 6px; padding-left: 20px; color: var(--muted); font-size: 15.5px; }
.keyfig { margin: 6px 0 10px; max-width: 540px; }
.q-root .keyfig { max-width: 900px; }
.q-size .keyfig { max-width: 640px; }
.kleg { font-size: 14px; color: var(--muted); margin: 4px 0 0; }
.kl-s { color: #b84a00; font-weight: 800; letter-spacing: 0.08em; }
.kl-c { display: inline-block; width: 14px; height: 12px; background: #59565e; opacity: 0.55; vertical-align: -1px; border-radius: 2px; }
@media (prefers-color-scheme: dark) { .kl-s { color: #ffab70; } .kl-c { background: #b5b0bd; } }
.sheet-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.hint { color: var(--muted); font-size: 15px; }
.ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

/* count tables */
.tabs { overflow-x: auto; }
.ctab { border-collapse: collapse; background: var(--paper); font-variant-numeric: tabular-nums; min-width: 240px; }
.ctab th, .ctab td { border: 1px solid var(--edge); padding: 6px 12px; text-align: left; }
.ctab td { text-align: right; }
.ctab thead th { background: var(--accent-soft); }
.ctab .tot th, .ctab .tot td { font-weight: 700; }
/* QA: the chi table's Total column fits a 320 px phone without side scrolling */
@media (max-width: 400px) { .ctab.chi { font-size: 15px; } .ctab.chi th, .ctab.chi td { padding: 6px 6px; } }

/* phones: Zoom in draws the fields twice as wide in their own sideways scroller */
@media (max-width: 899px) {
  .zoomed .figview { overflow-x: auto; }
  .zoomed .figview > .fig { width: 220%; max-width: none; }
  .zoomed .figview > .figs { width: 220%; max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 900px) { .zoom { display: none; } }

/* print and share */
.share { border-top: 3px solid var(--ink); padding-top: 12px; margin-top: 8px; }
.print-row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 14px; }
.print-row label { display: grid; gap: 3px; font-size: 15px; font-weight: 600; color: var(--muted); }
.share-out label { display: grid; gap: 3px; font-weight: 600; font-size: 15px; }
.share-out input { width: 100%; font-family: var(--mono); font-size: 15px; }
.recent summary { cursor: pointer; padding: 10px 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); font-size: 14px; }

/* ---------- content ---------- */
.content { max-width: 74ch; margin: 34px 0 30px; }
.content h2 { font-size: 24px; margin: 28px 0 8px; }
.faq details { border-top: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; min-height: 44px; }
.faq details p { margin: 0 0 12px; }
.sources { font-size: 15px; color: var(--muted); margin-top: 24px; }
footer { border-top: 1px solid var(--line); padding: 18px 0 28px; font-size: 15px; color: var(--muted); }
.indep { margin: 0 0 10px; }
.sb-more { line-height: 1.8; }
.sb-footer a { color: var(--ink); }
.sb-privacy, .sb-credit { margin: 6px 0; }
.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(150%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r);
  max-width: min(92vw, 520px); z-index: 20; transition: transform 0.2s; font-size: 15.5px; }
.toast.on { transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (max-width: 560px) {
  .hero { padding-left: 0; padding-top: 16px; }
  .hero::before { display: none; }
  .ctl { grid-template-columns: auto auto; justify-content: start; }
  .f-board { grid-column: 1 / -1; }
  .ain input { width: 7.5em; }
  .hero { padding-bottom: 10px; }
  .hero h1 { font-size: 26px; }
  .lede { font-size: 16px; }
  .more { gap: 0 16px; margin-top: 2px; }
  .more summary { font-size: 15.5px; padding: 8px 0; }
  .setup { padding-top: 8px; }
}

/* ---------- the drawn slide (same in both themes) ---------- */
svg.fld { display: block; width: 100%; height: auto; }
.fld .fov-bg { fill: var(--slide); }
.fld .fov { fill: none; stroke: #2a2830; stroke-width: 3; }
.fld .w { stroke-width: 1.6; }
.fld .ch { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.6; }
.fld .sp { stroke-width: 0.8; }
.fld .pl { stroke-width: 2.4; stroke-dasharray: 4 3; }
.fld .nu { stroke-width: 1.2; }
.st-blue { --slide: #f5f3fa; }
.st-blue .w { fill: #e4ddf0; stroke: #988ab9; }
.st-blue .nu { fill: #b9abd9; stroke: #6a58a6; }
.st-blue .nl { fill: #2f2170; }
.st-blue .gr { fill: #7766b3; }
.st-blue .ch { stroke: #221556; }
.st-blue .cm { fill: #221556; }
.st-blue .sp { stroke: #a597c8; }
.st-blue .pl { stroke: #3b2a78; }
.st-red { --slide: #fbf4f3; }
.st-red .w { fill: #f3dde0; stroke: #bb8c95; }
.st-red .nu { fill: #e1abb6; stroke: #a14a5e; }
.st-red .nl { fill: #5a1124; }
.st-red .gr { fill: #b0566a; }
.st-red .ch { stroke: #4b0b20; }
.st-red .cm { fill: #4b0b20; }
.st-red .sp { stroke: #d5a7b0; }
.st-red .pl { stroke: #6e1a30; }
.fld .lbox { fill: none; stroke: #1b1a20; stroke-width: 3; }
.fld .lb { fill: #fff; stroke: #1b1a20; stroke-width: 1.5; }
.fld .lt { font: 700 17px system-ui, sans-serif; text-anchor: middle; fill: #111; }
.fld .ks { font: 800 15px system-ui, sans-serif; text-anchor: middle; fill: #b84a00; paint-order: stroke; stroke: #fff; stroke-width: 3; }
.fld .kcut { fill: #59565e; fill-opacity: 0.45; stroke: none; }
.fld .gb, .fld .gt { stroke: #111; stroke-width: 1.1; }
.fld .gn { font: 600 14px system-ui, sans-serif; text-anchor: middle; fill: #111; paint-order: stroke; stroke: #fff; stroke-width: 3; }
.fld .kbr { fill: none; stroke: #b84a00; stroke-width: 2.5; }
.fld .kbt { font: 700 13px system-ui, sans-serif; text-anchor: middle; fill: #b84a00; paint-order: stroke; stroke: #fff; stroke-width: 3; }

/* ---------- print ---------- */
.print-root { display: none; }
@page { margin: 12mm 12mm 14mm; }
@media print {
  html, body { background: #fff !important; color: #000 !important; font: 10.5pt/1.35 var(--sans); }
  main, footer, .skip, .toast { display: none !important; }
  .print-root { display: block; }
  .psheet, .pkey { break-after: page; }
  .psheet:last-child, .pkey:last-child { break-after: auto; }
  .pt { width: 100%; border-collapse: collapse; }
  .pt > tbody > tr > td, .pt > thead > tr > td { padding: 0; }
  .prun { font-size: 8.5pt; color: #444; padding-bottom: 3mm !important; border-bottom: 0.3pt solid #999; }
  .ph h2 { font-size: 16pt; margin: 2mm 0 0; }
  .ph p { margin: 0 0 1mm; font-size: 10pt; }
  .ph { display: none; }
  .pmeta { display: flex; gap: 8mm; margin: 2mm 0; font-size: 10.5pt; }
  .pround { border: 0.6pt solid #000; padding: 1.5mm 3mm; margin: 0 0 3mm; font-size: 9pt; }
  .pround .rl { margin: 0; padding-left: 4mm; }
  .pround .rl li { margin: 0.5mm 0; }
  .pq, .pk { list-style: none; margin: 0; padding: 0; }
  .pq > li, .pk > li { break-inside: avoid; border-top: 0.6pt solid #000; padding: 2.5mm 0 3mm; }
  .pq h3, .pk h3 { font-size: 11.5pt; margin: 0 0 1mm; }
  .pscen { margin: 0 0 2mm; }
  .pbody { display: grid; grid-template-columns: 96mm 1fr; gap: 6mm; align-items: start; }
  .pk-root .pbody { grid-template-columns: 1fr; }
  .pk-size .pbody { grid-template-columns: 124mm 1fr; }
  .pk-table .pbody, .pk-chi .pbody { grid-template-columns: 75mm 1fr; }
  .pk-root .pparts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1mm 6mm; }
  .pk-root .pp.wide { grid-column: 1 / -1; }
  .pk-stages .pparts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6mm; }
  .pk-chi .pparts, .pk-count .pparts { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6mm; }
  .pk-chi .pp.wide, .pk-count .pp:last-child { grid-column: 1 / -1; }
  .pp { margin: 0 0 2mm; }
  .pp p { margin: 0; }
  .pline { display: flex; align-items: flex-end; gap: 2mm; height: 7mm; }
  .uline { display: inline-block; width: 32mm; border-bottom: 0.6pt solid #000; height: 6mm; }
  .psel .uline { width: 34mm; }
  .popts { display: grid; gap: 1mm; margin-top: 1mm !important; }
  .fig { margin: 0; }
  .figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; max-width: none; }
  .figs figcaption { font-size: 9.5pt; }
  .kleg { font-size: 8.5pt; color: #333; }
  .kl-s { color: #b84a00; }
  .kl-c { background: #59565e; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .ctab { border-collapse: collapse; background: #fff; min-width: 0; font-size: 10pt; }
  .ctab th, .ctab td { border: 0.6pt solid #000; padding: 1mm 3mm; }
  .ctab thead th { background: none; }
  .pkbody { display: grid; grid-template-columns: 70mm 1fr; gap: 4mm; align-items: start; }
  .pk-root .pkbody, .pk-size .pkbody { grid-template-columns: 1fr; }
  .pk-root .pkfig { width: 150mm; }
  .pk-size .pkfig { width: 105mm; }
  .pk-table .pkbody, .pk-chi .pkbody { grid-template-columns: 1fr; }
  .pkt { border-collapse: collapse; width: 100%; font-size: 9pt; table-layout: fixed; }
  .pkt td { border-top: 0.3pt solid #999; padding: 0.8mm 1.5mm; vertical-align: top; }
  .pka { font-weight: 700; width: 24%; }
  .pkq { width: 24%; }
  svg.fld { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
