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

body {
    font-family: 'Courier New', monospace;
    background: #f7f7f7;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: #535353;
}

.game-container {
    text-align: center;
    background: #f7f7f7;
    padding: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

.game-header {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 16px;
    font-weight: normal;
    color: #535353;
    z-index: 5;
}

#high-score {
    color: #535353;
}

.canvas-container {
    position: relative;
    width: 800px;
    height: 400px;
    border-right: 2px solid #535353;
    border-bottom: 2px solid #535353;
    background: #f7f7f7;
    margin-top: 10px; /* 向下降10px */
}

.canvas-container.video-playing {
    border: none; /* 播放视频时去掉边框 */
}

#gameCanvas {
    background: #f7f7f7;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    width: 800px;
    height: 400px;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}

#celebrationVideo {
    width: 1200px;
    height: 600px;
    position: absolute;
    top: -100px;
    left: -200px;
    background: #f7f7f7;
    cursor: pointer;
}

.game-controls {
    margin-top: 20px;
    z-index: 10;
}

.instructions {
    margin-bottom: 15px;
    font-size: 14px;
    color: #535353;
}

.start-btn, .restart-btn {
    background: #f7f7f7;
    color: #535353;
    border: 1px solid #d3d3d3;
    padding: 8px 16px;
    font-size: 14px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
}

.start-btn:hover, .restart-btn:hover {
    background: #e6e6e6;
}

.start-btn:active, .restart-btn:active {
    background: #d3d3d3;
}

.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f7f7f7;
    color: #535353;
    padding: 30px;
    border: 1px solid #d3d3d3;
    text-align: center;
    z-index: 100;
}

.game-over h2 {
    margin-bottom: 15px;
    font-size: 24px;
}

.game-over p {
    margin-bottom: 20px;
    font-size: 18px;
}

.hidden {
    display: none;
}


@media (max-width: 850px) {
    .canvas-container {
        width: 100vw;
        height: 40vh;
        max-width: 100vw;
    }
    
    #gameCanvas {
        width: 100vw;
        height: 40vh;
        max-width: 100vw;
    }
    
    #celebrationVideo {
        width: 150vw;
        height: 60vh;
        max-width: 150vw;
        left: -25vw;
        top: -10vh;
    }
    
    .game-container {
        padding: 10px;
    }
    
    .instructions {
        font-size: 12px;
    }
}

/* Simple Gift Dialog Styles */
.gift-dialog-simple {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #f7f7f7;
    border: 2px solid #535353;
    padding: 20px;
    text-align: center;
    z-index: 1000;
    font-family: 'Courier New', monospace;
}

.gift-dialog-simple.hidden {
    display: none !important;
}

.dialog-content h3 {
    color: #535353;
    margin-bottom: 15px;
    font-size: 16px;
}

.dialog-content p {
    color: #535353;
    margin-bottom: 20px;
    font-size: 14px;
}

.dialog-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.dialog-btn {
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    border: 1px solid #d3d3d3;
    background: #f7f7f7;
    color: #535353;
    cursor: pointer;
}

.dialog-btn:hover {
    background: #e6e6e6;
}

.dialog-btn:active {
    background: #d3d3d3;
}

.keyboard-instructions {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #d3d3d3;
}

.keyboard-instructions p {
    margin: 5px 0;
    font-size: 11px;
    color: #666;
    font-style: italic;
}

/* 背景装饰图片样式 */
.bg-images {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 图片不影响游戏交互 */
    z-index: 1; /* 确保在游戏画布下方 */
}

.bg-image {
    position: absolute;
    max-width: 250px;
    max-height: 250px;
    transition: opacity 0.5s ease-in-out;
}

/* 左上角 */
.bg-top-left {
    top: 60px;
    left: 60px;
}

/* 右上角 */
.bg-top-right {
    top: 60px;
    right: 60px;
}

/* 左下角 */
.bg-bottom-left {
    bottom: 60px;
    left: 60px;
}

/* 右下角 */
.bg-bottom-right {
    bottom: 60px;
    right: 60px;
}


/* 视频播放时隐藏背景图片 */
.bg-images.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .bg-image {
        max-width: 180px;
        max-height: 180px;
    }
    
    .bg-top-left, .bg-top-right {
        top: 40px;
    }
    
    .bg-bottom-left, .bg-bottom-right {
        bottom: 40px;
    }
    
    .bg-top-left, .bg-bottom-left {
        left: 40px;
    }
    
    .bg-top-right, .bg-bottom-right {
        right: 40px;
    }
}

@media (max-width: 950px) {
    .bg-image {
        max-width: 120px;
        max-height: 120px;
    }
    
    .bg-top-left, .bg-top-right {
        top: 20px;
    }
    
    .bg-bottom-left, .bg-bottom-right {
        bottom: 20px;
    }
    
    .bg-top-left, .bg-bottom-left {
        left: 20px;
    }
    
    .bg-top-right, .bg-bottom-right {
        right: 20px;
    }
}