@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@400;500;600;700&display=swap');

:root {
    /* Màu Tết truyền thống */
    --tet-red: #c41e3a;
    --tet-red-dark: #8b0000;
    --tet-red-light: #dc143c;
    --tet-gold: #ffd700;
    --tet-gold-light: #ffec8b;
    --tet-gold-dark: #daa520;
    --tet-orange: #ff6b35;
    --tet-pink: #ff69b4;
    --tet-green: #228b22;
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(139, 0, 0, 0.3);
    --glass-border: rgba(255, 215, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #8b0000 0%, #c41e3a 30%, #dc143c 60%, #8b0000 100%);
    overflow-x: hidden;
}

/* Animated background pattern */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 107, 53, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* ===== TET DECORATIONS ===== */
.tet-decoration {
    position: fixed;
    font-size: 3rem;
    animation: float 3s ease-in-out infinite;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.lantern.left { top: 10%; left: 3%; animation-delay: 0s; }
.lantern.right { top: 10%; right: 3%; animation-delay: 0.5s; }
.blossom.b1 { top: 20%; left: 8%; font-size: 2rem; animation-delay: 1s; }
.blossom.b2 { bottom: 20%; right: 8%; font-size: 2rem; animation-delay: 1.5s; }
.blossom.b3 { bottom: 30%; left: 5%; font-size: 1.8rem; animation-delay: 2s; }
.lucky { top: 5%; left: 50%; transform: translateX(-50%); font-size: 2.5rem; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    position: relative;
    z-index: 1;
}

/* ===== HEADER ===== */
.game-header {
    text-align: center;
}

.game-title {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light), var(--tet-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
    margin-bottom: 5px;
}

.game-subtitle {
    color: var(--tet-gold-light);
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ===== RIGHT SIDEBAR CTA BUTTONS ===== */
.right-cta-buttons {
    position: fixed;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.cta-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 15px 12px;
    background: linear-gradient(145deg, rgba(139, 0, 0, 0.95), rgba(100, 0, 0, 0.98));
    border: 3px solid var(--tet-gold);
    border-radius: 16px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 215, 0, 0.2);
    position: relative;
    min-width: 70px;
}

.cta-btn:hover {
    transform: translateX(-5px) scale(1.05);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 215, 0, 0.4);
    border-color: var(--tet-gold-light);
}

.cta-btn:active {
    transform: translateX(-3px) scale(1);
}

.cta-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.cta-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--tet-gold);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cta-btn.cta-horse {
    background: linear-gradient(145deg, #5c3d00, #3d2600);
}

.cta-btn.cta-rewards {
    background: linear-gradient(145deg, #8b0000, #5c0000);
}

.reward-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--tet-gold);
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.5);
    animation: badgePulse 2s ease-in-out infinite;
}

.reward-badge:empty, .reward-badge[data-count="0"] {
    display: none;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ===== BOARD ===== */
.board {
    width: 480px;
    height: 480px;
    background: linear-gradient(145deg, rgba(139, 0, 0, 0.95), rgba(196, 30, 58, 0.95));
    border-radius: 24px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    gap: 4px;
    padding: 8px;
    box-shadow: 
        0 25px 60px rgba(0, 0, 0, 0.5),
        0 0 0 3px var(--tet-gold),
        0 0 0 6px var(--tet-red-dark),
        inset 0 1px 0 rgba(255, 215, 0, 0.2);
    position: relative;
}

.board::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 3px;
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-orange), var(--tet-gold));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

/* ===== CELLS ===== */
.cell {
    background: rgba(255, 215, 0, 0.15);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: default;
    overflow: visible;
    border: 2px solid rgba(255, 215, 0, 0.3);
    z-index: 1;
}

.cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255, 215, 0, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.cell:hover::before { opacity: 1; }
.cell:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4); }

/* Prize cell types - Tết themed */
.cell.prize-lixi {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.3), rgba(220, 20, 60, 0.4));
    border-color: rgba(255, 215, 0, 0.6);
}

