* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* 防止移动设备点击时出现高亮 */
    touch-action: manipulation; /* 优化触摸行为 */
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* 防止页面滚动 */
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #333;
    user-select: none; /* 防止文本选择 */
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    max-height: 100vh;
    position: relative;
}

header {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 2em;
    color: #2C3E50;
    margin-bottom: 15px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 400px;
}

canvas {
    border: 2px solid #333;
    border-radius: 5px;
    background-color: #f8f8f8;
    max-width: 100%;
    height: auto;
    display: block;
    image-rendering: pixelated; /* 像素图像更清晰 */
    image-rendering: crisp-edges;
}

/* 触摸控制区域 */
.touch-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    z-index: 10;
    pointer-events: none; /* 默认不显示 */
}

.touch-zone {
    flex: 1;
    height: 100%;
    pointer-events: auto;
}

.touch-left:active, .touch-right:active {
    background-color: rgba(255, 255, 255, 0.1); /* 轻微视觉反馈 */
}

/* 射击按钮 */
.shoot-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: rgba(255, 87, 34, 0.7);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s, background-color 0.3s;
}

.shoot-button span {
    color: white;
    font-weight: bold;
    font-size: 14px;
}

.shoot-button:active {
    transform: scale(0.9);
    background-color: rgba(255, 87, 34, 0.9);
}

.game-instructions {
    margin-top: 15px;
    text-align: center;
}

button {
    margin-top: 10px;
    padding: 8px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    min-width: 120px;
    min-height: 44px; /* 移动设备上的最小触摸区域 */
}

button:hover {
    background-color: #45a049;
}

button:active {
    transform: scale(0.98); /* 按下时的视觉反馈 */
}

#restartBtn {
    background-color: #f44336;
}

#restartBtn:hover {
    background-color: #d32f2f;
}

footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: #666;
    width: 100%;
}

/* 手机上的提示标签 */
.tips {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.tip-left {
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.tip-right {
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
}

.tip-shoot {
    bottom: 90px;
    right: 20px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 10px;
        border-radius: 0;
        height: 100vh;
        justify-content: space-between;
    }

    h1 {
        font-size: 1.5em;
    }

    .game-header {
        font-size: 16px;
    }

    button {
        padding: 12px 24px; /* 移动设备上更大的按钮 */
        font-size: 16px;
        min-height: 50px;
    }
    
    /* 显示/隐藏移动/桌面特定内容 */
    .desktop-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    /* 移动设备上显示提示 */
    #game-container:active .tips {
        opacity: 1;
    }
}

/* 桌面设备规则 */
@media (min-width: 601px) {
    .mobile-only {
        display: none;
    }
    
    .desktop-only {
        display: block;
    }
    
    /* 在桌面上禁用触摸控制区域 */
    .touch-controls {
        display: none;
    }
} 