/* Sentence Diagramming Practice: the classroom board. Diagrams are chalk on a slate-green board (as Reed-Kellogg
   diagrams were taught at the board), the page around them a pale chalk-dust gray with a slab-serif heading face
   like an old grammar book. A red-pencil red marks mistakes. Print: black lines on white, full size. */
[hidden] { display: none !important; }
:root {
  --bg: #e9ece8;
  --paper: #f8f9f6;
  --ink: #1c2420;
  --muted: #4c5751;
  --line: #ccd3cd;
  --edge: #87918b;
  --accent: #24453a;
  --accent-ink: #f4f2e8;
  --board: #23392f;
  --board-edge: #6f5a3a;
  --chalk: #f2f0e5;
  --pick: #e9c84a;
  --ok: #1d6b3a;
  --ok-soft: #e1efe4;
  --bad: #a3321c;
  --bad-soft: #f7e3dc;
  --focus: #1d5fd1;
  --head: Rockwell, "Rockwell Nova", "Roboto Slab", "Zilla Slab", "DejaVu Serif", Georgia, 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: #161b19;
    --paper: #1d2421;
    --ink: #e5e9e4;
    --muted: #aab5ae;
    --line: #333d38;
    --edge: #6c7872;
    --accent: #9ccfb6;
    --accent-ink: #10231b;
    --board: #1e3128;
    --board-edge: #8a7350;
    --chalk: #eeece0;
    --pick: #e9c84a;
    --ok: #8fd8a3;
    --ok-soft: #16301f;
    --bad: #ff9f8a;
    --bad-soft: #3a1d17;
    --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: 1040px; 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; }

.hero { padding: 22px 0 6px; max-width: 760px; }
h1 { font: 700 clamp(1.75rem, 4.8vw, 2.6rem)/1.1 var(--head); margin: 0 0 8px; }
.lede { margin: 0; color: var(--muted); max-width: 64ch; }
h2 { font: 700 1.35rem/1.2 var(--head); margin: 0 0 10px; }

/* the set on a small board: code and score in chalk, the pick lists on the chalk tray */
.bar { background: var(--board); color: var(--chalk); border-bottom: 7px solid var(--board-edge); border-radius: var(--r) var(--r) 0 0; padding: 8px 12px 10px; margin-top: 12px; }
.bar-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 0 12px; }
.bar h2 { margin: 0; font-size: 1.2rem; }
.bar .code { color: var(--pick); }
.bar .score { color: var(--chalk); opacity: 0.85; }
.bar-ctl { display: grid; grid-template-columns: minmax(0, 20rem) auto auto; justify-content: start; gap: 8px; align-items: end; margin-top: 6px; }
.bar label { display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; font-weight: 650; color: var(--chalk); min-width: 0; }
.bar .btn.primary { background: var(--pick); color: #1c2420; border-color: var(--pick); }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.print-row label { display: flex; flex-direction: column; gap: 3px; font-size: 0.85rem; font-weight: 650; color: var(--muted); }
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 18px; 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; }

.rules { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-top: 8px; }
.rules > summary { cursor: pointer; padding: 10px 0; min-height: 44px; font-weight: 650; display: flex; align-items: center; }
.rl { margin: 0 0 12px; padding-left: 1.3em; max-width: 78ch; }
.rl li { margin: 0 0 6px; }
.rl .src { color: var(--muted); font-size: 14px; display: block; }

.note { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--bad); background: var(--bad-soft); overflow-wrap: anywhere; border-radius: var(--r); }
.note.info { border-color: var(--accent); background: var(--paper); }
.note .link { min-height: 0; padding: 0; font-weight: 600; }

/* the set */
.sheet { margin: 0 0 8px; }
.code { font-family: var(--mono); letter-spacing: 0.08em; color: var(--accent); }
.score { margin: 0; color: var(--muted); font-size: 0.95rem; }
.qs { list-style: none; margin: 0; padding: 0; }
.q { border-bottom: 1px solid var(--line); padding: 18px 0 12px; }
.q h3 { font: 600 1.3rem/1.35 var(--sans); margin: 0 0 8px; display: flex; gap: 12px; align-items: baseline; }
.qn { font: 700 1.1rem var(--head); color: var(--chalk); background: var(--board); min-width: 1.9em; height: 1.9em; display: inline-grid; place-items: center; border-radius: var(--r); flex: none; }
.ask-l { margin: 14px 0 6px; color: var(--muted); font-size: 0.95rem; }

/* every word with its pick list */
.words { display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 0 0 14px; }
.wd { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 0 1 auto; }
.ww { font-weight: 700; font-size: 1.05rem; padding-left: 2px; }
.wd select { width: 100%; min-width: 8.6rem; }
.wd.is-right select { border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.wd.is-wrong select, .wd.is-unread select { border-color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad); }
.wd .fb { max-width: 18rem; }

