/* «طاولة الأصدقاء» (tables/lobby.js): the friends' table screen of «وصّلها», «خلّصها» and «بلوت». The card: its title
   and the table's ticket on top; the game's seats and settings on one side, «أصدقاؤك الحين», a friend's code and sharing
   on the other (stacked on a phone); «ابدأ» and «اطلع» kept at its foot. Each game's own colours come through its
   variables (--ink, --muted, --gold, --gold2, --line…), so it sits in each game's look. */
.lb {
  --lb-ink: var(--ink, #F4F7FF); --lb-muted: var(--muted, #A9B6CF); --lb-gold: var(--gold, #EBC675); --lb-gold2: var(--gold2, #FFE3A0);
  --lb-line: var(--line, rgba(232, 184, 74, .22)); --lb-box: rgba(255, 255, 255, .045); --lb-row: rgba(255, 255, 255, .05);
  --lb-on-gold: var(--on-gold, #2A1A06); --lb-live: #FF5A70; --lb-ok: #4FD69A; --lb-field: rgba(0, 0, 0, .26);
}
.room-card.lb { padding: 0; gap: 0; overflow: hidden; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--lb-line); }
.lb-head h2 { min-width: 0; text-align: start !important; }
.room-card.lb > #roomMsg { margin: 12px 18px 0; }
.lb-body { display: flex !important; flex-direction: column; gap: 14px !important; padding: 14px 18px !important; overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.lb-body[hidden] { display: none !important; }
.lb-main, .lb-side { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.lb-foot { display: flex; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--lb-line); background: rgba(0, 0, 0, .14); }
.lb-foot > #roomGo { flex: 1 1 auto; min-width: 0; margin: 0; }
.lb-foot > #roomLeave { flex: 0 0 auto; min-width: 0; margin: 0; }
.lb-foot > #roomGo[hidden] + #roomLeave { flex: 1 1 auto; }
.lb-foot > #roomLeave { white-space: nowrap; }
.lb-foot > #roomGo { line-height: 1.2; }

/* the ticket: the table's code, a tap copies it */
.lb-ticket { flex: none; display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 7px 12px 7px 14px; border: 0; border-radius: 14px; cursor: pointer; font-family: inherit;
  color: var(--lb-on-gold); background: linear-gradient(180deg, #FFEBB8, #E2B252); box-shadow: 0 6px 18px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .55); -webkit-tap-highlight-color: transparent; }
.lb-ticket:empty, .lb-ticket[hidden] { display: none; }
.lb-ticket small { font-size: 11px; font-weight: 700; line-height: 1.2; opacity: .78; padding-inline-end: 10px; border-inline-end: 1.5px dashed rgba(42, 26, 6, .35); white-space: nowrap; }
.lb-ticket b { font: 800 19px/1 "Readex Pro", Alexandria, system-ui, sans-serif; letter-spacing: .14em; font-variant-numeric: tabular-nums; }
.lb-ticket svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; opacity: .7; }
.lb-ticket:active { transform: translateY(1px); }
.lb-ticket:focus-visible { outline: 2px solid var(--lb-gold2); outline-offset: 2px; }

/* the side's boxes */
.lb-box { margin: 0; padding: 12px; border: 1px solid var(--lb-line); border-radius: 16px; background: var(--lb-box); }
.lb-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 700 14px/1.3 "Readex Pro", Alexandria, system-ui, sans-serif; color: var(--lb-gold2); }
.lb-live { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; color: #FFD2D8; background: rgba(255, 90, 112, .16); }
.lb-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lb-live); box-shadow: 0 0 0 0 rgba(255, 90, 112, .6); animation: lb-pulse 1.6s infinite; }
.lb-live[hidden] { display: none; }
@keyframes lb-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 112, .55); } 70% { box-shadow: 0 0 0 7px rgba(255, 90, 112, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 90, 112, 0); } }

