/* ── profile.css ── */
/* ── Public Profile Header ── */
.public-profile {
    padding: 5px 5px;
    margin: 10px 9px 0;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 100;
    background: rgba(15, 15, 15, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 14px;
    flex-shrink: 0;
    container-type: inline-size;
    transition:
        border-color 0.35s ease,
        background 0.35s ease,
        padding 0.35s cubic-bezier(0.4, 0, 0.2, 1),
        border-radius 0.35s ease,
        transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Profile inline expansion ── */

.desktop.profile-open .public-profile {
    display: none;
}

/* Mobile: name + username centered in toolbar between back and edit buttons */
.profile-open-header {
    position: absolute;
    top: 10px;
    left: 90px;
    right: 90px;
    height: 40px;
    z-index: 101;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.desktop.profile-open .profile-open-header {
    opacity: 1;
}

/* Desktop: same centered layout as mobile */

.profile-open-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-open-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.profile-open-username {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

/* Stat row: hidden on mobile (stats shown flanking avatar), visible on desktop */
.profile-open-stat-row {
    display: none;
    flex-shrink: 0;
}

/* Big clickable stat cards — hidden by default, shown on desktop or in overlay */
.profile-open-stat-card {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    min-width: 80px;
    font-family: inherit;
    color: inherit;
}

.profile-open-stat-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

.profile-open-stat-card-num {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.2;
}

.profile-open-stat-card-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

[data-theme="light"] .profile-open-stat-card {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .profile-open-stat-card:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* Desktop: no stat cards in header, body stats always visible (same as mobile) */

.profile-open-username:empty {
    display: none;
}

/* Floating round back button for profile view — same style as .app-toolbar-back */
.profile-back-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 101;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 52px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.75);
    transition:
        opacity 0.25s ease,
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.15s;
}

.profile-back-btn:hover {
    background: rgba(50, 50, 50, 0.7);
    transform: scale(1.05);
}

.profile-back-btn:active {
    transform: scale(0.95);
}

.desktop.profile-open .profile-back-btn {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Stats collapse right */
.public-profile-stats {
    overflow: hidden;
    max-width: 240px;
    transition:
        opacity 0.22s ease,
        max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s ease,
        margin 0.32s ease;
}

.desktop.profile-open .public-profile-stats {
    opacity: 0;
    max-width: 0;
    transform: translateX(10px);
    margin: 0;
    pointer-events: none;
}

/* Stats always collapse when profile opens — shown in content instead */

/* Menu button and plan collapse right */
.desktop.profile-open .profile-menu-btn,
.desktop.profile-open .profile-settings-btn,
.desktop.profile-open .public-profile-plan {
    opacity: 0;
    max-width: 0;
    padding: 0;
    pointer-events: none;
    overflow: hidden;
}

/* When profile open: disable clicks on identity, hide only the text info.
   The avatar element stays in the identity and transforms to the big position. */
.desktop.profile-open .public-profile-identity {
    pointer-events: none;
    background: transparent;
}

.desktop.profile-open .public-profile-info {
    opacity: 0;
}

/* Hide the fixed header name — it's now in scrollable content */
.desktop.profile-open .profile-open-header {
    display: none;
}

/* Desktop tabs — instant switch */
.desktop-tabs {
    transition: none;
}

.desktop.profile-open .desktop-tabs {
    opacity: 0;
    pointer-events: none;
}

/* Desktop panels — instant switch */
.desktop-panels {
    transition: none;
}

.desktop.profile-open .desktop-panels {
    opacity: 0;
    pointer-events: none;
}

/* Inline profile panel */
.profile-inline-panel {
    position: absolute;
    inset: 0;
    z-index: 50;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
    padding: 48px 0px calc(var(--chat-h) + 32px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: none;
    /* instant on close */
}

.desktop.profile-open .profile-inline-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    transition:
        opacity 0.3s ease,
        transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    /* animate on open */
}

.profile-inline-content {
    margin: 0;
}

/* Scrollable profile top: avatar + name + stats */
.profile-content-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0 8px;
}

.profile-content-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.profile-content-avatar-init {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-tertiary);
}

.profile-content-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.profile-content-username {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-content-stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
}

/* Stats in content — shown on all screen sizes (pill stats are hidden when profile opens) */
.profile-inline-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

/* Avatar zone row: stats flank the avatar gap (centered layout) */
.profile-avatar-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    height: 117px;
    gap: 30px;
    margin-bottom: 38px;
}

.profile-avatar-gap {
    width: 117px;
    height: 117px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-stat {
    text-align: center;
    cursor: pointer;
    margin: 6px 12px;
    padding: 20px 2px;
    border-radius: 8px;
    transition: background 0.15s;
}

.profile-avatar-row .profile-stat {
    flex: 1 1 0;
}

.profile-stat:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-stat-num {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.profile-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

/* Follow button / email shown below pill */
.profile-inline-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Edit button inside the pill — only visible when profile is expanded */
/* Floating Edit profile button — top-right, same level as back button */
.profile-edit-float-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 101;
    height: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 0 16px 0 12px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 500;
    box-shadow: 0 2px 52px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transform: scale(0.75);
    transition:
        opacity 0.25s ease,
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        background 0.15s,
        color 0.15s;
}

.desktop.profile-open .profile-edit-float-btn {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

.profile-edit-float-btn:hover {
    background: rgba(96, 165, 250, 0.25);
    color: #93c5fd;
    border-color: rgba(96, 165, 250, 0.3);
}

.profile-edit-float-btn:active {
    transform: scale(0.95);
}

@media (max-width: 799px) {
    .profile-edit-float-btn svg {
        display: none;
    }

    .profile-edit-float-btn {
        padding: 0 16px;
        gap: 0;
    }
}

/* ── Profile Menu (dropdown) ── */
.profile-settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    align-self: stretch;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 13px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.profile-settings-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.profile-settings-label {
    display: inline;
}

@container (max-width: 450px) {
    .profile-settings-label {
        display: none;
    }

    .profile-settings-btn {
        padding: 6px;
    }
}

.profile-menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    max-width: 40px;
    transition:
        background 0.15s,
        color 0.15s,
        opacity 0.2s ease,
        max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        padding 0.3s ease;
}

.profile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.profile-dropdown {
    display: none;
    min-width: 160px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-hover);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.profile-dropdown.open {
    display: block;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition:
        background 0.15s,
        color 0.15s;
}

.profile-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.profile-dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
}

.public-profile-identity {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.public-profile-identity:hover {
    background: rgba(255, 255, 255, 0.06);
}

.public-profile-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    object-fit: cover;
    flex-shrink: 0;
}

.public-profile-info {
    flex: 1;
    min-width: 0;
    transition: opacity 0.15s ease;
}

.public-profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.public-profile-username {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.public-profile-stats {
    display: flex;
    gap: 16px;
    flex-shrink: 0;
    margin-left: auto;
}

.public-profile-stat {
    text-align: center;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s;
}

.public-profile-stat:hover {
    background: rgba(255, 255, 255, 0.06);
}

.public-profile-stat-num {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.public-profile-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 6px;
}

.public-profile-social {
    font-size: 12px;
    color: var(--text);
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.public-profile-social span {
    cursor: pointer;
    transition: color 0.15s;
}

.public-profile-social span:hover {
    color: var(--text);
}

.public-profile-social b {
    color: var(--text);
    font-weight: 600;
}

.public-profile-plan {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-shrink: 0;
    margin-left: auto;
    padding: 0 14px;
    align-self: stretch;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.public-profile-plan:hover {
    background: rgba(255, 255, 255, 0.06);
}

.public-profile-tokens {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding: 0px 0px 5px 0px;
}

.public-profile-plan-name {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Profile Overlay (other user profiles) ── */
.profile-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--chat-w, 600px);
    z-index: 200;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@media (max-width: 799px) {
    .profile-overlay {
        left: 0;
    }
}

.profile-overlay-close {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(30, 30, 30, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s,
        transform 0.15s;
    padding: 0;
}

.profile-overlay-close:hover {
    background: rgba(50, 50, 50, 0.7);
    transform: scale(1.05);
}

.profile-overlay-close:active {
    transform: scale(0.95);
}

.profile-overlay-content {
    overflow-y: auto;
    flex: 1;
    padding-top: 12px;
}

.profile-overlay-avatar-center {
    display: flex;
    justify-content: center;
}

.profile-overlay-big-avatar {
    width: 117px !important;
    height: 117px !important;
    border-radius: 50%;
    object-fit: cover;
}

.profile-overlay-avatar-init {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    font-size: 42px;
    font-weight: 600;
    color: var(--text);
}

.profile-overlay-name-block {
    text-align: center;
    margin-bottom: 16px;
}

.profile-overlay-name-block .profile-overlay-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-overlay-name-block .profile-overlay-username {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 20px 10px;
}

.profile-friends-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 0px 0px 34px;
}

.profile-friend-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    width: 76px;
}

.profile-friend-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
}

.profile-friend-avatar.pf-init {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
}

.profile-friend-name {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: 200px 0;
    }
}

.shimmer {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.04) 25%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.04) 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

