/* /tools/. Never hard-code a colour — every one comes from the shell's custom properties, so dark
   mode needs no second block. MOBILE FIRST: every grid starts single-column, every control clears 44px. */

.tl-wrap{ max-width:860px; margin:0 auto; }
.tl-main{ padding-bottom:24px; }

.tl-eyebrow{
  font-size:11.5px; font-weight:700; letter-spacing:.14em; text-transform:uppercase;
  color:var(--crimson-text); margin:0 0 10px;
}
.tl-main h1{
  font-family:var(--display); font-weight:500;
  font-size:clamp(30px,5.4vw,46px); line-height:1.06; letter-spacing:-.01em;
  margin:0 0 14px; text-wrap:balance;
}
.tl-lede{
  font-family:var(--display); font-size:clamp(17px,2.3vw,20px); line-height:1.5;
  color:var(--ink-soft); max-width:56ch; margin:0 0 24px;
}
.tl-main h2{
  font-family:var(--display); font-weight:500;
  font-size:clamp(22px,3vw,28px); line-height:1.15;
  margin:38px 0 10px; text-wrap:balance;
}
.tl-main h3{
  font-size:13px; font-weight:700; letter-spacing:.06em;
  color:var(--ink); margin:22px 0 5px;
}
.tl-main p{ margin:0 0 12px; max-width:66ch; line-height:1.62; }
.tl-main ul,.tl-main ol{ margin:0 0 14px; padding-left:20px; max-width:66ch; }
.tl-main li{ margin-bottom:8px; line-height:1.6; }
.tl-main li::marker{ color:var(--gold); }
.tl-main code{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.92em; background:var(--paper-2); border:1px solid var(--line-2);
  border-radius:4px; padding:1px 5px;
}
.tl-maths li code{ display:inline-block; margin:2px 0; }


.tl-cards{
  display:grid; grid-template-columns:1fr; gap:12px; margin:0 0 32px;
}
@media (min-width:640px){
  .tl-cards{ grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); }
}
.tl-card{
  display:flex; flex-direction:column; gap:7px;
  background:var(--tile); border:1px solid var(--line); border-radius:10px;
  padding:18px 18px 16px; text-decoration:none; color:var(--ink);
  transition:border-color .18s ease, transform .18s ease;
}
.tl-card:hover,.tl-card:focus-visible{ border-color:var(--crimson); transform:translateY(-1px); }
.tl-card b{ font-family:var(--display); font-size:21px; font-weight:500; line-height:1.15; }
.tl-card span{ font-size:14.5px; color:var(--ink-soft); line-height:1.5; }
.tl-card-go{ color:var(--crimson-text) !important; font-weight:600; font-size:13.5px !important; }


.tl-calc{
  background:var(--tile); border:1px solid var(--line); border-radius:12px;
  padding:16px; margin:0 0 14px;
}
.tl-variants{ display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:620px){ .tl-variants{ grid-template-columns:1fr 1fr; } }

.tl-variant{
  border:1px solid var(--line); border-radius:9px; margin:0; padding:6px 14px 14px;
  background:var(--paper);
}
.tl-variant legend{
  font-family:var(--display); font-size:19px; font-weight:500; padding:0 6px;
  display:flex; align-items:baseline; gap:7px; flex-wrap:wrap;
}
.tl-tag{
  font-family:var(--ui); font-size:10.5px; font-weight:700; letter-spacing:.1em;
  text-transform:uppercase; color:var(--ink-soft);
  border:1px solid var(--line); border-radius:999px; padding:2px 8px;
}

