/* ==========================================================================
   Multiplayer lobby styles. Everything is prefixed "mp-" so it cannot clash
   with the puzzle component (which uses "dp-"). Same palette and fonts.
   ========================================================================== */

/* One radius scale shared with css/dragon-puzzle.css: sm = tags, md = inputs and rows,
   lg = cards and panels, pill = buttons and chips. */
:root {
  --mp-r-sm: 10px;
  --mp-r-md: 14px;
  --mp-r-lg: 20px;
  --mp-r-pill: 999px;
  --mp-line: rgba(var(--wash-6), 0.2);
  --mp-surface: rgba(var(--surf-38), 0.78);
  --mp-shadow-soft: 0 6px 20px rgba(var(--shade-1), calc(0.32 * var(--shade-k)));
}

/* The entry button above the puzzle picker (solo page) */
.mp-bar { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 14px 12px 0; }

.mp-open,
.mp .mp-btn {
  appearance: none;
  min-height: 44px;
  padding: 0.55rem 1.3rem;
  border-radius: var(--mp-r-pill);
  border: 1px solid rgba(var(--wash-6), 0.28);
  background: rgba(var(--surf-51), 0.72);
  color: rgb(var(--txt-30));
  font: 500 0.95rem/1.2 "Nunito", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.mp-open { border-color: rgba(var(--cy-line-2), 0.45); }
.mp-open:hover,
.mp .mp-btn:hover:not(:disabled) { border-color: rgba(var(--wash-11), 0.55); background: rgba(var(--surf-69), 0.9); }

.mp-open:focus-visible,
.mp .mp-btn:focus-visible,
.mp .mp-input:focus-visible,
.mp .mp-head:focus-visible {
  outline: 2px solid rgb(var(--focus-1));
  outline-offset: 2px;
}

.mp .mp-btn:disabled { opacity: 0.55; cursor: progress; }

/* the main action: one solid ember fill, no gradient */
.mp .mp-btn--primary {
  border-color: rgba(var(--pri-line-1), 0.45);
  background: rgb(var(--pri-fill-2));
  color: rgb(var(--onfill-4));
  font-weight: 600;
}
.mp .mp-btn--primary:hover:not(:disabled) { background: rgb(var(--pri-fill-4)); border-color: rgba(var(--pri-line-1), 0.75); box-shadow: 0 4px 16px rgba(var(--pri-glow-1), 0.35); }

.mp .mp-btn--quiet { background: transparent; border-color: transparent; color: rgb(var(--txt-12)); text-decoration: underline; padding-inline: 0.7rem; }
.mp .mp-btn--quiet:hover:not(:disabled) { color: rgb(var(--txt-30)); border-color: transparent; }

/* The multiplayer screen */
.mp {
  box-sizing: border-box;
  width: 100%;
  padding: clamp(18px, 3.4vw, 44px);
  border-radius: var(--mp-r-lg);
  color: rgb(var(--txt-30));
  font-family: "Nunito", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(120% 70% at 72% -12%, rgba(var(--wash-2), 0.3), transparent 62%),
    radial-gradient(90% 60% at 6% 108%, rgba(var(--cy-wash-3), 0.26), transparent 62%),
    linear-gradient(180deg, rgb(var(--surf-17)) 0%, rgb(var(--surf-7)) 100%);
}
.mp[hidden] { display: none; }
.mp *, .mp *::before, .mp *::after { box-sizing: border-box; }

.mp-wrap { max-width: 46rem; margin: 0 auto; }

.mp-title {
  margin: 0;
  font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: 0.015em;
  color: rgb(var(--txt-39));
  text-shadow: 0 2px 30px rgba(var(--shade-1), calc(0.8 * var(--shade-k)));
}
.mp-sub { margin: 0.6rem 0 0; color: rgb(var(--txt-12)); max-width: 34rem; }
.mp-head { outline: none; }

/* messages */
.mp-notice { margin: 1.1rem 0 0; min-height: 0; }
.mp-notice:empty { display: none; }
.mp-notice p {
  margin: 0;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(var(--cy-line-2), 0.28);
  border-radius: var(--mp-r-md);
  background: rgba(var(--cy-wash-10), 0.08);
  color: rgb(var(--txt-34));
}
.mp-notice p.is-error { border-color: rgba(var(--cy-line-3), 0.45); background: rgba(var(--cy-wash-8), 0.14); color: rgb(var(--red-text-11)); }

/* cards */
.mp-grid { display: grid; gap: 16px; margin-top: 1.4rem; grid-template-columns: 1fr; }
.mp-card {
  padding: clamp(16px, 2.4vw, 22px);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-r-lg);
  background: var(--mp-surface);
  box-shadow: var(--mp-shadow-soft);
}
.mp-card h2, .mp-card h3 {
  margin: 0 0 0.7rem;
  font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 500;
  font-size: 1.5rem;
  color: rgb(var(--txt-39));
}
.mp-label { display: block; margin: 0 0 0.35rem; color: rgb(var(--txt-12)); font-size: 0.9rem; letter-spacing: 0.03em; }
.mp-input {
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  border-radius: var(--mp-r-md);
  border: 1px solid rgba(var(--wash-6), 0.3);
  background: rgba(var(--surf-1), 0.55);
  color: rgb(var(--txt-44));
  font: inherit;
  font-size: 1.05rem;
}
.mp-input--code { text-transform: uppercase; letter-spacing: 0.35em; text-align: center; font-size: 1.3rem; }
.mp-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0.9rem; align-items: center; }
.mp-help { margin: 0.5rem 0 0; color: rgb(var(--txt-12)); font-size: 0.9rem; }

/* puzzle choice buttons */
.mp-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.mp-choices .mp-btn { padding-inline: 0.9rem; }
.mp .mp-btn[aria-pressed="true"],
.mp .mp-btn[aria-pressed="true"]:hover:not(:disabled) { border-color: rgba(var(--cy-line-3), 0.6); background: rgba(var(--cy-wash-8), 0.2); color: rgb(var(--txt-44)); }

/* room screen: the code and its Copy button share one slim, inset panel */
.mp-code-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 6px 6px 6px 16px; max-width: 26rem;
  border: 1px solid rgba(var(--wash-8), 0.2); border-radius: 14px;
  background: linear-gradient(180deg, rgba(var(--surf-3), 0.72), rgba(var(--surf-21), 0.6));
  box-shadow: inset 0 1px 0 rgba(var(--hi-4), calc(0.04 * var(--hi-k))), 0 6px 18px rgba(var(--shade-1), calc(0.3 * var(--shade-k)));
}
.mp-code {
  margin: 0; min-width: 0;
  font-family: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 700;
  font-size: clamp(1.45rem, 5.4vw, 1.85rem);
  line-height: 1.1;
  letter-spacing: 0.2em;
  font-variant-numeric: lining-nums tabular-nums;
  color: rgb(var(--txt-44));
  text-shadow: 0 0 18px rgba(var(--cy-glow-12), 0.28);
  user-select: all;
}
.mp .mp-code-box .mp-copy {
  flex: none; width: auto; min-height: 36px; padding: 0 0.85rem; border-radius: 10px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; color: rgb(var(--cy-text-15));
  border-color: rgba(var(--cy-line-4), 0.3); background: rgba(var(--cy-wash-12), 0.07);
}
.mp .mp-code-box .mp-copy:hover:not(:disabled):not(.is-copied) { border-color: rgba(var(--cy-line-4), 0.55); background: rgba(var(--cy-wash-12), 0.13); color: rgb(var(--txt-46)); }
.mp .mp-code-box .mp-copy-face { gap: 0.4rem; }
.mp .mp-code-box .mp-copy-icon svg { width: 14px; height: 14px; }
.mp-meta { margin: 0.4rem 0 0; color: rgb(var(--txt-12)); }
.mp-meta strong { color: rgb(var(--txt-34)); font-weight: 500; }

.mp-players { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mp-players li {
  display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap;   /* the tags drop under a name instead of squeezing it */
  min-height: 44px; padding: 0.4rem 0.85rem;
  border: 1px solid rgba(var(--wash-6), 0.16);
  border-radius: var(--mp-r-md);
  background: rgba(var(--surf-1), 0.4);
}
.mp-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: rgb(var(--surf-80)); box-shadow: inset 0 0 0 1px rgba(var(--hi-1), calc(0.5 * var(--hi-k))); }
.mp-dot.is-on { background: rgb(var(--green-3)); box-shadow: 0 0 0 3px rgba(var(--green-3), 0.16); }
.mp-pname { flex: 1 1 5rem; min-width: 0; overflow-wrap: break-word; color: rgb(var(--txt-39)); }
.mp-pname.is-off { color: rgb(var(--txt-12)); }
.mp-tag {
  flex: none; padding: 0.1rem 0.6rem; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid rgba(var(--cy-line-2), 0.4); border-radius: var(--mp-r-pill); color: rgb(var(--cy-text-5));
}
.mp-tag--host { border-color: rgba(var(--cy-line-3), 0.55); color: rgb(var(--red-text-2)); }
.mp-warn { margin: 0.9rem 0 0; color: rgb(var(--gold-text-8)); font-size: 0.95rem; }
.mp-status { margin: 0.9rem 0 0; color: rgb(var(--txt-12)); font-size: 0.9rem; }
.mp-soon { margin: 1.2rem 0 0; padding: 0.8rem 1rem; border: 1px dashed rgba(var(--wash-6), 0.3); border-radius: var(--mp-r-md); color: rgb(var(--txt-12)); }

.mp-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 760px) {
  .mp-grid--two { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .mp .mp-btn { width: 100%; }
  .mp-choices .mp-btn { width: auto; flex: 1 1 100%; }
  .mp .mp-btn--quiet { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .mp * { transition: none !important; animation: none !important; }
}

/* ---------- Stage 4: the shared board inside a room ---------- */
.mp-board { margin-top: 16px; }
.mp-board .dragon-puzzle { border-radius: var(--mp-r-lg); }

/* Shared board: the same toolbar as the solo page (the .has-toolbar rules in css/dragon-puzzle.css). Shuffle carries the hidden
   attribute for everyone except the host (js/dragon-puzzle.js, _syncNetUi), and the shared board has no solo "best" time. */
.dragon-puzzle .dp-btn--tool[hidden] { display: none !important; }

/* Shared board: the progress count is a small, quiet element (the solo page keeps its large number). */
.dragon-puzzle.is-net .dp-progress {
  align-self: flex-start; box-sizing: border-box; width: min(100%, 13rem);
  padding: 9px 12px 11px; border: 1px solid rgba(var(--wash-8), 0.16); border-radius: 12px;
  background: rgba(var(--wash-14), 0.03);
}
.dragon-puzzle.is-net .dp-count { display: flex; align-items: baseline; gap: 0.35rem; margin: 0 0 7px; font: 500 0.78rem/1.2 var(--dp-sans); color: rgb(var(--txt-19)); }
.dragon-puzzle.is-net .dp-count-num { font: 600 1.05rem/1 var(--dp-sans); letter-spacing: 0; color: rgb(var(--txt-42)); font-variant-numeric: tabular-nums; }
.dragon-puzzle.is-net .dp-bar { height: 3px; }
/* narrow layouts (phones, tablets): one slim row, number then bar */
.dragon-puzzle.is-narrow.is-net .dp-progress { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; }
.dragon-puzzle.is-narrow.is-net .dp-count { margin: 0; flex: 0 0 auto; white-space: nowrap; }
.dragon-puzzle.is-narrow.is-net .dp-count-num, .dragon-puzzle.is-fs.is-net .dp-count-num { font-size: 1.05rem; }
.dragon-puzzle.is-narrow.is-net .dp-bar { flex: 1 1 auto; min-width: 40px; grid-column: auto; }
/* in full screen the slim top bar already shows the progress: no box around it */
.dragon-puzzle.is-fs.is-net .dp-progress { width: auto; padding: 0; border: 0; background: none; }

/* A piece another player just moved: a short blue glow (the red glow is for pieces that lock) */
.dragon-puzzle .dp-piece.is-remote { animation: mp-remote 1.2s ease-out; }
@keyframes mp-remote {
  0%   { filter: brightness(1.7) saturate(1.2) drop-shadow(0 0 14px rgba(var(--cy-glow-11), 0.95)); }
  100% { filter: brightness(0.84) drop-shadow(0 2px 3px rgba(var(--shade-1), calc(0.6 * var(--shade-k)))); }
}

/* Host controls */
.mp-host { margin-top: 16px; }
.mp-select {
  box-sizing: border-box; min-height: 44px; max-width: 100%;
  padding: 0.5rem 0.9rem; border-radius: var(--mp-r-md);
  border: 1px solid rgba(var(--wash-6), 0.3); background: rgba(var(--surf-51), 0.85);
  color: rgb(var(--txt-39)); font: inherit;
}
.mp-select:focus-visible { outline: 2px solid rgb(var(--focus-1)); outline-offset: 2px; }
.mp .mp-btn:disabled, .mp .mp-select:disabled { opacity: 0.55; cursor: progress; }

/* ---------- Player badges: glass pill with a coloured dot and P1..P4, bottom-right of a piece ---------- */
/* One muted palette for the whole interface (piece badges and the player list). The text
   always says the player number too, so colour is never the only clue. */
.mp-seat-1, .dragon-puzzle .dp-piece[data-seat="1"], .dragon-puzzle .dp-markcell[data-seat="1"] { --mp-seat: rgb(var(--red-3)); }   /* muted red   */
.mp-seat-2, .dragon-puzzle .dp-piece[data-seat="2"], .dragon-puzzle .dp-markcell[data-seat="2"] { --mp-seat: rgb(var(--cy-line-1)); }   /* muted blue  */
.mp-seat-3, .dragon-puzzle .dp-piece[data-seat="3"], .dragon-puzzle .dp-markcell[data-seat="3"] { --mp-seat: rgb(var(--green-1)); }   /* muted green */
.mp-seat-4, .dragon-puzzle .dp-piece[data-seat="4"], .dragon-puzzle .dp-markcell[data-seat="4"] { --mp-seat: rgb(var(--gold-2)); }   /* amber       */
.mp-tag--seat { border-color: var(--mp-seat); color: var(--mp-seat); }

/* Layer holding the badges of pieces on the board: above every piece, never receives the pointer */
.dragon-puzzle .dp-marks { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.dragon-puzzle .dp-markcell {
  position: absolute; container-type: size; pointer-events: none;
  transition: left 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), top 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
}
.dragon-puzzle .dp-markcell.is-origin { opacity: 0.22; }

/* a loose piece in the tray is a size container too, so its badge can scale with it */
.dragon-puzzle.is-net .dp-piece { container-type: size; }

.dragon-puzzle .dp-mark {
  position: absolute; right: 4%; bottom: 4%;                 /* inside the square's bottom-right corner */
  display: inline-flex; align-items: center; gap: 0.3em;
  box-sizing: border-box; height: 1.7em; padding: 0 0.5em 0 0.42em;
  /* COMPACT: a tiny pill (dot + "P1"). On a 121-piece board a square is only ~50px wide, so the badge stays well under half of it. */
  font: 600 clamp(8px, 6.2cqw, 10.5px)/1 "Nunito", "Segoe UI", system-ui, sans-serif;   /* cqw = % of the square */
  letter-spacing: 0.03em; white-space: nowrap;
  color: rgb(var(--txt-42));
  background: rgba(var(--surf-13), 0.82);
  border: 1px solid color-mix(in srgb, var(--mp-seat, rgb(var(--wash-13))) 60%, rgba(var(--wash-14), 0.15));
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(var(--shade-1), calc(0.5 * var(--shade-k)));                  /* no backdrop blur: up to 121 badges would make it slow */
  text-shadow: 0 1px 1px rgba(var(--shade-1), calc(0.6 * var(--shade-k)));
  pointer-events: none; user-select: none; -webkit-user-select: none;
}
/* in the tray the badge sits on the piece box (1.64 squares wide): same corner of the real square */
.dragon-puzzle .dp-piece > .dp-mark { right: 22.5%; bottom: 22.5%; font-size: clamp(8px, 4.1cqw, 10.5px); z-index: 2; }
.dragon-puzzle .dp-mark i {
  flex: none; width: 0.64em; height: 0.64em; border-radius: 50%;
  background: var(--mp-seat, rgb(var(--wash-13)));
  box-shadow: 0 0 0 1px rgba(var(--shade-1), calc(0.25 * var(--shade-k)));
  animation: mp-glow 3.2s ease-in-out infinite;   /* a slow, gentle breathing of the dot */
}
@keyframes mp-glow {
  0%, 100% { opacity: 0.85; }
  50%      { opacity: 1; }
}
.dragon-puzzle .dp-mark b { font-weight: inherit; font-variant-numeric: tabular-nums; }

/* tight squares (a big puzzle on a laptop: ~40-52px): dot + the number only, no "P" */
@container (max-width: 52px) {
  .dragon-puzzle .dp-markcell > .dp-mark { gap: 0.28em; padding: 0 0.42em 0 0.36em; }
  .dragon-puzzle .dp-markcell > .dp-mark .dp-mark-p { display: none; }
}

/* DOTS ONLY: on phones (and on any square too small for text) the badge is just the player's coloured dot, with a thin dark ring so it
   shows on every picture. The colour is the player's colour (same palette as the Players list, which names each colour); the full
   name is still the badge's title. */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .dragon-puzzle .dp-mark { right: 7%; bottom: 7%; height: auto; padding: 0; gap: 0; border: 0; background: none; box-shadow: none; text-shadow: none; font-size: 10px; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .dragon-puzzle .dp-mark b { display: none; }
  .dragon-puzzle .dp-mark i { width: clamp(7px, 18cqw, 9px); height: clamp(7px, 18cqw, 9px); box-shadow: 0 0 0 1.5px rgba(var(--shade-3), calc(0.9 * var(--shade-k))); animation: none; opacity: 1; }
  .dragon-puzzle .dp-piece > .dp-mark { right: 24%; bottom: 24%; }
  .dragon-puzzle .dp-piece > .dp-mark i { width: clamp(7px, 11cqw, 9px); height: clamp(7px, 11cqw, 9px); }
}
/* very small squares on any screen: dot only as well */
@container (max-width: 38px) {
  .dragon-puzzle .dp-markcell > .dp-mark { right: 6%; bottom: 6%; height: auto; padding: 0; gap: 0; border: 0; background: none; box-shadow: none; text-shadow: none; }
  .dragon-puzzle .dp-markcell > .dp-mark b { display: none; }
  .dragon-puzzle .dp-markcell > .dp-mark i { width: 7px; height: 7px; box-shadow: 0 0 0 1.5px rgba(var(--shade-3), calc(0.9 * var(--shade-k))); animation: none; opacity: 1; }
}

/* a quiet settle when a badge appears or its owner changes */
.dragon-puzzle .dp-mark.is-new, .dragon-puzzle .dp-mark.is-changed { animation: mp-badge-in 0.32s ease-out; }
@keyframes mp-badge-in {
  from { opacity: 0; transform: translateY(2px) scale(0.92); filter: brightness(1.8); }
  to   { opacity: 1; transform: none; filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .dragon-puzzle .dp-mark, .dragon-puzzle .dp-mark i { transition: none; animation: none !important; }   /* glow stays, motion goes */
}

/* ---------- Back arrow (only on screens that have a previous screen) ----------
   A circular button with a subtle layered look: a faint cyan ring sits slightly behind and to the lower-left of a charcoal disc, so the two
   circles overlap. The button keeps its 44px touch target; both circles stay inside it, so nothing is covered. */
.mp .mp-back {
  position: relative; isolation: isolate;
  appearance: none; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin: 0 0 0.5rem -4px; padding: 0;         /* 44px touch target; the visible disc is 36px, so it lines up with the title */
  border: 0; border-radius: 50%; background: transparent; color: rgb(var(--txt-29)); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease, transform 0.15s ease;
}
.mp .mp-back::before, .mp .mp-back::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease; }
.mp .mp-back::before {                       /* the rear ring */
  inset: 1px 3px 1px -1px; z-index: -2;
  border: 1px solid rgba(var(--cy-line-4), 0.26);
  background: radial-gradient(circle at 30% 28%, rgba(var(--cy-wash-12), 0.16), rgba(var(--cy-wash-12), 0) 70%);
}
.mp .mp-back::after {                        /* the front disc */
  inset: 4px; z-index: -1;
  border: 1px solid rgba(var(--wash-11), 0.26);
  background: linear-gradient(150deg, rgb(var(--surf-73)) 0%, rgb(var(--surf-45)) 100%);
  box-shadow: 0 4px 12px rgba(var(--shade-1), calc(0.5 * var(--shade-k))), inset 0 1px 0 rgba(var(--hi-4), calc(0.08 * var(--hi-k)));
}
.mp .mp-back[hidden] { display: none; }
.mp .mp-back:hover { color: rgb(var(--txt-46)); }
.mp .mp-back:hover::before { border-color: rgba(var(--cy-line-4), 0.5); }
.mp .mp-back:hover::after { border-color: rgba(var(--cy-line-4), 0.5); box-shadow: 0 4px 14px rgba(var(--shade-1), calc(0.5 * var(--shade-k))), 0 0 14px rgba(var(--cy-glow-6), 0.22), inset 0 1px 0 rgba(var(--hi-4), calc(0.1 * var(--hi-k))); }
.mp .mp-back:active { transform: scale(0.94); }
.mp .mp-back:focus-visible { outline: 2px solid rgb(var(--cy-line-4)); outline-offset: 1px; }
.mp .mp-back svg { display: block; position: relative; }
.mp .mp-back--close { margin-left: auto; margin-right: -10px; display: flex; }   /* leaderboard: the cross sits at the right edge */
.mp .mp-back--close:hover { color: rgb(var(--red-text-9)); }
.mp .mp-back--close:hover::before, .mp .mp-back--close:hover::after { border-color: rgba(var(--red-8), 0.55); }

/* ---------- "Leave the room?" confirmation ---------- */
.mp-confirm {
  position: fixed; inset: 0; z-index: 100; padding: 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--surf-4), 0.72);
}
.mp-confirm-box { background: rgb(var(--surf-39)); width: 100%; max-width: 22rem; margin: 0; box-shadow: 0 16px 48px rgba(var(--shade-1), calc(0.55 * var(--shade-k))); }
.mp-confirm-q { margin: 0; color: rgb(var(--txt-39)); font-size: 1.05rem; line-height: 1.4; }
.mp-confirm-sub { margin: 0.35rem 0 0; color: rgb(var(--txt-22)); font-size: 0.92rem; line-height: 1.4; }
/* the same card on the solo page: a bare wrapper that only supplies the .mp button styles */
.mp.mp-confirm-host { padding: 0; width: auto; background: none; border-radius: 0; }
.mp .mp-confirm-row .mp-btn { flex: 1 1 0; width: auto; }   /* Yes / No side by side, also on phones */
.mp-confirm-box .mp-label { margin-top: 0.8rem; }   /* the solo display-name card */
.mp-name-err { color: rgb(var(--red-text-8)); }
.mp-name-err:empty { display: none; }

