/* =========================================================================
   PORTAL LANDING PAGE  (Elemental direction — night blue + resource spectrum)
   Bento layout: Play the CPU / Play a friend / Recently played tiles, then the
   updates shown in full right on the page. Shown first via body.portal-open;
   "Play" swaps it for the setup screen.
   ========================================================================= */
body.portal-open { padding: 0; }  /* the app's 1.5rem body padding would inset the full-bleed portal */

/* The floating top-left "📖 Rules" button is retired — the rules now live behind the portal's
   "Rules" link (which opens this same #rulesDetails modal). The drawer content stays. */
.rules-details > summary { display: none !important; }
body.portal-open #introHead, body.portal-open #setup { display: none !important; }
#portal { display: none; }
body.portal-open:not(.in-match) #portal { display: block; }

#portalHomeBtn {
  position: fixed; top: 0.8rem; left: 1rem; z-index: 40;
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 8px; padding: 0.38rem 0.72rem; font-size: 0.8rem; cursor: pointer; font-family: inherit; font-weight: 600;
}
#portalHomeBtn:hover { border-color: var(--cs-gold); color: var(--hi, #fff); }
body.portal-open #portalHomeBtn, body.in-match #portalHomeBtn { display: none; }

#portal {
  --pt-bg: #0b0f1e; --pt-panel: #111733; --pt-panel-2: #0f1430;
  --pt-line: #1f2850; --pt-line-2: #2c3770; --pt-line-soft: rgba(255,255,255,.06);
  --pt-ink: #eaf0ff; --pt-dim: #b6c1e6; --pt-dim2: #96a1c8;
  --air: #7fc7e8; --void: #a481d6; --void-ink: #c3a6f0; --life: #5ccf92; --fire: #e87a45; --coral: #ff8a65; --gold: #e6c15a; --live: #4be08f;
  position: relative; min-height: 100vh; background: var(--pt-bg); color: var(--pt-ink);
  font-family: "Manrope", system-ui, sans-serif; line-height: 1.5; overflow-x: hidden; text-align: left;
}
#portal * { box-sizing: border-box; }
#portal a { color: inherit; text-decoration: none; }
#portal h1, #portal h2, #portal h3 { text-wrap: balance; margin: 0; }
#portal button { font-family: inherit; cursor: pointer; }
#portal button:focus-visible, #portal a:focus-visible, #portal input:focus-visible { outline: 2px solid var(--air); outline-offset: 2px; }
#portal .pt-wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 28px); }

#portal .pt-aurora { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#portal .pt-aurora::before, #portal .pt-aurora::after { content: ""; position: absolute; width: 60vw; height: 60vw; border-radius: 50%; filter: blur(90px); }
#portal .pt-aurora::before { top: -26vw; left: -14vw; background: radial-gradient(circle, var(--air), transparent 65%); opacity: .12; }
#portal .pt-aurora::after  { top: -22vw; right: -16vw; background: radial-gradient(circle, var(--void), transparent 65%); opacity: .14; }
#portal > main, #portal > .pt-header, #portal > .pt-footer { position: relative; z-index: 1; }

