/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 游戏容器 */
.game-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    max-width: 900px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 游戏标题 */
.game-title {
    font-size: 2.5rem;
    margin-bottom: 25px;
    text-align: center;
    background: linear-gradient(45deg, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 游戏信息区域 */
.game-info {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.1rem;
}

.info-label {
    color: #bdc3c7;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.info-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3498db;
}

/* 迷宫包装器 */
.maze-wrapper {
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 迷宫画布 */
.maze-canvas {
    border-radius: 8px;
    background: #2c3e50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    max-height: 500px;
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 12px 24px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:nth-child(2) {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3);
}

.control-btn:nth-child(2):hover {
    box-shadow: 0 6px 15px rgba(39, 174, 96, 0.4);
}

.control-btn:nth-child(3) {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    box-shadow: 0 4px 10px rgba(243, 156, 18, 0.3);
}

.control-btn:nth-child(3):hover {
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.4);
}

/* 移动设备控制 */
.mobile-controls {
    display: none;
    margin-top: 20px;
}

.control-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.direction-row {
    display: flex;
    gap: 10px;
}

.direction-btn {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.direction-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.direction-btn:active {
    background: rgba(52, 152, 219, 0.8);
    transform: scale(0.95);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-title {
    font-size: 2.2rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.modal-message {
    font-size: 1.2rem;
    color: #bdc3c7;
    margin-bottom: 25px;
}

.modal-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
}

.modal-stats p {
    margin: 10px 0;
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.modal-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
}

.modal-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.4);
}

.modal-btn:nth-child(2) {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    box-shadow: 0 4px 10px rgba(39, 174, 96, 0.3);
}

.modal-btn:nth-child(2):hover {
    box-shadow: 0 6px 15px rgba(39, 174, 96, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-container {
        padding: 20px;
    }
    
    .game-title {
        font-size: 2rem;
    }
    
    .game-info {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .info-item {
        width: 45%;
    }
    
    .game-controls {
        width: 100%;
    }
    
    .control-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .mobile-controls {
        display: block;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 1.8rem;
    }
    
    .info-item {
        width: 100%;
    }
    
    .direction-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-title {
        font-size: 1.8rem;
    }
}

/* 动画效果 */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

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

.game-container {
    animation: fadeIn 0.5s ease-out;
}

.modal.active .modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* 高亮路径提示动画 */
@keyframes highlight {
    0% { background-color: rgba(52, 152, 219, 0.3); }
    50% { background-color: rgba(52, 152, 219, 0.7); }
    100% { background-color: rgba(52, 152, 219, 0.3); }
}

.highlight-path {
    animation: highlight 1s infinite;
}

/* 玩家移动动画 */
@keyframes playerMove {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.player-move {
    animation: playerMove 0.2s ease-out;
}

/* 胜利动画 */
@keyframes victory {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(5deg); }
    50% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.victory {
    animation: victory 1s ease-out;
}