/* ---------- Room chat: floating icon + slide-out panel ---------- */
/* Hidden until the player opens it. Fixed to the screen edge, so the puzzle layout never moves, and it is a
   side panel (not a full-screen overlay): everything outside it keeps receiving pointer and touch events.
   Phones get a compact bottom sheet instead. Same markup roles as before (chat, chat-list, chat-input, ...). */
.mp-chatdock { --chat-w: 21rem; --chat-pad: 14px; }
.mp-chatdock .mp-sr { position: absolute; }

/* the floating "Chat" button (it is hidden while the chat panel is open, and comes back when it closes).
   It always sits at the BOTTOM of the window, the same place the panel opens from.
   Wide screens: just beside the 46rem play column (the empty margin), so it reads as part of the room.
   Tablets and phones have no free margin beside the board: a compact pill in the bottom-right corner.
   Glow: the pulsing halo is a ::before layer (opacity only), so nothing moves, resizes or blocks a click. */
.mp-chat-fab, .mp-chat-mini {
  position: fixed; z-index: 55;
  right: calc(var(--chat-pad) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--chat-pad) + env(safe-area-inset-bottom, 0px));
  appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; cursor: pointer;
  border: 1px solid rgba(var(--cy-line-2), 0.62); color: rgb(var(--txt-45));
  background: linear-gradient(140deg, rgb(var(--surf-79)) 0%, rgb(var(--surf-63)) 55%, rgb(var(--surf-52)) 100%);
  box-shadow: 0 6px 18px rgba(var(--shade-1), calc(0.5 * var(--shade-k))), 0 0 16px rgba(var(--cy-glow-9), 0.32), inset 0 1px 0 rgba(var(--hi-4), calc(0.14 * var(--hi-k)));
  font: 700 0.95rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.03em;
  transition: border-color .2s ease, background .2s ease, transform .18s ease, box-shadow .2s ease;
}
.mp-chat-fab[hidden], .mp-chat-mini[hidden] { display: none; }
.mp-chat-fab { height: 48px; padding: 0 20px 0 15px; border-radius: var(--mp-r-pill); }
.mp-chat-mini { height: 44px; padding: 0 16px 0 13px; border-radius: var(--mp-r-pill); }
.mp-chat-fab > *, .mp-chat-mini > * { position: relative; }          /* above the halo layer */
.mp-chat-fab::before {                                              /* soft pulsing halo */
  content: ""; position: absolute; inset: -2px; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(var(--cy-glow-11), 0.5), 0 0 22px 4px rgba(var(--cy-glow-9), 0.5);
  opacity: 0.18; animation: mp-chat-pulse 2.8s ease-in-out infinite;
}
@keyframes mp-chat-pulse { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.85; } }
.mp-chat-fab:hover, .mp-chat-mini:hover {
  border-color: rgba(var(--cy-line-6), 0.95); background: linear-gradient(140deg, rgb(var(--surf-82)) 0%, rgb(var(--surf-76)) 55%, rgb(var(--surf-62)) 100%);
  transform: translateY(-2px); box-shadow: 0 10px 24px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 24px rgba(var(--cy-glow-10), 0.5), inset 0 1px 0 rgba(var(--hi-4), calc(0.2 * var(--hi-k)));
}
.mp-chat-fab:active, .mp-chat-mini:active { transform: scale(0.95); transition-duration: .07s; box-shadow: 0 3px 10px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 12px rgba(var(--cy-glow-10), 0.4), inset 0 2px 4px rgba(var(--shade-1), calc(0.3 * var(--shade-k))); }
.mp-chat-fab:focus-visible, .mp-chat-mini:focus-visible, .mp-chat-tool:focus-visible { outline: 2px solid rgb(var(--focus-2)); outline-offset: 3px; }
.mp-chat-ic { display: inline-flex; } .mp-chat-ic svg { display: block; } .mp-chat-fab .mp-chat-ic svg { width: 22px; height: 22px; }
.mp-chat-fab-label, .mp-chat-mini-label { white-space: nowrap; line-height: 1; }

/* wide screens: beside the play column, at the bottom of the window */
@media (min-width: 1100px) {
  .mp-chat-fab, .mp-chat-mini { right: auto; left: calc(50% + 23rem + 16px); }     /* 23rem = half of the 46rem .mp-wrap column */
}

/* unread dot / count */
.mp-chat-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; box-sizing: border-box;
  display: inline-grid; place-items: center;
  background: rgb(var(--pri-fill-2)); color: rgb(var(--onfill-4)); font-size: 0.68rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px rgba(var(--shade-4), calc(0.95 * var(--shade-k)));
}
.mp-chat-badge[hidden] { display: none; }
.mp-chat-fab .mp-chat-badge { position: absolute; top: -6px; right: -6px; }

/* tooltips (hover-capable screens only) */
.mp-chat-tool::after {
  content: attr(data-tip); position: absolute; right: 0; bottom: calc(100% + 8px); transform: translateY(3px);
  padding: 4px 10px; border-radius: var(--mp-r-sm); white-space: nowrap; pointer-events: none; opacity: 0;
  background: rgb(var(--surf-39)); border: 1px solid rgba(var(--wash-6), 0.3); color: rgb(var(--txt-30)); font-size: 0.75rem; line-height: 1.3;
  transition: opacity .15s ease .3s, transform .15s ease .3s; z-index: 5;
}
.mp-chat-tool::after { bottom: auto; top: calc(100% + 6px); }
@media (hover: hover) {
  .mp-chat-tool:hover::after, .mp-chat-tool:focus-visible::after { opacity: 1; transform: none; }
}

/* the panel */
.mp-card.mp-chat {
  position: fixed; z-index: 56; margin: 0; padding: 0;
  right: calc(var(--chat-pad) + env(safe-area-inset-right, 0px));
  bottom: calc(var(--chat-pad) + env(safe-area-inset-bottom, 0px));                 /* always near the bottom of the window (phones: bottom sheet, below) */
  width: min(var(--chat-w), calc(100vw - 2 * var(--chat-pad)));
  /* wide screens: take only the empty margin beside the 46rem play column where possible (never narrower than 17rem) */
  width: min(var(--chat-w), max(17rem, calc((100vw - 46rem) / 2 - 2 * var(--chat-pad))));
  height: min(30rem, calc(100vh - 100px)); height: min(30rem, calc(100dvh - 100px));
  display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box;
  background: rgb(var(--surf-35)); border: 1px solid rgba(var(--wash-6), 0.28); border-radius: var(--mp-r-lg);
  box-shadow: 0 18px 48px rgba(var(--shade-1), calc(0.55 * var(--shade-k)));
  visibility: hidden; opacity: 0; transform: translateX(24px); pointer-events: none;
  transition: transform .22s ease, opacity .22s ease, visibility 0s linear .22s;
}
.mp-card.mp-chat.is-open { visibility: visible; opacity: 1; transform: none; pointer-events: auto; transition: transform .22s ease, opacity .22s ease, visibility 0s; }
.mp-card.mp-chat.is-locked { border-color: rgba(var(--cy-line-2), 0.5); }

