:root {
    --primary-gold: linear-gradient(135deg, #d4af37 0%, #f9d423 50%, #d4af37 100%);
    --bg-dark: #0a0a0a;
    --bg-card: #1a1a1a;
    --text-gold: #f9d423;
    --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.3);
    --transition-smooth: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    color: white;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

.app-container {
    max-width: 1000px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

@media (max-width: 480px) {
    .app-container {
        gap: 20px;
    }
}

header {
    text-align: center;
    animation: fadeInDown 1s ease-out;
}

.main-header {
    text-align: center;
    width: 100%;
    margin-bottom: 30px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.mute-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05); /* Glassmorph Luxury */
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 6px 15px;
    border-radius: 4px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    backdrop-filter: blur(5px);
}

.mute-badge:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--text-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
}

#muteText {
    color: var(--text-gold);
    letter-spacing: 1px;
}

.logo {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 12px;
    background: var(--primary-gold);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.5));
    margin-bottom: 8px;
    text-transform: uppercase;
}

.subtitle {
    color: #888;
    font-size: 1.1rem;
    font-weight: 300;
}

/* Redesigned Prize Trigger */
.prize-trigger-wrapper {
    margin-top: 25px;
    animation: fadeIn 1s 0.5s forwards;
    opacity: 0;
}

.modern-trigger-btn {
    background: #111;
    border: 2px solid #d4af37;
    padding: 12px 35px;
    border-radius: 12px;
    color: #d4af37;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.modern-trigger-btn:hover {
    background: #d4af37;
    color: #111;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.3);
}

.modern-trigger-btn .crown {
    font-size: 1.3rem;
}

/* Wall of Fame Modal - Deep Maroon & Gold */
.fame-container {
    width: 90%;
    max-width: 450px;
    background: #1c0a0a; /* Deep Maroon */
    border: 3px solid #b8860b; /* Golden Border */
    border-radius: 45px;
    padding: 40px 25px;
    box-shadow: 0 40px 100px rgba(0,0,0,0.9);
    animation: popupImpact 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.fame-header { margin-bottom: 30px; }
.fame-crown { font-size: 3rem; display: block; margin-bottom: 10px; }

.fame-title {
    font-size: 2.22rem;
    font-weight: 900;
    color: #d4af37;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin: 0;
}

.fame-subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-top: 5px;
}

.fame-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 35px;
}

.fame-item {
    background: #2b1010; /* Darker Inner Card */
    border-radius: 20px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid rgba(184, 134, 11, 0.1);
    transition: 0.3s;
}

.fame-item:hover {
    transform: scale(1.02);
    border-color: rgba(184, 134, 11, 0.5);
    background: #3d1616;
}

.fame-rank {
    color: #d4af37;
    font-weight: 800;
    font-size: 1.2rem;
    width: 40px;
}

.fame-info {
    flex: 1;
    text-align: left;
    padding-left: 15px;
}

.fame-label {
    color: #eee;
    font-weight: 700;
    font-size: 1.1rem;
    display: block;
}

.fame-status {
    color: #b8860b;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.fame-prize-val {
    color: #fff;
    font-weight: 800;
}

.fame-close-btn {
    width: 100%;
    background: #dfe6e9; /* Light Greyish Button */
    border: none;
    padding: 18px;
    border-radius: 15px;
    font-weight: 800;
    color: #2b1010;
    cursor: pointer;
    text-transform: uppercase;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: 0.3s;
}

.fame-close-btn:hover {
    background: #fff;
    transform: scale(1.02);
}

/* Premium Livechat Buttons */
.fame-livechat-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 18px;
    border-radius: 15px;
    font-weight: 800;
    text-decoration: none;
    text-transform: uppercase;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    transition: all 0.3s ease;
    border: none;
    font-size: 0.9rem;
    letter-spacing: 1px;
}

.fame-livechat-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.5);
    filter: brightness(1.1);
}

