/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    background-color: #f0f0f0;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    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);
}

/* 游戏标题 */
.game-title {
    font-size: 2.5rem;
    color: #4a4a4a;
    margin-bottom: 20px;
    text-align: center;
}

/* 游戏信息栏 */
.game-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.info-item {
    background-color: #e0e0e0;
    color: #333;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.info-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 5px;
    color: #666;
}

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

/* 游戏容器 */
.game-container {
    width: 100%;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 8px;
    padding: 10px;
}

/* 游戏棋盘 */
.game-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    background-color: #333;
    border-radius: 4px;
    max-width: 400px;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
}

/* 游戏格子 */
.game-cell {
    background-color: #8b4513;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    position: relative;
    overflow: hidden;
}

/* 不同类型的格子 */
.cell-wall {
    background-color: #4a4a4a;
}

.cell-floor {
    background-color: #8b4513;
}

.cell-target {
    background-color: #8b4513;
    position: relative;
}

.cell-target::after {
    content: '🎯';
    position: absolute;
    font-size: 1.5rem;
    z-index: 1;
}

/* 游戏元素 */
.game-element {
    position: absolute;
    width: 80%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    transition: all 0.2s ease;
    z-index: 2;
}

/* 玩家 */
.player {
    background-color: transparent;
}

/* 箱子 */
.box {
    background-color: transparent;
}

/* 完成的箱子 */
.box.completed {
    background-color: transparent;
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background-color: #4CAF50;
    color: white;
}

.btn-primary:hover {
    background-color: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: #2196F3;
    color: white;
}

.btn-secondary:hover {
    background-color: #1976D2;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 方向按钮 */
.direction-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    width: 100%;
}

.btn-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    width: 100%;
}

.btn-direction {
    background-color: #f44336;
    color: white;
    font-size: 1.2rem;
    min-width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.btn-direction:hover {
    background-color: #d32f2f;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 游戏说明 */
.game-instructions {
    background-color: rgba(245, 245, 245, 0.8);
    padding: 15px;
    border-radius: 8px;
    width: 100%;
    margin-top: 10px;
}

.game-instructions h3 {
    margin-bottom: 10px;
    color: #4a4a4a;
    text-align: center;
}

.game-instructions ul {
    list-style-position: inside;
    color: #666;
    line-height: 1.5;
}

.game-instructions li {
    margin-bottom: 5px;
}

/* 游戏结束遮罩 */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-over-overlay.show {
    opacity: 1;
    visibility: visible;
}

.game-over-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
}

.game-over-content h2 {
    color: #4a4a4a;
    margin-bottom: 20px;
}

.game-over-content p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .game-title {
        font-size: 2rem;
    }
    
    .info-value {
        font-size: 1.2rem;
    }
    
    .game-board {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(10, 1fr);
    }
    
    .game-element {
        font-size: 1.2rem;
    }
    
    .btn-direction {
        min-width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
    
    .game-info {
        gap: 5px;
    }
    
    .info-item {
        padding: 8px;
    }
    
    .info-value {
        font-size: 1rem;
    }
    
    .game-board {
        grid-template-columns: repeat(10, 1fr);
        grid-template-rows: repeat(10, 1fr);
    }
    
    .game-element {
        font-size: 1rem;
    }
    
    .btn-direction {
        min-width: 45px;
        height: 45px;
        font-size: 0.9rem;
    }
    
    .control-buttons {
        flex-wrap: wrap;
    }
    
    .btn {
        min-width: 80px;
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .game-instructions {
        padding: 10px;
    }
    
    .game-instructions ul {
        font-size: 0.9rem;
    }
}