/* Collector profile: a paddle button in the top bar opens the ledger dialog. */
.top-actions .profile-button{display:inline-flex;align-items:center;gap:5px;position:relative;color:#f4cf74;padding:6px 8px}
.profile-paddle-icon{width:20px;height:20px;flex-shrink:0;fill:currentColor}
.profile-paddle-icon .paddle-mark{fill:#102b30}
.profile-button-name{display:none;max-width:7em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px;color:#e6dbbd}
.profile-button[data-fresh=true]::after{content:'';position:absolute;top:8px;right:6px;width:7px;height:7px;background:#e85d3f;box-shadow:0 0 0 2px #102b30}
@media(min-width:560px){.profile-button-name:not(:empty){display:inline}}
/* Online scoreboards show the rival's nickname (up to 12 characters) in place of 对手. */
.score-heading>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* The profile and the guest roster are sheets like Settings: one rounded dark
   card, chunky tabs, ‹ 返回 at the bottom. They look the same in every theme. */
.profile-dialog{width:min(720px,calc(100vw - 32px));max-width:none;max-height:none;margin:auto;padding:0;border:0;background:transparent;color:var(--menu-text);font-family:var(--menu-sans);font-size:15px;line-height:1.5;overflow:visible}
.profile-dialog::backdrop{background:rgba(6,10,11,.62)}
.profile-dialog[open]{animation:sheet-pop .2s ease-out}
.game-app[data-motion=reduced] .profile-dialog[open]{animation:none}
@media(prefers-reduced-motion:reduce){.profile-dialog[open]{animation:none}}
.profile-sheet{display:flex;flex-direction:column;gap:14px;max-height:min(780px,calc(100dvh - 32px));padding:20px 22px 22px;box-sizing:border-box;border:2px solid var(--menu-line-strong);border-radius:16px;background:#141d1f;box-shadow:0 24px 70px rgba(0,0,0,.5);overflow:hidden}
.profile-dialog button{font:inherit;cursor:pointer}
.profile-dialog button:disabled{opacity:.5;cursor:default}
.profile-dialog[aria-busy=true] .profile-sheet{cursor:progress}
#valuation-app .profile-dialog :focus-visible{outline:3px solid var(--menu-focus);outline-offset:3px}

/* Head: the gold collector paddle, the name, a small rename button. */
.profile-head{flex:none;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px}
.profile-paddle{display:grid;place-items:center;width:46px;height:46px;border-radius:10px;background:var(--menu-gold);color:var(--menu-gold-ink);font-family:var(--menu-pixel);font-size:17px;box-shadow:0 4px 0 var(--menu-gold-shadow)}
.profile-id{min-width:0;display:flex;flex-direction:column}
.profile-eyebrow{margin:0;font-size:12px;letter-spacing:.14em;color:var(--menu-muted)}
.profile-name-line{display:flex;align-items:center;gap:10px;min-width:0}
.profile-id h2{margin:0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--menu-pixel);font-weight:400;font-size:26px;line-height:1.2;letter-spacing:.04em;color:var(--menu-text)}
#valuation-app .profile-link{flex:none;min-height:28px;padding:0 12px;border:0;border-radius:8px;background:var(--menu-slate);color:var(--menu-light-ink);font-size:13px;box-shadow:0 3px 0 var(--menu-slate-shadow)}
#valuation-app .profile-link:hover:not(:disabled){filter:brightness(1.1)}
#valuation-app .profile-close{align-self:start;width:34px;height:34px;padding:0;border:0;border-radius:8px;background:none;color:var(--menu-muted);font-size:22px;line-height:1}
#valuation-app .profile-close:hover{background:rgba(236,228,210,.08);color:var(--menu-text)}
.profile-name-form{display:flex;gap:6px;margin-top:6px}
#valuation-app :is(.profile-name-form input,.profile-recover-row input){flex:1;min-width:0;min-height:40px;padding:6px 10px;border:1px solid var(--menu-line-strong);border-radius:8px;background:rgba(236,228,210,.06);color:var(--menu-text);font:inherit;font-size:16px}
#valuation-app :is(.profile-name-form button,.profile-recover-row button,.profile-recovery button){min-height:40px;padding:0 14px;border:0;border-radius:8px;background:var(--menu-slate);color:var(--menu-light-ink);font-size:15px;white-space:nowrap;box-shadow:0 3px 0 var(--menu-slate-shadow)}
#valuation-app :is(.profile-name-form button[type=submit],.profile-recover-row button){background:var(--menu-gold);color:var(--menu-gold-ink);font-weight:600;box-shadow:0 3px 0 var(--menu-gold-shadow)}
.profile-welcome{flex:none;margin:0;padding:8px 12px;border:1px solid rgba(201,162,90,.4);border-radius:10px;background:rgba(201,162,90,.1);color:var(--menu-text);font-size:14px;line-height:1.5}

/* Summary, after Balatro's Stats: the headline number on the left,
   the record as label / value rows on the right. */
.profile-summary{flex:none;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:12px}
.profile-worth{min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;padding:14px 12px;border:1px solid rgba(201,162,90,.45);border-radius:12px;background:var(--menu-panel);text-align:center}
.profile-worth-label{font-size:12px;letter-spacing:.14em;color:var(--menu-muted)}
#profile-networth{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--menu-pixel);font-weight:400;font-size:40px;line-height:1.15;color:#f3d48a;text-shadow:0 3px 0 rgba(0,0,0,.45)}
.profile-best{display:flex;align-items:baseline;gap:8px;max-width:100%;margin-top:6px;padding:2px 12px;border-radius:999px;background:rgba(236,228,210,.08);font-size:12px;color:var(--menu-muted);white-space:nowrap}
#profile-best{min-width:0;overflow:hidden;text-overflow:ellipsis;font-size:14px;font-weight:600;color:var(--menu-text)}
.profile-stats{min-width:0;display:flex;flex-direction:column;justify-content:center;margin:0;padding:4px 14px;border:1px solid var(--menu-line);border-radius:12px;background:var(--menu-panel)}
.profile-stat{display:flex;justify-content:space-between;align-items:center;gap:12px;min-height:42px;border-bottom:1px solid var(--menu-line)}
.profile-stat:last-child{border-bottom:0}
.profile-stat dt{font-size:14px;color:var(--menu-muted);white-space:nowrap}
.profile-stat dd{margin:0;min-width:72px;padding:1px 10px;border-radius:8px;background:rgba(0,0,0,.32);box-shadow:inset 0 2px 0 rgba(0,0,0,.35);font-family:var(--menu-pixel);font-size:18px;text-align:center;color:var(--menu-text);white-space:nowrap}

/* Tabs: the same chunky tabs as Settings, a little smaller; counts ride along. */
.profile-tabs{flex:none;flex-wrap:wrap}
#valuation-app .menu-tabs.profile-tabs [role=tab]{min-height:36px;padding:0 16px;font-size:16px;box-shadow:0 3px 0 var(--menu-slate-shadow)}
#valuation-app .menu-tabs.profile-tabs [role=tab][aria-selected=true]{box-shadow:0 3px 0 var(--menu-gold-shadow)}
.profile-tabs [role=tab] span{margin-left:4px;font-size:.85em;opacity:.75}
.profile-panel{flex:1;min-height:140px;overflow-y:auto;overscroll-behavior:contain;padding:2px 4px 2px 2px;scrollbar-width:thin;scrollbar-color:rgba(236,228,210,.25) transparent}
.profile-note{margin:0 0 10px;color:var(--menu-muted);font-size:13px;line-height:1.55}
/* An empty tab shows its note as a dashed placeholder, like an open seat. */
.profile-panel:has(>.profile-list:empty)>.profile-note,.profile-empty{margin:0;padding:28px 16px;border:2px dashed var(--menu-line-strong);border-radius:12px;color:var(--menu-muted);font-size:14px;line-height:1.6;text-align:center}
.profile-list{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:6px}


.profile-game{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:12px;row-gap:2px;padding:9px 12px;border:1px solid var(--menu-line);border-radius:10px;background:rgba(236,228,210,.04)}
.profile-game-head{display:flex;align-items:center;gap:8px;min-width:0}
.profile-game-outcome{display:inline-grid;place-items:center;width:26px;height:26px;flex-shrink:0;border-radius:7px;font-size:14px;color:var(--menu-light-ink);background:var(--menu-slate)}
.profile-game[data-outcome=win] .profile-game-outcome{background:var(--menu-gold);color:var(--menu-gold-ink)}
.profile-game[data-outcome=loss] .profile-game-outcome{background:var(--menu-copper)}
.profile-game-opponent{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;color:var(--menu-text)}
.profile-game-score{align-self:center;font-family:var(--menu-pixel);font-size:15px;color:var(--menu-gold);white-space:nowrap}
.profile-game-meta,.profile-game-items{grid-column:1 / -1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;color:var(--menu-faint)}
.profile-game-items{color:var(--menu-muted)}
.profile-game[data-player-count="3"] .profile-game-score{white-space:normal;text-align:right;font-family:inherit;font-size:13px;line-height:1.4}
.profile-game-rivals{grid-column:1 / -1;display:grid;gap:2px;margin:3px 0 2px;padding-left:34px;color:var(--menu-muted);font-size:12px}
.profile-game-rival{display:flex;justify-content:space-between;align-items:baseline;gap:10px;min-width:0}
.profile-game-rival-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.profile-game-rival-value{flex-shrink:0;white-space:nowrap;font-variant-numeric:tabular-nums}


.profile-recovery{display:flex;align-items:center;gap:8px;margin-bottom:10px}
.profile-recovery code{flex:1;min-width:0;padding:10px;border-radius:10px;background:rgba(0,0,0,.32);box-shadow:inset 0 2px 0 rgba(0,0,0,.35);color:#f3d48a;font-family:ui-monospace,Consolas,monospace;font-size:17px;letter-spacing:.06em;text-align:center;user-select:all;overflow-wrap:anywhere}
.profile-recovery code[data-missing=true]{font-family:inherit;font-size:14px;letter-spacing:0;color:var(--menu-muted);user-select:none}
.profile-recover-form{margin-top:16px;padding-top:14px;border-top:1px solid var(--menu-line)}
.profile-recover-form label{display:block;margin-bottom:6px;font-size:14px;color:var(--menu-text)}
.profile-recover-row{display:flex;gap:6px;margin-bottom:8px}
#valuation-app .profile-recover-row input{font-family:ui-monospace,Consolas,monospace;letter-spacing:.04em}
.profile-status{flex:none;min-height:1.4em;margin:0;font-size:13px;color:var(--menu-gold);text-align:center}
.profile-status.error{color:#e8907a}
.profile-status:empty{display:none}
.profile-sheet>.sheet-foot{flex:none;margin-top:0}

@media(max-width:600px){
  .profile-dialog{width:calc(100vw - 24px)}
  .profile-sheet{padding:14px 14px 16px;gap:10px;max-height:calc(100dvh - 24px)}
  .profile-paddle{width:38px;height:38px;font-size:14px}
  .profile-id h2{font-size:21px}
  .profile-summary{grid-template-columns:minmax(0,1fr);gap:8px}
  .profile-worth{padding:10px}
  #profile-networth{font-size:32px}
  /* On phones the record becomes one row of three cells. */
  .profile-stats{flex-direction:row;padding:6px 4px}
  .profile-stat{flex:1;flex-direction:column;justify-content:center;gap:2px;min-height:0;border-bottom:0;border-right:1px solid var(--menu-line)}
  .profile-stat:last-child{border-right:0}
  .profile-stat dt{font-size:12px}
  .profile-stat dd{min-width:0;padding:0 8px;font-size:16px}
  .profile-tabs{gap:6px;flex-wrap:nowrap}
  #valuation-app .menu-tabs.profile-tabs [role=tab]{flex:1;min-width:0;padding:0 2px;font-size:13px;letter-spacing:0;white-space:nowrap}
  .profile-tabs [role=tab] span{margin-left:2px}
  .profile-recovery code{font-size:15px;padding:8px 4px}
}
@media(max-height:560px){.profile-stats,.profile-welcome,.profile-sheet>.sheet-foot{display:none}.profile-summary{grid-template-columns:minmax(0,1fr)}}

/* Classroom: only the top-bar paddle changes; the sheet itself stays the same as Settings. */
.game-app[data-theme=classroom] .top-actions .profile-button{color:#263b62}
.game-app[data-theme=classroom] .profile-paddle-icon .paddle-mark{fill:#f1e9d5}
.game-app[data-theme=classroom] .profile-button-name{color:#263b62}
.game-app[data-theme=classroom] .profile-button[data-fresh=true]::after{background:#c0392b;box-shadow:0 0 0 2px #f1e9d5}

/* Achievements: one row per medal, like the collection rows; progress sits in a pill on the right. */
.achievement-card{display:flex;align-items:center;gap:12px;padding:8px 12px;border:1px solid var(--menu-line);border-radius:10px;background:rgba(236,228,210,.04)}
.achievement-card[data-unlocked=true]{border-color:rgba(201,162,90,.55);background:linear-gradient(90deg,rgba(201,162,90,.14),rgba(201,162,90,.03))}
.achievement-copy{flex:1;min-width:0}
.achievement-copy b{display:block;font-size:15px;color:var(--menu-text)}
.achievement-card[data-unlocked=false] .achievement-copy b{color:var(--menu-muted)}
.achievement-copy p{margin:2px 0 0;font-size:12px;line-height:1.5;color:var(--menu-faint)}
.achievement-progress{flex:none;padding:1px 10px;border-radius:999px;background:rgba(236,228,210,.08);color:var(--menu-muted);font-size:12px;white-space:nowrap}
.achievement-card[data-unlocked=true] .achievement-progress{background:var(--menu-gold);color:var(--menu-gold-ink)}

/* Built-in pixel avatars; the colour shows only while the portrait loads. */
.player-avatar{display:inline-block;flex:none;width:26px;height:26px;border:1px solid #d5ba7a;border-radius:4px;background:var(--avatar-image,none) center/cover no-repeat,var(--avatar-color,#82919c);box-sizing:border-box;image-rendering:auto}
/* In the profile head the avatar is the collector's portrait card: gold rim, a pencil badge says it can change. */
#valuation-app #profile-avatar{position:relative;width:60px;height:60px;padding:0;border:2px solid var(--menu-gold);border-radius:12px;background:var(--avatar-image,none) center/cover no-repeat,var(--avatar-color,#82919c);box-shadow:0 4px 0 var(--menu-gold-shadow);cursor:pointer}
#valuation-app #profile-avatar::after{content:'✎';position:absolute;right:-6px;bottom:-6px;display:grid;place-items:center;width:20px;height:20px;border-radius:6px;background:var(--menu-slate);color:var(--menu-light-ink);font-size:12px;line-height:1;box-shadow:0 2px 0 var(--menu-slate-shadow)}
#valuation-app #profile-avatar[aria-expanded=true]{border-color:var(--menu-focus)}
#profile-avatar:focus-visible,.avatar-option:focus-visible{outline:3px solid var(--menu-focus);outline-offset:3px}
.avatar-picker{flex:none;max-height:min(300px,40dvh);overflow-y:auto;padding:10px 12px 12px;border:1px solid var(--menu-line);border-radius:12px;background:var(--menu-panel);scrollbar-width:thin}
.avatar-picker>.profile-note{margin:0}
/* While choosing an avatar the summary steps aside so the picker and the tabs both fit. */
.profile-sheet:has(>#profile-avatar-picker:not([hidden]))>:is(.profile-summary,.profile-welcome){display:none}
.avatar-options{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:8px;margin:8px 0}
#valuation-app .avatar-option{display:flex;flex-direction:column;align-items:center;gap:6px;padding:8px 2px;line-height:1.35;text-align:center;border:2px solid transparent;border-radius:10px;background:transparent;color:var(--menu-muted);font:inherit;font-size:12px;cursor:pointer}
#valuation-app .avatar-option:hover:not(:disabled){background:rgba(236,228,210,.06);color:var(--menu-text)}
.avatar-option .player-avatar{width:64px;height:64px;border-radius:8px}
.avatar-option-name{white-space:pre-line}
#valuation-app .avatar-option[aria-pressed=true]{border-color:var(--menu-gold);background:rgba(201,162,90,.12);color:var(--menu-text)}
.avatar-option:disabled{opacity:.6;cursor:wait}
#profile-button .player-avatar{width:20px;height:20px;margin-right:5px;vertical-align:middle}
#valuation-app .seat-avatar{order:-2;width:24px;height:24px}
#valuation-app .score-heading:has(.seat-avatar) .paddle-no{display:none}
#valuation-app .lobby-avatar{width:48px;height:48px;margin:8px 0 12px}
@media(max-width:600px){.avatar-options{grid-template-columns:repeat(3,minmax(0,1fr))}.avatar-option .player-avatar{width:56px;height:56px}#valuation-app .seat-avatar{width:20px;height:20px}#valuation-app .lobby-avatar{width:32px;height:32px;margin:4px 0 6px}}
#menu-profile-avatar{width:34px;height:34px}
#profile-button:has(.player-avatar) .profile-paddle-icon{display:none}

/* Achievement medals: pixel art from public/assets/achievements-v1, dimmed until unlocked. */
.achievement-icon{flex:none;width:48px;height:48px;object-fit:contain;filter:drop-shadow(0 3px 4px rgba(0,0,0,.45))}
.achievement-card[data-unlocked=false] .achievement-icon{filter:grayscale(1) brightness(.5);opacity:.8}