:root {
    --board-size: 600px;
    --square-size: calc(var(--board-size) / 10);

    /* Thematic Color Palette */
    --bg-color: #211e1c;
    --panel-bg: #3a3532;
    --border-color: #000;
    --text-color: #e0e0e0;
    --text-muted: #b0a9a4;

    --light-square: #e9d9b6;
    /* Warmer cream */
    --dark-square: #a98865;
    /* Warmer brown */

    --life-color: #4caf50;
    /* Vibrant Green */
    --death-color: #9e9e9e;

    --status-available: #81c784;
    --status-used: #e57373;
    --status-unavailable: #757575;

    --highlight-select: rgba(135, 206, 250, 0.4);
    --highlight-move: rgba(46, 139, 87, 0.6);
    /* SeaGreen, more opaque */
    --highlight-attack: rgba(255, 160, 122, 0.6);
    --highlight-special: rgba(173, 216, 230, 0.6);

    --font-main: 'Lato', sans-serif;
    --font-display: 'Merriweather', serif;
}

body {
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--bg-color);
    background: radial-gradient(ellipse at center, #3f3a36 0%, var(--bg-color) 70%);
    color: var(--text-color);
    margin: 0;
}

#game-container {
    display: flex;
    gap: 30px;
    align-items: center;
    padding: 20px;
}

#ui-panel {
    width: 280px;
    text-align: center;
    background-color: var(--panel-bg);
    padding: 20px;
    border-radius: 8px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

#ui-panel h1 {
    font-family: var(--font-display);
    margin-top: 0;
    margin-bottom: 25px;
    font-weight: 700;
    color: var(--text-color);
}

#status-panel {
    text-align: left;
}

#turn-status-container p {
    margin: 12px 0;
    font-size: 0.95em;
    color: var(--text-muted);
}

#turn-status-container span {
    font-weight: bold;
}

.status-available {
    color: var(--status-available);
}

.status-used {
    color: var(--status-used);
}

.status-unavailable {
    color: var(--status-unavailable);
}


#info-box {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #524c47;
}

#info-box p {
    margin: 0;
    font-style: italic;
    color: var(--text-muted);
    min-height: 4em;
    /* Reserve space to prevent layout shifts */
}


#player-turn {
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

#player-turn.white {
    background-color: #f0f0f0;
    color: black;
}

#player-turn.black {
    background-color: black;
    color: white;
}

#board-container {
    border: 5px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    position: relative;
}

#board-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(66, 66, 66, 0.7);
    transform: translateY(-50%);
    z-index: 3;
    pointer-events: none;
}


#game-board {
    width: var(--board-size);
    height: var(--board-size);
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    position: relative;
}

.square {
    width: var(--square-size);
    height: var(--square-size);
    position: relative;
    box-sizing: border-box;
}

.square.light {
    background-color: var(--light-square);
}

.square.dark {
    background-color: var(--dark-square);
}

.piece {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: calc(var(--square-size) * 0.7);
    cursor: pointer;
    position: relative;
    z-index: 2;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease;
}

.piece.white {
    color: #ffffff;
    /* Multi-layered shadow for better definition and glow */
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8), 0 0 8px rgba(0, 0, 0, 0.95);
}

.piece.black {
    color: #1a1a1a;
}

.piece.life-piece {
    color: var(--life-color);
    font-weight: bold;
    opacity: 0.50;
    text-shadow: none;
}

.piece.death-piece {
    color: var(--death-color);
    opacity: 0.50;
    text-shadow: none;
}

.piece.has-shield::after {
    content: '';
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    box-shadow: inset 0 0 7px 2px rgba(76, 175, 80, 0.8), 0 0 6px 1px rgba(76, 175, 80, 0.5);
    pointer-events: none;
    z-index: 1;
    transition: box-shadow 0.3s ease-in-out;
}

.piece.has-shield.is-immune::after {
    box-shadow: inset 0 0 10px 4px rgba(70, 200, 80, 1), 0 0 10px 3px rgba(70, 200, 80, 0.9);
}

.highlight-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    box-sizing: border-box;
}

.highlight-overlay.selected {
    background-color: var(--highlight-select);
}

.highlight-overlay.valid-move::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30%;
    height: 30%;
    background-color: var(--highlight-move);
    border-radius: 50%;
}

.highlight-overlay.valid-attack::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    background-color: transparent;
    border: 5px solid var(--highlight-attack);
    box-sizing: border-box;
    border-radius: 15%;
}

.highlight-overlay.valid-staging,
.highlight-overlay.valid-resting {
    background-color: var(--highlight-special);
    cursor: pointer;
    pointer-events: all;
}

/* --- RESPONSIVE DESIGN --- */
@media screen and (max-width: 1024px) {
    :root {
        --board-size: min(90vw, 500px);
    }

    #game-container {
        flex-direction: column;
        align-items: center;
    }

    #board-container {
        order: 1;
    }

    #ui-panel {
        order: 2;
        width: var(--board-size);
    }
}