.cell.prize-voucher {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.3), rgba(255, 140, 0, 0.4));
    border-color: rgba(255, 165, 0, 0.6);
}

.cell.prize-hoamai {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 236, 139, 0.4));
    border-color: rgba(255, 215, 0, 0.6);
}

.cell.prize-hoadao {
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.3), rgba(255, 182, 193, 0.4));
    border-color: rgba(255, 105, 180, 0.6);
}

.cell.prize-banh {
    background: linear-gradient(135deg, rgba(34, 139, 34, 0.3), rgba(50, 205, 50, 0.4));
    border-color: rgba(34, 139, 34, 0.6);
}

.cell.prize-mut {
    background: linear-gradient(135deg, rgba(255, 99, 71, 0.3), rgba(255, 127, 80, 0.4));
    border-color: rgba(255, 99, 71, 0.6);
}

.cell.prize-phao {
    background: linear-gradient(135deg, rgba(220, 20, 60, 0.3), rgba(255, 0, 0, 0.4));
    border-color: rgba(255, 0, 0, 0.6);
}

.cell.prize-loc {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 236, 139, 0.5));
    border-color: rgba(255, 215, 0, 0.8);
}

/* Corner cells */
.corner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 140, 0, 0.4)) !important;
    border-color: var(--tet-gold) !important;
}

/* Start cell */
.start-cell {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.5), rgba(255, 165, 0, 0.6)) !important;
    border-color: var(--tet-gold) !important;
}

/* Current position */
.cell.current {
    animation: currentPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    z-index: 10;
}

@keyframes currentPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 35px rgba(255, 215, 0, 1); }
}

.cell-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 1;
}

.cell-icon {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.cell-value {
    font-size: 8px;
    color: var(--tet-gold-light);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* ===== CENTER AREA ===== */
.center-area {
    grid-column: 2 / 7;
    grid-row: 2 / 7;
    background: linear-gradient(145deg, rgba(139, 0, 0, 0.95), rgba(100, 0, 0, 0.98));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border-radius: 16px;
    border: 3px solid var(--tet-gold);
    position: relative;
    overflow: hidden;
}

.center-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
}

.center-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tet-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.center-subtitle {
    font-size: 0.85rem;
    color: var(--tet-gold-light);
    z-index: 1;
}

/* ===== DICE ===== */
.dice-container {
    display: flex;
    gap: 25px;
    perspective: 800px;
    z-index: 1;
    padding: 15px;
}

.dice-wrapper {
    width: 60px;
    height: 60px;
    position: relative;
}

.dice {
    width: 60px;
    height: 60px;
    position: absolute;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.dice.rolling {
    animation: diceRoll3D 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

@keyframes diceRoll3D {
    0% { 
        transform: rotateX(0) rotateY(0) rotateZ(0);
    }
    10% { 
        transform: rotateX(90deg) rotateY(45deg) rotateZ(30deg);
    }
    20% { 
        transform: rotateX(180deg) rotateY(135deg) rotateZ(60deg);
    }
    30% { 
        transform: rotateX(270deg) rotateY(225deg) rotateZ(90deg);
    }
    40% { 
        transform: rotateX(360deg) rotateY(315deg) rotateZ(120deg);
    }
    50% { 
        transform: rotateX(450deg) rotateY(405deg) rotateZ(150deg);
    }
    60% { 
        transform: rotateX(540deg) rotateY(495deg) rotateZ(180deg);
    }
    70% { 
        transform: rotateX(630deg) rotateY(540deg) rotateZ(150deg);
    }
    80% { 
        transform: rotateX(700deg) rotateY(600deg) rotateZ(100deg);
    }
    90% { 
        transform: rotateX(var(--final-x)) rotateY(calc(var(--final-y) + 720deg)) rotateZ(30deg);
    }
    100% { 
        transform: rotateX(var(--final-x)) rotateY(var(--final-y)) rotateZ(0deg);
    }
}

.dice-face {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(145deg, #fff8dc, var(--tet-gold));
    border-radius: 12px;
    border: 2px solid var(--tet-gold-dark);
    box-shadow: 
        inset 0 3px 6px rgba(255, 255, 255, 0.6),
        inset 0 -3px 6px rgba(0, 0, 0, 0.15),
        0 0 10px rgba(255, 215, 0, 0.3);
    backface-visibility: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dice-face .dot {
    width: 11px;
    height: 11px;
    background: linear-gradient(145deg, var(--tet-red-light), var(--tet-red-dark));
    border-radius: 50%;
    position: absolute;
    box-shadow: 
        0 2px 3px rgba(0, 0, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.4),
        inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}

/* 3D cube faces positioning */
.dice-face.face-1 { transform: rotateY(0deg) translateZ(30px); }
.dice-face.face-6 { transform: rotateY(180deg) translateZ(30px); }
.dice-face.face-2 { transform: rotateY(-90deg) translateZ(30px); }
.dice-face.face-5 { transform: rotateY(90deg) translateZ(30px); }
.dice-face.face-3 { transform: rotateX(90deg) translateZ(30px); }
.dice-face.face-4 { transform: rotateX(-90deg) translateZ(30px); }

/* ===== ROLL BUTTON ===== */
.roll-btn {
    padding: 14px 50px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tet-red-dark);
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light), var(--tet-gold));
    border: 3px solid var(--tet-gold-dark);
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
    z-index: 1;
    text-shadow: 0 1px 2px rgba(255,255,255,0.5);
}

.roll-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--tet-gold-light), #fff, var(--tet-gold-light));
    opacity: 0;
    transition: opacity 0.3s;
}

