/* Preserved body styles from original */
body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('../photo/bg.jpg') no-repeat center center/cover;
    opacity: 0.5;
    z-index: -1;
}

/* Enhanced kids theme elements */
.container {
    max-width: 1000px;
    margin: 20px auto;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 20px rgba(109, 75, 158, 0.2);
    border: 3px solid #d9c2ff;
    position: relative;
    overflow: hidden;
}

.container::after {
    content: "";
    position: absolute;
    top: -10px;
    right: -10px;
    width: 50px;
    height: 50px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236d4b9e"><path d="M12 2L15.09 8.26L22 9.27L17 14.14L18.18 21.02L12 17.77L5.82 21.02L7 14.14L2 9.27L8.91 8.26L12 2Z"/></svg>') no-repeat;
    background-size: contain;
    opacity: 0.3;
}

h2 {
    color: #6d4b9e;
    text-align: center;
    font-size: 32px;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    display: inline-block;
    padding: 0 20px;
}

h2::before,
h2::after {
    content: "★";
    color: #ffd700;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

h2::before {
    left: -10px;
}

h2::after {
    right: -10px;
}

p {
    text-align: center;
    font-size: 18px;
    color: #555;
    margin-bottom: 25px;
    font-weight: 500;
}

/* Avatar grid styling - enhanced for kids */
.avatar-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 25px;
    padding: 20px;
}

.avatar-card {
    border: 4px solid #d9c2ff;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    background-color: white;
    position: relative;
    transform-style: preserve-3d;
}

.avatar-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(109, 75, 158, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.avatar-card:hover {
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 10px 25px rgba(109, 75, 158, 0.3);
    border-color: #6d4b9e;
}

.avatar-card:hover::before {
    opacity: 1;
}

.avatar-card.selected {
    border-color: #6d4b9e;
    background-color: #f3e9ff;
    box-shadow: 0 0 0 4px #b89be0, 0 8px 25px rgba(109, 75, 158, 0.4);
    transform: scale(1.05);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(109, 75, 158, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(109, 75, 158, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(109, 75, 158, 0);
    }
}

.avatar-img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    background-color: #f9f0ff;
    transition: transform 0.3s;
}

.avatar-card:hover .avatar-img {
    transform: scale(1.1);
}

.avatar-label {
    text-align: center;
    padding: 10px;
    background-color: #f3e9ff;
    color: #6d4b9e;
    font-weight: bold;
    font-size: 16px;
    border-top: 2px dashed #d9c2ff;
}

#confirmBtn {
    /* Base styles */
    background: #6d4b9e;
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    margin: 30px auto;
    display: block;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    position: relative;

    /* 3D effect */
    border-bottom: 6px solid #5a3d8a;
    border-right: 6px solid #5a3d8a;
    border-top: 2px solid #7d5bae;
    border-left: 2px solid #7d5bae;
    box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.2);
}

#confirmBtn:hover:not(:disabled) {
    /* Push down effect */
    transform: translate(2px, 2px);
    border-bottom-width: 4px;
    border-right-width: 4px;
    background: #634595;
}

#confirmBtn:active:not(:disabled) {
    /* Pressed effect */
    transform: translate(4px, 4px);
    border-bottom-width: 2px;
    border-right-width: 2px;
    box-shadow: inset 4px 4px 6px rgba(0, 0, 0, 0.3);
}

#confirmBtn:disabled {
    /* Disabled state */
    background: #cccccc;
    color: #999;
    border: 2px solid #aaa;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}y

/* Taken avatar styling - more visual */
.avatar-card.taken {
    position: relative;
    cursor: not-allowed;
    filter: grayscale(80%) brightness(0.9);
}

.taken-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 50, 50, 0.85);
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid white;
}

/* Loading and error states - more fun */
.avatar-container p {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 22px;
    color: #6d4b9e;
    font-weight: bold;
    padding: 20px;
    background-color: rgba(243, 233, 255, 0.7);
    border-radius: 15px;
    border: 2px dashed #d9c2ff;
}

.error {
    color: #ff4757;
    text-align: center;
    padding: 20px;
    font-size: 18px;
    background-color: #ffebee;
    border-radius: 15px;
    border: 3px solid #ffcdd2;
    position: relative;
}

.error::before {
    content: "!";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background-color: #ff4757;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Additional decorative elements */
.sticker {
    position: absolute;
    width: 60px;
    height: 60px;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.7;
    z-index: -1;
}

.sticker-1 {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%236d4b9e"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg>');
    top: 20px;
    left: 20px;
    transform: rotate(-15deg);
}

.sticker-2 {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23a37dd6"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></svg>');
    bottom: 30px;
    right: 30px;
    transform: rotate(10deg);
}