.livechat-win-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71) !important;
    color: white !important;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

/* Admin Overlay Backdrop */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(15px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* VIP Entry Zone Styling */
.vip-entry-container {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 500px;
    text-align: center;
    transition: var(--transition-smooth);
    animation: zoomIn 0.8s ease-out;
}

.vip-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.vip-input-wrapper.double {
    flex-direction: column;
    gap: 12px;
}

.vip-input-wrapper input {
    flex: 1;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(212, 175, 55, 0.4);
    padding: 15px;
    border-radius: 8px;
    color: var(--text-gold);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    text-align: center;
    transition: all 0.3s ease;
}

.vip-input-wrapper input:focus {
    border-color: var(--text-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.2);
    outline: none;
    background: rgba(0, 0, 0, 0.8);
}

.premium-btn.full-width {
    width: 100%;
}

#vipCode {
    flex: 1;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
    border-radius: 50px;
    padding: 15px 25px;
    color: var(--text-gold);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    letter-spacing: 2px;
    outline: none;
    transition: all 0.3s ease;
}

#vipCode:focus {
    border-color: #f9d423;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

.vip-feedback {
    font-size: 0.9rem;
    height: 20px;
    color: #f9d423;
    font-weight: 600;
}

/* Header & UI */
.mute-btn { display: none; } /* cleanup */

@media (max-width: 480px) {
    .vip-entry-container {
        padding: 20px 15px;
    }
    .vip-input-wrapper {
        flex-direction: column;
    }
    #vipSubmit {
        width: 100%;
    }
    #vipCode {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.8rem;
        letter-spacing: 4px;
        margin-bottom: 4px;
    }
    .subtitle {
        font-size: 0.9rem;
    }
}

/* Card Grid */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    width: 100%;
    perspective: 1000px;
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        max-width: 320px; /* Slimmer container */
        margin: 0 auto;
    }
    .card {
        height: 150px; /* Perfect 2x3 slim mobile fit */
    }
}

@media (max-width: 380px) {
    .card-grid {
        gap: 10px;
    }
    .card {
        height: 140px;
    }
}

/* Card Component */
.card {
    height: 280px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out; /* Sharper following for tilt */
    animation: levitate 4s ease-in-out infinite;
}

/* Offset animation for variety */
.card:nth-child(even) { animation-delay: 1s; }
.card:nth-child(3n) { animation-delay: 2s; }

.card:hover {
    transform: scale(1.1) rotateX(10deg) rotateY(10deg);
    z-index: 10;
    animation-play-state: paused;
}

.card:hover .card-inner {
    box-shadow: 0 20px 45px rgba(212, 175, 55, 0.5);
    border-color: #fff;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card.loading .card-inner {
    animation: vibrate 0.2s linear infinite;
    box-shadow: 0 0 50px rgba(212, 175, 55, 0.6);
}

/* New Cinematic Classes */
.card.spinning-out {
    /* Extreme tension: spin longer and vanish late */
    animation: spinAway 4s forwards cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.card-front, .card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid #333;
    overflow: hidden;
}

/* Card Front (Initially Visible - The Back of the card) */
.card-front {
    background: #111;
    background-image: url('assets/card_back.png');
    background-size: cover;
    background-position: center;
    border: 2px solid #d4af37;
    position: relative;
}

.card-front::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(0,0,0,0.3) 100%);
    pointer-events: none;
}

.card-front::after {
    display: none;
}

.flipped .card-inner {
    transform: rotateY(180deg) translateZ(1px); /* Stabilized 3D Flip */
}

/* Card Front (Actual Result) */
.card-back {
    background: #1a1a1a;
    transform: rotateY(180deg);
    flex-direction: column;
    gap: 15px;
    border: 2px solid var(--text-gold);
}

.card-back .val {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-gold);
}

.card-back .icon {
    font-size: 3.5rem;
}

/* Status Box */
.status-box {
    font-size: 1.2rem;
    color: #888;
}

