

.profile-page {
    padding: 40px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}


.profile-header {
    display: flex;
    gap: 32px;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--accent-glow);
    border-radius: 20px;
    padding: 40px;
}

.profile-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.profile-avatar img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    border: 4px solid var(--accent);
    box-shadow: 0 0 30px var(--accent-glow-strong);
    cursor: zoom-in;
}

.change-avatar-btn {
    background: var(--border);
    border: 2px solid var(--border-strong);
    color: var(--accent);
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.change-avatar-btn:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.profile-info {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.profile-username {
    font-size: clamp(26px, 6vw, 42px);
    font-weight: 900;
    margin: 0 0 24px 0;
    
    overflow-wrap: anywhere;
    background: linear-gradient(135deg, var(--accent), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-stats-quick {
    display: flex;
    gap: 40px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    color: var(--accent);
    font-size: 28px;
    font-weight: 800;
}


.profile-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
}

.profile-section h2 {
    color: white;
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 24px 0;
}

.achievements-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.achievements-header h2 { margin-bottom: 5px; }

.achievements-header p {
    margin: 0;
    color: rgba(226, 232, 240, .64);
    font-size: 14px;
    line-height: 1.5;
}

.achievements-total {
    flex: 0 0 auto;
    padding: 8px 11px;
    border: 1px solid rgba(196, 181, 253, .36);
    border-radius: 999px;
    color: #ede9fe;
    background: rgba(109, 40, 217, .18);
    font-size: 13px;
    font-weight: 800;
}

.achievements-preview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.achievement-card {
    display: flex;
    gap: 12px;
    min-height: 140px;
    padding: 15px;
    border: 1px solid rgba(148, 163, 184, .19);
    border-radius: 14px;
    background: rgba(15, 23, 42, .45);
}

.achievement-card-preview {
    min-height: 78px;
    padding: 11px;
}

.achievement-card.unlocked {
    border-color: rgba(167, 139, 250, .5);
    background: linear-gradient(135deg, rgba(91, 33, 182, .24), rgba(30, 41, 59, .62));
    box-shadow: inset 0 0 0 1px rgba(221, 214, 254, .06);
}

.achievement-card.locked { opacity: .66; }

.achievement-emblem {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border: 1px solid rgba(196, 181, 253, .4);
    border-radius: 13px;
    color: #ddd6fe;
    background: rgba(76, 29, 149, .24);
    overflow: hidden;
}

.achievement-emblem.has-art {
    border-color: rgba(226, 232, 240, .3);
    background-color: rgba(76, 29, 149, .24);
    background-size: 400% 400%;
    background-repeat: no-repeat;
}

.achievement-card-preview .achievement-emblem {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 12px;
}

.achievement-copy { min-width: 0; }

.achievement-copy h3 {
    margin: 0 0 5px;
    color: #f8fafc;
    font-size: 15px;
    line-height: 1.25;
}

.achievement-copy p {
    margin: 0;
    color: rgba(226, 232, 240, .65);
    font-size: 12px;
    line-height: 1.45;
}

.achievement-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-top: 10px;
    color: rgba(196, 181, 253, .9);
    font-size: 11px;
    font-weight: 700;
}

.achievement-percent { color: rgba(203, 213, 225, .68); }

.achievements-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    margin-top: 15px;
    padding: 12px 16px;
    border: 1px solid rgba(167, 139, 250, .45);
    border-radius: 11px;
    color: #ede9fe;
    background: rgba(109, 40, 217, .14);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.achievements-open:hover {
    border-color: rgba(196, 181, 253, .8);
    background: rgba(109, 40, 217, .27);
    transform: translateY(-1px);
}

.achievements-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 23, .78);
    backdrop-filter: blur(8px);
}

.achievements-modal[hidden] { display: none; }

.achievements-dialog {
    width: min(1180px, 100%);
    max-height: min(820px, calc(100dvh - 48px));
    padding: 24px;
    overflow: auto;
    border: 1px solid rgba(167, 139, 250, .45);
    border-radius: 18px;
    background: linear-gradient(145deg, #12192b, #0d1426);
    box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}

.achievements-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.achievements-dialog h2 {
    margin: 0 0 5px;
    color: #fff;
    font-size: 24px;
}

.achievements-dialog p {
    max-width: 650px;
    margin: 0;
    color: rgba(226, 232, 240, .67);
    line-height: 1.5;
}

.achievements-close {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 1px solid rgba(196, 181, 253, .4);
    border-radius: 10px;
    color: #f8fafc;
    background: rgba(91, 33, 182, .22);
    font: inherit;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.achievements-close:hover { background: rgba(109, 40, 217, .42); }

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

body.achievements-modal-open { overflow: hidden; }


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.role-stats-card {
    margin-top: 28px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.role-stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}




.section-title-with-scope {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scope-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.scope-chip.scope-global {
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.35);
}

.scope-chip.scope-server {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.role-stats-title {
    font-weight: 800;
    font-size: 18px;
}

.role-stats-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 4px;
}

.stat-card {
    background: var(--accent-bg);
    border: 2px solid var(--accent-glow);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-icon {
    font-size: 36px;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
}

.stat-text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}


.role-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.role-stat-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.role-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.role-icon img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.role-name {
    min-width: 120px;
    font-weight: 600;
    font-size: 16px;
}

.role-bar {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.role-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #3b82f6);
    border-radius: 6px;
    transition: width 0.5s ease;
}






.profile-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-loading-row {
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 37%,
        rgba(255, 255, 255, 0.04) 63%);
    background-size: 400% 100%;
    animation: profile-loading-shimmer 1.4s ease infinite;
}

@keyframes profile-loading-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .profile-loading-row { animation: none; }
}

