/* Volt — Gate 2: the room.
   Palette leans on Fortnite's register (deep navy ground, electric violet-blue),
   cut down to one accent so it stays a system rather than a carnival.
   Inter, self-hosted, OFL. See fonts/NOTICE.txt. */

@font-face {
  font-family: "Bricolage";
  src: url("fonts/bricolage-800.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #070a14;
  --panel: #121a30;
  --panel-2: #1b2544;
  --line: #2b3763;
  --line-hi: #41508a;
  --text: #eaf0ff;
  --muted: #8c99c4;
  --accent: #6c4cf1;
  --accent-hot: #a855f7;
  --on-accent: #ffffff;
  --radius: 16px;
  --gap: 14px;
  --display: "Bricolage", "Space Grotesk", system-ui, sans-serif;
  --body: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

/* The hidden attribute must win over layout display rules. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(1200px 500px at 50% -10%, #1a2450 0%, transparent 70%);
  background-repeat: no-repeat;
}

.bar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px var(--gap);
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.wordmark {
  margin: 0;
  display: flex;
  align-items: center;
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}

/* The letters take the gradient; the bolt is its own colour, so the L reads as
   a bolt rather than as a letter with a picture next to it. */
.wordmark > span {
  background: linear-gradient(100deg, #7c5cff, #c084fc 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(124, 92, 255, 0.45));
}

.bolt-l {
  /* The path fills only the left of its 24 box, so the box is cropped to the
     bolt itself: a letter-sized glyph, not a small mark in a lot of space. */
  width: 0.56em;
  height: 0.92em;
  margin: 0 0.05em 0 0.04em;
  color: #b06bff;
  filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.75));
}

.bar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-status {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.chat-status svg {
  width: 16px;
  height: 16px;
}

.chat-status.live {
  color: #7ef0b0;
  border-color: rgba(126, 240, 176, 0.5);
}

.chat-live {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.chat-status.live .chat-live {
  background: #35e08a;
  box-shadow: 0 0 8px rgba(53, 224, 138, 0.9);
}

.chat-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #f0603a;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
}

.chat-badge[hidden] {
  display: none;
}

#whoami {
  margin: 0;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40vw;
}

/* The one thing on the page that asks to be tapped for an explanation. */
.info {
  flex: none;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.info:hover,
.info[aria-expanded="true"] {
  border-color: var(--accent-hot);
  color: var(--text);
}

.online {
  position: relative;
}

/* Higher specificity than .popover, which sets top/right for the header. */
/* Opens beside the menu, over the shelf, so the board itself stays visible. */
.popover.info-pop {
  top: 46px;
  left: calc(100% + 10px);
  right: auto;
  width: min(320px, calc(100vw - 40px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px 14px;
}

.info-title {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}

.info-list {
  margin: 0;
  padding-left: 16px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
}

/* The rail's row rules would otherwise turn each sentence into a rounded
   card with a gap; this list is prose. */
.online .info-list li {
  display: list-item;
  padding: 0;
  margin: 0 0 7px;
  border-radius: 0;
  background: none;
  line-height: 1.45;
}

.online .info-list li:last-child {
  margin-bottom: 0;
}

/* Your own face is the settings door. Nothing else in the bar looks like one. */
.me {
  padding: 0;
  border: 0;
  background: none;
  border-radius: 12px;
  line-height: 0;
  cursor: pointer;
  align-self: center;
}

.me .avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  font-size: 1.15rem;
  transition: border-color 120ms ease, transform 120ms ease;
}

.me:hover .avatar,
.me[aria-expanded="true"] .avatar {
  border-color: var(--accent-hot);
  transform: translateY(-1px);
}

/* The popover needs a live preview: face and colour are one choice, not two. */
.me-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.me-head .avatar {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid var(--line);
  font-size: 1.15rem;
}

.me-head input {
  flex: 1;
  min-width: 0;
}

.avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.6rem;
  flex: none;
}

/* The face and colour pickers, on the way in and in the popover. */
.pick {
  margin-top: 18px;
}

.pick-label {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.faces {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
  margin-bottom: 14px;
}

.face {
  display: grid;
  place-items: center;
  padding: 0;
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(8, 6, 18, 0.35);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.faces {
  margin-bottom: 0;
}

/* A long list is a scroll box, not a page-length grid. */
.faces-scroll {
  max-height: 190px;
  overflow-y: auto;
  margin-bottom: 14px;
  padding: 2px 4px 2px 2px;
  border-radius: 12px;
}

.faces-scroll::-webkit-scrollbar {
  width: 8px;
}

.faces-scroll::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 8px;
}

.face:hover {
  border-color: rgba(168, 85, 247, 0.6);
}

.face.picked {
  border-color: var(--accent-hot);
  background: rgba(108, 76, 241, 0.38);
  box-shadow: 0 0 0 1px var(--accent-hot), 0 0 14px rgba(168, 85, 247, 0.4);
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Eight circles on one row, however narrow the card: each one flexes down
   rather than wrapping onto a second line. */
.swatch {
  flex: 1 1 0;
  min-width: 0;
  max-width: 26px;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid rgba(0, 0, 0, 0.35);
  border-radius: 999px;
  cursor: pointer;
}

.swatch.picked {
  border-color: var(--text);
  box-shadow: 0 0 0 3px var(--panel);
}

.popover {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 14px;
  width: min(320px, calc(100vw - 28px));
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

/* The one popup that is centred rather than attached, because it appears when
   a phone taps a game that cannot open here. */
.device-pop {
  position: fixed;
  inset: 0;
  top: 0;
  right: 0;
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(6, 4, 16, 0.68);
  border: 0;
  box-shadow: none;
  z-index: 60;
}

.device-pop[hidden] {
  display: none;
}

.device-card {
  width: min(340px, 100%);
  padding: 20px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.device-card h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.device-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.device-card button {
  width: 100%;
}

.popover label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.popover form {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

/* Only the submit button is a big pill: the pickers inside the popover are
   small squares and circles and must not inherit this padding. */
.popover button[type="submit"] {
  align-self: flex-end;
  padding: 8px 18px;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-hot));
  color: var(--on-accent);
  font-weight: 700;
}

.popover .muted {
  font-size: 0.78rem;
  margin-top: 8px;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  width: 100%;
  margin: 0;
  min-height: 0;
  overflow-y: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c3cdf0;
}

.muted {
  color: var(--muted);
  margin: 0;
}

#join {
  margin: auto;
  width: min(460px, 100%);
  padding: 28px;
}

#join h2 {
  font-size: 1.45rem;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--text);
  margin-bottom: 18px;
}

#join input {
  padding: 12px 14px;
}

#handle-form button {
  padding: 12px 22px;
  border-color: transparent;
  background: linear-gradient(120deg, var(--accent), var(--accent-hot));
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(108, 76, 241, 0.35);
}

