/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #e63946;
    color: #fff;
    overflow: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('image/bj.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.3;
    z-index: -1;
}

/* 游戏容器 */
.game-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* 屏幕样式 */
.screen {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: absolute;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none;
}

/* 加载界面样式 */
.loading-progress {
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background-color: #ffd700;
    transition: width 0.3s ease;
    border-radius: 10px;
}

#loading-text {
    font-size: 1rem;
    color: #fff;
}

/* 标题样式 */
h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.start-screen-image {
    width: 150px;
    height: 150px;
    object-fit: contain;
    margin-bottom: 2rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* 目标分数设置 */
.target-score-setting {
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

#target-score {
    width: 80px;
    height: 40px;
    font-size: 1.2rem;
    text-align: center;
    border: none;
    border-radius: 5px;
    margin-left: 10px;
}

/* 按钮样式 */
button {
    padding: 12px 24px;
    font-size: 1.2rem;
    background-color: #ffd700;
    color: #333;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-weight: bold;
}

button:hover {
    background-color: #ffed4e;
}

/* 分数显示 */
.score-display {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 1.2rem;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 5px;
}

/* 游戏区域 */
#game-area {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

/* 下落元素 */
.falling-element {
    position: absolute;
    display: flex;
    align-items: center;
    animation: fall linear infinite;
    box-sizing: border-box;
    padding: 5px;
}

.element-image {
    width: 60px;
    height: 60px;
    margin-right: 10px;
    object-fit: contain;
}

.element-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 聚宝盆 */
#treasure-basin {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 120px;
    background-image: url('image/jubaopen.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-sizing: border-box;
}

/* 游戏结束界面 */
#end-screen {
    background-color: rgba(0, 0, 0, 0.7);
    position: relative;
}

#end-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* 动画 */
@keyframes fall {
    from {
        top: -100px;
    }
    to {
        top: 100vh;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .element-image {
        width: 40px;
        height: 40px;
    }
    
    .element-value {
        font-size: 1rem;
    }
    
    #treasure-basin {
        width: 80px;
        height: 80px;
    }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* 确保模态框隐藏时不显示 */
.modal.hidden {
    display: none;
}

.modal-content {
    background: #ff0000;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-content div {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#modal-confirm-button {
    background-color: #ffd700;
    color: #333;
    border: none;
    padding: 12px 40px;
    font-size: 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
    margin-top: 1rem;
}

#modal-confirm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

#modal-confirm-button:active {
    transform: translateY(0);
}

/* 重新开始按钮样式 */
#restart-button {
    position: absolute;
    top: 80%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #ffd700;
    color: #333;
    border: none;
    padding: 12px 40px;
    font-size: 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    transition: all 0.3s ease;
    z-index: 10;
}

#restart-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}

#restart-button:active {
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.2rem;
    }
    
    .score-display {
        font-size: 1rem;
        top: 10px;
        left: 10px;
    }
    
    .element-image {
        width: 30px;
        height: 30px;
    }
    
    .element-value {
        font-size: 0.8rem;
    }
    
    #treasure-basin {
        width: 60px;
        height: 60px;
        bottom: 30px;
    }
}