/* GroupIt on the web. The palette is the app's own Slate theme — a board on this page must be
   the same colour as the same board in the app, or the player does not recognise it as theirs.
   Values are pinned in src/ui/palette.ts and by ColourThemeTests.SlateIsTheShippedBoard. */

:root {
  --backdrop: #F4F3EE;
  --panel: #FFFFFF;
  --ink: #1B1D22;
  --muted: #5F6573;
  --line: #E1E0D8;
  --accent: #E8B45A;
  --broken: #A8082E;
  --shadow: 0 1px 2px rgba(27, 29, 34, .05), 0 6px 20px rgba(27, 29, 34, .06);
  /* The page's column: .wrap is --measure wide with --gutter either side, so its content is
     --measure less two gutters. #board is capped at exactly that (below). */
  --measure: 46rem;
  --gutter: 1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --backdrop: #1B1D22;
    --panel: #262930;
    --ink: #F0F1EC;
    --muted: #8A919E;
    --line: #333740;
    --broken: #FFB9B2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --backdrop: #1B1D22;
  --panel: #262930;
  --ink: #F0F1EC;
  --muted: #8A919E;
  --line: #333740;
  --broken: #FFB9B2;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

/* The `hidden` attribute is the pages' show/hide switch, and an author `display` beats the browser's
   own [hidden] rule: `#board { display: flex }` kept the board's empty stage and its Undo / Reset /
   Share buttons on screen above the error card of a bad link (found 2026-10-05, in a real browser at
   360px), and for a moment on every load before the script ran. This puts the switch back in charge. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--backdrop);
  color: var(--ink);
  font: 400 16px/1.55 "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body { min-height: 100dvh; display: flex; flex-direction: column; }

h1, h2, h3 { line-height: 1.2; text-wrap: balance; margin: 0; letter-spacing: -.01em; }

a { color: inherit; }

.wrap { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

/* ── the board page ─────────────────────────────────────────────────────── */

.top {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 800; letter-spacing: -.02em; font-size: 1.05rem; text-decoration: none; }
.wordmark span { color: var(--muted); font-weight: 600; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: .26rem .55rem; border-radius: 999px; background: var(--panel);
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}

main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem 0 0; }

/* The board is a contained card, the same width on both pages (2026-10-05). The landing's sits in .wrap and
   so is 43.5rem (696px) at most; b/'s sits straight in <main>, and its stage ran the full browser width —
   1280px on a desktop, rounded corners at the window edges. Capping #board itself, rather than wrapping b/'s
   in .wrap, makes the two identical on a desktop and leaves a phone alone: b/'s stage stays as wide as the
   screen, where .wrap's gutters would take 40px from every board (about 10% off each cell) on the one page
   that is mostly opened on a phone. <main> centres it. */
#board {
  display: flex; flex-direction: column; align-items: center; gap: .9rem; width: 100%;
  max-width: calc(var(--measure) - 2 * var(--gutter));
}

.stage {
  display: flex; justify-content: center; width: 100%;
  padding: .9rem; border-radius: 1.1rem; background: var(--panel); box-shadow: var(--shadow);
}
canvas { display: block; max-width: 100%; }

/* A long-press is one of the board's gestures (it paints the other tone, src/ui/board.ts), and iOS
   Safari reads the same press as "select the word under the finger". It finds no text on a canvas, so
   it selects the nearest text on the page and raises Copy / Find Selection / Look Up over the board —
   on the landing sample and on b/, while the cell is also being painted (found 2026-10-05 on the iPhone
   simulator). The board and the card around it are not text and have to say so: no selection, no
   callout, no grey tap flash. Scoped to the stage, so every other line on the page stays selectable.
   (touch-action is set by BoardView on the canvas itself: the board owns its drags, the card's padding
   still scrolls the page.) Desktop right-click painting is untouched: `contextmenu` is cancelled in
   board.ts, and none of this stops a mouse. */
.stage, .stage canvas {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.status { min-height: 1.5rem; display: flex; gap: .6rem; align-items: center; font-size: .9rem; color: var(--muted); }
.status .bad { color: var(--broken); font-weight: 700; }

.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; padding-bottom: 1.5rem; }
button {
  font: inherit; font-weight: 700; font-size: .92rem;
  padding: .6rem 1.05rem; border-radius: .7rem; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line);
}
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .45; cursor: default; }
button.tone { padding: .45rem .5rem; display: inline-flex; align-items: center; }
.swatch {
  display: inline-block; min-width: 4.4rem; padding: .22rem .5rem; border-radius: .45rem;
  font-size: .82rem; font-weight: 700; letter-spacing: .01em;
}

