/* Table with friends (/stol, src/ui/friends.js): the lobby (invite link, seat picker)
   and the status bar under the table. The table itself is table.css, unchanged. */

/* ---------- Waiting room = the table (2026-10-31, second version) ----------
   Same felt and layout as the game: seats at N/E/S/W (you at the bottom once seated), the count in
   the middle, the invite always in view (phones: under the table; wide screens: the side panel).
   Team colours as World of Card Games does it: NS blue, EW pink (owner liked that look, 10-31). */
body.home { --ns: #9cc9f2; --ns-ink: #0d2e4d; --ew: #f4adb9; --ew-ink: #5a1220; }
/* The felt is a 3x3 grid (N on top; W, the count, E in the middle; S below), so seats and the count can
   never overlap, whatever the screen height (2026-10-31: absolute positions overlapped on an iPhone
   with the browser's bars, ~660 px tall). */
.lfelt { min-height: 280px; display: grid; grid-template-columns: 1fr minmax(0, 1.1fr) 1fr; grid-template-rows: 1fr auto 1fr;
  grid-template-areas: ". n ." "w m e" ". s ."; place-items: center; padding: 10px 4px; }
.ls { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 4px; max-width: 100%; text-align: center; }
.ls-n { grid-area: n; } .ls-e { grid-area: e; } .ls-s { grid-area: s; } .ls-w { grid-area: w; }
.lchip { position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font: 400 32px/1 system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.lchip .avi { width: 74%; height: 74%; }
.team-ns .lchip { background: var(--ns); color: var(--ns-ink); }
.team-ew .lchip { background: var(--ew); color: var(--ew-ink); }
/* Seat letter as a small badge on the circle. */
.lsl { position: absolute; right: -4px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font: 700 12px/1 system-ui, sans-serif; background: #0f2a1d; color: var(--ink); box-shadow: 0 0 0 2px rgba(255,255,255,.55); }
.lplate { max-width: 100%; padding: 3px 12px; border-radius: 999px; font: 600 15px system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.team-ns .lplate { background: var(--ns); color: var(--ns-ink); }
.team-ew .lplate { background: var(--ew); color: var(--ew-ink); }
.lnm { display: block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrole { font-size: 13px; color: var(--muted); line-height: 1.1; }
.ls.you .lchip { box-shadow: 0 0 0 3px var(--accent), 0 4px 14px rgba(0,0,0,.4); }
.ls.you .lrole { color: var(--accent); font-weight: 700; }
.ls.off .lchip, .ls.off .lplate { filter: grayscale(.7) brightness(.75); }
/* Empty seat: a dashed circle and a yellow "Usiądź"; the whole seat is the target. */
.ls.free .lchip { background: rgba(0,0,0,.2); color: rgba(255,255,255,.75); box-shadow: none; outline: 2px dashed rgba(255,255,255,.55); outline-offset: -2px; }
.ls.free.can { cursor: pointer; }
.lsit { display: inline-block; min-height: 32px; line-height: 32px; padding: 0 16px; border-radius: 999px; background: var(--accent); color: #222;
  font: 700 15px system-ui, sans-serif; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.ls.free.can:hover .lchip, .ls.free.can:focus-visible .lchip { background: rgba(242,193,78,.25); outline-color: var(--accent); }
.ls.free.can:focus-visible { outline: none; }
.ls.free.can:focus-visible .lsit { box-shadow: 0 0 0 3px #fff; }
/* Someone sat down: the seat pops in. */
.ls.pop .lchip, .ls.pop .lplate { animation: lpop .35s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes lpop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Middle of the felt: how many are seated and what happens next. */
.lmid { grid-area: m; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 4px; text-align: center; color: var(--ink); }
.lfelt > .lmid:only-child { grid-area: 1 / 1 / -1 / -1; } /* "connecting…" alone on the felt */
.lmid p { margin: 0; font-size: 14px; line-height: 1.3; }
.lcount { font-family: var(--serif); line-height: 1; } .lcount b { font-size: 44px; } .lcount span { font-size: 22px; color: var(--muted); }
.lmid .go { margin-top: 4px; }

/* Invite: phones under the table (thumb reach), wide screens in the side panel. */
.finv { order: 4; margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--plate); display: flex; flex-direction: column; gap: 8px; }
.finv h2 { margin: 0; font: 700 18px var(--serif); color: var(--ink); }
.finv p { margin: 0; font-size: 14px; color: var(--muted); }
@media (max-width: 899px) { .finv { padding: 10px; gap: 6px; margin-top: 8px; } .finv h2 { font-size: 16px; } .finv p { display: none; } .finv .link, .finv .go { min-height: 40px; height: 40px; } }
.frow { display: flex; gap: 8px; }
.finv .link { flex: 1; min-width: 0; height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid #5e7d6a; background: #0d2b1c; color: var(--ink);
  font: 14px ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; -webkit-user-select: all; }
:is(.table, .fdlg) .go { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: #222; font: 700 16px system-ui, sans-serif;
  cursor: pointer; white-space: nowrap; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
:is(.table, .fdlg) .go.alt { flex: 1; background: #e8e2d0; }
:is(.table, .fdlg) .go.ok { background: #8ee0a8; }
:is(.table, .fdlg) .go:active { transform: translateY(1px); box-shadow: none; }
.ltitle, .lsteps { display: none; }

/* Profile and QR dialogs: an opaque card over the page (outside the table, so table updates never
   redraw it). 18px input so iOS does not zoom; avatar grid of 44px+ targets. */
.fsheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(3, 14, 8, .78); }
.fbox { width: min(100%, 380px); max-height: calc(100svh - 32px); overflow-y: auto; padding: 20px; border-radius: 16px; background: #fbf8ef; color: #1b1b1b;
  display: flex; flex-direction: column; gap: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.5); animation: fslide .2s ease-out; }
@keyframes fslide { from { transform: translateY(12px); } to { transform: none; } }
.fbox h3 { margin: 0; font: 700 23px var(--serif); color: #1b1b1b; }
.fbox p { margin: 0; font-size: 16px; line-height: 1.4; color: #3d3d3d; }
.flbl { font: 600 15px system-ui, sans-serif; color: #2b2b2b; margin-top: 4px; }
.fbox input { height: 50px; padding: 0 14px; border-radius: 10px; border: 1px solid #a49c88; background: #fff; color: #1b1b1b; font: 18px system-ui, sans-serif; }
.fbox input:focus { outline: 3px solid var(--accent); outline-offset: 0; border-color: #8a6d1d; }
.fbox .go.alt { background: #e6e0cf; }
.fbox .frow { margin-top: 6px; }
.fbox .frow .go { flex: 1; }
.avi { display: block; object-fit: contain; pointer-events: none; }
/* Avatar picker as in pokerroom's NamePrompt: a scrollable window about three rows high, so the name
   field and the button stay in view on a phone. */
.avgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-height: min(34vh, 228px); overflow-y: auto; overscroll-behavior: contain;
  padding: 4px; margin: 0 -4px; }
.avb { aspect-ratio: 1; min-height: 44px; border-radius: 50%; border: 2px solid transparent; padding: 0; background: #ebe5d4; cursor: pointer;
  display: grid; place-items: center; } /* centred by the grid: a 100%-high image inside padding sat low in Safari */
.avb:hover { border-color: #b9ad8c; }
.avb.on { background: var(--accent); border-color: #1b1b1b; }
.avb .avi { width: 72%; height: 72%; }
@media (max-width: 360px) { .avgrid { grid-template-columns: repeat(5, 1fr); } }
.qrbox { width: 100%; max-width: 260px; margin: 0 auto; aspect-ratio: 1; display: grid; place-items: center; background: #fff; border-radius: 10px; }
.qrbox svg { width: 100%; height: 100%; }

@media (max-width: 899px) {
  body.friends .table[data-phase="lobby"] .mbar .mi { font: 700 19px/1.2 var(--serif); }
}
@media (max-width: 380px), (max-height: 700px) { .lchip { width: 50px; height: 50px; font-size: 28px; } .lcount b { font-size: 38px; } .lplate { font-size: 14px; } }

/* In play: avatar in team colour at the front of every name plate (as in the waiting room). */
.plate .fav { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; margin-right: -2px; }
.plate .fav .avi { width: 21px; height: 21px; }
.plate.fteam-ns .fav { background: var(--ns); color: var(--ns-ink); }
.plate.fteam-ew .fav { background: var(--ew); color: var(--ew-ink); }
.plate.fteam-ns { box-shadow: inset 0 0 0 2px rgba(156, 201, 242, .55); }
.plate.fteam-ew { box-shadow: inset 0 0 0 2px rgba(244, 173, 185, .55); }
.plate.turn.fteam-ns, .plate.turn.fteam-ew { box-shadow: 0 0 0 2px var(--accent), 0 0 14px rgba(242,193,78,.75); }
.plate { position: relative; }
/* Whose turn it is when it is not yours. */
.fturn { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5; max-width: 90%; padding: 6px 14px; border-radius: 999px;
  background: rgba(6, 26, 15, .88); color: var(--ink); font: 600 15px system-ui, sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Quick reactions instead of chat: three buttons next to your plate, a bubble on the sender's plate. */
.south .freact { position: absolute; right: 4px; top: 4px; display: flex; gap: 4px; z-index: 6; }
.freact .rtog { display: none; }
.freact button { min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: rgba(6, 26, 15, .7);
  color: var(--ink); font: 600 13px system-ui, sans-serif; cursor: pointer; }
.freact-b { position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%); padding: 4px 12px; border-radius: 12px; background: #fff;
  color: #1b1b1b; font: 700 15px system-ui, sans-serif; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.35); animation: lpop .3s ease-out; z-index: 8; }
@media (max-width: 899px) {
  /* The single-player table hides your plate at the end of a deal on phones; with friends it says who you are. */
  body.friends .table[data-phase="done"] .south .plate { display: inline-flex; }
  /* Phones: one 40px button at the right; the three reactions open upwards above it. */
  .south .freact { right: 0; top: 2px; flex-direction: column-reverse; align-items: flex-end; }
  .freact .rtog { display: grid; place-items: center; width: 40px; height: 40px; min-height: 0; padding: 0; border-radius: 50%; }
  .freact .rtog .rico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .freact:not(.open) [data-freact] { display: none; }
  .freact.open [data-freact] { min-height: 36px; padding: 0 14px; font-size: 14px; background: #0f2a1d; }
}

/* Under the table: who dropped out, the host's "computer" button. */
.fbar { position: absolute; left: 10px; right: 10px; bottom: 30%; z-index: 30; display: flex; flex-direction: column; gap: 4px;
  padding: 8px 12px; border-radius: 10px; background: rgba(6, 26, 15, .94); color: var(--ink); font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.fbar span { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.fbar .soft { color: var(--muted); }
.fbar .go.small { flex: none; min-height: 36px; font-size: 14px; margin-left: 6px; }

/* No undo or hints at a table of four. */
body.friends .tool[data-action="undo"], body.friends .tool[data-action="hint"] { visibility: hidden; }

@media (min-width: 900px) {
  .lfelt { margin: 14px 10px 10px; }
  .lchip { width: 80px; height: 80px; font-size: 40px; } .lplate { font-size: 17px; } .lnm { max-width: 180px; } .lsl { width: 26px; height: 26px; font-size: 13px; }
  .lmid p { font-size: 18px; } .lcount b { font-size: 64px; } .lcount span { font-size: 30px; }
  .lside { gap: 14px; }
  .ltitle { display: flex; align-items: center; gap: 12px; } .ltitle h2 { margin: 0; font: 700 1.75rem var(--serif); color: var(--ink); }
  .finv { order: 0; margin: 0; padding: 16px; gap: 10px; } .finv h2 { font-size: 1.375rem; } .finv p { font-size: 1rem; }
  .lsteps { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 14px 16px; list-style: none; border-radius: 14px; background: var(--plate); }
  .lsteps li { display: flex; align-items: center; gap: 12px; font-size: 1rem; color: var(--ink); }
  .lsteps b { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #222; font: 700 15px system-ui, sans-serif; }
  .fbar.inside { position: static; margin: 4px 0 6px; box-shadow: none; }
}

/* "You" (profile.js meCardHtml / decorateMenuButton), single-player and friends tables alike. */
/* Phones: the top bar's menu button shows your avatar with a small ☰ badge; the menu opens with the card. */
.mbar .mmenu.meb { position: relative; padding: 0; border-radius: 50%; background: var(--ns); border: 2px solid rgba(255,255,255,.5); display: grid; place-items: center; }
.mbar .mmenu.meb > .avi { width: 74%; height: 74%; }
.mbar .mmenu.meb .mbadge { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%; background: #0f2a1d;
  border: 1px solid rgba(255,255,255,.45); display: grid; place-items: center; }
.mbar .mmenu.meb .mbadge svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
body.menu-open .mbar .mmenu.meb { background: var(--ns); box-shadow: 0 0 0 3px var(--accent); }
.mbar .mmenu.meb.ew, body.menu-open .mbar .mmenu.meb.ew { background: var(--ew); }
.mecard { display: flex; flex-direction: column; gap: 8px; }
.meprof { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: var(--plate, #0f2a1d); color: var(--ink, #f6f1e4);
  font: 1rem system-ui, sans-serif; text-align: left; cursor: pointer; }
.meprof .fav { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ns, #9cc9f2); }
.meprof .fav .avi { width: 76%; height: 76%; }
.meprof .who { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meprof .chg { margin-left: auto; padding: 4px 12px; border-radius: 999px; border: 1px solid rgba(242,193,78,.7); color: var(--accent, #f2c14e); font-size: .9375rem; }
.meprof:hover .chg { background: rgba(242,193,78,.15); }
.mego { display: flex; align-items: center; justify-content: center; min-height: 46px; border-radius: 12px; background: var(--accent, #f2c14e); color: #222;
  font: 700 1.0625rem system-ui, sans-serif; text-decoration: none; }
.mego:hover { filter: brightness(1.06); }
.topnav .gme { display: none; }
@media (max-width: 899px) {
  body.home.menu-open .topnav .gme { display: block; padding: 6px 4px 10px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 4px; }
  body.home.menu-open .topnav .gme .meprof { font-size: 18px; }
  body.home.menu-open .topnav .gme .mego { color: #222; font-size: 18px; } /* the menu's link colour would make it yellow on yellow */
  body.home.menu-open .topnav .gme ~ .links a[href="/stol"] { display: none; } /* the card's button already says it */
  /* First visit: one line under the avatar button. */
  .metip { position: absolute; top: 58px; right: 8px; z-index: 40; max-width: 220px; padding: 8px 12px; border-radius: 12px; background: #fbf8ef; color: #1b1b1b;
    font: 600 14px/1.3 system-ui, sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
  .metip::before { content: ""; position: absolute; top: -6px; right: 18px; width: 12px; height: 12px; background: #fbf8ef; transform: rotate(45deg); }
}
.side > .mecard { display: none; }
@media (min-width: 900px) { .side > .mecard { display: flex; } }
