:root {
    --primary-red: #dc143c;
    --dark-red: #8b0000;
    --deep-maroon: #4a0000;
    --gold: #ffd700;
    --gold-bright: #fff3a0;
    --white: #ffffff;
    --black: #0a0a0a;
    --glass: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: #000 url('red-bg.png') no-repeat center center fixed;
    background-size: cover;
    color: var(--white);
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(139, 0, 0, 0.3) 0%, rgba(10, 10, 10, 0.8) 100%);
    z-index: -1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.hidden { display: none !important; }

/* LOADING SCREEN (New Cool Style) */
#loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--black);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loader-content {
    text-align: center;
    width: 100%;
    max-width: 300px;
}

.loader-wheel {
    font-size: 4rem;
    color: var(--primary-red);
    margin-bottom: 20px;
    animation: rotate 1.5s infinite linear;
    filter: drop-shadow(0 0 15px var(--primary-red));
}

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

.wheel-container {
    position: relative;
    width: 480px;
    height: 480px;
    max-width: 95vw;
    max-height: 95vw;
    margin: 0 auto;
    filter: drop-shadow(0 0 30px rgba(220, 20, 60, 0.4));
}

#wheel-canvas-container {
    width: 100%;
    height: 100%;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.loader-logo img {
    width: 200px;
    margin-bottom: 30px;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.loader-bar-wrapper {
    position: relative;
    width: 100%;
    height: 10px;
    background: #222;
    border-radius: 10px;
    overflow: visible;
    margin-bottom: 15px;
    border: 1px solid #333;
}

.loader-bar-glow {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--dark-red), var(--primary-red));
    border-radius: 10px;
    box-shadow: 0 0 20px var(--primary-red);
    transition: width 0.1s linear;
}

.loader-progress-text {
    position: absolute;
    top: -30px;
    right: 0;
    font-weight: 800;
    color: var(--gold);
    font-size: 1.2rem;
    text-shadow: 0 0 10px gold;
}

.loader-msg {
    color: #888;
    font-size: 0.9rem;
    letter-spacing: 1px;
    font-weight: 600;
}

/* LOGO STYLES */
.logo img { width: 180px; transition: var(--transition); }
.welcome-logo-main img { width: 220px; margin-bottom: 10px; }
.mini-logo-side img { width: 150px; margin-bottom: 15px; }
.win-logo-mini img { width: 140px; margin: 10px auto; display: block; }

/* WELCOME MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 15px;
}

.modal-overlay.active { display: flex; }

.welcome-box {
    background: var(--dark-red);
    width: 100%;
    max-width: 550px;
    border-radius: 20px;
    padding: 30px;
    position: relative;
    box-shadow: 0 0 40px rgba(139, 0, 0, 0.6);
    text-align: center;
    border: 2px solid var(--glass-border);
}

.logo-tag { font-weight: 800; line-height: 1.1; font-size: 1.5rem; margin-bottom: 15px; }
.logo-tag span { font-size: 0.9rem; color: var(--gold); }

.welcome-header h2 { font-size: 1.3rem; margin-bottom: 20px; letter-spacing: 1px; }

.welcome-body h3 { background: rgba(0, 0, 0, 0.3); padding: 8px; border-radius: 8px; margin-bottom: 15px; font-size: 1rem; }

.terms-content {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
    text-align: left;
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid var(--glass-border);
}

.terms-content li { font-size: 0.85rem; margin-bottom: 8px; padding-left: 20px; color: #f0f0f0; position: relative; list-style: none; }
.terms-content li::before { content: '•'; color: var(--gold); position: absolute; left: 0; font-weight: bold; }

.btn-mulai {
    margin-top: 25px;
    background: var(--gold);
    color: #000;
    border: none;
    padding: 12px 40px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    transition: var(--transition);
}

.btn-mulai:hover { transform: scale(1.05); }

/* MAIN INTERFACE */
#main-header { padding: 15px 0; position: absolute; width: 100%; top: 40px; z-index: 100; }
.nav-wrapper { display: flex; justify-content: space-between; align-items: center; }

.btn-livechat {
    background: var(--primary-red);
    color: white;
    padding: 8px 15px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 0 10px rgba(220, 20, 60, 0.3);
}

