/* Soft slate and sky: a pale misty page with a faint dot grain, slate ink, white rounded cards
   that float on soft shadows instead of borders. Words are set in a soft serif, controls in a
   rounded sans. Color is kept for meaning: each player's own hue, and closeness bars that turn
   from muted red through amber to green as a guess gets closer. */
:root {
  --bg: #eff3f7; --grain: #d9e2eb; --card: #fff; --ink: #263545; --muted: #5b6a7b;
  --line: #e4eaf0; --tint: #e6edf3; --tint-2: #f3f6f9; --sky: #6fa6cc; --sky-soft: #dceaf4;
  --slate: #34495e; --lilac: #ebe7f5;
  --cold: #a9cbe4; --mild: #e8c47e; --warm: #e59a6c; --hot: #d9695a;
  --gold: #8f6312; --neg: #b3423a; --pos: #2c7656;
  --pc: #c8432f; /* current player's color, set from JS */
  /* Bonus round: a warm honey wash, kept to the page so cards stay white. */
  --honey: #f2e3bd; --honey-soft: #fbf3df; --honey-ring: #d8ad4f;
  --shadow: 0 1px 2px rgba(38, 53, 69, .06), 0 4px 14px -6px rgba(38, 53, 69, .14);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light; /* one deliberate daytime theme */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; color: var(--ink); font: 16px/1.4 var(--sans); -webkit-tap-highlight-color: transparent; isolation: isolate;
  background: radial-gradient(var(--grain) 1px, transparent 1.4px) 0 0 / 18px 18px, linear-gradient(#e2edf5, var(--bg) 340px); background-color: var(--bg); }
/* The bonus round tints the whole page honey. It is a layer behind the content, so it fades in and out without moving anything. */
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .6s;
  background: radial-gradient(#e6d3a6 1px, transparent 1.4px) 0 0 / 18px 18px, linear-gradient(var(--honey), #f7f0e1 340px); background-color: #f7f0e1; }
.bonus body::before { opacity: 1; }
main { width: 100%; max-width: 540px; margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 40px max(18px, env(safe-area-inset-left)); }
/* One quiet line under everything, pushed to the bottom of the window when the page is short. */
footer { margin-top: auto; padding: 0 18px max(16px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; text-align: center; }
footer a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 2px; }
footer a:hover { color: var(--ink); }
footer a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 3px; }
footer .support { white-space: nowrap; }
footer .support svg { width: 1.1em; height: 1.1em; margin-right: .25em; vertical-align: -.2em; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }

/* Masthead: the soft-serif wordmark carries the brand on its own */
header { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; }
.brand { display: flex; align-items: center; min-width: 0; height: 40px; }
/* In the bonus round the wordmark gives way to the found word, under a small label with the guesses left. */
.bonusmark { display: none; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; }
.bonus .brand h1 { display: none; }
.bonus .bonusmark { display: flex; }
.bonusmark small { font: 800 10px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); white-space: nowrap; }
.bonusmark b { font: 600 27px/1 var(--serif); font-variation-settings: "SOFT" 100, "opsz" 72; letter-spacing: -.02em; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
h1 { margin: 0; font: 600 32px/1 var(--serif); font-variation-settings: "SOFT" 100, "opsz" 72; letter-spacing: -.025em; color: var(--ink); }
h1 .o { color: color-mix(in srgb, var(--pc) 78%, var(--ink)); transition: color .3s; }
/* The coin: the money sign struck on a gold face. The sign never appears anywhere without it. */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.coin { flex: none; display: inline-block; width: 1em; height: 1em; vertical-align: -.16em; }
/* A coin turns by animating --spin, which the coin's artwork reads to narrow its face and show its rim. The angle
   stays within -90 to 90 degrees: past edge-on it jumps to the other side, so the coin shows a face that reads as b,
   never a mirrored one. One full turn passes edge-on twice. */
@property --spin { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
.amt { white-space: nowrap; }
.amt .coin { width: .92em; height: .92em; margin-right: .12em; vertical-align: -.12em; }
.hdr { display: flex; align-items: center; gap: 2px; flex: none; }
.meta { color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-width: 5ch; text-align: right; }

/* Buttons: soft tinted pills, no outlines */
button { font: 700 15px/1 var(--sans); cursor: pointer; color: var(--ink); background: var(--tint);
  border: 0; border-radius: 12px; min-height: 44px; padding: 0 14px; touch-action: manipulation; transition: background .15s, transform .08s; }
button:active:not(:disabled) { transform: scale(.98); background: #d9e3ec; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible, summary:focus-visible, .pcard:focus-visible, .pot:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
button.go { background: var(--slate); color: #fff; }
button.go:active:not(:disabled) { background: #2a3b4d; }
button.ghost { background: transparent; color: var(--muted); padding: 0 8px; font-weight: 600; }
button.ghost:active:not(:disabled) { background: var(--tint-2); transform: none; }
.mute { min-height: 40px; padding: 0 6px; display: inline-grid; place-items: center; }
.mute svg { width: 20px; height: 20px; }

/* Secondary actions: quiet text, with New game as the one soft pill */
.tools { display: flex; align-items: center; gap: 2px; margin: 0 0 12px; }
.tools button { background: transparent; font-weight: 600; font-size: 14px; color: var(--muted); min-height: 40px; padding: 0 8px; }
.tools button:active:not(:disabled) { background: transparent; color: var(--ink); transform: none; }
.tools button:first-child { margin-left: -8px; }
.tools #newGame { margin-left: auto; min-height: 40px; padding: 0 14px; background: var(--card); color: var(--ink); font-weight: 700; box-shadow: var(--shadow); }

/* Scoreboard: one card; the player to play sits on a soft wash of their color */
.players { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 0 18px; padding: 6px;
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow); }
.players::-webkit-scrollbar { display: none; }
.pcard { position: relative; flex: 1 0 76px; cursor: pointer; padding: 8px 10px 9px; min-width: 0; border-radius: 13px; transition: background .25s; }
/* With no separate turn line, the card is the turn marker: a wash and an underline in the player's color. */
.pcard.turn { background: color-mix(in srgb, var(--c) 13%, #fff); }
.pcard.turn::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 3px; height: 3px; border-radius: 999px; background: var(--c); }
.pcard .top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.pcard .name { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard.turn .name { color: var(--ink); font-weight: 800; }
.pcard .score { font: 600 30px/1 var(--serif); font-variation-settings: "SOFT" 100; font-variant-numeric: tabular-nums lining-nums; margin-top: 5px; color: var(--muted); }
.pcard.turn .score { color: var(--ink); }
/* The round's winner keeps a gold ring and a star through the bonus round. */
.pcard.won { box-shadow: inset 0 0 0 2px var(--honey-ring); }
.pcard.won .name::before { content: '★ '; color: var(--gold); }
.cheering .pcard.won { animation: glow .9s ease-in-out 3; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px var(--honey-ring), 0 0 0 5px rgba(216, 173, 79, .35); background: var(--honey-soft); } }
/* A player's token: a soft wash of their color with the initial in a deep shade of it */
.token { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: color-mix(in srgb, var(--c) 20%, #fff); color: color-mix(in srgb, var(--c) 62%, #0f1720); font: 800 10px/1 var(--sans); }
/* On the scoreboard and the turn line the token shrinks to a plain color dot. */
.pcard .token, .turnline .token { width: 9px; height: 9px; font-size: 0; background: var(--c); }
/* A quiet + in the scoreboard's corner opens Players. Only on desktop, where the strip never scrolls. */
.addp { display: none; }

/* Play area */
.play { padding: 0; }
/* The pot sits quietly at the right end of the guess field: one number under a tiny label, fixed width so it never shifts. */
.field { position: relative; flex: 1; min-width: 0; display: flex; }
.pot { position: absolute; top: 0; bottom: 0; right: 6px; width: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 12px; font: 700 9px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #8795a5; font-variant-numeric: tabular-nums; cursor: pointer; }
.pot b { font: 600 17px/1 var(--serif); font-variation-settings: "SOFT" 100; letter-spacing: 0; color: var(--muted); }
.pot.live b { color: var(--gold); }
.pot .amt .coin { width: 14px; height: 14px; margin-right: 2px; vertical-align: -1px; }
.pot.bump b { animation: bump .45s ease-out; display: inline-block; }
@keyframes bump { 30% { transform: translateY(-3px); } }
/* When the pot grows its coin hops and spins once. */
.pot.grow .coin { animation: hop .7s ease-out, hop-spin .7s; }
@keyframes hop { 40% { transform: translateY(-6px); } 75% { transform: translateY(0); } 88% { transform: translateY(-1.5px); } 100% { transform: none; } }
/* Two half turns, each eased out as a whole, split where they pass edge-on. */
@keyframes hop-spin { 0%, 40% { --spin: 0deg; animation-timing-function: cubic-bezier(0, 0, .423, .5); }
  13.7%, 51.99% { --spin: 90deg; } 13.71%, 52% { --spin: -90deg; animation-timing-function: cubic-bezier(.3, .5, .681, 1); } 75%, 100% { --spin: 0deg; } }
/* A payout: coins pop out of the points on the latest guess and arc into the player's score.
   The outer layer carries the sideways move, the inner one the rise and fall, and the coin spins. */
.coinfx { position: fixed; z-index: 70; left: 0; top: 0; pointer-events: none; }
.coinfx > span { display: block; transform-origin: 0 0; } /* the coin's centre, so it shrinks onto its target */
.coinfx .coin { display: block; width: 20px; height: 20px; margin: -10px 0 0 -10px; animation: flip .32s linear infinite; }
@keyframes flip { 0% { --spin: 0deg; } 25%, 75% { --spin: 90deg; } 25.01%, 75.01% { --spin: -90deg; } 100% { --spin: 0deg; } }
.pcard .score.ding { animation: ding .14s ease-out; }
/* A floating note: a few words ("+21", "underdog bonus!", "Way off! −1") rise off a score or a guess and fade.
   Gold for points, red for a cost. */
.notefx { position: fixed; z-index: 71; pointer-events: none; transform: translate(-50%, -100%); white-space: nowrap;
  font: 800 15px/1 var(--sans); color: var(--gold); text-shadow: 0 1px 0 #fff, 0 0 6px #fff, 0 0 10px #fff; }
.notefx.neg { color: var(--neg); }
.notefx.num { font-size: 18px; transform-origin: 0 50%; }
@keyframes ding { 50% { transform: scale(1.12); } }
.pcard .score { transform-origin: left 70%; }
form { display: flex; gap: 8px; align-items: stretch; }
form input { flex: 1; min-width: 0; min-height: 56px; padding: 0 60px 0 16px; font: 500 23px/1 var(--serif); font-variation-settings: "SOFT" 100; }
form button { min-height: 56px; padding: 0 22px; font-size: 16px; }
.moves { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.moves button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 10px; font-weight: 700; color: var(--ink); }
#hint:not(:disabled) { background: var(--lilac); color: #4d4180; }
input { font: inherit; font-size: 16px; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 12px; min-height: 44px; box-shadow: var(--shadow); }
input:focus { outline: none; border-color: color-mix(in srgb, var(--pc) 55%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pc) 16%, transparent); }
input::placeholder { color: #6c7b8d; }

/* Fixed-height status area: plain text on the page, no box, so it never reads as an empty frame.
   The message line and the commentary never resize the page. */
.status { position: relative; margin: 14px 2px 0; height: 80px; overflow: hidden; }
.msg, .status .bubble { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 19px; }
.status .bubble { margin-top: 4px; }
.msg { font-size: 14px; font-weight: 600; color: var(--ink); height: 38px; }
.msg.err { color: var(--neg); }
.msg.idle { color: var(--muted); font-weight: 500; }
/* With nothing to say the line takes no room, so the commentary sits at the top of the area. */
.msg:empty { display: none; }
/* Read by screen readers only. */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.bubble { font: italic 400 15px/19px var(--serif); font-variation-settings: "SOFT" 100; color: var(--muted); opacity: 0; transition: opacity .6s; }
.bubble.on { opacity: 1; transition: opacity .2s; }
.bubble::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--cold); vertical-align: 2px; }
.bubble.good::before { background: var(--warm); }
.bubble.bad::before { background: var(--cold); }
.bubble.win::before { background: var(--mild); }
.bubble b { font-weight: 700; }
/* Before the first guess of a round nothing shows under Hint and Pass: no latest guess, no count and no idle
   line. The message line's area keeps its place, so an error or a "did you mean" still shows there. */
.fresh .lastbox, .fresh .stats { display: none; }
.fresh .status:has(> .msg.idle):not(:has(> .bubble.on)) { visibility: hidden; }
.load { position: absolute; left: 0; right: 0; top: 48px; height: 6px; border-radius: 999px; background: var(--tint); overflow: hidden; }
.load > div { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cold), var(--sky)); transition: width .2s; }

/* The board: closest first. A longer (closer) bar is also a greener one. */
.lastbox { margin: 6px 0 0; min-height: 56px; }
/* Before the first guess the slot is a faint labeled strip in the same place as the card that replaces it. */
.lastbox .none { min-height: 56px; display: grid; grid-template-columns: 4.4ch 1fr; column-gap: 10px; align-items: center; padding: 0 14px;
  border-radius: 16px; background: rgba(255, 255, 255, .55); color: var(--muted); font: italic 400 17px var(--serif); font-variation-settings: "SOFT" 100; }
.lastbox .none .r { font: 600 15px var(--sans); text-align: right; font-style: normal; color: #8795a5; }
.stats { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; margin: 16px 4px 8px; min-height: 18px; }
ol { list-style: none; margin: 0; padding: 0; }
#list:empty { display: none; }
#list { background: var(--card); border-radius: 18px; padding: 4px 16px; box-shadow: var(--shadow); }
li.g { --inset: 0px; position: relative; display: grid; grid-template-columns: 4.4ch 1fr auto auto; align-items: center; column-gap: 10px;
  min-height: 52px; padding: 0 0 9px; border-bottom: 1px solid var(--line); }
li.g:last-child { border-bottom-color: transparent; }
/* Closeness bar: a full-width track with the filled share on top, so the length reads at a glance.
   Each fill is one flat color picked from its closeness (set from JS): red when far, amber midway, green when close. */
li.g::before { content: ''; position: absolute; left: var(--inset); right: var(--inset); bottom: 6px; height: 5px; border-radius: 999px; background: var(--tint-2); }
li.g .bar { position: absolute; left: var(--inset); bottom: 6px; height: 5px; border-radius: 999px;
  width: calc((100% - 2 * var(--inset)) * var(--p) / 100);
  background: var(--c); }
li.g .r { font: 600 14px/1 var(--sans); font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
li.g .w { font: 500 20px/1.15 var(--serif); font-variation-settings: "SOFT" 100; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
li.g .pts { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--pos); min-width: 2.6ch; text-align: right; }
li.g .pts.neg { color: var(--neg); }
li.g.hint .w { font-style: italic; }
/* A bonus-round hit: its points in gold behind a small star. */
li.g.extra .pts { color: var(--gold); }
li.g.extra .pts:not(:empty)::before { content: '★'; margin-right: 2px; font-size: 11px; }
/* The winning word: a honey wash behind its row, wherever it is listed. */
li.g.win { --inset: 8px; margin: 0 -8px; padding: 0 8px 9px; border-radius: 12px; background: var(--honey-soft); }
li.g.win .w { font-weight: 650; }
#closestList li.g { min-height: 42px; padding-bottom: 8px; }
#closestList li.g .w { font-size: 18px; }
#hint.skip:not(:disabled) { background: var(--sky-soft); color: #2f5f82; }
.lastbox li.g { --inset: 14px; min-height: 56px; padding: 0 14px 9px; background: var(--card); border: 0; border-radius: 16px;
  box-shadow: var(--shadow); }
.lastbox li.g .w { font-weight: 600; }
.lastbox li.g.win { --inset: 14px; margin: 0; padding: 0 14px 9px; border-radius: 16px; background: var(--honey-soft); box-shadow: var(--shadow), inset 0 0 0 2px var(--honey-ring); }
.cheering .lastbox li.g.win { animation: glow-row .9s ease-in-out 3; }
@keyframes glow-row { 50% { box-shadow: var(--shadow), inset 0 0 0 2px var(--honey-ring), 0 0 0 5px rgba(216, 173, 79, .35); } }

/* The win moment: a card over the page naming the winner and the word, gone after a few seconds.
   It floats above everything and ignores taps, so the board under it never moves or stops working. */
.cheer { position: fixed; z-index: 60; left: 50%; top: 58%; width: min(360px, calc(100% - 48px)); transform: translate(-50%, -50%);
  padding: 20px 20px 22px; border-radius: 24px; text-align: center; pointer-events: none; background: var(--card);
  box-shadow: inset 0 0 0 2px var(--honey-ring), 0 24px 60px -16px rgba(38, 53, 69, .45); animation: cheer 3.4s ease-out forwards; }
.cheer[hidden] { display: none; }
.cheer .k { display: flex; align-items: center; justify-content: center; gap: 8px; font: 800 13px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.cheer .k .token { width: 10px; height: 10px; font-size: 0; background: var(--c); }
/* The word shrinks to fit the card on one line, however long it is. */
.cheer .w { margin-top: 10px; font: 600 min(60px, 13vw, min(320px, 100vw - 88px) / (var(--n) * .58))/1.05 var(--serif); font-variation-settings: "SOFT" 100, "opsz" 72; letter-spacing: -.025em; overflow-wrap: anywhere; }
.cheer .sub { margin-top: 10px; font: 700 14px/1.3 var(--sans); color: var(--muted); }
@keyframes cheer { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.86); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1.02); }
  15% { transform: translate(-50%, -50%) scale(1); } 82% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(-50%, -50%); } }
@keyframes cheer-still { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cheer { animation-name: cheer-still; }
  .cheering .pcard.won, .cheering .lastbox li.g.win, .pot.grow .coin, .pcard .score.ding { animation: none; }
  body::before { transition: none; }
}

/* Dialogs sit over the page, so opening one never moves the board. */
dialog { border: 0; border-radius: 22px; padding: 18px 18px 12px; background: var(--card); color: var(--ink);
  width: min(540px, calc(100% - 24px)); max-height: calc(100% - 48px); box-shadow: 0 20px 50px -12px rgba(38, 53, 69, .35); }
dialog::backdrop { background: rgba(38, 53, 69, .38); }
.hhead { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.hhead button { flex: none; white-space: nowrap; }
.hhead h2 { margin: 0; font: 600 24px/1.1 var(--serif); font-variation-settings: "SOFT" 100; letter-spacing: -.015em; }
/* On a first visit the Players card opens with how to play, under its title. */
.hhead:has(.intro:not([hidden])) { flex-wrap: wrap; padding-bottom: 14px; }
.hhead .intro { flex-basis: 100%; margin: 8px 0 0; color: var(--muted); font-size: 15px; line-height: 1.45; text-wrap: pretty; }
.hhead .intro[hidden] { display: none; }
.editor .row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; background: var(--card); border-radius: 14px; }
.editor .row.dragging { box-shadow: 0 8px 20px -8px rgba(38, 53, 69, .4); position: relative; z-index: 1; }
.grip { flex: none; display: grid; place-items: center; width: 24px; min-height: 44px; color: #8795a5; font-size: 20px;
  line-height: 1; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.dragging .grip { cursor: grabbing; color: var(--ink); }
.editor input { flex: 1; min-width: 0; box-shadow: none; background: var(--tint-2); border-color: transparent; font-weight: 600; }
/* Focus keeps the field's tint, so the name being edited still reads as a field on the white card. */
.editor input:focus { border-color: color-mix(in srgb, var(--pc) 55%, #fff); }
.editor .actions { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 14px; }
.tally[hidden], .hfoot[hidden] { display: none; }
.tally { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.tally .t { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.tally .t.plain { color: var(--muted); font-weight: 600; }
.hrow { border-top: 1px solid var(--line); }
.hrow summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 11px 0; }
.hrow summary::-webkit-details-marker { display: none; }
.hrow .flag { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; color: var(--muted); font-size: 12px; }
.hrow .mid { flex: 1; min-width: 0; }
.hrow .word { font: 600 19px/1.15 var(--serif); font-variation-settings: "SOFT" 100; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .sub { font-size: 12px; font-weight: 600; color: var(--muted); }
.hrow .word .sub { font: 600 12px var(--sans); }
.hrow .earned { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 46%; }
.hrow .chip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--pos); }
.hrow .chip.neg { color: var(--neg); }
.hrow .chip .token { width: 15px; height: 15px; font-size: 8px; }
.hrow[open] summary .word { color: color-mix(in srgb, var(--pc) 78%, var(--ink)); }
.hrow ol { margin: 0 0 12px; }
.hfoot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 4px; }
.hempty { color: var(--muted); padding: 18px 0; font: italic 400 16px var(--serif); }
dialog:focus { outline: none; }

/* The one-time support note: a small, calm card with the coin on top, easing in over a fading backdrop. */
dialog.support { width: min(380px, calc(100% - 32px)); padding: 28px 24px 14px; text-align: center; }
.support .x { position: absolute; top: 8px; right: 8px; width: 44px; padding: 0; display: grid; place-items: center; }
.support .x svg { width: 20px; height: 20px; }
.support > .coin { display: block; width: 46px; height: 46px; margin: 2px auto 14px; filter: drop-shadow(0 3px 4px rgba(122, 76, 10, .22)); }
.support h2 { margin: 0 0 8px; font: 600 24px/1.15 var(--serif); font-variation-settings: "SOFT" 100; letter-spacing: -.015em; text-wrap: balance; }
.support p { margin: 0 auto 20px; max-width: 30ch; color: var(--muted); font-size: 15px; line-height: 1.5; text-wrap: pretty; }
.support .actions { display: grid; gap: 4px; }
a.btn { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 14px; border-radius: 12px;
  font: 700 16px/1 var(--sans); text-decoration: none; transition: background .15s, transform .08s; }
a.btn.go { background: var(--slate); color: #fff; }
a.btn.go:hover { background: #2a3b4d; }
a.btn:active { transform: scale(.98); }
a.btn:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
dialog.support[open] { animation: note-in .34s cubic-bezier(.2, .8, .3, 1); }
dialog.support[open]::backdrop { animation: note-fade .34s ease-out; }
@keyframes note-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes note-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.support[open], dialog.support[open]::backdrop { animation: none; } }
.ptable { width: 100%; border-collapse: collapse; margin: 8px 0 2px; font-variant-numeric: tabular-nums; text-align: center; }
.ptable th, .ptable td { padding: 7px 2px; border-bottom: 1px solid var(--line); }
.ptable thead th { font-size: 12px; font-weight: 700; color: var(--muted); }
.ptable tbody td { font: 600 22px/1 var(--serif); font-variation-settings: "SOFT" 100; }
.ptable th:first-child { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); }
.rules dl { margin: 0 0 6px; font-size: 15px; line-height: 1.5; }
.rules dt { font: 600 18px/1.2 var(--serif); font-variation-settings: "SOFT" 100; margin-top: 14px; }
.rules dd { margin: 3px 0 0; color: var(--ink); }

/* Full-screen secret hint: deep slate while locked, a pale sky when the word shows */
.secret { position: fixed; inset: 0; z-index: 100; overflow: hidden; cursor: pointer;
  padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  display: grid; place-items: center; text-align: center; background: #2b3b4c; color: #f1f5f8;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.secret[hidden] { display: none; }
.secret::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--cold); transform: scaleX(0); transform-origin: left; }
.secret.arming::before { transform: scaleX(1); transition: transform var(--hold) linear; }
.secret.open { background: radial-gradient(circle at 50% 40%, #fff, var(--sky-soft) 70%); color: var(--ink); }
.secret.open::before { opacity: 0; }
.secret > div { position: relative; max-width: 100%; }
#secretFace { width: 100%; min-height: 60vh; display: grid; place-content: center; }
.secret .icon { font: 700 12px/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--cold); margin-bottom: 18px; }
.secret .lock { font: 600 34px/1.1 var(--serif); font-variation-settings: "SOFT" 100; letter-spacing: -.015em; }
.secret .sub { font-size: 16px; opacity: .8; margin-top: 12px; line-height: 1.5; }
.secret .word { font: 600 clamp(52px, 18vw, 132px)/1 var(--serif); font-variation-settings: "SOFT" 100; letter-spacing: -.025em; overflow-wrap: anywhere; }
.secret.open .sub { font-size: 18px; margin-top: 14px; opacity: 1; color: var(--muted); }
.secret .undo { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(28px, env(safe-area-inset-bottom));
  color: #f1f5f8; background: rgba(255, 255, 255, .1); padding: 0 20px; }
.secret .undo:active { transform: translateX(-50%); background: rgba(255, 255, 255, .16); }
.secret.open .undo, .secret.arming .undo { visibility: hidden; }

/* New game: a small form, filled in top to bottom. Each choice is a row of segments (radio buttons
   underneath, so the arrow keys move between them), and one Go button at the end. */
dialog.menu { width: min(420px, calc(100% - 24px)); padding-bottom: 16px; }
.note { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-wrap: pretty; }
.note[hidden] { display: none; }
.pick { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.pick legend { margin: 0 0 8px; padding: 0; font: 800 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; background: var(--tint-2); border-radius: 14px; }
.segs.starts { grid-template-columns: 1fr; }
.seg { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 11px;
  font: 700 15px/1.1 var(--sans); text-align: center; color: var(--muted); cursor: pointer; transition: background .15s, color .15s; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
.seg:has(input:checked) { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg:has(input:focus-visible) { outline: 2px solid var(--sky); outline-offset: -2px; }
.seg:active { color: var(--ink); }
@media (hover: hover) { .seg:hover:not(:has(input:checked)) { background: var(--tint); color: var(--ink); } }
.menu .actions { display: flex; gap: 8px; margin-top: 4px; }
.menu .actions .go { flex: 1; min-height: 52px; font-size: 16px; }
/* New players start at 0, so the old scores are not shown beside them. */
.editor.group .rs { visibility: hidden; }
.editor .rs { flex: none; min-width: 2.5ch; text-align: right; font: 600 22px/1 var(--serif); font-variation-settings: "SOFT" 100; font-variant-numeric: tabular-nums lining-nums; }
/* On phones the Players card hangs from the top, so switching it to New players grows it downward
   instead of re-centering it, and it stays clear of the keyboard. Wider screens center it. */
@media (max-width: 699px) { dialog.editor { margin-top: max(20px, 6vh); } }
.editor .actions > span { display: flex; gap: 8px; margin-left: auto; }
.editor .actions [hidden] { display: none; }
/* Both footer buttons keep one width across modes, so switching to New players moves nothing. */
#doneEdit, #toGroup, #cancelEdit { min-width: 8em; }
/* Undo after a reset, and a spelling to try, sit inline in the message line; their tap area reaches past the text. */
.msg .takeback, .msg .respell { position: relative; min-height: 0; height: 19px; padding: 0 2px; border: 0; background: transparent; vertical-align: baseline;
  font: 700 14px/19px var(--sans); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.msg .takeback::after, .msg .respell::after { content: ''; position: absolute; inset: -12px -12px; }
/* A "did you mean" offer is centred under the guess field and set a little larger, so the word reads as the thing to tap. */
.msg.offer { text-align: center; font-size: 16px; }
.msg.offer .respell { font-size: 17px; padding: 0 1px; }
.msg.offer .respell::after { inset: -12px -16px; }

/* Desktop: one wide centred stage, like a game show. Phones keep the single column above. */
.side { display: contents; }
@media (min-width: 960px) {
  /* The big wordmark in the middle of the top row, the scoreboard across the stage under it, the guess field
     centred beneath that, and the board below. Gaps grow with the window's height, so the stage uses it.
     A long board grows down the page, and the top never moves for it, so a new guess never moves the guess field.
     Before the first guess there is nothing under the guess field, so the whole stage centres in the window. */
  main { flex: 1; max-width: 1144px; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 0 repeat(8, auto);
    align-content: start; align-items: start;
    padding: max(clamp(24px, 5.5vh, 64px), env(safe-area-inset-top)) max(40px, env(safe-area-inset-right)) clamp(32px, 5vh, 56px) max(40px, env(safe-area-inset-left)); }
  .fresh main { grid-template-rows: minmax(0, 1fr) repeat(7, auto) minmax(0, 1.25fr); }
  /* The menu on the left, the wordmark in the middle, the game number, sound and New game on the right.
     All three share one grid cell, so the wordmark centres on the page itself. */
  header { display: contents; }
  .brand, .hdr, .tools { grid-row: 2; grid-column: 1; align-self: center; }
  .brand { justify-self: center; height: 92px; }
  h1 { font-size: 64px; }
  .bonusmark { align-items: center; gap: 7px; }
  .bonusmark small { font-size: 12px; }
  .bonusmark b { font-size: 48px; max-width: 46vw; padding-bottom: .06em; }
  /* The menu runs the full width of the row, so New game ends it on the right; the game number and
     sound sit just inside it, above the row so they stay clickable. */
  .tools { margin: 0; }
  .tools button { font-size: 15px; }
  .tools #newGame { width: 7.5rem; font-size: 15px; }
  .hdr { justify-self: end; margin-right: calc(7.5rem + 10px); position: relative; z-index: 1; gap: 4px; }
  .meta { font-size: 14px; }
  /* Each card centres its name and score, so the strip reads as one scoreboard across the stage. */
  .lineup { position: relative; grid-row: 3; margin: clamp(8px, 1.6vh, 20px) 0 clamp(26px, 4.6vh, 52px); }
  .players { margin: 0; }
  .lineup .addp { display: grid; place-items: center; position: absolute; right: 12px; bottom: 12px; width: 26px; height: 26px; min-height: 0;
    padding: 0; border-radius: 50%; color: #8795a5; transition: background .15s, color .15s; }
  .lineup .addp:hover { background: var(--tint-2); color: var(--muted); }
  .addp svg { width: 16px; height: 16px; }
  .pcard { text-align: center; }
  .pcard .top { justify-content: center; }
  .pcard .score { transform-origin: center 70%; }
  .pcard.turn::after { left: 50%; right: auto; width: min(calc(100% - 20px), 96px); transform: translateX(-50%); }
  /* The guess field, its moves, the latest guess and then the message line, each centred at one width. */
  .play { display: contents; }
  form { grid-row: 4; }
  .moves { grid-row: 5; }
  .lastbox { grid-row: 6; margin-top: clamp(14px, 2vh, 22px); }
  /* The message line is one line at this width, so its area keeps one line for it and two for the commentary. */
  .status { grid-row: 7; height: 64px; margin-top: clamp(8px, 1.2vh, 14px); }
  .msg { height: auto; min-height: 19px; }
  .stats { grid-row: 8; margin: clamp(6px, 1.4vh, 16px) 6px 10px; }
  #list { grid-row: 9; }
  form, .moves, .lastbox, .status { width: 100%; max-width: 680px; justify-self: center; }
  .status { max-width: 676px; text-align: center; }
  /* The guess field is the central interaction, so it is a size up from the phone's. */
  form { gap: 10px; }
  form input { min-height: 66px; padding: 0 74px 0 20px; font-size: 28px; border-radius: 16px; }
  form button { min-height: 66px; padding: 0 30px; font-size: 18px; border-radius: 14px; }
  .pot { width: 60px; right: 8px; font-size: 10px; gap: 4px; }
  .pot b { font-size: 20px; }
  .pot .amt .coin { width: 16px; height: 16px; }
  .moves { gap: 10px; margin-top: 10px; }
  .moves button { min-height: 50px; font-size: 16px; border-radius: 14px; }
  #list { padding: 6px 22px; }
  /* Rows are roomy and the closeness bar runs inline after the word, so the bars line up as one chart. */
  #list li.g, .lastbox li.g { grid-template-columns: 5ch minmax(0, 15em) minmax(0, 1fr) 22px 3.2ch; column-gap: 16px;
    min-height: 60px; padding-bottom: 0; }
  .lastbox li.g { column-gap: 14px; grid-template-columns: 5ch minmax(0, 11em) minmax(0, 1fr) 22px 3.2ch; }
  #list li.g::before, #list li.g .bar, .lastbox li.g::before, .lastbox li.g .bar { position: static; grid-row: 1; grid-column: 3; height: 6px; }
  #list li.g .bar, .lastbox li.g .bar { width: calc(100% * var(--p) / 100); }
  #list li.g > *, .lastbox li.g > * { grid-row: 1; }
  #list li.g .r, .lastbox li.g .r { grid-column: 1; }
  #list li.g .w, .lastbox li.g .w { grid-column: 2; }
  #list li.g > :nth-child(3), .lastbox li.g > :nth-child(3) { grid-column: 4; justify-self: center; }
  #list li.g .pts, .lastbox li.g .pts { grid-column: 5; }
  #list li.g .r { font-size: 15px; }
  #list li.g .w { font-size: 22px; }
  #list li.g.win { margin: 0 -10px; padding: 0 10px; }
  .lastbox li.g, .lastbox li.g.win { padding-bottom: 0; }
  /* No sideways scrolling with a mouse: up to 8 players share one row, and more wrap to two even rows. */
  .players { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); overflow: visible; }
  .players:has(> :nth-child(9)) { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .players:has(> :nth-child(11)) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  h1 { font-size: 30px; }
  form input { font-size: 21px; }
}

/* An Easy game (the easy class on the page, set by game.js): the regular look, a size up for small hands,
   with closeness shown as bands (Cold up to On fire) instead of rank numbers. */
.easy body { font-size: 17px; }
/* The header row (.tools) stays as it is in every mode, so switching modes moves nothing in it. */
.easy :where(:not(.tools)) > button { font-size: 16px; min-height: 48px; }
.easy .pcard .name { font-size: 14px; }
.easy .pcard .score { font-size: 32px; }
.easy form input { min-height: 62px; font-size: 26px; }
.easy form button { min-height: 62px; font-size: 18px; }
.easy .moves button { min-height: 52px; font-size: 17px; }
.easy .msg { font-size: 15px; }
.easy .msg, .easy .status .bubble { line-height: 20px; }
.easy .msg { height: 40px; }
.easy .bubble { font-size: 16px; line-height: 20px; }
.easy .status { height: 84px; }

/* A guess's band sits where the regular game shows its rank. */
.easy li.g { grid-template-columns: 5.4em 1fr auto auto; min-height: 56px; }
.easy li.g .w { font-size: 22px; }
li.g .r.band { font: 800 14px/1 var(--sans); color: var(--ink); text-align: right; white-space: nowrap; }
li.g.win .r.band { color: var(--gold); }
.easy li.g .pts { font-size: 14px; }
.easy .lastbox li.g, .easy .lastbox .none { min-height: 60px; }
.easy .lastbox .none { grid-template-columns: 5.4em 1fr; }
.easy #closestList li.g .w { font-size: 20px; }

.easy .rules dl { font-size: 16px; }

@media (min-width: 960px) {
  .easy form input { min-height: 70px; font-size: 30px; }
  .easy form button { min-height: 70px; font-size: 19px; }
  .easy .moves button { min-height: 54px; font-size: 17px; }
  .easy #list li.g, .easy .lastbox li.g { grid-template-columns: 6em minmax(0, 15em) minmax(0, 1fr) 22px 3.2ch; min-height: 64px; }
  .easy .lastbox li.g { grid-template-columns: 6em minmax(0, 11em) minmax(0, 1fr) 22px 3.2ch; }
  .easy #list li.g .w { font-size: 24px; }
  .easy #list li.g .r.band { font-size: 15px; }
}