.tl-field{ margin-top:10px; }
.tl-field label{
  display:block; font-size:12.5px; font-weight:600; letter-spacing:.03em;
  color:var(--ink-soft); margin-bottom:4px;
}
.tl-field input,.tl-field select{
  width:100%; box-sizing:border-box; min-height:44px;
  font-family:var(--ui); font-size:16px;  /* 16px: anything smaller makes iOS zoom on focus */
  color:var(--ink); background:var(--paper-2);
  border:1px solid var(--line); border-radius:7px; padding:9px 11px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.tl-field input{ font-variant-numeric:tabular-nums; }
.tl-field input:focus,.tl-field select:focus{
  outline:none; border-color:var(--crimson);
  box-shadow:0 0 0 3px color-mix(in srgb, var(--crimson) 22%, transparent);
}
.tl-field input[aria-invalid="true"]{ border-color:var(--crimson); }

.tl-rate{
  margin:12px 0 0 !important; font-size:13px; color:var(--ink-soft);
  border-top:1px dashed var(--line); padding-top:9px;
}
.tl-rate span{
  font-family:var(--display); font-size:24px; color:var(--ink);
  font-variant-numeric:tabular-nums; margin-right:5px;
}

.tl-opts{ display:grid; grid-template-columns:1fr; gap:12px; margin-top:14px; }
@media (min-width:620px){ .tl-opts{ grid-template-columns:1fr 1fr; } }

.tl-actions{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px; margin-top:14px;
}
.tl-reset{
  min-height:44px; padding:10px 18px; border-radius:999px; cursor:pointer;
  font-family:var(--ui); font-size:13.5px; font-weight:600;
  color:var(--ink-soft); background:transparent; border:1px solid var(--line);
  transition:.18s ease;
}
.tl-reset:hover,.tl-reset:focus-visible{ color:var(--crimson); border-color:var(--crimson); }
.tl-privacy{ margin:0 !important; font-size:12.5px; color:var(--ink-soft); flex:1 1 200px; }


.tl-result{ margin:0 0 8px; }

.tl-verdict{
  display:flex; flex-direction:column; gap:4px; max-width:none !important;
  border:1px solid var(--line); border-left-width:4px; border-radius:0 10px 10px 0;
  background:var(--paper-2); padding:14px 16px; margin:0 0 12px !important;
}
.tl-verdict strong{
  font-family:var(--display); font-weight:500; font-size:clamp(20px,3.4vw,26px); line-height:1.15;
}
.tl-verdict span{ font-size:14px; color:var(--ink-soft); line-height:1.5; }
.tl-verdict--significant{ border-left-color:var(--gold); }
.tl-verdict--significant strong{ color:var(--crimson-text); }
.tl-verdict--not-significant{ border-left-color:var(--ink-soft); }
.tl-verdict--none,.tl-verdict--invalid{ border-left-color:var(--line); }
.tl-verdict--invalid strong{ color:var(--ink-soft); }

.tl-rows{ display:grid; grid-template-columns:1fr; gap:1px; margin:0 0 12px;
  background:var(--line); border:1px solid var(--line); border-radius:10px; overflow:hidden; }
@media (min-width:700px){ .tl-rows{ grid-template-columns:1fr 1fr; } }
.tl-row{
  background:var(--tile); padding:12px 14px;
  display:grid; grid-template-columns:1fr auto; gap:2px 12px; align-items:baseline;
}
.tl-row dt{ font-size:12.5px; font-weight:600; color:var(--ink-soft); letter-spacing:.02em; }
.tl-row dd{ margin:0; }
.tl-figure{
  font-family:var(--display); font-size:clamp(20px,3vw,25px); line-height:1.1;
  font-variant-numeric:tabular-nums; text-align:right; white-space:nowrap;
}
.tl-hint{ grid-column:1 / -1; font-size:12.5px; color:var(--ink-soft); line-height:1.45; }

.tl-summary{
  font-size:13.5px; color:var(--ink-soft); line-height:1.55;
  border-left:2px solid var(--line); padding-left:12px; margin:0 0 6px !important;
}
.tl-summary:empty{ display:none; }


.tl-steps li{ line-height:1.6; }

.tl-siblings{
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  margin-top:36px; padding-top:18px; border-top:1px solid var(--line);
}
.tl-siblings-l{
  font-size:11px; font-weight:700; letter-spacing:.14em; text-transform:uppercase;
  color:var(--ink-soft);
}
.tl-siblings a{
  font-size:13px; color:var(--ink-soft); text-decoration:none;
  border:1px solid var(--line); border-radius:999px; padding:8px 13px;
  transition:.18s ease;
}
.tl-siblings a:hover,.tl-siblings a:focus-visible{ color:var(--crimson); border-color:var(--crimson); }

@media (prefers-reduced-motion: reduce){
  .tl-card,.tl-reset,.tl-siblings a{ transition:none; }
  .tl-card:hover,.tl-card:focus-visible{ transform:none; }
}


.ag-form{
  border:1px solid var(--line); border-radius:14px; background:var(--tile);
  padding:18px 18px 14px;
}
.ag-field label{
  display:block; font-size:11px; font-weight:700; letter-spacing:.13em;
  text-transform:uppercase; color:var(--ink-soft); margin-bottom:6px;
}
.ag-field textarea{
  font:inherit; font-family:var(--display); font-size:18px; line-height:1.5;
  width:100%; box-sizing:border-box; padding:11px 13px; resize:vertical;
  border:1px solid var(--line); border-radius:10px;
  background:var(--paper); color:var(--ink);
}
.ag-field textarea:focus{ outline:none; border-color:var(--crimson); }

.ag-words-wrap{ margin-top:15px; }
.ag-words-h{
  font-size:11px; font-weight:700; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ink-soft); margin:0 0 8px;
}
.ag-hint{
  font-weight:500; letter-spacing:0; text-transform:none; font-size:12px;
  margin-left:8px; opacity:.85;
}
.ag-words{ display:flex; flex-wrap:wrap; gap:7px; }
.ag-chip{
  display:inline-flex; align-items:center; gap:5px;
  border:1px solid var(--line); border-radius:9px; padding:4px 6px 4px 9px;
  background:var(--paper); font-size:13px;
}
.ag-chip.on{ border-color:var(--crimson); background:color-mix(in srgb, var(--crimson) 8%, transparent); }
.ag-chip.off{ opacity:.42; }
.ag-chip label{ display:inline-flex; align-items:center; gap:6px; cursor:pointer; }
.ag-chip.off label{ cursor:not-allowed; }
.ag-chip input{ accent-color:var(--crimson); margin:0; }
.ag-chip-word{ font-weight:600; letter-spacing:.02em; }
.ag-roll{
  font:inherit; font-size:14px; line-height:1; cursor:pointer; padding:3px 5px;
  border:1px solid transparent; border-radius:6px; background:transparent; color:var(--ink-soft);
}
.ag-roll:hover:not(:disabled),.ag-roll:focus-visible:not(:disabled){ color:var(--crimson); border-color:var(--crimson); }
.ag-roll:disabled{ opacity:.3; cursor:default; }

