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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: #333;
    overflow-x: hidden;
    padding: 20px;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 950px;
    width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow: hidden;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.game-header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 1.2em;
    font-weight: bold;
}

.game-info div span {
    color: #e74c3c;
    font-size: 1.3em;
}

.game-area {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    justify-content: center;
    max-height: 650px;
}

.game-board {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

#board {
    border: 3px solid #34495e;
    background: #ecf0f1;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 300px;
    height: 600px;
}

.row-sums {
    position: absolute;
    left: -45px;
    top: 0;
    bottom: 0;
    width: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0;
}

.row-sum {
    width: 35px;
    height: 28px;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 3px;
    font-size: 0.85em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin: 1px 0;
}

.side-panel {
    flex: 0 0 280px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 600px;
    overflow-y: auto;
}

.next-block {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.next-block h3 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

#nextBlock {
    border: 2px solid #bdc3c7;
    background: white;
    border-radius: 5px;
    width: 120px;
    height: 120px;
}

.controls, .game-rules {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.controls h3, .game-rules h3 {
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.controls p, .game-rules p {
    margin: 4px 0;
    font-size: 0.85em;
    line-height: 1.3;
}

.btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 100%;
    margin: 5px 0;
}

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

.btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.block-1 { background: #e74c3c; color: white; } /* 红色 */
.block-2 { background: #3498db; color: white; } /* 蓝色 */
.block-3 { background: #2ecc71; color: white; } /* 绿色 */
.block-4 { background: #f39c12; color: white; } /* 橙色 */
.block-5 { background: #9b59b6; color: white; } /* 紫色 */
.block-6 { background: #1abc9c; color: white; } /* 青色 */
.block-7 { background: #e67e22; color: white; } /* 深橙色 */

.cell {
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
}

@media (max-width: 1024px) {
    .game-container {
        max-width: 95vw;
        width: calc(100vw - 20px);
        padding: 15px;
    }
    
    .game-area {
        gap: 30px;
        max-height: none;
    }
    
    .side-panel {
        flex: 0 0 250px;
    }
}

@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        font-size: 1em;
    }
    
    #board {
        width: 250px;
        height: 500px;
    }
    
    .row-sums {
        left: -35px;
        width: 30px;
    }
    
    .row-sum {
        width: 25px;
        height: 22px;
        font-size: 0.7em;
    }
    
    .side-panel {
        flex: none;
        width: 100%;
        max-width: 300px;
        max-height: none;
    }
}