/* =============================================================================
   platform.css — rankings / profile / clubs pages in the Arena layout (#189).
   Source of truth: client/platform-arena-mockup.html. Tokens only (css/tokens.css),
   so every skin × mode works. Page scripts build markup with these classes.
   ============================================================================= */

[hidden] { display: none !important; }   /* a class's `display` must never defeat the attribute */

body.pl { margin: 0; background: var(--c-bg); color: var(--c-ink); font-family: 'Nunito', system-ui, sans-serif; -webkit-font-smoothing: antialiased; line-height: 1.5; min-height: 100vh; min-height: 100svh; overflow-x: hidden; overflow-x: clip; }   /* #215: main.css hides overflow-x on body, which makes body a (non-scrolling) scroll container and kills every position:sticky; clip does not */
/* #409: solid page background. html paints var(--c-bg) (main.css), body.pl paints it too; no grid/leaf layers (see docs/todo/F409). */

/* Icon size scale (#214, docs/knowledge/ui-ux/iconography.md): nothing below 16px on platform pages. */
.pl { --icon-sm: 16px; --icon-md: 20px; --icon-lg: 24px; --ptabbar-h: 68px;
  --c-border-strong: color-mix(in srgb, var(--c-ink) 55%, transparent);   /* F1: control borders >=3:1 vs surface (--c-border is a 10% divider tint) */
  --scrim: rgba(0, 0, 0, .6); --scrim-ring: rgba(0, 0, 0, .55); --shadow-pop: 0 8px 24px rgba(0, 0, 0, .35); --shadow-pop-soft: 0 8px 24px rgba(0, 0, 0, .25); }   /* F5: overlay literals as tokens */   /* --ptabbar-h: mobile tab bar height, shared by the bar and anything sticky above it (#215) */
.pl a { color: inherit; text-decoration: none; }
.pl :where(button, input, textarea, select) { font: inherit; color: inherit; }   /* :where → zero specificity, component sizes win */
.pl :focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }
/* Settings panel (B192): Arena 5px radius — shell.css carries this on lobby/room, platform pages do not load shell.css. */
.pl .gset-btn, .pl .gset-segment, .pl .gset-segment__opt { border-radius: var(--radius); }

/* ── Page frame ──────────────────────────────────────────────────────────── */
.papp { max-width: 1180px; margin: 0 auto; padding: 28px 24px 96px; }
.pintro { margin-bottom: 22px; }
.pintro h1 { margin: 0; font-size: calc(22px * var(--fs-scale, 1)); font-weight: 700; }
.pintro p { margin: 4px 0 0; }
.muted { color: var(--c-ink-2); }
.small { font-size: calc(14px * var(--fs-scale, 1)); }
.up { color: var(--c-success); }
.dn { color: var(--c-error); }

/* ── Panels / split ──────────────────────────────────────────────────────── */
.psplit { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.ppanel { background: var(--c-surface); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card); }
.cb-panel > .ppanel { margin-bottom: 20px; }
.cb-chat { display: flex; flex-direction: column; gap: 12px; }
.cb-chat__log { display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.cb-chat__msg { display: flex; gap: 10px; align-items: flex-start; }
.cb-chat__body { min-width: 0; flex: 1; }
.cb-chat__who { font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-3); }
.cb-chat__text { font-size: calc(14px * var(--fs-scale, 1)); overflow-wrap: anywhere; }
.cb-chat__form { display: flex; gap: 10px; }
.cb-chat__form input { flex: 1; min-width: 0; padding: 10px 12px; font-size: calc(14px * var(--fs-scale, 1)); border: 1px solid var(--c-border-strong); border-radius: var(--radius); background: var(--c-field); }
.ph2 { margin: 0 0 14px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 700; letter-spacing: .02em; color: var(--c-ink); }
.ph2--gap { margin-top: 28px; }
.pcode { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); user-select: all; }
.pcode code { color: var(--c-ink); font-size: calc(14px * var(--fs-scale, 1)); }
.padd { margin: 0 0 8px; }
.padd input { width: 100%; box-sizing: border-box; min-height: 38px; padding: 6px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-ink); font: inherit; font-size: calc(14px * var(--fs-scale, 1)); }
.pnote { margin: 12px 0 0; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); }
#tournament-club-note { margin: 0 0 14px; }
.pnote--error { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--c-error); font-weight: 600; }
.pnote--error:empty { display: none; }
.pnote b { color: var(--c-ink); }

/* ── Header card (profile / club) ────────────────────────────────────────── */
.phead { display: grid; grid-template-columns: auto 1fr auto; gap: 28px; align-items: center; background: var(--c-surface); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-card); }
.phead h1 { margin: 0; font-size: calc(26px * var(--fs-scale, 1)); font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.phead__flag { margin-left: 8px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 500; color: var(--c-ink-3); }
.phead__bio { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--c-ink-2); }
.pstats { display: flex; gap: 28px; margin: 0; }
.pstats div { display: flex; flex-direction: column; text-align: center; }
.pstats dd { margin: 0; font-size: calc(22px * var(--fs-scale, 1)); font-weight: 700; font-variant-numeric: tabular-nums; }
.pstats dt { order: 2; font-size: calc(14px * var(--fs-scale, 1)); text-transform: uppercase; letter-spacing: .1em; color: var(--c-ink-3); }

/* ── Avatar ──────────────────────────────────────────────────────────────── */
.pav--sm { width: 28px; height: 28px; font-size: calc(14px * var(--fs-scale, 1)); }
.pav--xl { width: 88px; height: 88px; font-size: calc(26px * var(--fs-scale, 1)); }
.pav--sq { border-radius: var(--radius-lg); background-color: var(--c-brand); color: var(--c-on-brand); }

