/* Xúc Xắc Game Styles (derived from Bầu Cua) */

.xucxac-container {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: stretch;
}

.history-panel {
    flex: 1;
    min-width: 250px;
    height: 650px;
    /* Fixed height bounds to enforce scroll overflow */
    display: flex;
    flex-direction: column;
}

.game-board {
    flex: 3;
    min-width: 300px;
    height: 650px;
    /* Match height */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Plate and Bowl 3D Design */
.table-area {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

.plate {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffffff 0%, #f0f0f0 70%, #d8d8d8 90%, #bbbbbb 100%);
    box-shadow:
        inset 0 5px 10px rgba(255, 255, 255, 0.9),
        0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    border: 1px solid #d0d0d0;
}

.plate-inner {
    width: 78%;
    height: 78%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, #f9f9f9 0%, #e0e0e0 70%, #cccccc 100%);
    box-shadow: inset 0 10px 30px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* The 3 Dice */
.dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    width: 250px;
}

.dice {
    width: 80px;
    height: 80px;
    background: #fff;
    border-radius: 14px;
    box-shadow:
        inset -4px -4px 10px rgba(0, 0, 0, 0.15),
        inset 4px 4px 12px rgba(255, 255, 255, 1),
        0 12px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid #f0f0f0;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 12px;
}

/* Dots inside the dice */
.dot {
    background-color: #2c3e50;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    margin: auto;
    box-shadow: inset 0px 2px 4px rgba(0, 0, 0, 0.6), 0px 1px 1px rgba(255, 255, 255, 0.8);
}

.dot.red {
    background-color: #e74c3c;
}

/* Dot grid positions */
.dot-c {
    grid-column: 2;
    grid-row: 2;
}

.dot-tl {
    grid-column: 1;
    grid-row: 1;
}

.dot-tr {
    grid-column: 3;
    grid-row: 1;
}

.dot-ml {
    grid-column: 1;
    grid-row: 2;
}

.dot-mr {
    grid-column: 3;
    grid-row: 2;
}

.dot-bl {
    grid-column: 1;
    grid-row: 3;
}

.dot-br {
    grid-column: 3;
    grid-row: 3;
}

/* Large red dot for face 1 */
.dot.huge {
    width: 24px;
    height: 24px;
}


/* The Bowl */
.bowl {
    position: absolute;
    top: 11%;
    left: 11%;
    width: 78%;
    height: 78%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #c3c3c3 40%, #646464 80%, #565656 100%);
    box-shadow:
        inset 20px 20px 40px rgba(255, 255, 255, 0.3),
        inset -20px -30px 40px rgba(0, 0, 0, 0.5),
        0 15px 30px rgba(0, 0, 0, 0.6),
        0 35px 50px rgba(0, 0, 0, 0.3);
    z-index: 2;
    transform-origin: center center;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.5s ease-in-out;
}

/* The bottom base of the bowl (đáy tô) pointing up towards camera */
.bowl::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32%;
    height: 32%;
    border-radius: 50%;
    background: transparent;
    border: 6px solid rgba(0, 0, 0, 0.25);
    box-shadow:
        inset 0 10px 15px rgba(0, 0, 0, 0.6),
        0 -3px 5px rgba(255, 255, 255, 0.3),
        0 5px 15px rgba(0, 0, 0, 0.5);
}

.bowl.lifted {
    transform: translateY(-200px) scale(0.9);
    opacity: 0;
    pointer-events: none;
}

/* Shake Animation */
@keyframes shake-bowl {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    10% {
        transform: translate(-10px, -5px) rotate(-3deg);
    }

    20% {
        transform: translate(10px, 5px) rotate(3deg);
    }

    30% {
        transform: translate(-15px, 10px) rotate(-5deg);
    }

    40% {
        transform: translate(15px, -10px) rotate(5deg);
    }

    50% {
        transform: translate(-10px, 0px) rotate(-3deg);
    }

    60% {
        transform: translate(10px, 5px) rotate(3deg);
    }

    70% {
        transform: translate(-5px, -5px) rotate(-2deg);
    }

    80% {
        transform: translate(5px, 5px) rotate(2deg);
    }

    90% {
        transform: translate(-2px, 0px) rotate(-1deg);
    }

    100% {
        transform: translate(0, 0) rotate(0deg);
    }
}

.shake {
    animation: shake-bowl 0.6s infinite ease-in-out;
}

/* History List */
.history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.history-round {
    font-size: 0.9em;
    color: #bbb;
}

.history-faces {
    display: flex;
    gap: 6px;
}

/* Mini dice for history & stats */
.history-dice {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 5px;
    padding: 3px;
    box-shadow: inset -1px -1px 3px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.mini-dot {
    background-color: #2c3e50;
    border-radius: 50%;
    width: 5px;
    height: 5px;
    margin: auto;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.4);
}

.mini-dot.red {
    background-color: #e74c3c;
}

/* Mini dot grid positions */
.mini-c  { grid-column: 2; grid-row: 2; }
.mini-tl { grid-column: 1; grid-row: 1; }
.mini-tr { grid-column: 3; grid-row: 1; }
.mini-ml { grid-column: 1; grid-row: 2; }
.mini-mr { grid-column: 3; grid-row: 2; }
.mini-bl { grid-column: 1; grid-row: 3; }
.mini-br { grid-column: 3; grid-row: 3; }

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Tài / Xỉu Stats Badges */
.taixiu-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.2s ease;
}

.taixiu-badge:hover {
    transform: scale(1.05);
}

.taixiu-tai {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.3);
}

.taixiu-xiu {
    background: rgba(52, 152, 219, 0.15);
    border-color: rgba(52, 152, 219, 0.3);
}

.taixiu-label {
    letter-spacing: 1px;
}

.taixiu-tai .taixiu-label {
    color: #e74c3c;
}

.taixiu-xiu .taixiu-label {
    color: #3498db;
}

.taixiu-count {
    font-size: 1.2em;
    font-weight: 700;
    color: #fff;
}

.taixiu-pct {
    font-size: 0.8em;
    color: #999;
}