/* Buttons, the box lid, lobby, header chips, the card stack and dialogs. */

/* ---------- buttons ---------- */

.btn {
  --face: var(--cherry);
  --side: var(--cherry-dark);
  --text: #fff8ec;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 11px 20px;
  border: 0;
  border-radius: var(--radius);
  background: var(--face);
  color: var(--text);
  font-family: var(--display);
  font-stretch: 85%;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  box-shadow: 0 4px 0 var(--side), 0 8px 14px rgba(40, 20, 5, .25);
  transform: translateY(0);
  transition: transform .08s ease, box-shadow .08s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--side), 0 10px 16px rgba(40, 20, 5, .25); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--side), 0 3px 6px rgba(40, 20, 5, .25); }
.btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.btn:disabled {
  --face: #e3ddd3;
  --side: #c6bdb0;
  --text: #958a7c;
  cursor: default;
  transform: none;
  box-shadow: 0 4px 0 var(--side);
}
.btn-secondary { --face: var(--navy); --side: var(--navy-dark); }
.btn-quiet { --face: var(--quiet); --side: var(--dash); --text: var(--ink); box-shadow: 0 4px 0 var(--side); }
.btn-wide { width: 100%; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.link-btn {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 600;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--ink); }

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--card-edge), 0 6px 12px rgba(30, 14, 4, .35);
  transition: transform .08s, box-shadow .08s;
}
.icon-btn:hover { transform: translateY(-1px); }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--card-edge), 0 2px 4px rgba(30, 14, 4, .35); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .dot { fill: currentColor; }

/* ---------- start screen: the box lid ---------- */

.start-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 16px 48px;
}

.lid {
  position: relative;
  width: min(1040px, 100%);
  overflow: hidden;
  border-radius: 6px;
  box-shadow: var(--box-shadow);
}

.lid-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px 32px;
  flex-wrap: wrap;
  padding: 40px 44px 26px;
}
.lid-title { display: flex; flex-direction: column; gap: 12px; }
.lid-sub {
  margin: 0;
  font-family: var(--mono);
  font-weight: 500;
  font-size: .95rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* the little printed fact box: 2 players, 480 squares, 3 clues */
.lid-facts {
  display: grid;
  grid-template-columns: repeat(3, auto);
  border: 2px solid var(--ink);
  border-radius: 4px;
  text-align: center;
}
.lid-facts div { display: flex; flex-direction: column; gap: 2px; padding: 10px 16px; }
.lid-facts div + div { border-left: 2px solid var(--ink); }
.lid-facts .num { font-weight: 700; font-size: 1.4rem; line-height: 1.2; }
.lid-facts .caps { font-size: .62rem; }

.lid-strip {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  height: 22px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}

.lid-body { display: grid; grid-template-columns: 1.3fr 1fr; }
.lid-section { padding: 28px 36px 32px 44px; display: flex; flex-direction: column; }
.lid-join {
  padding: 28px 44px 32px 36px;
  background: var(--card-alt);
  border-left: 2px dashed var(--dash);
}
.lid-join .btn { margin-top: auto; }
.lid-note { margin: -4px 0 16px; color: var(--ink-soft); font-size: .95rem; line-height: 1.45; }

.lid-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 44px;
  border-top: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lid-foot .link-btn { color: var(--ink); font-weight: 700; font-size: .75rem; }

.modes { display: grid; gap: 8px; margin-bottom: 16px; }
.mode { display: block; cursor: pointer; }
.mode input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mode-card {
  position: relative;
  display: block;
  padding: 11px 14px 11px 44px;
  border: 2px solid var(--card-line);
  border-radius: var(--radius);
  background: var(--card-hi);
  transition: border-color .15s, transform .1s, box-shadow .15s;
}
.mode-card::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 14px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--ink-soft);
  background: var(--card-hi);
}
.mode:hover .mode-card { transform: translateY(-1px); border-color: var(--dash); }
.mode input:checked + .mode-card { border-color: var(--cherry); box-shadow: 0 3px 0 rgba(126, 38, 32, .35); }
.mode input:checked + .mode-card::before { border-color: var(--cherry-dark); background: var(--cherry); box-shadow: inset 0 0 0 3px var(--card-hi); }
.mode input:focus-visible + .mode-card { outline: 3px solid var(--navy); outline-offset: 2px; }
.mode-title { display: block; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.mode-line { display: block; color: var(--ink-soft); font-size: .88rem; line-height: 1.3; }

/* name fields and "play to" share one row; a hidden field takes no space */
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 14px; align-items: end; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; margin-bottom: 5px; }
.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid var(--field-line);
  border-radius: var(--radius);
  background: var(--card-hi);
  font-weight: 600;
  font-size: 1rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: #c5b08c; font-weight: 600; }