/* ── Buttons / chips / tabs / search ─────────────────────────────────────── */
.pbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 16px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; cursor: pointer; border: 0; border-radius: var(--radius); background: var(--c-fill); color: var(--c-ink); }
.pbtn:hover { opacity: .75; }
.pbtn:active:not(:disabled), .pchip:active, .ptab:active { transform: translateY(1px); opacity: .6; }   /* F7: pressed state for touch */
.pbtn:disabled { opacity: .45; cursor: default; }
.pbtn--primary { background: var(--c-brand); color: var(--c-on-brand); }
.pl a.pbtn--primary { color: var(--c-on-brand); }   /* #270: `.pl a{color:inherit}` (0,1,1) outranks `.pbtn--primary` (0,1,0) on <a> buttons */
.pbtn--ghost { background: var(--c-surface-2); border: 1px solid var(--c-border-strong); color: var(--c-ink-2); }
.pbtn--sm { min-height: 28px; padding: 3px 10px; font-size: calc(14px * var(--fs-scale, 1)); }
.pactions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0 0; }
.pchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pchip { min-height: 34px; padding: 6px 14px; font-size: calc(14px * var(--fs-scale, 1)); cursor: pointer; border: 0; border-radius: var(--radius); background: var(--c-fill); color: var(--c-ink-2); }
.pchip[aria-selected="true"], .pchip[aria-pressed="true"] { background: var(--c-brand); color: var(--c-on-brand); }
.ptabs { display: flex; flex-wrap: wrap; gap: 24px; }
.ptab { min-height: 32px; padding: 4px 0; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 500; cursor: pointer; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--c-ink-3); }
.ptab[aria-selected="true"] { color: var(--c-strong); font-weight: 700; border-bottom-color: var(--c-brand-text); }
@media (max-width: 860px) { .pbtn, .pchip, .ptab, .padd input { min-height: 44px; } }   /* B306: touch targets; .pbtn--sm stays (own class, 0,1,0 later in file) */
.pbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.psearch { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: var(--radius); background: var(--c-fill); }
.psearch__icon { color: var(--c-ink-3); }
.psearch:focus-within { outline: 2px solid var(--c-ink); outline-offset: 2px; }   /* B324: ring on the pill, not the inner input */
.psearch input:focus-visible { outline: 0 !important; }   /* main.css :focus-visible is !important */
@media (max-width: 860px) { .psearch { min-height: 44px; } }
.psearch input { width: 180px; border: 0; background: none; outline: 0; font-size: calc(14px * var(--fs-scale, 1)); }

/* ── Table ───────────────────────────────────────────────────────────────── */
.ptbl-wrap { overflow-x: auto; padding: 4px 4px 8px; background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.ptbl { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--fs-scale, 1)); }
.ptbl th { padding: 10px 12px; text-align: left; white-space: nowrap; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--c-ink-3); border-bottom: 1px solid var(--c-border); }
.ptbl td { padding: 12px; white-space: nowrap; border-bottom: 1px solid var(--c-border-light); }
.ptbl tr:last-child td { border-bottom: 0; }
.ptbl tbody tr:hover { background: var(--c-hover); }
.ptbl tr.is-me td { background: var(--c-brand-light); }
.ptbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.ptbl .pav { margin-right: 8px; }
.ptbl a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }   /* F3: name links keep a signifier on touch (no hover) */
#rk-wrap .ptbl a { text-decoration: none; }   /* rankings table: names are links without underline (other .ptbl tables keep F3 signifier) */
.ptbl a:hover { text-decoration-thickness: 2px; }
@media (max-width: 860px) { .ptbl__games { display: none; } }
.ptbl__prov { margin-left: 2px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-3); }
/* #330: phone rankings = # · Người chơi · Rating (no sideways scroll); top 3 get a medal pill on every width */
#rk-wrap .ptbl td:first-child { font-variant-numeric: tabular-nums; color: var(--c-ink-3); }
#rk-wrap .rk-top td:first-child { color: var(--c-ink); font-weight: 700; }
#rk-wrap .rk-top--1 td { background: var(--c-medal-gold); }
#rk-wrap .rk-top--2 td { background: var(--c-medal-silver); }
#rk-wrap .rk-top--3 td { background: var(--c-medal-bronze); }
#rk-wrap .rk-top--1 td:first-child { box-shadow: inset 4px 0 0 rgb(224 168 0); }
#rk-wrap .rk-top--2 td:first-child { box-shadow: inset 4px 0 0 rgb(154 165 180); }
#rk-wrap .rk-top--3 td:first-child { box-shadow: inset 4px 0 0 rgb(184 115 58); }
#rk-wrap .rk-top td:nth-child(2) a { font-weight: 700; }
#rk-wrap .ptbl tr.is-me td { background: var(--c-brand-light); }
@media (max-width: 640px) {
  #rk-wrap .ptbl__delta, #rk-wrap .ptbl__club, #rk-wrap .ptbl__games { display: none; }
  #rk-wrap .ptbl th, #rk-wrap .ptbl td { padding-left: 8px; padding-right: 8px; }
  #rk-wrap .ptbl td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; width: 100%; }
}