.ag-drop{
  font-size:12.5px; margin:11px 0 0; padding:7px 12px; border-radius:0 8px 8px 0;
  border-left:3px solid var(--gold); color:var(--ink-soft);
}

.ag-actions{ display:flex; flex-wrap:wrap; gap:9px; align-items:center; margin-top:16px; }
/* The FILLED button carries white. --crimson is the FILL token; --crimson-text is for small
   crimson type on the PAGE background and measures 1.34:1 on the fill. */
.ag-btn{
  font:inherit; font-size:13.5px; font-weight:600; cursor:pointer;
  padding:9px 16px; border-radius:999px; border:1px solid var(--crimson);
  background:var(--crimson); color:#fff; transition:.18s ease;
}
.ag-btn:hover,.ag-btn:focus-visible{ filter:brightness(1.08); }
.ag-btn--ghost{ background:transparent; color:var(--ink-soft); border-color:var(--line); }
.ag-btn--ghost:hover,.ag-btn--ghost:focus-visible{ color:var(--crimson); border-color:var(--crimson); filter:none; }
.ag-btn:disabled{ cursor:not-allowed; opacity:.4; filter:none; }
.ag-btn:disabled:hover{ filter:none; }
.ag-count{
  font-size:13px; color:var(--ink); font-weight:500;
  font-variant-numeric:tabular-nums; flex:1 1 220px;
}
.ag-privacy{ font-size:12px; color:var(--ink-soft); margin:15px 0 0; opacity:.85; }


.ag-sheet{
  margin-top:20px; padding:24px 24px 18px;
  border:1px solid var(--line); border-radius:12px; background:var(--paper);
}
.ag-sheet-h{
  font-size:11px; font-weight:700; letter-spacing:.13em; text-transform:uppercase;
  color:var(--ink-soft); margin:0 0 14px;
}
.ag-swatch{
  display:inline-block; width:.85em; height:.85em; vertical-align:-.06em;
  border-bottom:2px solid var(--crimson);
}
.ag-line{
  font-family:var(--display); font-size:clamp(19px, 2.6vw, 25px); line-height:2.1;
  margin:0; color:var(--ink);
}
.ag-gap{ white-space:nowrap; }
.ag-jumble{
  display:inline-block; padding:0 .18em; border-bottom:2px solid var(--crimson);
  font-family:var(--ui); font-size:.78em; font-weight:700;
  letter-spacing:.22em; text-indent:.22em; text-transform:uppercase;
  color:var(--crimson);
}
.ag-key{ margin-top:22px; padding-top:14px; border-top:1px dashed var(--line); }
.ag-key summary{
  cursor:pointer; font-size:12.5px; font-weight:600; color:var(--ink-soft);
}
.ag-key summary:hover{ color:var(--crimson); }
.ag-key-list{
  margin:11px 0 0; padding-left:1.3em;
  font-size:14px; line-height:1.9; color:var(--ink-soft);
  columns:2; column-gap:28px;
}
.ag-key-list b{ letter-spacing:.14em; color:var(--crimson); }
@media (max-width:520px){ .ag-key-list{ columns:1; } }