.field input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(47, 76, 128, .2); }

/* Room code: one real input over four printed boxes. Mono letters are 0.6em
   wide, so the spacing below lands each letter in the middle of a box.
   Browsers add that spacing after the last letter too, which makes four
   letters wider than the boxes; the input is one tile wider so it never
   scrolls sideways, and the box clips the spare width. "clip", unlike
   "hidden", can't be scrolled to follow the caret; "hidden" is the fallback. */
.code-box { --tile: 64px; --tile-gap: 8px; --char: 15.6px; position: relative; display: block; width: calc(var(--tile) * 4 + var(--tile-gap) * 3); height: 52px; overflow: hidden; overflow: clip; }
.code-box .tiles { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--tile-gap); pointer-events: none; }
.code-box .tiles i { border: 2px solid var(--field-line); border-radius: var(--radius); background: var(--card-hi); transition: border-color .15s, box-shadow .15s; }
.code-box:focus-within .tiles i { border-color: var(--navy); box-shadow: inset 0 0 0 3px rgba(47, 76, 128, .2); } /* inset: the box clips outer glows */
.field .code-input {
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(100% + var(--tile));
  height: 100%;
  min-height: 0;
  padding: 0 0 0 calc((var(--tile) - var(--char)) / 2);
  border: 0;
  background: transparent;
  box-shadow: none !important;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: calc(var(--tile) + var(--tile-gap) - var(--char));
  text-transform: uppercase;
}

/* segmented "play to" control: three joined boxes */
.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg label { cursor: pointer; }
.seg label + label span { border-left: 2px solid var(--ink); }
.seg input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; pointer-events: none; }
.seg span {
  display: block;
  text-align: center;
  padding: 8px 0;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.1rem;
  transition: background .1s, color .1s;
}
.seg label:hover span { background: var(--card-alt); }
.seg input:checked + span { background: var(--ink); color: var(--card); }
.seg input:focus-visible + span { outline: 3px solid var(--navy); outline-offset: -3px; }

.form-msg { min-height: 1.4em; margin: 0 0 10px; color: var(--cherry); font-weight: 700; font-size: .95rem; }

/* ---------- lobby ---------- */

.lobby-card { width: min(640px, 100%); }
.lobby-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 36px;
  border-bottom: 2px solid var(--ink);
}
.lobby-head .logo { font-size: 2.1rem; line-height: 1; }
.lobby-body { padding: 26px 36px 30px; display: flex; flex-direction: column; gap: 18px; }
.lobby-body p { margin: 0; line-height: 1.45; }
.lobby-body .link-btn { align-self: flex-start; }
.code-tiles { display: flex; gap: 12px; margin-top: -10px; }
.code-tiles span {
  width: 84px;
  height: 92px;
  display: grid;
  place-items: center;
  font-stretch: 75%;
  font-weight: 900;
  font-size: 3.6rem;
  background: var(--card-hi);
  border: 2px solid var(--ink);
  border-radius: 6px;
  box-shadow: 0 5px 0 var(--ink);
}
.join-link { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.join-link code {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--card-alt);
  border: 1.5px dashed var(--dash);
  font-family: var(--mono);
  font-weight: 500;
  font-size: .82rem;
  word-break: break-all;
}
.join-link .btn { min-height: 46px; padding: 0 16px; font-size: .95rem; }
.slots { list-style: none; margin: 0; padding: 0; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.slots li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.slots li + li { border-top: 2px dashed var(--dash); }
.slots li.in { background: var(--card-hi); }
.slots .who { font-weight: 700; }
.slots li:not(.in) .who { color: var(--ink-soft); }
.slots .state { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.peg-inline { flex: none; width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .25); }
.slots li:not(.in) .peg-inline { background: transparent !important; border: 2px dashed var(--pc); box-shadow: none; }

/* ---------- game screen header ---------- */

.game-screen { min-height: 100vh; display: flex; flex-direction: column; }

.topbar { display: flex; align-items: center; gap: 20px; padding: 18px 22px 14px; }
.brand { display: flex; align-items: center; gap: 12px; }
.room-tag {
  font-family: var(--mono);
  font-weight: 600;
  font-size: .69rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--on-wood);
  border: 1.5px solid rgba(243, 223, 192, .55);
  border-radius: 3px;
  padding: 3px 7px;
}
.chips { display: flex; gap: 12px; margin-left: 12px; flex-wrap: wrap; }
.tools { margin-left: auto; display: flex; gap: 10px; }