/* ── Cards / rows ────────────────────────────────────────────────────────── */
.pcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.pcard { display: flex; flex-direction: column; gap: 2px; padding: var(--card-pad); background: var(--c-surface); border-radius: var(--card-radius); border: 1px solid var(--c-border); box-shadow: 0 1px 2px rgba(0,0,0,.05); }   /* ui-audit F1: light surface vs bg is 1.05:1 */
.pcard span { font-size: calc(14px * var(--fs-scale, 1)); letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-3); }
.pcard b { font-size: calc(26px * var(--fs-scale, 1)); font-weight: 700; color: var(--c-strong); font-variant-numeric: tabular-nums; }
.pcard small { font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); }
.prows { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--c-border-light); border-radius: var(--radius); }
.prow:last-child { border-bottom: 0; }
a.prow:hover { background: var(--c-hover); }
.prow__body { flex: 1; min-width: 0; }
@media (max-width: 480px) {   /* B322: a badge drops under the name instead of squeezing it */
  #cl-list .prow { flex-wrap: wrap; row-gap: 6px; }
  #cl-list .prow__body { flex: 1 1 60%; }
  #cl-list .prow .pbadge { margin-left: calc(28px + 14px); }
}
.prow__t { font-size: calc(15px * var(--fs-scale, 1)); font-weight: 500; overflow-wrap: anywhere; }
.prow__m { margin-top: 2px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-3); overflow-wrap: anywhere; }
#cl-list .prow__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }   /* B321: full text stays on the club page */
/* Ticket rows (docs/knowledge/ui-ux/ticket-rows.md) — opt-in per list via .prows--tickets; plain .prow stays for profile/social. */
.prows--tickets { gap: var(--card-gap); }
.prows--tickets .prow { gap: var(--space-4); padding: var(--card-pad); border: 0; border-radius: var(--card-radius); background: var(--c-surface-2); }
a.prow:hover { background: var(--c-hover); }
.prows--tickets .prow__t { font-weight: 600; line-height: 1.35; }
.prow__meta { display: flex; flex-wrap: wrap; gap: 2px var(--space-3); margin-top: var(--space-1); }
.prows--tickets .pnote { margin: 0; padding: var(--space-3) var(--space-4); }
.prow__act { flex: none; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; color: var(--c-ink-2); }
.pdot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--c-ink-3); }
.pdot--on { background: var(--c-brand-text); }
.pdot--loss { background: var(--c-error); }

/* ── Rating chart (profile) ──────────────────────────────────────────────── */
.pchart { display: block; width: 100%; height: 120px; color: var(--c-brand-text); border-bottom: 1px solid var(--c-border); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.pform { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.pform label, .pform__label { font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--c-ink-3); }
.pform input:not([type="checkbox"]):not([type="file"]), .pform textarea, .pform select { padding: 10px 12px; font-size: calc(14px * var(--fs-scale, 1)); border: 1px solid var(--c-border-strong); border-radius: var(--radius); background: var(--c-field); resize: vertical; }
.pform .pcheck { display: flex; align-items: center; gap: 10px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--c-ink); }
.pform__hint { margin: 0; }
.pform__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.ppager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); }

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .papp { padding: 16px 12px calc(var(--ptabbar-h) + env(safe-area-inset-bottom) + 28px); }   /* F6: tab bar height includes the inset */
  .psplit { grid-template-columns: 1fr; gap: 16px; }
  .pcards { grid-template-columns: repeat(2, 1fr); }
  .phead { grid-template-columns: auto 1fr; align-items: start; gap: 16px 20px; }
  .phead .pstats { grid-column: 1 / -1; justify-content: space-around; }
  .phead h1 { font-size: calc(22px * var(--fs-scale, 1)); }
  .pav--xl { width: 64px; height: 64px; font-size: calc(20px * var(--fs-scale, 1)); }
  .ppanel { padding: 14px; }
  .cb-panel > .ppanel { margin-bottom: 16px; }
}

/* Challenge form on a profile (#198 slice 3) */

/* Direct messages on the social page (#198 slice 4) */
.pdm__grid { display: grid; grid-template-columns: 280px 1fr; gap: 16px; min-height: 320px; }
.pdm__list { max-height: 460px; overflow-y: auto; }
.pdm__conv { width: 100%; text-align: left; border: 0; background: none; cursor: pointer; color: inherit; font: inherit; }
.pdm__conv.is-active, .pdm__conv:hover { background: var(--c-fill); }
.pdm__unread { margin-left: auto; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--c-brand); color: var(--c-on-brand); font-size: calc(14px * var(--fs-scale, 1)); font-weight: 700; line-height: 18px; text-align: center; }
.pdm__thread { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pdm__thread[hidden] { display: none; }
.pdm__head { font-weight: 700; }
.pdm__log { flex: 1; display: flex; flex-direction: column; gap: 6px; max-height: 380px; min-height: 200px; overflow-y: auto; padding: 8px; border-radius: var(--radius); background: var(--c-bg); }
.pdm__msg { align-self: flex-start; max-width: 80%; padding: 8px 12px; border-radius: 14px; background: var(--c-fill); color: var(--c-ink); font-size: calc(14px * var(--fs-scale, 1)); line-height: 1.4; overflow-wrap: anywhere; }
.pdm__msg--mine { align-self: flex-end; background: var(--c-brand); color: var(--c-on-brand); }
.pdm__form { display: flex; gap: 8px; }
.pdm__form input { flex: 1; min-width: 0; min-height: 38px; padding: 6px 12px; border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); color: var(--c-ink); font: inherit; font-size: calc(14px * var(--fs-scale, 1)); }
@media (max-width: 860px) { .pdm__grid { grid-template-columns: 1fr; } .pdm__list { max-height: 220px; } }
@media (max-width: 860px) { .pbtn--sm { min-height: 44px; padding: 6px 12px; } }
/* One .pbadge rule (B213: a second, overridden pill rule used to sit near .ptabs; its nowrap is kept here). */
.pbadge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; white-space: nowrap; border-radius: var(--radius); background: var(--c-fill); color: var(--c-ink-2); border: 1px solid var(--c-border); }