/* the three diagrams */
.choose { margin: 0; padding: 0; border: 0; min-width: 0; }
.choose legend { font-weight: 650; padding: 0; margin-bottom: 6px; }
.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.opt { display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.ol { display: inline-flex; align-items: center; gap: 8px; font: 700 1rem var(--head); min-height: 32px; }
.ol input { min-height: 0; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.bd { background: var(--board); border: 3px solid var(--board-edge); border-radius: var(--r); padding: 6px; min-width: 0; }
.opt:has(input:checked) .bd { box-shadow: 0 0 0 3px var(--pick); }
.choose.is-right .opt:has(input:checked) .bd { box-shadow: 0 0 0 3px var(--ok); }
.choose.is-wrong .opt:has(input:checked) .bd { box-shadow: 0 0 0 3px var(--bad); }
.bd svg { display: block; width: 100%; height: auto; margin: 0 auto; }
svg.dg line { stroke: var(--chalk); stroke-linecap: round; }
svg.dg text { fill: var(--chalk); font-family: Arial, "Liberation Sans", Helvetica, sans-serif; }

.fbwrap:empty { display: none; }
.fb { margin: 6px 0 0; padding: 6px 10px; border-radius: var(--r); max-width: 64ch; font-size: 0.93rem; }
.fb.right { background: var(--ok-soft); color: var(--ok); }
.fb.wrong, .fb.unread { background: var(--bad-soft); color: var(--bad); }
.qfoot { padding: 12px 0 0; }
.work > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 10px 0; min-height: 44px; display: flex; align-items: center; }
.bd.key { margin: 4px 0 8px; }
.jobs { margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.95rem; }
.job b { font-weight: 650; color: var(--muted); }

/* phones: diagrams fit the screen; Zoom in shows them at least 560 px wide, sliding sideways in their own box */
.khead { display: none; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin: 0 0 6px; }
.khint { display: none; font-size: 0.9rem; color: var(--muted); }
.zoom { min-height: 40px; padding: 4px 12px; white-space: nowrap; }
@media (max-width: 560px) {
  .khead { display: flex; }
  #qs.zoomed .khint { display: inline; }
  #qs.zoomed .bd { overflow-x: auto; }
  #qs.zoomed .bd svg { width: var(--nat); max-width: none !important; }
  .words { display: grid; gap: 6px; }
  .wd { display: grid; grid-template-columns: minmax(5.5rem, 34%) 1fr; align-items: center; column-gap: 8px; }
  .wd .fbwrap { grid-column: 1 / -1; }
  .wd select { min-width: 0; }
  .q h3 { font-size: 1.15rem; }
}
.sheet-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; padding: 12px 0 4px; }
.hint { color: var(--muted); font-size: 0.9rem; }
.ask { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.share { padding: 8px 0 0; }
.print-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.share-out label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; font-weight: 600; margin-top: 8px; }
.share-out input { width: 100%; }
.recent { border-top: 1px solid var(--line); margin-top: 12px; }
.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); }

.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); width: max-content; transition: transform 0.2s; z-index: 20; pointer-events: none; }
.toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

.content { padding: 28px 0 8px; max-width: 760px; }
.content h2 { margin-top: 26px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.content p, .levels { max-width: 70ch; }
.levels { padding-left: 1.4em; }
.content .bd { max-width: 34rem; }
.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); }
@media (max-width: 600px) {
  .hero { padding-top: 12px; }
  .bar-ctl { grid-template-columns: minmax(0, 1fr) auto; justify-content: stretch; }
  .bar-ctl .lv { grid-column: 1 / -1; }
}

/* ---------- print ---------- */
.print-root { display: none; }
@page { margin: 10mm 12mm; }
@media print {
  :root { --ink: #000; --muted: #333; --line: #999; --paper: #fff; }
  body { background: #fff; color: #000; font: 11pt/1.35 Arial, 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: 8pt Arial, sans-serif; color: #444; text-align: right; padding-bottom: 3pt !important; margin: 0; }
  section.psheet, section.pkey { break-before: page; page-break-before: always; }
  section:first-child { break-before: auto; page-break-before: auto; }
  .ph { border-bottom: 1.5pt solid #000; margin: 0 0 4pt; break-after: avoid; page-break-after: avoid; }
  .ph h2 { font: 700 15pt var(--head); margin: 0; }
  .ph p { margin: 0 0 3pt; font-size: 9.5pt; }
  .pmeta { display: flex; justify-content: space-between; gap: 12pt; margin: 6pt 0 4pt; }
  .pdir { margin: 0 0 6pt; font-size: 10pt; }
  .pqs { list-style: none; margin: 0; padding: 0; }
  .pq { break-inside: avoid; page-break-inside: avoid; margin: 0 0 6pt; padding-top: 5pt; border-top: 0.75pt solid #000; }
  .psent { margin: 0 0 4pt; font-size: 12.5pt; }
  .space { border: 0.5pt solid #999; }
  .pkfig svg { display: block; max-width: 100%; }
  svg.dg line { stroke: #000; }
  svg.dg text { fill: #000; }
  .pjobs { margin: 3pt 0 0; font-size: 8.5pt; display: flex; flex-wrap: wrap; gap: 1pt 10pt; }
  .pjobs b { font-weight: 700; }
}