/* score chip: player colour bar, name and role, score after a dashed rule */
.chip {
  display: flex;
  align-items: stretch;
  min-width: 200px;
  overflow: hidden;
  box-shadow: 0 3px 0 var(--card-edge), 0 8px 14px rgba(30, 14, 4, .35);
}
.chip .peg { flex: none; width: 8px; }
.chip .meta { display: flex; flex-direction: column; justify-content: center; padding: 7px 12px; line-height: 1.2; min-width: 0; }
.chip .name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.chip .name small { font-weight: 500; color: var(--ink-soft); margin-left: 4px; }
.chip .role { font-size: .62rem; letter-spacing: .1em; }
.chip .score {
  margin-left: auto;
  min-width: 58px;
  display: grid;
  place-items: center;
  border-left: 2px dashed var(--card-line);
  font-weight: 600;
  font-size: 1.6rem;
}
.chip .score.bump { animation: bump .22s ease-out; }
.chip.off { opacity: .55; }

.tabletop {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 26px;
  align-items: start;
  padding: 8px 22px 30px;
}

/* ---------- card stack ---------- */

.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card { padding: 18px 20px; }
.card h3 {
  margin: 0 0 8px;
  font-stretch: 75%;
  font-weight: 800;
  font-size: 1.6rem;
  line-height: 1.05;
  text-transform: uppercase;
}
.card p { margin: 0 0 10px; line-height: 1.45; }
.card p:last-child { margin-bottom: 0; }
.card .muted { color: var(--ink-soft); font-size: .95rem; }
.card .btn + .btn { margin-top: 12px; }

