/* 像素俄罗斯方块 - 8位复古风格 */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    font-family: 'Press Start 2P', monospace;
    background-color: #1a1a2e;
    color: #eee;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* 扫描线效果 */
    background-image: 
        linear-gradient(transparent 50%, rgba(0, 0, 0, 0.1) 50%),
        linear-gradient(90deg, 
            rgba(255, 0, 0, 0.03), 
            rgba(0, 255, 0, 0.02), 
            rgba(0, 0, 255, 0.03)
        );
    background-size: 100% 4px, 3px 100%;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

/* 标题样式 */
.game-header {
    text-align: center;
    margin-bottom: 15px;
}

.pixel-title {
    font-size: 28px;
    color: #ff6b6b;
    text-shadow: 
        4px 4px 0 #c92a2a,
        -2px -2px 0 #ff8787;
    letter-spacing: 4px;
    animation: titlePulse 2s infinite;
}

.pixel-subtitle {
    font-size: 10px;
    color: #4ecdc4;
    margin-top: 5px;
    letter-spacing: 2px;
}

@keyframes titlePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 游戏容器 */
.game-container {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

/* 侧边面板 */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.info-box, .next-box, .controls-box {
    background: #16213e;
    border: 4px solid #4ecdc4;
    padding: 10px;
    box-shadow: 
        4px 4px 0 #1a1a2e,
        inset 2px 2px 0 rgba(255,255,255,0.1);
}

.info-label {
    font-size: 8px;
    color: #4ecdc4;
    margin-bottom: 5px;
    text-align: center;
}

.info-value {
    font-size: 16px;
    color: #ffe66d;
    text-align: center;
    text-shadow: 2px 2px 0 #b8860b;
}

/* 游戏画布 */
.game-board-wrapper {
    position: relative;
    border: 6px solid #4ecdc4;
    box-shadow: 
        6px 6px 0 #1a1a2e,
        inset 4px 4px 0 rgba(255,255,255,0.1),
        inset -4px -4px 0 rgba(0,0,0,0.3);
    background: #0f0f23;
}

#gameCanvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* 遮罩层 */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
}

.pixel-text {
    font-size: 14px;
    color: #4ecdc4;
    margin-bottom: 20px;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.pixel-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 15px 30px;
    background: #ff6b6b;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 
        4px 4px 0 #c92a2a,
        inset 2px 2px 0 rgba(255,255,255,0.3);
    transition: all 0.1s;
}

.pixel-btn:hover {
    background: #ff8787;
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0 #c92a2a,
        inset 2px 2px 0 rgba(255,255,255,0.3);
}

.pixel-btn:active {
    transform: translate(4px, 4px);
    box-shadow: none;
}

/* 下一个方块预览 */
#nextCanvas {
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
}

/* 控制说明 */
.controls-box {
    font-size: 8px;
}

.control-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 2px solid #2a2a4a;
}

.control-row:last-child {
    border-bottom: none;
}

.key {
    color: #ffe66d;
    min-width: 50px;
}

.action {
    color: #aaa;
}

/* 触摸控制 */
.touch-controls {
    display: none;
    margin-top: 20px;
    padding: 10px;
    background: #16213e;
    border: 4px solid #4ecdc4;
}

.touch-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.touch-row:last-child {
    margin-bottom: 0;
}

.touch-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 20px;
    width: 60px;
    height: 60px;
    background: #4ecdc4;
    color: #1a1a2e;
    border: none;
    cursor: pointer;
    box-shadow: 
        4px 4px 0 #2a9d8f,
        inset 2px 2px 0 rgba(255,255,255,0.3);
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.touch-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 
        2px 2px 0 #2a9d8f,
        inset 2px 2px 0 rgba(255,255,255,0.3);
    background: #6ee7de;
}

.touch-btn.wide {
    width: 140px;
    font-size: 12px;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .side-panel {
        flex-direction: row;
        width: 100%;
        justify-content: center;
    }
    
    .left-panel {
        order: 1;
    }
    
    .game-board-wrapper {
        order: 2;
    }
    
    .right-panel {
        order: 3;
    }
    
    .controls-box {
        display: none;
    }
    
    .touch-controls {
        display: block;
        order: 4;
    }
    
    .pixel-title {
        font-size: 20px;
    }
    
    #gameCanvas {
        width: 250px;
        height: 500px;
    }
}

@media (max-width: 480px) {
    .pixel-title {
        font-size: 16px;
    }
    
    .pixel-subtitle {
        font-size: 8px;
    }
    
    .info-box {
        padding: 5px;
    }
    
    .info-label {
        font-size: 6px;
    }
    
    .info-value {
        font-size: 12px;
    }
    
    #gameCanvas {
        width: 200px;
        height: 400px;
    }
    
    #nextCanvas {
        width: 80px;
        height: 80px;
    }
    
    .touch-btn {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }
    
    .touch-btn.wide {
        width: 110px;
        font-size: 10px;
    }
}
