/* Профиль — тёмная тема, референс */

.profile-page {
    padding-bottom: 116px;
}

.profile-content {
    padding-top: 100px;
}

.tg-webview .profile-content {
    padding-top: 100px;
}

/* ----- Верхний блок: аватар слева, ник справа ----- */
.profile-header-block {
    margin-bottom: 32px;
}

.profile-top-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.profile-avatar-wrap {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-card);
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-img:not([src]),
.profile-avatar-img[src=""] {
    display: none;
}

.profile-avatar-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: 600;
}

.profile-avatar-wrap:has(.profile-avatar-img[src]:not([src=""])) .profile-avatar-fallback {
    display: none;
}

.profile-nick-row {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.profile-nick-view {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-nick-pill {
    display: inline-block;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-nick-edit-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
}

.profile-nick-edit-btn svg {
    width: 18px;
    height: 18px;
}

.profile-nick-edit-btn:active {
    opacity: 0.8;
}

/* Режим редактирования: input + X + check */
.profile-nick-edit {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.profile-nick-input {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: 'Manrope', sans-serif;
}

.profile-nick-input::placeholder {
    color: var(--text-secondary);
}

.profile-nick-cancel-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #8B1538;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}

.profile-nick-cancel-btn svg {
    width: 18px;
    height: 18px;
}

.profile-nick-save-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2e7d32;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}

.profile-nick-save-btn svg {
    width: 18px;
    height: 18px;
}

.profile-nick-cancel-btn:active,
.profile-nick-save-btn:active {
    opacity: 0.9;
}

.profile-moderation-msg {
    color: #F9A825;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
}

/* ----- История игр ----- */
.profile-history-section {
    margin-top: 24px;
}

.profile-section-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.profile-history-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.profile-tab {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
}

.profile-tab.active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.profile-tab:active {
    opacity: 0.9;
}

.profile-history-list {
    min-height: 60px;
}

.profile-history-empty {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

.profile-history-card {
    display: block;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius);
    margin-bottom: 10px;
    color: var(--text-primary);
    text-decoration: none;
}

.profile-history-card:active {
    opacity: 0.9;
}

.profile-history-card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.profile-history-card-meta {
    font-size: 13px;
    color: var(--text-secondary);
}