#join .muted {
  margin-top: 14px;
  font-size: 0.85rem;
}

.link {
  padding: 4px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
}

.link:hover {
  color: var(--text);
}

form {
  display: flex;
  gap: 8px;
}

input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.room {
  /* The board is a menu that opens and shuts; the shelf takes whatever is left. */
  --rail: 56px;
  flex: 1;
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas:
    "online shelf"
    "chat chat"
    "dock dock";
  gap: var(--gap);
  min-height: 0;
  transition: grid-template-columns 180ms ease;
}

/* Shut, the card moves left rather than becoming a tab: same panel, same
   rounded outer corner, just wide enough for a face. */
.room.rail-shut {
  --rail: 56px;
}

.room.rail-shut .online {
  width: var(--rail);
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  background: var(--panel);
  box-shadow: 10px 0 30px rgba(4, 6, 16, 0.5);
}

/* The board is a menu, not a card: it runs to the left edge of the screen,
   square corners, no padding, so the faces line up with the wall rather than
   floating in a box. The aside keeps overflow visible so the "i" popup is
   never clipped; the roster does its own scrolling. */
.online {
  grid-area: online;
  position: relative;
  z-index: 7;
  width: var(--rail);
  margin: 0;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: visible;
}

/* Open, it keeps its narrow column and spills out over the shelf instead, so
   the shelf never has to change width. Rounded on the side that leaves the
   wall, square against it. */
.room:not(.rail-shut) .online {
  width: 236px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 18px 18px 0;
  background: var(--panel);
  box-shadow: 14px 0 40px rgba(4, 6, 16, 0.6);
}

.online .scores-note {
  display: none;
}

.rail-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 10px 14px;
  border-bottom: 1px solid var(--line);
}

.online .rail-title {
  margin: 0;
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c3cdf0;
  white-space: nowrap;
}

.online .info {
  width: 20px;
  height: 20px;
  margin: 0;
}

.rail-toggle {
  margin-left: auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-family: var(--body);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
}

.rail-toggle:hover,
.rail-toggle:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.chev {
  display: block;
  transition: transform 160ms ease;
}

/* A small real button, for the two places a link would have done: Suggest is
   an action, so it looks like one. */
.pill {
  appearance: none;
  flex: none;
  border: 1px solid var(--line-hi);
  border-radius: 999px;
  padding: 7px 14px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}

.pill:hover,
.pill:focus-visible {
  border-color: var(--accent-hot);
  color: #fff;
}

.pill:active {
  transform: translateY(1px);
}

/* The phone's own two controls: a trophy in the banner and Suggest under the
   chat. On a big screen the chevron and the banner button do those jobs. */
.tab-glyph {
  display: none;
  line-height: 1;
}

.board-tab,
.dock {
  display: none;
}