#spin-interface { min-height: 100vh; display: flex; align-items: center; padding: 60px 0; }
.game-row { display: flex; justify-content: center; align-items: center; gap: 60px; width: 100%; }

/* WHEEL STYLES */
.wheel-wrapper { position: relative; display: flex; justify-content: center; }
.wheel-decor-top, .wheel-decor-bottom { position: absolute; width: 120%; left: -10%; display: flex; justify-content: space-between; z-index: 10; pointer-events: none; }
.wheel-decor-top { top: -30px; }
.wheel-decor-bottom { bottom: -30px; }
.wheel-decor-top img, .wheel-decor-bottom img { width: 70px; filter: drop-shadow(0 0 10px gold); }

.wheel-outer-ring {
    width: 480px;
    height: 480px;
    max-width: 90vw;
    max-height: 90vw;
    background: #111;
    border-radius: 50%;
    border: 8px solid #222;
    box-shadow: 0 0 80px rgba(139, 0, 0, 0.6), inset 0 0 30px rgba(0,0,0,0.8);
    position: relative;
    padding: 12px;
}

#wheel-canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#wheel-canvas {
    width: 100%;
    height: 100%;
}

.wheel-pointer-new {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-top: 40px solid var(--gold);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
}

.wheel-pointer-new::after { content: ''; position: absolute; top: -45px; left: -10px; width: 20px; height: 20px; background: var(--gold); border-radius: 50%; box-shadow: 0 0 15px gold; }

.wheel-leds { 
    position: absolute; 
    top: 0; left: 0; 
    width: 100%; height: 100%; 
    border-radius: 50%; 
    pointer-events: none; 
    z-index: 5; 
}

.led { 
    position: absolute; 
    width: 10px; height: 10px; 
    background: #fff; 
    border-radius: 50%; 
    box-shadow: 0 0 15px #fff; 
    animation: blinkLED 0.8s infinite alternate; 
    transform: translate(-50%, -50%);
}

