/* ==========================================================================
   strandshint.tips — style.css
   Layout and palette follow docs/demo-strandshint-tips.html.

   Ordered as: variables -> background -> page frame -> content blocks
   (generated by the shortcode) -> list -> footer -> responsive.

   Class conventions:
     .wrap        centered frame, used in every area
     .prose       WRAPS content taken from the DB. Every typographic style for h2/h3/p/ul of the
                  editors all sit under .prose, so the theme markup (card tags,
                  game grid…) do not pick up the article typography.
     .eyebrow     small uppercase label INSTEAD OF a heading in theme-printed blocks —
                  the site's rule is that every h2/h3 comes from content in the DB.
   ========================================================================== */

:root {
    --ink: #221c17;
    --ink-soft: #4a3f36;
    --muted: #7a6d61;
    --line: #e7ded1;
    --bg: #faf6ef;
    --surface: #ffffff;
    --surface-2: #f3ece0;
    --brand: #c2521f;
    --brand-ink: #9c3f16;
    --brand-soft: #fdeee5;
    --teal: #0e7c86;
    --teal-soft: #e2f2f2;
    --theme: #1a73c2;
    --theme-soft: #e7f1fb;
    --theme-line: #bcdcf6;
    /* Solved tiles and the lines joining them share one fill, so a word reads
       as a single ribbon rather than beads with dashes between. That only works
       if the fill itself stands off the paper: --theme-soft sits at 1.06:1
       against --bg, which is invisible once it leaves the tile. These are
       1.59:1 and 1.45:1, and the -deep inks clear 4.8:1 on top of them. */
    --theme-fill: #9ccbf2;
    --theme-deep: #0d4f8b;
    --gold: #e8a90c;
    --gold-soft: #fef4d8;
    --gold-line: #f0d488;
    --gold-ink: #8a6400;
    --gold-fill: #eecb6e;
    --gold-deep: #6b4e00;
    --green: #1a7f5a;
    --radius: 14px;
    --wrap: 860px;
    --serif: Georgia, "Times New Roman", "Noto Serif", serif;
    --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 18px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }
a { color: var(--brand-ink); }
button { font-family: inherit; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--surface);
    padding: 10px 16px;
    z-index: 50;
}
.skip-link:focus { left: 8px; top: 8px; }

/* --- top bar --------------------------------------------------- */

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 62px;
}
.brand {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -.3px;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.brand img { display: block; }
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 15px;
    cursor: pointer;
}
nav.main { display: flex; gap: 20px; }
nav.main a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
nav.main a:hover,
nav.main a.active { color: var(--brand-ink); border-color: var(--brand); }

/* --- hero -------------------------------------------------------------- */

.hero {
    background: linear-gradient(180deg, var(--brand-soft), var(--bg));
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
}
h1.title {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 36px;
    line-height: 1.12;
    letter-spacing: -.6px;
    margin: 14px 0 8px;
}
.dek {
    font-size: 19px;
    color: var(--ink-soft);
    margin: 0 0 6px;
    max-width: 62ch;
}
.datestrip {
    font-family: var(--serif);
    color: var(--muted);
    font-size: 14px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin: 10px 0 0;
}
.crumb { font-size: 14px; color: var(--muted); padding-top: 20px; }
.crumb a { color: var(--brand-ink); text-decoration: none; }
.crumb a:hover { text-decoration: underline; }

main .wrap { padding-top: 26px; padding-bottom: 20px; }
.readable { max-width: 720px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.eyebrow {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--brand);
    margin: 34px 0 10px;
}

/* --- content written by the editor ------------------------------------ */

