:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #363636;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-primary: #7389ae;
    --accent-success: #4CAF50;
    --accent-danger: #dc3545;
    --accent-warning: #ffd700;
    --square-light: #e9d8b6;
    --square-dark: #b58863;
    --highlight: rgba(115, 137, 174, 0.3);
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 20px;
}

.game-info {
    flex: 1;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    min-width: 300px;
}

.board-container {
    flex: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.board-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    margin-bottom: 20px;
}

.chess-board {
    width: 560px;
    height: 560px;
    border: 2px solid var(--accent-primary);
    background: var(--bg-secondary);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    position: relative;
    border-radius: 4px;
    overflow: hidden;
}

.bot-move-preview {
    position: relative;
    width: 560px;
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.bot-move-preview.visible {
    opacity: 1;
    transform: translateY(0);
}

.bot-move-preview .thinking-dots {
    display: inline-block;
    width: 50px;
    text-align: left;
}

.bot-move-preview .thinking-dots::after {
    content: '...';
    animation: thinking-dots 1.5s infinite;
}

@keyframes thinking-dots {
    0%, 20% { content: '.'; }
    40%, 60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.preview-content {
    margin-bottom: 10px;
    font-weight: bold;
}

.confidence-meter {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-top: 10px;
}

.confidence-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.confidence-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin: 5px 0;
}

.confidence-fill {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.5s ease;
}

.confidence-fill.high {
    background: var(--accent-success);
}

.confidence-fill.medium {
    background: var(--accent-warning);
}

.confidence-fill.low {
    background: var(--accent-danger);
}

.confidence-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.board-row {
    display: flex;
    height: 70px;
}

.square {
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 40px;
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

/* Style for white pieces */
.square[data-piece^="w"] {
    color: #ffffff;
    text-shadow: 
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

/* Style for black pieces */
.square[data-piece^="b"] {
    color: #000000;
    text-shadow: 
        -1px -1px 0 #fff,
        1px -1px 0 #fff,
        -1px 1px 0 #fff,
        1px 1px 0 #fff;
}

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

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

.square.selected {
    background-color: var(--accent-primary) !important;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3);
}

.square.valid-move::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(76, 175, 80, 0.5);
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.square.last-move {
    background-color: var(--accent-warning) !important;
    opacity: 0.3;
}

.square.check {
    background-color: var(--accent-danger) !important;
    animation: check-pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

@keyframes check-pulse {
    0% { background-color: rgba(220, 53, 69, 0.3); }
    50% { background-color: rgba(220, 53, 69, 0.5); }
    100% { background-color: rgba(220, 53, 69, 0.3); }
}

.square:hover {
    opacity: 0.8;
    transform: scale(1.05);
    z-index: 1;
}

.coordinates {
    display: flex;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: bold;
}

.coordinates.top, .coordinates.bottom {
    justify-content: space-around;
    width: 560px;
    padding: 5px 0;
}

.coordinates.left, .coordinates.right {
    flex-direction: column;
    justify-content: space-around;
    height: 560px;
    padding: 0 5px;
}

.coordinates div {
    width: 20px;
    text-align: center;
}

h1 {
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
    font-size: 24px;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.status-panel {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.player-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.player-info.active {
    border: 2px solid var(--accent-primary);
}

.player-label {
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-label::before {
    content: '⭐';
    opacity: 0;
    transition: opacity 0.3s ease;
}

.player-info.active .player-label::before {
    opacity: 1;
}

.white-player .player-label::before {
    color: #000;
}

.captured-pieces {
    font-size: 20px;
    min-height: 30px;
    letter-spacing: 3px;
    color: #000;
}

.game-status-container {
    text-align: center;
    padding: 15px;
    background-color: var(--bg-tertiary);
    border-radius: 8px;
    margin: 10px 0;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.game-status-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: status-shine 2s infinite;
}

@keyframes status-shine {
    to {
        left: 100%;
    }
}

.thinking {
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 5px;
    animation: thinking 1s infinite;
}

@keyframes thinking {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.hidden {
    display: none;
}

.controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: 0.5s;
}

.button:hover:not(:disabled)::after {
    left: 100%;
}

.button.primary {
    background-color: var(--accent-success);
    color: white;
}

.button.primary:hover:not(:disabled) {
    background-color: #45a049;
    transform: translateY(-2px);
}

.button.danger {
    background-color: var(--accent-danger);
    color: white;
}

.button.danger:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-2px);
}

.button.secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.button.secondary:hover:not(:disabled) {
    background-color: #5a6268;
    transform: translateY(-2px);
}

.move-history {
    height: 200px;
    overflow-y: auto;
    border: 1px solid var(--bg-tertiary);
    padding: 10px;
    margin-bottom: 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-family: monospace;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
}

.move-history::-webkit-scrollbar {
    width: 8px;
}

.move-history::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.move-history::-webkit-scrollbar-thumb {
    background-color: var(--accent-primary);
    border-radius: 4px;
}

.move-history div {
    padding: 8px;
    border-bottom: 1px solid var(--bg-secondary);
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.move-history div:hover {
    background-color: var(--bg-secondary);
    transform: translateX(5px);
}

.move-history div.latest-move {
    background-color: var(--accent-primary);
    color: var(--text-primary);
    font-weight: bold;
    border-radius: 4px;
}

.stats-panel {
    background-color: var(--bg-tertiary);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.game-stats p {
    margin: 5px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.game-stats p:hover {
    transform: translateX(5px);
}

.game-stats span {
    font-weight: bold;
    color: var(--accent-primary);
}

.winner-banner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    text-align: center;
    animation: winner-appear 0.5s ease;
}

@keyframes winner-appear {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
}

@media (max-width: 1200px) {
    .container {
        flex-direction: column;
    }
    
    .chess-board {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
    }
    
    .square {
        width: 12.5%;
        height: auto;
        aspect-ratio: 1;
    }
    
    .coordinates.top, .coordinates.bottom {
        width: 100%;
    }
    
    .bot-move-preview {
        width: 100%;
    }
}

.learning-header {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--bg-secondary);
}

.learning-stats {
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.learning-progress {
    margin-bottom: 15px;
}

.progress-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.progress-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin: 5px 0;
}

.progress-fill {
    height: 100%;
    background: var(--accent-primary);
    width: 0%;
    transition: width 0.5s ease;
}

.progress-fill.high {
    background: var(--accent-success);
}

.progress-fill.medium {
    background: var(--accent-warning);
}

.progress-fill.low {
    background: var(--accent-danger);
}

#database-size, #learning-ratio {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: right;
    margin-top: 2px;
}

.learning-metrics {
    margin-top: 15px;
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 10px;
}

.learning-metrics p {
    margin: 0;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.learning-metrics span {
    color: var(--accent-primary);
    font-weight: bold;
} 