.mp-chat-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--mp-line); }
.mp-card.mp-chat h2.mp-chat-title {
  display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; border: 0;
  font: 700 0.8rem/1.2 "Nunito", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.14em; text-transform: uppercase; color: rgb(var(--txt-34));
}
.mp-chat-title::before {                      /* status dot: green while chat works, grey when it is not available */
  content: ""; flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: rgb(var(--green-3)); box-shadow: 0 0 0 3px rgba(var(--green-3), 0.16);
}
.mp-chat:has(.mp-chat-input:disabled) .mp-chat-title::before { background: rgb(var(--surf-80)); box-shadow: none; }
.mp-chat-tools { flex: none; display: flex; gap: 4px; }
.mp-chat-tool {
  position: relative; appearance: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: rgb(var(--txt-22)); cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.mp-chat-tool svg { display: block; }
.mp-chat-tool:hover { background: rgba(var(--cy-wash-10), 0.12); color: rgb(var(--txt-43)); }
.mp-chat-tool[data-act="chat-close"]:hover { background: rgba(var(--cy-wash-8), 0.2); color: rgb(var(--red-text-11)); }
.mp-chat-tool.is-on { background: rgba(var(--cy-wash-10), 0.16); border-color: rgba(var(--cy-line-2), 0.5); color: rgb(var(--cy-text-5)); }
.mp-chat-tool::after { right: 0; }

.mp-chat-list {
  flex: 1 1 auto; min-height: 0; list-style: none; margin: 0; padding: 12px 14px;
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  scrollbar-width: thin; scrollbar-color: rgba(var(--wash-6), 0.3) transparent;
  border: 0; background: none;
  display: flex; flex-direction: column; gap: 10px;
}
.mp-chat-list:focus-visible { outline: 2px solid rgb(var(--focus-1)); outline-offset: -2px; }

.mp-chat-msg { display: flex; align-items: flex-start; gap: 8px; max-width: 92%; padding: 0; font-size: 0.93rem; line-height: 1.4; }
.mp-chat-msg.is-mine { flex-direction: row-reverse; align-self: flex-end; background: none; }
.mp-chat-col { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mp-chat-msg.is-mine .mp-chat-col { align-items: flex-end; }
.mp-chat-meta { display: flex; align-items: baseline; gap: 6px; padding: 0 4px; font-size: 0.72rem; color: rgb(var(--txt-12)); }
.mp-chat-name { color: var(--mp-seat, rgb(var(--txt-28))); font-weight: 600; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-chat-msg.is-mine .mp-chat-name { color: rgb(var(--txt-34)); }
.mp-chat-time { font-variant-numeric: tabular-nums; }

/* the player tile (P1-P4): a soft square in that player's colour */
.mp-chat-who {
  flex: none; display: grid; place-items: center;
  width: 28px; height: 28px; margin-top: 2px; padding: 0;
  border-radius: 8px; font-size: 0.7rem; font-weight: 700; line-height: 1; letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--mp-seat, rgb(var(--wash-5))) 16%, rgba(var(--surf-28), 0.9));
  border-color: color-mix(in srgb, var(--mp-seat, rgb(var(--wash-5))) 38%, transparent);
  color: var(--mp-seat, rgb(var(--txt-12)));
}

/* the bubble is the text itself, so it hugs its content */
.mp-chat-text {
  flex: 0 1 auto; min-width: 0; overflow-wrap: anywhere; color: rgb(var(--txt-39));
  padding: 7px 13px; border-radius: 16px 16px 16px 6px;
  background: rgba(var(--surf-59), 0.9); border: 1px solid rgba(var(--wash-6), 0.18);
}
.mp-chat-msg.is-mine .mp-chat-text {
  border-radius: 16px 16px 6px 16px;
  background: rgba(var(--cy-wash-8), 0.16); border-color: rgba(var(--cy-line-3), 0.34); color: rgb(var(--red-text-12));
}
.mp-chat-empty { margin: auto; padding: 4px; text-align: center; color: rgb(var(--txt-12)); font-size: 0.9rem; }

.mp-chat-err { flex: none; margin: 0; padding: 0 16px 6px; color: rgb(var(--red-text-11)); font-size: 0.88rem; }
.mp-chat-err[hidden] { display: none; }

/* one rounded input; Send sits inside it on the right */
.mp-chat-form {
  flex: none; display: flex; gap: 8px; align-items: center; margin: 0; padding: 5px 5px 5px 6px;
  border: 1px solid rgba(var(--wash-6), 0.26); border-radius: var(--mp-r-pill);
  background: rgba(var(--surf-1), 0.5); transition: border-color 0.2s;
  margin: 10px 12px 12px;
}
.mp-chat-form:focus-within { border-color: rgba(var(--cy-line-2), 0.7); outline: 2px solid rgb(var(--focus-1)); outline-offset: 2px; }
.mp-chat-field { position: relative; flex: 1 1 auto; min-width: 0; }
.mp .mp-chat-input {
  min-height: 40px; padding: 0.4rem 3.6rem 0.4rem 0.9rem; font-size: 1rem;   /* room for the 34/80 counter; 16px stops iOS zooming in */
  border: 0; border-radius: var(--mp-r-pill); background: transparent; outline: none;
}
.mp-chat-count {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  font-size: 0.75rem; color: rgb(var(--txt-12)); font-variant-numeric: tabular-nums; pointer-events: none;
}
.mp-chat-count.is-full { color: rgb(var(--gold-text-8)); }
.mp .mp-chat-input:placeholder-shown { padding-right: 0.9rem; }
.mp-chat-input:placeholder-shown + .mp-chat-count { opacity: 0; }
.mp .mp-chat-send { flex: none; width: auto; min-height: 40px; padding: 0.4rem 1.1rem; }   /* beats the full-width phone button rule */
.mp .mp-chat-input:focus-visible { outline: none; }   /* the pill around it shows the focus ring */
.mp-chat-input:disabled, .mp .mp-chat-send:disabled { opacity: 0.55; cursor: default; }

/* no free margin beside the board here, so the corner button is an overlay: leave scroll room under the room so the last controls can be scrolled clear of it */
@media (max-width: 1099px) { .mp-wrap:has(.mp-chatdock) { padding-bottom: calc(48px + 2 * 14px + env(safe-area-inset-bottom, 0px)); } }
/* tablets: a slimmer panel */
@media (max-width: 900px) { .mp-chatdock { --chat-w: 18.5rem; } .mp-card.mp-chat { width: min(var(--chat-w), calc(100vw - 2 * var(--chat-pad))); } }
/* phones: a compact bottom sheet that leaves most of the puzzle visible; it rises above the on-screen keyboard (--mp-kb) */
@media (max-width: 600px) {
  .mp-card.mp-chat {
    left: 0; right: 0; width: auto; border-radius: var(--mp-r-lg) var(--mp-r-lg) 0 0; border-bottom: 0;
    bottom: var(--mp-kb, 0px);
    height: min(21rem, 50vh); height: min(21rem, 50dvh);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(100%);
  }
  .mp-chat-tool { width: 44px; height: 44px; }
  .mp-chat-head { padding: 6px 8px 6px 16px; }
  .mp-chat-fab { height: 48px; }
  .mp-chat-mini { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-card.mp-chat, .mp-card.mp-chat.is-open, .mp-chat-fab, .mp-chat-mini, .mp-chat-tool { transition: none; }
  .mp-chat-fab:hover, .mp-chat-mini:hover, .mp-chat-fab:active, .mp-chat-mini:active { transform: none; }
  .mp-chat-fab::before { animation: none; opacity: 0.4; }
}

/* ---------- Copy Code: inline feedback on the button itself (no popup) ---------- */
.mp .mp-copy { position: relative; display: inline-grid; place-items: center; transition: border-color .2s ease, background-color .2s ease, color .2s ease; }
.mp .mp-copy-face { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 0.5rem; transition: opacity .2s ease, transform .2s ease; }
.mp .mp-copy-icon { display: inline-flex; opacity: 0.75; }
.mp .mp-copy-icon svg { display: block; }
.mp .mp-copy-done { opacity: 0; transform: translateY(4px); color: rgb(var(--green-text)); font-weight: 600; }
.mp .mp-copy.is-copied { border-color: rgba(var(--green-1), 0.7); background: rgba(var(--green-1), 0.12); }
.mp .mp-copy.is-copied .mp-copy-idle { opacity: 0; transform: translateY(-4px); }
.mp .mp-copy.is-copied .mp-copy-done { opacity: 1; transform: none; }
.mp .mp-copy::after {                       /* small tooltip (hover-capable screens only) */
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translate(-50%, 3px);
  padding: 4px 10px; border-radius: var(--mp-r-sm); white-space: nowrap; pointer-events: none; opacity: 0;
  background: rgb(var(--surf-39)); border: 1px solid rgba(var(--wash-6), 0.3); color: rgb(var(--txt-30)); font-size: 0.75rem; line-height: 1.3;
  transition: opacity .15s ease .25s, transform .15s ease .25s; z-index: 5;
}
@media (hover: hover) {
  .mp .mp-copy:hover:not(.is-copied)::after, .mp .mp-copy:focus-visible:not(.is-copied)::after { opacity: 1; transform: translate(-50%, 0); }
}
.mp .mp-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Chat toasts: compact glass card, click-through, accent = the sender's seat colour ---------- */
.mp-toasts {
  position: fixed; z-index: 60; pointer-events: none;
  top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  width: min(19rem, calc(100vw - 24px));
}
.mp-toast:not([class*="mp-seat-"]) { --mp-seat: rgb(var(--cy-line-2)); }   /* fallback accent; P1-P4 set their own colour */
.mp-toast {
  pointer-events: auto; cursor: pointer; position: relative; width: 100%;   /* clickable: jumps to the Room Chat */
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 14px 11px 16px; border-radius: var(--mp-r-md); overflow: hidden;
  background: rgba(var(--surf-38), 0.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(var(--wash-6), 0.22);
  box-shadow: 0 10px 28px rgba(var(--shade-1), calc(0.45 * var(--shade-k)));
  color: rgb(var(--txt-39)); font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  opacity: 0; transform: translateX(18px) scale(0.98);
  transition: opacity .28s ease, transform .32s cubic-bezier(.2, .8, .25, 1);
}
.mp-toast.is-in { opacity: 1; transform: none; }
.mp-toast::before {                           /* accent stripe */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--mp-seat);
}
.mp-toast-ic {
  flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: var(--mp-r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--mp-seat); background: color-mix(in srgb, var(--mp-seat) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--mp-seat) 35%, transparent);
}
.mp-toast-ic svg { display: block; }
.mp-toast-main { min-width: 0; flex: 1 1 auto; }
.mp-toast-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mp-toast-name { min-width: 0; font-weight: 700; font-size: 0.92rem; line-height: 1.25; color: rgb(var(--txt-44)); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-toast-dot { flex: none; color: rgb(var(--txt-4)); font-size: 0.7rem; }
.mp-toast-badge {
  flex: none; padding: 1px 8px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; line-height: 1.5; letter-spacing: 0.06em;
  color: var(--mp-seat); background: color-mix(in srgb, var(--mp-seat) 14%, transparent); border: 1px solid color-mix(in srgb, var(--mp-seat) 40%, transparent);
}
.mp-toast-msg {
  margin-top: 2px; font-size: 0.86rem; line-height: 1.35; color: rgb(var(--txt-30)); overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 480px) {                   /* phones: a little smaller, centred along the top edge */
  .mp-toasts { right: 50%; transform: translateX(50%); align-items: center; width: min(19rem, calc(100vw - 20px)); }
  .mp-toast { padding: 8px 12px 9px 14px; border-radius: var(--mp-r-md); }
}
@media (prefers-reduced-motion: reduce) { .mp .mp-copy::after { transition: none; } }


/* ==========================================================================
   Leaderboard (the "Leaderboard" screen). Charcoal, ivory and antique gold.
   Prefix "lb-"; lives inside .mp. Motion is switched off for reduced-motion users.
   ========================================================================== */
.lb {
  --lb-gold: rgb(var(--gold-text-6));
  --lb-gold-soft: rgba(var(--gold-1), 0.28);
  --lb-ivory: rgb(var(--gold-text-10));
  --lb-muted: rgb(var(--txt-14));
  position: relative;
  margin-top: 1.4rem;
  padding: clamp(18px, 3vw, 30px) clamp(14px, 3vw, 28px) clamp(20px, 3vw, 30px);
  border: 1px solid var(--lb-gold-soft);
  border-radius: var(--mp-r-lg);
  color: var(--lb-ivory);
  text-align: center;
  background:
    radial-gradient(90% 46% at 50% 0%, rgba(var(--gold-1), 0.1), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='20'%3E%3Cpath d='M0 10q7 0 7-10M14 10q7 0 7-10M7 20q7 0 7-10M21 20q7 0 7-10' fill='none' stroke='%23c9a45c' stroke-opacity='.05'/%3E%3C/svg%3E"),
    linear-gradient(180deg, rgb(var(--surf-41)) 0%, rgb(var(--surf-25)) 100%);
  box-shadow: var(--mp-shadow-soft), inset 0 0 0 1px rgba(var(--shade-1), calc(0.5 * var(--shade-k)));
  animation: lb-enter 0.55s ease-out both;
}
.lb::before {                       /* a fine inner gold hairline */
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  border: 1px solid rgba(var(--gold-1), 0.12); border-radius: calc(var(--mp-r-lg) - 6px);
}
.lb-orn, .lb-crown, .lb-medal, .lb-egg-wrap { display: block; color: var(--lb-gold); line-height: 0; }
.lb-orn { margin: 0 auto 0.5rem; max-width: 100%; }
.lb-orn svg { max-width: 100%; height: auto; }
.lb .lb-s { fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; opacity: 0.8; }
.lb .lb-f { fill: currentColor; }
.lb .lb-egg { stroke: currentColor; stroke-width: 1.2; opacity: 0.85; }

.lb .lb-title {
  margin: 0;
  font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-weight: 500; font-size: clamp(1.45rem, 3.6vw, 1.9rem); letter-spacing: 0.02em; color: var(--lb-ivory);
}

.lb-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 1rem 0 1.4rem; }
.mp .lb-tab {
  appearance: none; min-height: 40px; padding: 0.35rem 0.95rem;
  border-radius: var(--mp-r-pill); border: 1px solid rgba(var(--gold-8), 0.16);
  background: transparent; color: var(--lb-muted); cursor: pointer;
  font: 500 0.88rem/1.2 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.02em;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
@media (hover: hover) { .mp .lb-tab:hover { color: var(--lb-ivory); border-color: rgba(var(--gold-1), 0.5); } }   /* not on touch screens: a tapped tab must not stay "hovered" */
.mp .lb-tab[aria-pressed="true"] { color: rgb(var(--gold-text-11)); border-color: var(--lb-gold); background: rgba(var(--gold-1), 0.14); }
.mp .lb-tab:focus-visible { outline: 2px solid rgb(var(--gold-4)); outline-offset: 2px; }

.lb-body { min-height: 9rem; }
.lb-state { margin: 1.4rem 0 0.2rem; color: var(--lb-ivory); font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif; font-size: 1.25rem; }
.lb-empty { padding: 0.6rem 0 0.4rem; }
.lb-egg-wrap { margin: 0.4rem auto 0; }
.lb .mp-help { color: var(--lb-muted); }

/* ---- podium ---- */
.lb-podium { list-style: none; margin: 0 auto 1rem; padding: 0; display: flex; align-items: flex-end; justify-content: center; gap: clamp(6px, 2vw, 14px); max-width: 34rem; }
.lb-place {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px;
  animation: lb-rise 0.6s ease-out both;
}
.lb-place--1 { order: 2; flex-grow: 1.15; animation-delay: 0.30s; }
.lb-place--2 { order: 1; animation-delay: 0.18s; }
.lb-place--3 { order: 3; animation-delay: 0.08s; }
.lb-crown { margin-bottom: -2px; }
.lb-medal svg { display: block; }
.lb .lb-m-a { fill: var(--m2); }
.lb .lb-m-b { fill: var(--m1); }
.lb .lb-m-ring { fill: none; stroke: var(--m2); stroke-width: 1.2; stroke-dasharray: 2 2.2; }
.lb .lb-m-n { font: 700 15px "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif; }
.lb-pname {
  max-width: 100%; margin-top: 4px; padding: 0 2px; color: var(--lb-ivory); font-weight: 600; font-size: 0.95rem; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.lb-ptime { color: var(--lb-gold); font-variant-numeric: tabular-nums; font-size: 1.05rem; font-weight: 600; }
.lb-pmoves { color: var(--lb-muted); font-size: 0.82rem; }
.lb-plinth {
  align-self: stretch; margin-top: 8px; display: flex; align-items: flex-start; justify-content: center; padding-top: 0.4rem;
  border: 1px solid var(--lb-gold-soft); border-bottom: 0; border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, rgba(var(--gold-1), 0.16), rgba(var(--gold-1), 0.03));
  font: 500 1.6rem/1 "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif; color: rgba(var(--gold-text-6), 0.65);
  transform-origin: bottom; animation: lb-grow 0.7s cubic-bezier(.2, .7, .2, 1) both; animation-delay: inherit;
}
.lb-place--1 .lb-plinth { height: 5.6rem; }
.lb-place--2 .lb-plinth { height: 4rem; }
.lb-place--3 .lb-plinth { height: 3rem; }
.lb-place--1 .lb-crown { animation: lb-glint 4.5s ease-in-out 1s infinite; }
.lb-place.is-mine .lb-pname { color: rgb(var(--gold-text-11)); }
.lb-place.is-mine .lb-plinth { border-color: rgba(var(--gold-4), 0.7); }

.lb-you, .lb-team {
  display: inline-block; margin: 2px 0 0; padding: 0 0.5rem; border-radius: var(--mp-r-pill);
  font-size: 0.72rem; line-height: 1.55; letter-spacing: 0.06em; text-transform: uppercase;
}
.lb-you { color: rgb(var(--ink-dark-5)); background: var(--lb-gold); font-weight: 700; }
.lb-team { color: var(--lb-muted); border: 1px solid rgba(var(--gold-8), 0.18); }

/* ---- places 4 and below ---- */
.lb-list { list-style: none; margin: 0 auto; padding: 0; max-width: 34rem; border-top: 1px solid var(--lb-gold-soft); }
.lb-row {
  display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto auto; align-items: center; column-gap: 0.8rem;
  padding: 0.65rem 0.5rem; border-bottom: 1px solid rgba(var(--gold-8), 0.08); text-align: left;
  animation: lb-fade 0.45s ease-out both; animation-delay: calc(0.5s + var(--i, 0) * 0.04s);
}
.lb-row.is-mine { background: rgba(var(--gold-1), 0.1); border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(var(--gold-1), 0.4); }
.lb-rank { font: 500 1.25rem/1 "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif; color: var(--lb-gold); text-align: center; }
.lb-who { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.lb-name { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--lb-ivory); font-weight: 500; }
.lb-time { color: var(--lb-ivory); font-variant-numeric: tabular-nums; font-weight: 600; }
.lb-moves { min-width: 4.6rem; color: var(--lb-muted); font-size: 0.88rem; text-align: right; }
.lb-mine-note { margin: 1rem 0 0; color: var(--lb-ivory); font-size: 0.95rem; }
.lb-mine-note .lb-you { margin-right: 0.3rem; }

@media (max-width: 480px) {
  .lb-row { grid-template-columns: 1.8rem minmax(0, 1fr) auto; row-gap: 0; padding-inline: 0.2rem; }
  .lb-moves { grid-column: 2 / 4; grid-row: 2; text-align: left; min-width: 0; font-size: 0.82rem; }
  .lb-time { grid-column: 3; grid-row: 1; }
  .lb-pname { font-size: 0.85rem; }
  .lb-ptime { font-size: 0.95rem; }
  .lb-place--1 .lb-plinth { height: 4.6rem; }
  .lb-place--2 .lb-plinth { height: 3.3rem; }
  .lb-place--3 .lb-plinth { height: 2.5rem; }
}

@keyframes lb-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes lb-rise  { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes lb-grow  { from { transform: scaleY(0.05); } to { transform: scaleY(1); } }
@keyframes lb-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-glint { 0%, 80%, 100% { filter: none; } 90% { filter: drop-shadow(0 0 6px rgba(var(--gold-5), 0.85)); } }

@media (prefers-reduced-motion: reduce) {
  .lb, .lb-place, .lb-plinth, .lb-row, .lb-place--1 .lb-crown { animation: none !important; }
  .mp .lb-tab { transition: none; }
}


/* ==========================================================================
   Leaderboard trophy button (icon only): one, at the right end of the room-menu title row; it opens the board
   of the puzzle currently selected in "Create a room". Antique gold on the dark theme.
   ========================================================================== */
.mp-titlebar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
.mp-titlebar .mp-head { grid-column: 1 / 3; grid-row: 2; min-width: 0; }
.mp-titlebar .mp-trophy { grid-column: 3; grid-row: 2; }
.mp-titlebar .mp-back { grid-column: 1 / -1; grid-row: 1; justify-self: start; }      /* wide screens: its own line above the title, as before */
.mp-titlebar .mp-back--close { justify-self: end; }

.mp .mp-trophy {
  --tr-gold: rgb(var(--gold-text-6));
  --tr-gold-hi: rgb(var(--gold-text-7));
  position: relative; appearance: none; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0;                 /* 44px hit area even where only a small icon shows */
  border: 1px solid transparent; border-radius: 50%;
  background: transparent; color: var(--tr-gold); cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.mp .mp-trophy[hidden] { display: none; }
.mp .mp-trophy svg { display: block; }

.mp .mp-trophy--top {
  width: 56px; height: 56px;                            /* large, easy to see and tap (was 44px) */
  border-width: 1.5px; border-color: rgba(var(--gold-1), 0.55);
  background: radial-gradient(circle at 50% 35%, rgba(var(--gold-1), 0.18), rgba(var(--surf-37), 0.82) 70%);
  box-shadow: 0 2px 12px rgba(var(--shade-1), calc(0.4 * var(--shade-k))), 0 0 0 3px rgba(var(--gold-1), 0.06);
}
.mp .mp-trophy--top svg { width: 30px; height: 30px; filter: drop-shadow(0 0 7px rgba(var(--gold-1), 0.35)); }
@media (max-width: 480px) { .mp .mp-trophy--top { width: 52px; height: 52px; } .mp .mp-trophy--top svg { width: 28px; height: 28px; } }

.mp .mp-trophy:focus-visible { outline: 2px solid rgb(var(--gold-4)); outline-offset: 2px; color: var(--tr-gold-hi); }
.mp .mp-trophy:active:not(:disabled) { background: rgba(var(--gold-1), 0.24); border-color: rgba(var(--gold-1), 0.7); color: rgb(var(--gold-text-9)); transform: scale(0.93); }
.mp .mp-trophy:disabled { opacity: 0.45; cursor: progress; }

/* tooltip: same look as the Copy Code one, in gold. It exists ONLY where hovering exists, so touch screens get no hidden
   element that could widen the page; the accessible name (aria-label) is always there. */
@media (hover: hover) {
  .mp .mp-trophy::after {
    content: attr(data-tip); position: absolute; right: 0; top: calc(100% + 6px); transform: translateY(-3px);
    padding: 4px 10px; border-radius: var(--mp-r-sm); white-space: nowrap; pointer-events: none; opacity: 0;
    background: rgb(var(--surf-31)); border: 1px solid rgba(var(--gold-1), 0.38); color: rgb(var(--gold-text-10)); font-size: 0.75rem; line-height: 1.3;
    transition: opacity 0.15s ease 0.25s, transform 0.15s ease 0.25s; z-index: 5;
  }
  .mp .mp-trophy:hover:not(:disabled) { color: var(--tr-gold-hi); background: rgba(var(--gold-1), 0.14); border-color: rgba(var(--gold-1), 0.6); }
  .mp .mp-trophy:hover::after, .mp .mp-trophy:focus-visible::after { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mp .mp-trophy, .mp .mp-trophy::after { transition: none; }
  .mp .mp-trophy:active:not(:disabled) { transform: none; }
}

/* ==========================================================================
   Play with friends: premium lobby (Play Together / Join a Room / Create a Room)
   Scoped to .mp--flow, which is on only while the room menu is showing, so the
   room screen, chat and leaderboard keep their own look.
   ========================================================================== */
.mp--flow {
  --fl-cyan: rgb(var(--cy-line-4));
  --fl-blue: rgb(var(--cy-text-3));
  --fl-ink: rgb(var(--txt-43));
  --fl-dim: rgb(var(--txt-18));
  --fl-line: rgba(var(--wash-8), 0.16);
  --fl-line-hi: rgba(var(--cy-line-4), 0.55);
  --fl-sans: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --fl-serif: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
  font-family: var(--fl-sans);
  background:
    radial-gradient(70% 55% at 50% -8%, rgba(var(--cy-wash-9), 0.2), transparent 70%),
    radial-gradient(50% 40% at 100% 100%, rgba(var(--cy-wash-12), 0.07), transparent 70%),
    radial-gradient(60% 45% at 0% 100%, rgba(var(--surf-81), 0.16), transparent 70%),
    linear-gradient(180deg, rgb(var(--surf-13)) 0%, rgb(var(--surf-6)) 100%);
}
.mp--flow .mp-wrap { max-width: 56rem; }
.mp--flow .mp-title {
  font-family: var(--fl-serif); font-weight: 600; font-size: clamp(2.2rem, 5.4vw, 3.4rem); letter-spacing: 0.01em;
  background: linear-gradient(180deg, rgb(var(--wash-14)) 20%, rgb(var(--wash-10)) 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
}
.mp--flow .mp-sub { color: var(--fl-dim); font-size: 1.02rem; max-width: 36rem; margin-top: 0.5rem; }
.mp--flow .mp-notice p { display: flex; gap: 10px; align-items: flex-start; animation: fl-in 0.28s ease both; }
.mp--flow .mp-notice p.is-error::before { content: "!"; flex: none; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: rgba(var(--red-5), 0.9); color: rgb(var(--red-dark)); font: 800 0.8rem/20px var(--fl-sans); text-align: center; }
.mp--flow .mp-body { animation: fl-in 0.35s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes fl-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.mp--flow .mp-btn { font-family: var(--fl-sans); font-weight: 600; letter-spacing: 0.01em; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.18s ease, border-color 0.2s, background 0.2s, box-shadow 0.25s, filter 0.2s; }
.mp--flow .mp-btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.mp--flow .mp-btn:disabled { opacity: 0.6; cursor: progress; }
.mp--flow .mp-btn--primary {
  border: 1px solid rgba(var(--pri-line-3), 0.5);
  background: linear-gradient(135deg, rgb(var(--pri-fill-10)) 0%, rgb(var(--pri-fill-17)) 100%);
  color: rgb(var(--onfill-1)); box-shadow: 0 6px 22px rgba(var(--pri-glow-2), 0.32), inset 0 1px 0 rgba(var(--hi-4), calc(0.35 * var(--hi-k)));
}
.mp--flow .mp-btn--primary:hover:not(:disabled) { background: linear-gradient(135deg, rgb(var(--pri-fill-12)) 0%, rgb(var(--pri-fill-19)) 100%); border-color: rgba(var(--pri-line-4), 0.85); box-shadow: 0 8px 30px rgba(var(--pri-glow-4), 0.45), inset 0 1px 0 rgba(var(--hi-4), calc(0.45 * var(--hi-k))); transform: translateY(-1px); }
.mp--flow .mp-btn--lg { min-height: 52px; padding-inline: 1.7rem; font-size: 1.02rem; }
.mp--flow .mp-btn--ghost { background: rgba(var(--wash-14), 0.03); border-color: var(--fl-line); color: rgb(var(--txt-31)); }
.mp--flow .mp-btn--ghost:hover:not(:disabled) { background: rgba(var(--cy-wash-12), 0.08); border-color: rgba(var(--cy-line-4), 0.4); color: rgb(var(--txt-46)); }
.mp--flow .mp-btn--quiet { text-decoration: none; color: var(--fl-dim); }
.mp--flow .mp-btn--quiet:hover:not(:disabled) { color: rgb(var(--txt-46)); background: rgba(var(--wash-14), 0.04); }
.mp--flow .mp-btn:focus-visible, .mp--flow .mp-pick:focus-visible, .mp--flow .mp-puz:focus-visible, .mp--flow .mp-input:focus-visible { outline: 2px solid var(--fl-cyan); outline-offset: 3px; }
.mp-btn-ic { display: inline-flex; } .mp-btn-ic svg { display: block; }
.mp-spin { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(var(--surf-24), 0.3); border-top-color: rgb(var(--surf-24)); animation: fl-spin 0.7s linear infinite; }
.mp-btn.is-loading .mp-spin { display: inline-block; }
.mp-btn.is-loading .mp-btn-ic { display: none; }
@keyframes fl-spin { to { transform: rotate(360deg); } }

/* --- home: two cards --- */
.mp-picks { display: grid; gap: 18px; grid-template-columns: 1fr; margin-top: 1.8rem; }
.mp-pick {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; text-align: left;
  padding: clamp(22px, 3vw, 32px); min-height: 15rem; color: inherit; font: inherit; cursor: pointer; appearance: none;
  border: 1px solid var(--fl-line); border-radius: 24px;
  background: linear-gradient(160deg, rgba(var(--surf-64), 0.72) 0%, rgba(var(--surf-30), 0.88) 60%);
  box-shadow: 0 14px 40px rgba(var(--shade-1), calc(0.45 * var(--shade-k))), inset 0 1px 0 rgba(var(--hi-4), calc(0.05 * var(--hi-k)));
  transition: transform 0.28s cubic-bezier(.2, .7, .2, 1), border-color 0.25s, box-shadow 0.3s;
}
.mp-pick::before { content: ""; position: absolute; inset: -40% -20% auto auto; width: 70%; aspect-ratio: 1; background: radial-gradient(circle, rgba(var(--cy-wash-12), 0.22), transparent 65%); opacity: 0.55; transition: opacity 0.3s, transform 0.5s; pointer-events: none; }
.mp-pick--join::before { background: radial-gradient(circle, rgba(var(--wash-12), 0.16), transparent 65%); }
.mp-pick:hover { transform: translateY(-4px); border-color: var(--fl-line-hi); box-shadow: 0 22px 54px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 0 1px rgba(var(--cy-glow-13), 0.12), 0 0 40px rgba(var(--cy-glow-6), 0.16); }
.mp-pick:hover::before { opacity: 1; transform: scale(1.12); }
.mp-pick:active { transform: translateY(-1px) scale(0.99); }
.mp-pick > * { position: relative; }
.mp-pick-orb { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 0.9rem; border-radius: 18px; color: var(--fl-cyan); border: 1px solid rgba(var(--cy-line-4), 0.3); background: linear-gradient(150deg, rgba(var(--cy-wash-9), 0.22), rgba(var(--cy-wash-12), 0.06)); box-shadow: 0 0 26px rgba(var(--cy-glow-6), 0.2), inset 0 1px 0 rgba(var(--hi-4), calc(0.12 * var(--hi-k))); }
.mp-pick--join .mp-pick-orb { color: rgb(var(--txt-37)); border-color: rgba(var(--wash-12), 0.3); background: linear-gradient(150deg, rgba(var(--wash-12), 0.14), rgba(var(--wash-12), 0.03)); box-shadow: 0 0 26px rgba(var(--hi-3), calc(0.1 * var(--hi-k))), inset 0 1px 0 rgba(var(--hi-4), calc(0.12 * var(--hi-k))); }
.mp-pick-orb--sm { width: 52px; height: 52px; margin: 0; }
.mp-pick-ic { display: inline-flex; } .mp-pick-ic svg { display: block; }
.mp-pick-title { font-family: var(--fl-serif); font-weight: 600; font-size: clamp(1.7rem, 3.4vw, 2.15rem); line-height: 1.05; color: var(--fl-ink); }
.mp-pick-text { color: var(--fl-dim); font-size: 1rem; line-height: 1.5; max-width: 22rem; }
.mp-pick-cta { margin-top: auto; padding-top: 1.2rem; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 700; color: rgb(var(--ink-dark-3)); }
.mp-pick-cta { padding: 0.65rem 1.25rem; margin-top: auto; border-radius: 999px; background: linear-gradient(135deg, rgb(var(--pri-fill-10)), rgb(var(--pri-fill-17))); border: 1px solid rgba(var(--pri-line-3), 0.5); box-shadow: 0 6px 20px rgba(var(--pri-glow-2), 0.28); transition: box-shadow 0.25s, transform 0.25s; }
.mp-pick--join .mp-pick-cta { background: rgba(var(--wash-14), 0.06); color: rgb(var(--txt-43)); border-color: rgba(var(--wash-12), 0.32); box-shadow: none; }
.mp-pick--join:hover .mp-pick-cta { background: rgba(var(--cy-wash-11), 0.12); border-color: rgba(var(--cy-line-3), 0.55); box-shadow: 0 8px 24px rgba(var(--cy-glow-7), 0.2); }
.mp-pick-cta .mp-btn-ic { transition: transform 0.25s; }
.mp-pick:hover .mp-pick-cta .mp-btn-ic { transform: translateX(4px); }
.mp-pick:hover .mp-pick-cta { box-shadow: 0 8px 28px rgba(var(--cy-glow-8), 0.45); }
.mp-row--center { justify-content: center; margin-top: 1.4rem; }

/* --- join step --- */
.mp-stage { margin: 1.8rem auto 0; padding: clamp(22px, 4vw, 36px); border: 1px solid var(--fl-line); border-radius: 24px; background: linear-gradient(160deg, rgba(var(--surf-61), 0.7), rgba(var(--surf-21), 0.9)); box-shadow: 0 18px 50px rgba(var(--shade-1), calc(0.5 * var(--shade-k))), inset 0 1px 0 rgba(var(--hi-4), calc(0.05 * var(--hi-k))); }
.mp-stage--narrow { max-width: 28rem; text-align: center; }
.mp-stage-hero { display: flex; justify-content: center; margin-bottom: 1.1rem; }
.mp-label--center { text-align: center; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.16em; color: var(--fl-dim); margin-bottom: 0.6rem; }
.mp--flow .mp-input { font-family: var(--fl-sans); border-radius: 16px; border: 1px solid rgba(var(--wash-8), 0.28); background: rgba(var(--surf-3), 0.7); transition: border-color 0.2s, box-shadow 0.25s, background 0.2s; }
.mp--flow .mp-input--code { min-height: 68px; font-size: 1.9rem; font-weight: 700; letter-spacing: 0.4em; text-indent: 0.4em; padding-inline: 0.6rem; }
.mp--flow .mp-input--code::placeholder { color: rgba(var(--txt-18), 0.28); }
.mp--flow .mp-input:focus { outline: none; border-color: var(--fl-line-hi); background: rgba(var(--surf-5), 0.85); box-shadow: 0 0 0 4px rgba(var(--cy-glow-6), 0.18), 0 0 30px rgba(var(--cy-glow-6), 0.14); }
.mp--flow .mp-input:focus-visible { outline: none; }
.mp-help--center { text-align: center; }
.mp--flow .mp-help { color: var(--fl-dim); }
.mp-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 1.4rem; }
.mp-stage--narrow .mp-actions .mp-btn { width: 100%; }

/* --- create step --- */
.mp-create { margin-top: 1.4rem; display: grid; gap: 22px; }
.mp-sec { padding: clamp(16px, 2.6vw, 24px); border: 1px solid var(--fl-line); border-radius: 24px; background: linear-gradient(170deg, rgba(var(--surf-55), 0.6), rgba(var(--surf-18), 0.85)); box-shadow: 0 10px 30px rgba(var(--shade-1), calc(0.35 * var(--shade-k))); }
.mp-sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 1rem; }
.mp-step { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; font: 700 0.85rem/1 var(--fl-sans); color: var(--fl-cyan); border: 1px solid rgba(var(--cy-line-4), 0.4); background: rgba(var(--cy-wash-9), 0.12); }
.mp--flow .mp-sec h2 { margin: 0; font-family: var(--fl-serif); font-weight: 600; font-size: 1.55rem; color: var(--fl-ink); }
.mp-puzzles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; padding: 0; border: 0; min-width: 0; }
.mp-puz {
  position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 8px 8px 12px; text-align: left; appearance: none; cursor: pointer; font: inherit; color: var(--fl-ink);
  border: 1px solid var(--fl-line); border-radius: 18px; background: rgba(var(--wash-14), 0.025);
  transition: transform 0.22s cubic-bezier(.2, .7, .2, 1), border-color 0.2s, background 0.2s, box-shadow 0.25s;
}
.mp-puz:hover { transform: translateY(-3px); border-color: rgba(var(--cy-line-4), 0.35); background: rgba(var(--cy-wash-12), 0.05); }
.mp-puz[aria-pressed="true"] { border-color: var(--fl-line-hi); background: rgba(var(--cy-wash-9), 0.1); box-shadow: 0 0 0 1px rgba(var(--cy-glow-13), 0.35), 0 12px 32px rgba(var(--cy-glow-2), 0.22); }
.mp-puz-art { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border-radius: 12px; margin-bottom: 8px; background: linear-gradient(135deg, rgb(var(--surf-56)), rgb(var(--surf-22))); }
.mp-puz-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s cubic-bezier(.2, .7, .2, 1), filter 0.3s; filter: saturate(0.9) brightness(0.88); }
.mp-puz:hover .mp-puz-art img, .mp-puz[aria-pressed="true"] .mp-puz-art img { transform: scale(1.06); filter: none; }
.mp-puz-check { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: rgb(var(--onfill-1)); background: linear-gradient(135deg, rgb(var(--pri-fill-10)), rgb(var(--pri-fill-17))); box-shadow: 0 2px 12px rgba(var(--shade-1), calc(0.5 * var(--shade-k))); opacity: 0; transform: scale(0.5); transition: opacity 0.2s, transform 0.25s cubic-bezier(.3, 1.6, .5, 1); }
.mp-puz[aria-pressed="true"] .mp-puz-check { opacity: 1; transform: none; }
.mp-puz-check-ic { display: inline-flex; }
.mp-puz-name { padding: 0 4px; font-weight: 700; font-size: 0.95rem; line-height: 1.25; overflow-wrap: anywhere; }
.mp-puz-meta { padding: 0 4px; color: var(--fl-dim); font-size: 0.82rem; }
.mp-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
.mp-rule { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--fl-line); background: rgba(var(--wash-14), 0.025); }
.mp-rule-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--fl-cyan); background: rgba(var(--cy-wash-9), 0.12); border: 1px solid rgba(var(--cy-line-4), 0.22); }
.mp-rule-svg { display: inline-flex; } .mp-rule-svg svg { display: block; width: 22px; height: 22px; }
.mp-rule-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-rule-main strong { color: var(--fl-ink); font-weight: 700; }
.mp-rule-main span { color: var(--fl-dim); font-size: 0.92rem; line-height: 1.45; }
.mp-actions--bar {
  position: sticky; bottom: 10px; z-index: 5; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; padding: 12px 14px;
  border: 1px solid var(--fl-line); border-radius: 22px; background: rgba(var(--surf-16), 0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 12px 40px rgba(var(--shade-1), calc(0.55 * var(--shade-k)));
}
.mp-summary { margin: 0 auto 0 4px; display: flex; flex-direction: column; min-width: 0; flex: 1 1 10rem; line-height: 1.25; }
.mp-summary span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--fl-dim); }
.mp-summary strong { color: var(--fl-ink); font-weight: 700; overflow-wrap: anywhere; }
.mp-actions--bar .mp-btn { flex: 0 0 auto; }

@media (min-width: 640px) {
  .mp-puzzles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* (A `.mp-actions { flex-direction: column }` rule used to sit here. It only repeated the base default, but it beat
     .mp-actions--bar's row layout (same specificity, later in the file), so on tablets and desktops the Create Room bar stacked
     into a ~300px column: the "Your room" summary got a 10rem-tall box and Back / Create Room sat stacked underneath it.) */
}
@media (min-width: 760px) {
  .mp-picks { grid-template-columns: 1fr 1fr; gap: 22px; }
  .mp-rules { grid-template-columns: repeat(3, 1fr); }
  .mp-rule { flex-direction: column; }
}
@media (min-width: 980px) { .mp-puzzles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 480px) {
  .mp-actions--bar { bottom: 6px; padding: 10px; }
  .mp-actions--bar .mp-summary { flex-basis: 100%; margin: 0 0 2px 4px; }
  .mp-actions--bar .mp-btn { flex: 1 1 0; width: auto; }
  .mp-actions--bar .mp-btn--primary { flex: 2 1 0; }
  .mp-pick { min-height: 0; }
  .mp--flow .mp-input--code { font-size: 1.6rem; letter-spacing: 0.3em; text-indent: 0.3em; }
}
@media (prefers-reduced-motion: reduce) {
  .mp--flow *, .mp--flow *::before, .mp--flow *::after { animation: none !important; transition: none !important; }
  .mp-pick:hover, .mp-puz:hover { transform: none; }
}
.mp-pick-text { margin-bottom: 1.3rem; }
.mp--flow .mp-btn { white-space: nowrap; }
@media (max-width: 480px) {
  .mp-actions--bar .mp-btn { padding-inline: 0.9rem; }
  .mp-actions--bar .mp-btn--ghost { flex: 0 0 auto; }
  .mp-actions--bar .mp-btn--primary { flex: 1 1 0; }
}

/* ==========================================================================
   Stage 2 / part 1: phones (max-width 640px). Wider screens are not touched by anything below.
   - the Back circle sits beside the title instead of on its own line (the big text "Back" buttons are redundant there, so they go)
   - Play Together: Create a Room / Join a Room become two slim, fully tappable rows
   - the join and create steps lose their extra padding and spacing
   ========================================================================== */
@media (max-width: 640px) {
  .mp--flow { padding: 14px; }
  .mp-titlebar { column-gap: 10px; }
  .mp-titlebar .mp-back { grid-column: 1; grid-row: 1; margin: 0 0 0 -4px; justify-self: auto; }
  .mp-titlebar .mp-head { grid-column: 2; grid-row: 1; }
  .mp-titlebar .mp-trophy { grid-row: 1; }
  .mp-titlebar .mp-back[hidden] + .mp-head, .mp-titlebar .mp-back--close + .mp-head { grid-column: 1 / 3; }   /* no Back circle (or the leaderboard cross on the right): the title uses the space */
  .mp-titlebar .mp-back--close { grid-column: 3; margin: 0 -6px 0 0; justify-self: end; }
  .mp .mp-title, .mp--flow .mp-title { font-size: clamp(1.6rem, 7.4vw, 2.1rem); }
  .mp .mp-sub, .mp--flow .mp-sub { margin-top: 0.3rem; font-size: 0.92rem; line-height: 1.4; }
  .mp .mp-notice { margin-top: 0.7rem; }

  /* the text Back buttons duplicate the Back circle in the title row */
  .mp--flow .mp-row--center { display: none; }
  .mp--flow .mp-actions [data-act="back"] { display: none; }

  /* Play Together: two slim rows (icon, title + one line, arrow) */
  .mp-picks { gap: 10px; margin-top: 1rem; }
  .mp-pick {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "orb title cta" "orb text cta";
    align-items: center; column-gap: 14px; row-gap: 1px;
    min-height: 0; padding: 14px 14px 14px 16px; border-radius: 18px;
  }
  .mp-pick::before { inset: -60% -30% auto auto; opacity: 0.4; }
  .mp-pick-orb { grid-area: orb; width: 46px; height: 46px; margin: 0; border-radius: 14px; }
  .mp-pick-orb svg { width: 24px; height: 24px; }
  .mp-pick-title { grid-area: title; font-size: 1.4rem; align-self: end; }
  .mp-pick-text { grid-area: text; margin: 0; font-size: 0.86rem; line-height: 1.35; align-self: start; }
  .mp-pick-cta {                      /* the whole row is the button; the label stays for screen readers, the pill shrinks to an arrow */
    grid-area: cta; margin: 0; padding: 0; width: 36px; height: 36px; min-height: 0; justify-content: center; gap: 0;
  }
  .mp-pick-cta > span:not(.mp-btn-ic) { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .mp-pick:hover { transform: none; }

  /* join step */
  .mp-stage { margin-top: 1rem; padding: 16px; border-radius: 20px; }
  .mp-stage-hero { margin-bottom: 0.6rem; }
  .mp-pick-orb--sm { width: 44px; height: 44px; }
  .mp-label--center { margin-bottom: 0.4rem; }
  .mp--flow .mp-input--code { min-height: 56px; }
  .mp-actions { margin-top: 0.9rem; gap: 8px; }
  .mp--flow .mp-btn--lg { min-height: 48px; }

  /* create step */
  .mp-create { margin-top: 1rem; gap: 12px; }
  .mp-sec { padding: 14px; border-radius: 20px; }
  .mp-sec-head { margin-bottom: 0.7rem; }
  .mp--flow .mp-sec h2 { font-size: 1.35rem; }
  .mp-puzzles { gap: 10px; }
  .mp-rules { gap: 8px; }
  .mp-rule { padding: 10px 12px; gap: 12px; }
  .mp-rule-ic { width: 36px; height: 36px; }
  .mp-actions--bar { padding: 8px 8px 8px 14px; border-radius: 18px; flex-wrap: nowrap; }
  .mp-actions--bar .mp-summary { flex: 1 1 0; min-width: 0; margin: 0; }
  .mp-actions--bar .mp-btn--primary { flex: 0 0 auto; width: auto; }
}
@media (max-width: 360px) {
  .mp--flow { padding: 12px; }
  .mp-pick { column-gap: 11px; padding: 12px 10px 12px 12px; }
  .mp-pick-orb { width: 40px; height: 40px; border-radius: 12px; }
  .mp-pick-orb svg { width: 21px; height: 21px; }
  .mp-pick-title { font-size: 1.22rem; white-space: nowrap; }
  .mp-pick-text { font-size: 0.8rem; }
  .mp-pick-cta { width: 32px; height: 32px; }
  .mp .mp-title, .mp--flow .mp-title { font-size: clamp(1.45rem, 7.6vw, 1.7rem); }
}
@media (max-width: 400px) {                      /* narrow phones: the code and its Copy button must always fit on one line */
  .mp-code-box { gap: 8px; padding: 5px 5px 5px 12px; }
  .mp-code { font-size: 1.3rem; letter-spacing: 0.14em; }
  .mp .mp-code-box .mp-copy { padding: 0 0.65rem; font-size: 0.78rem; }
  .mp .mp-code-box .mp-copy-icon { display: none; }
}


/* ==========================================================================
   Stage 2 / leaderboard modal. PRESENTATION ONLY (appended; nothing above was edited).
   .mp-lb-host is the dimmed backdrop (fixed, centred), its .lb child is the dialog: a header, the difficulty filter + puzzle tabs,
   ONE scrolling list, and a footer. Only the chosen puzzle's board is ever drawn. Midnight black, charcoal, silver, electric cyan
   (the same palette as the completion card). The z-index (90) sits above the nav and profile menu and below the confirmation card (100).
   ========================================================================== */
.mp .mp-lb-host[hidden] { display: none; }
.mp .mp-lb-host:not([hidden]) {
  position: fixed; inset: 0; z-index: 90; box-sizing: border-box;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgba(var(--surf-4), 0.84); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  overscroll-behavior: contain;
  animation: lbm-fade 0.22s ease-out both;
}
.mp.mp--lb .mp-titlebar, .mp.mp--lb .mp-sub { visibility: hidden; }
/* While the modal is open the nav bar (covered by the backdrop anyway) is clipped to the screen. Without this, a nav bar that is wider than a
   412px phone (the profile button, a known earlier issue that is left as it is when the modal is closed) would widen the page and push the
   centred dialog a few pixels off-centre. */
body:has(.mp.mp--lb) .site-nav { overflow-x: clip; }   /* the dialog has its own heading; nothing of the page behind should peek through the blur */

.mp .mp-lb-host > .lb {
  --lb-gold: rgb(var(--cy-text-6)); --lb-gold-soft: rgba(var(--cy-line-3), 0.3); --lb-ivory: rgb(var(--txt-42)); --lb-muted: rgb(var(--txt-17));
  --lbm-line: rgba(var(--wash-8), 0.16);
  position: relative; margin: auto; padding: 0; overflow: hidden; text-align: left;
  display: flex; flex-direction: column;
  width: min(780px, 100%); max-height: min(820px, calc(100vh - 32px)); max-height: min(820px, calc(100dvh - 32px));
  border-radius: 22px; border: 1px solid rgba(var(--cy-line-3), 0.3);
  background: radial-gradient(90% 60% at 100% 0%, rgba(var(--cy-wash-11), 0.1), transparent 60%), linear-gradient(165deg, rgb(var(--surf-47)) 0%, rgb(var(--surf-19)) 100%);
  box-shadow: 0 30px 80px rgba(var(--shade-1), calc(0.65 * var(--shade-k))), 0 0 0 1px rgba(var(--hi-4), calc(0.03 * var(--hi-k))) inset, 0 0 60px rgba(var(--cy-glow-7), 0.16);
  animation: lbm-pop 0.34s cubic-bezier(.2, .8, .2, 1) both;
  outline: none;
}
.mp .mp-lb-host > .lb::before { display: none; }

/* header */
.lb-head { flex: none; padding: 22px 76px 12px 26px; }
.lb-head .lb-orn { margin: 0 0 8px; color: var(--pm-cyan, rgb(var(--cy-text-6))); opacity: 0.85; }
.lb-head .lb-orn svg { width: 132px; height: auto; }
.lb-eyebrow { margin: 0; font-weight: 700; font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: rgb(var(--cy-text-6)); }
.mp .lb-head .lb-title {
  margin: 2px 0 0; font: 600 clamp(1.45rem, 3.8vw, 2rem)/1.15 var(--pm-display, "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif);
  letter-spacing: 0.01em; color: rgb(var(--txt-42)); overflow-wrap: anywhere;
}
.mp .lb-x {
  appearance: none; position: absolute; top: 12px; right: 12px; z-index: 2; width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
  color: rgb(var(--txt-42)); background: rgba(var(--surf-10), 0.62); border: 1px solid rgba(var(--wash-8), 0.28);
  transition: background 0.2s, border-color 0.2s; -webkit-tap-highlight-color: transparent;
}
.mp .lb-x:hover { background: rgba(var(--cy-wash-11), 0.18); border-color: rgba(var(--cy-line-3), 0.6); }
.mp .lb-x svg { display: block; }

/* difficulty filter + puzzle tabs: the tabs scroll sideways inside their own strip, so 16 puzzles never fill the screen */
.lb-filters { flex: none; display: grid; gap: 10px; padding: 4px 26px 14px; border-bottom: 1px solid var(--lbm-line); }
.lb-levels { display: inline-flex; justify-self: start; gap: 2px; padding: 3px; border-radius: 999px; border: 1px solid var(--lbm-line); background: rgba(var(--wash-14), 0.04); max-width: 100%; }
.mp .lb-level {
  appearance: none; min-height: 36px; padding: 0 16px; border: 0; border-radius: 999px; cursor: pointer; background: transparent; color: rgb(var(--txt-17));
  font: 600 0.84rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.04em; -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, color 0.2s;
}
@media (hover: hover) { .mp .lb-level:hover { color: rgb(var(--txt-42)); } }
.mp .lb-level[aria-pressed="true"] { color: rgb(var(--onfill-2)); background: linear-gradient(135deg, rgb(var(--pri-fill-18)) 0%, rgb(var(--pri-fill-14)) 55%, rgb(var(--pri-fill-9)) 100%); }
.mp .lb-level:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 2px; }
.mp .lb-filters .lb-tabs {
  position: relative; display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; margin: 0; padding: 2px 2px 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: rgba(var(--cy-line-3), 0.35) transparent;
}
.mp .lb-filters .lb-tab {
  flex: 0 0 auto; max-width: 17rem; min-height: 40px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; scroll-snap-align: center;
  border-color: var(--lbm-line); color: rgb(var(--txt-23)); background: rgba(var(--wash-14), 0.03);
}
.mp .lb-filters .lb-tab[hidden] { display: none; }
@media (hover: hover) { .mp .lb-filters .lb-tab:hover { color: rgb(var(--txt-42)); border-color: rgba(var(--cy-line-3), 0.5); } }
.mp .lb-filters .lb-tab[aria-pressed="true"] { color: rgb(var(--txt-42)); border-color: rgba(var(--cy-line-3), 0.75); background: rgba(var(--cy-wash-11), 0.14); box-shadow: 0 0 18px rgba(var(--cy-glow-12), 0.14); }
.mp .lb-filters .lb-tab:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 2px; }

/* the ONE scrolling area */
.mp .mp-lb-host .lb-scroll {
  flex: 1 1 auto; min-height: 11rem; padding: 16px 26px 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: rgba(var(--cy-line-3), 0.35) transparent;
}
.mp .mp-lb-host .lb-scroll:focus-visible { outline-offset: -3px; }
.mp .mp-lb-host .lb-scroll::-webkit-scrollbar { width: 8px; }
.mp .mp-lb-host .lb-scroll::-webkit-scrollbar-thumb { background: rgba(var(--cy-wash-11), 0.3); border-radius: 8px; }
.mp .mp-lb-host .lb-state { margin: 1.1rem 0 0.2rem; color: rgb(var(--txt-42)); font: 600 1.15rem/1.3 var(--pm-display, "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif); }
.mp .mp-lb-host .lb-empty, .mp .mp-lb-host .lb-fail { text-align: center; padding: 0.8rem 0 1rem; }
.mp .mp-lb-host .lb .mp-help { color: rgb(var(--txt-17)); }
.lb-egg-wrap { color: rgb(var(--cy-text-6)); }
.lb .lb-egg { fill: rgba(var(--cy-text-6), 0.07); }
.lb .lb-pupil { fill: rgb(var(--ink-dark-1)); }
.mp .lb-retry {
  appearance: none; margin-top: 10px; min-height: 44px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  color: rgb(var(--onfill-2)); border: 0; background: linear-gradient(135deg, rgb(var(--pri-fill-18)) 0%, rgb(var(--pri-fill-14)) 55%, rgb(var(--pri-fill-9)) 100%); font: 700 0.95rem/1 "Nunito", "Segoe UI", system-ui, sans-serif;
}
.mp .lb-retry:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 3px; }
.lb-fail-why { margin: 0.2rem 0 0; }
.lb-skel { display: grid; gap: 8px; margin-top: 14px; }
.lb-skel i { display: block; height: 52px; border-radius: 12px; background: linear-gradient(90deg, rgba(var(--wash-14), 0.04), rgba(var(--cy-wash-11), 0.09), rgba(var(--wash-14), 0.04)); background-size: 200% 100%; animation: lbm-shimmer 1.4s linear infinite; }

/* top three */
.lb-body .lb-podium { max-width: 30rem; margin: 0 auto 1.1rem; }
.lb .lb-rib { fill: rgb(var(--cy-text-1)); }
.lb .lb-pname { color: rgb(var(--txt-42)); }
.lb .lb-ptime { color: rgb(var(--cy-text-10)); }
.lb .lb-pmoves { color: rgb(var(--txt-17)); }
.lb .lb-plinth { border-color: rgba(var(--cy-line-3), 0.28); background: linear-gradient(180deg, rgba(var(--cy-wash-11), 0.16), rgba(var(--cy-wash-11), 0.02)); color: rgba(var(--cy-text-14), 0.7); font-family: var(--pm-display, "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif); font-weight: 600; }
.lb .lb-place--1 .lb-plinth { height: 4.6rem; }
.lb .lb-place--2 .lb-plinth { height: 3.3rem; }
.lb .lb-place--3 .lb-plinth { height: 2.4rem; }
.lb .lb-place.is-mine .lb-pname { color: rgb(var(--txt-46)); }
.lb .lb-place.is-mine .lb-plinth { border-color: rgba(var(--cy-line-5), 0.85); }

/* places 4 and below: roomy rows, rank badge, time in cyan, moves quiet */
.lb .lb-you { color: rgb(var(--onfill-2)); background: rgb(var(--pri-fill-14)); font-weight: 800; }
.lb .lb-team { color: rgb(var(--txt-17)); border-color: rgba(var(--wash-8), 0.3); white-space: nowrap; }
.mp-lb-host .lb-list { max-width: none; margin: 0; padding: 0; border-top: 0; display: grid; gap: 8px; }
.mp-lb-host .lb-row {
  grid-template-columns: 2.4rem minmax(0, 1fr) auto minmax(5.2rem, auto); column-gap: 0.9rem; padding: 0.7rem 1rem 0.7rem 0.8rem; min-height: 56px;
  border: 1px solid var(--lbm-line); border-radius: 14px; background: rgba(var(--wash-14), 0.035);
}
.mp-lb-host .lb-row.is-mine { border-color: rgba(var(--cy-line-3), 0.6); background: rgba(var(--cy-wash-11), 0.1); box-shadow: 0 0 20px rgba(var(--cy-glow-12), 0.1); }
.mp-lb-host .lb-rank {
  width: 2.1rem; height: 2.1rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%;
  border: 1px solid rgba(var(--cy-line-3), 0.35); background: rgba(var(--cy-wash-11), 0.08); color: rgb(var(--cy-text-16)); font: 700 0.95rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; font-variant-numeric: tabular-nums lining-nums;
}
.mp-lb-host .lb-name { color: rgb(var(--txt-42)); font-weight: 600; }
.mp-lb-host .lb-time { color: rgb(var(--cy-text-10)); font-variant-numeric: tabular-nums lining-nums; }
.mp-lb-host .lb-moves { color: rgb(var(--txt-17)); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }

/* "Your best ..." stays in view at the bottom of the scrolling list */
.mp-lb-host .lb-mine-note {
  position: sticky; bottom: 0; margin: 12px -26px 0; padding: 12px 26px; color: rgb(var(--txt-42)); font-size: 0.94rem;
  border-top: 1px solid rgba(var(--cy-line-3), 0.3); background: linear-gradient(180deg, rgba(var(--surf-29), 0.92), rgb(var(--surf-19)));
}
.mp-lb-host .lb-body > :last-child:not(.lb-mine-note) { margin-bottom: 6px; }

/* footer */

/* tablets: a little tighter */
@media (max-width: 860px) {
  .lb-head { padding: 20px 70px 10px 22px; }
  .lb-filters { padding-inline: 22px; }
  .mp .mp-lb-host .lb-scroll { padding-inline: 22px; }
  .mp-lb-host .lb-mine-note { margin-inline: -22px; padding-inline: 22px; }
}
/* phones */
@media (max-width: 640px) {
  .mp .mp-lb-host:not([hidden]) { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .mp .mp-lb-host > .lb { width: 100%; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); border-radius: 20px; }
  .lb-head { padding: 16px 62px 8px 16px; }
  .lb-head .lb-orn svg { width: 104px; }
  .lb-filters { padding: 2px 16px 12px; gap: 8px; }
  .lb-levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); justify-self: stretch; }
  .mp .lb-level { padding: 0 4px; min-height: 40px; }
  .mp .lb-filters .lb-tab { max-width: 13rem; }
  .mp .mp-lb-host .lb-scroll { padding: 12px 16px 0; min-height: 9rem; }
  .mp-lb-host .lb-mine-note { margin-inline: -16px; padding-inline: 16px; }
  .mp-lb-host .lb-row { grid-template-columns: 2.1rem minmax(0, 1fr) auto; column-gap: 0.7rem; row-gap: 0; padding: 0.6rem 0.8rem 0.6rem 0.6rem; }
  .mp-lb-host .lb-rank { grid-row: 1 / span 2; align-self: center; width: 2rem; height: 2rem; }
  .mp-lb-host .lb-who { grid-column: 2; grid-row: 1; }
  .mp-lb-host .lb-time { grid-column: 3; grid-row: 1; }
  .mp-lb-host .lb-moves { grid-column: 2 / 4; grid-row: 2; text-align: left; }
  .lb .lb-place--1 .lb-plinth { height: 3.8rem; }
  .lb .lb-place--2 .lb-plinth { height: 2.8rem; }
  .lb .lb-place--3 .lb-plinth { height: 2rem; }
}
@media (max-width: 360px) {
  .lb .lb-place .lb-team { padding: 0 0.3rem; font-size: 0.62rem; letter-spacing: 0.02em; white-space: nowrap; }   /* "TEAM OF 2" stays on one line in the narrow podium cells */
  .lb-head { padding-right: 56px; }
  .mp .lb-level { font-size: 0.78rem; letter-spacing: 0; }
}
/* touch screens: every control is at least 44px */
@media (pointer: coarse) { .mp .lb-level, .mp .lb-filters .lb-tab { min-height: 44px; } }
/* short landscape phones / small windows: the dialog scrolls as a whole, and the extras fold away */
@media (max-height: 520px) {
  .mp .mp-lb-host > .lb { overflow-y: auto; }
  .mp .mp-lb-host .lb-scroll { flex: none; overflow: visible; min-height: 0; }
  .mp-lb-host .lb-mine-note { position: static; }
  .lb-head .lb-orn { display: none; }
  .lb-head { padding-top: 12px; }
}

@keyframes lbm-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbm-pop { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes lbm-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .mp .mp-lb-host:not([hidden]), .mp .mp-lb-host > .lb, .lb-skel i { animation: none !important; }
  .mp .lb-level, .mp .lb-x { transition: none; }
}


/* ==========================================================================
   Find a Room (multiplayer discovery, stage 1). APPENDED: nothing above was edited.
   - the third Play Together card (same silver treatment as "Join a Room"; three columns on wide screens, a slim row on phones)
   - the "List in Find a Room" tick on the create step (OFF by default)
   - the compact room list: puzzle, host, players, Join. Midnight black / charcoal / silver / restrained cyan like the rest.
   ========================================================================== */
.mp-pick--find::before { background: radial-gradient(circle, rgba(var(--wash-12), 0.16), transparent 65%); }
.mp-pick--find .mp-pick-orb { color: rgb(var(--txt-37)); border-color: rgba(var(--wash-12), 0.3); background: linear-gradient(150deg, rgba(var(--wash-12), 0.14), rgba(var(--wash-12), 0.03)); box-shadow: 0 0 26px rgba(var(--hi-3), calc(0.1 * var(--hi-k))), inset 0 1px 0 rgba(var(--hi-4), calc(0.12 * var(--hi-k))); }
.mp-pick--find .mp-pick-cta { background: rgba(var(--wash-14), 0.06); color: rgb(var(--txt-43)); border-color: rgba(var(--wash-12), 0.32); box-shadow: none; }
.mp-pick--find:hover .mp-pick-cta { background: rgba(var(--cy-wash-11), 0.12); border-color: rgba(var(--cy-line-3), 0.55); box-shadow: 0 8px 24px rgba(var(--cy-glow-7), 0.2); }
@media (min-width: 760px) {
  .mp-picks--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .mp-picks--3 .mp-pick { padding-inline: 20px; }
  .mp-picks--3 .mp-pick-title { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
}

/* create step: the listing tick */
.mp-listing {
  display: flex; align-items: flex-start; gap: 14px; margin-top: 10px; padding: 14px 16px; min-height: 44px; cursor: pointer;
  border: 1px solid var(--fl-line); border-radius: 16px; background: rgba(var(--wash-14), 0.025); transition: border-color 0.2s, background 0.2s;
}
.mp-listing:hover { border-color: rgba(var(--cy-line-4), 0.35); }
.mp-listing:has(.mp-check:checked) { border-color: var(--fl-line-hi); background: rgba(var(--cy-wash-9), 0.1); }
.mp-listing-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mp-listing-main strong { color: var(--fl-ink); font-weight: 700; }
.mp-listing-help { color: var(--fl-dim); font-size: 0.92rem; line-height: 1.45; }
.mp-check {
  -webkit-appearance: none; appearance: none; flex: none; display: grid; place-content: center; width: 24px; height: 24px; margin: 1px 0 0; cursor: pointer;
  border-radius: 8px; border: 1.5px solid rgba(var(--wash-8), 0.5); background: rgba(var(--surf-3), 0.7); transition: background 0.2s, border-color 0.2s;
}
.mp-check::after { content: ""; width: 12px; height: 7px; border-left: 2.5px solid rgb(var(--surf-24)); border-bottom: 2.5px solid rgb(var(--surf-24)); transform: rotate(-45deg) translate(1px, -1px) scale(0); transition: transform 0.18s ease; }
.mp-check:checked { background: linear-gradient(135deg, rgb(var(--pri-fill-10)), rgb(var(--pri-fill-17))); border-color: rgba(var(--pri-line-3), 0.6); }
.mp-check:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.mp-check:focus-visible { outline: 2px solid var(--fl-cyan); outline-offset: 3px; }
.mp-rule.is-public { border-color: rgba(var(--cy-line-4), 0.4); }

/* the room list */
.mp-find { margin-top: 1.2rem; display: grid; gap: 12px; }
.mp-find-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.mp-find-status { margin: 0; min-width: 0; color: var(--fl-dim); font-size: 0.92rem; overflow-wrap: anywhere; }
.mp-find-status.is-error { color: rgb(var(--red-text-7)); }
.mp .mp-find-bar .mp-find-refresh { flex: 0 0 auto; width: auto; min-height: 44px; }   /* (a phone-wide .mp-btn rule would otherwise stretch it and squeeze the status text into a column) */
.mp-find-bar .mp-find-status { flex: 1 1 auto; }
.mp-find-note { margin: 0; color: rgb(var(--red-text-7)); font-size: 0.88rem; overflow-wrap: anywhere; }   /* only if the list of your own rooms could not be read */
.mp-find-note:empty { display: none; }
.mp-find-refresh .mp-spin { border-color: rgba(var(--wash-14), 0.25); border-top-color: var(--fl-cyan); }
.mp-rooms { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mp-room {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  border: 1px solid var(--fl-line); border-radius: 16px; background: linear-gradient(170deg, rgba(var(--surf-55), 0.6), rgba(var(--surf-18), 0.85)); box-shadow: 0 8px 22px rgba(var(--shade-1), calc(0.3 * var(--shade-k)));
}
.mp-room-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mp-room-puzzle { color: var(--fl-ink); font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-room-title { display: flex; align-items: center; gap: 8px; min-width: 0; }   /* YOUR ROOM rows only: the name, then the label beside it */
.mp-room-title .mp-room-puzzle { flex: 0 1 auto; min-width: 0; }
.mp-room-badge {
  flex: none; padding: 1px 7px; border-radius: 999px; border: 1px solid rgba(var(--cy-line-4), 0.28); background: rgba(var(--cy-wash-9), 0.07);
  color: var(--fl-dim); font-size: 0.62rem; font-weight: 600; letter-spacing: 0.1em; line-height: 1.5; white-space: nowrap;
}   /* quiet on purpose: small, dim, outlined, never a filled button-like pill */
.mp-room-host { color: var(--fl-dim); font-size: 0.86rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-room-count {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 0.9rem; color: rgb(var(--txt-37)); font-variant-numeric: tabular-nums;
  border: 1px solid rgba(var(--cy-line-4), 0.25); background: rgba(var(--cy-wash-9), 0.1);
}
.mp-room-ic { display: inline-flex; } .mp-room-ic svg { display: block; width: 16px; height: 16px; }
.mp-room-join { min-height: 44px; padding-inline: 1.2rem; }
.mp-rooms-empty { display: flex; flex-direction: column; gap: 4px; align-items: center; text-align: center; padding: 26px 18px; border: 1px dashed rgba(var(--wash-8), 0.3); border-radius: 18px; color: var(--fl-dim); }
.mp-rooms-empty strong { color: var(--fl-ink); }
.mp-actions--find { flex-direction: row; justify-content: flex-start; margin-top: 0.4rem; }
@media (max-width: 640px) {
  .mp-actions--find { display: none; }              /* the Back circle in the title row does this on phones (same as the other steps) */
  .mp-find { margin-top: 0.9rem; gap: 10px; }
  .mp-listing { padding: 12px 14px; }
}
@media (max-width: 480px) {
  .mp-room { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main join" "count join"; row-gap: 6px; column-gap: 10px; padding: 10px 10px 10px 14px; }
  .mp-room-main { grid-area: main; }
  .mp-room-count { grid-area: count; justify-self: start; }
  .mp-room-join { grid-area: join; align-self: center; padding-inline: 1.05rem; }
  .mp-room-puzzle { white-space: normal; overflow-wrap: anywhere; }
  .mp-room-title { flex-wrap: wrap; row-gap: 3px; }
}

/* =====================================================================
   JOIN APPROVAL: the host's "Join requests" panel, the live notification, the requester's waiting screen
   ===================================================================== */
.mp-reqs { display: grid; gap: 10px; }
.mp-reqs-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mp-reqs-head h2 { margin: 0; }
.mp-reqs-list { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 14px 0 10px; cursor: pointer; color: var(--fl-dim, rgb(var(--txt-18))); font-size: 0.92rem; font-weight: 600;
  border: 1px solid var(--fl-line, rgba(var(--wash-8), 0.16)); border-radius: 999px; background: rgba(var(--wash-14), 0.025); transition: border-color .2s, color .2s; }
.mp-reqs-list:hover { border-color: rgba(var(--cy-line-4), 0.35); color: var(--fl-ink, rgb(var(--txt-43))); }
.mp-reqs-list:has(.mp-check:checked) { color: var(--fl-ink, rgb(var(--txt-43))); border-color: rgba(var(--cy-line-4), 0.45); }
.mp-reqs-list .mp-check { margin: 0; width: 22px; height: 22px; }
.mp-reqs-list .mp-check:disabled { opacity: 0.5; cursor: not-allowed; }
.mp-reqs-note { margin: 0; color: var(--fl-dim, rgb(var(--txt-18))); font-size: 0.92rem; line-height: 1.45; }
.mp-reqs-note:empty { display: none; }
.mp-reqs-note.is-error { color: rgb(var(--red-text-7)); }
.mp-reqs-items, .mp-reqs-blist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mp-reqs-items:empty { display: none; }
.mp-req { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; padding: 10px 10px 10px 16px; border-radius: 16px;
  border: 1px solid rgba(var(--cy-line-4), 0.38); background: linear-gradient(170deg, rgba(var(--surf-67), 0.65), rgba(var(--surf-18), 0.9)); box-shadow: 0 8px 24px rgba(var(--shade-1), calc(0.32 * var(--shade-k))), 0 0 0 1px rgba(var(--cy-glow-13), 0.06) inset;
  animation: mp-req-in .28s ease both; }
.mp-req-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mp-req-name { color: var(--fl-ink, rgb(var(--txt-43))); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-req-left { color: var(--fl-dim, rgb(var(--txt-18))); font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.mp-req-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.mp .mp-req-actions .mp-btn { width: auto; min-height: 44px; padding-inline: 1.1rem; }
.mp-req-ask { color: var(--fl-ink, rgb(var(--txt-43))); font-size: 0.92rem; font-weight: 600; margin-right: 4px; }
.mp .mp-btn--danger { background: rgba(var(--red-solid-6), 0.18); border-color: rgba(var(--red-6), 0.5); color: rgb(var(--red-text-10)); }
.mp .mp-btn--danger:hover:not(:disabled) { background: rgba(var(--red-solid-6), 0.3); border-color: rgba(var(--red-10), 0.8); }
.mp-reqs-blocked { border-top: 1px solid var(--fl-line, rgba(var(--wash-8), 0.16)); padding-top: 8px; }
.mp-reqs-blocked summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; color: var(--fl-dim, rgb(var(--txt-18))); font-size: 0.9rem; font-weight: 600; }
.mp-reqs-blocked summary:hover { color: var(--fl-ink, rgb(var(--txt-43))); }
.mp-reqs-blist { margin-top: 6px; }
.mp-blocked { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 14px; border: 1px solid var(--fl-line, rgba(var(--wash-8), 0.16)); color: var(--fl-ink, rgb(var(--txt-43))); }
.mp-blocked .mp-btn { width: auto; min-height: 40px; }
.mp-reqs-none { color: var(--fl-dim, rgb(var(--txt-18))); font-size: 0.9rem; padding: 4px 2px; }
@keyframes mp-req-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* live notification (host): a small pill at the bottom of the screen, above the page, never over the puzzle controls for long */
.mp-reqtoasts { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; width: min(24rem, calc(100vw - 24px)); pointer-events: none; }
.mp-reqtoast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; min-height: 52px; border-radius: 999px;
  border: 1px solid rgba(var(--cy-line-4), 0.5); background: linear-gradient(170deg, rgba(var(--surf-57), 0.96), rgba(var(--surf-11), 0.97)); color: var(--fl-ink, rgb(var(--txt-43))); font-size: 0.94rem;
  box-shadow: 0 14px 36px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 22px rgba(var(--cy-glow-13), 0.14); animation: mp-req-in .3s ease both; }
.mp-reqtoast-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--fl-cyan, rgb(var(--pri-fill-15))); box-shadow: 0 0 0 0 rgba(var(--pri-glow-6), 0.6); animation: mp-req-pulse 1.8s ease-out infinite; }
.mp-reqtoast-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.mp-reqtoast-go { flex: none; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer; font: inherit; font-weight: 700; color: rgb(var(--onfill-1));
  border: 1px solid rgba(var(--pri-line-3), 0.6); background: linear-gradient(135deg, rgb(var(--pri-fill-10)), rgb(var(--pri-fill-17))); }
.mp-reqtoast-go:hover { filter: brightness(1.08); }
.mp-reqtoast-go:focus-visible { outline: 2px solid var(--fl-cyan, rgb(var(--cy-line-4))); outline-offset: 3px; }
@keyframes mp-req-pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--cy-glow-13), 0.55); } 70% { box-shadow: 0 0 0 10px rgba(var(--cy-glow-13), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--cy-glow-13), 0); } }

/* short confirmation after Copy / Share ("Room code copied", "Invitation link copied", "Invitation shared"): a small pill at the bottom of the
   screen, so it is seen on a phone even when the buttons have scrolled away or only show an icon */
.mp-flashes { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 72; display: grid; justify-items: center; width: min(24rem, calc(100vw - 24px)); pointer-events: none; }
.mp-flashes:empty { display: none; }
.mp-flash { display: inline-flex; align-items: center; gap: 10px; max-width: 100%; padding: 10px 18px; min-height: 44px; border-radius: 999px; box-sizing: border-box;
  border: 1px solid rgba(var(--cy-line-4), 0.5); background: linear-gradient(170deg, rgba(var(--surf-57), 0.96), rgba(var(--surf-11), 0.97)); color: var(--fl-ink, rgb(var(--txt-43))); font-size: 0.94rem; line-height: 1.3;
  box-shadow: 0 14px 36px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 22px rgba(var(--cy-glow-13), 0.14); animation: mp-req-in .22s ease both; }
.mp-flash-ic { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--fl-cyan, rgb(var(--pri-fill-15))); color: rgb(var(--onfill-1)); font-size: 0.8rem; font-weight: 800; line-height: 1; }
@media (prefers-reduced-motion: reduce) { .mp-flash { animation: none; } }

