:root {
    --bg-wood: #5d4037;
    --board-light: #d7ccc8;
    --board-dark: #a1887f;
    --piece-green: #2e7d32;
    --piece-red: #c62828;
    --piece-bobail: #fdd835;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --cell-size: clamp(45px, 13vw, 70px);
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background-color: var(--bg-wood);
    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='M0 0h20v20H0V0zm10 17a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm20 0a7 7 0 1 0 0-14 7 7 0 0 0 0 14zM10 37a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm10-17h20v20H20V20zm10 17a7 7 0 1 0 0-14 7 7 0 0 0 0 14z' fill='%233e2723' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    color: #efebe9;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    overflow: hidden;
    user-select: none;
}

h1 {
    color: #ffe0b2;
    text-shadow: 2px 2px 4px #281815;
    margin: 10px 0 15px 0;
    letter-spacing: 2px;
    font-size: 2.2rem;
    font-variant: small-caps;
}

#status-panel {
    background: linear-gradient(145deg, #4e342e, #3e2723);
    padding: 10px 25px;
    border-radius: 4px;
    border: 2px solid #8d6e63;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    min-width: 300px;
    text-align: center;
    margin-bottom: 20px;
}

#turn-indicator {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 5px;
}

#phase-indicator {
    font-size: 0.95rem;
    color: #d7ccc8;
    font-style: italic;
}

#board-wrapper {
    position: relative;
    padding: 25px;
    background: #3e2723;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.5);
    border: 4px solid #5d4037;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(5, var(--cell-size));
    grid-template-rows: repeat(5, var(--cell-size));
    gap: 4px;
    background-color: #281815;
    padding: 4px;
    border: 1px solid #795548;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

#game-board.flipped {
    transform: rotate(180deg);
}

#game-board.flipped .cell {
    transform: rotate(-180deg);
}

.coord {
    position: absolute;
    color: #a1887f;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coord-row-top,
.coord-row-bottom {
    left: 29px;
    right: 29px;
    height: 25px;
    display: flex;
    justify-content: space-around;
}

.coord-row-top {
    top: 0;
}

.coord-row-bottom {
    bottom: 0;
}

.coord-col-left,
.coord-col-right {
    top: 29px;
    bottom: 29px;
    width: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
}

.coord-col-left {
    left: 0;
}

.coord-col-right {
    right: 0;
}


.cell {
    background-color: var(--board-dark);
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.05) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.05) 75%, transparent 75%, transparent);
    background-size: 10px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.3);
    position: relative;
}

.cell:nth-child(odd) {
    background-color: var(--board-light);
}

.cell[data-row="0"] {
    border-top: 3px solid var(--piece-green);
}

.cell[data-row="4"] {
    border-bottom: 3px solid var(--piece-red);
}

.cell.highlight {
    background-color: rgba(255, 235, 59, 0.4) !important;
    box-shadow: inset 0 0 10px #fbc02d;
}

.piece {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    position: relative;
    box-shadow: 2px 4px 6px rgba(0, 0, 0, 0.5), inset -3px -3px 8px rgba(0, 0, 0, 0.5), inset 3px 3px 8px rgba(255, 255, 255, 0.6);
    transition: transform 0.2s;
}

.piece.green {
    background: radial-gradient(circle at 35% 35%, #66bb6a, #1b5e20);
    border: 1px solid #1b5e20;
}

.piece.red {
    background: radial-gradient(circle at 35% 35%, #ef5350, #b71c1c);
    border: 1px solid #b71c1c;
}

.piece.bobail {
    background: radial-gradient(circle at 35% 35%, #fff59d, #fbc02d);
    border: 1px solid #f57f17;
    width: 65%;
    height: 65%;
}

.piece.selected {
    transform: scale(1.15);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    z-index: 10;
}

#controls {
    margin-top: 20px;
}

button {
    background: linear-gradient(#8d6e63, #6d4c41);
    color: #fff;
    border: 1px solid #3e2723;
    padding: 12px 30px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    box-shadow: 0 4px 0 #3e2723;
    transition: transform 0.1s, box-shadow 0.1s;
}

button:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #3e2723;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: #efebe9;
    color: #3e2723;
    border: 5px solid #5d4037;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    max-width: 90%;
}

.modal-title {
    font-size: 1.8rem;
    margin-bottom: 15px;
    font-weight: bold;
}

.btn-group {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.piece-icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.2);
}

.flip-text {
    flex-direction: column-reverse;
}

.flip-text-row {
    flex-direction: row-reverse;
}

#lang-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #8d6e63;
    color: #efebe9;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    border-radius: 4px;
}