/* 🌟 ULTIMATE SHARED LUDO BOARD STYLES 🌟 */
:root {
    --color-red: #ef4444;
    --color-blue: #3b82f6;
    --color-green: #22c55e;
    --color-yellow: #eab308;
    --board-size: 540px;
}

/* The Wooden Frame */
.board-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #5b2a00; /* Rich Wood */
    border-radius: 20px;
    padding: 20px;
    box-shadow: 
        0 20px 50px rgba(0,0,0,0.6),
        inset 0 0 20px rgba(0,0,0,0.5);
    width: fit-content;
    height: fit-content;
    user-select: none;
}

/* The Board Grid */
.ludo-board {
    width: var(--board-size);
    height: var(--board-size);
    background: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 20.5V18H0v-2h20v-2H0v-2h20v-2H0V8h20V6H0V4h20V2H0V0h22v20h2V0h2v20h2V0h2v20h2V0h2v20h2V0h2v20h2v2H20v-1.5zM0 20h2v20H0V20zm4 0h2v20H4V20zm4 0h2v20H8V20zm4 0h2v20h-2V20zm4 0h2v20h-2V20zm4 4h20v2H20v-2zm0 4h20v2H20v-2zm0 4h20v2H20v-2zm0 4h20v2H20v-2z' fill='%23000000' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
    border: 4px solid #1f2937;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

.path-cell {
    border: 1px solid rgba(0,0,0,0.15);
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Solid Vibrant Path Colors */
.path-red { background-color: var(--color-red); }
.path-green { background-color: var(--color-green); }
.path-blue { background-color: var(--color-blue); }
.path-yellow { background-color: var(--color-yellow); }

/* Start Tile Coloring (Position 0) - More specific to win over .path-cell */
.ludo-board .path-cell.start-red { background-color: var(--color-red) !important; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }
.ludo-board .path-cell.start-green { background-color: var(--color-green) !important; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }
.ludo-board .path-cell.start-blue { background-color: var(--color-blue) !important; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }
.ludo-board .path-cell.start-yellow { background-color: var(--color-yellow) !important; box-shadow: inset 0 0 10px rgba(0,0,0,0.2); }

/* Start Arrows - Consistent Triangle Sizes */
.arrow-up, .arrow-down, .arrow-left, .arrow-right {
    width: 0; height: 0;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.arrow-up, .arrow-down {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
}
.arrow-up { border-bottom: 20px solid white; }
.arrow-down { border-top: 20px solid white; }

.arrow-left, .arrow-right {
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
}
.arrow-left { border-right: 20px solid white; }
.arrow-right { border-left: 20px solid white; }

.safe-star {
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4));
    pointer-events: none;
    z-index: 2;
    color: #ffd700;
}

/* Bases */
.base-container {
    border: 2px solid #1f2937;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.1);
}

.base-red { background: var(--color-red); grid-area: 10 / 1 / 16 / 7; }
.base-green { background: var(--color-green); grid-area: 1 / 1 / 7 / 7; }
.base-blue { background: var(--color-blue); grid-area: 1 / 10 / 7 / 16; }
.base-yellow { background: var(--color-yellow); grid-area: 10 / 10 / 16 / 16; }

.base-inner-box {
    width: 70%;
    height: 70%;
    background: #ffffff;
    border-radius: 15%;
    padding: 12%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 15%;
    box-shadow: 
        0 4px 10px rgba(0,0,0,0.2),
        inset 0 2px 5px rgba(0,0,0,0.1);
    place-items: center;
}

.base-slot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: visible;
}

.base-red .base-slot { background: var(--color-red); }
.base-green .base-slot { background: var(--color-green); }
.base-blue .base-slot { background: var(--color-blue); }
.base-yellow .base-slot { background: var(--color-yellow); }

.base-slot-inner {
    width: 80%;
    height: 80%;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.3);
    position: relative;
}

/* Center Finish */
.center-container {
    grid-area: 7 / 7 / 10 / 10;
    position: relative;
    background: conic-gradient(
        var(--color-blue) 45deg,
        var(--color-yellow) 45deg 135deg,
        var(--color-red) 135deg 225deg,
        var(--color-green) 225deg 315deg,
        var(--color-blue) 315deg
    );
    border: 2px solid #1f2937;
    z-index: 5;
    box-shadow: 0 0 25px rgba(0,0,0,0.3);
    overflow: hidden;
}

.center-container::before {
    content: 'FINISH';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-family: var(--brand-font);
    font-weight: 900;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-muted);
}

.dtp-badge {
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

/* TOKENS - Premium Glow and 3D look */
.token {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    border: 2.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 6px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 900;
    color: white;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: absolute;
    inset: 0;
    margin: auto !important;
    pointer-events: auto;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.token.won {
    width: 22px;
    height: 22px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.6);
    z-index: 20;
    margin: 0 !important;
    right: auto;
    bottom: auto;
}

.token.red { background: radial-gradient(circle at 30% 30%, #ff8888, var(--color-red), #880000); }
.token.blue { background: radial-gradient(circle at 30% 30%, #88bbff, var(--color-blue), #0033aa); }
.token.green { background: radial-gradient(circle at 30% 30%, #88ffaa, var(--color-green), #006622); }
.token.yellow { background: radial-gradient(circle at 30% 30%, #ffffaa, var(--color-yellow), #aa7700); }

.token.valid-target {
    cursor: pointer;
    animation: bounceTarget 1.2s infinite alternate;
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.9);
}

@keyframes bounceTarget {
    from { transform: translateY(0px) scale(1.05); box-shadow: 0 0 15px var(--primary-color); }
    to { transform: translateY(-8px) scale(1.15); box-shadow: 0 0 30px var(--primary-color); }
}

/* DTP Protection Highlight (Stacks) */
.token:nth-child(n+2) {
    box-shadow: 0 0 15px 5px rgba(255, 255, 255, 0.4), 0 6px 12px rgba(0,0,0,0.5);
    border: 3px solid #fff !important;
}

.path-cell:has(.token:nth-child(n+2))::after {
    content: '🛡️';
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.8rem;
    z-index: 15;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.8));
}

/* --- Dice Animation --- */
@keyframes diceSpin {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.1); }
    50% { transform: rotate(180deg) scale(1.2); }
    75% { transform: rotate(270deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.dice-rolling {
    animation: diceSpin 0.6s ease-in-out infinite;
}

.player-marker { 
    position: absolute; 
    font-weight: 800; 
    font-size: 1.2rem; 
    padding: 6px 16px; 
    border-radius: 12px; 
    background: rgba(0,0,0,0.7); 
    backdrop-filter: blur(10px); 
    z-index: 100; 
    display: none; 
    color: white; 
    text-shadow: 0 2px 4px rgba(0,0,0,0.9); 
    border: 1px solid rgba(255,255,255,0.1);
}

.p-top-left { top: -40px; left: 0; color: #4ade80; }
.p-top-right { top: -40px; right: 0; color: #60a5fa; }
.p-bottom-left { bottom: -40px; left: 0; color: #f87171; }
.p-bottom-right { bottom: -40px; right: 0; color: #fbbf24; }