/* ── Settings page (B211): 4 underline tabs in one 720px column; icon-first controls ── */
.pset { max-width: 720px; }
.pset__tabs { flex-wrap: nowrap; gap: 22px; overflow-x: auto; border-bottom: 1px solid var(--c-border); }
.pset__tabs .ptab { display: inline-flex; align-items: center; gap: var(--space-2); font-size: calc(14px * var(--fs-scale, 1)); padding: 8px 0 10px; white-space: nowrap; margin-bottom: -1px; }
.pset__panel { border-radius: 0 0 var(--radius-lg) var(--radius-lg); padding: 8px 22px 22px; }
.pset .pform { max-width: none; }
/* Field labels read like the rows on the other Settings tabs: 20px leading icon + 14px/600 sentence case (#214).
   Label sits 8px above its field, 20px below the previous field (proximity). */
.pset .pform { gap: var(--space-2); }
.pset .pform label:not(.pcheck) { display: flex; align-items: center; gap: var(--space-2); font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--c-ink); }
.pset .pform label:not(.pcheck):not(:first-child) { margin-top: var(--space-3); }
.pset .pform label:not(.pcheck) > .icon { width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-3); }
.pset__h2 { display: flex; align-items: center; gap: var(--space-2); font-size: calc(16px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: 0; color: var(--c-ink); }   /* #214 review: sentence case like the field labels, one step larger as a group title */
.pset__h2 .icon { width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-3); }
/* Privacy is its own group: rule + space above, so its selects read as part of it (#214). */
.pset .pform .pset__h2 { margin: var(--space-5) 0 0; padding-top: var(--space-5); border-top: 1px solid var(--c-border-light); }
.pset__tabs .ptab .icon { width: var(--icon-md); height: var(--icon-md); }   /* tabs are navigation: 20px, like menu items */
@media (max-width: 400px) {   /* 4 labelled tabs fit 360px: 16px icons, 12px gaps (row still scrolls below ~340px) */
  .pset .pset__tabs { gap: var(--space-3); }   /* .pset: outranks the later 860px block */
  .pset__tabs .ptab .icon { width: var(--icon-sm); height: var(--icon-sm); }
}
.pset__avatar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; padding: 16px 0; border-bottom: 1px solid var(--c-border-light); }
.pset__avatar-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pset__avatar .pnote { flex-basis: 100%; margin: 0; }
/* Floating "back to room" (only when Settings was opened from a room): above the sticky save bar, clear of the mobile tab bar. */
.pl .pset__back { position: fixed; z-index: 30; right: 20px; bottom: 88px; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; background: color-mix(in srgb, var(--c-surface-2) 86%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); color: var(--c-brand); border: 1px solid var(--c-border); box-shadow: 0 6px 18px -6px rgba(0,0,0,.28); text-decoration: none; touch-action: none; user-select: none; cursor: grab; animation: pset-back-in .28s ease-out both; transition: transform .18s ease, box-shadow .18s ease, left .26s cubic-bezier(.2,.8,.2,1), top .26s cubic-bezier(.2,.8,.2,1); }
.pl .pset__back .icon { width: 22px; height: 22px; }
.pl .pset__back:hover { transform: scale(1.06); box-shadow: 0 8px 22px -6px rgba(0,0,0,.34); }
.pl .pset__back:active { transform: scale(.96); }
.pl .pset__back.is-dragging { cursor: grabbing; transition: none; transform: scale(1.08); box-shadow: 0 12px 28px -8px rgba(0,0,0,.4); }
.pl .pset__back:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 3px; }
@keyframes pset-back-in { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pl .pset__back { animation: none; transition: none; } }
.pset__save { position: sticky; bottom: 0; padding: 14px 0 0; background: var(--c-surface); border-top: 1px solid var(--c-border-light); }
.pset .pcheck { gap: var(--space-2); padding: 6px 0; }   /* icon · label · switch (markup order) */
.pset .pcheck > span { flex: 1; }
.pset .pcheck > .icon { flex: none; width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-3); }
.pset .pcheck input { appearance: none; position: relative; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--c-fill); cursor: pointer; transition: background var(--duration-fast); }
.pset .pcheck input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-ink-2); transition: transform var(--duration-fast); }
.pset .pcheck input:checked { background: var(--c-brand); }
.pset .pcheck input:checked::after { transform: translateX(16px); background: var(--c-on-brand); }
.pbtn--danger { background: var(--c-surface-2); border: 1px solid var(--c-error); color: var(--c-error); }
.psrow { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--c-border-light); }
.psrow:last-child { border-bottom: 0; }
.psrow > .icon { flex: none; width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-3); }
.psrow__t { flex: 1; min-width: 0; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; overflow-wrap: anywhere; }
.psrow__t small { display: block; margin-top: 1px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 400; color: var(--c-ink-3); }
.pseg { display: inline-flex; flex: none; gap: 2px; padding: 3px; border-radius: var(--radius); background: var(--c-fill); }
.pseg__opt { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 4px; background: var(--c-surface-2); cursor: pointer; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; color: var(--c-ink-3); }
.pseg__opt.is-active { background: var(--c-surface); color: var(--c-strong); box-shadow: 0 0 0 1px var(--c-border); }
.pseg__opt .icon { width: var(--icon-md); height: var(--icon-md); }
.pswitch { position: relative; flex: none; width: 38px; height: 22px; }
.pswitch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pswitch span { position: absolute; inset: 0; border-radius: 11px; background: var(--c-fill); pointer-events: none; transition: background var(--duration-fast); }
.pswitch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--c-ink-2); transition: transform var(--duration-fast); }
.pswitch input:checked + span { background: var(--c-brand); }
.pswitch input:checked + span::after { transform: translateX(16px); background: var(--c-on-brand); }
.pswitch input:focus-visible + span { outline: 2px solid var(--c-ink); outline-offset: 2px; }
@media (max-width: 860px) {
  .pset__panel { padding: 4px 16px 18px; }
  .pset__tabs { gap: 18px; }
  /* Labels stay visible on mobile (#214, NN/g: icons alone are rarely understood); the row scrolls if it must. */
  .pset__tabs { gap: var(--space-4); }
  .psrow { flex-wrap: wrap; }
  .psrow__t { flex-basis: calc(100% - 40px); }
  .psrow .pseg, .psrow .pswitch, .psrow .pbtn { margin-left: 34px; }
  .psrow .pswitch { margin-left: auto; }
  .pset__save { bottom: calc(var(--ptabbar-h) + env(safe-area-inset-bottom)); }
  .pl .pset__back { right: 16px; bottom: calc(var(--ptabbar-h) + env(safe-area-inset-bottom) + 84px); }
}

