* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
    padding: 10px;
}

.container {
    display: flex;
    gap: 20px;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap;
}

.game-info {
    width: 200px;
    padding: 15px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

h1 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
    color: #333;
}

.score-container, .level-container {
    margin-bottom: 15px;
    padding: 12px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.score-label, .level-label, .next-label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

#score, #level {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    color: #333;
}

.next-piece-container {
    margin-bottom: 20px;
    padding: 10px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

#next-piece {
    height: 120px;
    margin-top: 8px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #4ecca3;
    border-radius: 6px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#next-piece canvas {
    max-width: 100%;
    max-height: 100%;
}

.controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

button {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
}

#start-button {
    background: linear-gradient(145deg, #4caf50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#start-button:hover {
    background: linear-gradient(145deg, #45a049, #3d8b40);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

#start-button:active {
    transform: translateY(0);
}

#pause-button {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    color: white;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.4);
}

#pause-button:hover {
    background: linear-gradient(145deg, #1976D2, #0D47A1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.6);
}

#pause-button:active {
    transform: translateY(0);
}

.instructions {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.instructions h3 {
    font-size: 16px;
    margin-bottom: 10px;
    text-align: center;
}

.instructions p {
    font-size: 14px;
    margin-bottom: 5px;
}

.game-board-container {
    position: relative;
    flex-shrink: 0;
}

#game-board {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #4ecca3;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(78, 204, 163, 0.3), inset 0 0 30px rgba(0, 0, 0, 0.5);
}

/* 触摸控制器样式 */
.touch-controls {
    display: none;
    width: 100%;
    margin-top: 15px;
}

.control-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.control-btn {
    width: 140px;
    height: 70px;
    font-size: 32px;
    font-weight: bold;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.control-btn:active {
    transform: scale(0.90);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
    background: linear-gradient(145deg, #5a67d8, #6b46c1);
}

.control-btn:hover {
    background: linear-gradient(145deg, #5a67d8, #6b46c1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.rotate-btn, .drop-btn {
    width: 180px;
    font-size: 36px;
}

.drop-btn {
    background: linear-gradient(145deg, #f093fb, #f5576c);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

.drop-btn:hover {
    background: linear-gradient(145deg, #ed64a6, #e53e3e);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.6);
}

.drop-btn:active {
    background: linear-gradient(145deg, #d53f8c, #c53030);
    transform: scale(0.90);
}

/* 响应式设计 */
@media (max-width: 900px) {
    body {
        padding: 3px;
    }

    .container {
        flex-direction: row;
        align-items: flex-start;
        padding: 8px;
        max-width: 100vw;
        gap: 8px;
    }

    .game-info {
        width: 120px;
        order: 1;
        display: flex;
        flex-direction: column;
        padding: 6px;
        flex-shrink: 0;
    }

    h1 {
        font-size: 14px;
        margin-bottom: 6px;
        text-align: center;
    }

    .score-container, .level-container, .next-piece-container {
        margin-bottom: 5px;
        padding: 4px;
    }

    .score-label, .level-label, .next-label {
        font-size: 9px;
    }

    #score, #level {
        font-size: 14px;
    }

    #next-piece {
        height: 40px;
    }

    .controls {
        order: 2;
        margin-bottom: 5px;
    }

    button {
        padding: 6px 10px;
        font-size: 11px;
    }

    .instructions {
        display: none;
    }

    .game-board-container {
        order: 2;
        flex: 1;
        max-width: none;
    }

    #game-board {
        width: 100%;
        height: auto;
        max-height: calc(100vh - 200px);
        object-fit: contain;
    }

    .touch-controls {
        display: block;
        order: 3;
        width: 100%;
        margin-top: 5px;
    }

    .control-btn {
        width: 100px;
        height: 50px;
        font-size: 22px;
    }

    .rotate-btn, .drop-btn {
        width: 124px;
        font-size: 26px;
    }
}

@media (max-width: 600px) {
    .container {
        flex-direction: row;
        padding: 6px;
        align-items: flex-start;
    }

    .game-info {
        width: 100px;
        order: 1;
        flex-direction: column;
        flex-shrink: 0;
    }

    h1 {
        font-size: 12px;
        margin-bottom: 5px;
    }

    .score-container, .level-container, .next-piece-container {
        margin-bottom: 4px;
        padding: 3px;
    }

    .score-label, .level-label, .next-label {
        font-size: 8px;
    }

    #score, #level {
        font-size: 12px;
    }

    #next-piece {
        height: 40px;
    }

    .controls {
        width: 100%;
        margin-bottom: 4px;
    }

    button {
        padding: 5px 8px;
        font-size: 10px;
    }

    .game-board-container {
        order: 2;
        flex: 1;
        max-height: calc(100vh - 180px);
    }

    #game-board {
        max-height: calc(100vh - 180px);
    }

    .touch-controls {
        order: 3;
        width: 100%;
    }

    .control-btn {
        width: 90px;
        height: 45px;
        font-size: 20px;
    }

    .rotate-btn, .drop-btn {
        width: 116px;
        font-size: 24px;
    }
}

@media (max-width: 400px) {
    body {
        padding: 2px;
    }

    .container {
        padding: 5px;
        flex-direction: row;
    }

    .game-info {
        width: 90px;
        padding: 4px;
        flex-shrink: 0;
    }

    h1 {
        font-size: 11px;
        margin-bottom: 4px;
    }

    .score-label, .level-label, .next-label {
        font-size: 8px;
    }

    #score, #level {
        font-size: 11px;
    }

    #next-piece {
        height: 40px;
    }

    button {
        padding: 4px 6px;
        font-size: 9px;
    }

    .game-board-container {
        max-height: calc(100vh - 160px);
    }

    #game-board {
        max-height: calc(100vh - 160px);
    }

    .touch-controls {
        margin-top: 8px;
    }

    .control-btn {
        width: 80px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }

    .rotate-btn, .drop-btn {
        width: 104px;
        font-size: 22px;
    }

    .control-row {
        gap: 8px;
    }
}

@media (max-width: 360px) {
    body {
        padding: 1px;
    }

    .container {
        padding: 4px;
        flex-direction: row;
    }

    .game-info {
        width: 80px;
        padding: 3px;
        flex-shrink: 0;
    }

    h1 {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .score-label, .level-label, .next-label {
        font-size: 7px;
    }

    #score, #level {
        font-size: 10px;
    }

    #next-piece {
        height: 26px;
    }

    button {
        padding: 3px 5px;
        font-size: 8px;
    }

    .game-board-container {
        max-height: calc(100vh - 140px);
    }

    #game-board {
        max-height: calc(100vh - 140px);
    }

    .control-btn {
        width: 72px;
        height: 36px;
        font-size: 16px;
    }

    .rotate-btn, .drop-btn {
        width: 96px;
        font-size: 20px;
    }

    .control-row {
        gap: 6px;
    }
}