/* sr-only caption on each grid: a word search is a table of letters, and the caption is the only
   thing telling a screen-reader user what it is. */
.ts-sr{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip:rect(0 0 0 0); clip-path:inset(50%); white-space:nowrap;
}


.ts-form{
  background:var(--paper-2); border:1px solid var(--line); border-radius:12px; padding:16px;
}
.ts-field{ display:flex; flex-direction:column; gap:5px; margin-bottom:12px; }
.ts-field:last-child{ margin-bottom:0; }
.ts-field label,.ts-dirs legend{
  font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  color:var(--ink-soft);
}
.ts-opt,.ts-hint{
  font-weight:400; letter-spacing:0; text-transform:none; color:var(--ink-soft); opacity:.8;
}
.ts-field input[type=text],.ts-field textarea,.ts-field select{
  font:inherit; color:var(--ink); background:var(--paper);
  border:1px solid var(--line-2); border-radius:8px; padding:10px 11px; min-height:44px; width:100%;
}
.ts-field textarea{ resize:vertical; line-height:1.55; }
.ts-field input:focus,.ts-field textarea:focus,.ts-field select:focus{
  outline:none; border-color:var(--crimson);
}

.ts-themes{ display:flex; flex-wrap:wrap; align-items:center; gap:7px; margin:0 0 14px; }
.ts-themes-l{
  font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-soft);
}
.ts-theme{
  font:inherit; font-size:13px; cursor:pointer; min-height:44px; padding:6px 14px;
  color:var(--ink); background:var(--tile); border:1px solid var(--line); border-radius:999px;
  transition:.15s ease;
}
.ts-theme:hover,.ts-theme:focus-visible{ color:var(--crimson); border-color:var(--crimson); }

.ts-opts{ display:grid; grid-template-columns:1fr; gap:12px; align-items:start; margin-bottom:12px; }
@media (min-width:620px){ .ts-opts{ grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); } }
.ts-opts > .ts-field{ margin-bottom:0; }
.ts-opts > .ts-field select{ max-width:340px; }

.ts-dirs{ border:1px solid var(--line-2); border-radius:8px; padding:9px 11px 11px; margin:0; }
.ts-dirs legend{ padding:0 5px; }
.ts-dirs-row{ display:flex; flex-wrap:wrap; gap:0 20px; }
.ts-dirs label,.ts-check{
  display:flex; align-items:center; gap:9px; min-height:44px; cursor:pointer; font-size:14px;
}
.ts-dirs input,.ts-check input{ accent-color:var(--crimson); margin:0; width:17px; height:17px; }

.ts-notices{
  list-style:none; margin:0 0 12px; padding:10px 12px;
  background:color-mix(in srgb, var(--gold) 12%, transparent);
  border:1px solid color-mix(in srgb, var(--gold) 45%, transparent);
  border-radius:8px; font-size:13.5px; line-height:1.5;
}
.ts-notices li{ margin:0 0 5px; }
.ts-notices li:last-child{ margin:0; }

/* An empty sheet must not caption nothing. The sentence is the MODEL'S own summary line, and
   `data-empty` is server-rendered, so it is right on first paint and with JavaScript off. */
.ts-empty{
  color:var(--ink-soft); font-size:14.5px; line-height:1.5; text-align:center;
  margin:0; padding:30px 16px; border:1px dashed var(--line);
  border-radius:10px; background:var(--paper-2);
}
.tl-sheet[data-empty] .ts-sheet-sub,
.tl-sheet[data-empty] .ts-bank,
.tl-sheet[data-empty] .cg-author,
.tl-sheet[data-empty] .cg-strip,
.tl-sheet[data-empty] .ts-key-list,
.tl-sheet[data-empty] .cc-key,
.tl-sheet[data-empty] .cg-key,
.tl-sheet[data-empty] .cg-solution,
.tl-sheet[data-empty] [data-grid]{ display:none; }
.tl-sheet:not([data-empty]) .ts-empty{ display:none; }
.tl-sheet--key[data-empty]{ opacity:.55; }