.roll-btn:hover::before { opacity: 1; }
.roll-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 35px rgba(255, 215, 0, 0.7); }

.roll-btn span {
    position: relative;
    z-index: 1;
}

.roll-btn:disabled {
    background: linear-gradient(135deg, #666, #888);
    border-color: #555;
    color: #aaa;
    cursor: not-allowed;
    box-shadow: none;
}

.roll-btn:disabled:hover { transform: none; }

/* ===== HORSE - CHIBI TẾT (Giống ảnh mẫu) ===== */
.horse {
    position: absolute;
    width: 60px;
    height: 78px;
    z-index: 1000;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.35));
    transition: left 0.18s ease-out, top 0.18s ease-out;
    transform: translate(-50%, -80%);
    pointer-events: none;
}

.horse svg { 
    width: 100%; 
    height: 100%;
    transform-origin: center bottom;
    overflow: visible;
}

/* Hiệu ứng đứng yên - nhún nhẹ */
.horse.idle { 
    animation: horseIdle 1.2s ease-in-out infinite; 
}

@keyframes horseIdle {
    0%, 100% { 
        transform: translate(-50%, -80%) scale(1); 
    }
    50% { 
        transform: translate(-50%, -83%) scale(1.02); 
    }
}

/* Hiệu ứng chạy - nhảy lên xuống */
.horse.running { 
    animation: horseRunning 0.12s ease-in-out infinite; 
}

@keyframes horseRunning {
    0%, 100% { 
        transform: translate(-50%, -80%) scale(1) rotate(-2deg); 
    }
    50% { 
        transform: translate(-50%, -88%) scale(1.05) rotate(2deg); 
    }
}

/* Hiệu ứng ăn mừng */
.horse.celebrate { 
    animation: horseCelebrate 0.3s ease-in-out infinite; 
}

@keyframes horseCelebrate {
    0%, 100% { 
        transform: translate(-50%, -80%) rotate(0deg) scale(1); 
    }
    25% { 
        transform: translate(-50%, -90%) rotate(8deg) scale(1.12); 
    }
    50% { 
        transform: translate(-50%, -80%) rotate(0deg) scale(1); 
    }
    75% { 
        transform: translate(-50%, -90%) rotate(-8deg) scale(1.12); 
    }
}