button.primary { background: var(--accent); border-color: var(--accent); color: #1A1C21; }

/* A link that is a secondary action: the button's size and shape as an <a>, outlined in the accent
   so it reads as an offer beside the filled primary rather than as another Undo. */
.btn {
  display: inline-block; font: inherit; font-weight: 700; font-size: .92rem; text-decoration: none;
  padding: .6rem 1.05rem; border-radius: .7rem; cursor: pointer;
  background: var(--panel); color: var(--ink); border: 2px solid var(--accent);
}
.btn:hover { background: var(--backdrop); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── win, loading, error ────────────────────────────────────────────────── */

.card {
  text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 1.1rem; padding: 1.4rem 1.25rem; box-shadow: var(--shadow);
  margin: 0 1.25rem 1.25rem; max-width: 26rem;
}
.card h2 { font-size: 1.5rem; }
.card p { color: var(--muted); margin: .35rem 0 0; font-size: .92rem; }
/* What the board was — "6 × 5 · Tally". Facts, so it is set a notch firmer than the prose around it. */
.card .meta { font-weight: 700; letter-spacing: .02em; font-variant-numeric: tabular-nums; margin-top: .45rem; }

.getit { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.getit p { margin-bottom: .7rem; }
/* The quiet way on, under the win card's one primary button: a link, not a second button. */
.getit .more { margin: .9rem 0 0; font-size: .88rem; }
.getit .more a { color: var(--muted); text-underline-offset: .2em; }
.getit .more a:hover { color: var(--ink); }

.quiet { color: var(--muted); font-size: .9rem; text-align: center; padding: 2rem 1.25rem; }

/* ── the landing page ───────────────────────────────────────────────────── */

.hero { padding: 3rem 0 1.5rem; }
.hero h1 { font-size: clamp(2rem, 7vw, 3rem); font-weight: 800; }
.hero .lede { color: var(--muted); font-size: 1.05rem; max-width: 34rem; margin: .8rem 0 0; }

.playfull { text-align: center; padding: .25rem 0 1rem; }
.playfull p { color: var(--muted); font-size: .88rem; margin: .55rem auto 0; max-width: 28rem; text-wrap: balance; }

.rules { display: grid; gap: .8rem; padding: 1.5rem 0; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.rule { background: var(--panel); border: 1px solid var(--line); border-radius: .9rem; padding: 1rem 1.1rem; }
.rule h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rule p { margin: .45rem 0 0; font-size: .95rem; }

footer { border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .85rem; }
footer a { text-decoration-color: var(--line); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── the sample chapter ─────────────────────────────────────────────────── */

.eyebrow {
  margin: 0 0 .5rem; font-size: .74rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent);
}
.teaches { color: var(--muted); }

/* A part is the chapter's own structure, not a way of breaking up a long list: a stretch of
   boards exists because there is one technique it wants you to find, and that line is it. */
.part { padding: 1.6rem 0 .4rem; border-top: 1px solid var(--line); margin-top: 1.4rem; }
.part:first-child { border-top: 0; margin-top: 0; }
.parthead { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.parthead h2 { font-size: 1.15rem; font-weight: 800; }
.part .teaches { margin: .4rem 0 0; font-size: .93rem; max-width: 38rem; }

.tiles {
  display: grid; gap: .45rem; margin-top: .9rem;
  grid-template-columns: repeat(auto-fill, minmax(3.4rem, 1fr));
}
.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem;
  padding: .45rem .2rem; border-radius: .6rem; line-height: 1.1;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
}
.tile .n { font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }
.tile .s { font-size: .64rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
/* Solved is a COLOUR, not a dimming: the accent ring and the gold stars say "done", and the
   number stays exactly as legible as it was before it was earned. */
.tile.done { border-color: var(--accent); }
.tile.done .s { color: var(--accent); }

.playhead {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding-bottom: .2rem;
}

/* #broken is the only error this page can show — a baked payload that would not decode, which
   test/chapter.ts decodes all 154 of to rule out. It is a paragraph, not a .status child. */
p.bad { color: var(--broken); font-weight: 700; }

/* The board half of the chapter page keeps the picker's measure, so switching between them does
   not change how wide the page is. */
#play { width: 100%; max-width: 46rem; margin: 0 auto; }
