:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --danger-color: #f72585;
    --success-color: #4cc9f0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f5f7fa;
    color: var(--dark-color);
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    margin-bottom: 30px;
}

.home-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    box-shadow: var(--box-shadow);
}

.home-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.title {
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--primary-color);
    text-align: center;
    flex-grow: 1;
}

.game-container {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: var(--box-shadow);
    margin-bottom: 30px;
}

.controls-panel {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    gap: 15px;
}

.level-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-selector label {
    font-weight: 500;
    color: var(--dark-color);
}

.styled-select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    background-color: white;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
}

.styled-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--box-shadow);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background-color: #f0f4ff;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #d1146a;
    transform: translateY(-2px);
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, minmax(40px, 60px));
    grid-gap: 2px;
    background-color: var(--dark-color);
    width: fit-content;
    margin: 0 auto;
    border: 2px solid var(--dark-color);
    border-radius: 4px;
    overflow: hidden;
}

.cell {
    aspect-ratio: 1;
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    transition: background-color 0.2s;
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary-color);
    background-color: transparent;
}

.cell input:focus {
    outline: none;
    background-color: #f0f4ff;
}

.cell.given {
    background-color: #f8f9fa;
    color: var(--dark-color);
    font-weight: 600;
}

.cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 2px solid var(--dark-color);
}

.cell:nth-child(n+19):nth-child(-n+27),
.cell:nth-child(n+46):nth-child(-n+54),
.cell:nth-child(n+73):nth-child(-n+81) {
    border-bottom: 2px solid var(--dark-color);
}

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
    display: none;
}

.message.success {
    display: block;
    background-color: rgba(76, 201, 240, 0.2);
    color: #0a6c7e;
}

.message.error {
    display: block;
    background-color: rgba(247, 37, 133, 0.2);
    color: #a3124e;
}

.footer {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    margin-top: auto;
}

.footer i {
    color: var(--danger-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
    }
    
    .controls-panel {
        flex-direction: column;
        align-items: stretch;
    }
    
    .sudoku-grid {
        grid-template-columns: repeat(9, minmax(30px, 1fr));
    }
    
    .cell, .cell input {
        font-size: 1rem;
    }
}