/* Profile uses unframed rows; identity and XP remain visible in every tab. */
html:has(.profile-dialog[open]),body:has(.profile-dialog[open]) { overflow:hidden; }
main.solo-page[data-page=account] { padding-bottom:24px; }
/* Auth is a single compact form, not another page-sized panel. Keep native
 * radio semantics while using the same segmented selection as the game. */
#authentication { max-width:480px; margin:0 auto; }
#authentication .account-form { gap:16px; margin:0; }
#authentication .account-form > p { margin:0; font-size:13px; line-height:1.6; }
#authentication .auth-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:0; }
#authentication .auth-options label { position:relative; min-width:0; font-size:14px; padding:10px; }
#authentication .auth-options legend,#authentication .auth-options input {
  position:absolute; width:1px; height:1px; margin:0; padding:0; border:0;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
body:has(.public-header) .account-form :is(input:not([type=radio]):not([type=checkbox]):not([type=range]),textarea,select) {
  min-height:48px; padding:12px; border:1px solid var(--field-border);
  background:var(--surface-raised); color:var(--text); font-size:16px; line-height:1.4;
}
body:has(.public-header) .account-form input:-webkit-autofill {
  -webkit-box-shadow:0 0 0 1000px var(--surface-raised) inset;
  -webkit-text-fill-color:var(--text); caret-color:var(--text);
}
.account-form .password-field input { padding-right:52px!important; }
#authentication #reset-status:empty { display:none; }
body:has(main[data-page=account]) .site-footer { margin-top:0; }
#profile .profile-title { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin:0 0 20px; }
#profile .profile-title > div { min-width:0; flex:1 1 160px; }
/* Use the same coral pill as Forfeit; keep account actions out of edit dialogs. */
#profile #signout { --control-fill:#ff6f61; --control-text:#111; --control-radius:999px; flex:none; margin-left:auto; min-height:44px; padding:10px 18px; font-size:14px; font-weight:700; line-height:1.2; }
#profile #signout:hover:not(:disabled) { --control-fill:#ff867c; }
#profile-name { font-size:28px; line-height:1.2; margin:0; overflow-wrap:anywhere; }
#profile-bio { margin:8px 0 0; font-size:14px; line-height:1.5; color:var(--muted); }
#profile-team { margin:0; flex:none; }
#profile-team:empty { display:none; }
#profile-team .club-badge { width:56px; height:56px; display:block; }
#profile .profile-progress { margin:0 0 24px; }
#profile .xp-heading { font-size:14px; }
#profile #profile-level { font-size:20px; }
#profile-tabs { margin:0 0 24px; }
#profile-stats .metrics { margin:0; padding:16px 0; border-top:0; border-bottom:2px solid var(--ink); gap:16px; }
#profile-stats .metric strong { color:var(--ink); font-size:26px; }
#profile .profile-record { margin:24px 0; border:0; }
#profile .profile-record h3 { font-size:16px; margin:0; }
#profile #profile-record { grid-template-columns:repeat(3,minmax(0,1fr)); }
#profile #own-profile { display:block; }
#profile [data-profile-panel] { max-width:none; }
#profile .profile-club { padding:0; border:0; gap:12px; }
#profile .profile-section-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
#profile .profile-section-heading h2 { font-size:18px; }
#profile .profile-links { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; padding-top:16px; }
#profile .profile-links > a { display:flex; align-items:center; justify-content:center; min-height:44px; padding:10px 12px; font-size:14px; }
#profile [data-profile-panel=settings] { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; align-items:start; }
#profile [data-profile-panel=settings] > button { min-width:0; min-height:48px; font-size:14px; text-align:center; }
#profile #delete-open { color:var(--coral); }
#profile #public-friend-status:empty { display:none; }
#profile .friend-add { max-width:640px; }
/* Native dialogs leave the profile in place. Only the card scrolls on short
 * screens, with its title and close command always within reach. */
.profile-dialog,#delete-dialog.profile-dialog {
  width:min(480px,calc(100% - 24px)); max-height:calc(100dvh - 24px);
  padding:0 24px 24px; overflow:auto; overscroll-behavior:contain;
  border:var(--line-width) solid var(--ink); background:var(--surface); color:var(--text);
}
.profile-dialog:focus-visible { outline:none; }
/* Blur only the page, never the dialog. Filtering the content directly also
 * works in WebKit versions that omit blur on native dialog backdrops. */
body:has(.profile-dialog[open]) :is(.public-header,.page-return,main[data-page=account]>:not(dialog),.site-footer) { filter:blur(5px); }
.profile-dialog::backdrop { -webkit-backdrop-filter:none; backdrop-filter:none; }
.profile-dialog-heading { position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:20px 0 16px; background:var(--surface); }
.solo-page .profile-dialog-heading h2 { font-size:20px; line-height:1.3; margin:0; }
.profile-dialog-heading .icon-button { flex:none; width:44px; height:44px; padding:10px; display:grid; place-items:center; }
.profile-dialog-heading img { width:20px; height:20px; }
.profile-dialog .account-form { width:100%; max-width:none; margin:0; gap:16px; }
.profile-dialog .account-form p { margin:0; line-height:1.5; }
.profile-dialog [role=status]:empty,.profile-dialog [role=alert]:empty { display:none; }
.profile-dialog-status { font-size:14px; line-height:1.5; overflow-wrap:anywhere; }
.profile-dialog .actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.profile-dialog .actions button { min-width:0; padding:10px 12px; }
.profile-dialog .sound-settings { margin:0; border:0; padding:0; }
.profile-dialog .sound-volume { margin:0; }
.solo-page .profile-dialog input[type=range] { padding:0; border:0; background:transparent; }
.profile-dialog .team-options { margin-bottom:0!important; }
#team-dialog { width:min(560px,calc(100% - 24px)); }
@media(max-width:600px) {
  #profile-name { font-size:24px; }
  #profile .profile-title { gap:12px; margin-bottom:16px; }
  #profile-team .club-badge { width:44px; height:44px; }
  #profile-stats #profile-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  #profile [data-profile-panel=settings] { grid-template-columns:minmax(0,1fr); }
  #profile .profile-record { margin:20px 0; }
  #profile-stats .metric strong { font-size:24px; }
  .profile-dialog,#delete-dialog.profile-dialog { padding:0 16px 16px; }
  .profile-dialog-heading { padding-top:12px; }
}
