/* Classic newspaper-crossword look. Always light, even if the device is in dark mode. */
:root {
  color-scheme: light only;
  --bg: #faf8f3;
  --paper: #ffffff;
  --ink: #141414;
  --muted: #6f6c64;
  --line: #141414;
  --hair: #dedad0;
  --sel: #ffe58a;       /* selected square */
  --word: #cfe4fb;      /* current word */
  --wrong: #d9363e;
  --ok: #7bc99a;
  --cell: 56px;         /* set by JS to fit the screen */
  --serif: "Georgia", "Times New Roman", serif;
  --sans: -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.35 var(--sans); -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; touch-action: manipulation; cursor: pointer; }
h1, h2, h3 { margin: 0; }

/* ------------------------------------------------------------ lobby */
#lobby { max-width: 460px; margin: 0 auto; padding: calc(24px + env(safe-area-inset-top)) 20px 32px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font: 700 28px/1.1 var(--serif); letter-spacing: -.01em; }
.logo { display: grid; grid-template-columns: repeat(3, 12px); border: 2px solid var(--ink); background: var(--ink); gap: 1px; }
.logo i { width: 12px; height: 12px; background: var(--paper); } .logo i.k { background: var(--ink); }
.sub { color: var(--muted); margin: 6px 0 22px; }
.field { display: block; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 22px; }
.field input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: 500 18px var(--sans); text-transform: none; letter-spacing: 0; color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 10px; }
.field input:focus { outline: 3px solid var(--sel); }
#lobby h2 { font: 700 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
#lobby section { margin-bottom: 26px; }
.card { display: block; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: inherit; }
.current { display: flex; align-items: center; gap: 12px; box-shadow: 3px 3px 0 var(--ink); }
.current .meta { flex: 1; min-width: 0; } .current b { font: 700 19px var(--serif); display: block; }
.current small { color: var(--muted); display: block; margin-top: 2px; }
/* every line stays on one line: small text, no wrapping, details column sized to its content */
.current { gap: 10px; padding: 14px; }
.current .meta { flex: none; }
.current small { font-size: 13px; white-space: nowrap; }
.current .side { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.current .side .bar { margin: 0; }
.current .side small { margin: 0; text-align: center; white-space: nowrap; }
.current .go { text-align: center; font-weight: 700; padding: 8px 14px; border-radius: 99px; background: var(--sel); border: 1.5px solid var(--ink); white-space: nowrap; }
.bar { height: 6px; background: var(--hair); border-radius: 3px; margin-top: 8px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--ok); }
.kinds { display: grid; grid-template-columns: 1fr; gap: 12px; }
.kind { background: var(--paper); border: 1.5px solid var(--ink); border-radius: 12px; padding: 16px 14px; text-align: left; box-shadow: 3px 3px 0 var(--ink); }
.kind b { display: block; font: 700 22px var(--serif); } .kind span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.kind:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.kind:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.primary { width: 100%; padding: 14px; font: 700 18px var(--sans); background: var(--sel); border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }

