/* Accounts UI. Built only from theme tokens (theme-base.css), so all seven designs dress it. */
.account-slot { position: relative; display: flex; align-items: center; gap: 8px; }
.account-entry, .account-menu-button, .notes-button {
  min-height: 44px; margin: 0; padding: 6px 12px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--ghost-on-bg) !important; border-radius: var(--radius-sm); background: transparent !important; color: var(--on-bg) !important;
  font: 600 14px/1.2 var(--text) !important; box-shadow: none !important; text-transform: none !important; letter-spacing: 0 !important;
}
.account-entry:hover, .account-menu-button:hover, .notes-button:hover { background: color-mix(in srgb, var(--on-bg) 12%, transparent) !important; }
.notes-badge { min-width: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; line-height: 20px; text-align: center; }
.account-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-popover {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; width: min(360px, calc(100vw - 24px)); max-height: min(70vh, 520px); overflow: auto;
  padding: 14px; background: var(--surface); color: var(--on-surface); border: var(--panel-border); border-radius: var(--radius);
  box-shadow: var(--panel-frame), 0 18px 40px rgba(0, 0, 0, 0.35); --focus: var(--focus-surface);
}
.account-popover h2 { margin: 0 0 8px; font-size: 22px; color: var(--on-surface); }
.account-menu { width: 220px; display: grid; gap: 2px; padding: 8px; }
.account-menu a, .account-logout {
  display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--on-surface) !important; text-decoration: none;
  font: 600 15px/1.2 var(--text) !important; background: transparent !important; border: 0 !important; box-shadow: none !important; text-transform: none !important; text-align: left; width: 100%;
}
.account-menu a:hover, .account-logout:hover { background: color-mix(in srgb, var(--on-surface) 9%, transparent) !important; }
.account-logout { border-top: 1px solid var(--surface-line) !important; border-radius: 0; margin-top: 4px; }
.notes-list, .people, .history-list, .top-games { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.note { padding: 10px 0; border-top: 1px solid var(--surface-line); }
.note p { margin: 0 0 8px; }
.account-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.account-row .btn { min-height: 40px; padding: 6px 12px; font-size: 14px; }

/* avatars: same colours in every design so people stay recognisable */
.pm-avatar { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; font: 700 16px/1 var(--text); color: #fff; background: #2b2b2b; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--surface-line); }
.pm-avatar.small { width: 28px; height: 28px; font-size: 12px; }
.pm-avatar.large { width: 84px; height: 84px; font-size: 34px; }
.pm-avatar[data-color="rojo"] { background: #9e2028; }
.pm-avatar[data-color="verde"] { background: #2f6b3a; }
.pm-avatar[data-color="azul"] { background: #2a4fb0; }
.pm-avatar[data-color="oro"] { background: #8a6420; }
.pm-avatar[data-color="violeta"] { background: #6a3fb0; }
.pm-avatar[data-color="carbon"] { background: #2b2b2b; }

/* sign-in dialog */
.account-dialog { width: min(520px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: var(--panel-border); border-radius: var(--radius-card); background: var(--surface); color: var(--on-surface); box-shadow: var(--panel-frame), 0 30px 80px rgba(0, 0, 0, 0.5); --focus: var(--focus-surface); }
.account-dialog::backdrop { background: var(--backdrop); }
.account-dialog-head { position: relative; padding: 20px 60px 6px 22px; }
.account-dialog-head h2, .account-dialog-body h2 { margin: 0; font-size: clamp(26px, 5vw, 34px); color: var(--on-surface); }
.account-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border: 0 !important; border-radius: 50%; background: transparent !important; color: var(--on-surface) !important; font-size: 28px !important; box-shadow: none !important; cursor: pointer; }
.account-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--surface-line); overflow-x: auto; }
.account-tab { min-height: 44px; margin: 0; padding: 0 12px; border: 0 !important; border-bottom: 3px solid transparent !important; border-radius: 0 !important; background: transparent !important; color: var(--on-surface-muted) !important; box-shadow: none !important; font: 600 15px/1 var(--text) !important; text-transform: none !important; cursor: pointer; white-space: nowrap; }
.account-tab[aria-selected="true"] { color: var(--on-surface) !important; border-bottom-color: var(--surface-accent) !important; }
.account-dialog-body { padding: 16px 22px 22px; display: grid; gap: 12px; }
.account-lede { margin: 0; color: var(--on-surface-muted); font-size: 14px; }
.account-form { display: grid; gap: 14px; }
.account-field { display: grid; gap: 6px; font-weight: 600; color: var(--on-surface); }
.account-field input, .account-field textarea { width: 100%; padding: 10px 12px; font-size: 16px; }
.account-rule { font-weight: 400; font-size: 13px; color: var(--on-surface-muted); }
.account-error, .account-message[data-kind="error"] { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--error-bg); color: var(--error-ink); border: 1px solid var(--error-line); font-weight: 600; }
.account-message[data-kind="ok"] { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--surface-line); font-weight: 600; color: var(--on-surface); }
.recovery-codes { margin: 0; padding: 12px 12px 12px 36px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 16px; background: var(--surface-2); border: 1px dashed var(--surface-line); border-radius: var(--radius-sm); font: 600 15px/1.4 var(--mono); }
button[aria-busy="true"] { cursor: progress; opacity: 0.7; }

/* account pages */
.account-shell { display: grid; gap: 18px; }
.account-shell > h1, .account-card h1 { margin: 0; font-size: clamp(32px, 5vw, 48px); }
.account-shell > h1 { color: var(--on-bg); }
.account-shell > a { color: var(--on-bg); justify-self: start; }
.account-card { display: grid; gap: 12px; }
.account-card h2 { margin: 0; font-size: clamp(22px, 3.4vw, 28px); }
.account-card h3 { margin: 8px 0 0; font-size: 18px; }
.account-tabs-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.account-tabs-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border: 1px solid var(--ghost-on-bg); border-radius: var(--radius-sm); color: var(--on-bg); text-decoration: none; font-weight: 600; }
.account-tabs-nav a[aria-current="page"] { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.profile-who { display: flex; align-items: center; gap: 18px; }
.profile-bio { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 0; }
.stat-grid div { padding: 10px; background: var(--surface-2); border: 1px solid var(--surface-line); border-radius: var(--radius-sm); }
.stat-grid dt { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-surface-muted); }
.stat-grid dd { margin: 0; font: var(--heading-weight) 28px/1.1 var(--display); }
.top-games { list-style: decimal; padding-left: 1.4em; gap: 4px; }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 10px; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); }
.avatar-picker legend { font-weight: 700; padding: 0 4px; }
.swatch-option { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; border: 1px solid var(--surface-line); border-radius: var(--radius-sm); cursor: pointer; font-size: 18px; }
.swatch-option span:last-child { font-size: 14px; }
.swatch-option:has(input:checked) { border: 2px solid var(--on-surface); background: var(--surface-2); }
.swatch-option input { width: 18px; height: 18px; min-height: 0; accent-color: var(--surface-accent); }
.history-item { display: grid; gap: 2px; padding: 12px; background: var(--surface-2); border: 1px solid var(--surface-line); border-left: 5px solid var(--on-surface-muted); border-radius: var(--radius-sm); }
.history-item[data-outcome="win"] { border-left-color: var(--suit-b); }
.history-item[data-outcome="loss"] { border-left-color: var(--suit-c); }
.history-item[data-outcome="coop"] { border-left-color: var(--suit-d); }
.history-result { font-weight: 600; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--surface-line); }
.person > a { font-weight: 700; color: var(--on-surface); }
.person .account-row { margin-left: auto; }
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border: 1px solid var(--surface-line); border-radius: 14px; font-size: 13px; font-weight: 600; }
.presence { font-size: 13px; color: var(--on-surface-muted); }
.presence.online { color: var(--suit-b); font-weight: 700; }
.search-form { grid-template-columns: 1fr auto; align-items: end; }

/* room: friends and sharing */
.party-roster li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.roster-friend { min-height: 32px !important; padding: 2px 10px !important; font-size: 12px !important; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.invite-dialog .people { max-height: 50vh; overflow: auto; }
.invite-note { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--surface-line); border-radius: var(--radius-sm); }

@media (max-width: 640px) {
  .account-name { display: none; }
  .account-entry { padding: 6px 10px; font-size: 13px !important; }
  .recovery-codes { grid-template-columns: 1fr; }
  .search-form { grid-template-columns: 1fr; }
  .person .account-row { margin-left: 0; width: 100%; }
  .account-popover { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
}
.friends { display: grid; gap: 18px; }
.account-menu { padding: 14px; }
