* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #2c3e50, #3498db, #9b59b6);
    min-height: 100vh;
    color: #fff;
    padding: 20px;
    user-select: none;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 25px;
    backdrop-filter: blur(10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.game-header {
    text-align: center;
    margin-bottom: 25px;
}

.game-header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #f39c12;
    text-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
    font-weight: bold;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(243, 156, 18, 0.3);
}

.stat {
    text-align: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 80px;
}

.stat-label {
    font-size: 0.9em;
    color: #bdc3c7;
    margin-bottom: 5px;
    font-weight: 600;
}

.stat-value {
    font-size: 1.4em;
    font-weight: bold;
    color: #f39c12;
    text-shadow: 0 0 10px rgba(243, 156, 18, 0.3);
}

.difficulty-selector {
    margin-bottom: 25px;
    text-align: center;
}

.difficulty-selector h3 {
    color: #ecf0f1;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.difficulty-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 12px 18px;
    border: 3px solid rgba(243, 156, 18, 0.3);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    min-width: 110px;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(243, 156, 18, 0.3);
    border-color: #f39c12;
}

.difficulty-btn.active {
    border-color: #f39c12;
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    box-shadow: 0 0 20px rgba(243, 156, 18, 0.4);
}

.difficulty-btn span {
    font-size: 1.5em;
    display: block;
    margin-bottom: 5px;
}

.difficulty-btn div {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 0.95em;
}

.difficulty-btn small {
    font-size: 0.8em;
    opacity: 0.8;
}

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

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    min-width: 110px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
    background: linear-gradient(45deg, #e67e22, #d35400);
}

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

.btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
}

.btn.secondary:hover {
    background: linear-gradient(45deg, #7f8c8d, #6c7b7d);
    box-shadow: 0 5px 15px rgba(149, 165, 166, 0.4);
}

.game-board-container {
    position: relative;
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

#mazeCanvas {
    border: 3px solid #f39c12;
    border-radius: 12px;
    background: #2c3e50;
    box-shadow: 
        0 0 30px rgba(243, 156, 18, 0.3),
        inset 0 0 50px rgba(0, 0, 0, 0.3);
}

.minimap {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(243, 156, 18, 0.6);
    border-radius: 8px;
    padding: 8px;
}

#minimapCanvas {
    border-radius: 4px;
    display: block;
}

.minimap-label {
    text-align: center;
    color: #f39c12;
    font-size: 0.8em;
    font-weight: bold;
    margin-top: 5px;
}

.fog-toggle {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid rgba(243, 156, 18, 0.6);
    border-radius: 8px;
    padding: 10px;
}

.fog-toggle label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: #ecf0f1;
    font-size: 0.9em;
    font-weight: 600;
}

.fog-toggle input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
    accent-color: #f39c12;
}

.controls-hint {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(243, 156, 18, 0.3);
}

.control-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #bdc3c7;
    font-size: 0.9em;
}

.key {
    background: #f39c12;
    color: #2c3e50;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8em;
    min-width: 50px;
    text-align: center;
}

.desc {
    font-weight: 600;
}

.game-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.feature-section, .legend-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    border: 2px solid rgba(243, 156, 18, 0.3);
}

.feature-section h3, .legend-section h3 {
    color: #f39c12;
    margin-bottom: 20px;
    font-size: 1.2em;
    text-align: center;
}

