/* XOX Game Styles */

:root {
    --primary-color-1: #667eea;
    --primary-color-2: #764ba2;
    --dark-color-1: #2c3e50;
    --dark-color-2: #34495e;
}

.xox-game-container {
    font-family: 'Arial', sans-serif;
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color-1) 0%, var(--primary-color-2) 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

/* Size Selection Screen */
.xox-size-selection {
    text-align: center;
    color: #ffffff;
}

.xox-size-selection h3 {
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xox-size-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.xox-size-button {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 120px;
    justify-content: center;
}

.xox-size-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    background: #ffffff;
}

.xox-size-button:active {
    transform: translateY(-2px);
}

.size-icon {
    font-size: 48px;
    font-weight: bold;
    line-height: 1;
    color: var(--primary-color-1);
}

.size-desc {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Mode Selection Screen */
.xox-mode-selection {
    text-align: center;
    color: #ffffff;
}

.xox-mode-selection h3 {
    margin: 0 0 30px 0;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xox-mode-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.xox-mode-button {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    padding: 30px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 140px;
    justify-content: center;
}

.xox-mode-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    background: #ffffff;
}

.xox-mode-button:active {
    transform: translateY(-2px);
}

.mode-icon {
    font-size: 64px;
    line-height: 1;
}

.mode-title {
    font-size: 22px;
    font-weight: bold;
    color: var(--primary-color-1);
    margin: 0;
}

.mode-desc {
    font-size: 15px;
    color: #666;
    margin: 0;
}

/* Difficulty Selection Screen */
.xox-difficulty-selection {
    text-align: center;
    color: #ffffff;
}

.xox-difficulty-selection h3 {
    margin: 0 0 25px 0;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xox-difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.xox-difficulty-button {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-height: 130px;
    justify-content: center;
}

.xox-difficulty-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    background: #ffffff;
}

.xox-difficulty-button:active {
    transform: translateY(-2px);
}

.difficulty-icon {
    font-size: 56px;
    line-height: 1;
}

.difficulty-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color-1);
    margin: 0;
}

.difficulty-desc {
    font-size: 13px;
    color: #666;
    margin: 0;
}

/* Back Button */
.xox-back-button {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border: 2px solid #ffffff;
    padding: 10px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

.xox-back-button:hover {
    background: #ffffff;
    color: var(--primary-color-1);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.xox-back-button:active {
    transform: translateY(0);
}

/* Player Setup Screen */
.xox-player-setup {
    text-align: center;
    color: #ffffff;
}

.xox-player-setup h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xox-input-group {
    margin-bottom: 15px;
}

.xox-input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 16px;
}

.xox-player-name-input {
    width: 100%;
    max-width: 300px;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.xox-start-button {
    background: #ffffff;
    color: var(--primary-color-1);
    border: none;
    padding: 15px 50px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 15px;
}

.xox-start-button:hover {
    background: var(--primary-color-2);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Scoreboard */
.xox-scoreboard {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    gap: 10px;
}

.xox-score-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    flex: 1;
    color: #ffffff;
}

.xox-score-item .xox-player-name {
    display: block;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}

.xox-score-item .xox-score {
    display: block;
    font-size: 32px;
    font-weight: bold;
}

.xox-score-x {
    border: 2px solid #e74c3c;
}

.xox-score-o {
    border: 2px solid #3498db;
}

/* Celebration Animation */
@keyframes celebrate {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.05) rotate(-2deg);
    }
    75% {
        transform: scale(1.05) rotate(2deg);
    }
}

.xox-game-container.xox-celebration {
    animation: celebrate 0.5s ease-in-out 2;
}

.xox-game-header {
    text-align: center;
    margin-bottom: 20px;
}

