:root {
    --bg-color: #f7f7f7;
    --panel-bg: #d9d9d9;
    --white-sq: #f0f0d6;
    --black-sq: #769656;
    --primary-btn: #1b5e20;
    --primary-btn-hover: #144616;
    --mine-color: rgba(255, 0, 0, 0.6);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px 0;
}

/* Login page */
body.login-page {
    background-color: #f0f0f0;
    height: 100vh;
    padding: 0;
}

.login-card {
    background-color: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    text-align: center;
}

.login-card h1 { color: #2e7d32; }

.login-card input {
    padding: 10px;
    width: 200px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.login-card button {
    padding: 10px 20px;
    background-color: #2e7d32;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

.login-card button:hover { background-color: #1b5e20; }

/* Game container */
.game-container {
    display: flex;
    gap: 40px;
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

/* Chess Board */
.board-wrapper {
    position: relative;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 5px solid #333;
    user-select: none;
}

.square {
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.square.white { background-color: var(--white-sq); }
.square.black { background-color: var(--black-sq); }

.square.mine-hit {
    background-color: var(--mine-color) !important;
}

.square.check {
    background-color: blue !important;
}

.piece {
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 10;
}

/* Hit Map */
.hit-map-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.hit-map {
    display: grid;
    grid-template-columns: repeat(8, 35px);
    grid-template-rows: repeat(8, 35px);
    border: 3px solid #666;
    user-select: none;
}

.hit-square {
    width: 35px;
    height: 35px;
    border: 1px solid #ccc;
    position: relative;
}

.hit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 0, 0, 0);
    transition: background-color 0.3s;
}

/* Side Panel */
.side-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.top-buttons {
    display: flex;
    gap: 10px;
}

.btn-new-game {
    flex: 1;
    background-color: var(--primary-btn);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-new-game:hover { background-color: var(--primary-btn-hover); }

.btn-rotate {
    width: 50px;
    background-color: var(--primary-btn);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.btn-rotate svg { width: 20px; height: 20px; fill: white; }

.minefield-display {
    background-color: var(--panel-bg);
    border-radius: 15px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 64px;
    font-weight: bold;
    color: #333;
}

.captured-pieces {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    flex-grow: 1;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 5px;
}

.captured-piece-icon {
    width: 25px;
    height: 25px;
}

/* Labels */
.board-labels-left {
    position: absolute;
    left: -25px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    font-weight: bold;
    color: #666;
}
.board-labels-bottom {
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    font-weight: bold;
    color: #666;
}

/* Drag and drop helper */
.dragging {
    opacity: 0.5;
}

/* Responsive Styles */
@media (max-width: 900px) {
    body {
        align-items: flex-start;
        padding: 10px 0;
    }

    .game-container {
        flex-direction: column;
        gap: 30px;
        padding: 30px 10px;
        width: 95%;
        max-width: 500px;
        align-items: center;
        margin-bottom: 20px;
    }

    .hit-map-wrapper {
        display: none;
    }

    .board {
        grid-template-columns: repeat(8, 10.5vw);
        grid-template-rows: repeat(8, 10.5vw);
        max-width: 84vw;
    }

    .square {
        width: 10.5vw;
        height: 10.5vw;
    }

    .piece {
        width: 9vw;
        height: 9vw;
    }

    .side-panel {
        width: 100%;
        gap: 15px;
    }

    .minefield-display {
        height: 80px;
        font-size: 48px;
    }

    #turn-indicator {
        width: 95%;
        max-width: 500px;
        min-width: unset;
        box-sizing: border-box;
        font-size: 20px;
        padding: 10px 20px;
    }

    .board-labels-left {
        left: -18px;
        font-size: 12px;
    }
    .board-labels-bottom {
        bottom: -18px;
        font-size: 12px;
    }
}