/* ------------------------------------------------------------ game shell */
#game { position: fixed; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); overscroll-behavior: none; }
.top { display: flex; align-items: center; gap: 6px; height: 48px; padding: 0 8px; flex: none; border-bottom: 1px solid var(--hair); }
.icon { min-width: 36px; height: 36px; border: 0; background: none; font-size: 26px; line-height: 1; border-radius: 8px; padding: 0 6px; }
.icon.txt { font: 600 14px var(--sans); border: 1.5px solid var(--ink); background: var(--paper); height: 32px; padding: 0 10px; }
.icon:active { background: var(--hair); }
.ttl { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ttl b { font: 700 17px var(--serif); white-space: nowrap; }
.ttl small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.top { justify-content: space-between; }
.top .l, .top .r { display: flex; align-items: center; gap: 6px; min-width: 0; }
.top .r { justify-content: flex-end; margin-right: 10px; }
#next { margin-right: 8px; }
/* player row: badges on the left, then timer and All clues on the right */
.timer { flex: none; margin-left: auto; font: 700 20px/1 var(--serif); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.fine { text-transform: none; letter-spacing: 0; font-weight: 400; }
.who-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.who { padding: 12px 2px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 12px; font: 700 15px var(--sans); color: var(--ink); opacity: .5; }
.who.on { opacity: 1; box-shadow: 3px 3px 0 var(--ink); }
.dots { display: flex; gap: 4px; }
.dots { gap: 6px; flex: none; }
.dots { align-items: flex-end; gap: 8px; }
.pg { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pg + .pg { padding-left: 8px; border-left: 1px solid var(--hair); }
.pgl { font: 700 9px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.pgb { display: flex; justify-content: center; gap: 0; }
.pl { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 48px; } /* equal columns, so badges are evenly spaced however many there are */
.pl small { white-space: nowrap; text-align: center; } /* names are never cut off */
.pl small { font-size: 9px; line-height: 1; color: #a09c92; font-weight: 500; letter-spacing: 0; }
.dot { position: relative; width: 21px; height: 21px; border-radius: 5px; display: grid; place-items: center; font: 18px/1 var(--sans); border: 1.5px solid var(--ink); }
.pl.me .dot::after { content: ""; position: absolute; inset: -3px; border-radius: 7px; border: 1.5px dashed var(--muted); }
.dot { padding: 0; }
.dot { font: 700 18px/1 var(--sans); }
.dot .sb { width: 16px; height: 14px; }
.ic { display: grid; place-items: center; }
.ic .sb { width: 26px; height: 22px; }
.icon-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.ic { height: 52px; border: 1.5px solid var(--hair); border-radius: 12px; background: var(--paper); padding: 0; }
.ic:disabled { opacity: .25; filter: grayscale(1); cursor: not-allowed; }
.ic.on { border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.strip { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex: none; padding: 6px 10px 4px; border-bottom: 1px solid var(--hair); }
.invite { height: 30px; padding: 0 12px; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper); font: 600 13px var(--sans); white-space: nowrap; }
.strip .icon.txt { flex: none; font-size: 13px; padding: 0 9px; }
.invite:active { background: var(--sel); }
.done { flex: none; padding: 8px 14px; text-align: center; font-weight: 700; background: var(--ok); border-bottom: 1.5px solid var(--ink); }

.cluebar { display: flex; align-items: stretch; flex: none; background: var(--word); border-bottom: 1.5px solid var(--ink); min-height: 60px; }
.cluebar .icon.txt { align-self: center; flex: none; margin: 0 2px; white-space: nowrap; }
.nav { width: 44px; border: 0; background: none; font-size: 28px; }
.nav:active { background: rgba(0, 0, 0, .08); }
.active { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 6px 4px; display: flex; flex-direction: column; justify-content: center; }
.active small { font: 700 12px var(--sans); letter-spacing: .05em; text-transform: uppercase; color: #3a516e; }
.active span { font: 500 17px/1.2 var(--serif); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.body { flex: 1; min-height: 0; display: flex; }
.stage { flex: 1; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }

/* ------------------------------------------------------------ grid */
.grid { display: grid; gap: 1px; background: var(--line); border: 2px solid var(--line); width: max-content; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cell { position: relative; width: var(--cell); height: var(--cell); background-color: var(--tint, var(--paper)); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cell.block { background: var(--line); cursor: default; }
/* word / selection highlights are translucent layers so the author's colour still shows through */
.cell.word { background-image: linear-gradient(rgba(118, 172, 242, .45), rgba(118, 172, 242, .45)); }
.cell.sel { background-image: linear-gradient(rgba(255, 213, 58, .8), rgba(255, 213, 58, .8)); }
.cell .n { position: absolute; top: 2px; left: 3px; font: 600 calc(var(--cell) * .2)/1 var(--sans); color: #333; pointer-events: none; }
.cell .l { font: 500 calc(var(--cell) * .58)/1 var(--serif); text-transform: uppercase; margin-top: calc(var(--cell) * .08); pointer-events: none; }
/* suggestions: squares stay classic black and white; up to three mini blobs along the bottom show who suggested something */
/* mini blobs: one row in the top-right corner, right-aligned, so the first suggestion sits leftmost. Letters and grid never move or shrink. */
.cell .mini { position: absolute; top: 2px; right: 2px; display: flex; justify-content: flex-end; gap: 1px; pointer-events: none; }
.sb { display: block; }
.cell .mini .sb { width: calc(var(--cell) * .2); height: calc(var(--cell) * .175); }
/* "View suggestions" pill in the clue bar: grey caption over a muted-blue pill of blobs + count */
.vs { flex: none; align-self: center; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 82px; margin-right: 2px; }
.vs small { font: 500 9px/1 var(--sans); color: #6f7d90; white-space: nowrap; }
.vs-pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 10px; border: 1.5px solid var(--ink); border-radius: 99px; background: #9dbfe8; font: 600 13px var(--sans); color: var(--ink); }
.vs-pill .stack { display: inline-flex; }
.vs-pill .stack .sb { width: 16px; height: 14px; margin-left: -4px; }
.vs-pill .stack .sb:first-child { margin-left: 0; }
.vs-pill:active { transform: translateY(1px); }
/* banner under the player row (helpers only) */
.role { flex: none; display: flex; align-items: center; padding: 6px 16px; min-height: 32px; background: #fbf6e3; border-bottom: 1px solid var(--hair); font-size: 13px; color: #5a564c; }
/* suggestion sheet, in the keyboard's place. Every row uses the same four columns: blob | from | letter | action */
/* suggestions card: placed by script exactly over the grid (+4px bleed); pale blue so it reads as its own layer */
.sugsheet { position: fixed; z-index: 20; box-sizing: border-box; background: #e6eefa; border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 4px 4px 0 var(--ink); padding: 8px 14px 6px; display: flex; flex-direction: column; overflow: auto; }
.sc-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.sc-hd b { font: 500 14px var(--sans); }
.sc-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 6px; }
.sc-f { display: grid; gap: 1px; flex: none; }
.sc-f span { position: relative; box-sizing: border-box; width: 24px; height: 24px; border: 1.5px solid var(--ink); background: var(--paper); display: flex; align-items: center; justify-content: center; font: 500 14px var(--serif); }
.sc-f span i { position: absolute; top: 0; left: 2px; font: 600 7px/1 var(--sans); font-style: normal; color: #333; }
.sc-f span.n { border: 0; background: transparent; }
.sc-f span.e { border: 1px dashed #c3bfb2; background: transparent; }
.sc-f span.q { background: var(--sel); color: #3a8ac4; }
/* helper card: squares are typeable. Yellow = active, blue = what you suggest, a small struck letter = what the owner has there */
.sc-f span.act { background: var(--sel); }
.sc-f span.dr { color: #2f7fc4; font-weight: 600; box-shadow: inset 0 0 0 2px #2f7fc4; }
.sc-f span small { position: absolute; right: 2px; bottom: 0; font: 500 9px/1 var(--serif); color: #8a1f26; text-decoration: line-through; }
.sc-f span:not(.n):not(.e) { cursor: pointer; }
.sc-nm small { display: block; font-size: 10px; color: #6f7d90; }
.sc-lg { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 2px; }
.sc-lg h6 { margin: 0; font: 700 10px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: #5c6c82; }
.sc-lg p { margin: 2px 0 0; font: 500 12px/1.25 var(--serif); }
.sc-lg em { display: block; margin-top: 2px; font: 500 10px var(--sans); font-style: normal; color: #6f7d90; }
.sc-rows { margin-top: auto; }
.sc-r { display: grid; grid-template-columns: 26px 1fr 26px 60px; column-gap: 8px; align-items: center; height: 32px; border-top: 1px solid #bfd0e6; font-size: 12px; cursor: pointer; }
.sc-r.on { background: #fff; margin: 0 -5px; padding: 0 5px; border-radius: 8px; }
.sc-bl .sb { width: 20px; height: 17px; margin: 0 auto; }
.sc-l { font: 500 19px var(--serif); text-align: center; }
.sc-l.none { color: #b4b0a5; font-size: 16px; }
.sc-act .sg-btn { width: 60px; padding: 2px 0; font-size: 11px; }
.sg-hd { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sg-hd b { font: 500 14px var(--sans); }
.sg-x { border: 0; background: none; font-size: 26px; line-height: 1; width: 32px; height: 28px; padding: 0; margin-right: -6px; color: var(--ink); }
.sg { display: grid; grid-template-columns: 28px 1fr 36px 76px; column-gap: 10px; align-items: center; }
.sg-th { font: 700 10px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-bottom: 6px; border-bottom: 1.5px solid var(--ink); }
.sg-th .ctr { text-align: center; }
.sg-tr { min-height: 44px; border-bottom: 1px solid var(--hair); font-size: 14px; }
.sg-tr:last-of-type { border-bottom: 0; }
.sg-bl .sb { width: 28px; height: 24px; margin: 0 auto; }
.sg-l { font: 500 24px var(--serif); text-align: center; }
.sg-l.none { color: #b4b0a5; font-size: 18px; }
.sg-btn { display: block; width: 76px; padding: 4px 0; text-align: center; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper); font: 500 13px var(--sans); }
.sg-btn.y { background: var(--sel); }
.sg-btn:active { transform: translateY(1px); }
.sg-note { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
body.helper .menu .grp { display: none; } /* helpers can't check or reveal */

/* in-page confirm box (the browser's own one can't be reworded) */
.ask { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .35); }
.ask-card { width: min(86vw, 300px); padding: 20px 18px 16px; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--ink); }
.ask-card p { margin: 0 0 16px; font: 700 19px var(--serif); text-align: center; }
.ask-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ask-btns.one { grid-template-columns: 1fr; }
#askYes, #endedBtn { background: var(--sel); }

/* game top rows. Row 1: three equal columns (title | main user + time | helpers). Row 2: four equal pills. Both rows share one 12-unit grid. */
.hr1 { flex: none; display: grid; grid-template-columns: repeat(3, 1fr); padding: 8px 12px; }
.hcol { padding: 0 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.hcol:first-child { padding-left: 0; }
.hcol + .hcol { border-left: 1px solid var(--hair); }
.htitle { justify-content: space-between; gap: 0; }
.htitle b { display: block; font: 700 20px/1.05 var(--serif); }
.htitle .gn { display: block; margin-top: 2px; font: 600 13px/1.1 var(--sans); }
.htitle small { font-size: 9.5px; color: var(--muted); white-space: nowrap; text-align: left; }
.hgl { font: 700 8px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.hlst { display: flex; flex-direction: column; gap: 2px; }
.hpr { display: flex; align-items: center; gap: 6px; height: 18px; font: 500 10px var(--sans); color: #7d796f; }
.hdot { position: relative; width: 18px; height: 18px; border: 1.5px solid var(--ink); border-radius: 5px; display: grid; place-items: center; flex: none; }
.hdot .sb { width: 13px; height: 11px; }
.hpr.me .hdot::after { content: ""; position: absolute; inset: -3px; border: 1.5px dashed var(--muted); border-radius: 7px; }
.hnone { font: 500 10px var(--sans); color: #a8a496; }
.htm { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }
.htm b { font: 700 20px/1 var(--serif); font-variant-numeric: tabular-nums; }
.hr2 { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 2px 12px 9px; border-bottom: 1px solid var(--hair); }
.hbtn { height: 28px; padding: 0; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper); font: 600 11.5px var(--sans); white-space: nowrap; min-width: 0; }
.hbtn:disabled { color: #a8a496; border-color: #cdc9bc; background: #f1efe8; cursor: not-allowed; }
.hbtn:active:not(:disabled) { background: var(--sel); }
.ask-btns button { padding: 11px 0; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--paper); font: 600 15px var(--sans); }
#askYes { background: var(--sel); }

/* compact lobby: everything on one phone screen (blobs in a single row) */
#lobby { padding: calc(12px + env(safe-area-inset-top)) 18px 12px; }
.brand h1 { font-size: 24px; }
.logo { grid-template-columns: repeat(3, 9px); } .logo i { width: 9px; height: 9px; }
.sub { margin: 2px 0 10px; font-size: 14px; }
.field { margin-bottom: 10px; }
.who-row { margin-top: 6px; }
.who { padding: 8px 2px; }
#lobby h2 { margin-bottom: 6px; }
#lobby section { margin-bottom: 12px; }
.current { padding: 10px 12px; }
.current b { font-size: 17px; }
.current .go { padding: 6px 12px; }
.kind { padding: 10px 12px; } .kind b { font-size: 19px; }
.icon-row { grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 6px; }
.ic { height: 40px; border-radius: 9px; }
.ic .sb { width: 26px; height: 22px; }
/* Check / Reveal results: a very light red cell with a small corner flag bottom left (clue numbers top left, mini blobs top right) */
.cell.wrong { background-color: #fbe3e3; }
.cell.wrong::after { content: ""; position: absolute; left: 0; bottom: 0; pointer-events: none; border-left: calc(var(--cell) * .26) solid #d9363e; border-top: calc(var(--cell) * .26) solid transparent; }
.cell.right .l { color: #1f7a2e; }
/* the owner's wrong guess after a reveal: small and struck out, bottom right */
.cell .gx { position: absolute; right: 3px; bottom: 1px; font: 500 calc(var(--cell) * .24)/1 var(--serif); color: #8a1f26; text-decoration: line-through; pointer-events: none; }
/* a helper's unsent suggestion: gold inner outline, faint gold letter (big in an empty square, small where the owner already has a letter) */
.cell.draft { box-shadow: inset 0 0 0 calc(var(--cell) * .05) #e6b800; }
.cell .l.dgold { color: #b89400; opacity: .75; }
.cell .dl { position: absolute; right: 3px; bottom: 1px; font: 600 calc(var(--cell) * .26)/1 var(--serif); color: #b89400; pointer-events: none; }
/* helper's Send pill and strip, reveal banner, confirm sub-line, Reveal button */
.hbtn.go { background: var(--sel); border-color: var(--ink); color: var(--ink); }
.role.ready { background: #fff3c2; color: #4a4220; }
.done.rev { background: #f3e3b5; color: var(--ink); display: flex; align-items: center; justify-content: center; gap: 8px; text-align: left; font-weight: 600; font-size: 13px; padding: 6px 14px; }
.lgnd { display: flex; gap: 12px; font-weight: 600; font-size: 12px; }
.lgnd .sw { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border: 1px solid var(--ink); margin-right: 5px; position: relative; background: #fff; font: 700 15px/1 var(--sans); color: #1f7a2e; font-style: normal; vertical-align: -4px; }
.lgnd .sw.bad { background: #fbe3e3; }
.lgnd .sw.bad::after { content: ""; position: absolute; left: 0; bottom: 0; border-left: 5px solid #d9363e; border-top: 5px solid transparent; }
.ask-card small { display: block; margin: -10px 0 14px; text-align: center; font-size: 12px; color: var(--muted); }
/* popups: one format everywhere. White card, bold serif title, big stacked buttons; the first (yellow) is the main choice */
.ask-btns { display: flex; flex-direction: column; gap: 8px; }
.ask-btns button { padding: 12px 0; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--paper); font: 600 16px var(--sans); }
.ask-btns button.y { background: #f9d65c; }
.ask-btns button.red { background: #fdecea; color: #8a1f26; border-color: #8a1f26; }
.ask-card small.big { margin: 0 0 12px; font: 700 34px/1.1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.menu-card h6 { margin: 0; font: 700 11px var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.menu button small { display: block; margin-top: 2px; font: 400 11px var(--sans); color: var(--muted); }
.menu button.fresh { background: #e9f4ff; border-color: #1f5f99; color: #1f5f99; }
.menu button.fresh small { color: #4a7fb0; }
.menu button.warn small { color: #a85a60; }
.menu button:disabled { color: #a8a496; border-color: #cdc9bc; background: #f1efe8; cursor: not-allowed; }
.menu button.warn { background: #fdecea; color: #8a1f26; border-color: #8a1f26; }
.sg-btn.off { color: #a8a496; border-color: #cdc9bc; background: #f1efe8; }
.hpr.me { color: var(--ink); font-weight: 600; }
/* wide screens show the clue list beside the grid, so the All clues pill is hidden: three equal pills, no gap */
@media (min-width: 900px) { .hr2 { grid-template-columns: repeat(3, 1fr); } }

/* ------------------------------------------------------------ keyboard (touch screens) */
.kbd { flex: none; background: #d3d6dc; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; user-select: none; -webkit-user-select: none; }
.krow { display: flex; gap: 5px; justify-content: center; }
.krow.r2 { padding: 0 5%; }
.key { flex: 1; max-width: 40px; height: 44px; border: 0; border-radius: 6px; background: var(--paper); box-shadow: 0 1px 0 #8b8f98; font: 500 20px var(--sans); text-transform: uppercase; display: grid; place-items: center; }
.key:active { background: var(--sel); }
.key.wide { flex: 1.5; max-width: 60px; background: #a9aeb8; font-size: 18px; }

/* ------------------------------------------------------------ clue list (bottom sheet on phones) */
.clues { position: fixed; left: 0; right: 0; bottom: 0; max-height: 78dvh; background: var(--bg); border-top: 1.5px solid var(--ink); border-radius: 16px 16px 0 0;
  transform: translateY(105%); transition: transform .22s ease; z-index: 30; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }
.clues.open { transform: none; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 4px 16px; font: 700 16px var(--serif); }
/* clue list: small type, a rule between clues, and the number boxed like a grid square */
.cols { min-height: 0; overscroll-behavior: contain; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0 0 16px; -webkit-overflow-scrolling: touch; border-top: 1.5px solid var(--ink); }
.cols > div { padding: 0 10px; min-width: 0; }
.cols > div + div { border-left: 1.5px solid var(--ink); }
.clues h3 { position: sticky; top: 0; z-index: 1; background: var(--bg); font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); padding: 8px 2px 6px; border-bottom: 1.5px solid var(--ink); }
.clues ol { list-style: none; margin: 0; padding: 0; }
.clues li { display: flex; align-items: flex-start; gap: 8px; padding: 7px 2px; border-bottom: 1px solid var(--hair); font: 13px/1.25 var(--serif); cursor: pointer; }
.clues li b { flex: none; min-width: 22px; height: 22px; padding: 0 3px; display: grid; place-items: center; border: 1px solid var(--ink); border-radius: 3px; background: var(--paper); font: 700 11px/1 var(--sans); color: var(--ink); }
.clues li span { padding-top: 2px; }
.clues li.on { background: #eef4fb; } .clues li.mine { background: var(--word); } .clues li.mine b { background: var(--sel); }
.clues li.filled { color: #9a968c; text-decoration: line-through; text-decoration-color: #c9c5ba; }
.clues li.filled b { border-color: #bdb9ae; color: #9a968c; }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .28); z-index: 25; }

/* ------------------------------------------------------------ menu (bottom sheet) */
.menu { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .28); }
.menu-card { width: 100%; background: var(--bg); border-top: 1.5px solid var(--ink); border-radius: 16px 16px 0 0; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; }
.grp { display: flex; gap: 8px; align-items: center; }
.grp span { width: 64px; font: 700 13px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.menu button { flex: 1; padding: 12px 8px; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--paper); font-weight: 600; }
.menu button.wide { width: 100%; } .menu button.strong { background: var(--sel); }
.toast { position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 50; background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 99px; font-size: 14px; max-width: 90vw; text-align: center; }

/* ------------------------------------------------------------ keyboard shows only on touch devices; desktop gets side clues */
@media (hover: hover) and (pointer: fine) { .kbd { display: none; } }
.force-touch .kbd { display: flex !important; }
@media (min-width: 900px) {
  #game { max-width: 1100px; margin: 0 auto; }
  .clues { position: static; transform: none; width: 380px; max-height: none; border: 0; border-left: 1px solid var(--hair); border-radius: 0; background: none; z-index: auto; transition: none; }
  .sheet-head, #clueBtn { display: none; }
  .cols { padding-top: 12px; }
  .backdrop { display: none; }
}

/* ------------------------------------------------------------ lobby v2: title row, 2x2 names + 4x2 blobs, room cards */
#lobby { padding: calc(14px + env(safe-area-inset-top)) 16px 14px; }
.lb-brand { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lb-brand h1 { font: 700 22px/1.1 var(--serif); color: #000; opacity: 1; white-space: nowrap; letter-spacing: 0; }
.lb-brand .logo { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 40px; height: 40px; flex: none; }
.lb-brand .logo i { width: auto; height: auto; }
.lb-brand .cup { width: 52px; height: 52px; margin: -6px 0; object-fit: contain; flex: none; display: block; }
#lobby .sub { text-align: center; margin: 6px 0 12px; font-size: 13px; }
.lb-lab { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 5px; }
.lb-two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: start; margin-bottom: 14px; }
.lb-who { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 6px; height: 84px; }
.lb-b { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0; border: 1.5px solid var(--ink); border-radius: 10px; background: var(--paper); font: 700 12.5px var(--sans); white-space: nowrap; opacity: .55; }
.lb-b.on { opacity: 1; box-shadow: 2px 2px 0 var(--ink); }
.lb-b .sb { width: 14px; height: 12px; flex: none; }
.lb-blobs { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; gap: 6px; height: 84px; }
.lb-blobs .ic { height: auto; border-radius: 8px; }
.lb-blobs .ic .sb { width: 19px; height: 16px; }
.lb-blobs .hint { grid-column: 1 / -1; margin: 0; }
#roomsBox { margin-bottom: 0; }
.lb-room { display: grid; grid-template-columns: 34px 1fr auto; column-gap: 10px; align-items: center; padding: 9px 10px; margin-bottom: 7px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--rt, #fff); }
.lb-room.mine { box-shadow: 3px 3px 0 var(--ink); }
.lb-room.grey { filter: grayscale(1); opacity: .55; border-color: #8a8678; }
.lb-room.none { border-style: dashed; background: transparent; box-shadow: none; }
.lb-bd { width: 32px; height: 32px; border: 1.5px solid var(--ink); border-radius: 7px; display: grid; place-items: center; background: #fff; }
.lb-room.none .lb-bd { border-style: dashed; border-color: #cdc9bc; }
.lb-bd .sb { width: 22px; height: 19px; }
.lb-room b { display: block; font: 700 15px var(--serif); white-space: nowrap; }
.lb-room b em { font: 500 12px var(--sans); font-style: normal; color: #55524a; }
.lb-room small { display: block; font-size: 11px; color: #55524a; line-height: 1.3; white-space: nowrap; }
.lb-room .bar { width: 100px; height: 5px; margin-top: 4px; background: rgba(255, 255, 255, .7); }
.lb-act { display: flex; flex-direction: column; gap: 5px; width: 70px; }
.lb-btn { padding: 5px 0; border: 1.5px solid var(--ink); border-radius: 99px; text-align: center; font: 600 12px var(--sans); background: var(--paper); }
.lb-btn.y { background: var(--sel); }
.lb-btn.ghost { border-color: #8a1f26; color: #8a1f26; font-size: 11px; padding: 3px 0; }
.lb-btn:disabled { cursor: not-allowed; }
