 body {
            background-color: #fff2e0; 
            color: #333;
            font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
            margin: 0;
            padding: 10px;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            box-sizing: border-box;
            overflow: hidden;
            position: relative;
        }

        /* Canvas hiệu ứng pháo hoa và mưa tiền xu vàng đẳng cấp */
        #fireworksCanvas {
            position: fixed;
            top: 0; left: 0;
            width: 100vw; height: 100vh;
            pointer-events: none;
            z-index: 99999;
        }

        .main-wrapper{
            display:flex;
            width:100%;
            height:calc(100vh - 20px);
            gap:10px;
            padding:10px;
            align-items:stretch;
        }

        .winner-history-wrapper{
            flex:1;
            overflow-y:auto;
            margin-top:10px;
        }

        /* Banner hai bên cánh */
        .promo-sidebar {
            display: flex;
            flex-direction: column;
            width: 260px; 
            flex-shrink: 0;
            gap: 10px;
        }

        .promo-box {
            background: #fffaf3;
            border: 2px solid #ffd6a5;
            border-radius: 12px;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1;
        }

        .promo-box img {
            width: 100%;
            height: 100%;
            object-fit: fill;
        }

        /* Panel hai bên */
        .side-panel{
            width:250px;
            flex:none;
            background:#fffaf3;
            border:1px solid #ffd6a5;
            border-radius:18px;
            padding:15px;
            height:100%;
            display:flex;
            flex-direction:column;
        }

        .panel-header {
            display: flex;
            flex-direction: column;     /* badge xuống dưới */
            align-items: center;    /* ⬅ canh trái, không ép giữa */
            gap: 6px;

            font-weight: bold;
            color: #e76f51;
            font-size: 1rem;
            border-bottom: 1px solid #ffd6a5;
            padding-bottom: 10px;
            margin-bottom: 10px;
        }

        .panel-header > span:first-child {
            white-space: nowrap;   /* ❗ không cho tiêu đề xuống dòng */
        }

        .winner-count-badge {
            align-self: center;   /* nằm dưới, sát trái */
            background: linear-gradient(135deg, #d63031 0%, #ff7675 100%);
            color: white;
            padding: 3px 12px;
            border-radius: 10px;
            font-size: 1rem;
            font-weight: bold;
            box-shadow: 0 2px 4px rgba(214, 48, 49, 0.2);
        }

        .btn-clear {
            color: #b2bec3;
            cursor: pointer;
            font-size: 0.8rem;
            text-transform: uppercase;
            transition: 0.2s;
        }
        .btn-clear:hover { color: #d63031; font-weight: bold; }

        #searchBox {
            background: #ffffff;
            border: 1px solid #ffccd0;
            padding: 10px;
            border-radius: 8px;
            margin-bottom: 10px;
            outline: none;
            color: #333;
            font-size: 0.9rem;
        }

        .file-action-btn {
            background: #ffffff;
            border: 1px dashed #ff7675;
            color: #d63031;
            padding: 10px;
            border-radius: 6px;
            font-weight: bold;
            font-size: 0.85rem;
            cursor: pointer;
            text-align: center;
            margin-top: 10px;
            transition: 0.2s;
            letter-spacing: 0.5px;
        }
        .file-action-btn:hover {
            background: #ffe5e5;
            border-style: solid;
        }

        textarea {
            flex: 1;
            background: #fffaf3;
            border: 1px solid #ffd6a5;
            border-radius: 8px;
            padding: 12px;
            resize: none;
            outline: none;
            font-size: 0.95rem;
            margin-bottom: 10px;
        }

        #btnCapNhat {
            background: #d63031;
            color: white;
            border: none;
            padding: 10px;
            border-radius: 6px;
            font-weight: bold;
            cursor: pointer;
            width: 100%;
        }

        /* KHUNG CHÍNH GIỮA - ĐÈN LED HOÀNG GIA */
        .container{
            flex:1;
            min-width:700px;
            background:#fff6e9;
            border:3px solid #ffd700;
            border-radius:20px;
            padding:20px;
            display:flex;
            flex-direction:column;
            position:relative;
            overflow:hidden;
        }

        .container::after {
            content: '';
            position: absolute;
            top: -2px; left: -2px; right: -2px; bottom: -2px;
            border-radius: 20px;
            border: 2px dashed #d63031;
            pointer-events: none;
            animation: ledBlink 1.5s linear infinite;
        }

        @keyframes ledBlink {
            0%, 100% { border-color: #ffd700; opacity: 1; }
            50% { border-color: #d63031; opacity: 0.7; }
        }

        .main-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #ffccd0;
            padding-bottom: 12px;
        }

        .brand-zone {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .logo-img {
            max-height: 45px;
            width: auto;
            display: block;
            object-fit: contain;
        }

        .brand-text h2 {
            margin: 0;
            color: #d63031;
            font-size: 1.3rem;
            font-weight: 800;
            letter-spacing: 0.2px;
            display: flex;
            align-items: center;
            gap: 1px;
        }
        .brand-text h2::before {
            font-size: 1.2rem;
        }

        .total-badge {
            background: linear-gradient(135deg, #fff7ec 0%, #ffe6c7 100%);
            border: 1px solid #f4a261;

            padding: 17px 10px;
            border-radius: 20px;

            font-size: 0.8rem;
            color: #5a3a1b;
            font-weight: bold;

            box-shadow: 0 2px 6px rgba(244, 162, 97, 0.25);
        }

       /* KHUNG CHỨA USER */
        .box-container{
            flex:1;
            display:flex;
            flex-wrap:wrap;
            align-content:flex-start;

            gap:12px;
            padding:15px;

            overflow-y:auto;
            overflow-x:hidden;

            background:#fffaf3;
            border:1px solid #ffd6a5;
            border-radius:16px;
        }


        .user-box{
            flex:0 0 calc(20% - 10px);
            height:80px;

            display:flex;
            align-items:center;
            justify-content:center;

            box-sizing:border-box;

            background:#fff3e0;
            border:1px solid #ffd6a5;
            border-radius:12px;

            font-weight:bold;
            padding:0 10px;

            white-space:nowrap;
            overflow:hidden;
            text-overflow:ellipsis;
        }

        .user-box.active {
            background: linear-gradient(135deg, #ffb703 0%, #f4a261 100%);
            color: #4a2c1a;

            border: 2px solid #ffdd9a;

            transform: scale(1.05);
            box-shadow:
                0 0 10px rgba(255, 183, 3, 0.6),
                0 4px 10px rgba(244, 162, 97, 0.35);

            z-index: 2;
            text-shadow: 0 1px 1px rgba(255,255,255,0.4);
        }

        /* KHU VỰC ĐIỀU KHIỂN DƯỚI ĐÁY */
        .footer-controls{
            height:60px;
            display:flex;
            justify-content:center;
            align-items:center;
            gap:15px;
            flex-shrink:0;
        }

        .time-badge-vip{
            height:40px;
            display:flex;
            align-items:center;
            gap:5px;
            padding:2px 20px;
            border-radius:30px;
            background:#fffaf3;
            border:1px solid #ffd6a5;
        }

        .time-badge-vip span.title-label {
            font-size: 1rem;
            font-weight: bold;
            color: #d63031;
            letter-spacing: 0.6px;
        }

        .btn-time-config {
            background: none;
            border: none;
            color: #ff7675;
            cursor: pointer;
            font-size: 0.8rem;
            padding: 0 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.3s ease, color 0.2s;
        }
        .btn-time-config:hover {
            color: #d63031;
            transform: rotate(60deg);
        }

        .time-mini-input {
            width: 38px;
            background: #d63031;
            color: #ffffff;
            border: none;
            border-radius: 5px;
            font-weight: 900;
            font-size: 0.9rem;
            text-align: center;
            padding: 2px 0;
            outline: none;
            box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
        }
        .time-mini-input::-webkit-outer-spin-button,
        .time-mini-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }

        .control-btn {
            border: none;
            padding: 12px 40px;
            font-size: 0.95rem;
            font-weight: bold;
            border-radius: 6px;
            cursor: pointer;
            text-transform: uppercase;
            transition: 0.2s;
        }

        .btn-main { 
            background: #d63031; 
            color: white; 
            box-shadow: 0 4px 10px rgba(214, 48, 49, 0.2);
        }
        .btn-main:hover { background: #b82e20; transform: translateY(-1px); }
        
        .btn-sub { 
            right: 0;
            background: #fffaf3; 
            color: #e76f51; 
            border: 1px solid #f4a261; 
        }
        .btn-sub:hover { background: #fff0f1; }

        /* DANH SÁCH LỊCH SỬ TRÚNG THƯỞNG BÊN PHẢI */
        .winner-history-wrapper {
            flex: 1;
            overflow-y: auto;
        }

        #lstWinner {
            list-style: none;
            padding: 0;
            margin: 0;
        }

        #lstWinner li {
            background: linear-gradient(135deg, #ffedd5 0%, #ffd6a5 100%);
            color: #4a2c1a;

            padding: 10px 12px;
            margin-bottom: 8px;
            border-radius: 8px;

            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 12px;

            border-left: 4px solid #f4a261;

            box-shadow: 0 3px 6px rgba(244, 162, 97, 0.25);

            animation: slideInDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        .winner-rank {
            background: linear-gradient(135deg, #ffd166 0%, #ffbe76 100%);
            color: #5a3a1b;

            font-size: 0.8rem;
            padding: 2px 8px;
            border-radius: 4px;
            font-weight: 900;

            box-shadow: 0 1px 4px rgba(255, 190, 118, 0.6);
        }

        .winner-name {
            flex: 1;
            text-align: left;
        }
        @keyframes slideInDown {
            from { opacity: 0; transform: translateY(-15px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* POP-UP CHIẾN THẮNG */
        .popup-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(80, 40, 10, 0.65);; display: flex; justify-content: center; align-items: center;
            z-index: 999999; opacity: 0; pointer-events: none; transition: 0.3s ease;
            backdrop-filter: blur(4px);
        }
        .popup-overlay.active { opacity: 1; pointer-events: auto; }
        
        .popup-content {
            background: #ffffff;
            border: 4px solid #ffdd9a;
            border-radius: 20px;
            padding: 30px 20px;
            width: 90%; 
            max-width: 550px; 
            text-align: center; 
            box-shadow: 0 0 30px rgba(255, 183, 3, 0.45), 0 15px 40px rgba(0, 0, 0, 0.45);
            transform: scale(0.7); transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            display: flex; flex-direction: column; align-items: center;
        }
        .popup-overlay.active .popup-content { transform: scale(1); }
        
        .popup-title-text {
            font-size: 1.8rem;
            color: #e76f51;
            font-weight: 900;
            letter-spacing: 0.5px;
            text-shadow: 0 1px 1px rgba(0,0,0,0.05);
        }
        
        .popup-body { 
            background: linear-gradient(180deg, #fff7ec 0%, #ffe6c7 100%);
            border: 2px dashed #f4a261;
            border-radius: 12px;
            padding: 20px 15px; 
            margin-bottom: 20px; 
            width: 100%; 
            box-sizing: border-box; 
        }
        
        #popupWinnerName {
            font-size: 4.5rem;
            background: linear-gradient(to bottom, #f4a261 20%, #b45309 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;

            font-weight: 900;
            letter-spacing: -1px;
            filter: drop-shadow(0 2px 2px rgba(0,0,0,0.12));
        }
        
        .popup-logo-wrapper { 
            background: #ffffff;
            padding: 8px 30px; 
            border-radius: 10px; 
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
            display: inline-flex; 
            align-items: center; 
            justify-content: center; 
            margin-bottom: 20px; 
            border: 1px solid #ffedd5;
        }
        .popup-logo-img { max-height: 45px; width: auto; display: block; object-fit: contain; }
        
        .btn-close-popup { 
            background: linear-gradient(135deg, #f4a261 0%, #e76f51 100%);
            color: #ffffff;
            border: none; 
            padding: 12px 50px; 
            font-size: 1.05rem; 
            font-weight: bold; 
            border-radius: 6px; 
            cursor: pointer; 
            text-transform: uppercase;
            box-shadow: 0 4px 10px rgba(231, 111, 81, 0.25);
            transition: 0.2s;
        }
        .btn-close-popup:hover {
            background: linear-gradient(135deg, #e76f51 0%, #d65a3a 100%);
            transform: translateY(-1px);
        }

        /* Tiện ích nhạc nền */
        .music-btn{
            width:100px;
            height:30px;
            display:flex;
            justify-content:center;
            align-items:center;
            border-radius:8px;
            background:#fffaf3;
            border:1px solid #f4a261;
            color:#e76f51;
            font-weight:bold;
            cursor:pointer;
        }
        .bg-music-trigger:hover { transform: scale(1.05); background: #fff0f1; }
        .music-icon-spin { font-size: 1.2rem; animation: spinMusic 3s linear infinite; display: inline-block; }
        @keyframes spinMusic { 100% { transform: rotate(360deg); } }

        .music-popup-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(0, 0, 0, 0.4); display: flex; justify-content: center; align-items: center;
            z-index: 100000; opacity: 0; pointer-events: none; transition: 0.2s;
        }
        .music-popup-overlay.active { opacity: 1; pointer-events: auto; }
        
        .music-card {
            background: linear-gradient(135deg, #4a3319, #201205); 
            border: 2px solid #ffd700; border-radius: 12px; width: 420px; padding: 20px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5); color: #fff; position: relative;
        }
        .music-card-header {
            font-size: 1.2rem; font-weight: bold; text-align: center; color: #ffd700;
            margin-bottom: 25px; letter-spacing: 1px; border-bottom: 1px solid rgba(255,215,0,0.2); padding-bottom: 10px;
        }
        .music-close-x { position: absolute; top: 12px; right: 15px; font-size: 1.2rem; color: #aaa; cursor: pointer; }
        .music-close-x:hover { color: #ffd700; }

        .music-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-size: 1.05rem; }
        .music-row label { color: #dfcfb7; font-weight: 500; }

        .switch-container { display: flex; align-items: center; gap: 5px; }
        .switch-label-status { font-size: 0.9rem; font-weight: bold; color: #ffd700; text-transform: uppercase; }
        .music-switch { position: relative; display: inline-block; width: 60px; height: 30px; }
        .music-switch input { opacity: 0; width: 0; height: 0; }
        .slider-round {
            position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
            background-color: #555; transition: .3s; border-radius: 34px; border: 1px solid #777;
        }
        .slider-round:before {
            position: absolute; content: ""; height: 22px; width: 22px; left: 3px; bottom: 3px;
            background-color: #fff; transition: .3s; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3);
        }
        input:checked + .slider-round { background-color: #8a6321; border-color: #ffd700; }
        input:checked + .slider-round:before { transform: translateX(30px); background-color: #ffd700; }

        .music-select {
            width: 100%; background: #150b03; border: 1px solid #ffd700; color: #fff;
            padding: 10px; border-radius: 6px; outline: none; font-size: 0.95rem; cursor: pointer;
        }

        .music-actions { display: flex; justify-content: center; gap: 15px; margin-top: 25px; }
        .music-btn { padding: 8px 25px; border-radius: 4px; font-weight: bold; cursor: pointer; border: none; font-size: 0.9rem; }
        .btn-music-cancel { background: #fff; color: #333; }
        .btn-music-save { background: linear-gradient(to bottom, #8a5c1e, #503107); color: #fff; border: 2px solid #ffd700; }
        .btn-music-save:hover { background: #8a5c1e; }

/* ================= SLOT RANDOM UI (ANTI-LAG 14K USERS) ================= */

/* Ô đang chạy */
.slot-item.active {
    background: linear-gradient(135deg, #ffb703 0%, #f4a261 100%);
    color: #4a2c1a;

    border: 2px solid #ffdd9a;

    transform: scale(1.08);

    box-shadow:
        0 0 14px rgba(255, 183, 3, 0.75),
        0 6px 14px rgba(244, 162, 97, 0.45);

    text-shadow: 0 1px 1px rgba(255,255,255,0.45);
    z-index: 3;
}

/* Hai ô trên dưới mờ hơn (giả chiều sâu) */
.slot-item:not(.active) {
    opacity: 0.7;
}


.single-random-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* container vẫn sáng */
body.running-game .container {
    filter: none;
    opacity: 1;
}

/* Mờ toàn bộ khi quay */
body.running-game .promo-sidebar,
body.running-game .side-panel,
body.running-game .footer-controls,
body.running-game .box-container {
    filter: blur(6px);
    opacity: 0.25;
    pointer-events: none;
}

/* overlay trung tâm */
.spin-overlay {
    position: absolute;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 9999;
}

/* khi chạy */
body.running-game .spin-overlay {
    display: flex;
}

/* ô quay lớn */
.spin-box {
    width: 420px;
    height: 200px;

    background: linear-gradient(135deg, #fff0d6, #ffe6b3);
    border: 4px solid #ffd700;
    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 2.2rem;
    font-weight: 900;
    color: #d35400;

    box-shadow: 0 20px 60px rgba(0,0,0,0.35);

    transform: scale(0.8);
    animation: pop .2s ease forwards;
}

@keyframes pop {
    to {
        transform: scale(1);
    }
}

.single-random-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.single-random-box {
    width: 380px;
    height: 180px;
    background: linear-gradient(135deg, #fff0d6, #ffe6b3);
    border: 4px solid #ffd700;
    border-radius: 20px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 2rem;
    font-weight: bold;
    color: #d35400;

    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.wheel-wrapper{
    position: relative;
    width: 420px;
    height: 420px;
}

#wheelCanvas{
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
}

.wheel-pointer{
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: red;
}

.wheel-pointer {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    color: red;
    z-index: 999;
}

.game-overlay{
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.game-overlay.active{
    display: flex;
}

/* Ô hiển thị giữa */
#spinCenterBox{
    width: 360px;
    height: 140px;
    background: linear-gradient(135deg, #fff0d6, #ffe6b3);
    border: 4px solid #ffd700;
    border-radius: 18px;

    display: flex;
    justify-content: center;
    align-items: center;

    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

#spinBox{
    font-size: 28px;
    font-weight: 900;
    color: #d35400;
    text-align: center;
}

.game-btn{
    height:40px;
    min-width:150px;
    border-radius:8px;
    font-weight:bold;
    cursor:pointer;
}


.start-btn{
    background:#d63031;
    color:white;
    border:none;
}


.next-btn{
    background:#fffaf3;
    color:#e76f51;
    border:1px solid #f4a261;
}

.winner-panel{
    width:250px;
    height:100%;
    min-height:0;
    flex:none;
    background:#fffaf3;
    border:1px solid #ffd6a5;
    border-radius:18px;
    padding:15px;
    display:flex;
    flex-direction:column;
}


.winner-history-wrapper{
    flex:1;
    min-height:0;
    margin:15px 0;
    overflow-y:auto;
}


#lstWinner{
    list-style:none;
    padding:0;
    margin:0;
}


#lstWinner li{
    background:#ffe0b2;
    border-radius:8px;
    padding:12px;
    margin-bottom:8px;
    font-weight:bold;
}


.winner-panel .file-action-btn{
    margin-top:auto;
    flex-shrink:0;
}

/* CĂN ĐÁY CARD 2 BÊN THEO CARD GIỮA */
.side-panel{
    height: calc(100% - 30px);
    margin-bottom:30px;
}

.box-container{
    display:grid !important;
    grid-template-columns:repeat(5, 1fr) !important;
    gap:12px !important;
    overflow-x:hidden !important;
}


.box-container > *{
    width:100% !important;
    min-width:0 !important;
    max-width:none !important;
    height:80px !important;
    box-sizing:border-box;
}


.box-container > *{
    display:flex;
    align-items:center;
    justify-content:center;

    background:#fff3e0;
    border:1px solid #ffd6a5;
    border-radius:12px;

    font-weight:bold;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}