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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    padding: 20px;
    color: #333;
    overflow-x: hidden; /* 防止横向滚动 */
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

header {
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
    padding-left: 80px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.game-logo {
    width: 100px;
    height: 100px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s;
    animation: logoFloat 3s ease-in-out infinite;
    flex-shrink: 0;
}

.game-logo:hover {
    transform: scale(1.1) rotate(5deg);
}

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

.header-text {
    text-align: left;
}

h1 {
    font-size: 2.5em;
    color: #667eea;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #666;
    font-size: 1em;
    line-height: 1.6;
    margin: 0;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: bold;
    color: #555;
}

select {
    padding: 8px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

select:hover {
    border-color: #667eea;
}

select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #333;
}

.game-info {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    padding: 15px;
    background: #e9ecef;
    border-radius: 10px;
    flex-wrap: wrap;
}

.info-item {
    font-size: 1.2em;
}

.info-item .label {
    font-weight: bold;
    color: #555;
}

.info-item .value {
    color: #667eea;
    font-weight: bold;
    margin-left: 5px;
}

.wall-pass-info {
    transition: all 0.3s;
}

.wall-pass-info.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa500 100%);
    padding: 10px 20px;
    border-radius: 10px;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.wall-pass-info.active .label,
.wall-pass-info.active .value {
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.power-tip {
    text-align: center;
    padding: 12px;
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left: 4px solid #ffc107;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #856404;
    font-size: 0.95em;
}

.power-tip kbd {
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: auto;
}

#mazeCanvas {
    border: 3px solid #667eea;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    background: white;
    display: block; /* 防止canvas周围的额外空间 */
    touch-action: none; /* 禁用触摸滚动 */
}

.instructions {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #667eea;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

.instructions ul {
    list-style: none;
    padding-left: 0;
}

.instructions li {
    padding: 8px 0;
    color: #555;
    line-height: 1.6;
}

.instructions strong {
    color: #333;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9em;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
    }

    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .header-text {
        text-align: center;
    }

    .game-logo {
        width: 80px;
        height: 80px;
    }

    h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .controls {
        flex-direction: column;
    }

    .control-group {
        width: 100%;
        justify-content: space-between;
    }

    .btn {
        width: 100%;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }

    .canvas-wrapper {
        padding: 10px;
    }
}

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

.value {
    animation: pulse 2s infinite;
}

/* 胜利状态样式 */
.victory {
    color: #28a745 !important;
    font-weight: bold;
    animation: pulse 0.5s infinite;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.victory-icon {
    font-size: 80px;
    animation: bounce 1s infinite;
    margin-bottom: 20px;
}

.victory-title {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.5s ease;
}

.victory-stats {
    display: flex;
    justify-content: space-around;
    margin: 30px 0;
    gap: 20px;
}

.stat-item {
    flex: 1;
    padding: 20px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-item:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
    margin: 10px 0;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
}

.victory-message {
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.victory-message p {
    margin: 0;
    color: #555;
    font-size: 1.1em;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-close-modal {
    background: #6c757d;
    color: white;
}

.btn-close-modal:hover {
    background: #5a6268;
}

/* 五彩纸屑容器 */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    animation: confettiFall 3s linear infinite;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* 响应式优化 */
@media (max-width: 600px) {
    .modal-content {
        padding: 30px 20px;
    }

    .victory-title {
        font-size: 2em;
    }

    .victory-stats {
        flex-direction: column;
    }

    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons .btn {
        width: 100%;
    }
}

