* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

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

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

select, button {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: bold;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

select:focus, button:focus {
    outline: none;
    border-color: #667eea;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.timer, .mistakes {
    font-weight: bold;
    color: #333;
}

.sudoku-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: #333;
    border: 3px solid #333;
    border-radius: 10px;
    padding: 5px;
    width: 450px;
    height: 450px;
}

.cell {
    background: white;
    border: 1px solid #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.cell:hover {
    background: #e3f2fd;
}

.cell.selected {
    background: #2196f3 !important;
    color: white;
}

.cell.given {
    background: #f5f5f5;
    color: #333;
    cursor: default;
}

.cell.error {
    background: #ffebee;
    color: #d32f2f;
}

.cell.highlight {
    background: #fff3e0;
}

.cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 2px solid #333;
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 2px solid #333;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.number-btn {
    aspect-ratio: 1;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.number-btn:hover {
    transform: scale(1.1);
}

.number-btn.erase {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    grid-column: span 2;
    border-radius: 25px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 15px;
    width: 300px;
    text-align: center;
    animation: slideIn 0.3s ease;
}

.modal-content h2 {
    color: #4caf50;
    margin-bottom: 20px;
    font-size: 2em;
}

.modal-content p {
    margin-bottom: 15px;
    color: #666;
    font-size: 16px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    .container {
        margin: 20px;
        padding: 20px;
    }
    
    .sudoku-grid {
        width: 350px;
        height: 350px;
    }
    
    .cell {
        font-size: 16px;
    }
    
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .number-pad {
        grid-template-columns: repeat(3, 1fr);
    }
}