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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    padding: 20px;
}

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

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

button, select {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

button:hover {
    background-color: #45a049;
}

select {
    background-color: #2196F3;
}

select:hover {
    background-color: #0b7dda;
}

.status {
    text-align: center;
    margin-bottom: 15px;
    font-weight: bold;
    height: 20px;
}

.board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-gap: 1px;
    margin-bottom: 20px;
    border: 2px solid #333;
}

.cell {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    background-color: #fff;
    border: 1px solid #ccc;
    cursor: pointer;
}

.cell.fixed {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.cell.selected {
    background-color: #bbdefb;
}

.cell.error {
    color: #f44336;
}

.cell.highlight {
    background-color: #e3f2fd;
}

/* 添加3x3宫格的边框 */
.cell:nth-child(3n) {
    border-right: 2px solid #333;
}

.cell:nth-child(9n) {
    border-right: none;
}

.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);
    grid-gap: 5px;
    margin-bottom: 20px;
}

.num-btn {
    padding: 10px;
    font-size: 18px;
    font-weight: bold;
}

.num-btn:last-child {
    grid-column: span 5;
    background-color: #ff9800;
}

.num-btn:last-child:hover {
    background-color: #e68a00;
}

.timer {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

@media (max-width: 500px) {
    .controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .cell {
        font-size: 16px;
    }
    
    .num-btn {
        font-size: 16px;
        padding: 8px;
    }
}