/* Dim the key sheet when the reader said not to print it — otherwise nothing on screen confirms
   the setting took. .55, not fainter: they usually still want to read it. */
.tl-sheet--key[data-key-mode="none"]{ opacity:.55; border-style:dotted; transition:opacity .18s ease; }
.tl-sheet--key[data-key-mode="none"]:hover,
.tl-sheet--key[data-key-mode="none"]:focus-within{ opacity:1; }

/* EVERY SIZE ON A SHEET COMES FROM THESE TWO TOKENS, and the large-print class changes the TOKENS —
   that is what makes large print enlarge the puzzle, not just its box.
   tools/test-tools-printing.mjs asserts every grid and word-bank rule references a token, not a px. */
.tl-sheet{
  --ts-cell:27px;
  --ts-font:15px;
  --ts-num:9px;
  margin-top:20px; padding:18px;
  border:1px solid var(--line); border-radius:12px;
  /* a grid wider than the sheet scrolls INSIDE the sheet; turned off for print, where a scroll
     container slices the grid in half on paper. */
  overflow-x:auto;
  /* Scroll-shadow trick, no JavaScript: `local` gradients in the paper colour cover the shadow at an
     edge you cannot scroll toward. Tinted from --ink, NEVER --shadow, which is invisible on a dark sheet. */
  background:
    linear-gradient(to right, var(--paper) 40%, transparent) left center,
    linear-gradient(to left,  var(--paper) 40%, transparent) right center,
    radial-gradient(farthest-side at 0 50%,
      color-mix(in srgb, var(--ink) 30%, transparent), transparent) left center,
    radial-gradient(farthest-side at 100% 50%,
      color-mix(in srgb, var(--ink) 30%, transparent), transparent) right center,
    var(--paper);
  background-repeat:no-repeat;
  background-size:40px 100%, 40px 100%, 18px 100%, 18px 100%;
  background-attachment:local, local, scroll, scroll;
}
.tl-sheet.is-lg{ --ts-cell:40px; --ts-font:21px; --ts-num:12px; }
.tl-sheet--key{ border-style:dashed; }
/* On a phone the cells shrink through the TOKENS (the puzzle really shrinks rather than clipping)
   and the sheet scrolls its own overflow. None of it reaches paper: the print block re-sets both
   tokens in millimetres. */
@media (max-width:620px){
  .tl-sheet{ --ts-cell:21px; --ts-font:13px; --ts-num:8px; padding:14px; }
  .tl-sheet.is-lg{ --ts-cell:31px; --ts-font:17px; --ts-num:10px; }
}
.ts-sheet-h{
  font-family:var(--display); font-weight:500; font-size:clamp(19px,2.6vw,24px);
  margin:0 0 4px; line-height:1.15;
}
.ts-sheet-sub{ font-size:13.5px; color:var(--ink-soft); margin:0 0 16px; }

.ts-bank{ margin-top:18px; }
.ts-bank-h{
  font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft); margin:0 0 7px;
}
.ts-bank-list{
  list-style:none; margin:0; padding:0;
  columns:2; column-gap:22px; font-size:var(--ts-font); line-height:1.75; letter-spacing:.06em;
}
@media (min-width:560px){ .ts-bank-list{ columns:3; } }
.ts-bank-list li{ break-inside:avoid; }
.ts-key-list{ margin:14px 0 0; padding-left:20px; font-size:var(--ts-font); line-height:1.7; }
.ts-key-list b{ letter-spacing:.08em; }
.ts-key-list span{ color:var(--ink-soft); font-size:.86em; }