/* «أصدقاؤك الحين» */
.lb-now { display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.lb-f { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 13px; background: var(--lb-row); }
.lb-f.k-play, .lb-f.k-watch { background: linear-gradient(90deg, rgba(255, 90, 112, .1), rgba(255, 90, 112, .02)); }
[dir="ltr"] .lb-f.k-play, [dir="ltr"] .lb-f.k-watch { background: linear-gradient(270deg, rgba(255, 90, 112, .1), rgba(255, 90, 112, .02)); }
.lb-f.k-wait { background: rgba(235, 198, 117, .09); }
.lb-av { position: relative; width: 40px; height: 40px; }
.lb-av > :first-child { display: block; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; }
.lb-av .ini { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: #0B1220; font-weight: 800; font-size: 16px; }
.lb-av img, .lb-av svg { display: block; width: 100%; height: 100%; }
.lb-dot { position: absolute; bottom: 0; inset-inline-end: 0; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #121722; display: none; }
.k-play .lb-dot, .k-watch .lb-dot { display: block; background: var(--lb-live); }
.k-wait .lb-dot { display: block; background: var(--lb-gold); }
.k-on .lb-dot { display: block; background: var(--lb-ok); }
.lb-ft { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-ft b { font-size: 14px; font-weight: 700; color: var(--lb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-ft small { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 11.5px; color: var(--lb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.k-on .lb-ft small { color: var(--lb-ok); }
.lb-g { flex: none; display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 800; line-height: 1.5; color: #fff; }
.lb-g.g-wassilha { background: #3D7BEA; } .lb-g.g-cards { background: #D9472F; } .lb-g.g-baloot { background: #8E5A1C; }
.lb-b { flex: none; height: 32px; padding: 0 14px; border-radius: 10px; font: 700 13px/1 "Readex Pro", Alexandria, system-ui, sans-serif; cursor: pointer; white-space: nowrap; border: 1px solid transparent; -webkit-tap-highlight-color: transparent; }
.lb-b:focus-visible { outline: 2px solid var(--lb-gold2); outline-offset: 2px; }
.lb-watch { color: #FFD5DB; background: rgba(255, 90, 112, .16); border-color: rgba(255, 90, 112, .5); }
.lb-watch::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: var(--lb-live); vertical-align: 1px; }
.lb-join, .lb-join-b { color: var(--lb-on-gold); background: linear-gradient(180deg, #FFE7A6, #E0AE4C); box-shadow: 0 4px 12px rgba(224, 174, 76, .3); }
.lb-inv { color: var(--lb-gold2); background: transparent; border-color: rgba(235, 198, 117, .55); }
.lb-inv.sent, .lb-inv:disabled { color: var(--lb-muted); border-color: var(--lb-line); background: transparent; cursor: default; }
/* the invitation ringing on his pages (public/tables/livepop.js), then his answer */
.lb-inv.ringing { position: relative; overflow: hidden; color: var(--lb-gold2); border-color: rgba(235, 198, 117, .7); background: rgba(235, 198, 117, .1); }
.lb-inv.ringing::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, #FFE7A6, #E0AE4C); transform-origin: left; animation: lbRing var(--ttl, 7000ms) linear var(--el, 0ms) forwards; }
[dir="ltr"] .lb-inv.ringing::after { transform-origin: right; }
.lb-inv.ringing::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: #FFE7A6; box-shadow: 0 0 8px rgba(255, 231, 166, .9); vertical-align: 1px; animation: lbBlink .8s ease-in-out infinite alternate; }
@keyframes lbBlink { from { opacity: 1; } to { opacity: .25; } }
.lb-inv.lb-r-yes:disabled { color: #7CEBA8; border-color: rgba(52, 212, 122, .55); background: rgba(52, 212, 122, .1); }
.lb-inv.lb-r-no:disabled { color: #FFB3B3; border-color: rgba(255, 107, 107, .4); }
.lb-inv.lb-r-busy:disabled { color: #FFD98A; border-color: rgba(245, 185, 58, .45); }
.lb-inv.lb-r-away:disabled { color: #A9C4FF; border-color: rgba(122, 167, 255, .4); }
@keyframes lbRing { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.lb-more { align-self: center; margin-top: 2px; padding: 6px 12px; border: 0; background: none; color: var(--lb-gold2); font: 600 12.5px "Readex Pro", Alexandria, sans-serif; cursor: pointer; }
.lb-empty { margin: 4px 0; font-size: 12.5px; line-height: 1.7; color: var(--lb-muted); }

/* a friend's code */
.lb-join-row { display: flex; gap: 8px; }
.lb-code { flex: 1 1 auto; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--lb-line); border-radius: 12px; background: var(--lb-field); color: var(--lb-ink);
  font: 800 18px/1 "Readex Pro", Alexandria, system-ui, sans-serif; letter-spacing: .3em; text-align: center; text-transform: uppercase; -webkit-appearance: none; appearance: none; }
.lb-code::placeholder { font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--lb-muted); opacity: .8; text-transform: none; }
.lb-code:focus { outline: none; border-color: var(--lb-gold); box-shadow: 0 0 0 3px rgba(235, 198, 117, .22); }
.lb-join-b { height: 44px; padding: 0 18px; border-radius: 12px; font-size: 14.5px; }
.lb-msg { min-height: 0; margin: 8px 2px 0; font-size: 12px; line-height: 1.6; color: var(--lb-muted); }
.lb-msg:empty { display: none; }
.lb-msg.bad { color: #FFAA95; }

/* sharing */
.lb-share-box .room-link { margin: 0; }
.lb-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.lb-chips:empty { display: none; }
.lb-chip { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 11px; border: 1px solid var(--lb-line); background: var(--lb-row); color: var(--lb-ink);
  font: 600 13px/1 "Readex Pro", Alexandria, system-ui, sans-serif; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lb-chip svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lb-chip svg .f { fill: currentColor; stroke: none; }
.lb-wa { color: #7BE8A6; border-color: rgba(64, 199, 120, .45); background: rgba(37, 211, 102, .1); }
.lb-qrb.on { border-color: var(--lb-gold); color: var(--lb-gold2); }
.lb-chip:focus-visible { outline: 2px solid var(--lb-gold2); outline-offset: 2px; }
.lb-qr { margin-top: 12px; text-align: center; }
.lb-qr[hidden] { display: none; }
.lb-qr-in { display: inline-block; padding: 10px; border-radius: 16px; background: #fff; box-shadow: 0 10px 24px rgba(0, 0, 0, .3); }
.lb-qr-code { width: 176px; height: 176px; display: grid; place-items: center; color: #0B1220; }
.lb-qr-code:empty::after { content: ""; width: 26px; height: 26px; border-radius: 50%; border: 3px solid rgba(11, 18, 32, .2); border-top-color: #0B1220; animation: lb-spin .8s linear infinite; }
.lb-qr-code svg { display: block; width: 100%; height: 100%; }
.lb-qr p { margin: 10px auto 0; max-width: 260px; font-size: 12px; line-height: 1.6; color: var(--lb-muted); }
@keyframes lb-spin { to { transform: rotate(360deg); } }

/* wide: the game's seats on one side, the friends, the code and sharing on the other */
@media (min-width: 880px) {
  .room-card.lb { width: min(1060px, 100%) !important; }
  .lb-body { display: grid !important; grid-template-columns: minmax(0, 1fr) 360px; align-items: start; column-gap: 20px !important; }
  .lb-side { position: sticky; top: 0; }
}
/* narrower: the friends right under the seats, then the table's settings, a friend's code and sharing */
@media (max-width: 879px) {
  .lb-main, .lb-side { display: contents; }
  .lb-main > * { order: 1; }
  .lb-main > .lb-set, .lb-main > .room-opts, .lb-main > .room-mode, .lb-main > .room-rules, .lb-main > .room-bots { order: 3; }
  .lb-side > * { order: 4; }
  .lb-side > :first-child { order: 2; }
}
@media (max-width: 520px) {
  .lb-head { padding: 14px 14px 10px; }
  .lb-body { padding: 12px 14px !important; }
  .lb-foot { padding: 10px 14px 12px; }
  .room-card.lb > #roomMsg { margin: 10px 14px 0; }
  /* the ticket in two lines, so the title keeps one */
  .lb-ticket { flex-direction: column; gap: 1px; padding: 5px 12px 6px; border-radius: 12px; }
  .lb-ticket small { padding: 0; border: 0; font-size: 9.5px; }
  .lb-ticket b { font-size: 16px; }
  .lb-ticket svg { display: none; }
  /* (the long ones — «جاهز ✓ (اضغط تتراجع)», «ننتظر ٢ أصدقاء يجهزون» — take two lines rather than lose words) */
  .lb-foot > #roomGo { font-size: 15px; padding: 10px 12px; min-height: 50px; }
  .lb-foot > #roomLeave { font-size: 14px; padding: 10px 12px; min-height: 50px; }
}
@media (prefers-reduced-motion: reduce) { .lb-live::before, .lb-qr-code:empty::after { animation: none; } }
/* «ادعُ الكل»: one tap rings every friend on MODTV now */
.lb-all { align-self: stretch; height: 38px; border-radius: 11px; border: 1px dashed rgba(235, 198, 117, .6); background: rgba(235, 198, 117, .08); color: var(--lb-gold2); font: 700 13.5px/1 "Readex Pro", Alexandria, system-ui, sans-serif; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.lb-all:hover:not(:disabled) { background: rgba(235, 198, 117, .14); }
.lb-all:disabled { color: #7CEBA8; border-color: rgba(52, 212, 122, .5); background: rgba(52, 212, 122, .08); cursor: default; }
.lb-all:focus-visible { outline: 2px solid var(--lb-gold2); outline-offset: 2px; }
.lb-inv.lb-r-dnd:disabled { color: #C6BDFF; border-color: rgba(156, 140, 255, .45); }
.lb-inv.lb-r-watching:disabled { color: #FFC59A; border-color: rgba(255, 159, 90, .45); }
