@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    min-height: 100vh;
    padding: 20px;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}


header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 450px;
}

header h1 {
    color: #0f172a;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
}

.language-selector {
    display: flex;
    align-items: center;
}

.language-selector select {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    min-width: 80px;
}

.language-selector select:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
}

.language-selector select:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.game-controls button, .game-controls select {
    padding: 12px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.game-controls button:hover, .game-controls select:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.game-controls button:active, .game-controls select:active {
    transform: translateY(0);
}

#new-game {
    background: #8b5cf6;
    color: white;
    border-color: #8b5cf6;
}

#new-game:hover {
    background: #7c3aed;
    border-color: #7c3aed;
    color: white;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    background: #cbd5e1;
    border: 3px solid #64748b;
    border-radius: 12px;
    padding: 3px;
    margin: 0 auto;
    width: 450px;
    height: 450px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.sudoku-cell {
    background: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.sudoku-cell:hover:not(.given) {
    background: #f1f5f9;
}

.sudoku-cell.selected {
    background: #ede9fe;
    box-shadow: inset 0 0 0 2px #8b5cf6;
}

.sudoku-cell.given {
    background: #f8fafc;
    color: #0f172a;
    cursor: default;
    font-weight: 700;
}

.sudoku-cell.error {
    background: #fef2f2;
    color: #dc2626;
    box-shadow: inset 0 0 0 2px #dc2626;
}

.sudoku-cell.completed {
    background: #f0fdf4;
    color: #16a34a;
}

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

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #64748b;
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    outline: none;
    color: inherit;
    font-family: inherit;
}

.sudoku-cell input::placeholder {
    color: #94a3b8;
    opacity: 0.7;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: 16px;
    font-weight: 500;
    width: 450px;
    max-width: 100%;
}

#timer {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #8b5cf6;
    font-weight: 600;
}

#timer::before {
    content: "⏱";
    font-size: 18px;
}

#status {
    font-weight: 500;
    color: #475569;
}

.difficulty-label {
    position: absolute;
    top: -8px;
    left: 12px;
    background: white;
    padding: 0 8px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.game-controls {
    position: relative;
}

.game-controls select {
    position: relative;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-width: 300px;
    width: 100%;
}

.number-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    color: #475569;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    transform: scale(1.05);
}

.number-btn:active {
    transform: scale(0.95);
}

.erase-btn {
    background: #f87171;
    border-color: #f87171;
    color: white;
}

.erase-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

@media (max-width: 600px) {
    body {
        padding: 15px;
        gap: 20px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .language-selector select {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .sudoku-board {
        width: 320px;
        height: 320px;
    }
    
    .sudoku-cell {
        font-size: 18px;
    }
    
    .sudoku-cell input {
        font-size: 18px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .game-controls button, .game-controls select {
        width: 100%;
        max-width: 200px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        width: 320px;
    }
    
    .number-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
}

@media (max-width: 400px) {
    .sudoku-board {
        width: 280px;
        height: 280px;
    }
    
    .sudoku-cell {
        font-size: 16px;
    }
    
    .sudoku-cell input {
        font-size: 16px;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pulse {
    animation: pulse 0.5s ease-in-out;
}

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