/* Lobby + countdown. Colors, tiles, buttons and the backdrop come from /shared/theme.css. */

/* Every rule here starts with :where([data-styles~="game"]): the game's screens are all on one page (app.html), with
   every screen's stylesheet loaded, and that keeps this one's rules to the screens that name it in their data-styles.
   (:where adds no weight, so the rules count for just what they did before it. A rule for the screen itself has no
   space after it.) */

:where([data-styles~="game"]) {
  /* Prevent zoom and touch issues */
  touch-action: manipulation;
  -webkit-touch-callout: none;
  /* iPhones (Safari and the app) only know the prefixed one. Fine here: none of the pages using this file has
     a text box. */
  -webkit-user-select: none;
  user-select: none;
}

:where([data-styles~="game"]) .mute {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(12px + env(safe-area-inset-right, 0px));
  z-index: 100;
}

/* Left of the mute button, on the lobby screen only */
:where([data-styles~="game"]) .lobby-help {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: calc(64px + env(safe-area-inset-right, 0px));
  z-index: 100;
}
:where([data-styles~="game"]):not(.lobby) .lobby-help { display: none; }
/* A very narrow screen (a phone zoomed in, or with the largest text): just its "?" circle, as the home page's account
   button is on a phone, so it never covers 🏠 - the way out. Its words stay, unseen, for screen readers. The same on a
   small phone on its side, where the lobby's header comes up level with it (below): it would cover the room's code. */
@media (max-width: 300px), (orientation: landscape) and (max-height: 500px) and (min-width: 560px) and (max-width: 639px) {
  :where([data-styles~="game"]) .help-btn.lobby-help { width: 44px; padding: 0; gap: 0; justify-content: center; font-size: 0; }
}

/* (Not ".home" - that's the home page's body class from theme.css) */
:where([data-styles~="game"]) .home-btn {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: calc(12px + env(safe-area-inset-left, 0px));
  z-index: 100;
}


/* Lobby */

/* From the top down, not centred: the room's code and the header stay put as players come and go, and only what's
   under the list moves, gliding (lobby.js). A fifth of the way down - about the middle of a short phone's screen, and
   clear of the toasts (--toast-top). */
:where([data-styles~="game"]) .lobby-wrapper {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  padding: calc(clamp(120px, 20vh, 180px) + env(safe-area-inset-top, 0px)) 16px calc(32px + env(safe-area-inset-bottom, 0px));
  padding-top: calc(clamp(120px, 20svh, 180px) + env(safe-area-inset-top, 0px));
}

