:root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    --panel-bg: rgba(255, 255, 255, 0.05);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --board-light: #f0d9b5;
    --board-dark: #b58863;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.container {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    max-width: 1100px;
    width: 100%;
    align-items: center;
}

.panel {
    flex: 1;
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header .badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    border: 1px solid var(--panel-border);
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    transform: translateX(-3px);
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: -webkit-linear-gradient(0deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

select {
    appearance: none;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--panel-border);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

select:focus {
    border-color: var(--accent);
}

.buttons-row {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn.primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.status-box {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border-left: 4px solid var(--accent);
    font-weight: 600;
    min-height: 52px;
    display: flex;
    align-items: center;
}

.material-box {
    margin-top: 2rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border-left: 4px solid #a78bfa;
    font-weight: 600;
    color: #e2e8f0;
}

/* Tabuleiro Styles Overrides */
.board-container {
    flex: 1;
    display: flex;
    justify-content: center;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Classe ativada via JS para tela cheia */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 900;
    background: var(--bg-gradient);
    align-items: center;
    padding: 2rem;
}
.fullscreen-mode #myBoard {
    max-width: min(90vw, 80vh) !important;
    width: min(90vw, 80vh) !important;
}

/* Força as peças animadas do chessboard.js (que são jogadas no <body>) a sobreporem TUDO */
body > img.piece-417db,
body > img {
    z-index: 999999 !important;
}

.white-1e1d7 {
    background-color: var(--board-light);
    color: var(--board-dark);
}
.black-3c85d {
    background-color: var(--board-dark);
    color: var(--board-light);
}

/* Área de Jogo com Relógios */
.board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.player-info {
    width: 100%;
    max-width: 500px;
    display: flex;
    justify-content: flex-end;
    padding: 8px 0;
}

.fullscreen-mode .player-info {
    max-width: min(90vw, 80vh) !important;
}

.clock {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: monospace;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    border: 2px solid transparent;
}
.clock.active {
    background: #e2e8f0;
    color: #0f172a;
    border-color: var(--accent);
}

/* Destaque para o Click-to-Move */
.highlight-click {
    box-shadow: inset 0 0 3px 3px rgba(255, 255, 0, 0.7) !important;
}

/* Bolinha indicando para onde a peça pode ir */
.highlight-move {
    position: relative;
}
.highlight-move::after {
    content: '';
    position: absolute;
    width: 26%;
    height: 26%;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 50%;
    top: 37%;
    left: 37%;
    pointer-events: none; /* Para não bloquear o clique do usuário na casa */
}

/* Responsividade */
@media (max-width: 900px) {
    .container {
        flex-direction: column;
    }
    .board-container {
        width: 100%;
    }
}
/* Modal de Game Over (Caixa Menor) */
.game-over-modal {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 350px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--accent);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.8);
    z-index: 5000;
    flex-direction: column;
    align-items: center;
}
