/* ============================================================
   ChessBot – style szachownicy
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    background: #1a1a2e;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: #e0ddd5;
    min-height: 100vh;
}

/* ── Główny layout ─────────────────────────────────────────── */
.chess-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    gap: 20px;
}

.chess-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: #c9a84c;
    text-transform: uppercase;
    margin: 0;
}

.chess-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
    letter-spacing: 1px;
}

.chess-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-card {
    background: #16213e;
    border: 1px solid #2a3a5a;
    border-radius: 10px;
    padding: 12px 14px;
}

.sidebar-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #666;
    margin-bottom: 4px;
}

.sidebar-value {
    font-size: 1rem;
    font-weight: 600;
}

.status-normal   { color: #e0ddd5; }
.status-check    { color: #ff9800; }
.status-thinking { color: #64b5f6; }
.status-gameover { color: #f44336; }
.status-good     { color: #81c784; }

.thinking-anim::after {
    content: '...';
    animation: blink-dots 1s steps(3, end) infinite;
}
@keyframes blink-dots {
    0%   { content: '.'; }
    33%  { content: '..'; }
    66%  { content: '...'; }
}

.btn {
    width: 100%;
    padding: 9px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
    letter-spacing: 0.5px;
}
.btn:hover  { filter: brightness(1.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { filter: brightness(0.5); cursor: not-allowed; }

.btn-primary   { background: #c9a84c; color: #111; }
.btn-secondary { background: #2a3a5a; color: #c9a84c; border: 1px solid #c9a84c44; }

/* Wartość pozycji */
.value-display {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}
.value-positive { color: #f5f5f5; }
.value-negative { color: #555; }

/* Historia ruchów */
.move-history {
    font-family: 'Consolas', monospace;
    font-size: 0.78rem;
    color: #aaa;
    max-height: 180px;
    overflow-y: auto;
    line-height: 1.7;
}
.move-history::-webkit-scrollbar       { width: 4px; }
.move-history::-webkit-scrollbar-thumb { background: #c9a84c55; border-radius: 2px; }

.move-entry { display: flex; gap: 6px; }
.move-num   { color: #666; min-width: 22px; }
.move-w     { color: #e0e0e0; }
.move-b     { color: #aaa; }

/* ── Wrapper szachownicy ───────────────────────────────────── */
.board-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.board-row-outer {
    display: flex;
    gap: 4px;
    align-items: stretch;
}

.rank-labels {
    display: flex;
    flex-direction: column;
    width: 20px;
}

.rank-label {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    color: #666;
    font-weight: 600;
}

.file-labels {
    display: flex;
    margin-left: 24px;
}

.file-label {
    width: 60px;
    text-align: center;
    font-size: 0.72rem;
    color: #666;
    font-weight: 600;
    padding-top: 4px;
}

/* ── Szachownica ───────────────────────────────────────────── */
.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    border: 3px solid #4a3820;
    box-shadow:
        0 0 0 1px #6a5030,
        0 12px 40px rgba(0,0,0,0.6);
}

.square {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: filter 0.1s;
}

.sq-light { background: #F0D9B5; }
.sq-dark  { background: #B58863; }

.sq-selected  { background: rgba(247, 215, 0, 0.7) !important; }
.sq-last-move { background: rgba(155, 199, 0, 0.38) !important; }
.sq-in-check  { background: rgba(220, 40, 40, 0.55) !important; }

/* Podświetlenie legalnych ruchów */
.sq-target::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}
.sq-capture::after {
    content: '';
    position: absolute;
    inset: 3px;
    border: 5px solid rgba(0, 0, 0, 0.18);
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
    z-index: 2;
}

.square:hover { filter: brightness(1.08); }

/* Bierki */
.piece {
    font-size: 42px;
    line-height: 1;
    position: relative;
    z-index: 3;
    cursor: inherit;
    pointer-events: none;
}

.piece-white {
    color: #FFFDE7;
    text-shadow:
        0 1px 0 #8B6914,
        0 2px 4px rgba(0,0,0,0.45);
    filter: drop-shadow(0 0 1px rgba(0,0,0,0.3));
}

.piece-black {
    color: #1C1C1C;
    text-shadow:
        0 1px 0 #5a5a5a,
        0 2px 4px rgba(0,0,0,0.3);
    filter: drop-shadow(0 0 1px rgba(255,255,255,0.08));
}

/* ── Pasek ewaluacji ───────────────────────────────────────── */
.eval-bar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
}

.eval-bar {
    width: 22px;
    height: 480px;
    background: #1C1C1C;
    border: 1px solid #4a3820;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.eval-bar-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: #F0D9B5;
    transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.eval-label {
    font-size: 0.6rem;
    color: #666;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ── Dialog promocji ───────────────────────────────────────── */
.promo-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.promo-dialog {
    background: #16213e;
    border: 2px solid #c9a84c;
    border-radius: 16px;
    padding: 28px 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.promo-dialog h3 {
    margin: 0 0 16px;
    color: #c9a84c;
    letter-spacing: 1px;
}

.promo-pieces {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.promo-piece {
    font-size: 52px;
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: background 0.15s, transform 0.1s;
    line-height: 1;
}

.promo-piece:hover {
    background: rgba(201, 168, 76, 0.25);
    transform: scale(1.08);
}

/* ── Komunikaty połączenia ─────────────────────────────────── */
.connection-error {
    background: #2a1010;
    border: 1px solid #8B0000;
    border-radius: 10px;
    padding: 16px 24px;
    color: #ff6b6b;
    text-align: center;
    margin: 20px 0;
}