/* ===== NÚT NHẠC TẾT ===== */
.music-toggle-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    padding: 12px 20px;
    background: linear-gradient(145deg, #8b0000, #5c0000);
    border: 3px solid var(--tet-gold);
    border-radius: 50px;
    color: var(--tet-gold);
    font-family: 'Quicksand', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 215, 0, 0.2);
    transition: all 0.3s ease;
}

.music-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 215, 0, 0.4);
}

.music-toggle-btn.playing {
    background: linear-gradient(145deg, #006400, #004d00);
    animation: musicPulse 1s ease-in-out infinite;
}

@keyframes musicPulse {
    0%, 100% { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 215, 0, 0.6); }
}

/* ===== GAME INFO ===== */
.game-info {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-card {
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.8), rgba(100, 0, 0, 0.9));
    backdrop-filter: blur(10px);
    padding: 10px 16px;
    border-radius: 16px;
    border: 2px solid var(--tet-gold);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 85px;
    justify-content: center;
}

.info-card-icon { font-size: 1.2rem; }

.info-card-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tet-gold);
}

.info-card.coins .info-card-value { color: var(--tet-gold); }
.info-card.gems .info-card-value { color: #ff69b4; }
.info-card.voucher .info-card-value { color: #ff6b35; }
.info-card.laps .info-card-value { color: #7fff00; }

.info-card.dice-result {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 165, 0, 0.4));
    border-color: var(--tet-gold);
}

/* ===== POPUP OVERLAY ===== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay.show {
    display: flex;
    opacity: 1;
}

/* ===== POPUP CLOSE BUTTON ===== */
.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: linear-gradient(135deg, var(--tet-red), var(--tet-red-dark));
    color: white;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.popup-close:hover {
    transform: scale(1.1) rotate(90deg);
    background: linear-gradient(135deg, #ff0000, var(--tet-red));
}

/* ===== SKIN POPUP ===== */
.skin-popup {
    background: linear-gradient(145deg, #8b0000, #5c0000);
    border: 4px solid var(--tet-gold);
    border-radius: 24px;
    padding: 30px 40px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 215, 0, 0.3);
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 90vw;
}

.popup-overlay.show .skin-popup {
    transform: scale(1);
    opacity: 1;
}

.popup-header {
    margin-bottom: 20px;
}

.popup-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 10px;
}

.popup-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tet-gold);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.skin-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 25px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 50%;
    border: 3px solid var(--tet-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
}

.skin-preview svg {
    width: 90px;
    height: 90px;
}

.color-options {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 25px;
}

.color-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.color-btn::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.color-btn:hover { transform: scale(1.15); }