.round-card { display: flex; align-items: stretch; padding: 0; overflow: hidden; }
.round-no {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--card);
  font-family: var(--mono);
}
.round-no span { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.round-no b { font-size: 1.6rem; line-height: 1; }
.round-card .who-line { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 10px 14px; font-size: .95rem; line-height: 1.3; color: var(--ink-soft); }
.round-card .who-line b { color: var(--ink); }

/* clues: playing cards with a double printed border */
.clues { display: flex; flex-direction: column; gap: 10px; }
.clue {
  position: relative;
  padding: 12px 16px 14px 52px;
  background: var(--card-hi);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1.5px var(--ink), inset 0 0 0 5px var(--card-hi), inset 0 0 0 6px var(--card-line), 0 2px 0 var(--card-edge), 0 7px 14px rgba(30, 14, 4, .3);
}
.clue .clue-n { position: absolute; left: 18px; top: 13px; font-weight: 700; font-size: 1.4rem; line-height: 1; }
.clue .label { display: block; font-size: .62rem; }
.clue .text { display: block; font-weight: 700; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.01em; overflow-wrap: anywhere; }
.clue.fresh { animation: slide-in .55s cubic-bezier(.25, 1.25, .5, 1) both; }
.clue.empty {
  padding: 16px;
  background: transparent;
  box-shadow: none;
  border: 2px dashed rgba(251, 243, 225, .4);
  color: rgba(251, 243, 225, .75);
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* the four colour cards to pick from */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.option {
  border: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  background: var(--card-hi);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1.5px var(--card-line), 0 3px 0 var(--card-edge);
  transition: transform .12s, box-shadow .12s;
}
.option:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1.5px var(--card-line), 0 6px 0 var(--card-edge), 0 10px 14px rgba(30, 14, 4, .2); }
.option:active { transform: translateY(2px); box-shadow: inset 0 0 0 1.5px var(--card-line), 0 1px 0 var(--card-edge); }
.option .sw { display: block; height: 66px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.option .co { display: flex; justify-content: space-between; padding: 0 4px 2px; font-family: var(--mono); font-weight: 700; font-size: .9rem; }
.option .co span { color: var(--ink-faint); }
.options.dealt .option { animation: deal .38s cubic-bezier(.3, 1.3, .5, 1) both; }
.options.dealt .option:nth-child(2) { animation-delay: .05s; }
.options.dealt .option:nth-child(3) { animation-delay: .1s; }
.options.dealt .option:nth-child(4) { animation-delay: .15s; }
.redraw { margin-top: 16px; }

.secret-card { display: flex; gap: 14px; align-items: center; padding: 12px; }
.secret-card .sw { flex: none; width: 76px; height: 76px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.secret-card .co { font-family: var(--mono); font-weight: 700; font-size: 1.9rem; line-height: 1; }
.secret-card .muted { font-size: .88rem; margin: 4px 0 0; line-height: 1.35; }

.clue-form .field { margin-bottom: 6px; }
.clue-form .field-label { font-family: var(--display); font-size: .88rem; font-weight: 400; letter-spacing: 0; text-transform: none; margin-bottom: 6px; }
.clue-form input { font-size: 1.25rem; min-height: 48px; }
.clue-count { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: .69rem; letter-spacing: .08em; }
.err { min-height: 1.3em; color: var(--cherry); font-weight: 700; font-size: .92rem; margin: 0 0 8px; }
.err:empty { min-height: 0; margin: 0; }
.err.shake { animation: shake .42s; }

/* .card prefix so the generic .card p line height doesn't win */
.card .headline { margin: 0 0 12px; font-stretch: 62%; font-weight: 900; font-size: 3.5rem; line-height: .9; text-transform: uppercase; }
.reveal-target { display: flex; gap: 12px; align-items: center; margin: 0 0 12px; }
.reveal-target .sw { width: 44px; height: 44px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.reveal-target b { font-family: var(--mono); font-size: 1.25rem; }

.guess-list { list-style: none; margin: 12px 0 0; padding: 0; }
.guess-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1.5px dashed var(--card-line); font-weight: 600; font-size: .95rem; color: var(--ink-soft); }
.guess-list li.best { font-weight: 700; color: var(--ink); }
.guess-list .sw { flex: none; width: 20px; height: 20px; border-radius: 3px; }
.guess-list li.best .sw { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--gold); }
.guess-list .co { font-family: var(--mono); font-weight: 700; color: var(--ink); }
.guess-list .pts { margin-left: auto; font-family: var(--mono); font-size: .8rem; }
.guess-list li.best .pts { padding: 2px 6px; border-radius: 3px; background: var(--ink); color: var(--card); }

.wait { display: flex; align-items: baseline; gap: 2px; font-stretch: 75%; font-weight: 800; font-size: 1.3rem; text-transform: uppercase; line-height: 1.1; }
.dots { display: inline-flex; gap: 4px; margin-left: 8px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-soft); animation: dot 1.5s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .25s; }
.dots i:nth-child(3) { animation-delay: .5s; }

/* ---------- phone hand view (table mode) ---------- */

.game-screen.hand .board-col { display: none; }
.game-screen.hand .tabletop { grid-template-columns: minmax(0, 1fr); max-width: 560px; width: 100%; margin: 0 auto; }
.game-screen.hand .stack { font-size: 1.08rem; }
.game-screen.hand .card h3 { font-size: 1.9rem; }
.game-screen.hand .clue .text { font-size: 1.9rem; }
.game-screen.hand .option .sw { height: 110px; }
.game-screen.hand .secret-card .sw { width: 120px; height: 120px; }
.game-screen.hand .btn { min-height: 56px; font-size: 1.1rem; }
.card .big-note { margin: 0; font-stretch: 75%; font-weight: 800; font-size: 1.9rem; line-height: 1.05; text-transform: uppercase; }

/* ---------- overlays and dialogs ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px 16px;
  background: rgba(28, 13, 4, .62);
  overflow-y: auto;
  animation: fade .2s ease both;
}
.overlay.opaque { background-color: var(--wood); background-image: var(--table); }

.dialog {
  width: min(460px, 100%);
  padding: 28px 30px;
  border-radius: 6px;
  box-shadow: 0 4px 0 var(--card-edge), 0 11px 0 #b3925f, 0 28px 44px rgba(20, 8, 2, .5);
  animation: pop-in .35s cubic-bezier(.3, 1.35, .5, 1) both;
}
.dialog h2 { margin: 0 0 12px; font-stretch: 62%; font-weight: 900; font-size: 3rem; line-height: .9; text-transform: uppercase; }
.dialog p { margin: 0 0 16px; }
.dialog .btn { margin-top: 6px; }
.dialog .crown { width: 48px; height: 48px; fill: none; stroke: var(--gold); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.dialog .link-btn { margin-top: 12px; }

/* dialogs built from ruled sections, like a printed rule sheet */
.dialog.ruled { padding: 0; overflow: hidden; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 24px 32px 18px; border-bottom: 2px solid var(--ink); }
.dialog-head h2 { margin: 0; font-size: 3.4rem; }
.dialog-foot { padding: 16px 32px 20px; border-top: 2px solid var(--ink); }

.rules { width: min(820px, 100%); }
.rules-body { display: grid; grid-template-columns: 1.25fr 1fr; }
.rules-steps { margin: 0; padding: 22px 28px 24px 32px; list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: .95rem; line-height: 1.45; }
.rules-steps li { display: flex; gap: 14px; }
.rules-steps .step { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 50%; font-weight: 700; font-size: .75rem; }
.rules-side { padding: 22px 32px 24px 28px; border-left: 2px dashed var(--dash); background: var(--card-alt); display: flex; flex-direction: column; gap: 12px; }
.rules-side h3 { margin: 0; font-stretch: 75%; font-weight: 800; font-size: 1.1rem; text-transform: uppercase; }
.rules-side p { margin: 0; font-size: .82rem; line-height: 1.45; }
.points-table { border: 2px solid var(--ink); border-radius: 4px; overflow: hidden; background: var(--card-hi); font-size: .88rem; }
.points-table div { display: flex; justify-content: space-between; padding: 7px 12px; }
.points-table div + div { border-top: 1.5px dashed var(--card-line); }

.winner { width: min(500px, 100%); text-align: center; }
.winner-top { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 32px 22px; }
.winner-top h2 { margin: 0; font-size: 4.5rem; }
.winner-scores { display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.winner-scores div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px; }
.winner-scores div + div { border-left: 2px solid var(--ink); }
.winner-scores .num { font-weight: 700; font-size: 2.75rem; line-height: 1; }
.winner-scores .lead { background: var(--pc); color: var(--card); }
.winner-scores .lead .caps { color: var(--card); }
.winner-foot { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 32px 24px; }
.winner-foot p { margin: 0; font-size: .8rem; letter-spacing: .08em; }
.winner-foot .link-btn { margin-top: 0; }

.dialog.pass { text-align: left; }

.banner {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 45;
  transform: translateX(-50%);
  padding: 9px 18px;
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--cherry);
  color: #fff8ec;
  font-family: var(--mono);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 4px 0 var(--cherry-dark), 0 10px 18px rgba(0, 0, 0, .3);
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 46;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(440px, calc(100% - 32px));
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--ink), 0 3px 0 var(--card-edge), 0 10px 20px rgba(0, 0, 0, .35);
  font-weight: 600;
  animation: toast-in .3s cubic-bezier(.3, 1.3, .5, 1) both;
}
.toast.out { animation: fade-out .3s ease both; }

