/* 游戏主样式文件 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    overflow: hidden;
    background-color: #000;
}

/* 游戏容器 */
.game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 游戏画布 */
#gameCanvas {
    display: block;
    margin: 0 auto;
    background-color: #1a1a1a;
}

/* UI覆盖层 */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
    color: white;
    pointer-events: none;
}

.ui-overlay > div {
    pointer-events: auto;
}

/* HUD元素 */
.ui-element {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 500;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 左上角信息容器 */
.top-left-info {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 右上角小地图容器 */
.top-right-minimap {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    height: 200px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 触摸摇杆容器 - 移动设备控制 */
.joystick-container {
    position: absolute;
    bottom: 5rem; /* 距离底部1rem */
    right: 5rem; /* 距离左侧1rem */
    width: 150px;
    height: 150px;
    display: none; /* 默认隐藏，在移动设备上显示 */
}

/* 触摸摇杆外圈 */
.joystick-outer {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%; /* 圆形 */
    background-color: rgba(255, 255, 255, 0.1); /* 半透明白色 */
    border: 2px solid rgba(255, 255, 255, 0.3); /* 边框 */
}

/* 触摸摇杆内圈 */
.joystick-inner {
    position: absolute;
    width: 50%; /* 占外圈的50% */
    height: 50%;
    border-radius: 50%; /* 圆形 */
    background-color: rgba(255, 255, 255, 0.3); /* 半透明白色 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); /* 居中对齐 */
    pointer-events: none; /* 关键：让触摸事件“穿透”摇杆 */
}

/* 响应式设计 - 移动设备显示触摸摇杆 */
@media (max-width: 768px) {
    .joystick-container {
        display: block;
    }
}

/* 高端花纹背景样式 */
.premium-pattern-bg {
    background-color: #0f172a;
    background-image: 
        radial-gradient(rgba(59, 130, 246, 0.15) 2px, transparent 2px),
        radial-gradient(rgba(168, 85, 247, 0.15) 2px, transparent 2px),
        linear-gradient(to right, rgba(59, 130, 246, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(168, 85, 247, 0.05) 1px, transparent 1px);
    background-size: 60px 60px, 60px 60px, 20px 20px, 20px 20px;
    background-position: 0 0, 30px 30px, 0 0, 10px 10px;
    position: relative;
    overflow: hidden;
}

.premium-pattern-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(37, 99, 235, 0.2) 0%, transparent 70%);
    z-index: 1;
}

.premium-pattern-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(168, 85, 247, 0.1) 0%, transparent 30%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.1) 0%, transparent 30%);
    z-index: 1;
}

/* 浮动球体装饰 */
.floating-balls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.floating-ball {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0) 70%);
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
    opacity: 0.7;
    animation: float 8s infinite ease-in-out;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) translateX(0);
    }
    25% {
        transform: translateY(-20px) translateX(10px);
    }
    50% {
        transform: translateY(-10px) translateX(-10px);
    }
    75% {
        transform: translateY(-15px) translateX(5px);
    }
}

/* 高端标题样式 */
.premium-title {
    font-size: 6rem;
    font-weight: 900;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6, #EC4899);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    position: relative;
    z-index: 3;
}

/* 高端按钮样式 */
.premium-button {
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 9999px;
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
    color: white;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    z-index: 3;
}

.premium-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.6s ease;
}

.premium-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
}

.premium-button:hover::before {
    left: 100%;
}

/* 玻璃态面板 */
.glass-panel {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 3;
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 脉冲动画 */
.pulse {
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* 开始屏幕 */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* 游戏结束屏幕 */
.game-over-screen, .time-up-screen, .win-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    z-index: 100;
    display: none;
}

/* 游戏结束屏幕标题 */
.game-over-title, .time-up-title, .win-title {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    text-align: center;
}

.game-over-title {
    background: linear-gradient(90deg, #EF4444, #F87171);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.time-up-title {
    background: linear-gradient(90deg, #F59E0B, #FBBF24);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.win-title {
    background: linear-gradient(90deg, #10B981, #34D399);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* 游戏结束屏幕消息 */
.game-over-message, .time-up-message, .win-message {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    max-width: 600px;
}

/* 游戏结束屏幕分数 */
.game-over-score, .time-up-score {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* 关卡信息 */
.level-info {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* 按钮容器 */
.win-buttons {
    display: flex;
    gap: 1.5rem;
}

/* 重新开始按钮 */
.restart-button, .next-level-button {
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 9999px;
    color: white;
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.restart-button {
    background: linear-gradient(90deg, #3B82F6, #8B5CF6);
}

.next-level-button {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.restart-button:hover, .next-level-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

/* 难度选择容器 */
.difficulty-select {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

/* NPC出现通知 */
#spawnNotification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 1rem 2rem;
    border-radius: 9999px;
    font-size: 1.25rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#spawnNotification.show {
    opacity: 1;
}

/* 版本信息 */
.version-info {
    position: fixed;
    bottom: 20px;
    right: 0px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    z-index: 100;
}

/* 响应式设计 - 小屏幕适配 */
@media (max-width: 768px) {
    .premium-title {
        font-size: 4rem;
    }
    
    .game-over-title, .time-up-title, .win-title {
        font-size: 3rem;
    }
    
    .glass-panel {
        padding: 1.5rem;
        max-width: 90%;
    }
    
    .difficulty-select {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .win-buttons {
        flex-direction: column;
        gap: 1rem;
    }
}

/* 响应式设计 - 超小屏幕适配 */
@media (max-width: 480px) {
    .premium-title {
        font-size: 3rem;
    }
    
    .game-over-title, .time-up-title, .win-title {
        font-size: 2.5rem;
    }
    
    .ui-element {
        font-size: 16px;
    }
    
    .top-right-minimap {
        width: 150px;
        height: 150px;
    }
}
