/* ============================================
   RAMADAN BONUS EXPERIENCE — PREMIUM CASINO UI
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, Arial, sans-serif;
    background: #0a0a12;
    color: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Background Layer --- */
#bg-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
}

#bg-image,
#bg-image-mobile {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    filter: blur(4px) brightness(0.7);
    transition: filter 1s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: filter;
    position: absolute;
    inset: 0;
}

/* Desktop: show desktop bg, hide mobile */
.bg-mobile {
    display: none;
}

@media (max-width: 768px) and (orientation: portrait) {
    .bg-desktop {
        display: none;
    }
    .bg-mobile {
        display: block;
    }
}

#bg-image.clear,
#bg-image-mobile.clear {
    filter: blur(0px) brightness(1);
}

#bg-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(10, 10, 18, 0.1) 0%, rgba(10, 10, 18, 0.35) 100%);
    pointer-events: none;
}

/* --- Particles --- */
#particles {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* --- Popup Overlay --- */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(5, 5, 15, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.popup-overlay.hidden {
    display: none;
}

/* --- Popup Card --- */
.popup-card {
    position: relative;
    background: linear-gradient(165deg, rgba(25, 25, 50, 0.92) 0%, rgba(15, 15, 35, 0.96) 100%);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 24px;
    padding: 40px 36px 36px;
    max-width: 520px;
    width: 90%;
    text-align: center;
    box-shadow:
        0 0 60px rgba(255, 215, 0, 0.08),
        0 25px 80px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
    will-change: transform, opacity;
}

.popup-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.6), transparent);
    border-radius: 2px;
}

/* --- Logo --- */
.popup-logo {
    margin-bottom: 16px;
}

.popup-logo img {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.3));
}

/* --- Title --- */
.popup-title {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f0e6d2;
    margin-bottom: 28px;
    text-shadow: 0 2px 20px rgba(255, 215, 0, 0.25);
    letter-spacing: 0.01em;
}

.popup-title span {
    display: block;
    margin-top: 6px;
    font-size: 1.15em;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
}

/* --- Chips Row --- */
.chips-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 30px;
}

.chip-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 0;
    overflow: visible;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.4s ease;
    border: none;
    background: transparent;
}

.chip-wrapper:hover {
    transform: translateY(-8px) scale(1.08);
    filter: drop-shadow(0 8px 25px rgba(255, 215, 0, 0.35));
}

.chip-glow {
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.chip-wrapper:hover .chip-glow {
    opacity: 1;
}

.chip-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.5));
}

/* --- Banknotes Row --- */
.banknotes-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin-bottom: 24px;
}

.banknote-wrapper {
    position: relative;
    width: 230px;
    height: 140px;
    flex-shrink: 0;
    overflow: visible;
    cursor: default;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.4s ease;
    background: transparent;
}

.banknote-wrapper:hover {
    transform: translateY(-5px) scale(1.05);
    filter: drop-shadow(0 6px 20px rgba(255, 215, 0, 0.3));
}

.banknote-glow {
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.12) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.banknote-wrapper:hover .banknote-glow {
    opacity: 1;
}

.banknote-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    border-radius: 6px;
}

/* --- Input Group --- */
.input-group {
    position: relative;
    margin-bottom: 22px;
}

#nickname-input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 14px;
    color: #fff;
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    outline: none;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

#nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
}

#nickname-input:focus {
    border-color: rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

.input-group.shake {
    animation: shakeInput 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.input-group.shake #nickname-input {
    border-color: #ff4444;
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.2);
}

@keyframes shakeInput {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(4px); }
    30%, 50%, 70% { transform: translateX(-6px); }
    40%, 60% { transform: translateX(6px); }
}

/* --- Buttons --- */
.btn-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 44px;
    background: linear-gradient(135deg, #FFD700 0%, #e6a800 50%, #FFD700 100%);
    background-size: 200% 200%;
    color: #1a1a2e;
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    box-shadow:
        0 4px 25px rgba(255, 215, 0, 0.3),
        0 0 0 1px rgba(255, 215, 0, 0.1);
}

.btn-primary:hover {
    background-position: 100% 100%;
    box-shadow:
        0 6px 35px rgba(255, 215, 0, 0.45),
        0 0 0 1px rgba(255, 215, 0, 0.3);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow:
        0 2px 15px rgba(255, 215, 0, 0.2);
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: skewX(-20deg);
    animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
    0%, 100% { left: -100%; }
    50% { left: 150%; }
}

/* --- Stage --- */
#stage {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 6vh;
    will-change: opacity;
}

#stage.hidden {
    display: none;
}

.stage-instruction {
    text-align: center;
    z-index: 12;
    position: absolute;
    top: 5vh;
    left: 50%;
    transform: translateX(-50%);
}

.stage-instruction p {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 14px 32px;
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    display: inline-block;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.05em;
    animation: pulseText 2.5s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

@keyframes pulseText {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; text-shadow: 0 0 40px rgba(255, 215, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.5); }
}

.stage-area {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 40px;
    z-index: 11;
    position: relative;
}

/* --- Drag Guide Arrow --- */
#drag-guide {
    width: 100px;
    height: 50px;
    align-self: center;
    opacity: 0.7;
    animation: guideFloat 2s ease-in-out infinite;
    pointer-events: none;
    flex-shrink: 0;
}

#drag-guide svg {
    width: 100%;
    height: 100%;
}

@keyframes guideFloat {
    0%, 100% { transform: translateX(0); opacity: 0.5; }
    50% { transform: translateX(10px); opacity: 0.9; }
}

/* --- Mallet --- */
#mallet-container {
    width: 180px;
    height: 260px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    cursor: grab;
    z-index: 20;
    position: relative;
}