.ws-grid{ border-collapse:collapse; margin:0 auto; table-layout:fixed; }
.ws-grid td{
  /* min-width, not just width: table-layout:fixed still lets a table shrink to its container, which
     made a large-print grid on a phone render SMALLER cells than the ordinary setting. */
  width:var(--ts-cell); min-width:var(--ts-cell); height:var(--ts-cell);
  font-size:var(--ts-font); font-weight:600; letter-spacing:.04em;
  text-align:center; vertical-align:middle; padding:0;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
/* THE ANSWER KEY'S MARKING IS A BORDER, NOT A FILL, here and below: browsers do not print
   background colours unless the reader enables background graphics, so a tint prints as blank paper. */
.ws-grid--solved td{ color:var(--ink-soft); font-weight:400; }
.ws-grid--solved td.on{
  color:var(--ink); font-weight:700;
  border:1.5px solid currentColor;
  background:color-mix(in srgb, var(--gold) 16%, transparent);
}

.cc-grid{ border-collapse:collapse; margin:0 auto; table-layout:fixed; }
.cc-grid td{
  width:var(--ts-cell); min-width:var(--ts-cell); height:var(--ts-cell); padding:0; position:relative;
  text-align:center; vertical-align:middle;
}
.cc-grid td.off{ border:0; background:none; }
.cc-grid td.on{ border:1px solid var(--ink); }
.cc-num{
  position:absolute; top:1px; left:2px; font-size:var(--ts-num); line-height:1;
  color:var(--ink-soft); font-weight:700;
}
.cc-let{
  font-size:var(--ts-font); font-weight:600; letter-spacing:.03em;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.cc-grid--solved td.on .cc-let{ font-weight:700; }
.cc-bank{ display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:12px 20px; }
.cc-bank-g{ break-inside:avoid; }
.cc-bank-n{
  font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft); margin:0 0 3px;
}
.cc-bank .ts-bank-list{ columns:1; }
.cc-key{ display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:14px 24px; margin-top:14px; }
.cc-key-col{ break-inside:avoid; }
.cc-key-h{
  font-size:11.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--ink-soft); margin:0 0 4px;
}
.cc-key .ts-key-list{ margin-top:0; list-style:none; padding-left:0; }
.cc-key .ts-key-list b{ display:inline-block; min-width:1.9em; color:var(--ink-soft); }

