@font-face {
  font-family: 'Archivo';
  src: url(/fonts/archivo.woff2) format('woff2-variations'), url(/fonts/archivo.woff2) format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: block;
}

:root {
  --table: #131316;
  --table-2: #1b1b20;
  --table-3: #26262d;
  --line: #34343c;
  --mute: #8d8a84;
  --paper: #efe9dc;
  --paper-2: #e4dccb;
  --ink: #17171b;
  --red: #e2472d;
  --red-deep: #a8301c;
  --blue: #2d63da;
  --blue-deep: #1b3e98;
  --sand: #cdbd97;
  --sand-deep: #a39470;
  --void: #060607;
  --team: var(--red);
  --team-deep: var(--red-deep);
  color-scheme: dark;
}
[data-turn='b'], .t-b { --team: var(--blue); --team-deep: var(--blue-deep); }
[data-turn='r'], .t-r { --team: var(--red); --team-deep: var(--red-deep); }

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--table);
  color: var(--paper);
  font-family: 'Archivo', system-ui, sans-serif;
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; }
.hidden { display: none !important; }

/* ---------- shared atoms ---------- */
.btn {
  height: 44px; padding: 0 18px; border-radius: 11px;
  background: var(--table-3); color: var(--paper);
  font-weight: 650; font-stretch: 100%; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:hover { background: #303038; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; pointer-events: none; }
.btn.solid { background: var(--team); color: #fff; }
.btn.solid:hover { background: var(--team-deep); }
.btn.paper { background: var(--paper); color: var(--ink); }
.btn.armed { background: var(--paper); color: var(--ink); }

.word { display: block; width: 100%; white-space: nowrap; text-transform: uppercase; text-align: center; line-height: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--paper); color: var(--ink); border-radius: 12px;
  padding: 12px 18px; font-weight: 650; font-size: 16px; white-space: nowrap;
  box-shadow: 0 14px 40px rgba(0,0,0,.45);
  transition: opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast i { font-style: normal; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: 0; }

.conn {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 70;
  background: #3a2a12; color: #ffd9a0; border-radius: 9px; padding: 6px 12px; font-size: 13px; font-weight: 600;
}

/* identity fills, used by board tiles, phone keys and pips */
.k-r { --fill: var(--red); --fill-ink: #fff; }
.k-b { --fill: var(--blue); --fill-ink: #fff; }
.k-n { --fill: var(--sand); --fill-ink: #2b2619; }
.k-a { --fill: var(--void); --fill-ink: #f2ede4; }

/* ======================================================================
   BOARD (laptop)
   ====================================================================== */
body.board {
  display: grid; grid-template-rows: auto 1fr auto; height: 100dvh; overflow: hidden;
  padding: 18px 22px calc(14px + env(safe-area-inset-bottom));
  gap: 14px;
}

.bh { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 84px; }
.score { display: flex; align-items: center; gap: 16px; }
.score.b { justify-content: flex-end; flex-direction: row-reverse; }
.score .num {
  font-size: 76px; line-height: .8; font-weight: 850; font-stretch: 70%;
  font-variant-numeric: tabular-nums; min-width: 1ch; text-align: center;
}
.score.r .num { color: var(--red); }
.score.b .num { color: var(--blue); }
.score .meta { display: grid; gap: 8px; }
.score.b .meta { justify-items: end; }
.score .name { font-size: 15px; font-weight: 700; font-stretch: 112%; color: var(--paper); }
.pips { display: flex; gap: 4px; }
.pip { width: 9px; height: 16px; border-radius: 2.5px; background: var(--fill); transition: background .3s, box-shadow .3s; }
.pip.gone { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }

.status { text-align: center; padding: 0 24px; min-width: 420px; }
.status .who { font-size: 30px; font-weight: 800; font-stretch: 118%; line-height: 1.05; color: var(--team); }
.status .sub { margin-top: 8px; font-size: 17px; color: #c9c3b6; font-weight: 500; min-height: 22px; }
.status .clue { display: inline-flex; align-items: baseline; gap: 14px; }
.status .clue .cw { font-size: 30px; font-weight: 800; font-stretch: 100%; color: var(--paper); text-transform: uppercase; }
.status .clue .cn { font-size: 30px; font-weight: 800; color: var(--team); font-stretch: 80%; }
.status .clue .cg { font-size: 15px; color: var(--mute); font-weight: 550; }

/* the board's frame is the key card's edge: lit in the colour of whoever is guessing */
.frame {
  position: relative; min-height: 0;
  border-radius: 22px; padding: 14px;
  background: var(--table-2);
  box-shadow: inset 0 0 0 3px var(--team), 0 0 0 1px rgba(0,0,0,.4), 0 0 60px -10px color-mix(in srgb, var(--team) 45%, transparent);
  transition: box-shadow .5s;
}
.grid {
  height: 100%;
  display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 12px;
}

.card {
  position: relative; container-type: size; min-width: 0; min-height: 0;
  border-radius: 11px; background: var(--paper); color: var(--ink);
  box-shadow: 0 1px 0 #fff8 inset, 0 3px 0 var(--paper-2), 0 8px 18px rgba(0,0,0,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  transition: transform .15s, box-shadow .15s;
  cursor: pointer; user-select: none;
}
.card::before { /* printed inner rule */
  content: ''; position: absolute; inset: 7px; border-radius: 6px; border: 1.5px solid rgba(23,23,27,.12); pointer-events: none;
}
.card .echo {
  position: absolute; top: 12%; left: 0; right: 0; transform: rotate(180deg);
  font-size: min(11cqh, 7cqw); font-weight: 600; font-stretch: 100%; opacity: .2; padding: 0 12%;
}
.card .main {
  padding: 0 7%; margin-top: 18%;
  font-size: min(27cqh, 14cqw); font-weight: 800; font-stretch: 100%; letter-spacing: -.005em;
}
.board.live .card.open:hover { transform: translateY(-3px); box-shadow: 0 1px 0 #fff8 inset, 0 3px 0 var(--paper-2), 0 14px 26px rgba(0,0,0,.45); }
.card.armed { box-shadow: 0 0 0 4px var(--team), 0 3px 0 var(--paper-2), 0 14px 30px rgba(0,0,0,.5); transform: translateY(-3px); }
.card .arm {
  position: absolute; left: 0; right: 0; bottom: 9%; text-align: center;
  font-size: min(10cqh, 6.4cqw); font-weight: 700; color: var(--team-deep); opacity: 0; transition: opacity .15s;
}
.card.armed .arm { opacity: 1; }
.card.armed .echo { opacity: 0; }

/* the agent tile that covers a revealed card */
.card .tile {
  position: absolute; inset: 0; border-radius: inherit; background: var(--fill); color: var(--fill-ink);
  display: grid; place-items: end start; padding: 10% 9%;
  animation: drop .42s cubic-bezier(.2,.9,.25,1.1) both;
}
.card .tile .tw { font-size: min(17cqh, 9.5cqw); font-weight: 700; font-stretch: 100%; opacity: .7; text-align: left; }
.card .tile .mark { position: absolute; top: 12%; right: 9%; width: 18cqh; height: 18cqh; }
.card.revealed { cursor: default; box-shadow: 0 6px 14px rgba(0,0,0,.3); }
.card.revealed::before { display: none; }
.card .tile.k-a { box-shadow: inset 0 0 0 3px var(--red); }
.card.just .tile { animation: drop .42s cubic-bezier(.2,.9,.25,1.1) both, flash 1.4s .35s ease-out both; }
@keyframes drop { from { transform: translateY(-14%) scale(1.06); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes flash { 0% { box-shadow: inset 0 0 0 0 #fff0, 0 0 0 0 #fff8; } 30% { box-shadow: inset 0 0 0 4px #fff9, 0 0 0 6px #fff4; } 100% { box-shadow: inset 0 0 0 0 #fff0, 0 0 0 0 #fff0; } }
.card .tile:not(.anim) { animation: none; }

/* after the game: the rest of the key shows through the paper */
.board.over .card.open { cursor: default; background: color-mix(in srgb, var(--fill) 30%, var(--paper)); }
.board.over .card.open.k-a { background: #4a4a4f; color: #f2ede4; }
.board.over .card.open::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8%; background: var(--fill); }

.bf { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.bf .room { display: flex; align-items: center; gap: 12px; }
.bf .leave { color: var(--mute); font-size: 15px; font-weight: 650; text-decoration: none; padding: 10px 4px 10px 0; }
.bf .leave:hover { color: var(--paper); }
.bf .code { font-size: 22px; font-weight: 800; font-stretch: 125%; color: var(--paper); }
.bf .presence { display: flex; gap: 14px; font-size: 14px; color: var(--mute); margin-left: 6px; }
.bf .presence span { display: inline-flex; align-items: center; gap: 6px; }
.bf .presence i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.bf .presence .on.r i { background: var(--red); }
.bf .presence .on.b i { background: var(--blue); }
.bf .presence .on { color: var(--paper); }
.bf .actions { margin-left: auto; display: flex; gap: 10px; }
.board.over #newBtn { background: var(--team); color: #fff; }

.board .toast { top: var(--toast-top, 120px); bottom: auto; transform: translate(-50%, -50%) translateY(-10px); font-size: 18px; padding: 12px 20px; }
.board .toast.on { transform: translate(-50%, -50%); }

/* join sheet */
.ov {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: rgba(10,10,12,.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .2s both;
}
@keyframes fade { from { opacity: 0; } }
.joincard {
  display: grid; grid-template-columns: auto 1fr; gap: 40px; align-items: center;
  background: var(--paper); color: var(--ink); border-radius: 24px; padding: 40px 44px; width: min(900px, 92vw);
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.joincard .qr { width: 280px; height: 280px; }
.joincard .qr img { width: 100%; height: 100%; display: block; }
.joincard h2 { font-size: 40px; font-weight: 850; font-stretch: 112%; line-height: 1; }
.joincard .url { margin-top: 12px; font-size: 16px; line-height: 1.4; color: #5d584e; font-weight: 550; overflow-wrap: anywhere; }
.joincard .url b { color: var(--ink); font-weight: 750; }
.joincard ol { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 14px; counter-reset: s; }
.joincard li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; font-size: 16px; line-height: 1.35; color: #3a3730; }
.joincard li::before { content: counter(s); font-weight: 850; font-stretch: 70%; font-size: 20px; color: var(--ink); line-height: 1.1; }
.joincard .seats { display: flex; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.seat { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 10px; background: var(--paper-2); font-size: 14px; font-weight: 650; color: #6c665a; }
.seat i { width: 10px; height: 10px; border-radius: 3px; background: #bdb4a0; }
.seat.on.r { background: var(--red); color: #fff; } .seat.on.b { background: var(--blue); color: #fff; }
.seat.on i { background: #fff; }
.joincard .go { margin-top: 26px; display: flex; gap: 10px; }
.joincard .btn { background: var(--ink); color: var(--paper); }

.cluebox { background: var(--paper); color: var(--ink); border-radius: 20px; padding: 28px; width: 420px; display: grid; gap: 16px; }
.cluebox h3 { font-size: 22px; font-weight: 800; font-stretch: 110%; }

/* ======================================================================
   PHONE
   ====================================================================== */
/* the document never scrolls (installed iOS apps mis-size a scrolling one); #app scrolls under a fixed header */
body.phone {
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior: none;
}
body.phone #app {
  position: fixed; inset: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(env(safe-area-inset-top) + 54px) calc(12px + env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 16px) calc(12px + env(safe-area-inset-left));
}
/* fixed, full-width and solid on purpose: iOS 26+ paints this colour behind the status bar instead of its glass blur */
.ph {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  height: calc(env(safe-area-inset-top) + 54px);
  padding: calc(env(safe-area-inset-top) + 10px) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
  background: var(--table);
  display: flex; align-items: center; gap: 10px;
}
.phone .conn { top: calc(env(safe-area-inset-top) + 60px); }
.ph .room { display: inline-flex; align-items: center; gap: 7px; height: 32px; border-radius: 9px; font-size: 17px; font-weight: 800; font-stretch: 125%; cursor: default; }
.ph .room svg { display: none; }
/* for the host the code is the button to the join QR */
.ph .room.host { padding: 0 11px; background: var(--table-3); cursor: pointer; }
.ph .room.host svg { display: block; color: var(--paper); }

/* the score every phone carries now that there may be no shared board */
.pscore { display: flex; justify-content: space-between; align-items: center; margin: 2px 0 4px; }
.ps { display: flex; align-items: center; gap: 8px; }
.ps.k-b { flex-direction: row-reverse; }
.ps b { min-width: 1ch; font-size: 26px; line-height: 1; font-weight: 850; font-stretch: 70%; font-variant-numeric: tabular-nums; text-align: center; color: var(--fill); }
.ps .pips { display: flex; gap: 3px; }
.ps .pips i { width: 6px; height: 13px; border-radius: 2px; background: var(--fill); transition: background .3s, box-shadow .3s; }
.ps .pips i.gone { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.ps em { font-style: normal; font-size: 12px; font-weight: 700; font-stretch: 112%; color: var(--mute); }
.ps.now em { color: var(--fill); }

/* host panel */
.hostsheet {
  position: fixed; inset: 0; z-index: 45; overflow-y: auto; overscroll-behavior: contain;
  background: var(--table);
  padding: calc(env(safe-area-inset-top) + 14px) calc(14px + env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + 16px) calc(14px + env(safe-area-inset-left));
  animation: fade .18s both;
}
.hs-in { max-width: 440px; margin: 0 auto; display: grid; gap: 12px; }
.hs-card { background: var(--paper); color: var(--ink); border-radius: 22px; padding: 24px 24px 16px; display: grid; justify-items: center; gap: 12px; }
.hs-qr { width: min(100%, 300px, 41vh); aspect-ratio: 1; }
.hs-qr img { width: 100%; height: 100%; display: block; }
.hs-say { width: 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.hs-say b { font-size: 26px; font-weight: 850; font-stretch: 112%; line-height: 1; }
.hs-code { font-size: 28px; font-weight: 850; font-stretch: 125%; line-height: 1; }
.hs-alt { width: 100%; font-size: 14px; line-height: 1.35; color: #5d584e; font-weight: 550; overflow-wrap: anywhere; }
.hs-alt b { color: var(--ink); font-weight: 750; }
.hs-seats { display: flex; flex-wrap: wrap; gap: 8px; }
.hostsheet .seat { background: var(--table-2); color: var(--mute); box-shadow: inset 0 0 0 1.5px var(--line); }
.hostsheet .seat i { background: var(--line); }
.hostsheet .seat.on { box-shadow: none; }
.hostsheet .seat.on i { background: #fff; }
.hs-acts { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.hs-acts .btn { height: 48px; padding: 0 8px; }
.hs-in > .btn.solid { height: 54px; font-size: 17px; }
/* End game: quiet until armed (then paper, like every two-tap button) — it ends the game on every phone */
.btn.ghost { background: transparent; color: var(--mute); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { background: var(--table-2); color: var(--paper); }
.btn.ghost.armed { background: var(--paper); color: var(--ink); box-shadow: none; }
.hs-in > .btn.ghost { height: 48px; margin-top: 4px; }
.ph .me { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 9px; background: var(--team); color: #fff; font-size: 14px; font-weight: 700; }
.ph .switch { margin-left: auto; height: 32px; padding: 0 12px; border-radius: 9px; background: var(--table-3); font-size: 14px; font-weight: 600; color: #cfc9bc; }
/* FR: this phone's cards in French — a quiet chip like Switch, paper when on */
.ph .lang { margin-left: auto; flex: none; height: 32px; padding: 0 11px; border-radius: 9px; background: var(--table-3); font-size: 14px; font-weight: 750; font-stretch: 112%; color: #cfc9bc; transition: background .15s, color .15s; }
.ph .lang.on { background: var(--paper); color: var(--ink); }
.ph .lang + .switch { margin-left: 0; }
/* narrower phones: the header makes room for FR without squeezing the seat chip onto two lines */
@media (max-width: 400px) {
  .ph:has(.lang) { gap: 8px; }
  .ph .lang { padding: 0 9px; }
  .ph .lang ~ .switch { padding: 0 10px; }
}
@media (max-width: 380px) {
  .ph:has(.lang) { gap: 5px; }
  .ph:has(.lang) .me { padding: 0 9px; }
  .ph:has(.lang) .room.host { padding: 0 8px; }
  .ph .lang { padding: 0 7px; }
  .ph .lang ~ .switch { padding: 0 8px; }
}
@media (max-width: 350px) {
  .ph:has(.lang) .room.host svg { display: none; }
  .ph .lang { padding: 0 6px; font-size: 13px; }
  .ph .lang ~ .switch { padding: 0 7px; font-size: 13px; }
}

/* role picker */
.pick { margin-top: 14px; }
.pick h1 { font-size: 30px; font-weight: 850; font-stretch: 112%; line-height: 1.05; }
.pick p { margin-top: 8px; color: #b9b3a6; font-size: 16px; line-height: 1.4; }
.pick .leave { display: block; width: fit-content; margin: 22px auto 0; padding: 10px 14px; color: var(--mute); font-size: 14px; font-weight: 600; text-decoration: none; }
.seats4 { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seats4 .col { display: grid; gap: 10px; }
.seats4 .col h2 { font-size: 15px; font-weight: 800; font-stretch: 118%; color: var(--team); padding: 0 4px; }
.role {
  text-align: left; border-radius: 16px; padding: 16px 14px; min-height: 132px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
  background: var(--table-2); box-shadow: inset 0 0 0 2px var(--line);
}
.role.spy { background: var(--team); box-shadow: none; color: #fff; }
.role b { font-size: 21px; font-weight: 800; font-stretch: 100%; line-height: 1.05; }
.role span { font-size: 14px; line-height: 1.3; opacity: .82; }
.role .cnt { font-size: 12px; font-weight: 650; opacity: .7; }
.role:active { transform: scale(.98); }

/* status block */
.pstat { margin: 8px 0 12px; min-height: 76px; display: grid; align-content: center; }
.pstat .big { font-size: 27px; font-weight: 850; font-stretch: 108%; line-height: 1.05; }
.pstat .big.team { color: var(--team); }
.pstat .small { margin-top: 6px; font-size: 15px; color: #b9b3a6; line-height: 1.35; }
.pstat .cluebig { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pstat .cluebig .cw { font-size: 30px; font-weight: 850; text-transform: uppercase; line-height: 1; }
.pstat .cluebig .cn { font-size: 30px; font-weight: 850; font-stretch: 80%; color: var(--clue-c, var(--team)); line-height: 1; }

.pgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.cell {
  position: relative; height: 54px; border-radius: 8px; min-width: 0; overflow: hidden;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
  background: var(--paper); color: var(--ink);
  transition: transform .1s, opacity .2s;
}
.cell .word { font-size: 12.5px; font-weight: 750; }
.cell:active { transform: scale(.95); }
.cell.k { background: var(--fill); color: var(--fill-ink); }
.cell.k-a.k { box-shadow: inset 0 0 0 2px var(--red); }
.spyview .cell.rev { opacity: .3; }
.spyview .cell.rev .word { text-decoration: line-through; text-decoration-thickness: 2px; }
.spyview .cell:not(.rev).mine { box-shadow: inset 0 0 0 2px #fff6; }
.opview .cell.rev { background: var(--fill); color: var(--fill-ink); }
.opview .cell.rev .word { opacity: .65; font-weight: 650; }
.opview .cell.rev.k-a { box-shadow: inset 0 0 0 2px var(--red); }
.cell.just { animation: pop .9s ease-out; }
@keyframes pop { 0% { transform: scale(1.12); } 100% { transform: none; } }
.over .opview .cell:not(.rev) { background: color-mix(in srgb, var(--fill) 35%, var(--paper)); }

.compose { margin-top: 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.compose input {
  width: 100%; min-width: 0; height: 54px; border-radius: 12px; border: 0; padding: 0 16px; background: var(--paper); color: var(--ink);
  font-size: 22px; font-weight: 800; text-transform: uppercase; outline: none;
  -webkit-user-select: text; user-select: text; /* the phone page is user-select none; a field must not inherit it */
}
.compose input::placeholder { color: #9b9483; font-weight: 600; text-transform: none; }
.nums { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.nums button { height: 42px; border-radius: 10px; background: var(--table-3); font-size: 20px; font-weight: 800; font-stretch: 85%; }
.nums button.on { background: var(--team); color: #fff; }
.compose .warn { color: #ffb79f; font-size: 14px; min-height: 18px; }
.compose .send { height: 54px; font-size: 17px; }

.left { margin-top: 18px; }
.left h3 { font-size: 13px; font-weight: 700; color: var(--mute); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { padding: 7px 10px; border-radius: 8px; background: var(--team); color: #fff; font-size: 13px; font-weight: 750; text-transform: uppercase; }
.chips span.ass { background: var(--void); box-shadow: inset 0 0 0 1.5px var(--red); }

.pfoot { margin-top: 16px; display: grid; gap: 10px; }
.pfoot .btn { height: 52px; font-size: 16px; }

/* the game screen is a column, so the notes can take whatever height is left under the controls */
body.phone #app.game { display: flex; flex-direction: column; }
#app.game > * { flex-shrink: 0; }
#app.game .pstat { margin-top: 4px; } /* block layout collapsed the score's 4px into this 8px; flex adds them */
.pfoot:empty { display: none; }

.notes { flex: 1 0 auto; min-height: 176px; margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.nh { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.nh h3 { font-size: 13px; font-weight: 700; color: var(--mute); }
.nhint { font-size: 12.5px; font-weight: 550; color: #6c6964; transition: color .2s; }
.writing .nhint { color: var(--paper); }
.nbtn { margin-left: auto; height: 28px; padding: 0 12px; border-radius: 8px; background: var(--table-3); color: #cfc9bc; font-size: 13px; font-weight: 650; }
.nbtn.armed { background: var(--paper); color: var(--ink); }
.writing .nbtn { background: var(--team); color: #fff; }

/* every clue so far, newest at the right edge; each small square is what one guess turned out to be */
.trail { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px; }
.trail::-webkit-scrollbar { display: none; }
.trail .tl { flex: none; margin-right: 2px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.tc {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 12px; border-radius: 8px;
  background: var(--table-2); box-shadow: inset 3px 0 0 var(--team), inset 0 0 0 1.5px var(--line);
}
.tc b { font-size: 13px; font-weight: 750; text-transform: uppercase; color: var(--paper); }
.tc em { font-style: normal; font-size: 16px; line-height: 1; font-weight: 850; font-stretch: 80%; color: var(--team); }
.tc i { width: 8px; height: 8px; border-radius: 2px; background: var(--fill); }
.tc em + i { margin-left: 3px; } /* the picks sit apart from the number */
.tc i.k-a { box-shadow: inset 0 0 0 1.5px var(--red); }
.tc.now { background: var(--table-3); box-shadow: inset 3px 0 0 var(--team), inset 0 0 0 1.5px var(--team); }

/* a ruled pad on the table; the rules scroll with the writing */
.pad {
  flex: 1 1 auto; display: block; width: 100%; min-height: 116px; margin: 0; padding: 4px 14px;
  resize: none; outline: none; border: 0; border-radius: 14px;
  background-color: var(--table-2);
  background-image: repeating-linear-gradient(to bottom, transparent 0 27px, rgba(239,233,220,.07) 27px 28px);
  background-attachment: local;
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--paper); caret-color: var(--team);
  font: 500 17px/28px 'Archivo', system-ui, sans-serif; font-stretch: 100%;
  -webkit-user-select: text; user-select: text;
  transition: box-shadow .2s;
}
.pad::placeholder { color: #75726c; }
.writing .pad { box-shadow: inset 0 0 0 2px var(--team); }
.cell.jot { animation: jot .45s ease-out; }
@keyframes jot { from { box-shadow: 0 0 0 3px var(--team); transform: scale(.94); } }

/* writing with the keyboard up (phone.js pins #app to what the keyboard leaves visible): header, board, notes — nothing else */
body.kb #app.game { padding-bottom: 8px; }
body.kb #pscore, body.kb #pstat, body.kb #left, body.kb #pfoot { display: none !important; }
body.kb:not(.kbclue) #compose { display: none !important; }
/* typing the clue (v1.7): header, board, clue box — the notes step aside instead */
body.kbclue .notes { display: none; }
body.kbclue .compose { margin-top: 12px; }
body.kb .cell { height: 46px; }
body.kb .notes { margin-top: 8px; min-height: 0; }
body.kb .pad { min-height: 56px; }
body.kbshort .cell { height: 40px; }
body.kbshort .trail { display: none; }

.sheet-bg { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); animation: fade .15s both; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  background: var(--table-2); border-radius: 22px 22px 0 0; padding: 22px 16px calc(env(safe-area-inset-bottom) + 16px);
  display: grid; gap: 12px; animation: up .22s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes up { from { transform: translateY(100%); } }
.sheet .sw { display: flex; padding-left: 14px; padding-right: 14px; font-size: 34px; font-weight: 850; text-transform: uppercase; text-align: center; padding: 18px 0 8px; background: var(--paper); color: var(--ink); border-radius: 14px; }
.sheet .sq { text-align: center; color: #b9b3a6; font-size: 15px; }
.sheet .btn { height: 56px; font-size: 17px; }

/* landing */
body.land { min-height: 100%; display: grid; place-items: center; padding: 24px; }
.again { display: grid; gap: 10px; }
.again .row { display: flex; gap: 8px; transition: opacity .17s, transform .17s; }
.again .row.out { opacity: 0; transform: translateX(16px); }
.again a {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 20px; border-radius: 16px;
  background: var(--table-2); box-shadow: inset 0 0 0 2px var(--team); color: var(--paper); text-decoration: none;
}
.again a:active { transform: scale(.99); }
.again b { font-size: 22px; font-weight: 800; font-stretch: 125%; }
.again span { font-size: 16px; font-weight: 600; color: #cfc9bc; line-height: 1.25; text-wrap: balance; }
.again i { margin-left: auto; font-style: normal; font-size: 22px; font-weight: 700; color: var(--team); }
/* ✕ beside a row: forget that game on this phone */
.again .x { flex: none; width: 52px; border-radius: 16px; background: var(--table-2); box-shadow: inset 0 0 0 2px var(--line); color: var(--mute); display: grid; place-items: center; }
@media (hover: hover) { .again .x:hover { color: var(--paper); } }
.again .x:active { transform: scale(.95); }
.again .x svg { display: block; }
.toast.act.on { pointer-events: auto; }
.toast .tu { margin-left: 16px; padding: 4px 2px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.lands p b { color: var(--paper); font-weight: 700; }
.hint { color: var(--mute); font-size: 14px; line-height: 1.4; text-align: center; }
.hint b { color: #cfc9bc; font-weight: 650; }
.landwrap { width: min(520px, 100%); display: grid; gap: 34px; }
.landwrap h1 { font-size: clamp(44px, 9vw, 92px); font-weight: 900; font-stretch: 125%; line-height: .9;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.landwrap h1 span { display: block; font-stretch: 62%; color: var(--red); }
.landwrap h1 span + span { color: var(--blue); }
.lands { display: grid; grid-template-columns: 1fr; gap: 14px; }
.lands > * { border-radius: 18px; padding: 22px; background: var(--table-2); box-shadow: inset 0 0 0 2px var(--line); display: grid; gap: 14px; align-content: start; }
.lands h2 { font-size: 20px; font-weight: 800; }
.lands p { color: #b9b3a6; font-size: 15px; line-height: 1.4; }
.lands input { height: 54px; border-radius: 12px; border: 0; background: var(--paper); color: var(--ink); text-align: center; font-size: 26px; font-weight: 850; font-stretch: 125%; text-transform: uppercase; outline: none; width: 100%; }
.lands .btn { height: 52px; }
.lands .warn { color: #ffb79f; font-size: 14px; line-height: 1.3; }
.lands .warn:empty { display: none; }
.lands .link { justify-self: center; padding: 4px 6px; color: var(--mute); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
/* every phone: its games, then Host a game, then Join a game (v1.8 — anyone can host) */
/* the old address: a paper card pointing to the new one */
.moved { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 14px; row-gap: 4px; padding: 18px 20px;
  border-radius: 18px; background: var(--paper); color: var(--ink); text-decoration: none; }
.moved b { font-size: 18px; font-weight: 800; line-height: 1.2; text-wrap: balance; }
.moved span { grid-column: 1; font-size: 15px; font-weight: 550; color: #4d483f; line-height: 1.35; }
.moved i { grid-column: 2; grid-row: 1 / span 2; font-style: normal; font-size: 24px; font-weight: 800; color: var(--red); }
.moved:active { transform: scale(.99); }
/* narrower phones: a tighter Rejoin row, so its label stays on one line wherever it can (two balanced lines where it can't) */
@media (max-width: 430px) {
  .again a { padding: 12px 16px; gap: 12px; }
  .again b { font-size: 20px; }
}
@media (max-width: 360px) {
  .again a { padding: 12px 14px; gap: 10px; }
  .again b { font-size: 18px; }
  .again i { display: none; } /* the bar is plainly the way in; the ✕ beside it is the other action */
  .again .x { width: 46px; }
}