.ladder-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ladder-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ladder-bucket {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    font-size: 15px;
}

.ladder-rating {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}



.ladder-rating-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.55);
    text-transform: uppercase;
}


.ladder-rating--unrated {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: none;
    letter-spacing: 0;
}

.ladder-games {
    min-width: 150px;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

@media (max-width: 640px) {
    .ladder-item {
        flex-wrap: wrap;
        gap: 8px 12px;
    }

    .ladder-games {
        min-width: 0;
        text-align: left;
        flex-basis: 100%;
    }
}

.role-percent {
    min-width: 100px;
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 600;
}

.avatar-lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    z-index: 1000;
    padding: 20px;
}

.avatar-lightbox.active {
    display: flex;
}

.avatar-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 16px;
    border: 3px solid rgba(139, 92, 246, 0.7);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    background: #0f172a;
}

.avatar-lightbox .close-lightbox {
    position: absolute;
    top: 18px;
    right: 22px;
    font-size: 28px;
    color: #e5e7eb;
    cursor: pointer;
    font-weight: 800;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--accent-glow-strong);
    transition: transform 0.2s ease, background 0.2s ease;
}

.avatar-lightbox .close-lightbox:hover {
    transform: scale(1.05);
    background: rgba(79, 70, 229, 0.6);
}

.avatar-editor {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.avatar-editor.active {
    opacity: 1;
    pointer-events: auto;
}

.avatar-editor-content {
    background: #0d111f;
    border: 1px solid var(--accent-glow);
    border-radius: 16px;
    padding: 24px;
    width: min(720px, 92vw);
    color: #e5e7eb;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

.avatar-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 16px;
}

.avatar-editor-title {
    font-size: 22px;
    font-weight: 800;
}

.avatar-editor-subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-top: 4px;
}

.avatar-editor-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

.avatar-editor-close:hover {
    color: #fff;
}

.avatar-editor-preview-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.avatar-editor-preview {
    position: relative;
    width: min(360px, 80vw);
    aspect-ratio: 1 / 1;
    background: #0b0f1c;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    touch-action: none;
}

.avatar-editor-preview img {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%);
    transform-origin: center;
    will-change: transform;
    user-select: none;
    pointer-events: none;
}

.avatar-editor-mask {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.avatar-editor-hole {
    position: absolute;
    width: 72%;
    height: 72%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.6);
    border: 2px dashed rgba(255, 255, 255, 0.25);
}

.avatar-editor-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.avatar-zoom-label {
    font-size: 13px;
    color: var(--text);
}

#avatarZoomRange {
    width: 100%;
    accent-color: var(--accent);
}

.avatar-editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.avatar-editor-button {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    cursor: pointer;
}

.avatar-editor-button.secondary {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: #e5e7eb;
}

.avatar-editor-button.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.avatar-editor-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


