/* Lokales Chessboard-Layout */
.simple-chessboard {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    width: min(320px, 100%);
    aspect-ratio: 1 / 1;
    margin: 20px auto;
    border: 2px solid #444;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

.chess-square {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    user-select: none;
}

.chess-square.light {
    background: #f0d9b5;
}

.chess-square.dark {
    background: #b58863;
}

.chess-square.selected {
    outline: 3px solid #ffeb3b;
    outline-offset: -3px;
}

.chess-square.has-piece {
    cursor: pointer;
}

.simple-chessboard .chess-square:not(.has-piece) {
    cursor: default;
}

/* Stile für Schach-Popup */
.chess-popup {
    min-width: 520px;
    user-select: none;
    pointer-events: auto;
    /* Popup darf nicht draggable sein */
    -webkit-user-drag: none;
    position: fixed;
}

.chess-popup .chess-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: move;
}

.chess-popup .chess-popup-header h2 {
    margin: 0;
}

.chess-popup .close {
    border: none;
    background: transparent;
    color: #333;
    font-size: 30px;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    cursor: pointer;
}

.chess-popup .close:hover {
    color: #000;
}

#chess-board {
    width: 480px;
    margin: 0 auto;
    user-select: none;
    pointer-events: auto;
    -webkit-user-drag: none;
}

.chessboard-piece {
    pointer-events: auto !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
}

#chess-status {
    margin: 15px 0;
    font-weight: bold;
}

#chess-username {
    font-size: 0.7em;
    color: #888;
}

.chess-controls {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 10px;
}

#chess-games-list {
    margin-top: 20px;
}

.chess-game-result-win {
    color: green;
    font-weight: bold;
}

.chess-game-result-loss {
    color: red;
}

.chess-game-result-draw {
    color: #ff9800;
}

.chess-game-date {
    color: #666;
    font-size: 0.9em;
}

.chess-stats {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
}

.chess-stats-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.chess-stats-label {
    font-weight: bold;
}

@media (max-width: 520px) {
    .chess-popup {
        min-width: auto;
    }
    
    #chess-board {
        width: 100%;
        max-width: 480px;
    }
}
