* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #fff;
}

.container {
    width: 850px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 0 30px rgba(86, 11, 173, 0.5);
    backdrop-filter: blur(10px);
    overflow: hidden;
    position: relative;
}

/* 背景图案 */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 40% 70%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 60% 20%, rgba(255,255,255,0.05) 1px, transparent 1px),
        radial-gradient(circle at 80% 50%, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 150px 150px;
    opacity: 0.5;
    z-index: -1;
}

.game-header {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(123, 44, 191, 0.5);
}

.game-header h1 {
    font-size: 42px;
    margin-bottom: 15px;
    background: linear-gradient(to right, #7b2cbf, #9d4edd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(123, 44, 191, 0.5);
}

.game-header h1 i {
    margin-right: 15px;
}

.game-info {
    display: flex;
    justify-content: space-around;
    font-size: 22px;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px;
    border-radius: 10px;
}

#keys-count {
    color: #ffd700;
}

#time {
    color: #4cc9f0;
}

.game-area {
    background: rgba(10, 10, 40, 0.8);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 25px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8);
    position: relative;
}

#maze-container {
    display: grid;
    grid-template-columns: repeat(15, 30px);
    grid-template-rows: repeat(15, 30px);
    gap: 1px;
    margin: 0 auto;
    background: #2d3047;
    border: 2px solid #7b2cbf;
    border-radius: 5px;
    padding: 10px;
}

.cell {
    width: 30px;
    height: 30px;
    background: #1a1c2b;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    transition: all 0.2s ease;
    border-radius: 3px;
}

.wall {
    background: #7b2cbf;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.player {
    background: #4cc9f0;
    border-radius: 50%;
    box-shadow: 0 0 10px #4cc9f0;
    z-index: 2;
}

.key {
    background: #ffd700;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.treasure {
    background: linear-gradient(135deg, #ff9a00, #ffd700);
    border-radius: 5px;
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px #ffd700; }
    to { box-shadow: 0 0 20px #ff9a00; }
}

.monster {
    background: #e5383b;
    border-radius: 50%;
    animation: monsterFloat 3s infinite ease-in-out;
}

@keyframes monsterFloat {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

.path {
    background: rgba(76, 201, 240, 0.15);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
}

.control-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}

.control-info i {
    color: #9d4edd;
    font-size: 24px;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 25px;
}

button {
    padding: 14px 30px;
    font-size: 18px;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    background: linear-gradient(45deg, #7b2cbf, #9d4edd);
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(123, 44, 191, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(123, 44, 191, 0.6);
}

button:active {
    transform: translateY(1px);
}

#pause-btn {
    background: linear-gradient(45deg, #4cc9f0, #4895ef);
}

#reset-btn {
    background: linear-gradient(45deg, #f72585, #b5179e);
}

#hint-btn {
    background: linear-gradient(45deg, #ff9a00, #ffd700);
}

.instructions {
    background: rgba(20, 20, 40, 0.6);
    border-radius: 10px;
    padding: 20px;
    border: 1px solid rgba(123, 44, 191, 0.3);
}

.instructions h2 {
    text-align: center;
    margin-bottom: 15px;
    color: #9d4edd;
    font-size: 28px;
}

.instructions h2 i {
    margin-right: 10px;
}

.instructions ul {
    margin-left: 30px;
    font-size: 18px;
    line-height: 2;
    margin-bottom: 20px;
}

.instructions li {
    padding: 5px 0;
}

.legend {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-icon, .key-icon, .treasure-icon, .monster-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-bottom: 8px;
}

.player-icon {
    background: #4cc9f0;
    box-shadow: 0 0 10px #4cc9f0;
}

.key-icon {
    background: #ffd700;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
}

.treasure-icon {
    background: linear-gradient(135deg, #ff9a00, #ffd700);
    display: flex;
    justify-content: center;
    align-items: center;
}

.monster-icon {
    background: #e5383b;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (max-width: 850px) {
    .container {
        width: 95%;
    }
    
    #maze-container {
        grid-template-columns: repeat(15, 20px);
        grid-template-rows: repeat(15, 20px);
    }
    
    .cell {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .game-controls {
        flex-wrap: wrap;
    }
}

@media (max-width: 500px) {
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .instructions ul {
        margin-left: 20px;
        font-size: 16px;
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
    }
}