/* ---- public beta strip (above the header; scrolls away, the header stays sticky) ---- */
#portal .pt-beta { position: relative; z-index: 31; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; padding: 10px clamp(16px, 4vw, 28px); background: linear-gradient(90deg, #2a1c08, #3a2a0c 50%, #2a1c08); border-bottom: 1px solid #6b5220; font-size: 14px; color: #f3e2b3; text-align: center; }
#portal .pt-beta .tag { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 3px 9px; border-radius: 5px; background: var(--gold); color: #1a1205; }
#portal .pt-beta b { color: #fff3cf; }
#portal .pt-beta button { background: none; border: 0; padding: 4px 0; color: #ffd97a; font-weight: 700; font-size: 14px; }
#portal .pt-beta button:hover { text-decoration: underline; }
/* Keep the strip clear of the fixed top-right sign-in button. */
@media (max-width: 1600px) and (min-width: 701px) { #portal .pt-beta { padding-right: 180px; } }
@media (max-width: 700px) { #portal .pt-beta { padding-right: 130px; justify-content: flex-start; text-align: left; font-size: 13px; } #portal .pt-beta .why { display: none; } }

/* ---- header ---- */
#portal .pt-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--pt-bg) 80%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--pt-line-soft); }
#portal .pt-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
#portal .pt-brand { display: flex; align-items: center; gap: 10px; font-family: "Chakra Petch"; font-weight: 700; font-size: 20px; color: var(--pt-ink); background: none; border: 0; padding: 0; }
#portal .pt-orb { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(#7fc7e8, #5ccf92, #e6c15a, #e87a45, #d27ad9, #a481d6, #7fc7e8); flex: 0 0 auto; }
#portal .pt-nav nav { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: center; }
#portal .pt-link { background: none; border: 0; padding: 4px 0; color: var(--pt-dim); font-size: 15px; font-weight: 600; }
#portal .pt-link:hover { color: var(--pt-ink); }
#portal .pt-build { color: var(--pt-dim); font-size: 15px; font-weight: 600; }
#portal .pt-build:hover { color: var(--pt-ink); }
#portal .pt-online { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--pt-online-bg, #0f2a22); border: 1px solid var(--pt-online-line, #1f5a44); font-size: 13px; font-weight: 600; color: var(--pt-online-ink, #bdf3d6); }
#portal .pt-online .d { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 3px rgba(75,224,143,.22); animation: ptblink 2.4s infinite; }
@keyframes ptblink { 50% { opacity: .45; } }

/* ---- shared bits ---- */
#portal .pt-main { display: flex; flex-direction: column; gap: 20px; padding-top: 22px; padding-bottom: 28px; }
#portal .pt-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 14px; }
#portal .pt-row.wrap { flex-wrap: wrap; align-items: center; justify-content: flex-start; }
#portal .pt-kick { font-family: "IBM Plex Mono", monospace; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
#portal .pt-kick.air { color: var(--air); } #portal .pt-kick.void { color: var(--void-ink); }
#portal .pt-dim { font-size: 14px; color: var(--pt-dim2); }
#portal .pt-go { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 0; font-weight: 700; font-size: 16px; color: var(--pt-bg); transition: filter .15s; }
#portal .pt-go:hover { filter: brightness(1.08); }
#portal .pt-go.air { background: var(--air); } #portal .pt-go.void { background: var(--void); }

/* ---- bento ---- */
#portal .pt-bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(170px, auto); gap: 16px; }
#portal .pt-bento > section { border-radius: 18px; background: var(--pt-panel); border: 1px solid var(--pt-line); }

#portal .pt-cpu { grid-column: 1 / span 2; grid-row: 1 / span 2; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; padding: 30px; border-color: var(--pt-accent-line, #2a3a6e) !important; }
#portal .pt-cpu-copy, #portal .pt-cpu-act { position: relative; display: flex; flex-direction: column; gap: 12px; }
#portal .pt-cpu-copy { max-width: min(300px, calc(100% - 250px)); gap: 10px; }
#portal .pt-cpu h1 { font-family: "Chakra Petch"; font-weight: 700; font-size: clamp(30px, 3.2vw, 40px); line-height: 1.05; white-space: nowrap; }
#portal .pt-cpu p { margin: 0; font-size: 16px; color: var(--pt-dim); }
#portal .pt-cpu .pt-go { align-self: flex-start; }
#portal .pt-fan { position: absolute; right: 4px; top: 24px; width: 250px; height: 260px; pointer-events: none; }
#portal .pt-fan img { position: absolute; width: 124px; height: 174px; object-fit: cover; object-position: top; border-radius: 10px; opacity: .55; }
#portal .pt-fan img:nth-child(1) { right: 118px; top: 26px; transform: rotate(-10deg); }
#portal .pt-fan img:nth-child(2) { right: 8px; top: 26px; transform: rotate(10deg); }
#portal .pt-fan img:nth-child(3) { right: 56px; top: 0; width: 146px; height: 204px; opacity: 1; box-shadow: 0 10px 30px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
#portal .pt-diff { display: flex; flex-wrap: wrap; gap: 8px; }
#portal .pt-diff button { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--pt-line-2); background: var(--pt-bg); color: var(--pt-soft-ink, #c3cbe6); font-weight: 600; font-size: 14px; }
#portal .pt-diff button:hover { border-color: var(--air); }
#portal .pt-diff button[aria-pressed="true"] { border-color: var(--air); background: var(--pt-accent-soft, #1a2a5a); color: var(--pt-ink); font-weight: 700; }

#portal .pt-friend { grid-column: 3 / span 2; display: flex; flex-direction: column; justify-content: space-between; gap: 14px; padding: 24px 26px; border-color: var(--pt-p2-line, #3a2e66) !important; }
#portal .pt-friend h2 { font-family: "Chakra Petch"; font-weight: 700; font-size: 28px; margin-top: 6px; }
#portal .pt-rooms { font-size: 13px; color: var(--pt-online-ink, #bdf3d6); }
#portal .pt-friend .pt-go { min-height: 46px; padding: 0 18px; font-size: 15px; border-radius: 10px; }
#portal .pt-join { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 6px 0 14px; border-radius: 10px; background: var(--pt-bg); border: 1px solid var(--pt-line-2); margin: 0; }
#portal .pt-join label { font-size: 14px; color: var(--pt-dim2); }
#portal .pt-join input { width: 110px; background: transparent; border: 0; outline: 0; color: var(--pt-ink); font: 500 14px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; padding: 0; }
#portal .pt-join button { min-height: 34px; padding: 0 12px; border-radius: 8px; border: 0; background: var(--pt-btn, #26305e); color: var(--pt-ink); font-weight: 700; font-size: 14px; }

#portal .pt-recent { grid-column: 3 / span 2; display: flex; flex-direction: column; gap: 12px; padding: 20px 22px; }
#portal .pt-recent h2 { font-family: "Chakra Petch"; font-weight: 700; font-size: 20px; }
#portal .pt-recent .pt-link { font-size: 14px; }
#portal .pt-recent-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
#portal .pt-rc { display: flex; flex-direction: column; gap: 5px; min-width: 0; padding: 0; background: none; border: 0; color: var(--pt-ink); text-align: left; }
#portal .pt-rc .art { display: block; height: 104px; border-radius: 9px; overflow: hidden; border: 1px solid var(--pt-btn, #26305e); background: var(--pt-art-bg, #151c3d); }
#portal .pt-rc .art img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .2s; }
#portal .pt-rc .art .mono { display: grid; place-items: center; height: 100%; font-family: "Chakra Petch"; font-weight: 700; font-size: 30px; color: var(--air); }
#portal .pt-rc:hover .art img { transform: scale(1.04); }
#portal .pt-rc:hover .art { border-color: var(--air); }
#portal .pt-rc .nm { font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#portal .pt-rc .sub { font-size: 11px; color: var(--pt-dim2); }
#portal .pt-rc .sub.won { color: color-mix(in srgb, #8fe3b4, var(--text) var(--ink-mix, 0%)); } #portal .pt-rc .sub.lost { color: color-mix(in srgb, #ffb089, var(--text) var(--ink-mix, 0%)); }

/* ---- What's new (updates in full, right on the page) ---- */
#portal .pt-news { display: flex; flex-direction: column; gap: 18px; padding: 28px; border-radius: 20px; background: var(--pt-panel-2); border: 1px solid var(--pt-line); scroll-margin-top: 80px; }
#portal .pt-news h2 { font-family: "Chakra Petch"; font-weight: 700; font-size: 30px; }
#portal .pt-news-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
#portal .pt-newset { flex: 1 1 300px; max-width: 380px; display: flex; flex-direction: column; gap: 16px; padding: 22px; border-radius: 16px; background: var(--pt-newset-bg, #1a1430); border: 1px solid var(--pt-newset-line, #4a2f2a); color: var(--pt-ink); text-align: left; transition: border-color .15s; }
#portal .pt-newset[hidden] { display: none; }
#portal .pt-newset:hover { border-color: var(--coral); }
#portal .pt-newset .fan { position: relative; display: block; height: 186px; }
#portal .pt-newset .fan img { position: absolute; width: 118px; height: 166px; object-fit: cover; object-position: top; border-radius: 9px; }
#portal .pt-newset .fan img:nth-child(1) { left: 0; top: 14px; transform: rotate(-9deg); }
#portal .pt-newset .fan img:nth-child(2) { left: 22%; top: 4px; transform: rotate(-3deg); }
#portal .pt-newset .fan img:nth-child(3) { left: 44%; top: 4px; transform: rotate(3deg); }
#portal .pt-newset .fan img:nth-child(4) { left: 64%; top: 10px; transform: rotate(9deg); box-shadow: 0 10px 26px color-mix(in srgb, var(--shade, #000) 55%, transparent); }
#portal .pt-newset .tag { align-self: flex-start; font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 4px 8px; border-radius: 5px; background: var(--coral); color: #1a0d07; }
#portal .pt-newset .nm { font-family: "Chakra Petch"; font-weight: 700; font-size: 24px; line-height: 1.15; }
#portal .pt-newset .cta { font-size: 15px; color: color-mix(in srgb, #ffb089, var(--text) var(--ink-mix, 0%)); font-weight: 700; }
#portal .pt-newset .txt { display: flex; flex-direction: column; gap: 8px; }
#portal .pt-notes { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
#portal #ptPatchList { display: flex; flex-direction: column; gap: 12px; }
#portal .pt-note { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border-radius: 14px; background: var(--pt-panel); border: 1px solid var(--pt-line); }
#portal .pt-note .r1 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#portal .pt-note .chip { font-size: 11px; font-weight: 800; letter-spacing: .05em; padding: 3px 8px; border-radius: 5px; color: var(--pt-on-air, var(--pt-bg)); background: var(--air); text-transform: uppercase; }
#portal .pt-note .chip.new { background: #ffb089; } #portal .pt-note .chip.fix { background: var(--life); }
#portal .pt-note .chip.cards { background: var(--gold); } #portal .pt-note .chip.event { background: var(--void-ink); }
#portal .pt-note time { font-family: "IBM Plex Mono", monospace; font-size: 13px; color: var(--pt-dim2); }
#portal .pt-note h3 { font-family: "Chakra Petch"; font-weight: 700; font-size: 20px; line-height: 1.25; }
#portal .pt-note p { margin: 0; font-size: 15px; line-height: 1.6; color: var(--pt-soft-ink, #c3cbe6); }
#portal .pt-more { align-self: flex-start; min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--pt-line-2); background: transparent; color: var(--air); font-weight: 700; font-size: 15px; }
#portal .pt-more:hover { border-color: var(--air); }

#portal .pt-footer { padding: 6px 0 36px; }
#portal .pt-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--pt-foot-ink, #8f9bc4); }

/* The fixed top-right "Sign in" button (.auth-widget) would sit on the header links: keep clear of it. */
@media (max-width: 1600px) and (min-width: 701px) { #portal .pt-nav { padding-right: 180px; } }
@media (max-width: 980px) {
  #portal .pt-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #portal .pt-cpu { grid-column: 1 / -1; grid-row: auto; min-height: 340px; }
  #portal .pt-friend, #portal .pt-recent { grid-column: auto; }
}
@media (max-width: 700px) {
  #portal .pt-bento { grid-template-columns: minmax(0, 1fr); }
  #portal .pt-friend, #portal .pt-recent { grid-column: 1 / -1; }
  #portal .pt-fan { display: none; }
  #portal .pt-cpu-copy { max-width: none; }
  #portal .pt-cpu { padding: 24px 20px; min-height: 0; }
  #portal .pt-news { padding: 20px 16px; }
  #portal .pt-newset { max-width: none; }
  #portal .pt-recent-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #portal .pt-nav nav { gap: 6px 16px; }
}
@media (prefers-reduced-motion: reduce) { #portal *, #portalHomeBtn { animation: none !important; transition: none !important; } }

/* =========================================================================
   META PAGE  (Tournament deck power rankings — same Elemental system)
   ========================================================================= */
#metaPage { display: none; }
body.meta-open { padding: 0; }
body.meta-open #metaPage { display: block; }
body.meta-open #portal, body.meta-open #setup, body.meta-open #introHead { display: none !important; }
body.meta-open #portalHomeBtn { display: none; }

#metaPage {
  --pt-bg: #0b0f1e; --pt-panel: rgba(255,255,255,.045); --pt-line: rgba(255,255,255,.10); --pt-line-soft: rgba(255,255,255,.06);
  --pt-ink: #eaf0ff; --pt-dim: #96a1c8; --pt-dim2: #6f7aa0; --air: #7fc7e8; --void: #a481d6;
  position: relative; min-height: 100vh; background: var(--pt-bg); color: var(--pt-ink);
  font-family: "Manrope", system-ui, sans-serif; overflow-x: hidden; text-align: left; padding-bottom: 40px;
}
#metaPage * { box-sizing: border-box; }
#metaPage a { color: inherit; text-decoration: none; }
#metaPage .mp-wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(18px, 5vw, 40px); }
#metaPage .mp-aurora { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#metaPage .mp-aurora::before { content: ""; position: absolute; top: -22vw; right: -12vw; width: 55vw; height: 55vw; border-radius: 50%; filter: blur(90px); background: radial-gradient(circle, var(--void), transparent 65%); opacity: .22; }
#metaPage > * { position: relative; z-index: 1; }

#metaPage .mp-header { position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--pt-bg) 72%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--pt-line-soft); }
#metaPage .mp-nav { display: flex; align-items: center; gap: 16px; height: 62px; }
/* s51108: the fixed top-right "Sign in" button (.auth-widget) covered the meta header's "Live meta" / "Build" links on phones and
   narrow windows - keep clear of it, the same as #portal .pt-nav. */
@media (max-width: 1400px) and (min-width: 761px) { #metaPage .mp-nav { padding-right: 170px; } }
@media (max-width: 760px) { #metaPage .mp-nav { padding-right: 118px; gap: 10px; } #metaPage .mp-nav nav a:not(.mp-build) { display: none; } #metaPage .mp-nav .mp-brand { display: none; } }
#metaPage .mp-back { background: var(--pt-panel); border: 1px solid var(--pt-line); color: var(--pt-ink); border-radius: 9px; padding: 8px 14px; font-family: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; }
#metaPage .mp-back:hover { border-color: var(--air); }
#metaPage .mp-brand { display: flex; align-items: center; gap: 9px; font-family: "Chakra Petch"; font-weight: 700; font-size: 16px; }
#metaPage .mp-orb { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 210deg, var(--air), var(--void), #e87a45, #5ccf92, var(--air)); box-shadow: 0 0 12px -2px var(--air); }
#metaPage .mp-nav nav { margin-left: auto; display: flex; gap: 18px; align-items: center; }
#metaPage .mp-nav nav a { font-size: 13.5px; color: var(--pt-dim); font-weight: 600; }
#metaPage .mp-nav nav a:hover { color: var(--pt-ink); }
#metaPage .mp-build { color: var(--pt-bg) !important; background: linear-gradient(100deg, var(--air), var(--void)); padding: 7px 13px; border-radius: 8px; }

#metaPage .mp-intro { padding: clamp(30px, 5vw, 52px) 0 22px; }
#metaPage .mp-intro .kick { font-family: "IBM Plex Mono"; font-size: 12px; letter-spacing: .24em; text-transform: uppercase; color: var(--air); }
#metaPage .mp-intro h1 { font-family: "Chakra Petch"; font-weight: 700; font-size: clamp(30px, 5vw, 52px); margin: 10px 0 0; text-wrap: balance; }
#metaPage .mp-intro p { color: var(--pt-dim); font-size: 15.5px; max-width: 62ch; margin: 12px 0 0; line-height: 1.6; }

#metaPage .mp-podium { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin: 22px 0 30px; }
#metaPage .mp-pod { position: relative; overflow: hidden; border-radius: 16px; padding: 20px; border: 1px solid var(--pt-line); background: linear-gradient(160deg, color-mix(in srgb, var(--el) 20%, var(--pt-pod-a, #101634)), color-mix(in srgb, var(--el) 6%, var(--pt-pod-b, #0c1128))); display: flex; flex-direction: column; gap: 4px; }
#metaPage .mp-pod::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--el); }
#metaPage .mp-pod .rk { position: absolute; top: 14px; right: 16px; font-family: "Chakra Petch"; font-weight: 700; font-size: 40px; color: color-mix(in srgb, var(--el) 55%, var(--hi, #fff)); opacity: .35; }
#metaPage .mp-pod .badge { align-self: flex-start; font-family: "IBM Plex Mono"; font-size: 10px; letter-spacing: .12em; padding: 4px 9px; border-radius: 5px; background: color-mix(in srgb, var(--el) 26%, transparent); color: color-mix(in srgb, var(--el) 70%, var(--hi, #fff)); font-weight: 500; }
#metaPage .mp-pod .mono { font-family: "Chakra Petch"; font-weight: 700; font-size: 30px; color: color-mix(in srgb, var(--el) 70%, var(--hi, #fff)); margin-top: 10px; }
#metaPage .mp-pod h3 { font-family: "Chakra Petch"; font-weight: 700; font-size: 19px; margin: 2px 0 0; line-height: 1.05; }
#metaPage .mp-pod .sym { font-family: "IBM Plex Mono"; font-size: 12px; color: var(--pt-dim); letter-spacing: .04em; }
#metaPage .mp-pod .wr { font-family: "Chakra Petch"; font-weight: 700; font-size: 26px; color: var(--el); margin-top: 6px; }
#metaPage .mp-pod .play { margin-top: 12px; align-self: flex-start; background: color-mix(in srgb, var(--el) 22%, transparent); color: color-mix(in srgb, var(--el) 75%, var(--hi, #fff)); border: 1px solid color-mix(in srgb, var(--el) 45%, transparent); border-radius: 9px; padding: 9px 15px; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer; }
#metaPage .mp-pod .play:hover { background: color-mix(in srgb, var(--el) 34%, transparent); }

#metaPage .mp-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
#metaPage .mp-filters { display: flex; gap: 7px; flex-wrap: wrap; }
#metaPage .chip { background: var(--pt-panel); border: 1px solid var(--pt-line); color: var(--pt-dim); border-radius: 20px; padding: 6px 14px; font-family: "Chakra Petch"; font-weight: 600; font-size: 12.5px; cursor: pointer; }
#metaPage .chip:hover { color: var(--pt-ink); border-color: var(--el); }
#metaPage .chip.on { color: var(--pt-chip-ink, var(--pt-bg)); background: var(--el); border-color: var(--el); }
#metaPage .mp-count { font-family: "IBM Plex Mono"; font-size: 12px; color: var(--pt-dim2); }

#metaPage .mp-table { display: flex; flex-direction: column; gap: 6px; }
#metaPage .mp-row { display: grid; grid-template-columns: 34px 40px 1fr auto 150px 52px auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--pt-line); border-radius: 12px; background: var(--pt-panel); }
#metaPage .mp-row:hover { border-color: color-mix(in srgb, var(--air) 40%, var(--pt-line)); }
#metaPage .mp-row .rank { font-family: "IBM Plex Mono"; color: var(--pt-dim2); font-size: 14px; text-align: center; font-variant-numeric: tabular-nums; }
#metaPage .mp-row .mono { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-family: "Chakra Petch"; font-weight: 700; font-size: 15px; color: color-mix(in srgb, var(--el) 75%, var(--hi, #fff)); background: color-mix(in srgb, var(--el) 18%, transparent); }
#metaPage .mp-row .who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
#metaPage .mp-row .who b { font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#metaPage .mp-row .who small { color: var(--pt-dim2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#metaPage .mp-row .sym { font-family: "IBM Plex Mono"; font-size: 12px; letter-spacing: .04em; white-space: nowrap; }
#metaPage .mp-row .wrbar { height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--hi, #fff) 8%, transparent); overflow: hidden; }
#metaPage .mp-row .wrbar i { display: block; height: 100%; }
#metaPage .mp-row .pct { font-family: "IBM Plex Mono"; font-size: 13.5px; color: var(--air); text-align: right; font-variant-numeric: tabular-nums; }
#metaPage .mp-row .play { background: transparent; border: 1px solid var(--pt-line); color: var(--pt-dim); border-radius: 8px; padding: 7px 12px; font-family: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
#metaPage .mp-row .play:hover { color: var(--pt-bg); background: var(--air); border-color: var(--air); }

#metaPage .mp-source { color: var(--pt-dim2); font-size: 13px; margin-top: 26px; line-height: 1.6; }
#metaPage .mp-source a { color: var(--air); font-weight: 600; }

@media (max-width: 760px) {
  #metaPage .mp-podium { grid-template-columns: 1fr; }
  #metaPage .mp-row { grid-template-columns: 28px 34px 1fr 60px auto; }
  #metaPage .mp-row .sym, #metaPage .mp-row .wrbar { display: none; }
}
@media (prefers-reduced-motion: reduce) { #metaPage * { animation: none !important; transition: none !important; } }

/* =========================================================================
   p41112 (Discord "New Home Screen"): the lobby is the home page.
   - #p41112NewsBtn: the lobby's top-left "News" button (was "⌂ Home"), red dot while there are unseen updates.
   - #portal.p41112-news: the News pop-up - the old home's What's new section (same .pt-* cards and --pt-* tokens) as a dialog.
   - the account button + menu (#w21110AcctBtn / #w21110AcctMenu) at EVERY width on the lobby (it was phone-only): Friends, History,
     Appearance, Feedback, Rules, Sign out / Sign in. The match top bar keeps its plain row (the toggle isn't rendered there).
   ========================================================================= */
#p41112NewsBtn {
  position: fixed; top: 0.8rem; left: 1rem; z-index: 40; display: inline-flex; align-items: center; gap: 6px;
  background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright);
  border-radius: 8px; padding: 0.38rem 0.72rem; font-size: 0.8rem; cursor: pointer; font-family: inherit; font-weight: 600; line-height: 1.2;
}
#p41112NewsBtn:hover, #p41112NewsBtn[aria-expanded="true"] { border-color: var(--cs-gold); color: var(--hi, #fff); }
#p41112NewsBtn svg { flex: none; }
#p41112NewsBtn .p41112-dot {
  position: absolute; top: -4px; right: -4px; width: 11px; height: 11px; border-radius: 50%;
  background: #e5484d; box-shadow: 0 0 0 2px var(--t-bg, #0a0f1f);
}
body.in-match #p41112NewsBtn, body.meta-open #p41112NewsBtn { display: none; }
body.p41112-news-on { overflow: hidden; }

#portal.p41112-news {
  display: flex; position: fixed; inset: 0; z-index: 60; min-height: 0; padding: clamp(12px, 3vw, 32px); box-sizing: border-box;
  align-items: center; justify-content: center; overflow: hidden;
  background: color-mix(in srgb, var(--scrim, #000) 66%, transparent);
}
#portal.p41112-news .p41112-news-panel {
  width: min(1100px, 100%); max-height: 100%; overflow-y: auto; overscroll-behavior: contain; box-sizing: border-box;
  padding: 24px 26px 28px; gap: 16px; box-shadow: 0 24px 60px rgb(0 0 0 / 0.45);
}
#portal.p41112-news .p41112-news-head { align-items: center; justify-content: flex-start; flex-wrap: wrap; }
#portal.p41112-news .p41112-news-head h2 { margin-right: auto; }
#portal.p41112-news .p41112-news-close {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: none; padding: 0;
  border-radius: 12px; border: 1px solid var(--pt-line-2); background: var(--pt-panel); color: var(--pt-ink);
}
#portal.p41112-news .p41112-news-close:hover { border-color: var(--air); }
#portal.p41112-news .pt-beta {
  padding: 10px 14px; border-radius: 12px; border: 1px solid #6b5220; justify-content: flex-start; text-align: left; z-index: auto;
}
html[data-theme-mode="light"] #portal.p41112-news .pt-beta { border-color: #d4b25c; }
#portal.p41112-news .pt-newset { flex: 1 1 280px; }
@media (max-width: 700px) {
  #portal.p41112-news { padding: 0; align-items: stretch; }
  #portal.p41112-news .p41112-news-panel { width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px)); }
  #portal.p41112-news .p41112-news-head h2 { font-size: 26px; }
  #portal.p41112-news .pt-beta { padding: 10px 12px; font-size: 13px; }
  #portal.p41112-news .pt-beta .why { display: none; }
  #portal.p41112-news .pt-newset { max-width: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  #portal.p41112-news { padding: 0; }
  #portal.p41112-news .p41112-news-panel { width: 100%; height: 100%; border-radius: 0; }
}

/* The account button + menu on the lobby at every width (style.css's w21110 phone block, extended to desktop). #signInBtn moves into
   the menu ("Sign in with Google"); #signedInAs stays shown (it holds the button) - app.js hides the account-only items for a guest. */
body > .auth-widget > #signInBtn { display: none; }
body > .auth-widget .w21110-acct-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border-radius: 50%; overflow: hidden;
  background: var(--t-accent, var(--cs-panel-2)); color: var(--t-on-accent, var(--cs-text)); border: 2px solid var(--cs-line-bright);
  font-size: 16px; font-weight: 800; line-height: 1; box-shadow: 0 2px 8px rgb(0 0 0 / 0.35); cursor: pointer;
}
body > .auth-widget .w21110-acct-btn:hover, body > .auth-widget .w21110-acct-btn[aria-expanded="true"] { border-color: var(--cs-gold); }
body > .auth-widget .w21110-acct-btn img { width: 100%; height: 100%; border: 0; border-radius: 0; object-fit: cover; display: block; }
body > .auth-widget .w21110-acct-btn svg { display: block; }
body > .auth-widget #authAvatar, body > .auth-widget #authName { display: none; }
body > .auth-widget .w21110-acct-menu {
  display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 41; flex-direction: column; align-items: stretch; gap: 2px;
  min-width: 200px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 6px; border-radius: 12px;
  background: var(--t-surf, var(--cs-panel-2)); border: 1px solid var(--cs-line-bright); box-shadow: 0 14px 34px rgb(0 0 0 / 0.45);
}
body > .auth-widget .w21110-acct-btn[aria-expanded="true"] ~ .w21110-acct-menu { display: flex; }
body > .auth-widget .w21110-acct-menu button {
  min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--t-text, var(--cs-text));
  font-size: 14px; font-weight: 600; text-align: left; width: 100%; cursor: pointer;
}
body > .auth-widget .w21110-acct-menu button:hover, body > .auth-widget .w21110-acct-menu button:focus-visible { background: var(--t-surf2, var(--cs-panel)); }
body > .auth-widget .w21110-acct-menu .p41112-acct-signin { color: var(--t-accent, var(--cs-gold)); font-weight: 800; }
body > .auth-widget #signOutBtn { margin-top: 4px; border-top: 1px solid var(--t-line, var(--cs-line-bright)); border-radius: 0 0 8px 8px; }
body > .auth-widget .w21110-acct-who {
  display: block; padding: 4px 12px 6px; font-size: 12px; color: var(--t-muted, var(--cs-text-dim)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body > .auth-widget .w21110-acct-who:empty { display: none; }
@media (max-width: 820px), (max-height: 520px) {
  body > .auth-widget .w21110-acct-btn { width: 36px; height: 36px; }
  body > .auth-widget .w21110-acct-menu button { min-height: 42px; font-size: 15px; }
}
/* The match top bar keeps its plain row (avatar, Friends, History, Sign out / Sign in) - the lobby-only menu items don't ride along. */
#matchTopbar .p41112-acct-x { display: none !important; }
/* r66mh (Discord "[Mobile] Home"): phones - the menu button left of the profile button (Tutorial / Training Puzzles / More options), in the
   News button's style at the profile button's size; its menu is the account menu's look, at the same spot. Never on desktop / in a match. */
.r66mh-nav { display: none; }
@media (max-width: 820px), (max-height: 520px) {
  body > .auth-widget .r66mh-nav { display: inline-flex; }
  body.in-match .r66mh-nav, body.meta-open .r66mh-nav, #matchTopbar .r66mh-nav { display: none !important; }
  body > .auth-widget .r66mh-menu-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; box-sizing: border-box;
    background: var(--cs-panel-2); color: var(--cs-text); border: 1px solid var(--cs-line-bright); border-radius: 8px; cursor: pointer;
  }
  body > .auth-widget .r66mh-menu-btn:hover, body > .auth-widget .r66mh-menu-btn[aria-expanded="true"] { border-color: var(--cs-gold); color: var(--hi, #fff); }
  body > .auth-widget .r66mh-menu-btn svg { display: block; flex: none; }
  body > .auth-widget .r66mh-menu {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 41; flex-direction: column; align-items: stretch; gap: 2px;
    min-width: 200px; max-width: calc(100vw - 16px); box-sizing: border-box; padding: 6px; border-radius: 12px;
    background: var(--t-surf, var(--cs-panel-2)); border: 1px solid var(--cs-line-bright); box-shadow: 0 14px 34px rgb(0 0 0 / 0.45);
  }
  body > .auth-widget .r66mh-menu-btn[aria-expanded="true"] ~ .r66mh-menu { display: flex; }
  body > .auth-widget .r66mh-menu button {
    min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--t-text, var(--cs-text));
    font-size: 15px; font-weight: 600; text-align: left; width: 100%; cursor: pointer;
  }
  body > .auth-widget .r66mh-menu button:hover, body > .auth-widget .r66mh-menu button:focus-visible { background: var(--t-surf2, var(--cs-panel)); }
}
@media (hover: none) { body > .auth-widget .r66mh-menu .r66mh-more { display: none; } } /* touch: More options has nothing left (keys only) */
/* r69mh (Discord "[Mobile] Home" follow-up): phones - the header's right corner gets the same 16px gutter as News on the left (it was 8px),
   centred on the News button / VERSUS line, and the menu and profile buttons get a 10px gap (the lobby's gap between its rows and between
   the sliders button and FIGHT) instead of 6px. Never the match top bar (the widget isn't a body child there). */
@media (max-width: 820px), (max-height: 520px) {
  body > .auth-widget { top: 10px; right: 16px; }
  body > .auth-widget > .signed-in-as { gap: 10px; }
}