.features-grid, .legend-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.feature-card, .legend-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.feature-icon, .legend-symbol {
    font-size: 1.8em;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-symbol {
    border-radius: 4px;
    font-size: 1.5em;
}

.legend-symbol.player {
    background: transparent;
}

.legend-symbol.exit {
    background: transparent;
}

.legend-symbol.treasure {
    background: transparent;
}

.legend-symbol.wall {
    background: #34495e;
    border: 1px solid #2c3e50;
}

.legend-symbol.path {
    background: #ecf0f1;
    border: 1px solid #bdc3c7;
}

.legend-symbol.visited {
    background: rgba(52, 152, 219, 0.3);
    border: 1px solid #3498db;
}

.feature-info {
    flex: 1;
}

.feature-name {
    color: #ecf0f1;
    font-weight: bold;
    font-size: 1em;
    margin-bottom: 4px;
}

.feature-desc, .legend-desc {
    color: #bdc3c7;
    font-size: 0.85em;
    line-height: 1.3;
}

/* 弹窗样式 */
.victory-popup, .help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.victory-popup.show, .help-modal.show {
    display: flex;
}

.victory-content, .modal-content {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(243, 156, 18, 0.6);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: popupSlideIn 0.5s ease-out;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.victory-content h2 {
    color: #f39c12;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 0 0 15px rgba(243, 156, 18, 0.5);
}

.victory-message {
    font-size: 1.1em;
    color: #ecf0f1;
    margin-bottom: 20px;
    font-weight: 600;
}

.victory-stats {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: left;
}

.victory-stats p {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    color: #bdc3c7;
}

.victory-stats span {
    font-weight: bold;
    color: #f39c12;
}

.victory-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 帮助模态框 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(243, 156, 18, 0.3);
}

.modal-header h2 {
    color: #f39c12;
    font-size: 1.5em;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    color: #bdc3c7;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f39c12;
}

.modal-body {
    text-align: left;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    color: #f39c12;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-left: 4px solid #f39c12;
    padding-left: 12px;
}

.help-section p {
    color: #bdc3c7;
    line-height: 1.6;
    margin-bottom: 10px;
}

.help-section ul {
    color: #bdc3c7;
    line-height: 1.6;
    margin-left: 20px;
}

.help-section li {
    margin-bottom: 8px;
}

.help-section strong {
    color: #ecf0f1;
    font-weight: 600;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-features {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .minimap {
        position: static;
        margin-top: 15px;
        align-self: flex-start;
    }
    
    .fog-toggle {
        position: static;
        margin-top: 10px;
        align-self: flex-start;
    }
    
    .game-board-container {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 20px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-stats {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .stat {
        min-width: 120px;
    }
    
    .difficulty-buttons {
        flex-direction: column;
        align-items: center;
        max-width: 250px;
        margin: 0 auto;
    }
    
    .difficulty-btn {
        width: 100%;
        min-width: auto;
    }
    
    #mazeCanvas {
        width: 100%;
        height: auto;
        max-width: 400px;
        max-height: 400px;
    }
    
    .controls-hint {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .control-item {
        justify-content: center;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        min-width: 200px;
    }
    
    .victory-content, .modal-content {
        padding: 25px;
        margin: 20px;
    }
    
    .victory-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .victory-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .controls-hint {
        padding: 10px;
    }
    
    .control-item {
        font-size: 0.8em;
    }
    
    .key {
        min-width: 40px;
        padding: 3px 6px;
        font-size: 0.7em;
    }
    
    #mazeCanvas {
        max-width: 320px;
        max-height: 320px;
    }
    
    .features-grid {
        gap: 10px;
    }
    
    .feature-card {
        padding: 10px;
    }
    
    .feature-icon {
        font-size: 1.5em;
        width: 35px;
        height: 35px;
    }
}

/* 游戏特效 */
@keyframes treasureCollect {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.5);
        opacity: 0.8;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.treasure-collect {
    animation: treasureCollect 0.6s ease-out;
}

@keyframes pathHighlight {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.8;
    }
}

.path-highlight {
    animation: pathHighlight 1s ease-in-out infinite;
}

@keyframes playerMove {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

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

/* 小地图样式 */
.minimap {
    backdrop-filter: blur(5px);
}

.minimap canvas {
    opacity: 0.9;
}

/* 加载动画 */
@keyframes mazeGenerate {
    0% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.7;
    }
    100% {
        opacity: 1;
    }
}

.maze-generating {
    animation: mazeGenerate 1s ease-in-out;
}