.rail-shut .chev {
  transform: rotate(180deg);
}

/* A shut board keeps every face it has seen, with their dots. The list above
   it is a full board; this is the same board at a glance. */
.rail-shut .online ul#roster,
.rail-shut .online .scores-note,
.rail-shut .online .rail-title,
.rail-shut .online .info {
  display: none;
}

.rail-shut .rail-head {
  justify-content: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.rail-shut .rail-toggle {
  margin: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 30px;
  padding: 0;
  border-radius: 8px;
  font-size: 1rem;
}

.rail-shut .chev {
  display: none;
}

.rail-shut .tab-glyph {
  display: block;
}

.rail-faces {
  display: none;
}

.rail-shut .rail-faces {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 10px 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.rail-shut .rail-faces::-webkit-scrollbar {
  width: 0;
}

.rail-faces .rail-face {
  position: relative;
  flex: none;
  display: inline-grid;
  place-items: center;
}

.rail-faces .avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 1rem;
}

.rail-faces .dot {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 2px var(--panel);
}

.online ul#roster {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.online li {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px 7px 14px;
  font-size: 0.9rem;
  font-weight: 700;
}

.online li:hover {
  background: rgba(255, 255, 255, 0.04);
}

.online li.away {
  opacity: 0.5;
}

.online .who {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.online .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online li.away .name {
  font-weight: 400;
}

.online li.self .name {
  color: var(--accent-hot);
}

.online .rank {
  flex: none;
  width: 1.2em;
  text-align: right;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.online .avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.online .dot {
  width: 6px;
  height: 6px;
}

.online .score {
  flex: none;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
}

.online .points {
  color: var(--accent-hot);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.online .games {
  color: var(--muted);
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.shelf {
  grid-area: shelf;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chip {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-hi);
}

.chip.on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

.tile-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.tile-head h3 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seats {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.seats svg {
  width: 11px;
  height: 11px;
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.tile:hover {
  border-color: var(--accent-hot);
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(108, 76, 241, 0.28);
}

.tile-art {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(150deg, var(--panel-2), var(--bg));
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--display);
  font-size: 2.6rem;
  font-weight: 800;
}

.tile-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 300ms ease;
}

.tile:hover .tile-art img {
  transform: scale(1.04);
}

/* Which device a tile opens on. Two small glyphs rather than a word: at this
   size a word would be the same height as the tile title. */
.tile-devices {
  position: absolute;
  top: 6px;
  left: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(9, 7, 24, 0.72);
  color: #ded8ff;
  line-height: 0;
}

.tile-devices svg {
  width: 13px;
  height: 13px;
  display: block;
}

/* This device cannot open it. The tile stays tappable so the popup can
   explain, but Play stops looking like an invitation. */
.tile.off-device .play {
  opacity: 0.5;
}

.tile.off-device .tile-devices {
  color: var(--muted);
}

.tile h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Who is already in this game. Kept in the flow, not floating, so a tile with
   nobody in it is the same height as one with a crowd. */
.tile-players {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  flex-wrap: wrap;
}

.avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: 0.8rem;
  box-shadow: 0 0 0 1px var(--panel-2);
}

.tile-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: auto;
  padding-top: 2px;
}

.tile-foot .play {
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 700;
}

.tile-players {
  min-height: 18px;
}

/* A live tile has no badge, so Play keeps the right-hand corner by itself. */
.tile-foot .badge {
  margin-right: auto;
}

.play {
  padding: 7px 16px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
}

.play:disabled {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: #6d789f;
  opacity: 1;
}

.play:not(:disabled) {
  background: linear-gradient(120deg, var(--accent), var(--accent-hot));
  border-color: transparent;
  color: var(--on-accent);
  box-shadow: 0 6px 18px rgba(108, 76, 241, 0.4);
}

.count {
  color: var(--text);
  margin-left: 4px;
}

.count::before {
  content: "(";
}

.count::after {
  content: ")";
}

.avatar {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), var(--accent-hot));
  color: var(--on-accent);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1;
}

/* Status dots: green in the room, violet in a game, grey gone. */
.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}

