html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none; /* 全局禁止默认触摸行为 */
    overscroll-behavior: none; /* 禁止滚动链 */
    user-select: none; /* 禁止选择文本 */
    -webkit-user-select: none;
    -webkit-touch-callout: none; /* 禁止长按菜单 */
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    touch-action: none; /* 防止触摸时的默认行为（如滚动、缩放） */
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(0, 255, 255, 0.1) 0%, transparent 70%);
}

/* 触摸控制按钮 */
.touch-controls {
    position: absolute;
    bottom: 30px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 30;
    opacity: 0.7;
}

.control-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 255, 0.5);
    color: #00ffcc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation; /* 防止触摸时的默认行为 */
    -webkit-tap-highlight-color: transparent; /* 移除点击时的高亮效果 */
}

.control-group {
    display: flex;
    gap: 10px;
}

.game-info {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none; /* 防止遮挡触摸事件 */
}

#totalLogins, #score, #lives, #weapon, #weaponTime {
    font-size: clamp(8px, 2.6vw, 12px); /* 响应式字体大小 */
    font-weight: bold;
    color: #00ffcc;
    text-shadow: 0 0 10px #00ffcc, 0 0 20px #00ffcc;
    background: rgba(0, 0, 0, 0.5); /* 降低透明度 */
    padding: clamp(3px, 0.7vw, 6px) clamp(6px, 1.4vw, 12px);
    border-radius: 5px;
    border: 1px solid rgba(0, 255, 255, 0.3);
    white-space: nowrap; /* 防止换行 */
}

#lives {
    color: #00ff00;
    text-shadow: 0 0 10px #00ff00, 0 0 20px #00ff00;
    border-color: rgba(0, 255, 0, 0.5);
}

#weapon {
    color: #ff0066;
    text-shadow: 0 0 10px #ff0066, 0 0 20px #ff0066;
    border-color: rgba(255, 0, 102, 0.5);
}

#weaponTime {
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00, 0 0 20px #ffff00;
    border-color: rgba(255, 255, 0, 0.5);
}

/* 全屏按钮 */
.fullscreen-btn {
    position: absolute;
    top: 70px; /* 下移，避免与声音按钮重叠 */
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(0, 255, 255, 0.5);
    border-radius: 5px;
    color: #00ffcc;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.fullscreen-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.fullscreen-btn svg {
    width: 24px;
    height: 24px;
}

.game-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 居中定位 */
    width: 80%;
    max-width: 600px;
    height: auto;
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 20;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    pointer-events: none; /* 让点击穿透到canvas，通过JS控制显示隐藏 */
}

.game-overlay h1 {
    font-size: clamp(24px, 8vw, 48px);
    color: #ff0066;
    text-shadow: 0 0 20px #ff0066, 0 0 40px #ff0066;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
    text-align: center;
    line-height: 1.2;
}

.game-title-small {
    font-size: clamp(14px, 3vw, 18px);
    color: #00ffcc;
    opacity: 0.8;
    margin-bottom: 10px;
    margin-top: 0;
    text-shadow: 0 0 5px #00ffcc;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.game-overlay p {
    font-size: clamp(14px, 4vw, 20px);
    color: #00ffcc;
    text-shadow: 0 0 10px #00ffcc;
    margin: 10px 0;
    text-align: center;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.8), 0 0 30px rgba(0, 255, 255, 0.5);
    }
    100% {
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
    }
}

.game-container {
    animation: glow 3s infinite;
}