/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

.panel {
    background: var(--light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 2rem;
}

.panel-head h1 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.game-instructions {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(203, 213, 225, 0.1);
    border-radius: var(--radius);
}

.game-instructions h4 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.game-instructions > div {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

#mode-selection {
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#game-container {
    position: relative;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 8px;
    background-color: var(--dark);
    padding: 8px;
    border-radius: var(--radius);
    min-width: 600px;
    min-height: 600px;
}

.small-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 4px;
    background-color: var(--darker);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    place-items: center;
    justify-items: center;
    align-items: center;
}

.small-board .cell {
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.small-board.active {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.small-board.won-X {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}

.small-board.won-O {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
}

.cell {
    width: 40px;
    height: 40px;
    background-color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray);
    transition: all 0.2s ease;
    color: white;
}

.cell:hover:not(.taken) {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.cell.taken {
    cursor: not-allowed;
    opacity: 0.9;
}

.cell.player-X {
    color: #ff6b6b;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
}

.cell.player-O {
    color: #4ecdc4;
    text-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
}

#winning-line {
    position: absolute;
    height: 10px;
    background: linear-gradient(90deg, var(--warning), #ffed4e);
    border-radius: 5px;
    display: none;
    transform-origin: 0 0;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    z-index: 10;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(203, 213, 225, 0.1);
    border-radius: var(--radius);
}

.game-stats strong {
    color: var(--primary);
}

.game-stats span {
    font-family: var(--font-mono);
    font-weight: 600;
    margin-left: 0.5rem;
}

#status {
    font-weight: bold;
    font-size: 1.1rem;
    text-align: center;
}

.win-message {
    color: var(--warning);
    font-size: 1.2rem;
    animation: celebrate 0.5s ease;
}

.tie-message {
    color: var(--gray);
}

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

@media (max-width: 768px) {
    #game-board {
        grid-template-columns: repeat(3, 1fr);
        min-width: 300px;
        min-height: 300px;
    }

    .cell {
        width: 25px;
        height: 25px;
        font-size: 1rem;
    }

    .game-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    #game-board {
        min-width: 250px;
        min-height: 250px;
    }

    .cell {
        width: 20px;
        height: 20px;
        font-size: 0.8rem;
    }
}