.popup {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 999;
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

.popup-content {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    color: white;
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    max-width: 280px;
    min-height: 180px;
    max-height: 220px;
    border: 2px solid #e94560;
    position: relative;
    overflow: hidden;
    transform: translateY(-20px);
    animation: slideInFade 0.6s ease-out forwards;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.popup-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #e94560, #ff6b6b, #feca57, #48dbfb);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Slide In with Fade Animation */
@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade Out Animation */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Slide Out with Fade Animation */
@keyframes slideOutFade {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* Ubah animasi untuk arah dari atas */
@keyframes slideInTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideOutTop {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

.popup.hide {
    animation: fadeOut 0.5s ease-in forwards;
}

.popup.hide .popup-content {
    animation: slideOutFade 0.5s ease-in forwards;
}

/* Header styling */
.popup-header {
    text-align: center;
    margin-bottom: 8px;
    position: relative;
}

.popup-header h2 {
    font-family: 'Winky Rough', cursive;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, #ff6b6b, #feca57, #48dbfb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.jackpot-icon {
    width: 80px;
    height: 30px;
    margin-bottom: 6px;
    animation: bounce 2s infinite;
    object-fit: contain;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Body styling */
.popup-body {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.player-name {
    font-family: 'Winky Rough', cursive;
    font-size: 12px;
    color: #a8e6cf;
    margin: 0;
    font-weight: 500;
}

.win-amount {
    font-family: 'Winky Rough', cursive;
    font-size: 22px;
    font-weight: 800;
    color: #feca57;
    margin: 4px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
    to { text-shadow: 0 2px 20px rgba(254, 202, 87, 0.8); }
}

.game-name {
    font-family: 'Winky Rough', cursive;
    font-size: 11px;
    color: #ff6b6b;
    margin: 0;
    font-weight: 600;
}

.win-time {
    font-family: 'Winky Rough', cursive;
    font-size: 10px;
    color: #48dbfb;
    margin: 0;
    font-weight: 400;
    opacity: 0.9;
}

/* Tablet Responsive (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .popup {
        top: 15px;
        left: 15px;
        right: 15px;
    }
    
    .popup-content {
        max-width: 400px;
        min-height: 200px;
        max-height: 250px;
        padding: 20px;
        margin: 0 auto;
    }

    .popup-header h2 {
        font-size: 24px;
    }

    .jackpot-icon {
        width: 120px;
        height: 45px;
        margin-bottom: 8px;
    }

    .win-amount {
        font-size: 28px;
        margin: 6px 0;
    }

    .player-name {
        font-size: 14px;
    }

    .game-name {
        font-size: 13px;
    }

    .win-time {
        font-size: 12px;
    }
}

/* Mobile Responsive (320px - 767px) */
@media screen and (max-width: 767px) {
    .popup {
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        bottom: auto;
        width: 90%;
        max-width: 280px;
    }
    
    .popup-content {
        max-width: none;
        min-height: 160px;
        max-height: 200px;
        padding: 15px;
        margin: 0;
        border-radius: 12px;
    }

    .popup-header h2 {
        font-size: 18px;
    }

    .jackpot-icon {
        width: 100px;
        height: 38px;
        margin-bottom: 8px;
    }

    .win-amount {
        font-size: 20px;
        margin: 4px 0;
    }

    .player-name {
        font-size: 11px;
    }

    .game-name {
        font-size: 10px;
    }

    .win-time {
        font-size: 9px;
    }
}

/* Small Mobile Responsive (320px - 480px) */
@media screen and (max-width: 480px) {
    .popup {
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        bottom: auto;
        width: 85%;
        max-width: 260px;
    }
    
    .popup-content {
        min-height: 140px;
        max-height: 180px;
        padding: 12px;
        border-radius: 10px;
    }

    .popup-header h2 {
        font-size: 16px;
    }

    .jackpot-icon {
        width: 80px;
        height: 30px;
        margin-bottom: 6px;
    }

    .win-amount {
        font-size: 18px;
        margin: 3px 0;
    }

    .player-name {
        font-size: 10px;
    }

    .game-name {
        font-size: 9px;
    }

    .win-time {
        font-size: 8px;
    }
}

/* Landscape Mobile (height < 500px) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .popup {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        bottom: auto;
        width: 80%;
        max-width: 320px;
    }
    
    .popup-content {
        min-height: 120px;
        max-height: 150px;
        padding: 10px;
        max-width: none;
    }

    .jackpot-icon {
        width: 60px;
        height: 22px;
        margin-bottom: 4px;
    }

    .popup-header h2 {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .win-amount {
        font-size: 14px;
        margin: 2px 0;
    }

    .player-name, .game-name, .win-time {
        font-size: 8px;
    }
}

/* Large Desktop (1200px+) */
@media screen and (min-width: 1200px) {
    .popup-content {
        max-width: 450px;
        min-height: 220px;
        max-height: 280px;
        padding: 25px;
    }

    .popup-header h2 {
        font-size: 28px;
    }

    .jackpot-icon {
        width: 100px;
        height: 38px;
        margin-bottom: 15px;
    }

    .win-amount {
        font-size: 32px;
        margin: 8px 0;
    }

    .player-name {
        font-size: 16px;
    }

    .game-name {
        font-size: 14px;
    }

    .win-time {
        font-size: 12px;
    }
}