/* Chess Game Styles */
#chess-board {
    width: 100%;
    touch-action: none;
}

.game-board {
    width: 100%;
}

.game-board-wrapper {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    width: min(90vw, 70vh, 700px);
    max-width: 750px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .game-board-wrapper {
        width: min(95vw, 80vh, 600px);
    }
}

@media (max-width: 480px) {
    .game-board-wrapper {
        width: min(100%, 90vh);
    }
}

.cm-chessboard {
    margin: 0 auto;
}

#move-history {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-top: 1rem;
    font-family: monospace;
    font-size: 0.9rem;
}

#move-history .move {
    display: inline-block;
    margin-right: 1rem;
}

#move-history .move-number {
    color: var(--text-light);
}

#game-status {
    font-weight: 600;
    padding: 0.5rem;
    text-align: center;
}

#game-status.check {
    color: #dc2626;
}

#game-status.checkmate {
    color: #059669;
    font-size: 1.25rem;
}

#game-status.draw {
    color: #d97706;
}

#game-status.thinking {
    color: #6366f1;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Difficulty selector */
.difficulty-selector,
.mode-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.difficulty-selector label,
.mode-selector label {
    font-weight: 500;
    color: var(--text);
}

.difficulty-selector select,
.mode-selector select {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}

.difficulty-selector select:focus,
.mode-selector select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Promotion dialog */
.promotion-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
}

.promotion-dialog h3 {
    margin-bottom: 1rem;
    text-align: center;
}

.promotion-pieces {
    display: flex;
    gap: 0.5rem;
}

.promotion-piece {
    width: 50px;
    height: 50px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-alt);
    font-size: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.promotion-piece:hover {
    background: var(--border);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive */
@media (max-width: 480px) {
    #chess-board {
        max-width: 100%;
    }
}


/* Evaluation Bar */
.eval-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.eval-bar {
    width: 24px;
    height: 100%;
    min-height: 300px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.eval-bar .eval-black {
    background: #333;
    height: 50%;
    transition: height 0.3s ease;
}

.eval-bar .eval-white {
    background: #f0f0f0;
    height: 50%;
    transition: height 0.3s ease;
}

.eval-text {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
    min-width: 40px;
}

.eval-toggle {
    display: flex;
    align-items: center;
}

.eval-toggle label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

.eval-toggle input[type="checkbox"] {
    cursor: pointer;
}

@media (max-width: 480px) {
    .eval-bar {
        min-height: 250px;
    }
}