.color-btn.active::after {
    border-color: var(--tet-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
}

.color-btn.brown { background: linear-gradient(135deg, #92400e, #b45309); }
.color-btn.white { background: linear-gradient(135deg, #f8fafc, #e2e8f0); }
.color-btn.black { background: linear-gradient(135deg, #1f2937, #374151); }
.color-btn.golden { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.color-btn.red { background: linear-gradient(135deg, #dc2626, #b91c1c); }

.confirm-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--tet-red-dark);
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light));
    border: 2px solid var(--tet-gold-dark);
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    transition: all 0.3s;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6);
}

/* ===== REWARDS POPUP ===== */
.rewards-popup {
    background: linear-gradient(145deg, #8b0000, #5c0000);
    border: 4px solid var(--tet-gold);
    border-radius: 24px;
    padding: 25px 30px;
    text-align: center;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 2px rgba(255, 215, 0, 0.3);
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-width: 95vw;
    width: 400px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.popup-overlay.show .rewards-popup {
    transform: scale(1);
    opacity: 1;
}

.rewards-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.summary-item {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.summary-icon {
    font-size: 1.5rem;
}

.summary-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--tet-gold);
}

.summary-value.gems { color: #ff69b4; }
.summary-value.voucher { color: #ff6b35; }
.summary-value.gift { color: #7fff00; }

.rewards-divider {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    color: var(--tet-gold-light);
    font-size: 0.85rem;
    font-weight: 600;
}

.rewards-divider::before,
.rewards-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--tet-gold), transparent);
}

.rewards-list {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rewards-list::-webkit-scrollbar {
    width: 6px;
}

.rewards-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.rewards-list::-webkit-scrollbar-thumb {
    background: var(--tet-gold);
    border-radius: 3px;
}

.rewards-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.6);
}

.rewards-empty span {
    font-size: 3rem;
    margin-bottom: 10px;
    opacity: 0.5;
}

.rewards-empty p {
    margin: 3px 0;
    font-size: 0.9rem;
}

.rewards-empty p:first-of-type {
    font-weight: 600;
    color: var(--tet-gold-light);
}

.reward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    animation: rewardSlideIn 0.3s ease-out;
}

@keyframes rewardSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.reward-item-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.reward-item-info {
    flex: 1;
    min-width: 0;
}

.reward-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reward-item-desc {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

.reward-item-value {
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

.reward-item-value.positive { color: var(--tet-gold); }
.reward-item-value.negative { color: #ff6b6b; }

.reward-item-time {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

/* ===== PRIZE POPUP ===== */
.prize-popup {
    background: linear-gradient(145deg, #8b0000, #5c0000);
    border: 4px solid var(--tet-gold);
    padding: 40px 55px;
    border-radius: 24px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    text-align: center;
    position: relative;
    transform: scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.show .prize-popup {
    transform: scale(1);
    opacity: 1;
}

.prize-popup-icon {
    font-size: 70px;
    margin-bottom: 15px;
    animation: prizeIconBounce 0.6s ease-out;
}

@keyframes prizeIconBounce {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.prize-popup-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--tet-gold-light);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.prize-popup-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-top: 10px;
    text-shadow: 0 3px 6px rgba(0,0,0,0.4);
}

.prize-popup-value.positive { color: var(--tet-gold); }
.prize-popup-value.negative { color: #ff6b6b; }

/* ===== VICTORY ===== */
.victory-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.98), rgba(100, 0, 0, 0.98));
    backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 1000;
}

.victory-overlay.show { display: flex; }

.victory-lanterns {
    font-size: 3rem;
    display: flex;
    gap: 30px;
}

.victory-lanterns span {
    animation: lanternSwing 1s ease-in-out infinite;
    filter: drop-shadow(0 4px 15px rgba(255, 100, 0, 0.6));
}

.victory-lanterns span:nth-child(2) { animation-delay: 0.3s; }
.victory-lanterns span:nth-child(3) { animation-delay: 0.6s; }

@keyframes lanternSwing {
    0%, 100% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
}

.victory-horse {
    width: 130px;
    height: 130px;
    animation: victoryHorse 1s ease-in-out infinite;
}

@keyframes victoryHorse {
    0%, 100% { transform: rotate(-12deg) scale(1) translateY(0); }
    50% { transform: rotate(12deg) scale(1.1) translateY(-20px); }
}

.victory-text {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light), var(--tet-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: victoryPulse 0.5s ease-in-out infinite alternate;
}

@keyframes victoryPulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.victory-subtitle {
    font-size: 1.1rem;
    color: var(--tet-gold-light);
    font-weight: 500;
}

.victory-stats {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-align: center;
    line-height: 2;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px 40px;
    border-radius: 16px;
    border: 2px solid var(--tet-gold);
}

.victory-stats strong { color: var(--tet-gold); }

.restart-btn {
    padding: 16px 55px;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light));
    border: 3px solid var(--tet-gold-dark);
    border-radius: 50px;
    color: var(--tet-red-dark);
    cursor: pointer;
    font-weight: 700;
    font-family: 'Quicksand', sans-serif;
    box-shadow: 0 4px 25px rgba(255, 215, 0, 0.5);
    transition: all 0.3s;
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(255, 215, 0, 0.7);
}

/* ===== EFFECTS ===== */
.confetti {
    position: fixed;
    width: 12px;
    height: 12px;
    top: -20px;
    border-radius: 2px;
    animation: confettiFall 4s linear forwards;
}

@keyframes confettiFall {
    to { transform: translateY(110vh) rotate(1080deg); opacity: 0; }
}

.float-emoji {
    position: fixed;
    font-size: 40px;
    pointer-events: none;
    animation: floatUp 2s ease-out forwards;
    z-index: 600;
}

@keyframes floatUp {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-120px) scale(1.4); }
}

/* ===== WELCOME OVERLAY ===== */
.welcome-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.98), rgba(100, 0, 0, 0.98));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.welcome-content {
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    font-size: 6rem;
    margin-bottom: 20px;
    animation: welcomeBounce 1s ease-in-out infinite;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.4));
}

