/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Arial', sans-serif;
    background: #2c3e50;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow: hidden;
}

/* 游戏容器 - Game Boy 风格 */
.game-container {
    width: 100%;
    max-width: 900px;
    background: #f1c40f;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 20px;
}

.logo-text {
    font-size: 2em;
    font-weight: 900;
    color: #000;
    letter-spacing: 0.2em;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.2);
}

.logo-subtitle {
    font-size: 0.9em;
    color: #333;
    letter-spacing: 0.1em;
    margin-top: 5px;
}

/* 主游戏区域 */
.game-main {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

/* 隐藏桌面端面板 */
.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* 游戏信息栏 - 显示在右侧 */
.game-info-bar {
    display: none;
}

/* 游戏板 */
.game-board {
    flex: 1;
    background: #9b9b7a;
    border: 8px solid #000;
    border-radius: 10px;
    padding: 15px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    min-height: 0;
}

#gameCanvas {
    display: block;
    background: #8b9a5b;
    border: 2px solid #5a6b3a;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* 统计卡片 */
.stats-card {
    background: #9b9b7a;
    border: 4px solid #000;
    border-radius: 8px;
    padding: 12px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    border-bottom: 2px solid #7a7a5a;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.8em;
    color: #333;
    font-weight: bold;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #000;
}

/* 下一个方块卡片 */
.next-piece-card {
    background: #9b9b7a;
    border: 4px solid #000;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.next-piece-card h3 {
    font-size: 0.8em;
    color: #333;
    font-weight: bold;
    margin-bottom: 8px;
}

#nextCanvas {
    display: block;
    margin: 0 auto;
    background: #8b9a5b;
    border: 2px solid #5a6b3a;
    image-rendering: pixelated;
}

/* 控制区域 */
.mobile-controls {
    display: none !important;
}

/* 左侧按钮组 */
.control-buttons-left {
    display: flex;
    gap: 15px;
}
.desktop-controls {
    width: 100%;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    padding: 12px 20px;
    font-size: 1em;
    border: 4px solid #333;
    border-radius: 10px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 0 #222, 0 8px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #222, 0 4px 5px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: radial-gradient(circle at 30% 30%, #4caf50, #2e7d32);
}

.btn-secondary {
    background: radial-gradient(circle at 30% 30%, #2196f3, #1565c0);
}

.btn-danger {
    background: radial-gradient(circle at 30% 30%, #f44336, #c62828);
}

.btn-icon {
    font-size: 1.2em;
}

/* 键盘操作指南 */
.instructions-card {
    background: #9b9b7a;
    border: 4px solid #000;
    border-radius: 8px;
    padding: 15px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.2);
}

.instructions-card h3 {
    font-size: 0.9em;
    color: #333;
    font-weight: bold;
    margin-bottom: 12px;
    text-align: center;
}

.key-guide {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.key-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.key {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    border: 2px solid #333;
    font-weight: bold;
    font-size: 0.8em;
    min-width: 40px;
    text-align: center;
}

.key-item span:last-child {
    font-size: 0.85em;
    color: #333;
    font-weight: bold;
}
.control-buttons-left {
    display: flex;
    gap: 15px;
}

/* 控制按钮 */
.game-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid #333;
    font-size: 0.75em;
    font-weight: bold;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 6px 0 #222, 0 8px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.game-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #222, 0 4px 5px rgba(0, 0, 0, 0.3);
}

.btn-pause-game {
    background: radial-gradient(circle at 30% 30%, #4caf50, #2e7d32);
}

.btn-sound {
    background: radial-gradient(circle at 30% 30%, #4caf50, #2e7d32);
}

.btn-restart {
    background: radial-gradient(circle at 30% 30%, #f44336, #c62828);
}

/* 右侧方向控制 */
.control-pad {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 12px;
    position: relative;
}

.control-row {
    display: contents;
}

.control-btn {
    border-radius: 50%;
    border: 4px solid #333;
    background: radial-gradient(circle at 30% 30%, #5c7cfa, #3b5bdb);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow: 0 6px 0 #222, 0 8px 10px rgba(0, 0, 0, 0.3);
    font-size: 0.75em;
    font-weight: bold;
    text-align: center;
}

.control-btn:active,
.control-btn.active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #222, 0 4px 5px rgba(0, 0, 0, 0.3);
}

.control-btn svg {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
}

/* 按钮位置 */
.btn-rotate {
    grid-column: 2;
    grid-row: 1;
}

.btn-left {
    grid-column: 1;
    grid-row: 2;
}

.btn-down {
    grid-column: 2;
    grid-row: 2;
}

.btn-right {
    grid-column: 3;
    grid-row: 2;
}

.btn-drop {
    grid-column: 2;
    grid-row: 3;
    width: 120px;
    height: 120px;
}

/* 移动端按钮 */
.mobile-buttons {
    display: none;
}

/* ��戏结束覆盖层 */
.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    z-index: 1000;
}

.game-over-overlay.show {
    display: flex;
}

.game-over-content {
    text-align: center;
    padding: 40px;
    background: #f1c40f;
    border-radius: 15px;
    border: 6px solid #000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-over-content h2 {
    font-size: 2.5em;
    color: #000;
    margin-bottom: 20px;
    font-weight: 900;
}

.final-score {
    margin-bottom: 25px;
}

.final-score span:first-child {
    font-size: 1em;
    color: #333;
    font-weight: bold;
    display: block;
    margin-bottom: 10px;
}

.final-score span:last-child {
    font-size: 3em;
    font-weight: 900;
    color: #000;
}

.btn-glow {
    padding: 15px 40px;
    font-size: 1.1em;
    background: radial-gradient(circle at 30% 30%, #4caf50, #2e7d32);
    border: 4px solid #333;
    border-radius: 50px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 6px 0 #222, 0 8px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
}

.btn-glow:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #222, 0 4px 5px rgba(0, 0, 0, 0.3);
}

/* 隐藏不需要的元素 */
.background-animation {
    display: none;
}

/* PC端布局优化 */
@media (min-width: 769px) {
    .game-info-bar {
        display: none !important;
    }
    
    .mobile-controls {
        display: none !important;
    }
    
    .left-panel,
    .right-panel {
        display: flex !important;
        min-width: 180px;
    }
}