/* the requester's waiting screen */
.mp-wait { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 28px 20px 22px; }
.mp-wait h2 { margin: 0; }
.mp-wait-text { margin: 0; color: var(--fl-dim, rgb(var(--txt-18))); max-width: 26rem; line-height: 1.5; }
.mp-wait-orb { position: relative; width: 56px; height: 56px; border-radius: 50%; margin-bottom: 4px; background: radial-gradient(circle at 35% 30%, rgb(var(--pri-fill-21)), rgb(var(--pri-fill-7)) 70%); box-shadow: 0 0 26px rgba(var(--pri-glow-6), 0.3); }
.mp-wait-orb::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 1.5px solid rgba(var(--cy-line-4), 0.5); animation: mp-wait-ring 1.8s ease-out infinite; }
.mp-wait-orb.is-done { background: radial-gradient(circle at 35% 30%, rgb(var(--wash-1)), rgb(var(--surf-71)) 70%); box-shadow: none; }
.mp-wait-orb.is-done::after { animation: none; opacity: 0; }
@keyframes mp-wait-ring { from { transform: scale(0.85); opacity: 0.9; } to { transform: scale(1.35); opacity: 0; } }
.mp-actions--wait { margin-top: 8px; justify-content: center; }
.mp .mp-actions--wait .mp-btn { width: auto; min-width: 12rem; }

