html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    font-family: 'Arial', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* GPU Hardware Acceleration Rules for Zero Lag on Mobile (0% Visual Change) */
*, *::before, *::after {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

.game-container,
.top-header,
.bottom-bar,
.betting-area,
.table-container,
.side-gif,
.vs-image,
.card-image,
.chip,
.winner-burst,
.winner-glow,
.winner-gif-overlay,
.message-image,
.vs-graphic,
.vs-overlay,
.message-image-overlay,
.history-item.latest-history-item {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-perspective: 1000px;
    perspective: 1000px;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* Fullscreen Toggle Button */
.fullscreen-btn {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #ffd700;
    color: #ffd700;
    font-size: 18px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    margin-right: 8px;
    transition: transform 0.2s, background 0.2s;
    z-index: 1000;
}
.fullscreen-btn:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: scale(1.05);
}

/* Force Landscape Mode */
@media screen and (orientation: portrait) {
    body::before {
        content: "Please rotate your device to landscape mode";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.9);
        color: white;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        z-index: 99999;
    }
}

/* Background */
.game-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../../dragontiger/dragontiger_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* Animated Dragon & Tiger Background - HIDDEN by default */
.bg-dragon-animation,
.bg-tiger-animation {
    display: none;
    /* Hidden - will show on betting divs when winning */
}

/* Top Header */
.top-header {
    position: absolute;
    top: 1px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 100;
}

.card-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

/* Side Animated GIFs (Dragon & Tiger) */
.side-gif {
    width: 150px;
    /* 4x larger (70px * 4) */
    height: auto;
    filter: drop-shadow(0 4px 15px rgba(255, 215, 0, 0.6));
    animation: sideGifPulse 2s ease-in-out infinite;
    will-change: transform, opacity;
    transform: translateZ(0);
}

.dragon-gif {
    filter: drop-shadow(0 0 20px rgba(100, 100, 255, 0.9));
}

.tiger-gif {
    filter: drop-shadow(0 0 20px rgba(255, 150, 0, 0.9));
}

@keyframes sideGifPulse {

    0%,
    100% {
        transform: scale(1) translateZ(0);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05) translateZ(0);
        opacity: 1;
    }
}

.card-image {
    width: 55px;
    height: auto;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.7));
    border-radius: 8px;
    transition: all 0.3s ease;
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Fire card back special effect */
.card-image[src*="fire_card.gif"] {
    filter: drop-shadow(0 0 25px rgba(255, 120, 0, 0.9));
    animation: fireGlow 2s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes fireGlow {

    0%,
    100% {
        opacity: 0.9;
        transform: scale(1) translateZ(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.05) translateZ(0);
    }
}

.vs-image {
    width: 55px;
    height: auto;
    filter: drop-shadow(0 4px 15px rgba(255, 215, 0, 0.8));
    animation: pulse 1.5s ease-in-out infinite;
    will-change: transform;
    transform: translateZ(0);
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.game-status {
    display: none;
    /* Hidden */
}

/* History Bar - Visible */
.history-bar {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    /* Show history bar */
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 1px;
    border-radius: 25px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    z-index: 100;
}

.history-items {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 3px;
    overflow-x: auto;
    max-width: 300px;
    max-height: 30px;
    scroll-behavior: smooth;
    /* Hide scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.history-items::-webkit-scrollbar {
    display: none;
}

.history-item {
    min-width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.history-item.tiger {
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
}

.history-item.dragon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.history-item.tie {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    font-size: 9px;
}

/* Latest History Item Highlight (Next to .chart-btn) */
.history-item.latest-history-item {
    border: 2px solid #ffd700;
    box-shadow: 0 0 10px #ffd700;
    animation: latestHistoryPulse 1.2s ease-in-out infinite alternate;
}

@keyframes latestHistoryPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 4px #ffd700;
    }
    100% {
        transform: scale(1.15);
        box-shadow: 0 0 12px #ffd700;
    }
}

.chart-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid #ffd700;
    color: white;
    font-size: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.chart-btn:hover {
    transform: scale(1.1);
}

/* Main Game Container */
.game-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    height: 60%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    z-index: 5;
    /* Behind bottom-bar */
}

