/* General Page Structure */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    color: #343a40;
    line-height: 1.6;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Game Section */
#game-section {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
    margin-bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.xo-game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

#xo-board {
    display: grid;
    grid-template-columns: repeat(15, 40px);
    grid-template-rows: repeat(15, 40px);
    border: 2px solid #343a40;
    background-color: #fdfd96;
    gap: 1px;
    padding: 1px;
}

.xo-cell {
    width: 40px;
    height: 40px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    transition: background-color 0.2s;
}

.xo-cell:hover {
    background-color: #e9ecef;
}

.xo-cell.x { color: #d94848; }
.xo-cell.o { color: #4b8f8c; }

.xo-controls {
    text-align: center;
}

#restart {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.3s;
}

#restart:hover {
    background-color: #0056b3;
}

#xo-message {
    display: block;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #495057;
}

/* Internal Navigation / More Games */
.internal-nav {
    text-align: center;
    margin-bottom: 3rem;
}

.internal-nav h3 {
    font-size: 2.5rem;
    font-weight: 600;
    color: #003366;
    margin-top: 0;
    margin-bottom: 2rem;
}

.game-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.game-btn {
    background: #f8f9fa;
    border-radius: 10px;
    text-align: center;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
    color: #343a40;
    text-decoration: none;
}

.game-btn:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.game-btn img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.game-btn span {
    font-size: 1.3rem;
    font-weight: 600;
}

/* Info Sections & Cards */
.info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.info-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
}

.info-card.full-width {
    grid-column: 1 / -1;
}

.info-card h2 {
    font-size: 2rem;
    font-weight: 600;
    color: #003366;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

.info-card h4 {
    font-size: 1.4rem;
    color: #005f9e;
    margin-bottom: 0.5rem;
}

.info-card p, .info-card li {
    color: #343a40;
}

.info-card ul {
    padding-left: 20px;
}

/* Responsive Design */
@media (max-width: 992px) {
    .info-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    main {
        padding: 2rem 1rem;
    }
    #game-section, .info-card {
        padding: 2rem;
    }
    .internal-nav h3, .info-card h2 {
        font-size: 2rem;
    }
    #xo-board {
        grid-template-columns: repeat(15, 5.8vw);
        grid-template-rows: repeat(15, 5.8vw);
    }
    .xo-cell {
        width: 5.8vw;
        height: 5.8vw;
        font-size: 3.5vw;
    }
}

@media (orientation: portrait) and (max-width: 540px) {
    #game-section {
        padding: 1.25rem;
    }
    #xo-board {
        grid-template-columns: repeat(15, 6vw);
        grid-template-rows: repeat(15, 6vw);
        max-width: 94vw;
    }
    .xo-cell {
        width: 6vw;
        height: 6vw;
        font-size: 3.6vw;
    }
    #restart {
        width: 100%;
        max-width: 220px;
    }
}

@media (orientation: portrait) and (max-width: 430px) {
    #xo-board {
        grid-template-columns: repeat(15, 5.6vw);
        grid-template-rows: repeat(15, 5.6vw);
        max-width: 92vw;
    }
    .xo-cell {
        width: 5.6vw;
        height: 5.6vw;
        font-size: 3.4vw;
    }
    #restart {
        max-width: 200px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    #game-section {
        padding: 1.25rem;
    }
    #xo-board {
        grid-template-columns: repeat(15, min(5.5vw, 5.5vh));
        grid-template-rows: repeat(15, min(5.5vw, 5.5vh));
        max-width: 92vw;
    }
    .xo-cell {
        width: min(5.5vw, 5.5vh);
        height: min(5.5vw, 5.5vh);
        font-size: min(3.2vw, 3.2vh);
    }
    #restart {
        width: 100%;
        max-width: 240px;
    }
}

