/* 像素合成大师 - 像素风格样式 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    color: #ECF0F1;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
}

/* 游戏容器 */
.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #1a1a1a;
}

/* 顶栏 */
.top-bar {
    background: #2C3E50;
    padding: 10px 15px;
    border-bottom: 3px solid #34495E;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.score-display {
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 0px #34495E;
}

.score-display span {
    margin: 0 10px;
}

.current-score, .best-score {
    color: #F39C12;
}

/* 下一个方块预览 */
.next-block-preview {
    background: #34495E;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    border: 2px solid #2C3E50;
}

#next-block-preview {
    font-weight: bold;
    margin-left: 5px;
}

/* 游戏区域 */
.game-area {
    flex: 1;
    position: relative;
    background: linear-gradient(180deg, #1a1a1a 0%, #2C3E50 100%);
    overflow: hidden;
    border: 3px solid #34495E;
    margin: 10px;
    border-radius: 5px;
}

#game-canvas {
    display: block;
    background: transparent;
    cursor: crosshair;
}

/* 预览线 */
.preview-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        #ECF0F1,
        #ECF0F1 5px,
        transparent 5px,
        transparent 10px
    );
    opacity: 0.6;
    pointer-events: none;
    z-index: 10;
}

/* 警戒线 */
.warning-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        #E74C3C,
        #E74C3C 10px,
        #C0392B 10px,
        #C0392B 20px
    );
    opacity: 0.8;
    pointer-events: none;
    z-index: 10;
    animation: warningPulse 2s ease-in-out infinite;
}

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

/* 控制区域 */
.control-area {
    background: #2C3E50;
    padding: 15px;
    border-top: 3px solid #34495E;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.touch-controls {
    width: 100%;
    max-width: 420px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 投放按钮 */
.drop-button {
    background: linear-gradient(145deg, #3498DB, #2980B9);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 18px;
    font-weight: bold;
    padding: 15px 30px;
    cursor: pointer;
    box-shadow: 
        0 4px 0 #2471A3,
        0 6px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.drop-button:hover {
    background: linear-gradient(145deg, #5DADE2, #3498DB);
    transform: translateY(-1px);
}

.drop-button:active {
    transform: translateY(2px);
    box-shadow: 
        0 2px 0 #2471A3,
        0 4px 10px rgba(0, 0, 0, 0.3);
}

/* 游戏结束弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(145deg, #2C3E50, #34495E);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    border: 3px solid #34495E;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 300px;
    width: 90%;
}

.modal-content h2 {
    color: #E74C3C;
    margin-bottom: 20px;
    font-size: 24px;
    text-shadow: 2px 2px 0px #34495E;
}

.modal-content p {
    margin: 10px 0;
    font-size: 16px;
    color: #ECF0F1;
}

.final-score, .modal-best-score {
    color: #F39C12;
    font-weight: bold;
}

/* 重新开始按钮 */
.restart-button {
    background: linear-gradient(145deg, #27AE60, #229954);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    padding: 12px 25px;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: 
        0 3px 0 #1E8449,
        0 5px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.restart-button:hover {
    background: linear-gradient(145deg, #2ECC71, #27AE60);
    transform: translateY(-1px);
}

.restart-button:active {
    transform: translateY(2px);
    box-shadow: 
        0 1px 0 #1E8449,
        0 3px 10px rgba(0, 0, 0, 0.3);
}

/* 音效控制 */
.sound-control {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
}

.sound-button {
    background: rgba(44, 62, 80, 0.8);
    border: 2px solid #34495E;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: #ECF0F1;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.sound-button:hover {
    background: rgba(52, 73, 94, 0.9);
    transform: scale(1.1);
}

/* 屏幕闪烁效果 */
@keyframes screenFlash {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.screen-flash {
    animation: screenFlash 0.2s ease-in-out;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .top-bar {
        padding: 8px 10px;
        font-size: 12px;
    }
    
    .score-display {
        font-size: 12px;
    }
    
    .drop-button {
        font-size: 16px;
        padding: 12px 25px;
    }
    
    .modal-content {
        padding: 20px;
    }
    
    .modal-content h2 {
        font-size: 20px;
    }
}

/* 竖屏模式提示 */
@media (orientation: landscape) and (max-height: 600px) {
    .game-container {
        background: #1a1a1a;
    }
    
    .top-bar {
        background: #E74C3C;
    }
    
    .control-area {
        background: #E74C3C;
    }
    
    .landscape-warning {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(231, 76, 60, 0.9);
        color: white;
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        z-index: 999;
        display: block;
    }
}

/* 加载动画 */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.loading::after {
    content: '';
    display: block;
        width: 50px;
    height: 50px;
    border: 3px solid #34495E;
    border-top: 3px solid #3498DB;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}