/* Ranks, Me and Player pages (pages.js). Everything is prefixed pg-. */
#page { position: fixed; inset: 0; z-index: 28; overflow: hidden; background: var(--bg); animation: pg-in .28s cubic-bezier(.2, .8, .2, 1); }
html.pg-open { overflow: hidden; }
@keyframes pg-in { from { opacity: 0; transform: translateY(14px); } }
.pg-bg { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 40% at 12% 0%, rgba(255, 46, 126, .2), transparent 70%), radial-gradient(55% 40% at 92% 0%, rgba(91, 46, 255, .24), transparent 70%); }
.pg-wrap { position: relative; height: 100%; max-width: 1040px; margin: 0 auto; padding: 0 clamp(12px, 3vw, 28px) max(14px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; min-height: 0; }
.pg-wrap.pg-ranks, .pg-wrap.pg-player { max-width: 680px; }

.pg-head { display: flex; align-items: center; gap: 12px; padding: 12px 0; flex: none; }
.pg-head h2 { margin: 0; flex: 1; font: 700 22px var(--display); letter-spacing: .06em; text-transform: uppercase; }
.pg-back { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--raise); cursor: pointer; display: grid; place-items: center; padding: 0; transition: border-color .2s, transform .12s; }
.pg-back:hover { border-color: rgba(200, 255, 46, .6); }
.pg-back:active { transform: scale(.92); }
.pg-back svg { width: 18px; height: 18px; }
.pg-nav { display: flex; padding: 3px; border-radius: 999px; background: var(--raise); border: 1px solid var(--line); }
.pg-nav button { border: 0; background: none; cursor: pointer; padding: 7px 16px; border-radius: 999px; font: 700 12px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pg-nav button.on { background: var(--acid); color: #0c1200; }

.pg-col { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.pg-tabs.tabs { padding: 0 0 10px; flex: none; }
.pg-tabs.tabs button { padding: 9px 4px; white-space: nowrap; }
.pg-scroll { flex: 1; min-height: 0; overflow: auto; padding-right: 2px; overscroll-behavior: contain; }
.pg-seg { display: flex; gap: 6px; margin-bottom: 10px; }
.pg-seg button { flex: 1; padding: 7px 4px; border-radius: 999px; border: 1px solid var(--line); background: none; cursor: pointer; font: 600 12.5px Inter, system-ui, sans-serif; color: var(--muted); }
.pg-seg button.on { color: var(--text); background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .28); }

/* leaderboard rows: the lobby's player cards, a size up */
ol.board.pg-board { gap: 6px; }
ol.board.pg-board li { grid-template-columns: 26px 34px 1fr auto; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 13px; font-size: 15px; cursor: pointer; transition: background .15s, transform .15s; }
ol.board.pg-board li:hover { background: rgba(255, 255, 255, .075); transform: translateX(2px); }
ol.board.pg-board .rk { font-size: 14px; }
ol.board.pg-board .av { width: 34px; height: 34px; font-size: 15px; }
ol.board.pg-board .nm small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.2; }
ol.board.pg-board b { font-size: 18px; }
ol.board.pg-board li:nth-child(1) { background: linear-gradient(90deg, rgba(255, 201, 62, .16), rgba(255, 255, 255, .035) 60%); }
ol.board.pg-board li:nth-child(1) b { color: var(--gold); text-shadow: 0 0 18px rgba(255, 201, 62, .5); }
ol.board.pg-board li.me { background: color-mix(in srgb, var(--a) 14%, transparent); }
.pg-lvl { font: 700 11px var(--display); font-style: normal; letter-spacing: .12em; padding: 3px 8px; border-radius: 999px; background: rgba(255, 201, 62, .14); color: var(--gold); border: 1px solid rgba(255, 201, 62, .4); white-space: nowrap; }
.pg-lvl.big { font-size: 12px; padding: 4px 10px; }

.pg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.pg-res { --a: var(--acid); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 9px 14px 9px 10px; border-radius: 13px; background: rgba(255, 255, 255, .035); }
.pg-res[data-pg] { cursor: pointer; transition: background .15s; }
.pg-res[data-pg]:hover { background: rgba(255, 255, 255, .075); }
.pg-res.g-flyer { --a: var(--ice); }
.pg-res.g-snake { --a: var(--acid); }
.pg-res.g-tap { --a: var(--hot); }
.pg-res .av { width: 34px; height: 34px; font-size: 15px; }
.pg-dot { width: 10px; height: 10px; margin: 0 6px; border-radius: 50%; background: var(--a); box-shadow: 0 0 12px var(--a); }
.pg-dot.up { --a: var(--acid); }
.pg-dot.down { --a: #5b5b78; box-shadow: none; }
.pg-main { min-width: 0; }
.pg-main b { display: block; font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-main small, .pg-side small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-side { text-align: right; }
.pg-side b { display: block; font: 700 17px var(--display); font-variant-numeric: tabular-nums; }
.pg-win { color: var(--acid); text-shadow: 0 0 18px rgba(200, 255, 46, .4); }
.pg-pill { font: 700 10px var(--display); font-style: normal; letter-spacing: .12em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.pg-pill.won { background: var(--acid); color: #0c1200; }
.pg-pill.live { color: var(--hot); border: 1px solid rgba(255, 46, 126, .5); }

/* profile */
.pg-split { display: grid; grid-template-columns: 380px 1fr; gap: 22px; flex: 1; min-height: 0; }
.pg-left { min-width: 0; }
.pg-card { max-width: 440px; width: 100%; margin: 8px auto 0; }
.pg-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.av.pg-av { width: 68px; height: 68px; font-size: 30px; flex: none; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px hsl(var(--h) 95% 62%), 0 0 34px -4px hsl(var(--h) 95% 60%); }
.pg-id { flex: 1; min-width: 0; }
.pg-name { font: 700 26px/1.1 var(--display); letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.pg-streak { display: inline-flex; align-items: center; gap: 4px; font: 700 12px var(--display); color: #ff9a3e; }
.pg-streak svg { width: 15px; height: 15px; filter: drop-shadow(0 0 6px rgba(255, 154, 62, .7)); animation: pg-flick 1.3s ease-in-out infinite alternate; }
@keyframes pg-flick { to { transform: scale(1.14) rotate(-4deg); } }
.pg-since { color: var(--muted); font-size: 12px; }
.pg-xp { height: 9px; border-radius: 5px; background: rgba(255, 255, 255, .08); overflow: hidden; margin-top: 10px; }
.pg-xp i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--acid), var(--ice)); box-shadow: 0 0 16px rgba(200, 255, 46, .7); transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.pg-xpt { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.pg-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pg-card .pg-tiles { grid-template-columns: repeat(2, 1fr); }
.pg-tile { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .045); border: 1px solid var(--line); min-width: 0; }
.pg-tile b { display: block; font: 700 22px/1.15 var(--display); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-tile b i { font-style: normal; color: var(--muted); margin: 0 3px; }
.pg-tile span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-tile b span { display: inline; font: inherit; color: inherit; letter-spacing: 0; text-transform: none; overflow: visible; }
.pg-tile.up b { color: var(--acid); }
.pg-tile.down b { color: var(--hot); }
.pg-tile.gold b { color: var(--gold); }
.pg-bests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 14px; }
.pg-bests div { --a: var(--acid); padding: 9px 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--a) 40%, transparent); background: color-mix(in srgb, var(--a) 8%, transparent); min-width: 0; }
.pg-bests .g-flyer { --a: var(--ice); }
.pg-bests .g-tap { --a: var(--hot); }
.pg-bests span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-bests b { font: 700 24px/1.1 var(--display); color: var(--a); font-variant-numeric: tabular-nums; }
.pg-bests b::after { content: " best"; font: 500 11px Inter, system-ui, sans-serif; color: var(--muted); }

.pg-load { display: flex; gap: 8px; justify-content: center; padding: 60px 0; }
.pg-load i { width: 10px; height: 10px; border-radius: 50%; background: var(--acid); animation: pg-bob .8s ease-in-out infinite alternate; }
.pg-load i:nth-child(2) { animation-delay: .15s; }
.pg-load i:nth-child(3) { animation-delay: .3s; }
@keyframes pg-bob { to { transform: translateY(-10px); opacity: .35; } }
.pg-card .empty { margin: 30px 0 12px; }

/* rows and tiles rise in once, when a view first lands */
.pg-fresh .pg-board li, .pg-fresh .pg-res, .pg-fresh .pg-tile, .pg-fresh .pg-bests div, .pg-fresh .pg-hero { animation: pg-rise .45s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes pg-rise { from { opacity: 0; transform: translateY(12px); } }

@media (max-width: 820px) {
  .pg-split { display: flex; flex-direction: column; gap: 0; }
  .pg-left { flex: none; }
  .pg-head h2 { font-size: 19px; }
  .av.pg-av { width: 56px; height: 56px; font-size: 25px; }
  .pg-name { font-size: 22px; }
  .pg-hero { margin-bottom: 10px; }
  .pg-tile { padding: 7px 10px; border-radius: 12px; }
  .pg-tile b { font-size: 18px; }
  .pg-tile span { font-size: 9.5px; }
  .pg-bests { margin: 8px 0 10px; }
  .pg-bests div { padding: 6px 10px; }
  .pg-bests b { font-size: 19px; }
  .pg-tabs.tabs button { font-size: 11px; letter-spacing: .06em; }
}
@media (max-width: 380px) { .pg-tabs.tabs button { font-size: 10px; letter-spacing: .02em; } }

/* ---------- follow buttons on leaderboards and player pages ---------- */
ol.board.pg-board li { grid-template-columns: 26px 34px 1fr auto auto; }
.pg-res:has(.pg-fol) { grid-template-columns: auto 1fr auto auto; }
.pg-fol, .fol {
  padding: 6px 11px; border-radius: 999px; border: 1px solid rgba(200, 255, 46, .55); background: rgba(200, 255, 46, .1); color: var(--acid);
  font: 700 10.5px var(--display); letter-spacing: .1em; text-transform: uppercase; cursor: pointer; white-space: nowrap; transition: background .15s, transform .1s;
}
.pg-fol:active, .fol:active { transform: scale(.94); }
.pg-fol.on, .fol.on { border-color: var(--line); background: none; color: var(--muted); }
.pg-social { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 12px 0 2px; font-size: 13px; color: var(--muted); }
.pg-social b { color: var(--text, #f3f4ff); font: 700 16px var(--display); }
.pg-on { color: var(--acid); }
.pg-on::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 8px var(--acid); }
.pg-fy { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; }
.pg-sub { font: 600 11px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 14px 0 7px; }
.pg-act { max-height: 190px; overflow: auto; margin-bottom: 12px; }
.pg-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .06); font: 700 11px var(--display); font-style: normal; color: var(--ice); }
.k-win .pg-ico { color: var(--acid); background: rgba(200, 255, 46, .12); }
.k-lead .pg-ico, .k-promo .pg-ico { color: var(--gold); }
.pg-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }

/* ---------- the Friends hub (public/social.js) ---------- */
.f-top { padding: 10px 18px 0; }
.invite-btn { display: flex; align-items: center; justify-content: center; gap: 9px; }
.invite-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.f-tabs { padding-top: 10px; }
.f-tabs button { white-space: nowrap; letter-spacing: .06em; padding-left: 4px; padding-right: 4px; }
.f-tabs button i { font-style: normal; margin-left: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .08); font-size: 10.5px; }
.f-tabs button i.hotn { background: var(--hot); color: #fff; }
#friendsBody .sheet-scroll { min-height: 46dvh; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; margin-bottom: 10px; border-radius: 11px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.seg button { border: 0; background: none; padding: 7px; border-radius: 8px; cursor: pointer; font: 700 11.5px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.seg button.on { background: var(--acid); color: #07070d; }
.fd, .fl { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fd li, .fl li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); font-size: 13.5px; line-height: 1.3; animation: fdin .3s ease-out backwards; }
@keyframes fdin { from { opacity: 0; transform: translateY(6px); } }
.fd li.f-on { box-shadow: inset 3px 0 0 var(--acid); background: rgba(200, 255, 46, .05); }
.fd li.k-win { background: linear-gradient(90deg, rgba(200, 255, 46, .1), rgba(255, 255, 255, .03) 70%); }
.fd b, .fl b { cursor: pointer; }
.fd small, .fl small { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fd .who, .fl .who { border: 0; padding: 0; background: none; cursor: pointer; position: relative; width: 34px; height: 34px; }
.fd .av, .fl .av, .chl .av { width: 34px; height: 34px; font-size: 14px; position: relative; }
.av.on::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--acid); border: 2px solid #12131f; box-shadow: 0 0 8px var(--acid); }
.fd .amt { font: 700 14px var(--display); font-style: normal; color: var(--acid); text-shadow: 0 0 14px rgba(200, 255, 46, .5); white-space: nowrap; }
.fl .lv { font: 700 10px var(--display); font-style: normal; letter-spacing: .08em; color: var(--gold); margin-left: 4px; }
.fl .fr { font: 700 9.5px var(--display); font-style: normal; letter-spacing: .1em; text-transform: uppercase; color: #07070d; background: var(--ice); padding: 1px 6px; border-radius: 999px; margin-left: 6px; }
.fl.found { margin: 8px 0 2px; }
.fl .btn.sm { padding: 7px 12px; }
.chips.stakes button { padding-left: 2px; padding-right: 2px; }
#linkBox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(4, 4, 10, .7); }
#linkBox[hidden] { display: none; }
#linkBox .lb { width: min(100%, 420px); display: grid; gap: 10px; padding: 18px; border-radius: 16px; background: #12131f; border: 1px solid rgba(200, 255, 46, .5); text-align: center; }
#linkBox b { font: 700 14px var(--display); letter-spacing: .1em; text-transform: uppercase; }
#fQ { text-align: left; }

/* Group pools and comments in the Challenge tab (public/social.js) */
.team { display: flex; flex-wrap: wrap; gap: 6px; }
.team button { padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font: 600 13px Inter, system-ui, sans-serif; cursor: pointer; }
.team button.on { border-color: var(--acid); background: rgba(200, 255, 46, .12); color: var(--acid); }
.fl .now { color: var(--acid); font-weight: 600; }
.chl .av.grp { background: rgba(200, 255, 46, .14); color: var(--acid); font-style: normal; }
.chl li > div[data-act] { cursor: pointer; min-width: 0; }
.chl small.more { color: var(--acid); margin-top: 2px; }
.chl .acts { flex-wrap: wrap; justify-content: flex-end; max-width: 150px; }
.chl .det { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--line); }
.chl .pl { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 3px; counter-reset: pl; }
.chl .pl li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 8px; border-radius: 8px; background: rgba(255, 255, 255, .04); font-size: 13px; }
.chl .pl li.won { box-shadow: inset 0 0 0 1px rgba(200, 255, 46, .5); color: var(--acid); }
.chl .pl em { font-style: normal; font-weight: 700; }
.cmts ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; max-height: 180px; overflow-y: auto; }
.cmts li { display: block; padding: 6px 9px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 13px; overflow-wrap: anywhere; }
.cmts li.me { background: rgba(200, 255, 46, .08); }
.cmts li small { display: inline; margin-left: 6px; }
.cmts .empty { margin: 0 0 8px; }

/* Friends list rows: picture, name over level and status, then the buttons. One line each, nothing wraps. */
.fl .fn { display: block; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl .fa { display: flex; gap: 6px; flex: none; }
.fl .fa .btn.sm { padding: 7px 12px; min-width: 52px; }
/* The floating chat button steps aside while a sheet is open, so it never sits on a row or a button. */
body:has(.sheet-wrap:not([hidden])) #talkBtn:not(.in-hud):not(.in-panel) { display: none; }
