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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    padding: 20px;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 900px;
    width: 100%;
}

.game-header {
    margin-bottom: 25px;
}

.game-header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 700;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 12px;
    font-weight: 600;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.9em;
    color: #6c757d;
}

.stat-value {
    font-size: 1.3em;
    color: #2c3e50;
}

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

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

.difficulty-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: #e9ecef;
    color: #495057;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.difficulty-btn.active {
    background: #2c3e50;
    color: white;
}

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

.control-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #3498db;
    color: white;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn.secondary {
    background: #95a5a6;
}

.btn.secondary:hover {
    background: #7f8c8d;
}

.sudoku-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    align-items: flex-start;
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 1px;
    background: #2c3e50;
    border: 3px solid #2c3e50;
    border-radius: 8px;
    padding: 3px;
    width: 450px;
    height: 450px;
}

.cell {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    user-select: none;
}

.cell:hover {
    background: #e74c3c;
    color: white;
}

.cell.selected {
    background: #3498db;
    color: white;
}

.cell.given {
    background: #ecf0f1;
    color: #2c3e50;
    cursor: default;
}

.cell.given:hover {
    background: #ecf0f1;
    color: #2c3e50;
}

.cell.error {
    background: #e74c3c;
    color: white;
    animation: shake 0.5s ease-in-out;
}

.cell.completed {
    background: #27ae60;
    color: white;
}

.cell.same-number {
    background: #f39c12;
    color: white;
}

.cell.notes-mode {
    font-size: 12px;
    line-height: 1.2;
    padding: 2px;
}

.cell-notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    width: 100%;
    height: 100%;
    font-size: 10px;
    color: #7f8c8d;
}

.note {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 宫格边界加粗 */
.cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 2px solid #2c3e50;
}

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

.number-pad {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    min-width: 200px;
}

.number-pad h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.number-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.number-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #bdc3c7;
    border-radius: 8px;
    background: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #2c3e50;
}

.number-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.number-btn.selected {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
}

.pad-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pad-controls .btn {
    width: 100%;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    text-align: left;
}

.rules, .tips {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #3498db;
}

.rules h3, .tips h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.rules ul, .tips ul {
    list-style: none;
    padding: 0;
}

.rules li, .tips li {
    color: #495057;
    margin-bottom: 10px;
    padding-left: 20px;
    position: relative;
    line-height: 1.5;
}

.rules li:before, .tips li:before {
    content: "▸";
    color: #3498db;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.game-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-message.show {
    display: flex;
}

.message-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
}

.message-content h2 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 2em;
}

.message-content p {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #495057;
}

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

@keyframes celebration {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cell.celebrate {
    animation: celebration 0.6s ease-in-out;
}

@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .sudoku-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .sudoku-grid {
        width: 300px;
        height: 300px;
    }
    
    .cell {
        font-size: 16px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-info {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .number-pad {
        width: 100%;
        max-width: 300px;
    }
}