* {
    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;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
}

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

h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.difficulty-selector label {
    color: #666;
    font-weight: 500;
}

.difficulty-selector select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.difficulty-selector select:hover {
    border-color: #667eea;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.game-board {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    border: 3px solid #333;
    background: #333;
    width: 100%;
    max-width: 450px;
    aspect-ratio: 1;
}

.cell {
    background: white;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

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

.cell.fixed {
    background: #f8f8f8;
    color: #333;
    font-weight: 700;
    cursor: default;
}

.cell.selected {
    background: #b3d9ff;
}

.cell.error {
    background: #ffcccc;
    color: #cc0000;
}

.cell.correct {
    background: #ccffcc;
}

/* 粗边框分隔 */
.cell:nth-child(3n) {
    border-right: 2px solid #333;
}

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

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

.cell:nth-child(n+73) {
    border-bottom: 3px solid #333;
}

.controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.message {
    text-align: center;
    min-height: 30px;
    font-size: 16px;
    font-weight: 500;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s;
}

.message.success {
    background: #d4edda;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* 数字选择器 */
.number-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f8f8;
    border-radius: 10px;
}

.number-btn {
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.number-btn.clear {
    grid-column: span 2;
    background: #ff6b6b;
    color: white;
    border-color: #ff6b6b;
}

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

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

    h1 {
        font-size: 2em;
    }

    .cell {
        font-size: 1.2em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

