/* 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;
}

.sudoku-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.controls label {
    font-weight: 500;
}

select#size {
    font-size: 1rem;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    border: 1px solid #ced4da;
}

#newGame, #checkSolution {
    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;
}

#newGame:hover, #checkSolution:hover {
    background-color: #0056b3;
}

#sudoku-board {
    display: grid;
    border: 3px solid #343a40;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-width: 100%;
}

.sudoku-cell {
    width: 50px;
    height: 50px;
    font-size: 1.8rem;
    text-align: center;
    border: 1px solid #ced4da;
    outline: none;
    transition: background-color 0.2s;
    box-sizing: border-box;
}

.sudoku-cell:focus {
    background-color: #e9ecef;
}

.sudoku-cell.fixed {
    background-color: #f8f9fa;
    font-weight: bold;
}

.sector-top { border-top: 2px solid #343a40; }
.sector-left { border-left: 2px solid #343a40; }
.sector-bottom { border-bottom: 2px solid #343a40; }
.sector-right { border-right: 2px solid #343a40; }

#message {
    font-size: 1.1rem;
    font-weight: 500;
    min-height: 24px;
}

/* 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 p, .info-card li, .info-card dd {
    color: #343a40;
}

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

.info-card dt {
    font-weight: bold;
    color: #005f9e;
    margin-top: 1rem;
}

/* 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;
    }
    .sudoku-cell {
        width: 9vw;
        height: 9vw;
        font-size: 5vw;
    }
    .controls {
        flex-direction: column;
    }
}

@media (max-width: 540px) {
    #game-section {
        padding: 1.5rem;
    }
    #sudoku-board {
        max-width: 96vw;
    }
    .sudoku-cell {
        width: 10vw;
        height: 10vw;
        font-size: 5.5vw;
    }
    #newGame, #checkSolution {
        width: 100%;
        max-width: 260px;
    }
}

@media (orientation: portrait) and (max-width: 480px) {
    #game-section {
        padding: 1.25rem;
    }
    #sudoku-board {
        max-width: 94vw;
    }
    .sudoku-cell {
        width: 10.5vw;
        height: 10.5vw;
        font-size: 6vw;
    }
    #newGame, #checkSolution {
        width: 100%;
        max-width: 220px;
    }
}

@media (orientation: portrait) and (max-width: 430px) {
    #sudoku-board {
        max-width: 92vw;
    }
    .sudoku-cell {
        width: 10.2vw;
        height: 10.2vw;
        font-size: 5.8vw;
    }
    #newGame, #checkSolution {
        max-width: 200px;
    }
}

@media (orientation: landscape) and (max-height: 520px) {
    #game-section {
        padding: 1.25rem;
    }
    #sudoku-board {
        max-width: 94vw;
    }
    .sudoku-cell {
        width: min(8vw, 8vh);
        height: min(8vw, 8vh);
        font-size: min(4.5vw, 4.5vh);
    }
    #newGame, #checkSolution {
        width: 100%;
        max-width: 240px;
    }
}
