* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

.game-container {
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    width: 100%;
    max-width: 1000px;
}

.header h1 {
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 10px;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) translateX(-5px);
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    max-width: 1000px;
    width: 100%;
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 150px;
}

.main-game {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    z-index: 10;
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #ffffff;
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: rgba(255, 255, 255, 0.9);
}

.controls-hint {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.controls-hint strong {
    color: #ffeb3b;
}

.game-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.game-btn:active {
    transform: translateY(0);
}

#restartBtn {
    display: none;
}

.hold-container, .next-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hold-container h3, .next-container h3 {
    margin-bottom: 10px;
    font-size: 1.2rem;
    color: #ffeb3b;
}

#holdCanvas, .next-pieces canvas {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.5);
}

.next-pieces {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-item .label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.stat-item .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffeb3b;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .side-panel {
        flex-direction: row;
        min-width: auto;
        width: 100%;
        max-width: 300px;
        justify-content: space-around;
    }
    
    .left-panel {
        order: 2;
    }
    
    .main-game {
        order: 1;
    }
    
    .right-panel {
        order: 3;
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .back-btn {
        position: static;
        transform: none;
        margin-bottom: 15px;
    }
    
    .header {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .side-panel {
        flex-direction: column;
        gap: 15px;
    }
    
    .hold-container, .next-container, .stats {
        padding: 10px;
    }
    
    #gameCanvas {
        width: 200px;
        height: 400px;
    }
}

/* 游戏动画效果 */
@keyframes lineComplete {
    0% { background-color: rgba(255, 255, 255, 0.3); }
    50% { background-color: rgba(255, 255, 255, 0.8); }
    100% { background-color: rgba(255, 255, 255, 0.3); }
}

.line-flash {
    animation: lineComplete 0.5s ease-in-out;
}

/* 方块颜色 */
.tetromino-I { background-color: #00f0f0; }
.tetromino-O { background-color: #f0f000; }
.tetromino-T { background-color: #a000f0; }
.tetromino-S { background-color: #00f000; }
.tetromino-Z { background-color: #f00000; }
.tetromino-J { background-color: #0000f0; }
.tetromino-L { background-color: #f0a000; }