@keyframes welcomeBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.welcome-title {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light), var(--tet-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
}

.welcome-text {
    font-size: 1.3rem;
    color: var(--tet-gold-light);
    margin-bottom: 30px;
    font-weight: 500;
}

.welcome-btn {
    padding: 18px 60px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--tet-red-dark);
    background: linear-gradient(135deg, var(--tet-gold), var(--tet-gold-light), var(--tet-gold));
    border: 4px solid var(--tet-gold-dark);
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Quicksand', sans-serif;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: welcomeBtnPulse 2s ease-in-out infinite;
}

@keyframes welcomeBtnPulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 8px 50px rgba(255, 215, 0, 0.8); }
}

.welcome-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 40px rgba(255, 215, 0, 0.7);
}

.welcome-note {
    margin-top: 25px;
    font-size: 0.95rem;
    color: rgba(255, 215, 0, 0.7);
    font-weight: 500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
    .board { width: 95vmin; height: 95vmin; padding: 5px; gap: 3px; }
    .game-title { font-size: 1.4rem; }
    .horse { width: 50px; height: 65px; }
    .dice-wrapper { width: 45px; height: 45px; }
    .dice { width: 45px; height: 45px; }
    .dice-face { width: 45px; height: 45px; }
    .dice-face .dot { width: 8px; height: 8px; }
    .dice-face.face-1 { transform: rotateY(0deg) translateZ(22.5px); }
    .dice-face.face-6 { transform: rotateY(180deg) translateZ(22.5px); }
    .dice-face.face-2 { transform: rotateY(-90deg) translateZ(22.5px); }
    .dice-face.face-5 { transform: rotateY(90deg) translateZ(22.5px); }
    .dice-face.face-3 { transform: rotateX(90deg) translateZ(22.5px); }
    .dice-face.face-4 { transform: rotateX(-90deg) translateZ(22.5px); }
    .dice-container { gap: 15px; padding: 10px; }
    .roll-btn { padding: 12px 35px; font-size: 1rem; }
    .cell-icon { font-size: 14px; }
    .cell-value { font-size: 7px; }
    .color-btn { width: 38px; height: 38px; }
    .info-card { padding: 8px 12px; min-width: 70px; }
    .tet-decoration { font-size: 2rem; }
    .skin-popup { padding: 25px 30px; }
    .prize-popup { padding: 30px 40px; }
    
    /* Right CTA buttons - Góc phải dưới màn hình */
    .right-cta-buttons {
        position: fixed;
        right: 10px;
        left: auto;
        top: auto;
        bottom: 15px;
        transform: none;
        flex-direction: row;
        gap: 10px;
        z-index: 100;
    }
    .cta-btn {
        padding: 10px 12px;
        min-width: 70px;
        border-radius: 12px;
        flex-direction: column;
        gap: 4px;
    }
    .cta-icon { font-size: 1.2rem; }
    .cta-text { font-size: 0.65rem; }
    .reward-badge {
        min-width: 16px;
        height: 16px;
        font-size: 0.55rem;
        top: -5px;
        right: -5px;
    }
    
    /* Game info */
    .game-info {
        margin-bottom: 10px;
    }
    
    /* Rewards popup responsive */
    .rewards-popup {
        width: 95vw;
        padding: 20px 15px;
        max-height: 85vh;
    }
    .rewards-summary { gap: 8px; }
    .summary-item { padding: 10px 8px; }
    .summary-icon { font-size: 1.2rem; }
    .summary-value { font-size: 1rem; }
    .rewards-list { max-height: 200px; }
    
    /* Music button responsive - góc trái dưới */
    .music-toggle-btn {
        bottom: 15px;
        left: 10px;
        padding: 8px 12px;
        font-size: 0.7rem;
    }
    
    /* Welcome overlay responsive */
    .welcome-content {
        padding: 25px 15px;
    }
    .welcome-icon {
        font-size: 4rem;
        margin-bottom: 15px;
    }
    .welcome-title {
        font-size: 1.3rem;
        white-space: nowrap;
        margin-bottom: 10px;
    }
    .welcome-text {
        font-size: 1rem;
        margin-bottom: 20px;
    }
    .welcome-btn {
        padding: 14px 40px;
        font-size: 1.1rem;
    }
}