@media (max-width: 520px) {
  .mp-req { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .mp-req-actions { justify-content: stretch; }
  .mp .mp-req-actions .mp-btn { flex: 1 1 7rem; }
  .mp .mp-req-actions .mp-btn--quiet { flex: 0 0 auto; }
  .mp-reqtoasts { bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .mp-req, .mp-reqtoast { animation: none; }
  .mp-reqtoast-dot, .mp-wait-orb::after { animation: none; }
}


/* room code actions: Copy + Share (Share is icon-only on phones) */
.mp-code-actions { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.mp .mp-code-box .mp-share .mp-copy-icon { display: inline-flex; opacity: 0.85; }
.mp .mp-share .mp-copy-done { white-space: nowrap; }
@media (max-width: 600px) {
  .mp .mp-code-box .mp-share { width: 38px; min-width: 38px; padding: 0; }
  .mp .mp-code-box .mp-share .mp-share-label { display: none; }
  .mp .mp-code-box .mp-share .mp-copy-icon svg { width: 17px; height: 17px; }
}
@media (max-width: 400px) {
  .mp-code-actions { gap: 5px; }
  .mp .mp-code-box .mp-share { width: 36px; min-width: 36px; }
}


/* ==========================================================================
   Phase 3: the active room (Play with friends), a calmer dark-fantasy layout.
   Everything is scoped to .mp--room (set by render() only while a room is on screen), so the menus, the leaderboard, the solo page,
   the homepage and the navigation are untouched. Presentation only: no behaviour, permission or sync rule lives here.
   Type: Fredoka for the title and the puzzle name, Nunito for everything the player reads or taps.
   Scale: title 2.2rem / puzzle name 1.9rem / body 0.95rem / quiet labels 0.78rem. Space: 12 / 20 / 28 px.
   Alignment: one centred column; the board is the widest, brightest thing in it.
   ========================================================================== */
.mp--room .mp-wrap { max-width: 54rem; }
@media (min-width: 1100px) {
  .mp--room .mp-chat-fab, .mp--room .mp-chat-mini { left: calc(50% + 27rem + 16px); }   /* 27rem = half of the 54rem room column */
}

/* header: Back | centred title | trophy, on one row */
.mp--room .mp-titlebar { grid-template-columns: 56px minmax(0, 1fr) 56px; column-gap: 8px; }
.mp--room .mp-titlebar .mp-back { grid-column: 1; grid-row: 1; margin: 0 0 0 -4px; justify-self: start; }
.mp--room .mp-titlebar .mp-head { grid-column: 2; grid-row: 1; text-align: center; font-size: clamp(1.7rem, 4.6vw, 2.3rem); letter-spacing: 0.02em; }
.mp--room .mp-titlebar .mp-trophy { grid-column: 3; grid-row: 1; justify-self: end; }
.mp--room .mp-sub:empty { display: none; }
.mp--room .mp-notice { margin-top: 0.8rem; }

/* room card: code, then players. One border for the whole card, none around the rows inside it */
.mp--room .mp-roomcard { position: relative; margin-top: 20px; padding: 18px clamp(14px, 3vw, 28px) 20px; text-align: center; border-radius: 22px; }
.mp--room .mp-roomcard-top { display: flex; align-items: center; justify-content: center; position: relative; min-height: 36px; margin-bottom: 4px; }
.mp--room .mp-roomcard-top .mp-label { margin: 0; font-size: 0.78rem; letter-spacing: 0.12em; color: rgb(var(--txt-9)); }
.mp--room .mp-info-btn {
  position: absolute; right: -6px; top: -4px; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: rgb(var(--txt-16)); cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}
.mp--room .mp-info-btn svg { display: block; }
.mp--room .mp-info-btn:hover, .mp--room .mp-info-btn[aria-expanded="true"] { color: rgb(var(--cy-text-11)); background: rgba(var(--cy-wash-11), 0.1); }
.mp--room .mp-info-btn:focus-visible, .mp--room .mp-info-close:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 1px; }
.mp--room .mp-code-box { width: fit-content; max-width: 100%; margin: 0 auto; gap: 16px; padding: 6px 6px 6px 20px; justify-content: center; border-radius: 16px; background: rgba(var(--surf-3), 0.5); border-color: rgba(var(--wash-8), 0.14); }
.mp--room .mp-code { flex: 0 1 auto; margin-right: -0.2em; }   /* the letter-spacing leaves a gap after the last letter: pull the buttons in by the same amount */

/* players: quiet chips in a wrapping, centred row */
.mp--room .mp-players-wrap { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(var(--wash-8), 0.1); }
.mp--room .mp-players-wrap h2 { margin: 0 0 10px; font: 600 0.78rem/1.2 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.12em; color: rgb(var(--txt-9)); }
.mp--room .mp-players { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.mp--room .mp-players li { min-height: 40px; padding: 0.3rem 0.8rem; gap: 4px 8px; flex-wrap: nowrap; border: 0; border-radius: 999px; background: rgba(var(--wash-14), 0.045); }
.mp--room .mp-pname { flex: 0 1 auto; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.mp--room .mp-tag { padding: 0.05rem 0.5rem; font-size: 0.68rem; letter-spacing: 0.05em; }
.mp--room .mp-warn { margin-top: 12px; font-size: 0.88rem; }
.mp--room .mp-status { margin-top: 8px; font-size: 0.85rem; }
.mp--room .mp-status:empty { display: none; }

/* the information popover: anchored under the code, over the players */
.mp--room .mp-info-pop {
  position: absolute; z-index: 20; right: 14px; top: 52px;       /* hangs from the info icon */
  width: min(26rem, calc(100% - 28px)); max-height: min(82vh, 32rem); overflow: auto; overscroll-behavior: contain;
  padding: 16px 18px 12px; text-align: left; border: 1px solid rgba(var(--cy-line-4), 0.28); border-radius: 18px;
  background: linear-gradient(180deg, rgba(var(--surf-44), 0.98), rgba(var(--surf-14), 0.98));
  box-shadow: 0 22px 54px rgba(var(--shade-1), calc(0.65 * var(--shade-k))), 0 0 0 1px rgba(var(--hi-4), calc(0.03 * var(--hi-k))) inset;
  animation: mp-pop-in .16s ease-out both;
}
.mp--room .mp-info-pop[hidden] { display: none; }
@keyframes mp-pop-in { from { opacity: .4; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.mp--room .mp-info-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.mp--room .mp-info-head h2 { margin: 0; font-size: 1.35rem; }
.mp--room .mp-info-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; margin-right: -8px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: rgb(var(--txt-21)); cursor: pointer; }
.mp--room .mp-info-close:hover { color: rgb(var(--txt-46)); background: rgba(var(--wash-14), 0.07); }
.mp--room .mp-info-sec { padding: 12px 0 14px; border-top: 1px solid rgba(var(--wash-8), 0.12); }
.mp--room .mp-info-sec:first-of-type { border-top: 0; }
.mp--room .mp-info-sec h3 { margin: 0 0 4px; font: 700 0.9rem/1.3 "Nunito", "Segoe UI", system-ui, sans-serif; color: rgb(var(--cy-text-11)); letter-spacing: 0.01em; }
.mp--room .mp-info-sec p { margin: 0; font-size: 0.92rem; line-height: 1.55; color: rgb(var(--txt-27)); }

/* join requests (host only): the same behaviour, a lighter panel */
.mp--room .mp-reqs { margin-top: 12px; padding: 12px clamp(14px, 3vw, 22px); border-radius: 18px; background: rgba(var(--surf-38), 0.5); box-shadow: none; gap: 8px; }
.mp--room .mp-reqs-head h2 { font-size: 1.15rem; }
.mp--room .mp-reqs-list { min-height: 40px; font-size: 0.86rem; }
.mp--room .mp-reqs-note { font-size: 0.86rem; }
.mp--room .mp-reqs-blocked { border-top: 0; padding-top: 0; }
.mp--room .mp-reqs-blocked summary { min-height: 32px; font-size: 0.84rem; font-weight: 500; }

/* desktop: the panel sits below the board (js moves it there; on phones / tablets it stays above) */
.mp--room .mp-board + .mp-reqs { margin-top: 20px; }

/* host-only puzzle switch: one slim row directly above the puzzle */
.mp--room .mp-switch { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin: 20px auto 0; }
.mp--room .mp-switch[hidden] { display: none; }
.mp--room .mp-switch-label { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; color: rgb(var(--txt-9)); }
.mp--room .mp-switch .mp-select { flex: 0 1 22rem; min-width: 0; min-height: 40px; padding: 0.35rem 2rem 0.35rem 0.85rem; border-radius: 999px; font-size: 0.9rem; border-color: rgba(var(--wash-8), 0.2); background-color: rgba(var(--surf-38), 0.7); }
.mp--room .mp-switch-go { width: auto; min-height: 40px; padding: 0 1.1rem; border-radius: 999px; font-size: 0.9rem; font-weight: 600; }
.mp--room .mp-switch-go.is-switch { border-color: rgba(var(--cy-line-3), 0.55); background: rgba(var(--cy-wash-8), 0.2); color: rgb(var(--txt-44)); }
.mp--room .mp-switch + .mp-board { margin-top: 12px; }

/* the puzzle: the largest, most luminous thing on the screen */
.mp--room .mp-board { margin-top: 20px; }
.mp--room .mp-board .dragon-puzzle {
  padding: clamp(14px, 3vw, 28px); border-radius: 24px; border-color: rgba(var(--cy-line-3), 0.16);
  box-shadow: 0 24px 70px rgba(var(--shade-1), calc(0.55 * var(--shade-k))), 0 0 60px rgba(var(--cy-glow-4), 0.09);
}
.mp--room .dragon-puzzle.is-net .dp-head { max-width: none; text-align: center; }
.mp--room .dragon-puzzle.is-net .dp-title { font-size: clamp(1.6rem, 4vw, 2.2rem); }
.mp--room .dragon-puzzle.is-net .dp-lede { margin: 0.4rem auto 0; max-width: 34rem; font-size: 0.92rem; color: rgb(var(--txt-20)); }
/* one centred column at every width: board, then the toolbar, then the progress (the solo page keeps its side column) */
.mp--room .dragon-puzzle.is-net.has-toolbar:not(.is-narrow):not(.is-fs) .dp-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; row-gap: 14px; }
.mp--room .dragon-puzzle.is-net.has-toolbar:not(.is-narrow):not(.is-fs) .dp-boardwrap { grid-column: 1; grid-row: 1; }
.mp--room .dragon-puzzle.is-net.has-toolbar:not(.is-narrow):not(.is-fs) .dp-toolbar { grid-column: 1; grid-row: 2; }
.mp--room .dragon-puzzle.is-net.has-toolbar:not(.is-narrow):not(.is-fs) .dp-side { grid-column: 1; grid-row: 3; align-self: start; padding-top: 0; }
.mp--room .dragon-puzzle.is-net .dp-toolbar { width: min(100%, 38rem); margin-inline: auto; }
.mp--room .dragon-puzzle.is-net .dp-side { width: min(100%, 38rem); margin-inline: auto; }
.mp--room .dragon-puzzle.is-net .dp-progress { align-self: stretch; width: 100%; border: 0; background: none; padding: 4px 4px 0; }
.mp--room .dragon-puzzle.is-net .dp-status:empty { display: none; }

/* leave: a quiet, centred text button */
.mp--room .mp-leave-row { display: flex; justify-content: center; margin-top: 28px; }
/* Leave room: a clear red exit button (door + arrow icon). Same click behaviour as before: it asks "Do you really want to leave?" first. */
.mp .mp-btn.mp-btn--leave {
  width: auto; min-width: 11rem; min-height: 48px; padding: 0 1.5rem 0 1.25rem; gap: 0.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid rgba(var(--red-10), 0.6);
  background: linear-gradient(180deg, rgb(var(--red-solid-7)) 0%, rgb(var(--red-solid-2)) 100%); color: rgb(var(--txt-46));
  font: 700 0.98rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.02em; text-decoration: none;
  box-shadow: 0 6px 18px rgba(var(--red-solid-2), 0.38), inset 0 1px 0 rgba(var(--hi-4), calc(0.2 * var(--hi-k)));
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.mp .mp-btn.mp-btn--leave:hover:not(:disabled) {
  background: linear-gradient(180deg, rgb(var(--red-1)) 0%, rgb(var(--red-solid-3)) 100%); border-color: rgba(var(--red-11), 0.85); color: rgb(var(--txt-46));
  transform: translateY(-1px); box-shadow: 0 9px 24px rgba(var(--red-solid-4), 0.5), inset 0 1px 0 rgba(var(--hi-4), calc(0.26 * var(--hi-k)));
}
.mp .mp-btn.mp-btn--leave:active:not(:disabled) { transform: translateY(0) scale(0.98); box-shadow: 0 3px 10px rgba(var(--red-solid-2), 0.4), inset 0 2px 4px rgba(var(--shade-1), calc(0.25 * var(--shade-k))); }
.mp .mp-btn.mp-btn--leave:focus-visible { outline: 2px solid rgb(var(--red-12)); outline-offset: 3px; }
.mp-leave-ic { display: inline-flex; flex: none; } .mp-leave-ic svg { display: block; }
.mp-leave-text { white-space: nowrap; }
@media (max-width: 640px) {
  .mp--room .mp-leave-row { margin-top: 22px; }
  .mp .mp-btn.mp-btn--leave { width: 100%; max-width: 22rem; min-height: 52px; }   /* a full-width, easy-to-hit target on phones */
}
@media (prefers-reduced-motion: reduce) { .mp .mp-btn.mp-btn--leave, .mp .mp-btn.mp-btn--leave:hover:not(:disabled), .mp .mp-btn.mp-btn--leave:active:not(:disabled) { transition: none; transform: none; } }

@media (max-width: 640px) {
  .mp--room { padding: 14px 12px 20px; }
  .mp--room .mp-titlebar { grid-template-columns: 48px minmax(0, 1fr) 48px; }
  .mp--room .mp-titlebar .mp-trophy { width: 44px; height: 44px; }
  .mp--room .mp-titlebar .mp-head { font-size: clamp(1.45rem, 6.8vw, 1.8rem); }
  .mp--room .mp-roomcard { margin-top: 14px; padding: 14px 12px 16px; border-radius: 20px; }
  .mp--room .mp-info-btn { right: -4px; }
  .mp--room .mp-info-pop { top: 50px; right: 6px; left: 6px; width: auto; }
  .mp--room .mp-players li { min-height: 38px; padding-inline: 0.65rem; }
  .mp--room .mp-switch { margin-top: 16px; }
  .mp--room .mp-switch-label { flex: 0 0 100%; text-align: center; }
  .mp--room .mp-switch .mp-select { flex: 1 1 100%; }
  .mp--room .mp-switch-go { flex: 1 1 100%; }
  .mp--room .mp-board { margin-top: 14px; }
  .mp--room .mp-board .dragon-puzzle { padding: 12px; border-radius: 20px; }
}
@media (prefers-reduced-motion: reduce) { .mp--room .mp-info-pop { animation: none; } }


/* ==========================================================================
   Update 2 - room chat while the board is full screen (desktop). js/multiplayer.js parks the chat dock INSIDE the full-screen board
   element for as long as it is full screen (only that element is visible then), so the Chat button and panel can be used without exiting.
   ========================================================================== */
.mp-chatdock--fs .mp-chat-fab, .mp-chatdock--fs .mp-chat-mini,
.mp--room .mp-chatdock--fs .mp-chat-fab, .mp--room .mp-chatdock--fs .mp-chat-mini {
  left: auto; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60;
}
.mp-chatdock--fs .mp-card.mp-chat {
  z-index: 61; width: min(22rem, calc(100vw - 32px));
  right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom));
  height: min(30rem, calc(100vh - 100px)); height: min(30rem, calc(100dvh - 100px));
}
.dragon-puzzle.is-fs > .mp-toasts { z-index: 62; }

/* Host only: the small Remove button on a player's row (the server decides who may remove; this is just the button) */
.mp .mp-players .mp-remove { flex: none; width: auto; min-height: 34px; padding: 0.15rem 0.75rem; font-size: 0.8rem; }

/* First visit to a room: one small "the puzzle is further down" arrow (js/multiplayer.js, showScrollHint). A 44px tap target around a 34px
   round glass button with a down chevron that bobs gently; it fades in a moment after the room opens, sits low in the middle of the window
   (under the join-request toasts, away from the Chat button) and is removed as soon as the player scrolls, taps it or reaches the puzzle. */
.mp-scrollhint {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  width: 44px; height: 44px; margin: 0 0 0 -22px; padding: 0; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
  opacity: 0; animation: mp-hint-in 0.5s ease 0.5s forwards;
}
.mp-scrollhint-dot {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  color: var(--fl-cyan, rgb(var(--cy-text-8)));
  border: 1px solid rgba(var(--cy-line-4), 0.4);
  background: rgba(var(--surf-20), 0.78);
  box-shadow: 0 6px 18px rgba(var(--shade-1), calc(0.4 * var(--shade-k))), 0 0 14px rgba(var(--cy-glow-13), 0.12);
  animation: mp-hint-bob 1.9s ease-in-out 1.2s infinite;
}
.mp-scrollhint:hover .mp-scrollhint-dot { border-color: rgba(var(--cy-line-4), 0.7); }
.mp-scrollhint:focus-visible { outline: 2px solid var(--fl-cyan, rgb(var(--cy-line-4))); outline-offset: 1px; border-radius: 50%; }
@keyframes mp-hint-in { from { opacity: 0; } to { opacity: 0.92; } }
@keyframes mp-hint-bob { 0%, 100% { transform: translateY(-2px); } 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) {
  .mp-scrollhint { animation: none; opacity: 0.92; }
  .mp-scrollhint-dot { animation: none; }
}

/* ==========================================================================
   Update 9 - room chat on phones: full-screen chat icon, a shorter panel while the keyboard is up, a Send button that visibly lights up
   ========================================================================== */

/* (a) Full screen on phones / tablets (js: .mp-chatdock--fs-compact + the icon button inside the puzzle's control bar). The floating
   "Chat" pill is replaced by the icon-only button next to Shuffle / Reveal / Sound; it keeps the unread badge. */
.mp-chatdock--fs-compact .mp-chat-fab { display: none; }
.mp-fs-chat { position: relative; }
.mp-fs-chat .mp-chat-badge { position: absolute; top: -5px; right: -5px; }
.dragon-puzzle.is-fs .mp-fs-chat svg { pointer-events: none; }
/* the minimised bar (only after "Minimize") becomes a small round icon above the control bar instead of a pill over it */
.mp-chatdock--fs-compact .mp-chat-mini {
  left: auto; right: max(12px, env(safe-area-inset-right)); bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  width: 44px; padding: 0; gap: 0; z-index: 60;
}
.mp-chatdock--fs-compact .mp-chat-mini-label { display: none; }
.mp-chatdock--fs-compact .mp-chat-mini .mp-chat-badge { position: absolute; top: -5px; right: -5px; }
/* phones: the same bottom sheet as outside full screen (the desktop full-screen rule above would make it a floating box) */
@media (max-width: 600px) {
  .mp-chatdock--fs.mp-chatdock--fs-compact .mp-card.mp-chat {
    left: 0; right: 0; width: auto; border-radius: var(--mp-r-lg) var(--mp-r-lg) 0 0; border-bottom: 0;
    bottom: var(--mp-kb, 0px); height: min(21rem, 50vh); height: min(21rem, 50dvh);
    padding-bottom: env(safe-area-inset-bottom, 0px); transform: translateY(100%);
  }
  .mp-chatdock--fs.mp-chatdock--fs-compact .mp-card.mp-chat.is-open { transform: none; }
}

/* (b) Keyboard up (js adds .is-kb to the panel and sets --mp-vvh = the height visible above the keyboard): the panel shrinks to the
   header, about one message and the box, and never takes more than (visible height - 7.5rem), so a part of the puzzle stays visible
   behind it. Keyboard closed = no .is-kb = the normal panel, unchanged. */
.mp-card.mp-chat.is-kb,
.mp-chatdock--fs .mp-card.mp-chat.is-kb,
.mp-chatdock--fs.mp-chatdock--fs-compact .mp-card.mp-chat.is-kb {
  height: min(13rem, max(10.25rem, calc(var(--mp-vvh, 100dvh) - 7.5rem)));
}
.mp-card.mp-chat.is-kb .mp-chat-head { padding: 2px 6px 2px 14px; }
.mp-card.mp-chat.is-kb .mp-chat-tool { width: 40px; height: 40px; }
.mp-card.mp-chat.is-kb .mp-chat-list { padding: 8px 12px; gap: 8px; }
.mp-card.mp-chat.is-kb .mp-chat-form { margin: 6px 10px 8px; }

/* (c) Send: dim while there is nothing to send, clearly lit once there is. The lit look no longer depends on :hover (a phone has none):
   brighter fill, bright rim and a soft glow, the same colours the button already used on hover. */
.mp .mp-chat-send { transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, opacity .18s ease; }
.mp .mp-chat-send:disabled { opacity: 0.5; box-shadow: none; }
.mp .mp-chat-send:not(:disabled) {
  background: rgb(var(--pri-fill-4)); border-color: rgba(var(--pri-line-1), 0.85);
  box-shadow: 0 0 0 1px rgba(var(--pri-glow-5), 0.25), 0 4px 16px rgba(var(--pri-glow-1), 0.5), 0 0 14px rgba(var(--pri-glow-5), 0.35);
}
.mp .mp-chat-send:not(:disabled):active { transform: scale(0.96); }
@media (prefers-reduced-motion: reduce) { .mp .mp-chat-send { transition: none; } }

/* ==========================================================================
   Update 10 - phones: notifications in full screen, seat dots on big boards
   ========================================================================== */

/* (a) A chat notification in full screen on a phone / tablet used to land on top of the pieces-in-place counter (top left) and half of the
   Exit button (top right) for four seconds, and, being tappable, could block them. It now appears BELOW that header row, centred. */
.mp-toasts.mp-toasts--fs-compact {
  top: calc(env(safe-area-inset-top, 0px) + 64px);
  right: 50%; transform: translateX(50%); align-items: center;
  width: min(19rem, calc(100vw - 24px));
}

/* (b) Seat dots: on a phone a board of 64 or more pieces has squares of about 42px or less, and a dot on every moved piece clutters it. The
   decorative on-board dots are hidden there (boards of 25 / 36 / 49 pieces and every desktop board keep them). Who is who stays visible in
   the Players list (coloured "Player 1 / 2" tags), the chat notifications ("P1") and the chat messages. */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .dragon-puzzle.has-many .dp-marks,
  .dragon-puzzle.has-many .dp-piece > .dp-mark { display: none; }
}

/* Share: one share sheet at a time (the button is ignored while a sheet is open) */
.mp .mp-copy.is-sharing { opacity: 0.6; cursor: progress; }

/* ---- host-only Browse Puzzles: neutral (not red); now placed beside New game above the puzzle (see below) ---- */
.mp--room .mp-leave-row { flex-direction: column; align-items: center; gap: 12px; }
.mp .mp-btn.mp-btn--browse {
  width: auto; min-width: 11rem; min-height: 48px; padding: 0 1.5rem 0 1.25rem; gap: 0.6rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid rgba(var(--cy-line-4), 0.45);
  background: rgba(var(--cy-wash-11), 0.08); color: rgb(var(--txt-39));
  font: 700 0.98rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.02em; text-decoration: none;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.mp .mp-btn.mp-btn--browse:hover:not(:disabled) { background: rgba(var(--cy-wash-11), 0.16); border-color: rgba(var(--cy-line-3), 0.7); transform: translateY(-1px); }
.mp .mp-btn.mp-btn--browse:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.mp .mp-btn.mp-btn--browse:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 3px; }
@media (max-width: 640px) { .mp .mp-btn.mp-btn--browse { width: 100%; max-width: 22rem; min-height: 52px; } }

/* Browse Puzzles now sits beside New game / Switch puzzle in the host's Puzzle row above the board (see renderHostControls). Same pill size as that button. */
.mp--room .mp-switch-btns { display: flex; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 8px 10px; }
.mp--room .mp-switch .mp-btn.mp-btn--browse { width: auto; min-width: 0; max-width: none; min-height: 40px; padding: 0 1.1rem 0 0.95rem; gap: 0.45rem; font-size: 0.9rem; font-weight: 600; white-space: nowrap; }
.mp--room .mp-switch .mp-btn--browse .mp-leave-ic svg { width: 18px; height: 18px; }
@media (max-width: 640px) {
  .mp--room .mp-switch-btns { flex: 1 1 100%; width: 100%; }
  .mp--room .mp-switch-btns > .mp-btn { flex: 1 1 0; min-width: 0; width: auto; min-height: 44px; padding-inline: 0.7rem; }
  .mp--room .mp-switch .mp-btn.mp-btn--browse { width: auto; max-width: none; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .mp .mp-btn.mp-btn--browse, .mp .mp-btn.mp-btn--browse:hover:not(:disabled), .mp .mp-btn.mp-btn--browse:active:not(:disabled) { transition: none; transform: none; } }

.mp-confirm-box.mp-browse-box { max-width: 46rem; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.mp-browse-grid { margin-top: 14px; }
.mp-browse-row { margin-top: 16px; position: sticky; bottom: 0; }
@media (min-width: 980px) { .mp-browse-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* room-status toasts ("You left the room.", "New game started"): same pill as the copy confirmations, with an "i" mark; wraps instead of clipping on phones */
.mp-flash--info { border-radius: 18px; text-align: left; }
.mp-flash--info .mp-flash-ic { font-family: Georgia, "Times New Roman", serif; font-style: italic; }

/* ---- Leaderboard polish: medals, time prominence, podium / row consistency ----
   Added last so it wins over the earlier .lb rules. Colours only; no layout of the dialog changes.
   Medals: gold / silver / bronze discs. Each theme has its own shades so all three stay apart on the dark panel AND on the cream one.
   This block is the ONLY place that colours the medals (the older token-based medal rules were removed: in the light theme every gold-text-* token is
   the same ink colour, so they could not keep gold and bronze apart). */
.lb {
  --medal-gold-1: #ffd75e;  --medal-gold-2: #b98300;  --medal-gold-ink: #3b2800;
  --medal-silver-1: #eef2f8; --medal-silver-2: #8f9bad; --medal-silver-ink: #1f2733;
  --medal-bronze-1: #e0955a; --medal-bronze-2: #8f4a1c; --medal-bronze-ink: #2e1405;
  --medal-glow: 0.55;
  --lb-time-color: rgb(var(--cy-text-10));
}
:root[data-theme="light"] .lb {
  --medal-gold-1: #f2b705;  --medal-gold-2: #8a5a00;  --medal-gold-ink: #2e1d00;
  --medal-silver-1: #c3ccd8; --medal-silver-2: #56637a; --medal-silver-ink: #121a28;
  --medal-bronze-1: #c4723a; --medal-bronze-2: #6a3010; --medal-bronze-ink: #fff4e6;
  --medal-glow: 0.35;
  --lb-time-color: rgb(var(--cy-text-10));
}
.lb .lb-medal--1 { --m1: var(--medal-gold-1);   --m2: var(--medal-gold-2);   --mn: var(--medal-gold-ink); }
.lb .lb-medal--2 { --m1: var(--medal-silver-1); --m2: var(--medal-silver-2); --mn: var(--medal-silver-ink); }
.lb .lb-medal--3 { --m1: var(--medal-bronze-1); --m2: var(--medal-bronze-2); --mn: var(--medal-bronze-ink); }
.lb .lb-m-n { fill: var(--mn, rgb(var(--ink-dark-2))); }
.lb .lb-medal--1 svg { filter: drop-shadow(0 0 5px rgba(255, 200, 40, var(--medal-glow))) drop-shadow(0 3px 4px rgba(var(--shade-1), calc(0.45 * var(--shade-k)))); }
.lb .lb-medal--2 svg { filter: drop-shadow(0 0 4px rgba(190, 205, 225, var(--medal-glow))) drop-shadow(0 3px 4px rgba(var(--shade-1), calc(0.45 * var(--shade-k)))); }
.lb .lb-medal--3 svg { filter: drop-shadow(0 0 4px rgba(214, 120, 50, var(--medal-glow))) drop-shadow(0 3px 4px rgba(var(--shade-1), calc(0.45 * var(--shade-k)))); }
/* a thin dark rim keeps a pale silver / yellow gold disc readable on the cream (light) panel */
:root[data-theme="light"] .lb .lb-m-a { stroke: rgba(40, 24, 8, 0.55); stroke-width: 0.8; }

/* the podium plinths take a hint of their medal colour (the 1 / 2 / 3 under each place) */
.lb .lb-place--1 .lb-plinth { border-color: color-mix(in srgb, var(--medal-gold-1) 55%, transparent); }
.lb .lb-place--2 .lb-plinth { border-color: color-mix(in srgb, var(--medal-silver-2) 60%, transparent); }
.lb .lb-place--3 .lb-plinth { border-color: color-mix(in srgb, var(--medal-bronze-1) 55%, transparent); }
.lb .lb-place.is-mine .lb-plinth { border-color: rgba(var(--cy-line-5), 0.85); }

/* time = the headline number, moves = quiet. Podium (.lb-ptime / .lb-pmoves) and places 4+ (.lb-time / .lb-moves) share one look. */
.lb .lb-ptime, .mp-lb-host .lb-time {
  color: var(--lb-time-color);   /* (the font stays the project's time font, set in typography.css) */
  font-weight: 700; letter-spacing: 0.01em; line-height: 1.1; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap;
}
.lb .lb-ptime { margin-top: 2px; font-size: 1.45rem; }
.mp-lb-host .lb-time { font-size: 1.35rem; text-align: right; min-width: 3.4rem; }
.lb .lb-pmoves, .mp-lb-host .lb-moves { font-size: 0.78rem; font-weight: 500; letter-spacing: 0.02em; color: rgb(var(--txt-17)); font-variant-numeric: tabular-nums lining-nums; }
.lb .lb-pmoves { margin-bottom: 2px; }
.mp-lb-host .lb-moves { min-width: 4.4rem; text-align: right; }
/* places 4+: same name weight and vertical centring as the podium cards */
.mp-lb-host .lb-row { align-items: center; }
.mp-lb-host .lb-name { font-size: 0.98rem; }
@media (max-width: 640px) {
  .lb .lb-ptime { font-size: 1.2rem; }
  .mp-lb-host .lb-time { font-size: 1.25rem; min-width: 0; }
  .mp-lb-host .lb-moves { text-align: left; min-width: 0; font-size: 0.76rem; }
}
.lb .lb-medal svg { width: 46px; height: 62px; }
.lb .lb-place--1 .lb-medal svg { width: 52px; height: 70px; }


/* ==========================================================================
   Leaderboard layout refinement (appended; earlier rules untouched).
   - meta line centred under the (left-aligned) title
   - podium: three equal columns, identical info areas, plinth heights unchanged
   - names wrap to two lines; YOU / TEAM badges live in their own row
   - exact-time tooltip on the m:ss time (hover, keyboard focus, tap)
   - places 4+: names + badges left, time prominent right, moves quiet
   ========================================================================== */

/* podium: equal columns, 2nd - 1st - 3rd order kept, every column built from the same fixed areas */
.mp-lb-host .lb-body .lb-podium {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; justify-content: stretch;
  gap: clamp(6px, 2vw, 14px); max-width: 30rem; width: 100%; margin: 0 auto 1.1rem; padding-top: 0.2rem;
}
.mp-lb-host .lb-podium .lb-place { flex: none; width: auto; min-width: 0; position: relative; padding-top: 18px; gap: 0; }   /* 18px = crown slot, same in all three */
.mp-lb-host .lb-podium .lb-place--1 { order: 2; }
.mp-lb-host .lb-podium .lb-place--2 { order: 1; }
.mp-lb-host .lb-podium .lb-place--3 { order: 3; }
.mp-lb-host .lb-podium--1, .mp-lb-host .lb-podium--2 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mp-lb-host .lb-podium--1 .lb-place--1 { grid-column: 2; }
.lb-place .lb-crown { position: absolute; top: 0; left: 50%; margin: 0; transform: translateX(-50%); }
.lb .lb-place .lb-medal { height: 70px; display: flex; align-items: center; justify-content: center; }
.lb-pname-box { align-self: stretch; height: 2.5em; margin-top: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.95rem; line-height: 1.25; }
.lb-pname-box .lb-pname { margin: 0; max-width: 100%; text-align: center; font-size: inherit; line-height: inherit; }
.lb-place .lb-badges { align-self: stretch; min-height: 1.6rem; margin-top: 2px; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 2px 4px; }
.lb-badges .lb-you, .lb-badges .lb-team { margin: 2px 0 0; white-space: nowrap; }
.lb .lb-place .lb-ptime { margin-top: 4px; }
.lb .lb-place .lb-pmoves { margin-bottom: 0; }

/* time buttons: look like the plain time, add a tooltip with the exact time */
.lb .lb-tt {
  position: relative; display: inline-block; margin: 0; padding: 0; border: 0; border-radius: 4px; background: none; cursor: help;
  font-family: var(--ty-mono); -webkit-tap-highlight-color: transparent; -webkit-appearance: none; appearance: none;
  text-decoration: underline dotted rgba(var(--wash-8), 0.45); text-underline-offset: 0.2em; text-decoration-thickness: 1px;
}
.lb .lb-tt::after {
  content: attr(data-exact); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
  padding: 3px 8px; border-radius: 8px; border: 1px solid rgba(var(--cy-line-3), 0.6); background: rgb(var(--surf-19)); color: rgb(var(--txt-42));
  font: 600 0.85rem/1.3 var(--ty-mono); letter-spacing: 0.02em; white-space: nowrap; pointer-events: none; box-shadow: 0 6px 18px rgba(var(--shade-1), 0.35);
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease;
}
.lb .lb-time.lb-tt::after { left: auto; right: 0; transform: none; }          /* rows: tooltip ends at the right edge, never clipped */
@media (hover: hover) { .lb .lb-tt:hover::after { opacity: 1; visibility: visible; } }
.lb .lb-tt:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 3px; }
.lb .lb-tt:focus-visible::after, .lb .lb-tt.is-open::after { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) { .lb .lb-tt::after { transition: none; } }

/* places 4+: fixed columns so every time lines up; name (2 lines max) + badges left */
.mp-lb-host .lb-who { display: flex; flex-direction: column; align-items: flex-start; flex-wrap: nowrap; gap: 3px; }
.mp-lb-host .lb-name {
  max-width: 100%; white-space: normal; overflow: hidden; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lb-row .lb-badges { display: flex; flex-wrap: wrap; gap: 2px 6px; }
.lb-row .lb-badges .lb-you, .lb-row .lb-badges .lb-team { margin: 0; }
.mp-lb-host .lb-row .lb-time { justify-self: end; }
@media (min-width: 641px) {
  .mp-lb-host .lb-row { grid-template-columns: 2.4rem minmax(0, 1fr) 5.6rem 4.8rem; }
}
@media (max-width: 640px) {
  .mp-lb-host .lb-row { grid-template-columns: 2.1rem minmax(0, 1fr) auto; }
  .mp-lb-host .lb-moves { margin-top: 2px; }
}
/* narrow phones: podium badges may need two lines, so every column reserves two */
@media (max-width: 480px) {
  .lb-place .lb-badges { min-height: 3.1rem; }
  .lb-pname-box { font-size: 0.85rem; }
}


/* ==========================================================================
   Leaderboard layout refinement (appended; no earlier rule was edited).
   - recorded-games line centred under the (left-aligned) title
   - podium: three equal columns, 2nd-1st-3rd, one identical info layout per column, plinth heights unchanged
   - names wrap to at most two lines; YOU / TEAM badges live in their own row so they never move the name or the time
   - m:ss times are buttons: hover / keyboard focus / tap shows the exact time (data-exact, m:ss.mmm) in a small bubble
   - places 4+: names + badges left, time prominent in a fixed right column, moves small and secondary
   ========================================================================== */

/* podium */
.lb-body .lb-podium {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; justify-content: stretch;
  gap: clamp(6px, 2vw, 14px); max-width: 34rem; margin: 0 auto 1.1rem; border-bottom: 1px solid var(--lb-gold-soft);
}
.lb-podium--1 { grid-template-columns: minmax(0, 1fr); max-width: 11.5rem; }
.lb-podium--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 23rem; }
.lb-place { position: relative; flex: none; width: 100%; box-sizing: border-box; padding-top: 18px; gap: 0; text-align: center; }
.lb-place--1 { order: 0; grid-column: 2; }
.lb-place--2 { order: 0; grid-column: 1; }
.lb-place--3 { order: 0; grid-column: 3; }
.lb-podium--2 .lb-place--1 { grid-column: 2; }
.lb-podium--1 .lb-place--1 { grid-column: 1; }
.lb-place .lb-crown { position: absolute; top: 0; left: 50%; margin: 0; transform: translateX(-50%); }
.lb .lb-medal { width: 100%; height: 70px; display: flex; align-items: center; justify-content: center; }
.lb-pname-box { width: 100%; height: 2.5rem; margin-top: 4px; display: flex; align-items: center; justify-content: center; }
.lb .lb-pname { margin: 0; padding: 0 2px; font-size: 0.95rem; text-align: center; max-width: 100%; }
.lb-badges { width: 100%; min-height: 1.2rem; margin-top: 4px; display: flex; flex-wrap: wrap; align-content: flex-start; justify-content: center; gap: 4px; }
.lb-badges .lb-you, .lb-badges .lb-team { margin: 0; }
.lb .lb-ptime { margin-top: 4px; }
.lb .lb-pmoves { margin-bottom: 0; padding-bottom: 2px; }
.lb .lb-plinth { margin-top: 8px; }
@media (max-width: 480px) {
  .lb-badges { min-height: 2.5rem; }
  .lb .lb-pname { font-size: 0.92rem; }
}

/* names + badges in places 4+ */
.mp-lb-host .lb-who { display: flex; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 4px; }
.mp-lb-host .lb-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; text-overflow: clip;
  overflow-wrap: anywhere; line-height: 1.25; max-width: 100%;
}
.mp-lb-host .lb-row .lb-badges { width: auto; min-height: 0; margin: 0; justify-content: flex-start; }
@media (min-width: 641px) {
  .mp-lb-host .lb-row { grid-template-columns: 2.4rem minmax(0, 1fr) 5.5rem 4.8rem; }
  .mp-lb-host .lb-time { min-width: 0; justify-self: end; }
  .mp-lb-host .lb-moves { min-width: 0; text-align: right; }
}
@media (max-width: 640px) {
  .mp-lb-host .lb-row { grid-template-columns: 2.1rem minmax(0, 1fr) 4.8rem; }
  .mp-lb-host .lb-time { justify-self: end; align-self: start; }
}
.mp-lb-host .lb-scroll { padding-bottom: 16px; }

/* precise-time tooltip */
.lb .lb-tt {
  position: relative; appearance: none; -webkit-appearance: none; background: none; border: 0; margin: 0; padding: 0; border-radius: 4px;
  cursor: pointer; text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 5px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); -webkit-tap-highlight-color: transparent;
}
.lb .lb-tt:focus-visible { outline: 2px solid rgb(var(--cy-line-5)); outline-offset: 3px; }
.lb .lb-tt::after {
  content: attr(data-exact); position: absolute; z-index: 20; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(3px);
  padding: 0.3rem 0.6rem; border-radius: 8px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.14s ease, transform 0.14s ease;
  font: 600 0.85rem/1.2 var(--ty-mono, ui-monospace, monospace); letter-spacing: 0.02em; text-decoration: none; font-variant-numeric: tabular-nums lining-nums;
  color: rgb(var(--txt-42)); background: rgb(var(--surf-19)); border: 1px solid rgba(var(--cy-line-3), 0.7); box-shadow: 0 6px 18px rgba(var(--shade-1), 0.35);
}
.lb .lb-time.lb-tt::after { left: auto; right: 0; transform: translateY(3px); }
.lb .lb-tt:focus-visible::after, .lb .lb-tt.is-open::after { opacity: 1; transform: translateX(-50%); }
.lb .lb-time.lb-tt:focus-visible::after, .lb .lb-time.lb-tt.is-open::after { transform: none; }
@media (hover: hover) {
  .lb .lb-tt:hover::after { opacity: 1; transform: translateX(-50%); }
  .lb .lb-time.lb-tt:hover::after { transform: none; }
}
@media (prefers-reduced-motion: reduce) { .lb .lb-tt::after { transition: none; } }


/* ==========================================================================
   Leaderboard refinement 2 (appended; the old meta-line and footer rules were removed above).
   - header block centred (ornament, LEADERBOARD label, title, All/Sweet/Sour/Spicy group); the puzzle-name strip is NOT touched
   - the dialog has a FIXED height (and width): only the entries area scrolls, so it never grows or shrinks between puzzles
   - YOU badge: small gem-and-pill in the cyan palette; TEAM badge shares its height; neither can widen a podium column
   - places 4+: name + badges left, time prominent right, moves small and quiet under it
   ========================================================================== */

/* fixed outer size */
.mp .mp-lb-host > .lb { height: min(660px, calc(100vh - 32px)); height: min(660px, calc(100dvh - 32px)); }
@media (max-width: 640px) {
  .mp .mp-lb-host > .lb { height: min(660px, calc(100vh - 20px)); height: min(660px, calc(100dvh - 20px)); }
}
/* tighter vertical rhythm (same design, less air) */
.mp .mp-lb-host .lb-head { padding-top: 16px; padding-bottom: 8px; }
.mp .mp-lb-host .lb-head .lb-orn { margin-bottom: 5px; }
.mp .mp-lb-host .lb-filters { gap: 8px; padding-bottom: 8px; }
.mp .mp-lb-host .lb-filters .lb-tabs { padding-bottom: 4px; }
.mp .mp-lb-host .lb-scroll { padding-top: 10px; }
.mp .mp-lb-host .lb-body { min-height: 0; }
.mp-lb-host .lb-body .lb-podium { margin-bottom: 0.8rem; }
.mp-lb-host .lb-list { gap: 6px; }

/* centred header: equal side padding (the close button sits in it), so the centre is the dialog's true centre */
.mp .mp-lb-host .lb-head { padding-inline: 76px; text-align: center; }
.mp .mp-lb-host .lb-head .lb-orn { display: flex; justify-content: center; margin: 0 auto 8px; }
@media (max-width: 860px) { .mp .mp-lb-host .lb-head { padding-inline: 70px; } }
@media (max-width: 640px) { .mp .mp-lb-host .lb-head { padding-inline: 62px; } }
@media (max-width: 380px) { .mp .mp-lb-host .lb-head { padding-inline: 56px; } }
@media (min-width: 641px) { .mp .mp-lb-host .lb-filters .lb-levels { justify-self: center; } }   /* phones: the four chips already span the full width */

/* YOU / TEAM badges: same height, never wider than their column */
.mp-lb-host .lb .lb-you, .mp-lb-host .lb .lb-team {
  display: inline-flex; align-items: center; box-sizing: border-box; height: 1.2rem; margin: 0; line-height: 1; max-width: 100%; white-space: nowrap;
}
.mp-lb-host .lb .lb-team { padding: 0 0.5rem; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: calc(1.2rem - 2px); }
.mp-lb-host .lb .lb-you {
  flex: none; gap: 0.38rem; padding: 0 0.6rem 0 0.5rem; border-radius: 999px;
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgb(var(--cy-text-10));
  background: linear-gradient(180deg, rgba(var(--cy-wash-11), 0.36), rgba(var(--cy-wash-11), 0.12));
  border: 1px solid rgba(var(--cy-line-3), 0.8);
  box-shadow: inset 0 1px 0 rgba(var(--hi-4), calc(0.2 * var(--hi-k))), 0 0 9px rgba(var(--cy-glow-12), 0.2);
}
.mp-lb-host .lb .lb-you::before {               /* the same little diamond as the header ornament */
  content: ""; flex: none; width: 5px; height: 5px; transform: rotate(45deg); background: currentColor; box-shadow: 0 0 5px currentColor; opacity: 0.9;
}

/* places 4+: [rank] [name + badges] [time over moves] */
.mp-lb-host .lb-list .lb-row {
  grid-template-columns: 2.4rem minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 0.9rem; row-gap: 0; align-items: center;
}
.mp-lb-host .lb-list .lb-rank { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.mp-lb-host .lb-list .lb-who { grid-column: 2; grid-row: 1 / span 2; align-self: center; min-width: 0; }
.mp-lb-host .lb-list .lb-time {
  grid-column: 3; grid-row: 1; justify-self: end; align-self: end; min-width: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.15; letter-spacing: 0.01em;
}
.mp-lb-host .lb-list .lb-moves {
  grid-column: 3; grid-row: 2; justify-self: end; align-self: start; min-width: 0; margin-top: 2px; text-align: right; font-size: 0.74rem; line-height: 1.2; opacity: 0.9;
}
@media (max-width: 640px) {
  .mp-lb-host .lb-list .lb-row { grid-template-columns: 2rem minmax(0, 1fr) auto; column-gap: 0.7rem; }
  .mp-lb-host .lb-list .lb-time { font-size: 1.15rem; }
}

/* empty puzzle ("No records yet"): centred vertically as well as horizontally in the entries area */
.mp-lb-host .lb-scroll { display: flex; flex-direction: column; }
.mp-lb-host .lb-scroll > .lb-body { flex: 1 0 auto; }
.mp-lb-host .lb-body:has(> .lb-empty) { display: flex; flex-direction: column; justify-content: center; }
.mp-lb-host .lb-body > .lb-empty { padding: 0; }

/* mode badge under the puzzle title: these are multiplayer room results */
.mp .mp-lb-host .lb-head .lb-mode {
  display: inline-flex; align-items: center; box-sizing: border-box; max-width: 100%; margin: 8px 0 0; padding: 0 0.8rem; height: 1.45rem;
  border: 1px solid rgba(var(--cy-line-3), 0.5); border-radius: 999px; background: rgba(var(--cy-wash-11), 0.07);
  color: rgb(var(--cy-text-6)); font: 700 0.62rem/1 "Nunito", "Segoe UI", system-ui, sans-serif; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap;
}
@media (max-width: 380px) { .mp .mp-lb-host .lb-head .lb-mode { letter-spacing: 0.1em; padding: 0 0.6rem; } }