.game-history {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-history-table {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.game-history-header {
    display: grid;
    grid-template-columns: 1.1fr 2fr 0.75fr 0.85fr 0.85fr;
    padding: 12px 16px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 10px;
    background: linear-gradient(90deg, var(--accent-bg), rgba(139, 92, 246, 0.05));
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 13px;
    column-gap: 8px;
}

.game-history-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.history-limit-note {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.game-history-row {
    display: grid;
    grid-template-columns: 1.1fr 2fr 0.75fr 0.85fr 0.85fr;
    align-items: center;
    padding: 14px 16px;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: all 0.3s ease;
    gap: 8px;
    color: inherit;
    text-decoration: none;
}

.game-history-row:hover {
    border-color: var(--border-strong);
    background: var(--accent-bg);
}

.profile-empty {
    padding: 16px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(139, 92, 246, 0.05);
}

.profile-empty-state {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 28px 20px;
    border: 1px dashed rgba(167, 139, 250, 0.28);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.28);
    color: rgba(226, 232, 240, 0.66);
    text-align: center;
}

.profile-empty-state p {
    margin: 0;
}

.profile-empty-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    border: 1px solid rgba(167, 139, 250, 0.42);
    border-radius: 10px;
    color: #ede9fe;
    background: rgba(109, 40, 217, 0.16);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.profile-empty-action:hover {
    border-color: rgba(196, 181, 253, 0.72);
    background: rgba(109, 40, 217, 0.3);
    transform: translateY(-1px);
}


.game-date {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.game-lobby {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-role,
.game-result,
.game-mmr {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-self: end;
    text-align: right;
}

.game-role-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.game-role-icon img {
    width: 33px;
    height: 33px;
    object-fit: contain;
}

.game-title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.game-title .lobby-name {
    font-weight: 700;
    color: #fff;
}

.game-title .game-mode,
.game-lobby .game-mode {
    color: var(--text-subtle);
    font-size: 13px;
}

.game-history-header .column-label:nth-child(3),
.game-history-header .column-label:nth-child(4),
.game-history-header .column-label:nth-child(5) {
    text-align: right;
    justify-self: end;
    padding-right: 12px;
}

.result-badge {
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    display: inline-flex;
    justify-content: center;
    min-width: 76px;
}

.result-badge.win {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.result-badge.loss {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.game-role {
    font-size: 20px;
}

.game-details {
    display: flex;
    gap: 24px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.game-detail {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.mmr-change {
    font-weight: 700;
}

.mmr-change.positive {
    color: #10b981;
}

.mmr-change.negative {
    color: var(--danger);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination button {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-strong);
    background: rgba(139, 92, 246, 0.15);
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 38px;
}

.pagination button.active {
    background: rgba(139, 92, 246, 0.35);
    border-color: rgba(139, 92, 246, 0.8);
    font-weight: 700;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-ellipsis {
    padding: 8px 12px;
    color: rgba(229, 231, 235, 0.7);
    font-weight: 700;
}


.friends-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.friends-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.friends-count {
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid var(--accent-glow);
}

.friends-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--accent);
    font-weight: 800;
    background: rgba(139, 92, 246, 0.12);
    border: 2px solid var(--accent-glow);
    box-shadow: 0 0 18px rgba(139, 92, 246, 0.25);
    transition: all 0.3s ease;
}

.friends-view-all-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35);
}

.friends-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.friends-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.friend-card {
    width: 130px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    color: #e5e7eb;
    text-decoration: none;
}

.friend-card:hover {
    transform: translateY(-2px);
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.friend-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.friend-avatar-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--border-strong);
    overflow: hidden;
    background: rgba(15, 23, 42, 0.6);
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 2px rgba(139, 92, 246, 0.15);
}

.friend-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-name {
    font-weight: 800;
    font-size: 15px;
    text-align: center;
}

.friend-rating-chip {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 700;
    color: #e5e7eb;
    font-size: 12px;
}

.friend-card.pending {
    position: relative;
}

.friend-card.pending .friend-avatar-wrap,
.friend-card.pending .friend-name {
    opacity: 0.6;
}

.friend-request-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

.friend-action {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
}

.friend-action.accept {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.5);
    color: #34d399;
}

.friend-action.decline {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #f87171;
}

.friend-requests-title {
    font-weight: 800;
    margin: 16px 0 8px;
}

.friend-requests-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}


@media (max-width: 768px) {
    .profile-header {
        gap: 24px;
        padding: 24px;
    }

    .profile-header .profile-info {
        min-width: 0;
    }

    .profile-avatar img {
        width: 128px;
        height: 128px;
    }

    .profile-section {
        padding: 20px 16px;
    }
    
    .profile-stats-quick {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px 24px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .achievements-header { flex-direction: column; }

    .achievements-modal { padding: 12px; }

    .achievements-dialog {
        max-height: calc(100dvh - 24px);
        padding: 16px;
    }

    .achievements-dialog-header { gap: 12px; }
    
    .role-stat-item {
        flex-wrap: wrap;
    }

    .game-history-header {
        display: none;
    }

    .game-history-row {
        grid-template-columns: 1fr;
        align-items: flex-start;
        gap: 10px;
    }

    .game-history-row > div {
        display: flex;
        flex-direction: row;
        gap: 10px;
    }

    .game-lobby {
        flex-direction: column;
        gap: 2px;
    }
}

@media (max-width: 560px) {
    .profile-header {
        flex-direction: column;
        text-align: center;
        padding: 24px 16px;
    }

    .profile-header .profile-info {
        width: 100%;
    }

    .profile-avatar img {
        width: 112px;
        height: 112px;
    }

    .profile-stats-quick {
        justify-content: center;
    }
}








.profile-username-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rename-btn {
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid rgba(139, 92, 246, 0.45);
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.rename-btn:hover {
    background: rgba(139, 92, 246, 0.22);
    border-color: rgba(139, 92, 246, 0.7);
}

.rename-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    max-width: 320px;
}

.rename-form[hidden] {
    display: none;
}

.rename-form input {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(15, 23, 42, 0.6);
    color: #f8fafc;
    font-size: 1rem;
    width: 100%;
}

.rename-form input:focus {
    outline: none;
    border-color: rgba(139, 92, 246, 0.7);
}

.rename-actions {
    display: flex;
    gap: 8px;
}

.rename-actions button {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    min-height: 40px;
}

.rename-save {
    background: linear-gradient(135deg, var(--accent-strong, #8b5cf6), #2563eb);
    color: #fff;
}

.rename-save:disabled {
    opacity: 0.6;
    cursor: default;
}

.rename-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}


.rename-form .field-hint {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.35;
    color: rgba(226, 232, 240, 0.6);
}

.rename-form .field-hint:empty {
    display: none;
}

.rename-form .field-hint.invalid {
    color: #fca5a5;
}