/* ===== LANDSCAPE MOBILE - Chế độ ngang ===== */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding: 5px;
        overflow: hidden;
    }
    
    .game-container {
        gap: 5px;
    }
    
    .game-header {
        display: none; /* Ẩn header để tiết kiệm không gian */
    }
    
    .board {
        width: min(85vw, 85vh);
        height: min(85vw, 85vh);
        padding: 3px;
        gap: 2px;
    }
    
    .horse {
        width: 35px;
        height: 45px;
    }
    
    .cell-icon { font-size: 11px; }
    .cell-value { font-size: 6px; }
    
    .dice-container {
        gap: 8px;
        padding: 5px;
    }
    
    .dice-wrapper { width: 35px; height: 35px; }
    .dice { width: 35px; height: 35px; }
    .dice-face { width: 35px; height: 35px; }
    .dice-face .dot { width: 6px; height: 6px; }
    .dice-face.face-1 { transform: rotateY(0deg) translateZ(17.5px); }
    .dice-face.face-6 { transform: rotateY(180deg) translateZ(17.5px); }
    .dice-face.face-2 { transform: rotateY(-90deg) translateZ(17.5px); }
    .dice-face.face-5 { transform: rotateY(90deg) translateZ(17.5px); }
    .dice-face.face-3 { transform: rotateX(90deg) translateZ(17.5px); }
    .dice-face.face-4 { transform: rotateX(-90deg) translateZ(17.5px); }
    
    .roll-btn {
        padding: 8px 25px;
        font-size: 0.85rem;
    }
    
    .game-info {
        gap: 5px;
        margin-bottom: 0;
    }
    
    .info-card {
        padding: 5px 8px;
        min-width: 50px;
    }
    .info-card-icon { font-size: 0.9rem; }
    .info-card-value { font-size: 0.8rem; }
    
    /* CTA buttons góc phải */
    .right-cta-buttons {
        position: fixed;
        right: 5px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        flex-direction: column;
        gap: 5px;
    }
    .cta-btn {
        padding: 6px 8px;
        min-width: auto;
    }
    .cta-icon { font-size: 1rem; }
    .cta-text { display: none; }
    .reward-badge {
        min-width: 14px;
        height: 14px;
        font-size: 0.5rem;
    }
    
    /* Music button */
    .music-toggle-btn {
        bottom: 5px;
        left: 5px;
        padding: 5px 8px;
        font-size: 0.6rem;
    }
    
    /* Ẩn decorations */
    .tet-decoration { display: none; }
    
    /* Welcome overlay landscape */
    .welcome-content { padding: 15px; }
    .welcome-icon { font-size: 3rem; margin-bottom: 10px; }
    .welcome-title { font-size: 1.2rem; }
    .welcome-text { font-size: 0.9rem; margin-bottom: 15px; }
    .welcome-btn { padding: 10px 30px; font-size: 1rem; }
}