.shimmer-line {
    border-radius: 4px;
}

.profile-win-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.profile-win-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    object-fit: cover;
    flex-shrink: 0;
}

.profile-win-info {
    flex: 1;
    min-width: 0;
}

.profile-win-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.profile-win-username {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-win-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-win-stat {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.profile-win-stat:hover {
    background: rgba(255, 255, 255, 0.06);
}

.profile-win-stat-num {
    font-weight: 600;
    color: var(--text);
}

.profile-win-stat-label {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-win-apps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
}


/* ── Username Section ── */
/* ── Edit Profile Screen ── */

.edit-profile-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 24px;
}

.edit-profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
}

.edit-profile-avatar-ring {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
}

.edit-profile-avatar-ring:hover .edit-profile-avatar-overlay {
    opacity: 1;
}

.edit-profile-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.edit-profile-avatar-empty {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    color: var(--text-secondary);
}

.edit-profile-avatar-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    color: #fff;
}

.edit-profile-avatar-hint {
    font-size: 12px;
    color: var(--text-muted);
    min-height: 16px;
}

.edit-profile-avatar-hint.saving {
    color: var(--text-secondary);
}

.edit-profile-avatar-hint.saved {
    color: #4ade80;
}

.edit-profile-avatar-hint.error {
    color: #f87171;
}

