/* Configurações Globais e Responsividade */
:root {
    --dark-tile: #222222;
    --light-tile: #EEEEEE;
    --accent-color: #e07a5f;
    --board-size: 80vmin;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
    background-color: #22223b;
    color: white;
}

#game-container {
    display: flex;
    flex-direction: column;
    width: 95%;
    max-width: 450px;
    padding: 10px;
    box-sizing: border-box;
    display: none;
}

/* Cabeçalho - leve ajuste para legibilidade sem tocar no tabuleiro */
header h1 {
    text-align: center;
    margin: 10px 0 5px 0;
    font-size: 1.4em;
    color: var(--light-tile);
}

.score-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.9em;
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 10px;
}

.timer-box {
    font-weight: bold;
    color: var(--accent-color);
    padding: 5px;
    border: 1px solid var(--accent-color);
    border-radius: 5px;
    min-width: 80px;
    text-align: center;
}

/* Tabuleiro (sem alteração) */
.board-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5), 0 0 0 5px var(--accent-color);
    border-radius: 5px;
}

.tile {
    background-color: var(--dark-tile);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0;
    cursor: default;
    box-sizing: border-box;
    border-bottom: 2px solid rgba(0, 0, 0, 0.3);
    border-right: 2px solid rgba(0, 0, 0, 0.3);
    transition: background-color 0.3s;
}

/* Casas claras (sem alteração) */
.board-grid > div:nth-child(16n+1),
.board-grid > div:nth-child(16n+3),
.board-grid > div:nth-child(16n+5),
.board-grid > div:nth-child(16n+7),
.board-grid > div:nth-child(16n+10),
.board-grid > div:nth-child(16n+12),
.board-grid > div:nth-child(16n+14),
.board-grid > div:nth-child(16n+16),
.board-grid > div:nth-child(16n+17),
.board-grid > div:nth-child(16n+19),
.board-grid > div:nth-child(16n+21),
.board-grid > div:nth-child(16n+23),
.board-grid > div:nth-child(16n+26),
.board-grid > div:nth-child(16n+28),
.board-grid > div:nth-child(16n+30),
.board-grid > div:nth-child(16n+32),
.board-grid > div:nth-child(16n+33),
.board-grid > div:nth-child(16n+35),
.board-grid > div:nth-child(16n+37),
.board-grid > div:nth-child(16n+39),
.board-grid > div:nth-child(16n+42),
.board-grid > div:nth-child(16n+44),
.board-grid > div:nth-child(16n+46),
.board-grid > div:nth-child(16n+48),
.board-grid > div:nth-child(16n+49),
.board-grid > div:nth-child(16n+51),
.board-grid > div:nth-child(16n+53),
.board-grid > div:nth-child(16n+55),
.board-grid > div:nth-child(16n+58),
.board-grid > div:nth-child(16n+60),
.board-grid > div:nth-child(16n+62),
.board-grid > div:nth-child(16n+64) {
    background-color: var(--light-tile);
    cursor: default;
}

/* Peças */
.piece {
    width: 100%; /* Ajuste para preencher a div do tile (pois a imagem PNG já é a peça) */
    height: 100%;
    border-radius: 0; /* Remove borda redonda, a imagem PNG faz a forma */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    /* Remove box-shadow e transform que davam efeito 3D (a imagem PNG deve ter esses detalhes) */
    box-shadow: none; 
    transform: none;
    
    /* Configuração padrão para imagens */
    background-size: 80%; /* Para que a peça não ocupe 100% da célula */
    background-position: center;
    background-repeat: no-repeat;
    transition: transform 0.2s ease-out, opacity 0.5s ease-out;
}

/* Peças Normais (PNG) */
.piece.white {
    /* Imagem para a peça branca normal */
    background-image: url('imagens/peca_branca.png');
}

.piece.black {
    /* Imagem para a peça preta normal */
    background-image: url('imagens/peca_preta.png');
}

/* Peças Coroadas (Dama - PNG) */
.piece.white.is-king {
    /* Imagem para a Dama branca */
    background-image: url('imagens/dama_branca.png');
}

.piece.black.is-king {
    /* Imagem para a Dama preta */
    background-image: url('imagens/dama_preta.png');
}

.piece.selected {
    box-shadow: 0 0 10px 3px #ffeb3b;
    transform: scale(1.05); /* Efeito de seleção na imagem */
}

.possible-move {
    background-color: #6a994e !important;
    border: 3px dashed var(--light-tile);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.piece.captured {
    opacity: 0;
    transform: scale(0.1);
}

.message-area {
    text-align: center;
    padding: 10px;
    color: white;
    min-height: 20px;
    transition: background-color 0.3s;
}

.error {
    background-color: var(--accent-color);
    color: white;
    border-radius: 5px;
}

.controls-area {
    display: flex;
    justify-content: space-around;
    padding: 15px 0 0;
}

button {
    padding: 10px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #c76f53;
}

/* Start e modo (Login) */
.mode-select {
    margin: 12px 0;
    text-align: center;
}

.mode-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px 0;
}

.mode-btn {
    padding: 8px 10px;
    border-radius: 6px;
    border: 2px solid transparent;
    background: rgba(255,255,255,0.06);
    color: white;
    cursor: pointer;
    min-width: 120px;
}

.mode-btn.selected {
    border-color: var(--accent-color);
    background: rgba(224,122,95,0.12);
}

.mode-hint {
    display: block;
    font-size: 0.8em;
    margin-top: 6px;
    color: #ddd;
}

/* botão start desativado */
.start-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Popups (sem alteração) */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.popup-overlay.active {
    display: flex;
}

.popup-content {
    background: var(--dark-tile);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

.popup-content.white-bg {
    background: var(--light-tile);
    color: var(--dark-tile);
}

.popup-content input {
    width: 80%;
    padding: 10px;
    margin: 15px 0;
    border: 2px solid var(--accent-color);
    border-radius: 5px;
    box-sizing: border-box;
}

.rules-content h3 {
    margin-bottom: 6px;
    margin-top: 14px;
    text-align: left;
}

.rules-content ul {
    text-align: left;
    padding-left: 18px;
}

/* A estilização da Coroa (Dama) foi substituída pelo background-image */
/* O seletor .is-king::after foi removido, pois a imagem já contém a coroa. */
