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

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

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 30px;
    max-width: 500px;
    width: 100%;
}

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

.title {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    color: #999;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 10px;
}

.difficulty-selector {
    display: flex;
    gap: 5px;
}

.difficulty-btn {
    padding: 8px 16px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: #667eea;
    color: white;
}

.difficulty-btn.active {
    background: #667eea;
    color: white;
}

.new-game-btn {
    padding: 8px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.new-game-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

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

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.info-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 2px;
    background: #667eea;
    padding: 2px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.cell {
    aspect-ratio: 1;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e0e0e0;
}

.cell:nth-child(3n) {
    border-right: 2px solid #667eea;
}

.cell:nth-child(9n) {
    border-right: 1px solid #e0e0e0;
}

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

.cell:hover {
    background: #f0f4ff;
}

.cell.selected {
    background: #667eea;
    color: white;
}

.cell.fixed {
    background: #f8f9fa;
    color: #333;
    cursor: default;
}

.cell.fixed:hover {
    background: #f8f9fa;
}

.cell.error {
    background: #ff6b6b;
    color: white;
    animation: shake 0.5s ease;
}

.cell.highlight {
    background: #e8f0fe;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.number-btn {
    padding: 15px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.number-btn:hover {
    background: #667eea;
    color: white;
    transform: scale(1.05);
}

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

.clear-btn {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
}

.clear-btn:hover {
    background: #ff5252;
    border-color: #ff5252;
}

.game-message {
    text-align: center;
    padding: 15px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    display: none;
}

.game-message.success {
    background: #d4edda;
    color: #155724;
    display: block;
    animation: fadeIn 0.5s ease;
}

.game-message.failure {
    background: #f8d7da;
    color: #721c24;
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.modal-title {
    font-size: 32px;
    color: #667eea;
    margin-bottom: 10px;
}

.modal-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 30px;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #667eea;
}

.modal-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.modal-btn:active {
    transform: translateY(-1px);
}

@media (max-width: 480px) {
    .container {
        padding: 20px;
    }

    .title {
        font-size: 28px;
    }

    .game-controls {
        flex-direction: column;
        gap: 15px;
    }

    .difficulty-selector {
        width: 100%;
        justify-content: center;
    }

    .difficulty-btn {
        flex: 1;
    }

    .new-game-btn {
        width: 100%;
    }

    .cell {
        font-size: 16px;
    }

    .number-btn {
        padding: 12px;
        font-size: 16px;
    }
}