/* Personal center: a bounded dialog with one scrolling content area. */
body.profile-center-open { overflow: hidden; }
#userCenterModal {
    --profile-bg: #f6f7fa;
    --profile-surface: #fff;
    --profile-text: #252632;
    --profile-muted: #717584;
    --profile-border: #e8eaf0;
    --profile-accent: #c74378;
    --profile-soft: #fcecf3;
    box-sizing: border-box;
    height: 100%; height: 100dvh;
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    z-index: 1001;
    background: #19203280;
    backdrop-filter: blur(6px);
}
#userCenterModal .profile-shell {
    box-sizing: border-box;
    display: flex; flex-direction: column;
    width: 100%; max-width: 560px; max-height: 100%; min-height: 0;
    padding: 0; overflow: hidden; border-radius: 22px;
    background: var(--profile-bg); color: var(--profile-text);
    border: 1px solid var(--profile-border);
    box-shadow: 0 24px 80px #17223b33;
}
#userCenterModal * { box-sizing: border-box; }
#userCenterModal .profile-header {
    flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; gap: 12px;
    background: var(--profile-surface); border-bottom: 1px solid var(--profile-border);
}
#userCenterModal .profile-header h2 { font-size: 18px; line-height: 1.4; margin: 0; letter-spacing: .3px; }
#userCenterModal .profile-header p { font-size: 12px; color: var(--profile-muted); margin: 4px 0 0; }
#userCenterModal .profile-close {
    width: 40px; height: 40px; flex: 0 0 40px;
    background: var(--profile-bg); color: var(--profile-muted);
    border: 1px solid var(--profile-border); border-radius: 12px;
    font-size: 26px; line-height: 1; cursor: pointer;
}
#userCenterModal .profile-body {
    min-height: 0; overflow-y: auto; overflow-x: hidden;
    padding: 20px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    scrollbar-width: thin; scrollbar-color: #c8cbd3 transparent;
    scroll-padding-block: 16px;
}
#userCenterModal .profile-card { background: var(--profile-surface); border: 1px solid var(--profile-border); border-radius: 16px; padding: 18px; }
#userCenterModal .profile-identity { display: flex; gap: 16px; align-items: center; }
#userCenterModal .profile-avatar { width: 68px; height: 68px; flex: 0 0 68px; border: 0; padding: 0; border-radius: 50%; background: var(--profile-soft); color: var(--profile-accent); font-size: 26px; cursor: pointer; overflow: hidden; }
#userCenterModal .profile-identity-copy { min-width: 0; flex: 1; }
#userCenterModal .profile-name { font-size: 21px; line-height: 1.3; margin: 0 0 5px; overflow-wrap: anywhere; }
#userCenterModal .profile-meta { font-size: 12px; line-height: 1.7; color: var(--profile-muted); overflow-wrap: anywhere; }
#userCenterModal .profile-role { display: inline-flex; padding: 3px 9px; margin-top: 7px; border-radius: 6px; font-size: 11px; line-height: 1.5; background: var(--profile-soft); color: var(--profile-accent); }
#userCenterModal .user-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
#userCenterModal .stat-card { min-width: 0; text-align: center; padding: 14px 5px 12px; border-radius: 12px; background: var(--profile-bg); }
#userCenterModal .stat-card:first-child { background: #fff5e5; color: #986317; }
#userCenterModal .stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
#userCenterModal .stat-label { font-size: 11px; margin-top: 6px; color: var(--profile-muted); }
#userCenterModal .profile-stat-note { color: var(--profile-muted); font-size: 11px; line-height: 1.6; margin: 10px 0 16px; }
#userCenterModal .profile-section-label { margin: 0 0 10px; font-size: 13px; color: var(--profile-muted); font-weight: 600; }
#userCenterRoles { display: flex; flex-direction: column; gap: 7px; }
#userCenterRoles .role-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; background: var(--profile-bg) !important; border-radius: 8px !important; border: 0 !important; padding: 9px 11px !important; }
#userCenterRoles .role-item span { overflow-wrap: anywhere; }
#userCenterRoles .role-item span:last-child { margin-left: auto; color: var(--profile-muted) !important; }
#userCenterModal .priority-panel { margin: 14px 0; padding: 18px; border-radius: 16px; border-color: #ead9b6; background: #fffbf3; color: #574323; }
#userCenterModal .profile-priority-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#userCenterModal .priority-panel h3 { margin: 0; font-size: 16px; }
#userCenterModal .profile-balance { margin: 0; font-size: 12px; white-space: nowrap; }
#userCenterModal #priorityUserBalance { font-size: 20px; margin: 0 3px; }
#userCenterModal .priority-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 15px 0 12px; }
#userCenterModal .priority-actions button { min-width: 0; min-height: 44px; padding: 10px 12px; font-size: 13px; border-radius: 10px; }
#userCenterModal .priority-actions .primary { background: #8d6829; border-color: #8d6829; }
#userCenterModal .priority-panel summary { cursor: pointer; font-size: 12px; padding: 8px 0 2px; line-height: 1.6; }
#userCenterModal .priority-record { padding: 12px; }
#userCenterModal .priority-record h4 { font-size: 14px; }
#userCenterModal .priority-record p { font-size: 12px; }
#userCenterModal .profile-settings-title { margin: 0 0 14px; font-size: 15px; }
#userCenterModal .profile-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
#userCenterModal .profile-action { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 52px; padding: 11px 10px; border: 1px solid var(--profile-border); border-radius: 11px; background: var(--profile-surface); color: var(--profile-text); text-align: left; font-size: 12px; cursor: pointer; }
#userCenterModal .profile-action svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--profile-accent); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#userCenterModal .profile-action span { overflow-wrap: anywhere; }
#userCenterModal .profile-action-wide { grid-column: 1 / -1; background: var(--profile-soft); border-color: transparent; }
#userCenterModal .profile-action-wide::after { content: '›'; font-size: 22px; color: var(--profile-accent); margin-left: auto; }
#userCenterModal .profile-footer { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; border-top: 1px solid var(--profile-border); background: var(--profile-surface); }
#userCenterModal .profile-footer button { min-height: 44px; padding: 10px 20px; border-radius: 11px; border: 0; font-size: 13px; font-weight: 600; cursor: pointer; }
#userCenterModal .profile-logout { background: transparent; color: #bd4658; }
#userCenterModal .profile-done { background: var(--profile-accent); color: #fff; min-width: 100px; }
#userCenterModal button:focus-visible, #userCenterModal summary:focus-visible { outline: 2px solid var(--profile-accent); outline-offset: 3px; }
@media (hover: hover) { #userCenterModal .profile-action:hover, #userCenterModal .profile-close:hover { background: var(--profile-soft); border-color: #deb2c5; } }
/* Account subdialogs must stay above the personal center, including activation. */
#changePasswordModal, #changeEmailModal, #changeQQModal, #activateModal { z-index: 1010; box-sizing: border-box; padding: 16px; height: 100%; height: 100dvh; }
#changePasswordModal > .modal-content, #changeEmailModal > .modal-content, #changeQQModal > .modal-content, #activateModal > .modal-content { box-sizing: border-box; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
body.night-mode #userCenterModal { --profile-bg: #20222b; --profile-surface: #292c37; --profile-text: #ececf1; --profile-muted: #a6aabb; --profile-border: #3a3e4d; --profile-accent: #e789ae; --profile-soft: #412f3d; }
body.night-mode #userCenterModal .stat-card:first-child { background: #3c3328; color: #e5bc7d; }
body.night-mode #userCenterModal .priority-panel { background: #302c24; border-color: #64553a; color: #eddfc3; }
body.night-mode #userCenterModal .priority-actions button { background: #302c24; border-color: #76613b; color: #eddfc3; }
body.night-mode #userCenterModal .priority-actions .primary { background: #b38a42; color: #181818; }
body.night-mode #userCenterModal .profile-done { color: #251721; }
body.night-mode #userCenterModal .profile-logout { color: #f197a7; }
@media (min-width: 780px) and (min-height: 600px) {
    #userCenterModal .profile-shell { max-width: 780px; }
    #userCenterModal .profile-body { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
    #userCenterModal .user-profile { grid-row: 1 / span 2; align-self: stretch; }
    #userCenterModal .priority-panel { margin: 0; }
    #userCenterModal .user-actions { grid-column: 2; }
}
@media (max-width: 380px) {
    #userCenterModal .profile-body { padding: 12px; }
    #userCenterModal .profile-card, #userCenterModal .priority-panel { padding: 14px; }
    #userCenterModal .profile-identity { gap: 12px; }
    #userCenterModal .profile-header { padding: 14px 16px; }
    #userCenterModal .profile-footer { padding: 10px 14px; }
    #userCenterModal .priority-actions { grid-template-columns: minmax(0, 1fr); }
}
@media (max-height: 420px) {
    #userCenterModal .profile-header { padding-block: 8px; }
    #userCenterModal .profile-header p { display: none; }
    #userCenterModal .profile-footer { padding-block: 8px; }
}
