* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f0f0;
}

/* 游戏机外壳样式 */
.game-console {
    background-color: #d32f2f; /* 红色主题 */
    border-radius: 20px;
    padding: 12px; /* 减小内边距 */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 
                inset 0 2px 10px rgba(255, 255, 255, 0.3),
                inset 0 -5px 10px rgba(0, 0, 0, 0.2);
    max-width: 550px;
    width: 100%;
    margin: 0 auto;
}

.console-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 8px; /* 减小内边距 */
    border-bottom: 2px solid #b71c1c;
    margin-bottom: 10px; /* 减小下边距 */
}

.brand-name {
    font-size: 24px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.7);
    letter-spacing: 2px;
}

.decorative-lights {
    display: flex;
    gap: 10px;
}

.light {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ffeb3b;
    box-shadow: 0 0 10px #ffeb3b;
    animation: blink 2s infinite alternate;
}

.light:nth-child(2) {
    animation-delay: 0.7s;
}

.light:nth-child(3) {
    animation-delay: 1.4s;
}

@keyframes blink {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.console-body {
    background-color: #e53935;
    border-radius: 15px;
    padding: 12px; /* 减小内边距 */
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.console-bottom {
    padding: 10px 0 5px; /* 减小内边距 */
    display: flex;
    justify-content: center;
}

.console-speaker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    width: 100px;
}

.speaker-hole {
    width: 20px;
    height: 5px;
    background-color: #b71c1c;
    border-radius: 2px;
}

.container {
    display: flex;
    gap: 15px; /* 减小间距 */
    background-color: #e53935;
    border-radius: 10px;
    justify-content: center;
}

.game-info {
    display: flex;
    flex-direction: column;
    width: 180px;
    color: white;
    flex-shrink: 0;
}

.game-screen {
    background-color: #b71c1c;
    padding: 10px; /* 减小内边距 */
    border-radius: 10px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    margin-right: 0;
}

.screen-border {
    background-color: #333;
    padding: 5px; /* 减小内边距 */
    border-radius: 5px;
    box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.2);
}

.game-board {
    border: none; /* 移除原有边框 */
    background-color: white;
    overflow: hidden; /* 防止内容溢出 */
}

h1 {
    margin-top: 0;
    font-size: 24px;
    text-align: center;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.score-container {
    margin-bottom: 15px; /* 减小下边距 */
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px; /* 减小内边距 */
    border-radius: 8px;
}

.score-container p {
    margin: 5px 0;
    font-weight: bold;
}

.next-piece {
    margin-bottom: 15px;
    background-color: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
    text-align: center;
}

.next-piece p {
    margin-bottom: 5px;
    font-weight: bold;
}

/* 下一个方块的画布容器 */
.next-piece-canvas-container {
    background-color: white;
    border-radius: 5px;
    padding: 10px;
    margin: 0 auto;
    width: 85%; /* 调整宽度适应功能区域 */
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

#next-canvas {
    display: block;
    background-color: white;
    border: none; /* 移除边框 */
}

.button-container {
    margin-top: auto;
}

.button-group {
    display: flex;
    gap: 10px;
}

button {
    padding: 8px 12px;
    background-color: #ffeb3b;
    color: #333;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

button:hover {
    background-color: #ffd600;
}

button:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

#board {
    display: block;
}

/* 游戏机风格的控制区域 */
.gamepad {
    margin-bottom: 0; /* 移除底部边距 */
    background-color: #b71c1c;
    border-radius: 15px;
    padding: 12px 10px; /* 减小内边距 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 
                inset 0 1px 3px rgba(255, 255, 255, 0.3);
}

.gamepad-title {
    color: #fff;
    text-align: center;
    margin-bottom: 10px; /* 减小下边距 */
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* 方向键 */
.direction-pad {
    position: relative;
    width: 110px;
    height: 110px;
    margin: 0 auto 15px;
}

.btn-direction {
    position: absolute;
    width: 35px;
    height: 35px;
    background-color: #333;
    color: white;
    border: 2px solid #555;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    padding: 0;
}

.btn-direction:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #444;
}

.btn-up {
    top: 0;
    left: 37px;
}

.btn-left {
    top: 37px;
    left: 0;
}

.btn-right {
    top: 37px;
    right: 0;
}

.btn-down {
    bottom: 0;
    left: 37px;
}

.btn-center {
    position: absolute;
    width: 25px;
    height: 25px;
    background-color: #444;
    border-radius: 50%;
    top: 42px;
    left: 42px;
}

/* 动作按钮 */
.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px; /* 减小间距 */
}

/* 并排按钮行 */
.action-row {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: center;
}

/* 功能按钮 */
.btn-action {
    width: 70px;
    height: 30px;
    background-color: #ffeb3b;
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #ff5722;
    padding: 0;
}

/* 游戏控制按钮 */
.game-controls {
    margin-top: 5px;
}

.btn-game-control {
    flex: 1;
    height: 30px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 15px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.btn-game-control:hover {
    background-color: #43a047;
}

.btn-game-control:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #388e3c;
}

/* 变形按钮 */
.transform-buttons {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.btn-transform {
    width: 30px;
    height: 30px;
    background-color: #ffeb3b;
    color: white;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #2196f3;
    padding: 0;
}

.btn-transform:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #ffd600;
}

.btn-action:active {
    transform: scale(0.95);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    background-color: #ffd600;
}

canvas {
    display: block;
    background-color: white;
    border: 1px solid #333; /* 统一边框样式 */
} 