/* =====================================================================
   GIAO DIỆN LỄ VINH DANH - GLASSMORPHISM (KÍNH MỜ)
   Cấu hình: Chỉ hiển thị Top 1 và Top 2.
   Tự động xử lý trường hợp đồng hạng (nhiều người chung 1 thẻ).
   ===================================================================== */

/* 1. HIỆU ỨNG NỀN ORB PHÁT SÁNG */
.glowing-orbs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.orb-1 { width: 40vw; height: 40vw; background: #3b82f6; top: -10%; left: -10%; }
.orb-2 { width: 30vw; height: 30vw; background: #ec4899; bottom: -10%; right: -10%; }
.orb-3 { width: 25vw; height: 25vw; background: #8b5cf6; top: 40%; left: 40%; opacity: 0.3; }

/* 2. KHUNG CHỨA SÂN KHẤU */
.ceremony-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(20px, 5vw, 50px);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    padding: 0 20px;
    height: 60vh;
    max-height: 500px;
}

/* 3. THẺ KÍNH MỜ (GLASS CARD) */
.glass-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: clamp(20px, 4vw, 40px) clamp(10px, 2vw, 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    opacity: 0;
    transform: translateY(40px) rotateX(10deg);
    transition: all 0.8s cubic-bezier(.2,.8,.2,1);
    position: relative;
    overflow-y: auto; /* Cho phép cuộn nếu có quá nhiều người đồng hạng */
    max-height: 100%;
    width: 100%;
    scrollbar-width: none; /* Ẩn thanh cuộn trên Firefox */
}

.glass-card::-webkit-scrollbar { display: none; } /* Ẩn thanh cuộn trên Chrome/Safari */

.glass-card.appear {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

/* Phân cấp kích thước Thẻ (Top 2 nhỏ hơn, Top 1 to hơn) */
.glass-card.rank-2 {
    max-width: 240px;
    opacity: 0.85;
    margin-top: 40px;
}

.glass-card.rank-1 {
    max-width: 400px;
    z-index: 3;
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
    border-color: rgba(255,255,255,0.25);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.4);
}

/* 4. CHỨA DANH SÁCH NGƯỜI ĐOẠT GIẢI */
.person-container {
    display: flex;
    flex-wrap: wrap; /* Tự động rớt dòng nếu có 3-4 người */
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
}

/* Nếu chỉ có 1 người thì căn giữa dọc */
.person-container.single {
    flex-direction: column;
    align-items: center;
}

.person-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 120px;
}

/* 5. AVATAR, TÊN, ĐIỂM SỐ */
.g-avatar {
    width: clamp(60px, 8vw, 90px);
    height: clamp(60px, 8vw, 90px);
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 900;
    margin-bottom: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.3);
    overflow: hidden;
    color: #fff;
}

.g-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Avatar Top 1 to hơn */
.glass-card.rank-1 .g-avatar {
    width: clamp(70px, 10vw, 110px);
    height: clamp(70px, 10vw, 110px);
}

.g-name {
    font-weight: 700;
    font-size: clamp(13px, 1.6vw, 16px);
    text-align: center;
    line-height: 1.3;
    margin-bottom: 6px;
    color: #fff;
    word-break: break-word;
}

.g-score {
    font-size: clamp(20px, 2.5vw, 28px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(255,255,255,0.3);
}

.g-score span {
    font-size: 0.5em;
    color: rgba(255,255,255,0.6);
    margin-left: 2px;
}

/* 6. HUY HIỆU (TIỀN THƯỞNG / TOP 2) */
.g-badge {
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 20px;
    margin-top: 10px;
    white-space: nowrap;
}

.g-badge.gold {
    background: linear-gradient(to right, #fbbf24, #d97706);
    color: #000;
    box-shadow: 0 0 15px rgba(251,191,36,0.4);
}

.g-badge.silver {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 7. XỬ LÝ ĐỒNG HẠNG (3 NGƯỜI TRỞ LÊN) */
/* Nếu thẻ có từ 3 person-item, tự động thu nhỏ avatar và chữ lại cho vừa */
.person-container:has(.person-item:nth-child(3)) .g-avatar {
    width: 50px;
    height: 50px;
    font-size: 18px;
}

.person-container:has(.person-item:nth-child(3)) .g-name {
    font-size: 11px;
}

.person-container:has(.person-item:nth-child(3)) .g-score {
    font-size: 16px;
}

/* 8. RESPONSIVE (MOBILE) */
@media (max-width: 640px) {
    .ceremony-stage {
        gap: 10px;
    }
    
    .glass-card {
        padding: 15px 10px;
        border-radius: 16px;
    }
    
    .glass-card.rank-2 {
        max-width: 35%;
    }
    
    .glass-card.rank-1 {
        max-width: 45%;
    }
    
    .person-item {
        min-width: 80px;
    }
}