.cg-line{
  display:flex; flex-wrap:wrap; align-items:flex-end; gap:0 var(--ts-num);
  margin:0 0 14px; max-width:none;
}
.cg-word{ display:inline-flex; white-space:nowrap; }
.cg-space{ display:inline-block; width:calc(var(--ts-cell) * .7); }
.cg-cell{
  display:inline-flex; flex-direction:column; align-items:center;
  width:calc(var(--ts-cell) * .82); margin:0 1px 6px;
}
.cg-cell b{
  font-size:var(--ts-font); font-weight:700; letter-spacing:.04em; line-height:1.3;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.cg-cell i{
  display:block; width:100%; min-height:calc(var(--ts-font) * 1.25);
  border-bottom:1px solid var(--ink); font-style:normal; font-weight:600;
  font-size:var(--ts-font); line-height:1.25; text-align:center;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.cg-cell.given i{ color:var(--crimson-text); }
.cg-lit{
  align-self:flex-end; font-size:var(--ts-font); line-height:1.3;
  padding-bottom:calc(var(--ts-font) * 1.25 + 6px);
}
.cg-author{ font-size:var(--ts-font); color:var(--ink-soft); margin:0 0 16px; }
.cg-strip{
  display:flex; flex-wrap:wrap; gap:2px var(--ts-num);
  padding-top:14px; border-top:1px dashed var(--line);
}
.cg-solution{
  font-size:var(--ts-font); font-weight:600; letter-spacing:.04em; line-height:1.6;
  margin:0 0 16px; max-width:none;
}
.cg-key{ display:flex; flex-wrap:wrap; gap:6px 14px; }
.cg-key-pair{
  display:inline-flex; align-items:baseline; gap:3px;
  font-size:calc(var(--ts-font) * .95); color:var(--ink-soft);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.cg-key-pair.used{ color:var(--ink); font-weight:700; }
.cg-key-pair i{ font-style:normal; }

/* PDF TO MARKDOWN — /tools/pdf-to-markdown/. No print sheet: the printable thing is the PREVIEW,
   which the print block below brings back on its own. Colours from the shell's tokens only. */
.pm-app{
  background:var(--tile); border:1px solid var(--line); border-radius:12px;
  padding:16px; margin:0 0 14px;
}
.pm-drop{
  display:flex; flex-direction:column; align-items:center; gap:10px; text-align:center;
  border:2px dashed var(--line-2); border-radius:10px; background:var(--paper);
  padding:26px 16px; transition:border-color .18s ease, background .18s ease;
}
.pm-drop.is-over{ border-color:var(--crimson); background:var(--paper-2); }
.pm-drop b{ font-family:var(--display); font-size:19px; font-weight:500; }
.pm-drop small{ color:var(--ink-soft); font-size:13.5px; max-width:44ch; line-height:1.5; }
.pm-pick{
  display:inline-flex; align-items:center; justify-content:center; min-height:44px;
  padding:0 20px; border-radius:8px; border:1px solid var(--crimson);
  background:var(--crimson); color:#fff; font-weight:650; font-size:15px; cursor:pointer;
}
.pm-pick:hover,.pm-pick:focus-visible{ filter:brightness(1.07); }
.pm-drop input[type=file]{ position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }

.pm-privacy{
  display:flex; gap:8px; align-items:flex-start;
  margin:12px 0 0; font-size:13.5px; line-height:1.55; color:var(--ink-soft);
}
.pm-privacy b{ color:var(--ink); }

.pm-opts{ display:flex; flex-wrap:wrap; gap:14px; margin:14px 0 0; }
.pm-check{ display:flex; align-items:center; gap:8px; font-size:14px; min-height:44px; cursor:pointer; }
.pm-check input{ width:18px; height:18px; accent-color:var(--crimson); }

.pm-status{ margin:12px 0 0; font-size:14px; line-height:1.5; min-height:1.5em; color:var(--ink-soft); }
.pm-status[data-kind="ok"]{ color:var(--ink); font-weight:600; }
.pm-status[data-kind="bad"]{ color:var(--crimson-text); font-weight:600; }
.pm-bar{ width:100%; height:6px; margin-top:8px; accent-color:var(--crimson); }

/* Empty and error states are CENTRED WITH A NEXT ACTION, never a blank panel. */
.pm-empty{
  text-align:center; color:var(--ink-soft); font-size:14.5px; line-height:1.6;
  border:1px solid var(--line); border-radius:12px; background:var(--tile);
  padding:32px 18px; margin:0 0 14px;
}
.pm-empty b{ display:block; font-family:var(--display); font-size:19px; color:var(--ink); margin-bottom:6px; }

.pm-ocr{
  border:1px solid var(--gold); border-radius:12px; background:var(--paper-2);
  padding:16px; margin:0 0 14px;
}
.pm-ocr h3{ margin:0 0 6px; }
.pm-ocr p{ font-size:14px; }
.pm-btn{
  display:inline-flex; align-items:center; justify-content:center; min-height:44px;
  padding:0 16px; border-radius:8px; border:1px solid var(--line-2);
  background:var(--tile); color:var(--ink); font-weight:600; font-size:14.5px; cursor:pointer;
}
.pm-btn:hover,.pm-btn:focus-visible{ border-color:var(--crimson); }
.pm-btn[disabled]{ opacity:.45; cursor:not-allowed; }
.pm-btn--go{ background:var(--crimson); border-color:var(--crimson); color:#fff; }

.pm-notes{ list-style:none; margin:0 0 14px; padding:0; }
.pm-note{
  border-left:3px solid var(--gold); background:var(--paper-2);
  padding:9px 12px; margin:0 0 8px; font-size:13.5px; line-height:1.55; border-radius:0 6px 6px 0;
}
.pm-note--table,.pm-note--columns{ border-left-color:var(--crimson); }

.pm-actions{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 12px; }
.pm-panes{ display:grid; grid-template-columns:1fr; gap:12px; }
@media (min-width:860px){ .pm-panes{ grid-template-columns:1fr 1fr; } }
.pm-pane h3{ margin:0 0 6px; }
.pm-out{
  width:100%; min-height:340px; resize:vertical;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:13px; line-height:1.55;
  background:var(--paper); color:var(--ink);
  border:1px solid var(--line-2); border-radius:8px; padding:12px;
}
.pm-preview{
  min-height:340px; max-height:70vh; overflow:auto;
  background:var(--paper); border:1px solid var(--line-2); border-radius:8px; padding:12px 14px;
  font-size:14.5px; line-height:1.6;
}
.pm-preview h1,.pm-preview h2,.pm-preview h3,.pm-preview h4,.pm-preview h5,.pm-preview h6{
  font-family:var(--display); font-weight:500; line-height:1.2; margin:16px 0 6px;
}
.pm-preview h1{ font-size:24px; }
.pm-preview h2{ font-size:20px; }
.pm-preview h3,.pm-preview h4,.pm-preview h5,.pm-preview h6{ font-size:16px; letter-spacing:0; }
.pm-preview p{ margin:0 0 10px; }
.pm-preview ul,.pm-preview ol{ margin:0 0 10px; padding-left:22px; }
.pm-preview li{ margin-bottom:4px; }
.pm-preview > :first-child{ margin-top:0; }

.pm-advanced{
  border:1px solid var(--line); border-radius:12px; background:var(--paper-2);
  padding:16px; margin:0 0 14px;
}

/* 🚨 The worked example is real markdown, so its lines are long. Unstyled it was 1198px wide and
   dragged the WHOLE page into a sideways scroll on a phone. It scrolls inside its own box. */
.pm-demo{
  overflow-x:auto; max-width:100%;
  background:var(--paper); border:1px solid var(--line-2); border-radius:8px;
  padding:12px 14px; margin:0 0 16px;
  font-size:13px; line-height:1.6;
}
.pm-demo code{ font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color:var(--ink); }

/* PRINTING — scoped, and deliberately NOT feed/paper.css: that sheet hides everything outside its
   own wrapper and is why this site's printables printed one blank page for months.
   The key's own-page mode lives in a data attribute, so it is server-rendered correct and survives
   Ctrl+P with JavaScript off. */
@media print{
  .tl-wrap > .tl-main > *{ display:none !important; }
  .tl-wrap > .tl-main > .ag-sheet{ display:block !important; }
  .tl-wrap > .tl-main > .tl-sheet{ display:block !important; }
  .tl-wrap > .tl-main > h1{ display:block !important; font-size:20pt; margin:0 0 4pt; }
  /* :has() is the invariant ("this page renders sheets of its own") rather than a list of slugs a new
     tool would have to join; unsupported costs one extra heading line, not a broken sheet. */
  .tl-main:has(> .tl-sheet) > h1{ display:none !important; }
  header,footer,nav,script{ display:none !important; }

  /* No puzzle sheet on the PDF tool — what is worth printing is the converted document. */
  .tl-wrap > .tl-main > .pm-result{ display:block !important; }
  .pm-result .pm-actions,.pm-result .pm-pane--source,.pm-result .pm-notes{ display:none !important; }
  .pm-panes{ display:block; }
  .pm-preview{ border:none; padding:0; max-height:none; overflow:visible; }

  .ag-sheet{ border:none; padding:0; margin:0; background:none; }
  .ag-line{ font-size:17pt; line-height:2.4; }
  .ag-key{ break-inside:avoid; }
  .ag-key summary{ list-style:none; }
  .ag-key summary::-webkit-details-marker{ display:none; }

  .tl-sheet{
    --ts-cell:7.6mm; --ts-font:11.5pt; --ts-num:6pt;
    border:none; padding:0; margin:0; background:none;
    /* SCREEN DIMMING MUST NOT REACH PAPER. !important because the two dimming rules out-specify a bare
       .tl-sheet and a media query adds no specificity. */
    opacity:1 !important;
    overflow:visible;
  }
  .tl-sheet.is-lg{ --ts-cell:11.5mm; --ts-font:16pt; --ts-num:8pt; }
  .ts-sheet-h{ font-size:17pt; margin:0 0 3pt; }
  .ts-sheet-sub{ font-size:10pt; margin:0 0 10pt; }
  .ts-bank{ margin-top:12pt; break-inside:avoid; }
  .ts-bank-list{ columns:3; }
  .cg-line{ margin-bottom:10pt; }

  /* the `.tl-wrap > .tl-main >` prefix matches the specificity of the display rule above; without it
     "do not print" loses and the key prints anyway. */
  .tl-wrap > .tl-main > .tl-sheet[data-key-mode="separate"]{
    break-before:page; page-break-before:always;
  }
  .tl-wrap > .tl-main > .tl-sheet[data-key-mode="same"]{ margin-top:10mm; }
  .tl-wrap > .tl-main > .tl-sheet[data-key-mode="none"]{ display:none !important; }
}

@media (prefers-reduced-motion: reduce){
  .ag-btn,.ag-roll,.ts-theme,.tl-sheet--key[data-key-mode="none"]{ transition:none; }
}