/* ── Avatar editor modal (B211 follow-up): drag/zoom a photo under a circular mask ── */
.pcrop { position: fixed; inset: 0; z-index: var(--z-crop); display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--scrim); }
.pcrop__dlg { width: 100%; max-width: 360px; padding: 20px; background: var(--c-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.pcrop__dlg .ph2 { margin-bottom: 12px; }
.pcrop__view { position: relative; width: 280px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; overflow: hidden; border-radius: var(--radius); background: var(--c-bg); cursor: grab; touch-action: none; user-select: none; }
.pcrop__view.is-drag { cursor: grabbing; }
.pcrop__view canvas { display: block; width: 100%; height: 100%; }
.pcrop__ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px var(--scrim-ring), inset 0 0 0 2px var(--c-on-brand); pointer-events: none; }
.pcrop__tools { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.pcrop__rot { min-width: 44px; min-height: 44px; font-size: calc(20px * var(--fs-scale, 1)); line-height: 1; cursor: pointer; color: var(--c-ink-2); background: var(--c-fill); border: 1px solid var(--c-border); border-radius: var(--radius); }
.pcrop__rot:hover { background: var(--c-hover); }
.pcrop__zoomrow { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; color: var(--c-ink-3); text-transform: uppercase; letter-spacing: .1em; }
.pcrop__zoom { flex: 1; min-width: 0; accent-color: var(--c-brand); }
.pcrop__actions { justify-content: flex-end; margin-top: 16px; }
.psplit > aside { display: flex; flex-direction: column; gap: 20px; }
.pbtn--ghost[aria-pressed="true"] { color: var(--c-strong); border-color: var(--c-ink-3); }

/* ── Social (B210): two columns — Thông báo / thách đấu / lời mời | bạn bè + tin nhắn ── */
.pcol { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.psplit .pdm__grid { grid-template-columns: 1fr; min-height: 0; }
.psplit .pdm__list { max-height: 260px; }
.prow__t.is-unread { font-weight: 700; }
.ptab__n { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--c-ink-3); }
/* Admin "Tất cả báo cáo" table (B210c): Loại · Đối tượng · Người báo · Thời gian · Xem xét */
.ptable-wrap { overflow-x: auto; }
.ptable { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--fs-scale, 1)); }
.ptable th { text-align: left; padding: 8px 12px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-3); border-bottom: 1px solid var(--c-border); white-space: nowrap; }
.ptable td { overflow-wrap: anywhere; padding: 10px 12px; border-bottom: 1px solid var(--c-border-light); color: var(--c-ink-2); vertical-align: middle; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable tbody tr:hover { background: var(--c-hover); }
@media (max-width: 600px) { .ptable th:nth-child(4), .ptable td:nth-child(4) { display: none; } .ptable th, .ptable td { padding-left: 8px; padding-right: 8px; } }
.psplit--solo { grid-template-columns: minmax(0, 1fr); }

/* ── Profile page icons (B213); the page layout lives in css/profile.css (#403 PF7 CV sheet) ── */
.pbtn .icon, .pbadge .icon, .pmeta .icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); }
.pchip .icon, .pback .icon { flex: none; width: var(--icon-sm); height: var(--icon-sm); }   /* #214 Scope 2: chip tools, back links */
.pchip:has(.icon), .pback { display: inline-flex; align-items: center; gap: 6px; }   /* #214: all platform pages, not only profile */

/* ── Settings › Giao diện › Bàn cờ (#216): controls + sticky live preview ── */
.pboard__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: 24px; align-items: start; }
.pboard__controls { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pboard__label { font-size: calc(14px * var(--fs-scale, 1)); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-2); margin-bottom: 8px; }
.pboard__controls .pseg { display: flex; width: 100%; }
.pboard__controls .pseg__opt { flex: 1; min-height: 36px; }
.pboard__swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pboard__swatch { position: relative; aspect-ratio: 1; padding: 0; border: 2px solid var(--c-border); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: none; }
.pboard__swatch.is-active { border-color: var(--c-brand-text); box-shadow: 0 0 0 1px var(--c-brand-text); }
.pboard__swatch svg { display: block; width: 100%; height: 100%; }
.pboard__swatch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pboard__colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.pboard__color { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); cursor: pointer; }
.pboard__color input { flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid var(--c-border); border-radius: var(--radius); background: none; cursor: pointer; }
.pboard__check { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; cursor: pointer; }
.pboard__reset { align-self: flex-start; }
.pboard__preview { position: sticky; top: 72px; padding: 12px; border-radius: var(--radius-lg); background: var(--c-surface-2); }
.pboard__board { display: flex; justify-content: center; }
.pboard__preview p { margin-top: 8px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-3); }
.pboard__toast { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-board-toast); max-width: 380px; padding: 14px 16px; border: 1px solid var(--c-border); border-radius: var(--radius-lg); background: var(--c-surface-2); box-shadow: var(--shadow-lg); font-size: calc(14px * var(--fs-scale, 1)); }
.pboard__toast b { display: block; font-size: calc(14px * var(--fs-scale, 1)); }
.pboard__toast p { margin: 2px 0 10px; color: var(--c-ink-2); }
.pboard__toast-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pboard__chip { display: inline-block; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,.6); }
@media (max-width: 768px) {
  .pboard__grid { grid-template-columns: 1fr; }
  .pboard__preview { order: -1; top: 56px; z-index: 5; padding: 8px; }
  .pboard__board { max-width: 40vh; margin: 0 auto; }
  .pboard__toast { left: 8px; right: 8px; bottom: 76px; max-width: none; }
}

