/**
 * 头像选择系统样式
 */

/* ===== 主界面玩家头像样式 ===== */
.player-avatar {
    font-size: 60px;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E0B4E8 0%, #D8BBDF 100%);  /* 粉紫色渐变 */
    border-radius: 50%;  /* 圆形 */
    box-shadow: 0 4px 12px rgba(224, 180, 232, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    position: relative;
    border: 3px solid #F0EEF2;  /* 细边框 */
}

.player-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(224, 180, 232, 0.5);
    border-color: #E0B4E8;
}

.player-avatar:active {
    transform: scale(0.98);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.player-avatar span {
    font-size: 60px;
}

/* ===== 头像选择弹窗 ===== */
.avatar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(90, 73, 99, 0.4);  /* 深紫灰半透明 */
    backdrop-filter: blur(8px);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.avatar-modal-content {
    background: #FFFFFF;  /* 纯白背景 */
    border-radius: 28px;  /* 大圆角 */
    padding: 40px;
    max-width: 650px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #F0EEF2;  /* 细边框 */
    box-shadow: 0 20px 40px rgba(224, 180, 232, 0.3);  /* 粉紫色阴影 */
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);  /* 弹性动画 */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== 头像弹窗头部 ===== */
.avatar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid #F0EEF2;  /* 分割线 */
}

.avatar-modal-header h2 {
    color: #5A4963;  /* 深紫灰 */
    font-size: 26px;
    margin: 0;
    font-weight: 700;
}

.avatar-modal-close {
    background: #F2E0F5;  /* 淡粉紫色 */
    border: 2px solid #E0B4E8;  /* 粉紫色边框 */
    border-radius: 16px;  /* 圆角方形 */
    width: 44px;
    height: 44px;
    font-size: 24px;
    color: #5A4963;  /* 深紫灰 */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    font-weight: bold;
}

.avatar-modal-close:hover {
    background: #E0B4E8;  /* 悬停时变深 */
    border-color: #C896D4;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 12px rgba(224, 180, 232, 0.4);
}

/* ===== 头像网格 ===== */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 24px;
}

.avatar-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 24px;  /* 大圆角，不再是圆形 */
    overflow: hidden;
    cursor: pointer;
    border: 3px solid #F0EEF2;  /* 细边框 */
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #E0B4E8 0%, #D8BBDF 100%);  /* 粉紫色渐变 */
    box-shadow: 0 4px 8px rgba(224, 180, 232, 0.2);
}

.avatar-item:hover {
    transform: translateY(-4px) scale(1.05);
    border-color: #E0B4E8;
    box-shadow: 0 8px 16px rgba(224, 180, 232, 0.4);
}

.avatar-item.selected {
    border-color: #B8E6D5;  /* 薄荷绿边框 */
    border-width: 4px;
    box-shadow: 0 0 0 4px rgba(184, 230, 213, 0.3),
                0 8px 20px rgba(184, 230, 213, 0.5);  /* 双层阴影 */
}

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

.avatar-item-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #B8E6D5 0%, #A3F4E1 100%);  /* 薄荷绿渐变 */
    border-radius: 12px;  /* 圆角方形 */
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #2c4a45;  /* 深绿色 */
    box-shadow: 0 4px 12px rgba(184, 230, 213, 0.6);
    border: 2px solid #9FD9C8;
}

.avatar-item.selected .avatar-item-check {
    display: flex;
    animation: checkBounce 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes checkBounce {
    0% {
        transform: scale(0) rotate(-45deg);
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .avatar-modal-content {
        padding: 28px;
        width: 95%;
        border-radius: 24px;
    }

    .avatar-modal-header {
        margin-bottom: 24px;
        padding-bottom: 16px;
    }

    .avatar-modal-header h2 {
        font-size: 22px;
    }

    .avatar-modal-close {
        width: 40px;
        height: 40px;
        font-size: 20px;
        border-radius: 14px;
    }

    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 16px;
    }

    .avatar-item {
        border-radius: 20px;
    }

    .player-avatar {
        width: 100px;
        height: 100px;
        font-size: 50px;
    }

    .player-avatar span {
        font-size: 50px;
    }
}

@media (max-width: 480px) {
    .avatar-modal-content {
        padding: 20px;
        border-radius: 20px;
    }

    .avatar-modal-header {
        margin-bottom: 20px;
        padding-bottom: 12px;
    }

    .avatar-modal-header h2 {
        font-size: 20px;
    }

    .avatar-modal-close {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 12px;
    }

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

    .avatar-item {
        border-radius: 16px;
        border-width: 2px;
    }

    .avatar-item.selected {
        border-width: 3px;
    }

    .avatar-item-check {
        width: 28px;
        height: 28px;
        font-size: 14px;
        border-radius: 10px;
    }

    .player-avatar {
        width: 80px;
        height: 80px;
        font-size: 40px;
    }

    .player-avatar span {
        font-size: 40px;
    }
}