/* Sidebar Players */
.left-players,
.right-players {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 65px;
}

.player-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.player-avatar-frame {
    position: relative;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vip-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.player-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.player-balance {
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: bold;
    border: 1px solid #ffd700;
}

.player-name {
    color: white;
    font-size: 8px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.online-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: 3px solid #ffd700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 8px;
}

.online-btn img {
    width: 150%;
    height: 151%;
    object-fit: contain;
}

.online-btn:hover {
    transform: scale(1.1);
}

/* Betting Area */
.betting-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Table Container */
.table-container {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 40px;
    /* add space from bottom */
}

.table-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.bet-header-container {
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.status-image {
    height: 60px;
    width: auto;
    filter: drop-shadow(0 4px 15px rgba(255, 215, 0, 0.8));
}

.betting-boxes {
    position: relative;
    display: flex;
    gap: 15px;
    width: 75%;
    height: 55%;
    z-index: 2;
    margin-top: 50px;
    /* Move down from top */
}

.bet-box {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s;
    border-radius: 15px;
    overflow: visible;
    /* Allow chips flying from avatars to render smoothly outside container bounds */
}

.chips-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}

.chip {
    position: absolute;
    width: 18px; /* 50% of original 35px */
    height: 18px;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    user-select: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
    contain: layout style paint;
}

.bet-box:hover {
    transform: scale(1.02);
}

/* Background Image Wrapper */
.box-bg-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.box-bg-image,
.tie-bg-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Dragon Box Specific */
.dragon-box {
    border: 3px solid #8b7bd8;
}

.dragon-box .box-bg-image {
    opacity: 1;
    /* Fully visible */
}

/* Tiger Box Specific */
.tiger-box {
    border: 3px solid #ff8c00;
}

.tiger-box .box-bg-image {
    opacity: 1;
    /* Fully visible */
}

/* Tie Box Specific - Independent sizing */
.tie-box {
    flex: none;
    /* Remove flex sizing */
    width: 120px;
    /* Fixed width - adjust as needed */
    height: 85%;
    /* Full height from top */
    border: 3px solid #00ff00;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Align from top */
    align-self: flex-start;
    /* Align from top like other boxes */
    padding-bottom: 30px;
    /* Adjust this to reduce bottom space */
    box-sizing: border-box;
    /* Include padding in height calculation */
}

.tie-bg-wrapper {
    opacity: 1;
    /* Fully visible */
}

.tie-bg-image {
    opacity: 1;
    /* Fully visible */
    height: 110%;
    /* Increased height */
    width: 100%;
    /* Maintain aspect ratio */
    object-fit: cover;
    /* Cover the area */
}

/* Top Amount Display (Dragon & Tiger) */
.bet-top-amount {
    position: relative;
    z-index: 3;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    padding: 15px 10px 5px;
}

/* Bottom Info (Dragon & Tiger) */
.bet-bottom-info {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 5px 10px 15px;
    margin-top: auto;
}

.bottom-amount {
    font-size: 24px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.8),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 5px;
}