.prose p { margin: 0 0 16px; }
.prose h2 {
    font-family: var(--serif);
    font-size: 25px;
    font-weight: 700;
    letter-spacing: -.3px;
    margin: 36px 0 8px;
    padding-left: 14px;
    border-left: 4px solid var(--brand);
}
.prose h3 {
    font-family: var(--serif);
    font-size: 19px;
    font-weight: 700;
    margin: 24px 0 6px;
}
.prose h4 { font-size: 17px; margin: 20px 0 4px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 16px; }
.prose li { margin: 6px 0; }
.prose img { border-radius: var(--radius); }
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 16px;
    font-size: 16px;
}
.prose th, .prose td {
    border: 1px solid var(--line);
    padding: 8px 10px;
    text-align: left;
}
.prose th { background: var(--surface-2); }

.post-cover { border-radius: var(--radius); margin: 0 0 22px; display: block; }

/* --- presentation block (shortcode) ---------------------------------------- */

.callout {
    background: var(--gold-soft);
    border: 1px solid var(--gold-line);
    border-left: 4px solid var(--gold);
    border-radius: 12px;
    padding: 14px 16px;
    margin: 18px 0;
    font-size: 16px;
}
.callout > :last-child { margin-bottom: 0; }

.spoiler-slim {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gold-ink);
    background: var(--gold-soft);
    border: 1px solid var(--gold-line);
    border-radius: 999px;
    padding: 7px 14px;
    margin: 0 0 20px;
}

.sc-warn {
    background: #fdecec;
    border: 1px solid #f0b8b8;
    border-left: 4px solid #c23a3a;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 16px 0;
    font-size: 15px;
    color: #7a2222;
}

.puzzle-meta { display: flex; gap: 9px; flex-wrap: wrap; margin: 0 0 20px; }
.chip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
}
.chip.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.teal { background: var(--teal-soft); border-color: #bfe2e2; color: var(--teal); }

.overview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px 26px 12px;
    margin: 40px 0 10px;
    box-shadow: 0 2px 14px rgba(80, 50, 20, .05);
}
.overview .tag {
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--brand);
    background: var(--brand-soft);
    border: 1px solid #f4d9c8;
    border-radius: 999px;
    padding: 5px 13px;
}
.overview h2:first-of-type { margin-top: 18px; }

