/* Tool pages. Every tool has one board in its own color, and the thing you came for sits on it.
   Setup is beside or on the board; records and reference text follow. Spin the Wheel has its own file.
   1 colors · 2 layout · 3 parts · 4 game boards · 5 each tool · 6 small screens · 7 print */
@media screen {

/* 1 ─ Colors: the board is a wash of the tool's color, the color of its picture on the home page. */
.tool-page { --stage: var(--surface); --stage-dot: var(--rule); --board-edge: var(--c-ink); }
[data-theme=dark] .tool-page { --board-edge: var(--rule-strong); }
@supports (color: color-mix(in srgb, red, blue)) {
  .tool-page { --stage: color-mix(in srgb, var(--tool) 50%, #fffdf6); --stage-dot: color-mix(in srgb, var(--tool) 82%, #14160f); }
  [data-theme=dark] .tool-page { --stage: color-mix(in srgb, var(--tool) 10%, #14160f); --stage-dot: color-mix(in srgb, var(--tool) 28%, #14160f); }
}
.memory-pin { --tool: #c6f432; }
.perfect-circle-game { --tool: #f6dba5; }
.blind-ranking-game { --tool: #a6bcb2; }
.bingo { --tool: #a6d5c9; }
.tier-list-maker { --tool: #f1cec0; }
.random-name-picker { --tool: #e0c4eb; }
.teams { --tool: #b6d8fe; }
.reaction-time-test { --tool: #f4bd4f; }
.aim-trainer { --tool: #a9d9e1; }
.tournament-bracket-maker { --tool: #bfc3f3; }
.online-scoreboard { --tool: #adbba7; }

/* 2 ─ Layout: board and side column, or (flip) a form and its board. */
.work { display: grid; grid-template-columns: minmax(0, 1.34fr) minmax(300px, 1fr); gap: 28px clamp(20px, 3vw, 44px); align-items: start; }
.work.flip { grid-template-columns: minmax(280px, 350px) minmax(0, 1fr); }
.below { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px clamp(20px, 3vw, 44px); align-items: start; margin-top: 32px; }
.stage { --board: var(--stage); --board-dot: var(--stage-dot); min-width: 0; padding: 14px clamp(12px, 2vw, 20px) clamp(14px, 2vw, 20px); border: 1.5px solid var(--edge); border-radius: var(--r-l); }
.side, .block { min-width: 0; }
:is(.stage, .side, .block) > * + * { margin-top: 12px; }
.side > .block + .block, .side > .guide, .side > .block + .guide { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--rule); }
.side > .guide:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.side .guide h2:first-child, .below .guide h2:first-child { margin-top: 0; }
.below > .guide { margin-top: 0; }
.tool-page .tool-head > p { max-width: 46ch; }

/* 3 ─ Parts */
:where(.tool-page main) h2 { font-size: 1.25rem; letter-spacing: -.015em; overflow-wrap: anywhere; }
:where(.tool-page main) h3 { font-size: 1rem; letter-spacing: -.01em; }
:where(.tool-page main :is(.stage, .side, .block)) p { font-size: .9375rem; overflow-wrap: anywhere; }
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 40px; }
.stage-bar > :first-child { margin-right: auto; }
.stage-bar h2, .stage-bar > p:first-child { font-size: 1.125rem; font-weight: 750; letter-spacing: -.01em; }
.setup { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.setup > div:first-child { flex: 0 1 230px; min-width: 0; }
.actions, .inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* A quiet button that starts a line sits flush with the text above it. */
:is(.block, .side) > .btn-quiet { margin-left: -10px; }
.inline { flex-wrap: nowrap; }
.inline .field { width: 112px; }
.field-label + * { margin-top: 0; }
.field-label:not(:first-child) { margin-top: 14px; }
.tool-page .hint { margin-top: 6px; }
.tool-page textarea.field { resize: vertical; line-height: 1.5; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.filebutton { position: relative; overflow: hidden; }
.filebutton input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filebutton:focus-within { outline: 2px solid var(--focus); outline-offset: 3px; }
/* Feedback appears next to the control that caused it. Empty, it takes no room. */
[role=status]:empty, #errors:empty, #metrics:empty, #selection:empty { margin: 0; }
:is(#message, #status, #result):not(:empty) { padding: 8px 12px; border-left: 3px solid var(--edge); border-radius: 0 var(--r-s) var(--r-s) 0; background: var(--surface); font-size: .875rem; font-weight: 600; }
#saved { font-size: .8125rem; color: var(--fg-muted); }
#stats { font-weight: 700; font-variant-numeric: tabular-nums; }
.error { color: var(--danger); }
.note, .notice { padding: 9px 12px; border-radius: var(--r); background: var(--sunken); font-size: .8125rem; line-height: 1.45; }
.log { margin-bottom: 0; padding-left: 1.9em; font-size: .875rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
.log li::marker { color: var(--fg-muted); font-size: .8125rem; }
.log:empty { display: none; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric { min-width: 0; padding: 10px 12px; border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--surface); overflow-wrap: anywhere; }
.metric :is(strong, b) { display: block; font-size: 1.5rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric :is(span, small) { font-size: .75rem; line-height: 1.3; color: var(--fg-muted); }
.metric em { display: block; font-size: .6875rem; font-style: normal; font-weight: 600; color: var(--accent-fg); }
.tool-page table { width: 100%; border-collapse: collapse; font-size: .8125rem; }
.tool-page :is(th, td) { padding: 7px 4px; border-bottom: 1px solid var(--rule); text-align: left; overflow-wrap: anywhere; }
.tool-page th { font-size: .75rem; font-weight: 600; color: var(--fg-muted); }
.tool-jumps { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: -6px 0 14px; font-size: .875rem; color: var(--fg-muted); }
.tool-jumps a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; color: var(--fg); }

/* 4 ─ Game boards stay ink in both themes: the board is the brand's black, the pins its lime. */
.pinboard, #arena, #pad { background-color: #171a12; border-radius: 12px; box-shadow: 0 0 0 1.5px var(--board-edge), 0 6px 0 #000; }
.pinboard { display: block; position: relative; width: min(100%, 510px); aspect-ratio: 1; margin: 14px auto 8px; touch-action: none; user-select: none; }
.pinboard:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
div.pinboard { background-image: linear-gradient(90deg, #2f3426 1px, transparent 1px), linear-gradient(#2f3426 1px, transparent 1px); background-size: 20% 20%; }
.dot { position: absolute; display: grid; place-items: center; width: 30px; height: 30px; transform: translate(-50%, -50%); border-radius: 50%; background: #c6f432; color: #14160f; font-weight: 800; pointer-events: none; }
.dot:not(.guess)::after { content: ""; position: absolute; right: -2px; bottom: 0; width: 5px; height: 5px; background: #c6f432; transform: rotate(35deg); }
.dot.guess { border: 2px dashed #ffb494; background: transparent; color: #ffcbad; }
.cursor { position: absolute; transform: translate(-50%, -50%); color: #fff; font-size: 22px; line-height: 1; pointer-events: none; }
/* Review: a line from each pin to its guess, and a mark for how close the guess was. Lime is the bullseye. */
.links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.links line { stroke: #ffb494; stroke-width: 2; stroke-linecap: round; }
.grade { flex: none; width: 1em; height: 1em; vertical-align: -.125em; }
.verdict { position: absolute; display: grid; place-items: center; width: 22px; height: 22px; transform: translate(-50%, -50%); border-radius: 50%; background: var(--c-cream); color: var(--c-ink); font-size: 14px; pointer-events: none; animation: verdict-pop .3s .1s cubic-bezier(.3, 1.4, .5, 1) both; }
.verdict.is-top { background: var(--c-lime); }
@keyframes verdict-pop { from { opacity: 0; scale: .4; } }
@media (max-height: 720px) { div.pinboard { width: min(100%, 510px, 66svh); } }
#arena { position: relative; height: clamp(260px, 52vh, 540px); margin-bottom: 8px; overflow: hidden; background-image: radial-gradient(#444a38 1px, transparent 1px); background-size: 20px 20px; touch-action: none; user-select: none; }
#pin { position: absolute; width: 44px; height: 44px; padding: 0; transform: translate(-50%, -50%); border: 4px solid #c6f432; border-radius: 50%; background: #2b3a12; cursor: pointer; }
#pin::after { content: ""; display: block; width: 12px; height: 12px; margin: auto; border-radius: 50%; background: #c6f432; }
/* Before a run the board says the rule of the chosen mode, under the center pin. */
#rule { position: absolute; right: 0; bottom: 16%; left: 0; margin: 0; padding: 0 16px; color: #d7d9c8; font-size: .9375rem; font-weight: 600; text-align: center; pointer-events: none; }
#rule:empty { display: none; }
/* A hit leaves a ring where it landed, with the streak from two up. A miss leaves the word. */
.ping { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; transform: translate(-50%, -50%); border: 2px solid #c6f432; border-radius: 50%; color: #c6f432; font: 800 .875rem/1 var(--font); pointer-events: none; animation: ping .45s ease-out both; }
.ping.miss { border: 0; color: #ffb494; }
@keyframes ping { to { opacity: 0; scale: 1.5; } }
/* Survival: the halo around the pin runs down with its time limit. */
#pin.fused { animation: fuse var(--limit) linear both; }
@keyframes fuse { from { box-shadow: 0 0 0 16px #c6f43259; } to { box-shadow: 0 0 0 0 #c6f43259; } }
#pad { display: block; width: 100%; min-height: clamp(200px, 40vh, 360px); margin-bottom: 8px; padding: 16px; border: 0; background-image: radial-gradient(#444a38 1px, transparent 1px); background-size: 20px 20px; color: var(--c-cream); font: 900 clamp(2rem, 6vw, 4rem)/1.1 var(--font); letter-spacing: -.03em; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* Between rounds the pad shows the time just measured, with the next step under it. */
#pad[data-note]:not([data-note=""]) { font-size: clamp(2.75rem, 9vw, 5rem); }
#pad[data-note]:not([data-note=""])::after { content: attr(data-note); display: block; margin-top: 12px; color: #d7d9c8; font: 700 1rem/1.2 var(--font); letter-spacing: .02em; }
#pad[data-state=waiting] { background: #6a2a22; color: #fff; }
#pad[data-state=go] { background: var(--c-lime); color: var(--c-ink); }
/* Before the first response the pad carries the rule of the chosen mode under its label. */
#pad small { display: block; margin-top: 14px; color: #d7d9c8; font: 600 .9375rem/1.3 var(--font); letter-spacing: 0; }
/* Feint: a fake cue differs from Go! in its word and its stripes, not in color alone. */
#pad[data-state=fake] { background: var(--c-sky) repeating-linear-gradient(45deg, transparent 0 16px, #7cc2e4 16px 32px); color: var(--c-ink); }
/* The result card pops onto the board when a run ends. It is paper in both themes, lime for a new best. */
.board { position: relative; }
.board > .pinboard { margin-top: 2px; }
/* On a very short screen the board grows to hold its card instead of letting it cover the text around it. */
.board:has(.result-card:not([hidden])) { min-height: 280px; }
.result-card { --fg: var(--c-ink); --fg-muted: #4a4d40; --edge: var(--c-ink); --lip: var(--c-ink); --sunken: #14160f1f; --focus: #5a3fd4; position: absolute; z-index: 2; top: 50%; left: 50%; width: min(88%, 340px); padding: 16px 14px 14px; transform: translate(-50%, -50%); border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-cream); color: var(--c-ink); box-shadow: 0 6px 0 #000, 0 20px 44px #000a; text-align: center; animation: card-pop .32s cubic-bezier(.3, 1.4, .5, 1) both; }
.result-card.is-best { background: var(--c-lime); }
@keyframes card-pop { from { opacity: 0; transform: translate(-50%, -42%) scale(.9); } }
.result-card .label { justify-content: center; }
/* With a picture of the drawing, the score sits beside it. */
.result-card canvas { float: left; width: 92px; height: 92px; margin: 0 12px 4px 0; border: 2px solid var(--c-ink); border-radius: 8px; }
.has-picture { text-align: left; }
.has-picture .label { justify-content: flex-start; }
.has-picture .card-stats { clear: both; text-align: center; }
#cardScore { display: block; margin-top: 6px; font: 900 clamp(2.5rem, 9vw, 3.5rem)/1 var(--font); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
#cardBest { margin-top: 8px; font-size: .8125rem; font-weight: 600; }
.card-stats { display: flex; gap: 6px; margin-top: 12px; }
.card-stats div { flex: 1; min-width: 0; padding: 6px 4px; border: 1.5px solid var(--c-ink); border-radius: 6px; font-size: .6875rem; line-height: 1.3; }
.card-stats b { display: block; font-size: .9375rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-card .actions { justify-content: center; margin-top: 14px; }
.result-card .btn-quiet { color: var(--c-ink); }
/* On a new best the card is lime, so its key turns ink. */
.result-card.is-best .btn-primary { background: var(--c-ink); color: var(--c-cream); box-shadow: 0 3px 0 #0006; }
/* A circle can be redrawn straight through its card: only the buttons take the pointer. */
/* The line above the board keeps room for two lines, so the board does not move under the pen when the text changes. */
.perfect-circle-game .stage-bar { min-height: 3.375rem; }
.perfect-circle-game .result-card { pointer-events: none; }
.perfect-circle-game .result-card .btn { pointer-events: auto; }
/* While the card offers Draw again, the same button under the board steps aside. */
.stage:has(.result-card:not([hidden])) #retry { display: none; }

/* 5 ─ Each tool */
/* One lime key at a time: when the next step is Next round or the card's button, Play steps back. */
.memory-pin .stage:has(#next:not([hidden])) #play, .stage:has(.result-card:not([hidden])) .setup .btn-primary { min-height: 44px; border: 1px solid var(--rule-strong); background: var(--surface); color: var(--fg); box-shadow: none; font-weight: 600; font-size: .9375rem; }
.memory-pin #round { margin-top: 18px; font-size: 1.125rem; font-weight: 750; }
.memory-pin #phase { margin-top: 4px; }
.memory-pin #errors span { display: flex; align-items: center; gap: 8px; }
/* Its card adds the streak line and a button that copies the challenge, so the board leaves room for a taller card. */
#cardNote { margin-top: 4px; font-size: .75rem; }
#cardNote:empty { display: none; }
#cardShare { border: 1.5px solid var(--c-ink); background: transparent; color: var(--c-ink); }
.memory-pin #cardAgain { flex: 1 0 100%; }
.memory-pin .board:has(.result-card:not([hidden])) { min-height: 340px; }
/* The last seven days of the daily board. A day with an official score is lime and shows it. */
.memory-pin #streak { font-size: 1.125rem; font-weight: 750; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 10px 0; padding: 0; list-style: none; }
.week li { display: grid; gap: 2px; padding: 7px 0 6px; border: 1px solid var(--rule-strong); border-radius: 6px; color: var(--fg-muted); font-size: .6875rem; line-height: 1.1; text-align: center; font-variant-numeric: tabular-nums; }
.week b { color: var(--fg); font-size: .9375rem; font-weight: 800; }
.week .is-done { border-color: var(--c-ink); background: var(--c-lime); color: var(--c-ink); }
.week .is-done b { color: var(--c-ink); }
.week [aria-current] { box-shadow: 0 0 0 1.5px var(--edge); }

/* Reaction Time Test: the five tries stand side by side as columns from zero, the value on each cap. */
#scores { display: flex; align-items: flex-end; gap: 8px; padding: 0; list-style: none; }
#scores li { position: relative; flex: 0 1 64px; min-width: 0; padding-bottom: 20px; font: 700 .8125rem/1.3 var(--font); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
#scores i { display: block; width: 24px; margin: 4px auto 0; border-radius: 4px 4px 0 0; background: var(--fg-muted); }
#scores small { position: absolute; right: 0; bottom: 0; left: 0; color: var(--fg-muted); font: 600 .75rem/1.3 var(--font); }
#scores .is-median i { background: var(--fg); }
#scores:empty { display: none; }

/* Blind Ranking: a face-down card waits on the board; each reveal is a lime card to place in a slot. */
.blind-ranking-game .stage:has(#game[hidden])::after { content: "?"; display: grid; place-items: center; width: 108px; height: 144px; margin: 30px auto 18px; transform: rotate(-5deg); border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-lime); color: var(--c-ink); box-shadow: 5px 6px 0 var(--c-ink); font: 900 4rem/1 var(--font); }
#editor { flex-basis: 100%; }
#game { margin-top: 20px; }
#game > * + * { margin-top: 10px; }
#item { display: block; padding: 22px 20px; border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-lime); color: var(--c-ink); box-shadow: 0 5px 0 var(--c-ink); font-size: clamp(1.5rem, 3.4vw, 2.25rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; overflow-wrap: anywhere; text-wrap: balance; }
#slots { display: grid; gap: 6px; margin-top: 18px; }
.rank-slot { touch-action: manipulation; display: block; width: 100%; min-height: 48px; margin: 0; padding: 8px 14px; border: 1.5px dashed var(--edge); border-radius: var(--r); background: transparent; color: var(--fg); font: 600 1rem/1.3 var(--font); text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.rank-slot:hover:enabled { border-style: solid; background: var(--surface); }
.rank-slot:disabled { border-style: solid; background: var(--surface); font-weight: 700; cursor: default; }
.rank-slot small { display: block; color: var(--fg-muted); font: 600 .8125rem/1.3 var(--font); }
#regret { font-weight: 600; }

/* Random Name Picker: the called name is printed on a ticket. */
.ticket { position: relative; padding: 30px 20px 26px 54px; border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-cream); color: var(--c-ink); box-shadow: 0 5px 0 var(--c-ink); text-align: center; }
.ticket::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 34px; border-left: 2px dashed #14160f66; }
#last { display: block; font-size: clamp(2rem, 5.4vw, 3.5rem); font-weight: 900; letter-spacing: -.035em; line-height: 1.05; overflow-wrap: anywhere; }
.ticket p { margin-top: 10px; font-size: .8125rem; font-weight: 600; letter-spacing: .02em; }
.random-name-picker .stage .actions { margin-top: 20px; }
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; padding: 0; list-style: none; }
.roster label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 8px; min-height: 48px; padding: 6px 10px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.roster input { grid-row: span 2; width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fg); }
.roster small { grid-column: 2; font-size: .75rem; font-weight: 400; color: var(--fg-muted); }
.roster li:has(input:not(:checked)) label { background: transparent; border-style: dashed; }
.attend { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--rule); }
.attend h3 { margin-top: 20px; }

/* Online Scoreboard: two cards in the logo's colors, numerals you can read across a room. */
.scoregrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
#display .scoregrid section { display: flex; flex-direction: column; align-items: center; min-width: 0; padding: 14px 12px 16px; border: 2px solid var(--c-ink); border-radius: 12px; background: var(--c-lime); color: var(--c-ink); box-shadow: 0 6px 0 #000; text-align: center; }
#display .scoregrid section + section { background: var(--c-coral); }
#display .scoregrid h2 { font-size: clamp(1rem, 2.4vw, 1.5rem); font-weight: 800; }
#display .scoregrid output { display: block; font: 900 clamp(4.5rem, 16vw, 10rem)/1 var(--font); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
#display .scoregrid .actions { justify-content: center; margin-top: 6px; }
#display .scoregrid button { min-width: 64px; min-height: 52px; border: 2px solid var(--c-ink); background: transparent; color: var(--c-ink); font-size: 1.125rem; font-weight: 800; }
#display .scoregrid button[data-delta="1"] { min-width: 96px; background: var(--c-ink); color: var(--c-cream); }
#display .scoregrid button:disabled { opacity: .35; }
.clock { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 22px; }
.clock h2 { font: 700 .6875rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; }
#clock { min-width: 4.6ch; padding: 4px 14px; border-radius: var(--r); background: var(--c-ink); color: var(--c-lime); font: 800 clamp(1.75rem, 5vw, 2.75rem)/1.2 var(--mono); font-variant-numeric: tabular-nums; text-align: center; }
#display > .actions { justify-content: center; margin-top: 16px; }
#display:fullscreen { display: flex; flex-direction: column; justify-content: center; padding: 3vmin; border: 0; border-radius: 0; overflow: auto; }
#display:fullscreen .scoregrid output { font-size: clamp(6rem, 30vmin, 24rem); }
.scoregrid.plain > div > :first-child { margin-top: 0; }

/* Tournament Bracket: setup on one row, then the matches pinned to the board. */
.draw { display: grid; grid-template-columns: minmax(0, 1.34fr) minmax(260px, 1fr); gap: 0 clamp(20px, 3vw, 44px); align-items: start; margin-bottom: 28px; }
.draw > div > * + * { margin-top: 12px; }
.draw h2 { grid-column: 1 / -1; margin-bottom: 12px; }
.stage-bar label { font: 600 .875rem/1.3 var(--font); }
.stage-bar select.field { width: auto; min-width: 150px; }
.roundblock { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.roundblock h3 { grid-column: 1 / -1; }
.match { min-width: 0; padding: 12px; border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--surface); break-inside: avoid; }
.match strong { display: block; font: 700 .6875rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--fg-muted); }
.match p { margin: 6px 0 10px; font-weight: 600; }
.match .actions { gap: 6px; }
.match .btn { min-height: 40px; padding: 0 12px; font-size: .875rem; white-space: normal; overflow-wrap: anywhere; }
.match .btn:last-child { border-color: transparent; background: transparent; color: var(--fg-muted); }
.match .btn:last-child:hover { background: var(--sunken); color: var(--fg); }
.match .winner { border-color: var(--c-ink); background: var(--c-lime); color: var(--c-ink); }
#matches { margin-top: 14px; }

/* Tier List Maker: each row is a colored label and a tray; a picked item lifts like a sticker. */
#board { display: grid; gap: 6px; }
.tier { display: grid; grid-template-columns: minmax(84px, 116px) minmax(0, 1fr); overflow: hidden; border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--surface); }
.tier > div:first-child { display: grid; align-content: start; gap: 6px; padding: 6px; border-right: 1.5px solid var(--edge); background: var(--sunken); font: 700 .8125rem/1.3 var(--font); }
.tier .rank { width: 100%; min-height: 48px; margin: 0; padding: 4px; border: 1.5px solid var(--c-ink); border-radius: 6px; background: var(--rank); color: var(--c-ink); font: 800 1.125rem/1.2 var(--font); text-align: center; }
.tier .btn { min-height: 36px; padding: 0 6px; font-size: .75rem; white-space: normal; }
.tray { display: flex; flex-wrap: wrap; align-content: center; gap: 6px; min-height: 60px; padding: 8px; }
.tray:empty::after { content: "Empty"; align-self: center; font-size: .8125rem; color: var(--fg-muted); }
.tile { touch-action: manipulation; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; max-width: 145px; min-height: 44px; margin: 0; padding: 6px 10px; border: 1.5px solid var(--edge); border-radius: 6px; background: var(--page); color: var(--fg); font: 600 .875rem/1.25 var(--font); overflow-wrap: anywhere; cursor: grab; transition: transform .1s, box-shadow .1s; }
.tile img { width: 56px; height: 50px; object-fit: contain; }
.tile:hover { border-color: var(--fg); }
.tile[aria-pressed=true] { transform: translate(-1px, -2px); border-color: var(--c-ink); background: var(--c-lime); color: var(--c-ink); box-shadow: 3px 4px 0 var(--c-ink); }
[data-theme=dark] .tile[aria-pressed=true] { box-shadow: 3px 4px 0 #000; }
.tier-list-maker .stage > .actions:last-of-type { margin-top: 18px; padding-top: 14px; border-top: 1.5px solid var(--edge); }

/* Bingo: the preview cards are paper in both themes, laid out on the board as they will print. */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card { min-width: 0; padding: 10px; border: 1.5px solid var(--c-ink); border-radius: 6px; background: #fff; color: #14160f; box-shadow: 0 4px 0 #14160f33; break-inside: avoid; }
.cardhead { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 6px; font-size: .75rem; font-weight: 750; }
.cardhead span:first-child { overflow-wrap: anywhere; }
.grid { display: grid; gap: 2px; border: 1px solid #b9b7a6; background: #b9b7a6; }
.cell { display: grid; place-items: center; min-width: 0; aspect-ratio: 1.2; padding: 3px; background: #fff; color: #14160f; font-size: clamp(9px, 1.1vw, 12px); line-height: 1.12; text-align: center; overflow-wrap: anywhere; }
.cell.free { background: #e6f3c0; font-weight: 800; }
.cell.mark { background: var(--c-lime); font-weight: 750; }
#results > .label, #host > .label { margin-bottom: -6px; }
#results .stage { margin-top: 18px; }
#more { margin-top: 14px; }
#results .stage-bar p { font-size: .875rem; font-weight: 600; }
#host { margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--rule); }
.callbox { --board: var(--c-ink); display: grid; place-content: center; gap: 4px; min-height: 132px; padding: 20px; border-radius: 12px; box-shadow: 0 0 0 1.5px var(--board-edge), 0 6px 0 #000; color: var(--c-lime); text-align: center; overflow-wrap: anywhere; }
.callbox strong { font-size: clamp(1.625rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.callbox small { font: 700 .6875rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; color: #d7d9c8; }
.callbox + .actions { margin-top: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 140px; overflow: auto; }
.chip { padding: 3px 9px; border: 1px solid var(--rule-strong); border-radius: 20px; background: var(--surface); font-size: .75rem; overflow-wrap: anywhere; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 8px; font-weight: 600; font-size: .9375rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent-fg); }
#error { display: none; padding: 9px 12px; border-radius: var(--r); background: var(--danger-bg); color: var(--danger); font-size: .875rem; font-weight: 600; }
#wordCount { min-height: 20px; font-size: .8125rem; color: var(--fg-muted); }
#words { min-height: 200px; }
.bingo .form .btn-primary, .teams .form .btn-primary { width: 100%; }
#verifyCard { max-width: 310px; }
.guide details { border-bottom: 1px solid var(--rule); }
.guide summary { padding: 11px 0; font-weight: 650; cursor: pointer; }
.guide details p { padding-bottom: 12px; }
#printRoot { display: none; }

/* Random Group Generator: each team is a card on the board. */
.teams #names { height: 170px; }
.round { padding-top: 14px; }
.round + .round { border-top: 1.5px solid var(--edge); margin-top: 14px; }
.round h3 { margin-bottom: 8px; }
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.group { min-width: 0; padding: 9px 10px; border: 1.5px solid var(--edge); border-radius: var(--r); background: var(--surface); overflow-wrap: anywhere; }
.group strong { font: 700 .6875rem/1.2 var(--font); letter-spacing: .09em; text-transform: uppercase; }
.group ul { margin: 6px 0 0; padding-left: 18px; font-size: .9375rem; }
.audit { max-height: 320px; overflow: auto; }
.teams .fold, .teams .fold:last-of-type { margin-top: 16px; border-color: var(--edge); }

/* On touch screens the compact buttons grow to finger size. */
@media (pointer: coarse) {
  .match .btn, .tier .btn, .tool-jumps a { min-height: 44px; }
}

/* 6 ─ Small screens: one column, and the board runs edge to edge. */
@media (max-width: 860px) {
  .work, .work.flip, .below, .draw { grid-template-columns: 1fr; gap: 24px; }
  .draw { gap: 0; }
  .draw > div + div { margin-top: 12px; }
  .stage { margin-inline: calc(-1 * var(--gutter)); padding: 12px var(--gutter) 18px; border-inline: 0; border-radius: 0; }
  .setup > div:first-child { flex-basis: 100%; }
  #host { margin-top: 28px; }
}
@media (max-width: 520px) {
  .cards { grid-template-columns: 1fr; }
  .groups { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .cell { font-size: 13px; }
  .metric { padding: 8px; }
  .metric :is(strong, b) { font-size: 1.25rem; }
  .tier { grid-template-columns: 84px minmax(0, 1fr); }
  #display .scoregrid button { min-width: 52px; }
  #display .scoregrid button[data-delta="1"] { min-width: 72px; }
}
}

/* 7 ─ Print: bracket, group schedule and bingo sheets on white paper. */
#printRoot .card { margin-bottom: 10mm; }
.callList { columns: 2; }
.printSheet { break-after: page; }
.printSheet:last-child { break-after: auto; }
.printSheet h2 { overflow-wrap: anywhere; }
.printSheet .cell { font-size: 12pt; aspect-ratio: auto; min-height: 15mm; }
.printSheet.two .cell { font-size: 10pt; min-height: 9mm; }
.printSheet.two .card { margin-bottom: 5mm; }
.printSheet .cardhead { font-size: 11pt; }
.printSheet li { overflow-wrap: anywhere; margin-bottom: 3mm; }
@media print {
  @page { margin: 12mm; }
  .tool-page { font: 11pt/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
  .tool-page main { max-width: none; margin: 0; padding: 0; }
  .tool-page h1 { margin: 0 0 4mm; font-size: 20pt; }

  /* Bracket: the title and every round. */
  .tournament-bracket-maker :is(main > :not(.tool-head):not(#competition), .tool-head .label, .tool-head > p, #competition button, #competition select, #competition label, #competition .actions) { display: none !important; }
  #competition .roundblock[hidden] { display: block !important; }
  .roundblock { margin: 14px 0; }
  .roundblock h3 { margin: 0 0 4px; break-after: avoid; }
  .match { padding: 8px 0; border-top: 1px solid #aaa; color: #000; break-inside: avoid; }
  .match p { margin: 4px 0; overflow-wrap: anywhere; }

  /* Groups: the schedule only. */
  .teams :is(.tool-head, .form, .metrics, .actions, .audit-details, .guide, .related) { display: none !important; }
  .round { padding: 12px 0; border-top: 1px solid #aaa; break-inside: avoid; }
  .round h3 { margin: 0 0 6px; }
  .groups { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .group { padding: 8px; border: 1px solid #aaa; border-radius: 6px; break-inside: avoid; overflow-wrap: anywhere; }
  .group ul { margin: 5px 0; padding-left: 18px; }

  /* Bingo: only the prepared sheets. */
  body.bingo > * { display: none !important; }
  body.bingo > #printRoot { display: block !important; }
  #printRoot .cardhead { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 6px; font-weight: 750; color: #000; }
  #printRoot .cardhead span:first-child { overflow-wrap: anywhere; }
  #printRoot .grid { display: grid; gap: 2px; border: 1px solid #888; background: #888; }
  #printRoot .cell { display: grid; place-items: center; min-width: 0; padding: 3px; border: .3pt solid #aaa; background: #fff; color: #000; line-height: 1.12; text-align: center; overflow-wrap: anywhere; }
  #printRoot .cell.free { font-weight: bold; }
  #printRoot .card { padding: 4mm; border: 1px solid #777; break-inside: avoid; }
  #printRoot .printSheet { break-inside: avoid; }
  #printRoot .printSheet.two .card { max-width: 155mm; margin-left: auto; margin-right: auto; }
  #printRoot .printSheet:not(.two) .card { max-width: 175mm; margin: 0 auto 10mm; }
  #printRoot .printSheet:not(.two) .cell { min-height: 23mm; }
  #printRoot .callList { font-size: 10pt; }
}
