/* Playbot, in the Bauhaus design system: Jost, square corners, 2px black rules, gold / blue / pink. */
:root {
  --bg: #f6f3ea; --card: #fffdf7; --soft: #e9e3d3; --ink: #111; --muted: #5c5848; --rule: #111; --hair: #d5cfbf;
  --gold: #fbaa2b; --blue: #16a1d7; --pink: #d716ac; --on-pink: #fff; --on-blue: #111;
  --font: Jost, Futura, 'Century Gothic', system-ui, sans-serif;
  --bar-h: 72px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #141412; --card: #1d1c19; --soft: #2b2924; --ink: #f2efe6; --muted: #b9b4a6; --rule: #f2efe6; --hair: #3b3932;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.4 var(--font); min-height: 100vh; }
button, input { font-family: var(--font); border-radius: 0; }
[hidden] { display: none !important; }
kbd { font: 600 0.9em var(--font); border: 1.5px solid var(--rule); padding: 0 4px; }

/* ---- the bar ---- */
.bar { display: flex; align-items: center; gap: 24px; height: var(--bar-h); padding: 0 24px; background: var(--gold);
  color: #111; border-bottom: 3px solid #111; }
.brand { display: block; text-decoration: none; }
.mark { display: grid; grid-template-columns: repeat(2, 14px); gap: 4px; }
.mark i { width: 14px; height: 14px; background: #111; }
.mark i:nth-child(2) { background: var(--blue); } .mark i:nth-child(3) { background: var(--pink); }
.mark i:nth-child(4) { background: #fffdf7; }
.bar h1 { margin: 0; font: 800 30px/1 var(--font); letter-spacing: -0.01em; white-space: nowrap; }
.tabs { display: flex; border: 2px solid #111; }
.tabs a { display: flex; align-items: center; min-height: 44px; padding: 0 20px; color: #111; text-decoration: none;
  font-weight: 600; font-size: 17px; }
.tabs a + a { border-left: 2px solid #111; }
.tabs a[aria-current="page"] { background: #111; color: var(--gold); }
.tabs a:not([aria-current="page"]):hover { background: rgba(0, 0, 0, .08); }
.theme { display: flex; border: 2px solid #111; margin-left: auto; }
.theme button { min-height: 40px; padding: 0 14px; border: 0; background: transparent; color: #111; font-size: 14px;
  font-weight: 500; cursor: pointer; }
.theme button + button { border-left: 2px solid #111; }
.theme button[aria-pressed="true"] { background: #111; color: var(--gold); font-weight: 600; }

/* ---- layout: tiles on the left, every result on the right, all above the fold ---- */
main { display: grid; grid-template-columns: minmax(380px, 5fr) minmax(340px, 6fr); gap: 24px; padding: 20px 24px;
  height: calc(100vh - var(--bar-h)); }
.board { display: flex; flex-direction: column; gap: 16px; min-width: 0; min-height: 0; overflow-y: auto; }
/* A scrolling board takes focus when clicked; its tiles show their own focus, so the board needs no ring. */
.board:focus { outline: none; }
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 20px; }
.controls .hint { flex-basis: 100%; margin: 0; }
.hint { color: var(--muted); font-size: 14px; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 0 0 6px; }
.seg { display: flex; border: 2px solid var(--rule); }
.seg button { min-width: 44px; min-height: 44px; border: 0; background: var(--card); color: var(--ink); font-size: 16px;
  font-weight: 600; cursor: pointer; }
.seg button + button { border-left: 2px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.actions { display: flex; gap: 10px; }
.primary, .ghost { min-height: 44px; padding: 0 22px; border: 2px solid var(--rule); font-size: 17px; font-weight: 700;
  cursor: pointer; }
.primary { background: var(--gold); color: #111; }
.primary:hover { background: #ffbe55; }
.ghost { background: transparent; color: var(--ink); font-weight: 600; }
.ghost:hover { background: var(--soft); }

/* ---- Wordsmith: an N x N grid of square tiles turned 45°, so the grid is a diamond and each tile a diamond ---- */
/* flex-basis 0 so the wrap's size is the room left over, never the tiles' own size (they are sized to fit it); at
   least 200px, so a short window gets smaller tiles rather than a scrolling board. */
.diamond-wrap { flex: 1 1 0; min-height: 200px; display: grid; place-items: center; }
.diamond { display: grid; grid-template-columns: repeat(var(--n, 4), var(--tile, 72px)); gap: var(--gap, 8px);
  transform: rotate(45deg); }
.tile { position: relative; width: var(--tile, 72px); height: var(--tile, 72px); border: 2px solid var(--rule);
  background: var(--card); }
.tile input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent;
  color: inherit; text-align: center; transform: rotate(-45deg); font-weight: 700; text-transform: uppercase;
  font-size: calc(var(--tile, 72px) * var(--fit, .42)); outline: none; }
.tile:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.tile .score, .tile .step { position: absolute; transform: rotate(-45deg); font-weight: 700; line-height: 1;
  pointer-events: none; font-size: max(11px, calc(var(--tile, 72px) * .17)); }
.tile .score { top: 5%; left: 5%; color: var(--muted); }
.tile .step { right: 6%; bottom: 6%; }
.tile.hl { background: var(--blue); color: var(--on-blue); }
.tile.hl.first { background: var(--pink); color: var(--on-pink); }
.tile.hl .score { color: inherit; opacity: .85; }
.tile.dead { background: var(--soft); }

/* ---- Quartiles: 4 columns x 5 rows ---- */
.quad { display: grid; grid-template-columns: repeat(4, minmax(96px, 132px)); gap: 10px; align-content: start; }
.qtile { position: relative; height: 64px; border: 2px solid var(--rule); background: var(--card); }
.qtile input { width: 100%; height: 100%; padding: 0 6px; border: 0; background: transparent; color: inherit;
  text-align: center; font-size: 24px; font-weight: 600; text-transform: lowercase; outline: none; }
.qtile:focus-within { outline: 3px solid var(--gold); outline-offset: 2px; }
.qtile .step { position: absolute; right: 5px; bottom: 3px; font-size: 12px; font-weight: 700; pointer-events: none; }
/* A hovered word's tiles, in order (John): yellow, blue, pink, then white with the text inverted (the ink colour, so
   it's white on the dark theme and stays visible on the light one). */
.qtile.hl[data-step="1"] { background: var(--gold); color: #111; }
.qtile.hl[data-step="2"] { background: var(--blue); color: var(--on-blue); }
.qtile.hl[data-step="3"] { background: var(--pink); color: var(--on-pink); }
.qtile.hl[data-step="4"] { background: var(--ink); color: var(--bg); }

/* ---- results ---- */
.results { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 2px solid var(--rule);
  background: var(--card); }
.results-head { display: flex; align-items: baseline; gap: 16px; padding: 12px 16px; border-bottom: 2px solid var(--rule); }
.results-head h2 { margin: 0; font-size: 22px; font-weight: 700; white-space: nowrap; }
.results-head .hint { margin: 0; }
.results-list { flex: 1 1 auto; min-height: 0; padding: 10px 12px; column-width: 9em; column-gap: 14px;
  column-fill: auto; overflow-x: auto; overflow-y: hidden; font-size: var(--rsize, 16px); }
.results-list h3 { break-after: avoid; margin: 0 0 4px; padding: 4px 6px; background: var(--ink); color: var(--bg);
  font-size: 0.8em; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.results-list h3:not(:first-child) { margin-top: 8px; }
.results-list .w { display: flex; justify-content: space-between; gap: 8px; width: 100%; padding: 1px 6px;
  border: 0; background: transparent; color: inherit; font-size: 1em; text-align: left; cursor: pointer;
  break-inside: avoid; line-height: 1.35; }
.results-list .w b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.results-list .w:hover { background: var(--soft); }
.results-list .w[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.results-list .w[aria-pressed="true"] b { color: inherit; }
.results-list .empty { color: var(--muted); }
.ws-word { text-transform: uppercase; }

@media (max-width: 900px) {
  :root { --bar-h: auto; }
  .bar { flex-wrap: wrap; gap: 12px 16px; padding: 12px 16px; }
  .theme { margin-left: 0; }
  main { grid-template-columns: 1fr; height: auto; padding: 16px; }
  .results { min-height: 60vh; }
  .quad { grid-template-columns: repeat(4, 1fr); }
}

/* Deadwords: words excluded from this game. Quartiles lists every one its tiles make; muted, no strikethrough (John). */
.results-list h3.dead { background: var(--pink); color: #fff; }
.results-list .w.dead span { color: var(--muted); }

/* "Definitely Exists" (confirmed words, blue) and "Unknown" (grey): the same full-width headings as the others. */
.results-list h3.sect.exists { background: var(--blue); color: #fff; }
.results-list h3.sect.unknown { background: var(--unknown); color: #fff; }
html { --unknown: #8a8578; }
html[data-theme="dark"] { --unknown: #6d695e; }

/* Admins: a blue check box (confirm) left of each word and a pink x box (exclude) right of it, lined up in each column. */
.results-list .row { display: flex; align-items: center; gap: 4px; break-inside: avoid; }
.results-list .row .w { flex: 1 1 auto; min-width: 0; }
.results-list .mark { flex: 0 0 auto; display: grid; grid-template-columns: 1fr; gap: 0; place-items: center; width: 1.1em; height: 1.1em; padding: 0;
  border: 0; color: #fff; font-size: 1em; line-height: 0; cursor: pointer; }
.results-list .mark svg { display: block; width: .8em; height: .8em; }
.results-list .mark.ok { background: var(--blue); }
.results-list .mark.no { background: var(--pink); }
.results-list .mark:hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.results-list .mark.gap { background: transparent; cursor: default; }

/* ---- Crossword: one clue box (an optional length, then the clue) and, for admins, the actual-answer box ---- */
.cw-form { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 10px; }
.cw-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cw-input { min-height: 52px; padding: 0 14px; border: 2px solid var(--rule); background: var(--card); color: var(--ink);
  font-size: 20px; font-weight: 500; outline: none; }
.cw-input:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.cw-teach { margin-top: 12px; padding-top: 16px; border-top: 2px solid var(--rule); }
#cw-answer { text-transform: uppercase; letter-spacing: .08em; }
html:not(.gs-admin) .cw-teach, html:not(.gs-admin) .cw-unanswered { display: none; }
/* Unanswered clues (admins): searched, no answer added yet; click one to search it again. */
.cw-unanswered { display: flex; flex-direction: column; gap: 8px; min-height: 0; margin-top: 12px; padding-top: 16px;
  border-top: 2px solid var(--rule); }
.cw-unanswered h3 { margin: 0; font-weight: 500; }
.cw-unanswered .hint { margin: 0; }
.cw-pending { list-style: none; margin: 0; padding: 0; overflow-y: auto; border: 2px solid var(--rule);
  background: var(--card); }
.cw-pending:empty { display: none; }
.cw-pending li { display: flex; align-items: stretch; }
.cw-pending li + li { border-top: 1px solid var(--hair); }
.cw-pending .go { flex: 1 1 auto; display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border: 0;
  background: transparent; color: var(--ink); font: 500 16px/1.3 var(--font); text-align: left; cursor: pointer; }
.cw-pending .go b { min-width: 1.6em; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.cw-pending .go:hover, .cw-pending li.on .go { background: var(--soft); }
.cw-pending .drop { flex: 0 0 auto; width: 40px; border: 0; border-left: 1px solid var(--hair); background: transparent;
  color: var(--muted); font-size: 18px; cursor: pointer; }
.cw-pending .drop:hover { background: var(--pink); color: #fff; }
.cw-word { text-transform: uppercase; letter-spacing: .04em; }
.results-list h3.guess { background: var(--pink); color: #fff; }

/* Crossword results: one column, each answer with a past clue for it from the master list. */
.results-list.cw-results { column-width: auto; column-count: 1; overflow-y: auto; font-size: 16px; }
.cw-results .w { justify-content: flex-start; gap: 14px; align-items: baseline; }
.cw-results .cw-word { flex: 0 0 auto; min-width: 7em; font-weight: 600; }
.cw-was { color: var(--muted); font-style: normal; font-size: .9em; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }

/* ---- Crossword puzzles: mode switch, admin editor (left), the grid with its clues beneath (right) ---- */
.cw-modes { align-self: flex-start; }
.cw-modes button { padding: 0 16px; }
.cw-mode { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
html:not(.gs-admin) .admin-only { display: none !important; }
.xw-size { display: flex; align-items: center; gap: 8px; min-width: 0; }
.xw-size .cw-label { margin: 0 2px 0 auto; }  /* Grid sits at the right end of the Date line */
.xw-num { width: 64px; min-height: 44px; padding: 0 8px; }
.xw-size .gs-date { min-width: 0; }
.xw-text { min-height: 160px; padding: 10px 14px; font-size: 15px; line-height: 1.4; resize: vertical;
  font-family: var(--font); }
.xw-current { margin: 0; padding: 8px 12px; background: var(--blue); color: #fff; font-size: 17px; font-weight: 600; }
.xw-cands { list-style: none; margin: 0; padding: 0; border: 2px solid var(--rule); background: var(--card); }
.xw-cands:empty { display: none; }
.xw-cands li { display: flex; align-items: stretch; }
.xw-cands li + li { border-top: 1px solid var(--hair); }
.xw-cands .go { flex: 1 1 auto; display: flex; gap: 12px; align-items: baseline; min-width: 0; padding: 6px 12px; border: 0;
  background: transparent; color: var(--ink); font: 400 15px/1.3 var(--font); text-align: left; cursor: pointer; }
.xw-cands .go b { flex: 0 0 auto; min-width: 6.5em; font-weight: 700; letter-spacing: .04em; }
.xw-cands .go:hover { background: var(--soft); }
.xw-cands .add { flex: 0 0 auto; width: 40px; border: 0; border-left: 1px solid var(--hair); background: transparent;
  color: var(--blue); font-size: 18px; font-weight: 700; cursor: pointer; }
.xw-cands .add:hover { background: var(--blue); color: #fff; }
.xw-cands .add[disabled] { color: var(--hair); cursor: default; background: transparent; }
.xw-fill { display: flex; gap: 10px; }
.xw-fill .cw-input { flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: .06em; }
.xw-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.xw-actions[hidden] { display: none; }
.xw-saved { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.xw-saved h3 { margin: 0; font-weight: 500; }
.xw-list .go small { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.xw-list .go .ok { color: var(--blue); font-weight: 700; }

.xw-body { flex: 1 1 auto; min-height: 0; overflow: hidden; padding: 12px 16px; display: flex; flex-direction: column;
  gap: 16px; }
.xw-grid { display: grid; grid-template-columns: repeat(var(--w, 15), var(--cell, 32px)); gap: 0; align-self: center;
  border: 2px solid var(--rule); }
.xw-grid .c { position: relative; width: var(--cell, 32px); height: var(--cell, 32px); border: 1px solid var(--hair);
  background: var(--card); display: grid; place-items: center; font-weight: 700; text-transform: uppercase;
  font-size: calc(var(--cell, 32px) * .55); cursor: pointer; user-select: none; }
.xw-grid .c.b { background: var(--ink); border-color: var(--ink); cursor: default; }
.xw-grid .c small { position: absolute; top: 1px; left: 2px; font-size: max(8px, calc(var(--cell, 32px) * .28));
  font-weight: 600; color: var(--muted); line-height: 1; }
.xw-grid .c.in { background: #cdeaf6; }
html[data-theme="dark"] .xw-grid .c.in { background: #12465a; }
.xw-grid .c.at { background: var(--gold); color: #111; }
.xw-grid.ro .c { cursor: default; }
.xw-grid { flex: 0 0 auto; }
.xw-clues { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; flex: 1 1 auto; min-height: 0; }
.xw-clues > div { display: flex; flex-direction: column; min-height: 0; }
.xw-clues ol { flex: 1 1 auto; min-height: 0; overflow-y: auto; position: relative; }
.xw-clues h3 { margin: 0 0 6px; padding: 4px 6px; background: var(--ink); color: var(--bg); font-size: 13px;
  letter-spacing: .06em; text-transform: uppercase; }
.xw-clues ol { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.xw-clues li { display: flex; gap: 8px; padding: 3px 6px; cursor: pointer; }
.xw-clues li b { flex: 0 0 2em; text-align: right; }
.xw-clues li .ans { margin-left: auto; padding-left: 8px; color: var(--muted); font-weight: 600; letter-spacing: .04em;
  white-space: nowrap; }
.xw-clues li.done .ans { color: var(--ink); }
.xw-clues li:hover { background: var(--soft); }
.xw-clues li.at { background: var(--blue); color: #fff; }
.xw-clues li.at .ans { color: #fff; }
.xw-grid.ro + .xw-clues li { cursor: default; }
.xw-clues li .reveal { margin-left: auto; padding: 0 8px; min-height: 0; height: 22px; font-size: 12px; font-weight: 600;
  background: none; border: 1.5px solid var(--hair); color: var(--muted); cursor: pointer; }
.xw-clues li .reveal:hover { border-color: var(--blue); color: var(--blue); }
@media (max-width: 900px) { .xw-clues { grid-template-columns: 1fr; } .xw-body { overflow: auto; } }
.linkish { padding: 0; border: 0; background: none; color: var(--blue); font: inherit; font-weight: 600;
  text-decoration: underline; cursor: pointer; }
.xw-cands .go span { min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xw-setup { display: flex; }
#cw-puzzle-mode { overflow-y: auto; }
.xw-grid:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.xw-grid:focus .c.at { background: var(--pink); color: #fff; }

/* ---- New Puzzle, the game's date, the puzzle selector and the Play on ... links ---- */
button, input, select { font-family: var(--font); border-radius: 0; }
.gs-date, .gs-select { min-height: 44px; padding: 0 10px; border: 2px solid var(--rule); background: var(--card);
  color: var(--ink); font: 500 16px/1 var(--font); }
.gs-date:focus, .gs-select:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.play { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 2px solid var(--rule);
  background: var(--ink); color: var(--bg); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.play::after { content: '↗'; font-weight: 700; }
.play:hover { background: var(--blue); color: #fff; }
.results-head .play { margin-left: auto; align-self: center; min-height: 36px; font-size: 14px; }
.cw-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cw-top .cw-modes { align-self: auto; }
.xw-meta { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; align-items: center; }
.xw-meta .gs-select, .xw-meta #xw-name { font-size: 16px; min-height: 44px; }

/* Crossword editor: candidates in a fixed ten-row table; past clues for a finished answer; ✓ verifies one clue. */
.xw-cands, .xw-cands:empty { display: block; height: calc(10 * 33px + 4px); overflow: hidden; }
.xw-cands li { height: 33px; }
.xw-cands li + li { border-top: 1px solid var(--hair); }
.xw-cands li.past .go { cursor: default; }
.xw-cands li.past .go b { min-width: 3.2em; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.xw-cands li.past .go span { color: var(--ink); }
.xw-clues li .vf { flex: 0 0 auto; width: 22px; height: 22px; margin-left: 6px; padding: 0; border: 1.5px solid var(--hair);
  background: transparent; color: var(--hair); font-size: 13px; font-weight: 700; line-height: 1; cursor: pointer; }
.xw-clues li .vf:hover { border-color: var(--blue); color: var(--blue); }
.xw-clues li .vf.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.xw-clues li.at .vf { border-color: rgba(255, 255, 255, .55); color: rgba(255, 255, 255, .55); }
.xw-clues li.at .vf.on { background: #fff; border-color: #fff; color: var(--blue); }
.xw-clues li.ok .ans::after { content: ' ✓'; color: var(--blue); }
#xw-reveal { white-space: nowrap; flex: 0 0 auto; }

/* Wordsmith: the top 20 words in one large column, score order. Each row is a grid (check, word, score, x) so the x box
   never sits on top of the score. Accepted (confirmed) words stay in place, in blue. */
.results-list.ws-results { column-width: auto; column-count: 1; overflow-y: auto; font-size: 21px; }
.ws-results .row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; margin-bottom: 1px; }
.ws-results .w { gap: 16px; padding: 2px 10px; line-height: 1.3; }
.ws-results .w span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600;
  letter-spacing: .04em; }
.ws-results .w b { flex: 0 0 auto; }
.ws-results .mark { width: 1.3em; height: 1.3em; }
.ws-results .row.sure .w span { color: var(--blue); }
.ws-results .row.sure .w { box-shadow: inset 4px 0 0 var(--blue); }
.ws-results .row.sure .w[aria-pressed="true"] span { color: inherit; }
html:not(.gs-admin) .ws-results .row { grid-template-columns: minmax(0, 1fr); }

/* In Botri Dish (theme.js adds .framed) the app's sidebar picks the game, so the page's own header goes. */
:root.framed header.bar { display: none; }

/* A note that reports a problem (crossword.js note(..., true)). */
.bad-note { padding: 10px 14px; border-left: 6px solid var(--red, #e4322b); background: var(--soft); color: var(--ink); font-weight: 600; }

/* Crossword: a label with something on its right (Clues and its ? tip; Your puzzles and New Puzzle). */
.xw-head { position: relative; display: flex; align-items: center; gap: 8px; }
.xw-head .ghost { margin-left: auto; }
/* The ? beside a label: its help shows on hover (or keyboard focus) instead of sitting under the box. */
.tip { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid var(--muted);
  color: var(--muted); font-size: 13px; font-weight: 700; line-height: 1; cursor: help; user-select: none; }
.tip:hover, .tip:focus { border-color: var(--blue); color: var(--blue); outline: none; }
.tip-text { position: absolute; top: calc(100% + 6px); left: 0; z-index: 5; width: min(420px, 100%); padding: 10px 14px;
  border: 2px solid var(--rule); background: var(--card); color: var(--ink); font-size: 14px; line-height: 1.4;
  box-shadow: 4px 4px 0 var(--rule); visibility: hidden; opacity: 0; transition: opacity .12s; }
.tip:hover + .tip-text, .tip:focus + .tip-text { visibility: visible; opacity: 1; }
#xw-setup-note:empty { display: none; }

/* Crossword editor fills the column: the Clues box takes the spare height, so the puzzle list below it ends level with
   the grid panel on the right. When the answer tools open under it, the column scrolls instead. Admins have no list
   heading (the list is their puzzles, under New Puzzle); visitors keep "Puzzles". */
#crossword { overflow: hidden; }
#crossword .cw-mode:not([hidden]) { flex: 1 1 auto; }
/* The form never shrinks below its own content (min-height stays auto): it shrinking to nothing let the answer tools
   below draw over it. Once a puzzle is laid out and the answer tools show, the Clues box keeps its normal height and
   the column scrolls. */
#cw-puzzle-mode .xw-setup { flex: 1 1 auto; }
#cw-puzzle-mode .xw-text { flex: 1 1 0; min-height: 96px; }
#cw-puzzle-mode .xw-one { flex: 1 1 0; min-height: 220px; }
#cw-puzzle-mode:has(#xw-work:not([hidden])) .xw-setup { flex: 0 0 auto; }
#cw-puzzle-mode:has(#xw-work:not([hidden])) .xw-text { flex: 0 0 auto; min-height: 160px; }
#cw-puzzle-mode:has(#xw-work:not([hidden])) .xw-one { flex: 0 0 auto; }
#cw-puzzle-mode:has(#xw-work:not([hidden])) .xw-entries { max-height: 280px; }
#xw-list-note:empty { display: none; }
/* The crossword's top row: Edit Clues and the puzzle-wide buttons on the left, Save and New Puzzle at the right end. */
.xw-file { display: flex; gap: 12px; margin-left: auto; }

/* Clues one at a time: the entry line (with where a clue without A or D goes), then the clues by number, Across then
   Down, each with Edit and ×. "Paste all clues" (a small button by the label) swaps this for the clue box. */
.xw-one { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.xw-entry-row { display: flex; align-items: stretch; gap: 8px; }
.xw-entry-row .cw-input { flex: 1 1 auto; min-width: 0; }
.xw-dir { flex: 0 0 auto; display: grid; place-items: center; min-width: 76px; padding: 0 10px; background: var(--blue);
  color: #fff; font-size: 15px; font-weight: 700; }
.xw-entries { flex: 1 1 0; min-height: 0; overflow-y: auto; }
.xw-entries h4 { margin: 8px 0 4px; font-weight: 500; }
.xw-entries h4:first-child { margin-top: 0; }
.xw-entry-list .go { cursor: default; }
.xw-entry-list .go:hover { background: transparent; }
.xw-entry-list .go small { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.xw-entry-list .edit { flex: 0 0 auto; padding: 0 12px; border: 0; border-left: 1px solid var(--hair);
  background: transparent; color: var(--blue); font: 600 14px var(--font); cursor: pointer; }
.xw-entry-list .edit:hover { background: var(--blue); color: #fff; }
.xw-entry-list li.editing { padding: 4px; }
.xw-edit { flex: 1 1 auto; min-height: 40px; }
.xw-mode-btn { min-height: 32px; padding: 0 12px; font-size: 14px; }
.xw-head .xw-paste-btn { margin-left: 0; }  /* sits right after Enter lengths, which takes the auto margin */
.xw-mode-btn[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
/* A clue's length box (Enter lengths), at the row's right end where (5) usually shows. */
.xw-len { flex: 0 0 auto; width: 56px; min-height: 36px; margin: 3px 4px; padding: 0 8px; text-align: center;
  font-size: 16px; font-variant-numeric: tabular-nums; }
/* The clue added last: a light tint so it's easy to spot after the list scrolls to it. */
.xw-entry-list li.fresh .go, .xw-entry-list li.fresh .go:hover { background: color-mix(in srgb, var(--blue) 14%, var(--card)); }

.results-list h3.len { background: var(--soft); color: var(--ink); font-weight: 500; }
.results-list h3.dead.len { background: var(--soft); color: var(--ink); }
/* Quartiles words known before this puzzle: a small dim dot; words first seen in this puzzle: a blue one. */
.results-list .row.known::before, .results-list .row.newword::before { content: ''; flex: 0 0 auto; width: 5px; height: 5px;
  border-radius: 50%; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.results-list .row.newword::before { background: rgba(60, 120, 255, .65); }
/* Your puzzles (Wordsmith, Quartiles): date, word count, then the tiles, cut short with … so the list never scrolls
   sideways. The crossword's saved-puzzle list (#xw-list) keeps its own layout. */
#ws-list, #q-list { overflow-x: hidden; }
#ws-list li, #q-list li, #ws-list .go, #q-list .go { min-width: 0; }
#ws-list .go, #q-list .go { overflow: hidden; }
#ws-list .go b, #q-list .go b, #ws-list .go small, #q-list .go small { flex: 0 0 auto; margin-left: 0; white-space: nowrap; }
#ws-list .go .tiles, #q-list .go .tiles { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board { padding-right: 18px; }
.results-list .w i.brk { font-style: normal; font-weight: 700; padding: 0 1px; color: var(--pink); }
.results-list .w b.shared { font-weight: inherit; color: var(--pink); }
/* Quartiles' Deadwords header folds its list: ▾ open, ▸ folded. */
.results-list h3.sect.toggle { cursor: pointer; user-select: none; }
.results-list h3.sect.toggle::before { content: '▾ '; }
.results-list h3.sect.toggle[aria-expanded="false"]::before { content: '▸ '; }
.results-list h3.sect.toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
#q-arrange[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* ---- Every game's left panel fits the window: no scrollbar on the board (John, 2026-10-27) ----
   The controls keep their size; what's left goes to the tiles, which shrink to the room (Wordsmith's diamond down to
   200px, Quartiles' rows down to 32px). The puzzle lists sit behind the Puzzles button (below). The Play on ... links sit
   in the results header (index.html). */
.board { container-type: inline-size; }
/* A narrow panel (1280 wide windows): Grid and Date share a line. */
@container (max-width: 470px) {
  #ws-sizes button { min-width: 36px; }
  #wordsmith .controls { column-gap: 12px; }
  #wordsmith .gs-date { padding: 0 6px; }
}
/* Wordsmith: the diamond takes the room the controls leave. */
#wordsmith .diamond-wrap { flex: 1 1 320px; overflow: hidden; }
#quartiles .quad { flex: 0 1 auto; min-height: 200px; grid-template-rows: repeat(5, minmax(32px, 64px)); }
#quartiles .qtile { height: auto; }
/* The results header with Wordsmith's or Quartiles' Play link: the title and the link on the first line, the note under
   them at full width (it gets long after a solve). */
.results-head:has(.play[data-for]:not([hidden])) { flex-wrap: wrap; row-gap: 4px; }
.results-head:has(.play[data-for]:not([hidden])) #r-note { order: 1; flex: 1 1 100%; }
/* Crossword: the Clues box and the puzzle list give way, so the column itself never scrolls at these sizes. */
#cw-puzzle-mode .xw-one { min-height: 96px; }
/* Once the grid is laid out: the candidates table gives way from ten rows down to five. */
#xw-work { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
#xw-work .hint:empty { display: none; }
#xw-work .xw-cands, #xw-work .xw-cands:empty { flex: 0 1 auto; min-height: calc(5 * 33px + 4px); }

/* ---- The puzzle list behind the Puzzles button (John, 2026-10-27) ----
   Puzzles swaps the whole board for the game's list, which fills the panel and scrolls inside it; Done (or Escape)
   brings the board back. Picking a puzzle opens it and leaves the list up. */
.board:not(.picking) > .gs-pick { display: none; }
.board.picking > :not(.gs-pick) { display: none !important; }
.gs-pick { flex: 1 1 auto; min-height: 0; }
/* Solve, Clear, New Puzzle and Puzzles share one line, so a narrow board gets narrower buttons, never a sideways scroll. */
@container (max-width: 540px) {
  .board .actions > button { padding: 0 14px; }
}
.gs-pick-head { display: flex; align-items: center; gap: 12px; }
.gs-pick-head h3 { margin: 0; font-size: 20px; }
.gs-pick-head button { margin-left: auto; }
.gs-pick .xw-list { flex: 0 1 auto; min-height: 0; overflow-y: auto; }
.gs-pick .hint:empty { display: none; }

/* In Botri Dish each game's New Puzzle and Puzzles buttons, and the crossword's Save, Edit, Mark verified and Publish, sit
   in the app's tab row instead (solver.js), which leaves the crossword's own top row empty. */
:root.framed :is(#ws-new, #ws-puzzles, #q-new, #q-puzzles, #xw-new, #xw-save, #xw-edit-clues, #xw-verify, #xw-publish,
  #xw-puzzles, .cw-top) { display: none !important; }

/* ---- A narrow window (half a Mac screen: the board sits above the results) (John, 2026-10-29) ----
   The board takes its natural height and the page scrolls, so the crossword's fill-the-column rules above would leave
   the entry list one row tall. Here the list shows at least eight clues, grows with them to half the window, then
   scrolls inside; the same for the Clues box under Paste all clues. Wordsmith and Quartiles keep their full-size tiles
   here already. */
@media (max-width: 900px) {
  #crossword { overflow: visible; }
  #crossword .cw-mode:not([hidden]), #cw-puzzle-mode .xw-setup, #cw-puzzle-mode .xw-one { flex: 0 0 auto; }
  #cw-puzzle-mode .xw-entries { flex: 0 0 auto; min-height: 360px; max-height: max(360px, 50vh); }
  #cw-puzzle-mode .xw-text, #cw-puzzle-mode:has(#xw-work:not([hidden])) .xw-text { flex: 0 0 auto; min-height: 360px; }
}