.xox-game-header h2 {
    color: #ffffff;
    margin: 0 0 10px 0;
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.xox-game-status {
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    margin: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: inline-block;
}

.xox-game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 10px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Reduce gap for larger boards */
.xox-game-board[data-board-size="5"] {
    gap: 8px;
    padding: 8px;
}

.xox-game-board[data-board-size="6"] {
    gap: 6px;
    padding: 6px;
}

.xox-cell {
    aspect-ratio: 1;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    min-height: 60px;
}

/* Smaller border radius for smaller cells */
.xox-game-board[data-board-size="6"] .xox-cell {
    border-radius: 8px;
}

/* Dynamic font sizes based on grid */
.xox-game-board[data-board-size="3"] .xox-cell {
    font-size: 56px;
}

.xox-game-board[data-board-size="4"] .xox-cell {
    font-size: 42px;
}

.xox-game-board[data-board-size="5"] .xox-cell {
    font-size: 34px;
}

.xox-game-board[data-board-size="6"] .xox-cell {
    font-size: 28px;
    min-height: 50px;
}

.xox-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.xox-cell.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.xox-cell.x {
    color: #e74c3c;
    animation: fadeIn 0.3s ease;
}

.xox-cell.o {
    color: #3498db;
    animation: fadeIn 0.3s ease;
}

.xox-cell.winning {
    background: #f1c40f;
    animation: pulse 0.6s ease infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.xox-game-footer {
    text-align: center;
}

.xox-reset-button {
    background: #ffffff;
    color: var(--primary-color-1);
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.xox-reset-button:hover {
    background: var(--primary-color-2);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.xox-reset-button:active {
    transform: translateY(0);
}

.xox-main-menu-button {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border: 2px solid #ffffff;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-left: 10px;
}

.xox-main-menu-button:hover {
    background: #ffffff;
    color: var(--primary-color-1);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.xox-main-menu-button:active {
    transform: translateY(0);
}

/* AI Thinking Animation */
.ai-thinking {
    pointer-events: none;
    opacity: 0.7;
}

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

/* Statistics Button */
.xox-stats-button {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border: 2px solid #ffffff;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    margin-top: 10px;
    display: inline-block;
}

.xox-stats-button:hover {
    background: #ffffff;
    color: var(--primary-color-1);
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Statistics Modal */
.xox-stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.xox-stats-content {
    background: linear-gradient(135deg, var(--primary-color-1) 0%, var(--primary-color-2) 100%);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
    color: #ffffff;
}

.xox-stats-content h3 {
    margin: 0 0 20px 0;
    font-size: 24px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

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

.stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
}

.xox-close-stats-button,
.xox-reset-stats-button {
    background: #ffffff;
    color: var(--primary-color-1);
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    width: 100%;
}

.xox-reset-stats-button {
    background: rgba(255, 255, 255, 0.3);
    color: #ffffff;
    border: 2px solid #ffffff;
}

.xox-close-stats-button:hover,
.xox-reset-stats-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Responsive design */
@media (max-width: 480px) {
    .xox-game-board[data-board-size="3"] .xox-cell {
        font-size: 36px;
        min-height: 60px;
    }
    
    .xox-game-board[data-board-size="4"] .xox-cell {
        font-size: 28px;
        min-height: 50px;
    }
    
    .xox-game-board[data-board-size="5"] .xox-cell {
        font-size: 22px;
        min-height: 42px;
    }
    
    .xox-game-board[data-board-size="6"] .xox-cell {
        font-size: 18px;
        min-height: 38px;
    }
    
    .xox-game-board {
        gap: 8px;
        padding: 8px;
    }
    
    .xox-game-board[data-board-size="5"] {
        gap: 6px;
        padding: 6px;
    }
    
    .xox-game-board[data-board-size="6"] {
        gap: 5px;
        padding: 5px;
    }
    
    .xox-game-header h2 {
        font-size: 24px;
    }
    
    .xox-game-status {
        font-size: 16px;
    }
    
    .xox-scoreboard {
        flex-direction: column;
    }
    
    .xox-player-name-input {
        max-width: 100%;
    }
    
    .xox-size-buttons {
        grid-template-columns: 1fr;
    }
    
    .xox-size-button {
        min-height: 100px;
    }
}