.dot.room { background: #3ddc97; box-shadow: 0 0 6px rgba(61, 220, 151, 0.7); }
.dot.game { background: var(--accent-hot); box-shadow: 0 0 6px rgba(192, 132, 252, 0.6); }
.dot.off { background: #4a4a63; }


/* The dot key lives inside the "i" popover now, where it costs no screen. */
.info-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 0.72rem;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.scores {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.scores-game {
  margin: 0 0 6px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.scores ol {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 4px;
}

.scores li {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
}

.scores .rank {
  width: 1.1em;
  color: var(--muted);
  font-size: 0.72rem;
}

.scores .who {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scores .points {
  color: var(--accent-hot);
  font-variant-numeric: tabular-nums;
}

.scores-note {
  margin: 8px 0 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0.8;
}

.page-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: none;
  align-self: stretch;
  margin: 4px 0 12px;
  padding: 0;
  text-align: left;
}

.page-info summary {
  text-align: left;
}

.privacy,
.about {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: left;
}

.privacy summary,
.about summary {
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.privacy summary:hover,
.about summary:hover {
  color: var(--text);
}

.privacy ul,
.about ul {
  margin: 10px 0 0;
  padding-left: 18px;
  line-height: 1.55;
  text-align: left;
}

.privacy li,
.about li {
  margin-bottom: 5px;
}

@media (max-width: 640px) {
  .page-info {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  height: 18px;
  padding: 0 6px;
  font-size: 0.56rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.online .badge {
  color: #d8c9ff;
  border-color: rgba(168, 85, 247, 0.45);
  background: rgba(168, 85, 247, 0.16);
}

.chat {
  grid-area: chat;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0;
  padding: 8px;
}

.dock {
  grid-area: dock;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 2px;
}

.chat-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 0;
  margin: 7px 2px 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pulse {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4a5375;
  transition: background 160ms ease, box-shadow 160ms ease;
}

.pulse.on {
  background: #35e08a;
  box-shadow: 0 0 8px rgba(53, 224, 138, 0.85);
}

.chat form {
  display: flex;
}

.chat input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
}

.chat input.nudge {
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.3);
}

/* Reading the chat is a deliberate act, like opening your profile. The bar
   itself is just the place to type. */
.log.chat-log {
  position: absolute;
  z-index: 25;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 30px));
  max-height: min(46vh, 420px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.log {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0;
}

/* In-game chat, not a messenger: one row per message, face and name in their
   own columns so the text lines up down the page. */
.line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 2px 0;
  font-size: 0.85rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.line .avatar-xs {
  flex: none;
  width: 18px;
  height: 18px;
  align-self: center;
  border-radius: 5px;
  font-size: 0.62rem;
}

.line .who {
  flex: none;
  max-width: 38%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  color: #c3cdf0;
}

.line.mine .who {
  color: var(--accent-hot);
}

.line .text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
}

.line.system {
  display: block;
  padding: 3px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: italic;
}

.help ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
}

.help li {
  margin-bottom: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media (max-width: 640px) {
  body {
    height: auto;
    overflow: visible;
  }

  main {
    overflow: visible;
  }

  .room {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "shelf"
      "chat"
      "dock";
  }

  /* The board is not a strip on a phone. The trophy in the banner opens the
     list as a card over the shelf; tapping it again puts it away. */
  .online {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 6;
    display: none;
    flex-direction: column;
    gap: 0;
    width: min(92%, 340px);
    max-height: min(78vh, 520px);
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
    box-shadow: 0 20px 44px rgba(4, 6, 16, 0.62);
    overflow-x: hidden;
    overflow-y: auto;
  }

  .room:not(.rail-shut) .online {
    display: flex;
  }

  /* The heading and the way out stay put while the list scrolls. */
  .rail-head {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 8px 8px 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }

  .online .rail-title,
  .online .info {
    display: block;
  }

  .rail-toggle {
    display: none;
  }

  /* The card always holds a full list: rank, dot, face, name, points. */
  .online ul#roster {
    display: block;
    overflow: visible;
    padding: 4px 0 6px;
  }

  .online li {
    width: 100%;
    padding: 6px 10px 6px 12px;
  }

  .online .who,
  .online .score {
    display: flex;
  }

  /* The rules popover sits inside the card, in the flow, so it makes the card
     taller instead of being cut off. */
  .popover.info-pop {
    position: static;
    width: auto;
    margin: 8px;
    box-shadow: none;
  }

  /* The trophy sits right of the face and is the same size as it, so the two
     read as one little pair of your own controls. */
  .bar-actions {
    gap: 8px;
  }

  #whoami {
    order: 0;
  }

  #me {
    order: 1;
  }

  /* Two tiles to a phone means a long name has no room for one line. */
  .tile-head h3 {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.2;
  }

  .board-tab {
    order: 2;
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--panel);
    font-size: 1rem;
    line-height: 1;
  }

  .chat-status {
    order: 3;
  }

  .board-tab[aria-expanded="true"] {
    border-color: var(--line-hi);
    background: var(--panel-2);
  }

  /* The line and Suggest share one row under the chat, in reach of a thumb. */
  .dock {
    gap: 8px;
    padding: 2px 2px 0;
  }

  .chat-line {
    font-size: 0.66rem;
  }

  #suggest-tab {
    display: inline-flex;
    padding: 8px 14px;
    font-size: 0.7rem;
  }

  /* It opens as a sheet by the thumb that asked for it, not at the top. */
  #suggest-popover {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 60vh;
  }

  .shelf-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
  }

  .tile p {
    display: none;
  }
}