@keyframes blinkLED { 
    0% { background: #fff; box-shadow: 0 0 5px #fff; transform: translate(-50%, -50%) scale(0.8); } 
    100% { background: var(--gold); box-shadow: 0 0 20px var(--gold); transform: translate(-50%, -50%) scale(1.2); } 
}

#wheel-canvas-container { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; transform: rotate(0deg); }
#wheel-canvas { width: 100%; height: 100%; }

/* INFO COLUMN */
.info-column { width: 100%; max-width: 420px; }
.branding-area { text-align: center; margin-bottom: 25px; }
.promo-title { font-size: 1.8rem; font-weight: 800; line-height: 1.1; margin-top: 5px; }
.promo-title span { color: var(--gold); }

.voucher-form-box {
    background: var(--glass);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    background: white;
    border: none;
    padding: 12px 15px;
    border-radius: 6px;
    color: #333;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.form-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn-action {
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-spin-main { background: var(--primary-red); color: white; }
.btn-history { background: transparent; color: white; border: 1px solid var(--primary-red); }
.btn-livechat-full { display: flex; justify-content: center; align-items: center; gap: 8px; background: transparent; border: 1px solid var(--primary-red); color: white; text-decoration: none; padding: 10px; border-radius: 6px; margin-top: 12px; font-weight: 700; font-size: 0.9rem; }

/* WINNERS AREA ANIMATED */
.live-winners-area { background: rgba(0, 0, 0, 0.5); padding: 15px; border-radius: 12px; border: 1px solid var(--glass-border); overflow: hidden; height: 260px; position: relative; }
.winners-header { font-weight: 700; color: var(--gold); margin-bottom: 15px; font-size: 0.9rem; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid rgba(255, 215, 0, 0.2); padding-bottom: 8px; position: relative; z-index: 2; background: rgba(20, 0, 0, 0.8); }

#winner-list { display: flex; flex-direction: column; gap: 0; position: relative; }
.winner-item-mini { 
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); 
    font-size: 0.85rem; height: 45px;
    animation: slideUp 0.5s ease-out forwards;
}
.winner-user { font-weight: 600; color: #fff; }
.winner-prize { color: var(--gold); font-weight: 700; text-shadow: 0 0 5px rgba(255, 215, 0, 0.3); }

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.table-mini-wrapper { max-height: 150px; overflow-y: auto; }
#prize-list-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
#prize-list-table th { text-align: left; color: #888; font-weight: 400; padding-bottom: 5px; }
#prize-list-table td { padding: 6px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }
#prize-list-table td:last-child { text-align: right; color: var(--gold); font-weight: 700; }

/* MODAL SYSTEM (Baja Optimized) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-overlay.active { display: flex; }

.modal-popup {
    background: linear-gradient(135deg, #222, #111);
    width: 90%;
    max-width: 450px;
    padding: 30px 20px;
    border-radius: 20px;
    border: 2px solid var(--primary-red);
    box-shadow: 0 0 50px rgba(220, 20, 60, 0.5);
    text-align: center;
    position: relative;
}

.win-trophy { font-size: 4rem; color: var(--gold); margin-bottom: 15px; filter: drop-shadow(0 0 15px var(--gold)); }
.win-logo-mini img { width: 140px; margin-bottom: 15px; }

.history-popup { max-width: 550px; padding: 30px; position: relative; }
.close-history { position: absolute; top: 15px; right: 15px; font-size: 1.8rem; cursor: pointer; color: #fff; }
.history-table-wrapper { margin-top: 20px; max-height: 350px; overflow-y: auto; }
#history-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; }
#history-table th, #history-table td { padding: 12px; border-bottom: 1px solid var(--glass-border); }
#history-table th { background: var(--primary-red); color: white; }

/* TOAST */
.toast { position: fixed; top: 15px; left: 50%; transform: translateX(-50%) translateY(-100px); background: #f44336; color: white; padding: 10px 25px; border-radius: 50px; font-weight: 700; z-index: 5000; transition: transform 0.3s ease; font-size: 0.9rem; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* COIN FALLING ANIMATION (Premium Style) */
.coin-particle { 
    position: fixed; 
    top: -50px; 
    z-index: 1; 
    pointer-events: none; 
    width: 25px;
    height: 25px;
    background: radial-gradient(circle at 30% 30%, var(--gold-bright), var(--gold));
    border: 2px solid #b8860b;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5), inset -2px -2px 5px rgba(0,0,0,0.3);
    animation: fall linear infinite; 
}

.coin-particle::after {
    content: '$';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #b8860b;
    font-weight: 900;
    font-size: 14px;
}

@keyframes fall { 
    0% { transform: translateY(-50px) rotateX(0deg) rotateY(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(110vh) rotateX(720deg) rotateY(360deg); opacity: 0; } 
}

/* TOP RUNNING TEXT BAR */
#running-text-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.95);
    border-bottom: 2px solid var(--gold);
    padding: 8px 0;
    z-index: 2000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.marquee-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.marquee-content {
    display: inline-block;
    padding-left: 100%;
    animation: marquee 30s linear infinite;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 1px;
}

@keyframes marquee {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}

/* PREMIUM RESPONSIVE OPTIMIZATION */
@media (max-width: 1024px) {
    .main-grid { flex-direction: column; align-items: center; gap: 40px; padding-top: 20px; }
    .wheel-column { order: 1; }
    .info-column { order: 2; width: 100%; max-width: 550px; text-align: center; }
    .mini-logo-side { justify-content: center; }
    .wheel-outer-ring { width: 400px; height: 400px; }
}

@media (max-width: 768px) {
    .promo-title { font-size: 1.8rem; }
    .wheel-outer-ring { width: 340px; height: 340px; padding: 10px; }
    .wheel-pointer-new { top: -25px; }
    .input-group { flex-direction: column; }
    .input-group input { width: 100% !important; border-radius: 12px !important; }
}

@media (max-width: 480px) {
    .container { padding: 10px; }
    .wheel-outer-ring { width: 290px; height: 290px; }
    .promo-title { font-size: 1.5rem; }
    .mini-logo-side img { width: 120px; }
    .voucher-form-box { padding: 20px; border-radius: 20px; }
    .btn-action { padding: 14px; font-size: 0.9rem; }
    
    .modal-popup { width: 95%; padding: 20px; border-radius: 20px; }
    .modal-popup h2 { font-size: 1.3rem; }
    .history-table-wrapper { max-height: 350px; }
}