/* ── Friend challenge modal (#222): friend picker → create-room-parity settings ── */
.pchal__dlg { max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.pchal__search { width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-field); }
.pchal__list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; margin-top: var(--space-2); }
.pchal__friend { width: 100%; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-bottom: 1px solid var(--c-border-light); cursor: pointer; }
.pchal__friend:hover, .pchal__friend:focus-visible { background: var(--c-hover); }
.pchal__friend .prow__body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pchal__who { padding-top: 0; }
.pchal__form { display: flex; flex-direction: column; gap: var(--space-3); }
.pchal__row { display: flex; flex-direction: column; gap: 6px; }
.pchal__label { font-size: calc(14px * var(--fs-scale, 1)); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-3); }
.pchal__seg { display: flex; flex-wrap: wrap; gap: 6px; }
.pchal__seg label { position: relative; display: inline-flex; }
.pchal__seg input[type="radio"] { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pchal__seg input[type="radio"] + span { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-surface); }
.pchal__seg input[type="radio"]:checked + span { color: var(--c-strong); border-color: var(--c-brand); background: var(--c-fill); font-weight: 600; }
.pchal__seg input[type="radio"]:focus-visible + span { outline: 2px solid var(--c-brand); outline-offset: 2px; }
.pchal__seg input[type="radio"]:disabled + span { opacity: .45; cursor: not-allowed; }
.pchal__check { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-size: calc(14px * var(--fs-scale, 1)); color: var(--c-ink-2); }
.pchal__check:has(input:disabled) { opacity: .45; }
.pchal__pair { flex-direction: column; gap: var(--space-3); }
.pchal__num { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 8px; }
.pchal__num .pchal__label { grid-column: 1 / -1; }
.pchal__num input { width: 100%; max-width: 120px; min-height: 36px; padding: 6px 10px; font: inherit; font-size: calc(14px * var(--fs-scale, 1)); border: 1px solid var(--c-border); border-radius: var(--radius); background: var(--c-field); color: var(--c-ink); }
.pchal__num input:disabled { opacity: .45; }
.pchal__hint[hidden] { display: none; }
.pchal__status:empty { display: none; }
.pchal__status { color: var(--c-error); }
.pchal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.pchal__head .ph2 { margin-bottom: 0; }
.pchal__stake .prow__m { color: var(--c-strong); font-weight: 600; }
.ph2 .pbadge { margin-left: var(--space-2); padding: 2px 10px; font-size: calc(14px * var(--fs-scale, 1)); letter-spacing: 0; }