.confetti { position: fixed; inset: 0; z-index: 48; pointer-events: none; width: 100%; height: 100%; }

/* ---------- smaller screens ---------- */

@media (max-width: 900px) {
  .tabletop { grid-template-columns: minmax(0, 1fr); padding: 6px 16px 28px; }
  .topbar { flex-wrap: wrap; padding: 12px 16px 8px; gap: 10px 12px; }
  .chips { order: 3; margin-left: 0; width: 100%; }
  .chip { flex: 1; min-width: 0; }
  .lid-body { grid-template-columns: 1fr; }
  .lid-join { border-left: 0; border-top: 2px dashed var(--dash); }
  .rules-body { grid-template-columns: 1fr; }
  .rules-side { border-left: 0; border-top: 2px dashed var(--dash); }
}

@media (max-width: 560px) {
  .has-room .lid-join { order: -1; border-top: 0; border-bottom: 2px dashed var(--dash); }
  .lid-top { padding: 28px 20px 20px; }
  .lid-section, .lid-join { padding: 22px 20px 24px; }
  .lid-foot { padding: 10px 20px; }
  .lid-facts div { padding: 8px 12px; }
  .lobby-head, .lobby-body { padding-left: 20px; padding-right: 20px; }
  .code-tiles span { width: 64px; height: 72px; font-size: 2.8rem; }
  .headline { font-size: 3rem; }
  .chip .name { max-width: 90px; }
  .dialog-head, .dialog-foot { padding-left: 20px; padding-right: 20px; }
  .dialog-head h2 { font-size: 2.6rem; }
  .winner-top h2 { font-size: 3.4rem; }
  .rules-steps, .rules-side { padding-left: 20px; padding-right: 20px; }
}