.bottom-ratio {
    font-size: 32px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.urdu-text {
    font-size: 20px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    margin-bottom: 5px;
    line-height: 1.3;
}

/* Tie Box Layout */
.tie-top {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 15px 10px 5px;
}

.star-icon {
    font-size: 28px;
    margin-bottom: 5px;
    animation: rotate 3s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.tie-ratio-big {
    font-size: 52px;
    font-weight: bold;
    color: white;
    text-shadow:
        0 0 15px rgba(255, 255, 255, 0.9),
        0 0 30px rgba(0, 255, 0, 0.6),
        2px 2px 4px rgba(0, 0, 0, 0.8);
}

.tie-middle {
    position: relative;
    z-index: 3;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.rate-text {
    font-size: 18px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.bet-label-text {
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.tie-bottom-amount {
    position: relative;
    z-index: 3;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
    text-shadow:
        0 0 15px rgba(255, 215, 0, 1),
        2px 2px 4px rgba(0, 0, 0, 0.8);
    padding: 15px 10px;
    margin-top: 1px;
    margin-bottom: auto;
}

.timer-bar {
    width: 80%;
    height: 25px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.timer-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 70%;
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 15px;
    animation: timerProgress 10s linear infinite;
}

@keyframes timerProgress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.timer-icon {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
}

/* Timer Bar in Tie Box */
.timer-bar {
    width: 100%;
    max-width: 120px;
    height: 22px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.timer-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 70%;
    background: linear-gradient(90deg, #ffd700 0%, #ffed4e 100%);
    border-radius: 12px;
    transition: width 1s linear;
}

.timer-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-weight: bold;
    font-size: 14px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Chips Container - Random Absolute Positioning */
.chips-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.chip {
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
    animation: chipDrop 0.5s ease-out;
    pointer-events: none;
    position: absolute !important;
    /* Random positioning will be set via JavaScript */
}

@keyframes chipDrop {
    from {
        transform: translateY(-100px) scale(0) rotate(0deg);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* Bottom Bar */
.bottom-bar {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    height: 52px;
    /* reduced height */
    padding: 6px 25px;
    /* tighter padding */
    z-index: 100;
    /* Front - above game-container */
}

/* Current Player */
.current-player {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.current-avatar-frame {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.current-avatar-frame .vip-frame {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.current-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
    border: 2px solid #ffd700;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.current-balance {
    background: rgba(0, 0, 0, 0.8);
    color: #ffd700;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    border: 1px solid #ffd700;
}

/* Chip Selection */
.chip-selection {
    display: flex;
    gap: 8px;

}

.chip-btn {
    width: 35px;
    height: 35px;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chip-btn img {
    width: 32px;
    height: 32px;
    position: absolute;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.6));
}

.chip-btn:hover {
    transform: translateY(-5px) scale(1.05);
}

.chip-btn.active {
    transform: scale(1.15);
}

.chip-btn.active img {
    filter: drop-shadow(0 6px 20px rgba(56, 239, 125, 0.8));
}

.chip-label {
    display: none;
    /* Hide chip price labels */
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.next-btn,
.menu-btn {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid #ffd700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.next-btn:hover,
.menu-btn:hover {
    transform: scale(1.1);
}

.continue-btn {
    padding: 6px 20px;
    border-radius: 15px;
    border: 2px solid #ffd700;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.continue-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.7);
}

.menu-btn img {
    width: 15px;
    height: 15px;
}

/* Version Info */
.version-info {
    position: absolute;
    bottom: 5px;
    left: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 10px;
}

/* Top Right Menu */
.top-right-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.menu-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid #ffd700;
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.menu-icon:hover {
    transform: rotate(90deg);
}

/* Dragon and Tiger Animations */
.dragon-animation,
.tiger-animation {
    position: absolute;
    width: 200px;
    height: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.dragon-animation {
    top: 50%;
    left: 20%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(102, 126, 234, 0.8) 0%, transparent 70%);
}

.tiger-animation {
    top: 50%;
    right: 20%;
    transform: translate(50%, -50%);
    background: radial-gradient(circle, rgba(255, 107, 53, 0.8) 0%, transparent 70%);
}

.dragon-animation.active,
.tiger-animation.active {
    opacity: 1;
    animation: animalGlow 2s ease-in-out infinite;
}

@keyframes animalGlow {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet Landscape (768px - 1024px) */
@media screen and (max-width: 1024px) and (orientation: landscape) {

    .bg-dragon-animation,
    .bg-tiger-animation {
        width: 250px;
        height: 250px;
        top: 10%;
    }

    .betting-boxes {
        height: 205px;
        width: 415px;
    }

    .bet-amount {
        font-size: 22px;
        top: 25px;
    }

    .ratio-value {
        font-size: 24px;
    }

    .chip-btn {
        width: 60px;
        height: 60px;
    }

    .chip-btn img {
        width: 55px;
        height: 55px;
    }

    .table-frame {
        max-width: 750px;
    }

    /* Chip size — tablet landscape */
    .chip {
        width: 28px;
        height: 28px;
    }
}

/* Mobile Landscape (480px - 768px) */
@media screen and (max-width: 768px) and (orientation: landscape) {

    .bg-dragon-animation,
    .bg-tiger-animation {
        width: 180px;
        height: 180px;
        top: 15%;
    }

    .bg-dragon-animation {
        left: 2%;
    }

    .bg-tiger-animation {
        right: 2%;
    }

    .betting-boxes {
        height: 200px;
        max-width: 600px;
        gap: 10px;
    }

    .bet-amount {
        font-size: 18px;
        top: 20px;
    }

    .ratio-text {
        font-size: 16px;
    }

    .ratio-value {
        font-size: 20px;
    }

    .tie-ratio {
        font-size: 36px;
    }

    .chip-btn {
        width: 50px;
        height: 50px;
    }

    .chip-btn img {
        width: 40px;
        height: 40px;
    }

    .player-avatar {
        width: 40px;
        height: 40px;
    }

    .current-avatar {
        width: 35px;
        height: 35px;
    }

    .left-players,
    .right-players {
        width: 100px;
        gap: 10px;
    }

    .player-name {
        font-size: 9px;
    }

    .player-balance {
        font-size: 10px;
        padding: 2px 8px;
    }

    .history-bar {
        padding: 1px 6px;
    }

    .history-item {
        min-width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .game-status {
        font-size: 12px;
        padding: 4px 15px;
    }

    .table-frame {
        max-width: 650px;
    }

    .status-image {
        height: 50px;
    }

    .vs-graphic {
        width: 350px;
    }

    /* Chip size — mobile landscape (480–768px) */
    .chip {
        width: 20px;
        height: 20px;
    }
}

/* Small Mobile Landscape (< 480px) */
@media screen and (max-width: 480px) and (orientation: landscape) {

    .bg-dragon-animation,
    .bg-tiger-animation {
        width: 120px;
        height: 120px;
        top: 20%;
    }

    .betting-boxes {
        height: 160px;
        max-width: 450px;
        gap: 8px;
    }

    .bet-amount {
        font-size: 14px;
        top: 15px;
    }

    .ratio-text {
        font-size: 12px;
    }

    .ratio-value {
        font-size: 16px;
    }

    .tie-ratio {
        font-size: 28px;
    }

    .bet-label {
        font-size: 12px;
    }

    .chip-btn {
        width: 45px;
        height: 45px;
    }

    .chip-btn img {
        width: 40px;
        height: 40px;
    }

    .chip-label {
        font-size: 7px;
        bottom: -15px;
    }

    .continue-btn {
        padding: 8px 25px;
        font-size: 14px;
    }

    .next-btn,
    .menu-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .left-players,
    .right-players {
        width: 80px;
        gap: 8px;
    }

    .player-avatar {
        width: 40px;
        height: 40px;
    }

    .current-avatar {
        width: 50px;
        height: 50px;
    }

    .player-avatar-frame,
    .current-avatar-frame {
        width: 50px;
        height: 50px;
    }

    .card-image {
        width: 60px;
    }

    .vs-image {
        width: 80px;
    }

    .status-image {
        height: 40px;
    }

    .vs-graphic {
        width: 250px;
    }

    /* Chip size — small mobile landscape (<480px) */
    .chip {
        width: 18px;
        height: 18px;
    }
}

/* Portrait Mode - Show Rotate Message */
@media screen and (orientation: portrait) {
    body::after {
        content: "🔄 Please rotate your device to LANDSCAPE mode for the best experience! 📱→📱";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.95);
        color: #ffd700;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        font-weight: bold;
        text-align: center;
        z-index: 99999;
        padding: 20px;
        line-height: 1.6;
    }

    .game-container,
    .betting-area,
    .bottom-bar,
    .top-header {
        display: none;
    }
}

/* Loading Animation */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.loading {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ========================================
   VIDEO-BASED ANIMATIONS
   ======================================== */

/* ========================================
   SYSTEM MESSAGE ANIMATIONS (VIDEO SPEC)
   ======================================== */

/* VS Graphic - Zoom In/Out Flash (0.5-1.0s) */
.vs-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: vsFlash 1s ease-out forwards;
}

.vs-graphic {
    width: 600px;
    height: auto;
    animation: vsZoomInOut 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    filter: drop-shadow(0 0 40px rgba(255, 180, 0, 0.9));
    will-change: transform, opacity;
}

@keyframes vsFlash {
    0% {
        opacity: 0;
        background: rgba(255, 255, 255, 0.5);
    }

    10% {
        opacity: 1;
        background: rgba(0, 0, 0, 0.9);
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes vsZoomInOut {
    0% {
        transform: scale(0.3) rotate(-10deg) translateZ(0);
        opacity: 0;
    }

    40% {
        transform: scale(1.2) rotate(0deg) translateZ(0);
        opacity: 1;
    }

    60% {
        transform: scale(1.1) rotate(0deg) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(5deg) translateZ(0);
        opacity: 0;
    }
}

/* ========================================
   MESSAGE IMAGES (1 Second Show/Hide)
   ======================================== */

/* Common Message Image Style */
.message-image-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: messageFlash 1s ease-out forwards;
    will-change: opacity;
}

.message-image {
    max-width: 400px;
    height: auto;
    animation: messageZoom 1s cubic-bezier(0.68, -0.55, 0.27, 1.55) forwards;
    filter: drop-shadow(0 0 35px rgba(255, 200, 0, 0.9));
    will-change: transform, opacity;
}

@keyframes messageFlash {
    0% {
        opacity: 0;
        background: rgba(255, 255, 255, 0.3);
    }

    10% {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }

    90% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

@keyframes messageZoom {
    0% {
        transform: scale(0.3) rotate(-5deg);
        opacity: 0;
    }

    40% {
        transform: scale(1.1) rotate(0deg);
        opacity: 1;
    }

    60% {
        transform: scale(1.05) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(3deg);
        opacity: 0;
    }
}

/* Winner Burst Effect - Intense Glow (ONLY ON WINNER) */
.winner-burst {
    opacity: 1 !important;
    animation: burstGlow 0.8s ease-out infinite;
    filter: drop-shadow(0 0 50px rgba(255, 215, 0, 1)) !important;
    transform: scale(1.2) translateZ(0);
    will-change: transform, opacity;
}

@keyframes burstGlow {

    0%,
    100% {
        opacity: 1;
        transform: scale(1.2) translateZ(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.3) translateZ(0);
    }
}

/* Winner Glow on Betting Box */
.winner-glow {
    animation: boxGlow 0.5s ease-in-out infinite;
    position: relative;
    will-change: box-shadow;
}

/* TEMP DISABLED: rotating gold gradient ring */
.winner-glow::before {
    display: none; /* arzi tor per band */
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, #ffd700, #ff6b35, #ffd700);
    border-radius: 20px;
    z-index: -1;
    animation: rotateGlow 2s linear infinite;
    opacity: 0.8;
}

/* Winner GIF Overlay on Betting Div */
.winner-gif-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 10;
    pointer-events: none;
    animation: winnerGifPulse 1.5s ease-in-out infinite;
    will-change: transform, opacity;
}

.dragon-box .winner-gif-overlay {
    background-image: url('../../dragontiger/gif_dragon_animated.gif');
}

.tiger-box .winner-gif-overlay {
    background-image: url('../../dragontiger/gif_tiger_animated.gif');
}

@keyframes winnerGifPulse {

    0%,
    100% {
        opacity: 0.9;
        transform: scale(1) translateZ(0);
    }

    50% {
        opacity: 1;
        transform: scale(1.05) translateZ(0);
    }
}

@keyframes boxGlow {

    0%,
    100% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8),
            0 0 60px rgba(255, 215, 0, 0.6),
            0 0 90px rgba(255, 215, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 50px rgba(255, 215, 0, 1),
            0 0 100px rgba(255, 215, 0, 0.8),
            0 0 150px rgba(255, 215, 0, 0.6);
    }
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg) translateZ(0);
    }

    to {
        transform: rotate(360deg) translateZ(0);
    }
}

/* Card Flip Animation */
.card-flip {
    animation: cardFlip 0.6s ease-in-out;
    will-change: transform;
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg) scale(1);
    }

    50% {
        transform: rotateY(90deg) scale(1.1);
    }

    100% {
        transform: rotateY(0deg) scale(1);
    }
}

/* ========================================
   CHIP ANIMATIONS (USER + RANDOM PLAYERS)
   ======================================== */

/* User's Own Chip - Fast Parabolic Arc (0.2s) */
.chip-user {
    animation: chipUserArc 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}

@keyframes chipUserArc {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(1) translateZ(0);
        opacity: 1;
    }

    50% {
        transform: translateY(-80px) translateX(0) rotate(180deg) scale(1.1) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: translateY(0) translateX(0) rotate(360deg) scale(1) translateZ(0);
        opacity: 1;
    }
}

/* Random Floating Chips - Multiple Paths */
.chip-random-1 {
    animation: chipRandomPath1 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}

.chip-random-2 {
    animation: chipRandomPath2 0.9s cubic-bezier(0.34, 0.56, 0.64, 1) forwards;
    will-change: transform, opacity;
}

.chip-random-3 {
    animation: chipRandomPath3 0.7s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
    will-change: transform, opacity;
}

@keyframes chipRandomPath1 {
    0% {
        transform: translate(-200px, 300px) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 0;
    }

    60% {
        opacity: 1;
    }

    100% {
        transform: translate(0, 0) rotate(540deg) scale(1) translateZ(0);
        opacity: 1;
    }
}

@keyframes chipRandomPath2 {
    0% {
        transform: translate(200px, 350px) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 0;
    }

    60% {
        opacity: 1;
    }

    100% {
        transform: translate(0, 0) rotate(-540deg) scale(1) translateZ(0);
        opacity: 1;
    }
}

@keyframes chipRandomPath3 {
    0% {
        transform: translate(0, 400px) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 0;
    }

    60% {
        opacity: 1;
    }

    100% {
        transform: translate(0, 0) rotate(720deg) scale(1) translateZ(0);
        opacity: 1;
    }
}

/* Enhanced Chip Drop with Parabolic Trajectory */
.chip-flying {
    animation: chipFly 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform, opacity;
}

@keyframes chipFly {
    0% {
        transform: translateY(-200px) translateX(0) rotate(0deg) scale(0.5) translateZ(0);
        opacity: 0;
    }

    40% {
        transform: translateY(-50px) translateX(20px) rotate(180deg) scale(1) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: translateY(0) translateX(0) rotate(720deg) scale(1) translateZ(0);
        opacity: 1;
    }
}

/* ========================================
   PARTICLE BURST EFFECTS (WINNING)
   ======================================== */

/* Gold/Fire Particles Container */
.particle-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

/* Individual Particles */
.particle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ffd700 0%, #ff8c00 100%);
    border-radius: 50%;
    box-shadow: 0 0 10px #ffd700, 0 0 20px #ff8c00;
    animation: particleExplode 1.5s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes particleExplode {
    0% {
        transform: translate(0, 0) scale(0) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(1) translateZ(0);
        opacity: 0;
    }
}

/* Confetti Particles */
.confetti-particle {
    position: absolute;
    width: 8px;
    height: 16px;
    background: linear-gradient(45deg, #ffd700, #ff6b35, #00ff00, #00ffff);
    animation: confettiFall 2s ease-out forwards;
    will-change: transform, opacity;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: translateY(500px) rotate(720deg) translateZ(0);
        opacity: 0;
    }
}

/* ========================================
   CHIP SETTLEMENT ANIMATIONS
   ======================================== */

/* Losing Chips - Vacuum Effect (0.5s) */
.chip-vacuum {
    animation: chipVacuumUp 0.5s cubic-bezier(0.55, 0.09, 0.68, 0.53) forwards;
    will-change: transform, opacity;
}

@keyframes chipVacuumUp {
    0% {
        transform: translateY(0) scale(1) rotate(0deg) translateZ(0);
        opacity: 1;
    }

    100% {
        transform: translateY(-500px) scale(0.3) rotate(1080deg) translateZ(0);
        opacity: 0;
    }
}

/* Winning Chips - Float to Balance */
.chip-win-float {
    animation: chipWinFloat 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    will-change: transform, opacity;
}

@keyframes chipWinFloat {
    0% {
        transform: translate(0, 0) scale(1) translateZ(0);
        opacity: 1;
    }

    70% {
        opacity: 1;
    }

    100% {
        transform: translate(-500px, 300px) scale(0.5) translateZ(0);
        opacity: 0;
    }
}

/* Balance Count-Up Animation */
.balance-counting {
    animation: balanceGlow 0.5s ease-in-out 3;
    color: #00ff00 !important;
}

@keyframes balanceGlow {

    0%,
    100% {
        text-shadow: 0 0 10px rgba(0, 255, 0, 0.8);
        transform: scale(1);
    }

    50% {
        text-shadow: 0 0 30px rgba(0, 255, 0, 1);
        transform: scale(1.15);
    }
}

/* Urgent Timer Pulse */
@keyframes urgentPulse {

    0%,
    100% {
        transform: scale(1);
        color: #ff0000;
    }

    50% {
        transform: scale(1.2);
        color: #ffff00;
        text-shadow: 0 0 20px rgba(255, 0, 0, 0.8);
    }
}

/* Chip Collection/Vacuum Effect */
@keyframes chipVacuum {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    to {
        transform: translateY(-200px) translateX(-100px) scale(0);
        opacity: 0;
    }
}

/* Balance Update Pop Animation */
@keyframes balancePop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

.balance-update {
    animation: balancePop 0.5s ease-out;
    color: #00ff00;
}

/* Particle Burst Effect (For future enhancement) */
@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* ========================================
   AUTH MODAL STYLING
   ======================================== */

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-box {
    position: relative;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 25px 30px;
    width: 320px;
    text-align: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    color: white;
}

.auth-box h2 {
    font-size: 20px;
    color: #ffd700;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.auth-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-inputs input {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #ffd700;
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 14px;
    outline: none;
}

.auth-inputs input:focus {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-btn {
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: bold;
    font-size: 13px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.auth-btn:hover {
    transform: scale(1.03);
}

.login-btn {
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    color: #1a1a2e;
}

.register-btn {
    background: linear-gradient(90deg, #11998e, #38ef7d);
    color: white;
}

.guest-btn {
    background: linear-gradient(90deg, #667eea, #764ba2);
    color: white;
}

.auth-close-btn {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #ff6b6b;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
}

/* ========================================
   CONNECTING TO SERVER OVERLAY
   ======================================== */

.connecting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
}

.connecting-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #ffd700;
    text-align: center;
    padding: 30px 40px;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.9) 0%, rgba(22, 33, 62, 0.9) 100%);
    border: 2px solid #ffd700;
    border-radius: 16px;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.5);
}

.connecting-box h2 {
    font-size: 22px;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
    margin: 0;
}

.connecting-box p {
    font-size: 13px;
    color: #cccccc;
    margin: 0;
}

.connecting-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 215, 0, 0.2);
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: connectingSpin 1s linear infinite;
}

@keyframes connectingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}