.edit-profile-section {
    margin-bottom: 16px;
}

.edit-profile-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.edit-profile-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.edit-profile-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s;
}

.edit-profile-input:focus {
    border-color: var(--accent);
}

.edit-profile-save-btn {
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}

.edit-profile-save-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.edit-profile-field-status {
    font-size: 12px;
    min-height: 16px;
    margin-top: 4px;
    color: var(--text-muted);
}

.edit-profile-field-status.saved {
    color: #4ade80;
}

.edit-profile-field-status.invalid {
    color: #f87171;
}

/* username-section inside edit screen — no extra border boxing needed */
.edit-profile-section .username-section {
    margin-bottom: 0;
    background: transparent;
    border: none;
    padding: 0;
}

.username-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.username-section:focus-within {
    border-color: var(--border-hover);
}

.username-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.username-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.username-display-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
}

.username-display-empty {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    cursor: text;
    transition: color 0.15s;
}

.username-display-empty:hover {
    color: var(--text-dim);
}

.username-claim-btn,
.username-change-btn {
    padding: 5px 13px;
    border-radius: 8px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.username-claim-btn:hover,
.username-change-btn:hover {
    background: var(--accent);
    color: #000;
}

.username-edit-form {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: usernameSlideDown 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes usernameSlideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.username-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.username-prefix {
    font-size: 16px;
    color: var(--text-dim);
    font-weight: 500;
    flex-shrink: 0;
    user-select: none;
}

.username-input {
    flex: 1;
    padding: 8px 10px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.username-input:focus {
    border-color: var(--accent);
}

.username-input.error {
    border-color: var(--red);
    animation: usernameShake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.username-input.success {
    border-color: var(--green);
}

@keyframes usernameShake {

    0%,
    100% {
        transform: translateX(0);
    }

    15% {
        transform: translateX(-6px);
    }

    35% {
        transform: translateX(6px);
    }

    55% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }

    90% {
        transform: translateX(-2px);
    }
}

.username-status {
    font-size: 12px;
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
    padding-left: 2px;
}

.username-status.available {
    color: var(--green);
}

.username-status.taken {
    color: var(--red);
}

.username-status.checking {
    color: var(--text-muted);
}

.username-status.hint {
    color: var(--text-muted);
}

.username-status.invalid {
    color: var(--orange);
}

.username-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.username-save-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: #000;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition:
        filter 0.15s,
        opacity 0.15s,
        background 0.2s;
}

.username-save-btn:hover:not(:disabled) {
    filter: brightness(1.12);
}

.username-save-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.username-save-btn.saving {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: wait;
    font-weight: 400;
}

.username-save-btn.saved {
    background: var(--green);
    color: #000;
}

.username-cancel-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.username-cancel-btn:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

/* Light theme */
[data-theme="light"] .profile-back-btn {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--border);
    color: var(--text-muted);
}
[data-theme="light"] .profile-back-btn:hover {
    background: #fff;
    color: var(--text);
}
[data-theme="light"] .profile-edit-float-btn {
    background: rgba(255, 255, 255, 0.85);
    border-color: var(--border);
    color: var(--text-dim);
}
[data-theme="light"] .profile-edit-float-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent);
    border-color: rgba(0, 122, 255, 0.3);
}
