/* Chess & Checkers Collection Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 1000px;
    width: 100%;
    text-align: center;
}

header {
    margin-bottom: 30px;
}

h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game Selection */
.game-selection {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.game-btn {
    padding: 15px 25px;
    border: none;
    border-radius: 25px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
}

.game-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.game-btn.active {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: 2px solid rgba(255,255,255,0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.control-group label {
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

select {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.9);
    color: #333;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

select:hover {
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.reset-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,107,107,0.4);
}

/* Game Area */
.game-area {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

.game-info, .move-history {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
}

.game-info h3, .move-history h3 {
    margin-bottom: 15px;
    color: #ffd700;
    font-size: 1.3rem;
}

.status-display {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    text-align: center;
}

.current-player {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

.status-check {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-checkmate {
    background: linear-gradient(135deg, #f8d7da, #ff7675);
    color: #721c24;
    border: 1px solid #ff7675;
}

.status-stalemate {
    background: linear-gradient(135deg, #d4edda, #74b9ff);
    color: #155724;
    border: 1px solid #74b9ff;
}

.score-board {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

.score {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score span {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Chess Board */
.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 4px solid #8B4513;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    background: #8B4513;
}

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

.square.white {
    background: #f0d9b5;
}

.square.black {
    background: #b58863;
}

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

.square.selected {
    background: #ffff00 !important;
    box-shadow: inset 0 0 0 3px #ff0000;
}

.square.possible-move {
    background: #90EE90 !important;
    box-shadow: inset 0 0 0 2px #006400;
    cursor: pointer;
}

.square.move {
    background: #90EE90 !important;
    box-shadow: inset 0 0 0 2px #006400;
}

.square.move::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: rgba(0, 100, 0, 0.5);
    pointer-events: none;
}

/* Chess Pieces */
.piece {
    font-size: 48px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    user-select: none;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.piece:hover {
    transform: scale(1.05);
}

.chess-piece.white {
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.chess-piece.black {
    color: #333333;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.3);
}

/* Move History */
.moves-list {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 10px;
    text-align: left;
}

.move-pair {
    display: grid;
    grid-template-columns: 30px 1fr 1fr;
    gap: 10px;
    padding: 5px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-family: 'Courier New', monospace;
}

.move-number {
    font-weight: bold;
    color: #ffd700;
}

.white-move {
    color: #ffffff;
}

.black-move {
    color: #cccccc;
}

/* Loading Animation */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top: 5px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-area {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 20px;
    }
    
    .board {
        grid-template-columns: repeat(8, 50px);
        grid-template-rows: repeat(8, 50px);
    }
    
    .square {
        width: 50px;
        height: 50px;
    }
    
    .piece {
        font-size: 32px;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }
    
    .square {
        width: 40px;
        height: 40px;
    }
    
    .piece {
        font-size: 24px;
    }
    
    .container {
        padding: 10px;
    }
}

/* Dice Styles for Backgammon */
.dice-container {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
}

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

.die {
    width: 40px;
    height: 40px;
    background: white;
    color: black;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}

.dice-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 15px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

.dice-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.moves-remaining {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #ffd700;
}

/* Checkers Specific Styles */
.checker-piece {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    margin: auto;
}

.checker-piece.red, .checker-piece.white {
    background: radial-gradient(circle, #ffffff, #e0e0e0);
    color: black;
    border: 2px solid #cccccc;
}

.checker-piece.black {
    background: radial-gradient(circle, #2f3542, #1e2328);
    color: white;
    border: 2px solid #0d0e0f;
}

.checker-piece.king::after {
    content: '♔';
    font-size: 24px;
    position: absolute;
    color: gold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Backgammon Board Styles */
.backgammon-board {
    width: 800px;
    height: 600px;
    background: #8B4513;
    border: 4px solid #654321;
    border-radius: 8px;
    position: relative;
    display: grid;
    grid-template-areas: 
        "top-right top-right top-left top-left"
        "bottom-right bottom-right bottom-left bottom-left";
}

.backgammon-point {
    width: 30px;
    height: 200px;
    position: absolute;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.backgammon-point.up {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.backgammon-point.down {
    clip-path: polygon(0% 0%, 100% 0%, 50% 100%);
}

.backgammon-point.light {
    background: #f4f4f4;
}

.backgammon-point.dark {
    background: #8B4513;
}

.backgammon-checker {
    width: 25px;
    height: 6px;
    border-radius: 50%;
    margin: 1px 0;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.backgammon-checker.white {
    background: radial-gradient(circle, #ffffff, #e0e0e0);
    border: 1px solid #ccc;
}

.backgammon-checker.black {
    background: radial-gradient(circle, #2c2c2c, #000000);
    border: 1px solid #333;
}

.bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 100%;
    background: #654321;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bear-off {
    position: absolute;
    width: 60px;
    height: 100%;
    background: rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bear-off.white {
    right: -65px;
}

.bear-off.black {
    left: -65px;
}

/* Board size adjustments for different games */
.board.chess {
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
}

.board.checkers {
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
}

.square.dark-square {
    background-color: #b58863;  /* Same as chess black squares */
}

.square.light-square {
    background-color: #f0d9b5;  /* Same as chess white squares */
}
