/* 像素风格字体和基础样式 */
@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: #2c2c2c;
    overflow: hidden;
    user-select: none;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* 屏幕切换 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #404040;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    display: none;
}

/* 像素文字样式 */
.pixel-text {
    color: #ffffff;
    text-align: center;
    text-shadow: 2px 2px 0px #000000;
    line-height: 1.5;
    margin: 20px;
}

.pixel-text.small {
    font-size: 12px;
    color: #cccccc;
}

/* 开始界面 */
#startScreen {
    background: linear-gradient(45deg, #404040, #505050);
}

#startScreen h1 {
    font-size: 24px;
    margin-bottom: 40px;
    animation: blink 2s infinite;
}

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

/* 游戏界面 */
#gameScreen {
    background-color: #808080;
    padding: 0;
}

#gameScreen.breathing {
    background-color: #202020;
    transition: background-color 0.2s ease;
}

/* 游戏UI */
#gameUI {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border: 2px solid #ffffff;
}

.ui-label {
    color: #ffffff;
    font-size: 12px;
    margin-right: 10px;
}

/* 血量条 */
#healthBar {
    display: flex;
    align-items: center;
}

.health-container {
    width: 120px;
    height: 16px;
    border: 2px solid #ffffff;
    background-color: #000000;
    position: relative;
}

#healthFill {
    height: 100%;
    background-color: #ff0000;
    width: 100%;
    transition: width 0.3s ease;
}

/* 计时器 */
#timer {
    display: flex;
    align-items: center;
    color: #ffffff;
    font-size: 12px;
}

#timeLeft {
    color: #ffff00;
    margin-left: 5px;
}

/* 游戏画布 */
#gameCanvas {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #808080;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* 结束界面 */
#endScreen {
    background: linear-gradient(45deg, #202020, #404040);
}

#endScreen h1 {
    font-size: 20px;
    max-width: 80%;
    margin-bottom: 40px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .pixel-text {
        font-size: 16px;
    }
    
    .pixel-text.small {
        font-size: 10px;
    }
    
    #endScreen h1 {
        font-size: 14px;
    }
    
    #gameUI {
        height: 35px;
        padding: 8px 15px;
    }
    
    .ui-label {
        font-size: 10px;
    }
    
    .health-container {
        width: 80px;
        height: 12px;
    }
    
    #timer {
        font-size: 10px;
    }
}

/* 像素化效果 */
canvas {
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* 动画效果 */
.damage-flash {
    animation: damageFlash 0.3s ease;
}

@keyframes damageFlash {
    0% { background-color: #808080; }
    50% { background-color: #ff4444; }
    100% { background-color: #808080; }
}
