* {
    box-sizing: border-box;
}

.ludo-container {
    width: 450px;
    margin: 80px auto;
    position: relative;
    background-color: #999;
}

.ludo-container .ludo {

    height: 450px;
    width: 100%;
    background-image: url('./ludo-bg.jpg');
    background-size: contain;
    position: relative;
}

.player-pieces {
    height: 100%;
    width: 100%;
}

.player-piece {
    width: 3%;
    height: 3%;
    border: 2px solid;
    border-radius: 50%;
    position: absolute;
    transform: translate(50%, 50%);
    transition: all .2s;

    z-index: 1;
}
.player-piece.highlight {
    cursor: pointer;
    border: 2px dashed;
    animation: spin 1s infinite linear;
}
@keyframes spin {
    0% {
        transform: translate(50%, 50%) rotate(0deg);
    }
    50% {
        transform: translate(50%, 50%) rotate(180deg) scale(1.4);
    }
    100% {
        transform: translate(50%, 50%) rotate(360deg);
    }
}

[player-id="P1"].player-piece {
    background-color: #2eafff;
}

[player-id="P2"].player-piece {
    background-color: #e05810;
}

[player-id="P3"].player-piece {
    background-color: #049645;
}

[player-id="P4"].player-piece {
    background-color: #e6c700;
}

.player-piece.hidden {
    display: none;
}

.player-base {
    width: 40%;
    height: 40%;
    border: 30px solid;
    position: absolute;
}

.player-bases [player-id="P1"].player-base {
    bottom: 0;
    left: 0;
    border-color: #1295e7;
}

.player-bases [player-id="P2"].player-base {
    bottom: 0;
    right: 0;
    border-color: #e05810;
}

.player-bases [player-id="P3"].player-base {
    top: 0;
    right: 0;
    border-color: #049645;
}

.player-bases [player-id="P4"].player-base {
    top: 0;
    left: 0;
    border-color: #c5a800;
}

.player-base.hidden {
    display: none;
}

.player-base.highlight {
    animation: border-blink .7s infinite ease-in-out;
}

@keyframes border-blink {
    50% {
        border-color: rgba(255, 255, 255, 0.8);
    }
}

.btn {
    padding: 8px 20px;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
}

.btn-dice {
    width: 56px;
    height: 56px;
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.countdown-ring {
    position: absolute;
    inset: -6px;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    transform: rotate(-90deg);
    pointer-events: none;
    opacity: 0;
}

.countdown-ring circle {
    fill: none;
    stroke: #e74c3c;
    stroke-width: 3;
    stroke-dasharray: 175.93;
    stroke-dashoffset: 0;
    stroke-linecap: round;
}

.btn-dice.countdown .countdown-ring {
    opacity: 1;
}

.btn-dice.countdown .countdown-ring circle {
    animation: countdown-dash 20s linear forwards;
}

@keyframes countdown-dash {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: 175.93; }
}

.btn-dice:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dice-loader {
    width: 40px;
    height: 40px;
    display: none;
}

.btn-dice.loading .dice-loader {
    display: block;
}

.btn-dice.loading .dice-face {
    display: none;
}

.dice-face {
    width: 44px;
    height: 44px;
    position: relative;
    display: block;
}

.dice-face .dot {
    width: 9px;
    height: 9px;
    background-color: #333;
    border-radius: 50%;
    position: absolute;
    display: none;
}

/* 1 - center */
.dice-face[data-value="1"] .dot:nth-child(1) {
    display: block;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}

/* 2 - top-right, bottom-left */
.dice-face[data-value="2"] .dot:nth-child(1) {
    display: block;
    top: 6px; right: 6px;
}
.dice-face[data-value="2"] .dot:nth-child(2) {
    display: block;
    bottom: 6px; left: 6px;
}

/* 3 - top-right, center, bottom-left */
.dice-face[data-value="3"] .dot:nth-child(1) {
    display: block;
    top: 6px; right: 6px;
}
.dice-face[data-value="3"] .dot:nth-child(2) {
    display: block;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="3"] .dot:nth-child(3) {
    display: block;
    bottom: 6px; left: 6px;
}

/* 4 - all corners */
.dice-face[data-value="4"] .dot:nth-child(1) {
    display: block;
    top: 6px; left: 6px;
}
.dice-face[data-value="4"] .dot:nth-child(2) {
    display: block;
    top: 6px; right: 6px;
}
.dice-face[data-value="4"] .dot:nth-child(3) {
    display: block;
    bottom: 6px; left: 6px;
}
.dice-face[data-value="4"] .dot:nth-child(4) {
    display: block;
    bottom: 6px; right: 6px;
}

/* 5 - all corners + center */
.dice-face[data-value="5"] .dot:nth-child(1) {
    display: block;
    top: 6px; left: 6px;
}
.dice-face[data-value="5"] .dot:nth-child(2) {
    display: block;
    top: 6px; right: 6px;
}
.dice-face[data-value="5"] .dot:nth-child(3) {
    display: block;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
}
.dice-face[data-value="5"] .dot:nth-child(4) {
    display: block;
    bottom: 6px; left: 6px;
}
.dice-face[data-value="5"] .dot:nth-child(5) {
    display: block;
    bottom: 6px; right: 6px;
}

/* 6 - 3 left, 3 right */
.dice-face[data-value="6"] .dot:nth-child(1) {
    display: block;
    top: 6px; left: 6px;
}
.dice-face[data-value="6"] .dot:nth-child(2) {
    display: block;
    top: 6px; right: 6px;
}
.dice-face[data-value="6"] .dot:nth-child(3) {
    display: block;
    top: 50%; left: 6px;
    transform: translateY(-50%);
}
.dice-face[data-value="6"] .dot:nth-child(4) {
    display: block;
    top: 50%; right: 6px;
    transform: translateY(-50%);
}
.dice-face[data-value="6"] .dot:nth-child(5) {
    display: block;
    bottom: 6px; left: 6px;
}
.dice-face[data-value="6"] .dot:nth-child(6) {
    display: block;
    bottom: 6px; right: 6px;
}

.player-area {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.player-area.active {
    opacity: 1;
    pointer-events: auto;
}

.player-area.hidden {
    display: none;
}

.player-area-P1 {
    bottom: -70px;
    left: 0;
}

.player-area-P2 {
    bottom: -70px;
    right: 0;
}

.player-area-P3 {
    top: -70px;
    right: 0;
}

.player-area-P4 {
    top: -70px;
    left: 0;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-label {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.player-area-P1 .player-label {
    color: #1295e7;
}

.player-area-P2 .player-label {
    color: #e05810;
}

.player-area-P3 .player-label {
    color: #049645;
}

.player-area-P4 .player-label {
    color: #c5a800;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-title {
    font-size: 32px;
    font-weight: 800;
    color: #333;
    margin: 0 0 6px;
}

.modal-subtitle {
    font-size: 16px;
    color: #666;
    margin: 0 0 28px;
}

.modal-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    cursor: pointer;
    font-size: 17px;
    font-weight: 600;
    color: #333;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    background: #2eafff;
    color: #fff;
    border-color: #2eafff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 175, 255, 0.3);
}

.modal-btn-icon {
    font-size: 22px;
}

.modal-btn-sub {
    font-size: 13px;
    font-weight: 400;
    opacity: 0.7;
}
