* {
    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;
    margin: 0;
}

.container {
    text-align: center;
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

h1.title {
    color: #333;
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #333;
    margin-bottom: 15px;
}

.timer {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 8px;
    display: inline-block;
}

#sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 45px);
    grid-template-rows: repeat(9, 45px);
    border: 3px solid #222;
    margin: 0 auto 20px;
    background: #222;
    width: fit-content;
    position: relative;
    z-index: 1;
}

.cell {
    width: 45px;
    height: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 22px;
    font-weight: bold;
    background: white;
    border: 1px solid #ccc;
    cursor: pointer;
    user-select: none;
    position: relative;
    z-index: 2;
}

.cell:hover:not(.fixed) {
    background: #e8f4ff;
}

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

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

.cell.selected {
    background-color: #bbdefb !important;
    box-shadow: inset 0 0 0 3px #1976D2;
}

.cell.user-input {
    color: #0066cc;
}

.cell.invalid {
    background-color: #ffcdd2 !important;
    color: #c62828 !important;
}

/* Bordes групос para regiones 3x3 */
.cell:nth-child(3n) {
    border-right: 2px solid #222;
}

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

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

.controls {
    margin-bottom: 15px;
}

.controls button {
    margin: 0 5px;
    padding: 12px 20px;
    font-size: 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

#new-game {
    background: #4CAF50;
    color: white;
}

#check-solution {
    background: #2196F3;
    color: white;
}

#solve {
    background: #FF9800;
    color: white;
}

.numpad {
    margin-bottom: 15px;
}

.numpad button {
    width: 42px;
    height: 42px;
    font-size: 18px;
    font-weight: bold;
    margin: 2px;
    border: none;
    border-radius: 6px;
    background: #555;
    color: white;
    cursor: pointer;
}

.numpad button:hover {
    background: #777;
}

.numpad button.selected {
    background: #2196F3;
}

.message {
    font-size: 18px;
    font-weight: bold;
    min-height: 24px;
}

.message.success {
    color: #4CAF50;
}

.message.error {
    color: #f44336;
}

.selected {
    background-color: #bbdefb !important;
    outline: 2px solid #2196f3;
}

.rules {
    background: #f8f8f8;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
    text-align: left;
}

.rules h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 18px;
}

.rules ul {
    margin: 0;
    padding-left: 20px;
}

.rules li {
    color: #555;
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.5;
}