:where([data-styles~="game"]) .lobby-head {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

/* Five across on even the narrowest screen */
:where([data-styles~="game"]) .code-tiles {
  --tile-size: min(46px, calc((100vw - 56px) / 5));
  display: flex;
  gap: 6px;
}

@media (min-width: 600px) {
  :where([data-styles~="game"]) .code-tiles { --tile-size: 56px; gap: 8px; }
}

/* (Not ".lobby" - that's the body's screen class from theme.css) */
:where([data-styles~="game"]) .lobby-card {
  width: 100%;
  max-width: 440px;
  padding: 16px;
  display: grid;
  gap: 12px;
}

/* Lives inside the card so the Start button never moves when the text changes */
:where([data-styles~="game"]) .status {
  justify-self: center;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--you-bg);
  color: var(--you);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

/* The lobby until the server first says who's here (app.html - lobby.js takes it away): grey shapes the size of the
   status line and the ready button (a .skel-block is a button's height and corners already), two players' rows with
   grey bars where a name, wins and a status go, and how many players in the line above the room code */
:where([data-styles~="game"]) .lobby-skel.skel-pill { --w: 15em; --h: calc(13px * 1.3 + 14px); justify-self: center; }
:where([data-styles~="game"]) .player-pill .player-name .skel { --w: 6em; }
:where([data-styles~="game"]) .player-pill + .player-pill .player-name .skel { --w: 4.5em; }
:where([data-styles~="game"]) .player-pill .wins .skel { --w: 2.2em; }
:where([data-styles~="game"]) .player-pill > .skel-pill { --w: 78px; --h: 20px; }
:where([data-styles~="game"]) .lobby-head .eyebrow .skel { --w: 8em; }

/* As wide as the card, not as the longest name would like - a long one is cut short instead (.player-name) */
:where([data-styles~="game"]) .players {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

:where([data-styles~="game"]) .player-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 6px 12px 6px 8px;
  border-radius: 12px;
  background: var(--field);
  font-weight: 700;
  font-size: 15px;
}

/* The narrowest screens (a phone zoomed in, or with the largest text): a little closer together - and too narrow for
   it all side by side, which squeezed the name to nothing and ran off the screen. So the name has the first line,
   beside the picture, and the rest goes under it on the right. */
@media (max-width: 300px) {
  :where([data-styles~="game"]) .player-pill { gap: 6px; padding-left: 6px; padding-right: 8px; }
  :where([data-styles~="game"]) .player-pill:not(.empty) { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
  :where([data-styles~="game"]) .player-pill .player-name { flex: 1 1 calc(100% - 50px); }
  :where([data-styles~="game"]) .player-pill .wins { margin-left: 0; }
}

:where([data-styles~="game"]) .player-pill.you { background: var(--you-bg); }
/* Their connection dropped - their place is kept for a little while. (Each row stays from one change to the next, so
   this fades.) */
:where([data-styles~="game"]) .player-pill { transition: opacity 0.3s ease; }
:where([data-styles~="game"]) .player-pill.away { opacity: 0.5; }
/* Come while the game was out of sight: they come in once it's back (lobby.js) */
:where([data-styles~="game"]) .player-pill.arriving { opacity: 0; transition: none; }

:where([data-styles~="game"]) .player-pill.empty {
  background: transparent;
  border: 2px dashed var(--field-line);
  color: var(--ink-muted);
  font-weight: 600;
  padding-left: 14px;
}

:where([data-styles~="game"]) .player-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:where([data-styles~="game"]) .you-badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--you);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* Wins in this lobby */
:where([data-styles~="game"]) .wins {
  flex: none;
  margin-left: auto;
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Not ready, ready or in game */
:where([data-styles~="game"]) .player-status {
  flex: none;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
:where([data-styles~="game"]) .player-status.notReady { background: var(--field-line); color: var(--ink-muted); }
:where([data-styles~="game"]) .player-status.ready { background: var(--good-bg); color: var(--good-ink); }
:where([data-styles~="game"]) .player-status.inGame { background: var(--warn-bg); color: var(--warn-ink); }

:where([data-styles~="game"]) #readyBtn { width: 100%; }

/* A phone on its side (in a browser - the app stays upright): the lobby from the very top, its header smaller, and the
   card wider and shorter - two players to a row - so I'm ready is on the screen without scrolling */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  :where([data-styles~="game"]) .lobby-wrapper {
    gap: 12px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
  }
  :where([data-styles~="game"]) .lobby-head { gap: 8px; }
  :where([data-styles~="game"]) .lobby-head .code-tiles { --tile-size: 40px; gap: 6px; }
  :where([data-styles~="game"]) .lobby-card { max-width: 600px; }
  :where([data-styles~="game"]) .players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* "Leave this lobby?" - and solo's "Stop this run?" and Daily Jam's "Leave this word?", which are made the same way: a
   card up from the bottom (/shared/sheet.css), with what's in it in the middle */

:where([data-styles~="game"]) .leave-card { text-align: center; }
:where([data-styles~="game"]) .leave-card > .sheet-body { gap: 10px; padding-top: 12px; }

:where([data-styles~="game"]) .leave-card h2 {
  margin: 0;
  font-weight: 800;
  font-size: 22px;
}

:where([data-styles~="game"]) .leave-note {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-muted);
}

:where([data-styles~="game"]) .leave-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}


/* "Reconnecting…" while the connection is down (lobby.js), so it doesn't look like the game froze. At the bottom,
   clear of the buttons and the game's header along the top - and above the overlays, which wait on it too. */
:where([data-styles~="game"]) .reconnecting {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 300;
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(30, 27, 46, 0.94);
  border: 1px solid var(--glass-line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
:where([data-styles~="game"]) .reconnecting .spinner { margin-right: 8px; vertical-align: -0.2em; }

/* It, and the overlays below, fade out rather than cutting out (lobby.js): already hidden, still seen for a moment -
   and not in the way of anything under them */
:where([data-styles~="game"]) .reconnecting.fading-out[hidden] { display: block !important; pointer-events: none; }
:where([data-styles~="game"]) .overlay.fading-out[hidden] { display: grid !important; pointer-events: none; }


/* Full-screen overlays: the countdown, and "open in another tab" */

:where([data-styles~="game"]) .overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  background: rgba(16, 14, 24, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

:where([data-styles~="game"]) .overlay-text {
  margin: 0;
  font-weight: 800;
  font-size: 24px;
}

:where([data-styles~="game"]) .count-num {
  font-weight: 900;
  font-size: clamp(110px, 32vw, 200px);
  line-height: 1;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* Each number zooms in and dims as its second goes - and stays dimmed until the next (it used to spring back to full
   for the last tenth of a second, a blink on every beat). GO! comes in the same way but stays at full, until the round
   (or the run) is there under it: then it bursts as the dim lifts (lobby.js, solo/js/run.js). */
:where([data-styles~="game"]) .count-num.tick { animation: countIn 0.9s cubic-bezier(0.2, 0.9, 0.25, 1.2) both; }
:where([data-styles~="game"]) .count-num.tick.go { animation: goIn 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.2) both; }

/* Reduce Motion: plain numbers at full strength, each fading in (the scripts). (theme.css only makes animations
   instant, which would leave every number stuck at its dimmed end.) */
/* Less motion: the phone's Reduce Motion, or the switch in Settings (html.reduce-motion - /shared/settings.js) */
html.reduce-motion :where([data-styles~="game"]) .count-num.tick, html.reduce-motion :where([data-styles~="game"]) .count-num.tick.go { animation: none; }

@keyframes countIn {
  0% { opacity: 0; transform: scale(1.8); }
  25% { opacity: 1; transform: scale(1); }
  85% { opacity: 1; }
  100% { opacity: 0.35; transform: scale(0.9); }
}

@keyframes goIn {
  0% { opacity: 0; transform: scale(1.8); }
  25%, 100% { opacity: 1; transform: none; }
}

/* The 3-2-1's last row: a room's Not ready, and the line that says it's still waiting on the round or the run, share
   it. Each keeps its place when it's not there - hidden here means unseen, not gone - so nothing above them moves as
   they come and go. */
:where([data-styles~="game"]) #countdown > :is(#cancelStart, .overlay-wait) { grid-area: 3 / 1; }

:where([data-styles~="game"]) .overlay-wait {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--on-dark-muted);
  transition: opacity 0.15s ease;
}
:where([data-styles~="game"]) #countdown > .overlay-wait[hidden] { display: inline-flex !important; visibility: hidden; opacity: 0; }

/* Too late to back out once it says GO!: Not ready fades, keeping its place */
:where([data-styles~="game"]) #cancelStart { transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, visibility 0s; }
:where([data-styles~="game"]) #cancelStart.gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0s 0.15s;
}

/* Not ready tapped: the count carries on, dimmed and quiet, until the server stops it for everyone (lobby.js) - dimmed
   round the number (its own opacity is its animation's) */
:where([data-styles~="game"]) .count-dim { transition: opacity 0.15s ease; }
:where([data-styles~="game"]) .overlay.backing-out .count-dim { opacity: 0.4; }

/* Solo's 3-2-1 leaves its 🏠 and 🔊 above it, to be used: 🏠 goes straight home then (there's no run to stop yet),
   and its "Connecting…" can go on for as long as the connection's down. (A room's has Not ready for that.) Daily Jam
   and practice, which share solo's styles, have no 3-2-1 to be above. */
:where([data-styles~="game"][data-styles~="solo"]) :is(.home-btn, .mute) { z-index: 210; }


/* ---------- A room's round: what's its own (the rest is in game-state.css) ---------- */

/* The points beside "Word 3 of 10" swell as they go up (game.js) - which takes a box, not a run of text */
:where([data-styles~="game"]) #pointsDisplay { display: inline-block; }

/* A letter taken back is still on its way to its tile: the tile shows once it's there (game.js flyBack). (A room's only:
   solo, Daily Jam and practice show their tile growing back as the letter comes, just its letter hidden - game-state.css.) */
:where([data-styles~="game"]:not([data-styles~="solo"])) .letter-tiles .tile.returning { visibility: hidden; }

/* Time ran out on a word: said where the points go up, in amber */
:where([data-styles~="game"]) .feedback.late { color: #fbbf24; }

/* Through every word: 🔄 and ⌫ have nothing left to do, and fade where they are, so nothing round them moves */
:where([data-styles~="game"]) .word-actions.is-finished {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0s 0.15s;
}

/* The round frozen as it ends (game-state.css): the finisher's '+2' still floats up and fades rather than stopping
   in mid-air under "You finished!" (A room's only - solo, Daily Jam and practice have rounds of their own.) */
:where([data-styles~="game"]:not([data-styles~="solo"])) .game-state.frozen .feedback { animation-play-state: running !important; }

/* Toasts in a round sit under the standings rather than over them (phones: the chip row along the top) */
@media (max-width: 899px) {
  :where([data-styles~="game"]).page-body.game:has(.standing-list) { --toast-top: 112px; }
}
/* ...and along the very top, over the header's middle: on a phone on its side (the big ones too), where the standings
   are down the side and the word is just under the header; and in a window 900-959px wide, where the standings down the
   side reach in under a toast below the header. (From 960px they're clear of it.) */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px), (min-width: 900px) and (max-width: 959px) {
  :where([data-styles~="game"]).page-body.game:has(.standing-list) { --toast-top: 12px; }
  /* Narrow enough to end left of the timer on a small phone (the 🔊 and the timer take the right 124px) */
  :where([data-styles~="game"]).page-body.game:has(.standing-list) .toast-stack { width: min(92vw, 420px, calc(100vw - 248px)); }
}
/* The lobby on a phone on its side: its header is at the very top, so its toasts ('Bob joined the room', 'Invite link
   copied') sit under the room's code and invite link instead of over them */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  :where([data-styles~="game"]).page-body.lobby { --toast-top: 130px; }
}


/* ---------- Friends in the lobby (lobby.js, /shared/friends.js) ---------- */

/* Invite friends beside the link to copy: side by side, one under the other where there isn't room */
:where([data-styles~="game"]) .lobby-invites {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

/* On a player's row: your friend already, or someone you've asked... */
:where([data-styles~="game"]) .friend-chip {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--pink-bg);
  color: var(--pink-ink);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
:where([data-styles~="game"]) .friend-chip.sent { background: var(--good-bg); color: var(--good-ink); }
/* ...or someone you could: a small button, 44px to a finger. On the results' dark standings it's glass. */
:where([data-styles~="game"]) .add-mini {
  appearance: none;
  position: relative;
  flex: none;
  min-height: 30px;
  padding: 0 10px;
  border: 2px solid var(--field-line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
:where([data-styles~="game"]) .add-mini::after { content: ""; position: absolute; inset: -9px -4px; }
:where([data-styles~="game"]) .add-mini:is(:active, .is-pressed) { scale: 0.94; }
:where([data-styles~="game"]) .add-mini:disabled { opacity: 0.5; }
:where([data-styles~="game"]) .add-mini.on-dark { border: 1px solid var(--glass-line); background: var(--glass); color: #fff; }

/* A Heads-up - a room with two seats: the two of you, in a glass panel where the code would be, and the score between
   you under it. The code, the invite buttons and the list of players make way. */
:where([data-styles~="game"]) .versus {
  width: min(100vw - 32px, 440px);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 22px 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
:where([data-styles~="game"]) .versus-sides {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
:where([data-styles~="game"]) .versus-side {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  --face: 72px;
  --ring: #2d2b38;
}
:where([data-styles~="game"]) .versus-side > .avatar { width: 72px; height: 72px; font-size: 30px; }
:where([data-styles~="game"]) .versus-side > b {
  max-width: 100%;
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:where([data-styles~="game"]) .versus-vs { font-weight: 900; font-size: 22px; letter-spacing: 0.06em; color: var(--on-dark-muted); }
:where([data-styles~="game"]) .versus-score {
  margin: 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--glass);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.3;
  text-wrap: balance;
}
:where([data-styles~="game"]) .is-heads-up .code-tiles, :where([data-styles~="game"]) .is-heads-up .lobby-invites, :where([data-styles~="game"]) .is-heads-up .players { display: none; }
:where([data-styles~="game"]) .heads-note {
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-muted);
}
/* The link, for a friend who isn't answering: quiet, under the card */
:where([data-styles~="game"]) .lobby-link {
  appearance: none;
  position: relative;
  padding: 6px 10px;
  border: 0;
  background: none;
  color: var(--on-dark-muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
:where([data-styles~="game"]) .lobby-link::after { content: ""; position: absolute; inset: -8px -4px; }


/* ---------- Whose room it is, its lock, and votes (lobby.js) ---------- */

/* 👑 after the name of whoever's room it is */
:where([data-styles~="game"]) .crown { flex: none; margin-left: -4px; font-size: 15px; line-height: 1; }

/* Under the invite buttons: the host's switch - on, the room is open to anyone with its code - and, for everyone else,
   a line when it's been closed */
:where([data-styles~="game"]) .lobby-lock {
  display: grid;
  justify-items: center;
  gap: 6px;
}
:where([data-styles~="game"]) .lock-switch {
  appearance: none;
  position: relative;
  height: 36px;
  padding: 0 7px 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
:where([data-styles~="game"]) .lock-switch::after { content: ""; position: absolute; inset: -5px 0; }
:where([data-styles~="game"]) .lock-switch[hidden] { display: none; }
:where([data-styles~="game"]) .lock-knob {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  transition: background 0.2s ease;
}
:where([data-styles~="game"]) .lock-knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: translate 0.2s cubic-bezier(0.3, 1.3, 0.5, 1);
}
:where([data-styles~="game"]) .lock-switch[aria-checked="true"] .lock-knob { background: var(--go-light); }
:where([data-styles~="game"]) .lock-switch[aria-checked="true"] .lock-knob::after { translate: 16px 0; }
:where([data-styles~="game"]) .lock-switch:is(:active, .is-pressed) { scale: 0.97; }
:where([data-styles~="game"]) .lock-note {
  margin: 0;
  color: var(--on-dark-muted);
  font-weight: 600;
  font-size: 13px;
  text-align: center;
}
:where([data-styles~="game"]) .is-heads-up .lobby-lock { display: none; }

/* A row that opens its player's card: it takes a press, and says so with a › at its end */
:where([data-styles~="game"]) .player-pill.can-open { cursor: pointer; transition: opacity 0.3s ease, scale 0.15s ease; }
:where([data-styles~="game"]) .player-pill.can-open::after {
  content: "›";
  flex: none;
  margin: 0 -2px 0 -4px;
  color: var(--ink-muted);
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
}
:where([data-styles~="game"]) .player-pill.can-open:is(:active, .is-pressed):not(:has(button:active)) { scale: 0.98; }
:where([data-styles~="game"]) .player-pill.can-open:focus-visible { outline: 2px solid var(--you); outline-offset: 2px; }

/* The player a vote is about: how it stands, on their row */
:where([data-styles~="game"]) .vote-chip {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 800;
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* On a dark row, the dark mode red pair */
html[data-theme="dark"] :where([data-styles~="game"]) .vote-chip {
  background: var(--bad-bg);
  color: var(--bad-ink);
}

/* Everyone ready but one, for a while: a quiet line under the status that opens their card */
:where([data-styles~="game"]) .kick-hint {
  appearance: none;
  justify-self: center;
  margin: -6px 0 -4px;
  padding: 4px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--field-line);
  text-underline-offset: 3px;
  cursor: pointer;
}
:where([data-styles~="game"]) .kick-hint:is(:active, .is-pressed) { background: var(--field); color: var(--ink); }

/* A player's card, and the vote's: the leave card's shape (above), with the player's picture over their name, and the
   time the vote has left as a bar that runs down */
:where([data-styles~="game"]) .player-face { display: grid; justify-items: center; }
:where([data-styles~="game"]) .player-face .avatar { width: 64px; height: 64px; font-size: 26px; }
:where([data-styles~="game"]) .vote-clock {
  height: 4px;
  margin: -2px 0 6px;
  border-radius: 2px;
  background: var(--field);
  overflow: hidden;
}
:where([data-styles~="game"]) .vote-clock i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--bad);
  transform-origin: left;
  animation: voteRunsDown 30s linear forwards;
}
@keyframes voteRunsDown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}



/* ---------- A room of 7 or more (lobby.js, CROWD) ---------- */

/* Higher up the screen, the code a size smaller, and the invite link and the switch side by side: more of the room
   on the screen at once */
:where([data-styles~="game"]) .lobby-wrapper.is-crowded {
  gap: 16px;
  padding-top: calc(76px + env(safe-area-inset-top, 0px));
}
:where([data-styles~="game"]) .is-crowded .lobby-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px 8px;
}
:where([data-styles~="game"]) .is-crowded .lobby-head > .eyebrow,
:where([data-styles~="game"]) .is-crowded .lobby-head > .code-tiles { flex: 1 0 100%; justify-content: center; }
:where([data-styles~="game"]) .is-crowded .code-tiles { --tile-size: min(40px, calc((100vw - 56px) / 5)); }
:where([data-styles~="game"]) .is-crowded .lock-switch { height: 32px; font-size: 13px; }
:where([data-styles~="game"]) .is-crowded .lobby-lock:has(.lock-note:not([hidden])) { flex: 1 0 100%; }

/* How many are ready, over the faces */
:where([data-styles~="game"]) .ready-count { display: grid; gap: 6px; }
:where([data-styles~="game"]) .ready-count[hidden] { display: none; }
:where([data-styles~="game"]) .ready-count p {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
:where([data-styles~="game"]) .ready-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
:where([data-styles~="game"]) .ready-meter { height: 6px; border-radius: 999px; background: var(--field); overflow: hidden; }
:where([data-styles~="game"]) .ready-meter i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--go);
  transition: width 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
/* The status line stays for screen readers; the line over I'm ready says it */
:where([data-styles~="game"]) .is-crowded .status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* The faces, four across */
:where([data-styles~="game"]) .is-crowded .players { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 4px; }
:where([data-styles~="game"]) .player-pill.face {
  position: relative;
  flex-direction: column;
  justify-content: flex-start;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  padding: 6px 2px 4px;
  border-radius: 14px;
  background: none;
  font-size: 13px;
  text-align: center;
}
:where([data-styles~="game"]) .player-pill.face.can-open::after { content: none; }
:where([data-styles~="game"]) .player-pill.face.can-open:is(:active, .is-pressed) { scale: 0.94; background: var(--field); }
:where([data-styles~="game"]) .face-pic { position: relative; display: grid; margin-bottom: 3px; }
:where([data-styles~="game"]) .face .avatar {
  width: 48px;
  height: 48px;
  font-size: 20px;
  box-shadow: 0 0 0 3px var(--field-line);
  transition: box-shadow 0.25s ease;
}
:where([data-styles~="game"]) .face.ready .avatar { box-shadow: 0 0 0 3px var(--go); }
:where([data-styles~="game"]) .face.inGame .avatar { box-shadow: 0 0 0 3px var(--warn-ink); }
:where([data-styles~="game"]) .face.you .avatar { outline: 2px solid var(--you); outline-offset: 4px; }
:where([data-styles~="game"]) .face .crown { position: absolute; top: -9px; left: -7px; margin: 0; font-size: 16px; rotate: -18deg; }
/* ✓ once they're ready; in a round, how far along they are */
:where([data-styles~="game"]) .face-badge {
  position: absolute;
  right: -6px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border: 2px solid var(--card);
  border-radius: 999px;
  background: var(--go);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
:where([data-styles~="game"]) .face.inGame .face-badge { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--card); right: -10px; }
:where([data-styles~="game"]) .face .player-name { max-width: 100%; font-weight: 700; color: var(--ink-muted); }
:where([data-styles~="game"]) .face:is(.ready, .you) .player-name { color: var(--ink); }
:where([data-styles~="game"]) .face.you .player-name { color: var(--you); }
:where([data-styles~="game"]) .face .wins { margin: 0; font-size: 11px; }
:where([data-styles~="game"]) .face :is(.friend-chip, .vote-chip) { padding: 1px 6px; font-size: 10px; }
/* The open seat: a dashed circle */
:where([data-styles~="game"]) .player-pill.face.empty { border: 0; padding-left: 2px; font-weight: 600; }
:where([data-styles~="game"]) .seat-ring {
  width: 48px;
  height: 48px;
  margin-bottom: 3px;
  display: grid;
  place-items: center;
  border: 2px dashed var(--field-line);
  border-radius: 50%;
  color: var(--ink-muted);
  font-size: 20px;
  font-weight: 500;
}

/* I'm ready, kept at the bottom of the screen as the faces scroll under it - fading them out as they go - and who it's
   waiting on, over it. Where the card ends above the bottom of the screen, it's just the card's last thing. */
:where([data-styles~="game"]) .ready-bar { display: grid; gap: 8px; }
:where([data-styles~="game"]) .is-crowded .lobby-card { padding-bottom: 0; }
:where([data-styles~="game"]) .is-crowded .ready-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -16px;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  background: linear-gradient(to bottom, transparent, var(--card) 18px);
}
:where([data-styles~="game"]) .ready-wait {
  margin: 0;
  text-align: center;
  text-wrap: balance;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-muted);
}
:where([data-styles~="game"]) .ready-wait[hidden] { display: none; }

/* A player's card: their wins and where they are, and Add */
:where([data-styles~="game"]) .player-facts { margin: -4px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-muted); }
:where([data-styles~="game"]) .player-friend { display: flex; justify-content: center; }
:where([data-styles~="game"]) .player-friend[hidden] { display: none; }
:where([data-styles~="game"]) .player-friend .add-mini { min-height: 38px; padding: 0 16px; font-size: 14px; }
:where([data-styles~="game"]) .player-friend .friend-chip { padding: 5px 12px; font-size: 13px; }
:where([data-styles~="game"]) .player-dialog .leave-note[hidden] { display: none; }

/* ---------- Christmas (html.xmas - /shared/christmas.js) ---------- */

/* A Santa hat on every picture in the lobby - the rows, the faces of a full room, a Heads-up's two sides and a player's
   card - tilted on its top-left (lobby.js withHat puts one on each, always; it's only seen while the look is on). Sized
   by the picture it's on, and out of the way of every tap. */
:where([data-styles~="game"]) .lobby-hat { display: none; }
:where([data-styles~="game"]) .has-hat { position: relative; }
html.xmas :where([data-styles~="game"]) .lobby-hat {
  position: absolute;
  left: -24%;
  top: -40%;
  z-index: 1;
  display: block;
  width: 78%;
  height: auto;
  rotate: -18deg;
  pointer-events: none;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.3));
}
/* A player's card: room over the picture for its hat, which the card would otherwise cut off at its top */
html.xmas :where([data-styles~="game"]) .player-face { padding-top: 26px; }
/* A full room's faces: the room maker's crown moves over to the top-right, out from under the hat */
html.xmas :where([data-styles~="game"]) .face .crown { left: auto; right: -7px; rotate: 18deg; }