#mallet-container:active {
    cursor: grabbing;
}

#mallet {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.5));
    transition: filter 0.3s ease;
    will-change: transform;
}

#mallet-container.dragging #mallet {
    filter: drop-shadow(0 20px 50px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 15px rgba(255, 215, 0, 0.2));
}

/* --- Drum --- */
#drum-container {
    width: 300px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 15;
}

#drum {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 40px rgba(0, 0, 0, 0.5));
    will-change: transform;
}

.drop-highlight {
    position: absolute;
    inset: -15px;
    border: 2px dashed rgba(255, 215, 0, 0.0);
    border-radius: 50%;
    transition: all 0.4s ease;
    pointer-events: none;
}

#drum-container.drag-over .drop-highlight {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.15);
    inset: -20px;
}

/* --- Video Overlay --- */
#video-overlay {
    z-index: 200;
    background: rgba(0, 0, 0, 0.92);
}

#bonus-video {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 0 80px rgba(255, 215, 0, 0.1), 0 30px 100px rgba(0, 0, 0, 0.8);
    outline: none;
    will-change: opacity;
}

/* --- Result Popup --- */
.result-card {
    max-width: 460px;
    padding: 44px 36px 36px;
}

.celebration-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.08) 0%, transparent 70%);
    animation: celebPulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes celebPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.9); opacity: 0.5; }
    50% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
}

.result-chip-wrapper {
    width: 180px;
    height: 180px;
    margin: 0 auto 24px;
    border-radius: 0;
    overflow: visible;
    border: none;
    background: transparent;
    animation: resultGlow 2s ease-in-out infinite alternate;
}

@keyframes resultGlow {
    0% { filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.15)); }
    100% { filter: drop-shadow(0 0 30px rgba(255, 215, 0, 0.35)); }
}

.result-chip-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 5px 20px rgba(0, 0, 0, 0.5));
}

.result-title {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #FFD700 0%, #FFAA00 50%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.result-sub {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 28px;
    line-height: 1.5;
    font-weight: 400;
}

.btn-ok {
    padding: 14px 60px;
}

/* --- Waiting / Countdown Popup --- */
.wait-card {
    max-width: 460px;
    padding: 44px 36px 36px;
}

.wait-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: waitPulse 2s ease-in-out infinite;
}

@keyframes waitPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

.wait-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 16px;
}

.wait-timer span {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 50%, #FFD700 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.02em;
}

.timer-sep {
    font-size: 2.4rem !important;
    opacity: 0.6;
    animation: sepBlink 1s step-end infinite;
}

@keyframes sepBlink {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.15; }
}

.wait-text {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 28px;
    line-height: 1.5;
    font-weight: 400;
}

.wait-note {
    background: rgba(255, 215, 0, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 12px;
    padding: 14px 20px;
}

.wait-note p {
    font-family: 'Google Sans', 'Google Sans Text', 'Segoe UI', Roboto, sans-serif;
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
    margin: 0;
}

.wait-note strong {
    color: #FFD700;
    font-weight: 700;
}


/* --- Responsive --- */
@media (max-width: 768px) {
    .popup-card {
        padding: 24px 18px 22px;
        border-radius: 20px;
        width: 92%;
        max-width: 95%;
    }

    .popup-title {
        font-size: 1.4rem;
    }

    .popup-logo img {
        width: 80px;
    }

    .chips-row {
        gap: 6px;
        margin-bottom: 20px;
    }

    .chip-wrapper {
        width: 95px;
        height: 95px;
    }

    .banknotes-row {
        gap: 4px;
        margin-bottom: 18px;
    }

    .banknote-wrapper {
        width: 190px;
        height: 115px;
    }

    .btn-primary {
        padding: 13px 28px;
        font-size: 0.95rem;
    }

    #stage {
        padding-bottom: 4vh;
    }

    /* Stage mobile layout: side by side, scaled down */
    .stage-area {
        flex-direction: row;
        gap: 15px;
    }

    #mallet-container {
        width: 120px;
        height: 180px;
    }

    #drum-container {
        width: 190px;
        height: 190px;
    }

    .stage-instruction {
        position: relative;
        top: auto;
        left: auto;
        transform: none;
        margin-bottom: 20px;
    }

    .stage-instruction p {
        font-size: 1.1rem;
        padding: 10px 22px;
    }

    #drag-guide {
        width: 60px;
        height: 30px;
    }

    #bonus-video {
        width: 96%;
        border-radius: 12px;
    }

    .result-card {
        padding: 28px 20px 24px;
    }

    .result-title {
        font-size: 1.15rem;
    }

    .result-chip-wrapper {
        width: 130px;
        height: 130px;
    }

    .btn-ok {
        padding: 12px 40px;
        font-size: 0.9rem;
    }
}

@media (max-width: 400px) {
    .popup-title {
        font-size: 1.2rem;
    }

    .chip-wrapper {
        width: 80px;
        height: 80px;
    }

    .banknote-wrapper {
        width: 160px;
        height: 100px;
    }

    #nickname-input {
        padding: 12px 14px;
        font-size: 0.88rem;
    }

    .btn-primary {
        padding: 12px 22px;
        font-size: 0.85rem;
    }

    #mallet-container {
        width: 100px;
        height: 150px;
    }

    #drum-container {
        width: 155px;
        height: 155px;
    }

    .stage-instruction p {
        font-size: 0.95rem;
        padding: 8px 16px;
    }

    .result-chip-wrapper {
        width: 110px;
        height: 110px;
    }
}

/* --- Utility --- */
.hidden {
    display: none !important;
}