/* Buttons */
.premium-btn {
    background: var(--primary-gold);
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    transition: var(--transition-smooth);
    color: #111;
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.3);
}

.premium-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.5);
}

.hidden { display: none !important; }

/* Overlay Result - Improved 3D & Glassmorphism */
.result-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.95) 100%);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(15px);
    perspective: 2000px;
}

.result-content {
    background: rgba(26, 26, 26, 0.8);
    border: 2px solid rgba(212, 175, 55, 0.5);
    padding: 60px;
    border-radius: 40px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    transform-style: preserve-3d;
    transform: rotateX(10deg);
    box-shadow: 
        0 30px 60px rgba(0,0,0,0.8),
        inset 0 0 40px rgba(212, 175, 55, 0.1);
    animation: popupImpact 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: visible;
}

@media (max-width: 480px) {
    .result-content {
        padding: 30px 15px;
        border-radius: 30px;
    }
}

@media (max-width: 400px) {
    .result-content {
        width: 95%;
        padding: 25px 10px;
    }
}

/* Glowing Aura restored and improved */
.result-content::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.4) 0%, rgba(212, 175, 55, 0.1) 40%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: pulseAura 4s ease-in-out infinite;
    z-index: -1;
    filter: blur(20px);
}

.result-content::after {
    content: "";
    position: absolute;
    top: -20%;
    left: -20%;
    width: 140%;
    height: 140%;
    border-radius: 50%;
    background-image: radial-gradient(circle, #f9d423 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.3;
    animation: rotateAura 20s linear infinite;
    pointer-events: none;
    z-index: -1;
}

@keyframes pulseAura {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.8; }
}

@keyframes rotateAura {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.result-value {
    font-size: 4.5rem;
    font-weight: 800;
    margin: 25px 0;
    color: var(--text-gold);
    text-shadow: 
        0 5px 15px rgba(0,0,0,0.5),
        0 0 30px rgba(212, 175, 55, 0.4);
    transform: translateZ(50px); /* 3D Depth */
    animation: prizeFloat 3s ease-in-out infinite;
}

@media (max-width: 480px) {
    .result-value {
        font-size: 2.2rem; /* Scaled down for mobile */
    }
    #resultTitle {
        font-size: 1.4rem;
        letter-spacing: 4px;
    }
    .result-content {
        padding: 30px 15px;
    }
}

#resultTitle {
    letter-spacing: 10px;
    transform: translateZ(30px);
}

/* Animations */
@keyframes vibrate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-2deg); }
    100% { transform: rotate(0deg); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes levitate {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-15px) rotate(1deg); }
}

/* Floating Particles (Bg) */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bg-dot {
    position: absolute;
    background: radial-gradient(circle, rgba(212,175,55,0.4) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(2px);
    animation: floatParticle 10s infinite linear;
}

@keyframes floatParticle {
    from { transform: translateY(110vh); }
    to { transform: translateY(-10vh); }
}

@keyframes spinAway {
    0% { transform: rotate(0) scale(1.1); opacity: 1; }
    70% { transform: rotate(720deg) scale(1.05); opacity: 0.9; } /* Spin in place longer */
    100% { transform: rotate(1080deg) scale(0); opacity: 0; } /* Final quick vanish */
}

@keyframes rotateRays {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes popupImpact {
    0% { transform: scale(0.5) rotateX(30deg); opacity: 0; }
    70% { transform: scale(1.05) rotateX(-5deg); }
    100% { transform: scale(1) rotateX(10deg); opacity: 1; }
}

@keyframes prizeFloat {
    0%, 100% { transform: translateZ(50px) translateY(0); }
    50% { transform: translateZ(70px) translateY(-10px); }
}

.screen-shake {
    animation: screenShake 0.4s ease-in-out;
}

@keyframes screenShake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-5px, 5px); }
    50% { transform: translate(5px, -5px); }
    75% { transform: translate(-5px, -5px); }
}