/* Club identity (#235): preset colours, white text ≥ 4.5:1. .pav.pav--c-* beats .pav--sq. */
.pav.pav--c-blue, .pswatch.pav--c-blue { background-color: var(--club-blue); color: var(--club-ink); }
.pav.pav--c-green, .pswatch.pav--c-green { background-color: var(--club-green); color: var(--club-ink); }
.pav.pav--c-red, .pswatch.pav--c-red { background-color: var(--club-red); color: var(--club-ink); }
.pav.pav--c-orange, .pswatch.pav--c-orange { background-color: var(--club-orange); color: var(--club-ink); }
.pav.pav--c-purple, .pswatch.pav--c-purple { background-color: var(--club-purple); color: var(--club-ink); }
.pav.pav--c-teal, .pswatch.pav--c-teal { background-color: var(--club-teal); color: var(--club-ink); }
.pav.pav--c-pink, .pswatch.pav--c-pink { background-color: var(--club-pink); color: var(--club-ink); }
.pav.pav--c-gray, .pswatch.pav--c-gray { background-color: var(--club-gray); color: var(--club-ink); }
.pswatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pswatch { width: 28px; height: 28px; padding: 0; border: 2px solid transparent; border-radius: 50%; cursor: pointer; forced-color-adjust: none; }   /* forced-colors (Firefox on a high-contrast GTK theme) would repaint the fill ButtonFace grey; the colour IS the control */
.pswatch[aria-checked="true"] { border-color: var(--c-ink); outline: 2px solid var(--c-surface); outline-offset: -4px; }
.cb-announce { margin-bottom: var(--space-4); }
.cb-announce p { margin: 0; font-size: calc(14px * var(--fs-scale, 1)); overflow-wrap: anywhere; white-space: pre-line; }
.cb-announce .ph2 { margin-bottom: var(--space-2); }
.cb-inline { display: flex; gap: var(--space-2); }
.cb-inline input { flex: 1; min-width: 0; padding: 10px 12px; font-size: calc(14px * var(--fs-scale, 1)); border: 1px solid var(--c-border-strong); border-radius: var(--radius); background: var(--c-field); }
.cb-inline { margin-bottom: var(--space-3); }
@media (max-width: 860px) {
  #cb-tablist { flex-wrap: nowrap; overflow-x: auto; }
  #cb-tablist .ptab { flex: none; }
}
/* Wide variant for the club banner editor (#250): 4:1 viewport, rectangular frame */
.pcrop__dlg--wide { max-width: 700px; }
.pcrop__dlg--wide .pcrop__view { width: 640px; }
.pcrop__ring--rect { border-radius: var(--radius); box-shadow: inset 0 0 0 2px var(--c-on-brand); }
/* Club banner + image controls (#250) */
.cb-banner { width: 100%; aspect-ratio: 4 / 1; margin-bottom: 12px; border-radius: var(--radius-lg); background: var(--c-surface-2) center / cover no-repeat; }
@media (max-width: 600px) { .cb-banner { aspect-ratio: 3 / 1; } }   /* 4:1 is ~90px on a phone: crop the sides (cover) for a taller strip */
.cb-sugg { margin-bottom: var(--space-3); border: 1px solid var(--c-border); border-radius: var(--radius); }
.cb-sugg__item { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--c-border-light); font: inherit; cursor: pointer; color: inherit; }
.cb-sugg__item:last-child { border-bottom: 0; }
.cb-sugg__item:hover, .cb-sugg__item:focus-visible { background: var(--c-surface-2); }
.cb-images { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.cb-images__row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.cb-images__row .pform__label { min-width: 120px; }


@media (max-width: 860px) { .pseg__opt, .pboard__controls .pseg__opt, .pchal__search, .pchal__seg input[type="radio"] + span, .pchal__check, .pchal__num input, .pboard__color, .pboard__check { min-height: 44px; } }   /* B306: touch targets */
@media (max-width: 860px) { .pswatch { width: 44px; height: 44px; } }   /* B306: touch target (user ok 2026-10-22) */
@media (max-width: 860px) { .pform input:not([type="checkbox"]):not([type="file"]), .pform textarea, .pform select, .cb-chat__form input, .cb-inline input, .padd input, .pdm__form input { font-size: 16px; } }   /* F2: iOS Safari zooms on focus below 16px */

/* ── Settings › Hồ sơ: bento tiles (ui/settings-profile-bento, SB) ──────────────────────────────────
   Every fill is opaque (tints are color-mix against a solid surface); no transparent button/div. */
.pset { max-width: 1040px; --ctl-r: 14px; --ctl-h: 44px; }
.pset__panel { background: var(--c-bg); box-shadow: none; border-radius: 0; padding: 16px 0 0; }
.pset__panel:not(#p-profile) { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: start; }
.pset { --tint: color-mix(in srgb, var(--c-brand) 16%, var(--c-surface)); --soft: color-mix(in srgb, var(--c-ink) 7%, var(--c-surface)); --soft-2: color-mix(in srgb, var(--c-ink) 12%, var(--c-surface)); --line: color-mix(in srgb, var(--c-ink) 22%, var(--c-surface)); }
.pbento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.pset .pbento { gap: 14px; }
.ptile { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 20px; border-radius: 22px; background: var(--c-surface); box-shadow: var(--shadow-card); animation: ptile-in var(--duration-base, 240ms) var(--ease-out, ease-out) backwards; }
.ptile:nth-child(2) { animation-delay: 70ms; } .ptile:nth-child(3) { animation-delay: 140ms; } .ptile:nth-child(4) { animation-delay: 210ms; } .ptile:nth-child(5) { animation-delay: 280ms; }
@keyframes ptile-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ptile__h, .pset .pform .ptile__h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; font-size: calc(13px * var(--fs-scale, 1)); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--c-ink-2); }
.ptile__h > .icon, .ptile__h label > .icon { width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-2); }
.pset .pform .ptile__h label { margin: 0; font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.pcount { margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--soft); font-size: calc(13px * var(--fs-scale, 1)); font-weight: 700; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }
.ptile--avatar { grid-column: span 4; grid-row: span 2; align-items: center; justify-content: center; text-align: center; background: var(--tint); }
.ptile--avatar .ptile__h, .ptile--avatar .ptile__h > .icon { color: var(--c-brand-text); }
.ptile--avatar .pav--xl { width: 132px; height: 132px; font-size: calc(48px * var(--fs-scale, 1)); }
.pbento__btns { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.pbento__btns .pbtn { justify-content: center; min-height: 44px; }
.ptile--avatar #st-avatar-remove { color: var(--c-error); }
.ptile--avatar .pnote { margin: 0; }
.ptile--wide { grid-column: 1 / -1; }
.ptile--half { grid-column: span 6; }
.ptile--bio, .ptile--place { grid-column: span 8; }
.ptile--priv, .ptile--contact { grid-column: span 6; }
.ptile--bio textarea { min-height: 96px; }
.ptile__two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pfield { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pset .pform .pfield label { margin: 0; }
.pbento .pcheck { min-height: 48px; padding: 6px 8px 6px 12px; border-radius: 14px; background: var(--soft); }
.pset .pbento .pcheck input { width: 52px; height: 30px; border-radius: 15px; background: var(--line); transition: background-color var(--duration-fast) var(--ease-out, ease-out); }
.pset .pbento .pcheck input::after { top: 3px; left: 3px; width: 24px; height: 24px; background: var(--c-knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform var(--duration-base, 240ms) var(--ease-out, ease-out); }
.pset .pbento .pcheck input:checked { background: var(--c-brand); }
.pset .pbento .pcheck input:checked::after { transform: translateX(22px); background: var(--c-knob); }
.pbento .pcheck:has(input:focus-visible) { outline: 3px solid var(--c-brand-text); outline-offset: 2px; }
.paud { display: flex; flex-direction: column; gap: 6px; }
.paud__lab { display: flex; align-items: center; gap: 8px; font-size: calc(14px * var(--fs-scale, 1)); font-weight: 800; color: var(--c-ink); }
.paud__lab > .icon { width: var(--icon-md); height: var(--icon-md); color: var(--c-ink-2); }
.paudseg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: var(--ctl-r); background: var(--soft); }
.pset .pform .paudseg label:not(.pcheck):not(:first-child), .pset .pform .paudseg label { position: relative; display: flex; margin: 0; gap: 0; font-size: inherit; font-weight: inherit; }   /* margin:0 must beat the :not(:first-child) stacking rule or options 2-3 sit 12px low */
.paudseg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.paudseg span { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 36px; padding: 0 12px; border-radius: 10px; background: var(--soft); color: var(--c-ink-2); font-size: calc(14px * var(--fs-scale, 1)); font-weight: 800; white-space: nowrap; transition: background-color var(--duration-fast) var(--ease-out, ease-out), color var(--duration-fast) var(--ease-out, ease-out); }
.paudseg input:checked + span { background: var(--c-brand); color: var(--c-on-brand); }
.paudseg input:focus-visible + span { outline: 3px solid var(--c-brand-text); outline-offset: 2px; }
.pbento .pset__save { grid-column: 1 / -1; z-index: 2; padding: 12px 16px; border: 0; border-radius: 22px; background: var(--c-surface); box-shadow: 0 -6px 20px -10px rgba(0, 0, 0, .5); }
.pbento .pset__save .pbtn { min-height: 44px; }
.pbento .pset__save .pnote { margin: 0 0 0 auto; }
@media (max-width: 860px) {
  .ptile--avatar, .ptile--bio, .ptile--place, .ptile--priv, .ptile--contact, .ptile--half { grid-column: 1 / -1; grid-row: auto; }
  .ptile--avatar { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; text-align: left; }
  .ptile--avatar .ptile__h { flex-basis: 100%; }
  .ptile--avatar .pav--xl { width: 84px; height: 84px; font-size: calc(32px * var(--fs-scale, 1)); }
  .ptile--avatar .pbento__btns { flex: 1; min-width: 200px; width: auto; }
  .ptile__two { grid-template-columns: 1fr; }
  .pbento .pset__save { bottom: calc(var(--ptabbar-h, 62px) + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .ptile { animation: none; } .pset .pbento .pcheck input, .pset .pbento .pcheck input::after, .paudseg span { transition: none; } }
.pset .pform label.pbtn, .pset .pform label.pbtn:not(:first-child) { margin: 0; justify-content: center; font-weight: 700; }   /* beat `.pset .pform label:not(.pcheck)` (ink text, flex) on the upload button */
.pset .pform label.pbtn--primary { color: var(--c-on-brand); }
.pset .pform label.pbtn > .icon { color: inherit; width: var(--icon-md); height: var(--icon-md); }

/* One control language on every Settings tab: 14px radius, 44px height, 1px solid-tint border, opaque fills.
   Buttons, text boxes, selects, switch rows and segmented choices all share it; segments are equal-width columns. */
.pset .pbtn { justify-content: center; min-height: var(--ctl-h); padding: 0 18px; border: 1px solid var(--line); border-radius: var(--ctl-r); background: var(--soft); color: var(--c-ink); font-weight: 700; }
.pset .pbtn--primary { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-on-brand); }
.pset .pbtn--ghost { background: var(--soft); border-color: var(--line); color: var(--c-ink); }
.pset .pbtn--danger { background: var(--soft); border-color: var(--c-error); color: var(--c-error); }
.pset .pform input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .pset .pform select, .pset .pform textarea { box-sizing: border-box; min-height: var(--ctl-h); padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--ctl-r); background: var(--c-field); font-size: calc(14px * var(--fs-scale, 1)); }
.pset .pform textarea { min-height: 96px; }
.pbento .pcheck { border-radius: var(--ctl-r); }
.pset .pseg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); gap: 4px; padding: 4px; border-radius: var(--ctl-r); background: var(--soft); }
.pset .pseg__opt { min-height: 36px; padding: 0 12px; border-radius: 10px; background: var(--soft); color: var(--c-ink-2); font-weight: 800; transition: background-color var(--duration-fast) var(--ease-out, ease-out), color var(--duration-fast) var(--ease-out, ease-out); }
.pset .pseg__opt.is-active { background: var(--c-brand); color: var(--c-on-brand); box-shadow: none; }
.pset .pseg__opt:focus-visible { outline: 3px solid var(--c-brand-text); outline-offset: 2px; }
.pset .psrow .pseg { background: var(--soft-2); }
.pset .psrow .pseg__opt { background: var(--soft-2); }
.pset .psrow .pseg__opt.is-active { background: var(--c-brand); }
.pset .pboard__controls .pseg { display: grid; width: 100%; }
.pset .ptile .psrow { min-height: 52px; padding: 6px 8px 6px 14px; border: 0; border-radius: var(--ctl-r); background: var(--soft); }
.psrow__who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ptag { padding: 2px 10px; border-radius: 999px; background: var(--tint); color: var(--c-brand-text); font-size: calc(13px * var(--fs-scale, 1)); font-weight: 700; }
.pset .pswitch { width: 52px; height: 30px; }
.pset .pswitch span { border-radius: 15px; background: var(--line); }
.pset .pswitch span::after { top: 3px; left: 3px; width: 24px; height: 24px; background: var(--c-knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform var(--duration-base, 240ms) var(--ease-out, ease-out); }
.pset .pswitch input:checked + span { background: var(--c-brand); }
.pset .pswitch input:checked + span::after { transform: translateX(22px); background: var(--c-knob); }
.pset .pboard__swatch { background: var(--c-surface-2); border-radius: 10px; }
.pset .pboard__color input { background: var(--c-field); border-radius: 10px; }
.pset .pboard__check { padding: 6px 8px 6px 14px; border-radius: var(--ctl-r); background: var(--soft); }
.pset .pboard__preview { border-radius: var(--ctl-r); }
@media (max-width: 860px) { .paudseg span { min-height: 44px; } }
.pset .pboard__label { text-transform: none; letter-spacing: 0; font-weight: 800; color: var(--c-ink); }