.steps { list-style: none; padding: 0; margin: 6px 0 18px; display: grid; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.steps .n {
    flex: none;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: grid;
    place-items: center;
    margin-top: 2px;
}

.grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 16px 0; }
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 18px;
    text-decoration: none;
    color: var(--ink);
    background: var(--surface);
    display: block;
}
a.card:hover { border-color: var(--brand); box-shadow: 0 3px 12px rgba(0, 0, 0, .06); }
.card .k { font-family: var(--serif); font-weight: 700; font-size: 18px; margin: 0 0 4px; }
.card .d { font-size: 15px; color: var(--muted); margin: 0; }
.card .dt { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

.tabs {
    display: inline-flex;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 5px;
    margin: 14px 0 16px;
}
.tabs button {
    border: 0;
    background: transparent;
    padding: 9px 20px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink-soft);
    cursor: pointer;
}
.tabs button.active { background: var(--brand); color: #fff; }
.mode { display: none; }
.mode.show { display: block; }

/* "reveal" accordion - the site's anti-spoiler principle */
.reveal {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 0 0 12px;
    overflow: hidden;
    background: var(--surface);
}
.reveal > button.rv {
    width: 100%;
    text-align: left;
    background: var(--surface-2);
    border: 0;
    padding: 15px 18px;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
}
.reveal > button.rv:hover { filter: brightness(.98); }
.reveal .label-left { display: flex; align-items: center; gap: 12px; }
.reveal .num {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--theme);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.reveal .caret { color: var(--muted); font-size: 14px; font-weight: 600; white-space: nowrap; }
.reveal .body {
    padding: 0 18px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height .28s ease, opacity .2s, padding .28s;
}
.reveal.open .body {
    padding: 16px 18px 20px;
    max-height: 2000px;
    opacity: 1;
    border-top: 1px solid var(--line);
}
.reveal.open .caret { color: var(--brand); }
.reveal .body .answer { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.reveal .answer-note { margin: 10px 0 0; color: var(--ink-soft); font-size: 16px; }
.reveal.spangram .num { background: var(--gold); color: #3a2c00; }
.reveal.spangram .body .answer { color: #b98900; }

/* FAQ */
.faq-list { margin: 12px 0 0; }
details.faq { border-bottom: 1px solid var(--line); padding: 14px 0; }
details.faq summary {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 18px;
    cursor: pointer;
    list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; float: right; color: var(--muted); }
details.faq[open] summary::after { content: "\2013"; }
details.faq .faq-a { margin: 10px 0 2px; color: var(--ink-soft); }
details.faq .faq-a > :last-child { margin-bottom: 0; }

/* --- tool: per-word hint ---------------------------------------- */

.word-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 18px; }
.wcard {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 15px;
}
.wcard .whead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.wcard .wname { font-family: var(--serif); font-weight: 700; font-size: 16px; color: var(--muted); }
.wcard .wname.solved { color: var(--green); }
.wcard .wlen {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-2);
    border-radius: 999px;
    padding: 2px 9px;
}
.wbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.wbtns button {
    font-size: 12.5px;
    font-weight: 700;
    border: 1px solid var(--theme-line);
    background: var(--theme-soft);
    color: var(--theme);
    border-radius: 8px;
    padding: 6px 9px;
    cursor: pointer;
}
.wbtns button:hover { background: #d9ebfb; }
.wbtns button.rev { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-ink); }
.wout {
    font-size: 14.5px;
    color: var(--ink-soft);
    min-height: 20px;
    margin: 9px 0 0;
    line-height: 1.5;
}
.wout b { color: var(--ink); font-family: var(--serif); font-size: 17px; }

/* --- tool: board --------------------------------------------------- */

.board-block { margin: 6px 0 20px; }
.boardtools { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 12px; }
.btn { border: 0; border-radius: 10px; padding: 11px 18px; font-size: 15px; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.ghost { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }

.board-wrap { overflow-x: auto; }
/* position+z-index make .board its own stacking context. The connectors below
   sit at z-index -1 so a word's line runs UNDER the tiles it joins; without a
   context of their own they would fall behind an ancestor's background instead
   and vanish. Nothing here paints a background, so the page shows through. */
.board {
    position: relative;
    z-index: 0;
    display: grid;
    gap: var(--cell-gap);
    max-width: 360px;
    margin: 6px auto 4px;
    /* Centre-to-centre of two neighbouring tiles: one tile across, plus the
       gap, plus the two 1px borders — the connector's own 100% resolves against
       the padding box, which excludes them. Diagonal neighbours are that same
       distance times root two. Both follow the tile, so the lines stay exact at
       every screen width without a single line of script. */
    --cell-gap: 8px;
    --link-o: calc(100% + var(--cell-gap) + 2px);
    --link-d: calc((100% + var(--cell-gap) + 2px) * 1.41421356);
}
.board .cell {
    position: relative;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    /* Round, not rounded-square, and that is geometry rather than taste: on a
       square the centre-to-edge distance is w/2 sideways but w/√2 across the
       diagonal, so a diagonal join pokes out much further than a sideways one
       and the path looks ragged. A circle is the same distance in every
       direction, so every join reads identically. */
    border-radius: 50%;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(15px, 4.6vw, 21px);
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    transition: transform .05s;
}
/* Press feedback moved onto the letter: a transform on the tile itself would
   make it a stacking context, dragging the z-index -1 connector up on top of
   the tile for as long as a finger is down. */
.board .cell .l { display: block; transition: transform .05s; }
.board .cell:active .l { transform: scale(.94); }
.board .cell.sel { background: #efe6d6; border-color: #d8c7a6; }
/* --tile is what the connector paints itself with, so tile and line are the
   same colour by construction and cannot drift apart. The border takes it too:
   a 1px edge of a different colour would draw a seam straight across the join. */
.board .cell.show-t {
    --tile: var(--theme-fill);
    background: var(--tile);
    border-color: var(--tile);
    color: var(--theme-deep);
}
.board .cell.show-s {
    --tile: var(--gold-fill);
    background: var(--tile);
    border-color: var(--tile);
    color: var(--gold-deep);
}
/* ---- Connectors along a word's path ----------------------------------- */

/* A bar radiating from the tile centre towards the next tile in the same word,
   the way the board itself joins letters. Hidden until the solution is shown:
   data-link is in the HTML from the start (it is data, not state), and only
   .show-t / .show-s / .is-trace let it paint. */
.board .cell::after,
.solver__grid .scell::after {
    content: "";
    position: absolute;
    left: 50%;
    /* Origin sits at the tile centre: left 50% across, and half the bar's own
       height up from top 50%. Both percentages resolve against the same square
       box, so the maths stays true at any size and rotation is a plain angle
       with no translate. A ribbon this thick is what makes a word read as one
       shape; a thin wire would just be a dash between two tiles. */
    top: 29%;
    height: 42%;
    background: var(--tile, currentColor);
    transform-origin: 0 50%;
    z-index: -1;
    display: none;
}
.board .cell.show-t[data-link]::after,
.board .cell.show-s[data-link]::after,
.solver__grid .scell.is-trace[data-link]::after { display: block; }

.board .cell[data-link="e"]::after,
.solver__grid .scell[data-link="e"]::after { width: var(--link-o); transform: rotate(0deg); }
.board .cell[data-link="se"]::after,
.solver__grid .scell[data-link="se"]::after { width: var(--link-d); transform: rotate(45deg); }
.board .cell[data-link="s"]::after,
.solver__grid .scell[data-link="s"]::after { width: var(--link-o); transform: rotate(90deg); }
.board .cell[data-link="sw"]::after,
.solver__grid .scell[data-link="sw"]::after { width: var(--link-d); transform: rotate(135deg); }
.board .cell[data-link="w"]::after,
.solver__grid .scell[data-link="w"]::after { width: var(--link-o); transform: rotate(180deg); }
.board .cell[data-link="nw"]::after,
.solver__grid .scell[data-link="nw"]::after { width: var(--link-d); transform: rotate(225deg); }
.board .cell[data-link="n"]::after,
.solver__grid .scell[data-link="n"]::after { width: var(--link-o); transform: rotate(270deg); }
.board .cell[data-link="ne"]::after,
.solver__grid .scell[data-link="ne"]::after { width: var(--link-d); transform: rotate(315deg); }

/* Step number along a word's path. The line gives the shape; the number gives
   the direction, which a line cannot — and the order is the part a reader wants
   to copy back onto their own board. currentColor keeps each number in step
   with the theme-word or spangram colour of its square. */
.board .cell .n {
    position: absolute;
    top: 1px;
    right: 3px;
    font-family: var(--sans);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    color: currentColor;
    opacity: .7;
}
.legend {
    display: flex;
    gap: 18px;
    justify-content: center;
    font-size: 13px;
    color: var(--muted);
    margin: 8px 0 0;
    flex-wrap: wrap;
}
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .b { background: var(--theme-soft); border: 1px solid var(--theme-line); }
.legend .g { background: var(--gold-soft); border: 1px solid var(--gold-line); }

/* --- tool: spangram cue --------------------------------------------- */

.cues { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.cue {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    display: block;
    width: 100%;
}
.cue:hover { border-color: var(--gold-line); }
.cue.open { border-color: var(--gold-line); background: var(--gold-soft); }
.cue .lab {
    display: block;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
}
.cue .val { display: block; font-family: var(--serif); font-weight: 700; font-size: 19px; color: var(--ink); margin-top: 3px; }
.cue .val.hidden { font-family: var(--sans); font-size: 14px; font-weight: 600; color: var(--brand-ink); }

/* --- tool: spangram filter panel ---------------------------------------- */

.sg-block { margin: 10px 0 20px; }
.sg-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0 14px; }
.sg-controls label,
.search-form label {
    display: flex;
    flex-direction: column;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    gap: 5px;
}
.sg-controls input,
.sg-controls select,
.search-form input {
    font-family: inherit;
    font-size: 15px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}
.sg-controls .grow,
.search-form .grow { flex: 1; min-width: 180px; }
.search-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 0; }
.sg-count { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.sg-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sg-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}
.sg-row:last-child { border-bottom: 0; }
a.sg-row:hover { background: var(--surface-2); }
.sg-row.is-hidden { display: none; }
/* min-width:0 so a long spangram name does not push the meta column out of the flex row. */
.sg-row .l { min-width: 0; }
.sg-row .sgw { display: block; font-family: var(--serif); font-weight: 700; font-size: 17px; color: var(--ink); }
.sg-row .tagw {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-ink);
    background: var(--gold-soft);
    border: 1px solid var(--gold-line);
    border-radius: 999px;
    padding: 1px 8px;
    vertical-align: middle;
}
.sg-row .clue { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.sg-row .meta { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; flex: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 18px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; }
.stat .lab {
    display: block;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    font-weight: 800;
}
.stat .big { display: block; font-family: var(--serif); font-size: 21px; font-weight: 700; margin-top: 4px; }
.card-lite { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.dist-card { margin-top: 12px; }
.dist-h { font-weight: 700; margin: 0 0 6px; }
.dist { display: grid; gap: 7px; }
.dist .drow { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.dist .dbar { height: 10px; background: var(--teal); border-radius: 5px; min-width: 4px; }
.dist .dlab { width: 84px; flex: none; color: var(--muted); }
.dist .dn { width: 30px; flex: none; text-align: right; color: var(--muted); }

/* --- game embedded directly (no iframe) ------------------------------------ */

/* INTENTIONALLY only these few lines. The entire look inside the block is from the stylesheet of
   the game handles it, in the version scoped down to `.strands` — a theme that colors or borders
   in here the two sides would fight over the same element. The theme's job is only
   gives the game a box in the flow of the article.

   min-height reserves space before the bundle runs: without it the block is 0px tall and then
   expands, pushing the article below it to jump as soon as the reader starts
   reading. This number is only a placeholder, the game decides the real height itself. */
.strands-block {
    margin: 18px 0;
    min-height: 520px;
}

/* --- tool: board solver ------------------------------------------- */

/* [hidden] must win: .solver__acts and .solver__filters are both display:flex, and
   a display declared in the stylesheet overrides the default of the hidden attribute. */
.solver [hidden] { display: none !important; }

.solver { margin: 10px 0 20px; }
/* Board size controls. A New York Times board is always 6x8, so almost nobody
   touches these — keep them small and quiet, above the grid rather than
   competing with it. */
.solver__size { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; }
.solver__sz { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.solver__sz input {
    width: 58px;
    padding: 5px 8px;
    font: 700 14px var(--sans);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}
.solver__help { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.solver__acts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.solver__legend { font-size: 13px; color: var(--muted); margin: 10px 0 0; text-align: center; }
.solver__legend b { font-weight: 700; border-radius: 5px; padding: 1px 6px; }
.solver__legend .k-used { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.solver__legend .k-hint { background: var(--gold-soft); color: var(--gold-ink); border: 1px solid var(--gold-line); }

/* The grid reuses .board, but the cells here are <button> so the style must be rebuilt from
   first instead of inheriting .board .cell. */
.solver__grid { max-width: 380px; }
.scell {
    position: relative;
    aspect-ratio: 1/1;
    display: grid;
    place-items: center;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(15px, 4.6vw, 21px);
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    transition: transform .05s;
}
/* Round for the same reason the puzzle board is — see .board .cell. Only the
   result grid draws joins; the typing grid below stays square-cornered, because
   there you are filling in a form, not reading a path. */
.solver__grid .scell { border-radius: 50%; }
/* Press feedback on the letter, not the tile: a transform here would make the
   tile a stacking context and lift the z-index -1 join on top of it. */
.scell .scell__l { display: block; transition: transform .05s; }
.scell:active .scell__l { transform: scale(.94); }
.scell[data-mark="used"] { background: var(--surface-2); color: var(--muted); opacity: .55; }
.scell[data-mark="hint"] { background: var(--gold-soft); border-color: var(--gold-line); color: var(--gold-ink); }
.scell.is-trace {
    --tile: var(--theme-fill);
    background: var(--tile);
    border-color: var(--tile);
    color: var(--theme-deep);
}
.scell.is-trace-head { box-shadow: 0 0 0 2px var(--theme); }
/* Ordinal number in the path. A 12-letter word snaking across the board is highlighted
   cannot tell where it goes from and to, and that is what the user needs to copy. */
.scell__n {
    position: absolute;
    top: 1px;
    right: 3px;
    font-family: var(--sans);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
    /* Follows the tile's own ink, so it stays readable on whichever fill the
       square is wearing instead of being pinned to the theme-word blue. */
    color: currentColor;
}

/* The typing grid. Its squares are <input>, so the browser's own styling has to
   be stripped and rebuilt to match .scell — same size, same corners as the
   settled board below, so the two steps do not read as two different tools. */
.solver__entry { max-width: 380px; }
/* The grid is built by script, so until then it is empty and zero tall. Hold
   the space a default 6x8 board will take, so nothing below it jumps. */
.solver__entry:empty { aspect-ratio: 6 / 8; }
.scell--in {
    display: block;
    width: 100%;
    text-align: center;
    text-transform: uppercase;
    cursor: text;
    -webkit-appearance: none;
    appearance: none;
    /* Never below 16px: iOS zooms the whole page when a smaller field takes
       focus, and there are 48 fields here to take focus. */
    font-size: clamp(16px, 4.6vw, 21px);
}
/* An empty square is :invalid, via the required attribute the script sets. One
   look shows which squares are still missing, with nothing to count. */
.scell--in:invalid { background: var(--bg); }
.scell--in:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 2px var(--brand);
}
.solver__count { font-size: 13px; font-weight: 700; color: var(--muted); margin: 8px 0 0; text-align: center; }
.solver__count.is-done { color: var(--green); }

.solver__status { font-size: 14px; color: var(--muted); margin: 10px 0 0; min-height: 1.6em; }
.solver__status.is-warn { color: var(--brand-ink); }

.solver__filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 14px 0 4px; }
.solver__f { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.solver__f select {
    font-family: inherit;
    font-size: 14px;
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.solver__out { margin-top: 6px; }
.solver__tally,
.solver__empty { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.solver__len {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    font-weight: 800;
    color: var(--muted);
    margin: 16px 0 6px;
}
.solver__words { display: flex; gap: 7px; flex-wrap: wrap; }
.sword {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .04em;
    padding: 7px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}
.sword:hover { border-color: var(--theme-line); background: var(--theme-soft); }
/* Words valid only by Scrabble rules: still listed, but faint with a dashed border so the eye
   can be skimmed while looking for the topic word. */
.sword.is-rare { color: var(--muted); border-style: dashed; }
/* Touching two opposite edges - a spangram candidate, uses exactly the spangram yellow
   on the rest of the site. Placed BEFORE .is-on so the selected word still stands out. */
.sword.is-span { border-color: var(--gold-line); background: var(--gold-soft); color: var(--gold-ink); }
.sword.is-on { background: var(--theme); border-color: var(--theme); color: #fff; }
.sword.is-span.is-on { background: var(--gold); border-color: var(--gold); color: #fff; }
.solver__more { margin-top: 14px; }

/* --- list --------------------------------------------------------- */

.topics { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0 22px; }
.topic {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    padding: 9px 16px;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.topic:hover,
.topic.active { border-color: var(--brand); color: var(--brand-ink); background: var(--brand-soft); }
.topic .cnt { font-size: 12px; color: var(--muted); font-weight: 600; }

.guide-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2px 18px;
    margin: 16px 0;
}
.guide-row {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 2px;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
    color: inherit;
}
.guide-row:last-child { border-bottom: 0; }
.guide-thumb {
    flex: none;
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.guide-thumb-empty { display: block; background: var(--surface-2); }
.guide-meta { min-width: 0; }
.guide-title {
    display: block;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 19px;
    margin: 0 0 4px;
    color: var(--ink);
    line-height: 1.25;
}
.guide-row:hover .guide-title { color: var(--brand); }
.guide-desc { display: block; font-size: 15px; color: var(--muted); line-height: 1.5; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin: 16px 0; }
.game-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    text-decoration: none;
    color: var(--ink);
    display: block;
}
.game-tile:hover { border-color: var(--brand); }
.game-tile img { border-radius: 10px; display: block; width: 100%; height: auto; }
.game-name { display: block; font-family: var(--serif); font-weight: 700; font-size: 16px; margin-top: 8px; }
.game-desc { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

.game-stage {
    max-width: 100%;
    margin: 18px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.game-stage iframe { display: block; width: 100%; min-height: 520px; border: 0; }

.related { margin-top: 10px; }

/* --- pagination -------------------------------------------------------- */

.pager { display: flex; justify-content: space-between; gap: 12px; margin: 30px 0; }
.pager a,
.pager .item {
    flex: 1;
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--ink);
    background: var(--surface);
}
.pager small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.pager b { font-family: var(--serif); font-size: 16px; }
.pager .next,
.pager .item.next { text-align: right; }
.pager .item.disabled { opacity: .55; }

/* --- footer ------------------------------------------------------------ */

.site-footer { border-top: 1px solid var(--line); margin-top: 44px; background: var(--surface); color: var(--muted); }
.foot-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 34px 24px 10px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 72px;
    flex-wrap: wrap;
}
.foot-col { flex: 0 1 auto; min-width: 170px; }
.foot-brand { max-width: 320px; }
.foot-brand .flogo {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 21px;
    color: var(--ink);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 10px;
}
.foot-brand p { font-size: 14px; line-height: 1.6; color: var(--muted); margin: 0; max-width: 36ch; }
.foot-head {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 14px;
}
.foot-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.foot-links a { color: var(--brand-ink); text-decoration: none; font-size: 15px; font-weight: 600; }
.foot-links a:hover { color: var(--brand); text-decoration: underline; }
.foot-bottom { max-width: 1080px; margin: 0 auto; padding: 16px 24px 30px; border-top: 1px solid var(--line); }
.foot-bottom .disclaimer { font-size: 12.5px; line-height: 1.55; margin: 0 0 10px; }
.foot-bottom .copy { font-size: 13px; color: var(--muted); margin: 0; }

/* --- responsive -------------------------------------------------------- */

@media (min-width: 760px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .grid.cols-1 { grid-template-columns: 1fr; }
}

@media (max-width: 660px) {
    body { font-size: 17px; }
    h1.title { font-size: 29px; }
    .nav-toggle { display: block; }
    nav.main {
        display: none;
        position: absolute;
        top: 62px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        padding: 6px 20px 12px;
    }
    nav.main.show { display: flex; }
    nav.main a { padding: 12px 0; border-bottom: 1px solid var(--line); }
    .word-grid { grid-template-columns: 1fr; }
    .guide-list { padding: 2px 14px; }
    .guide-thumb { width: 56px; height: 56px; }
    .guide-title { font-size: 17px; }
    .guide-desc { font-size: 14px; }
    .foot-inner { flex-direction: column; gap: 28px; }
    .sg-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .sg-row .meta { text-align: left; }
}
