body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #0b1026; /* 匹配新的夜空蓝 */
    font-family: 'Arial', sans-serif;
    user-select: none; /* 防止长按选中文本 */
    -webkit-user-select: none;
}

#output_canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    text-align: center;
    z-index: 10;
    pointer-events: none;
    transition: opacity 0.5s;
    background: rgba(0, 0, 0, 0.7);
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 300px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 指令面板 - PC端 */
#instruction-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.6);
    padding: 15px;
    border-radius: 12px;
    z-index: 5;
    pointer-events: auto; /* 允许点击交互 */
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    max-width: 250px;
}

#instruction-panel h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #f1c40f;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer; /* 鼠标变为手型 */
}

#toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* 折叠状态 */
#instruction-panel.collapsed #instruction-list {
    display: none;
}

#instruction-panel.collapsed #toggle-icon {
    transform: rotate(-90deg);
}

#instruction-panel.collapsed {
    background: rgba(0, 0, 0, 0.3); /* 折叠时背景变淡 */
    padding-bottom: 5px;
}

#instruction-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

#instruction-panel li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.key-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* 状态反馈 */
#status-feedback {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    background: rgba(0, 0, 0, 0.4);
    padding: 12px 24px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
}

#status-feedback.active {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
}

/* --- 移动端适配 (小于 768px) --- */
@media (max-width: 768px) {
    #instruction-panel {
        top: auto;
        bottom: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 10px;
        font-size: 11px;
        transform: translateY(0);
        background: rgba(0, 0, 0, 0.5); /* 稍微透明一点 */
    }
    
    #instruction-panel h3 {
        font-size: 14px;
        margin-bottom: 5px;
    }

    #instruction-panel ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    
    #instruction-panel li {
        margin-bottom: 2px;
        white-space: nowrap; /* 防止换行 */
    }

    #status-feedback {
        bottom: 50%;
        font-size: 20px;
        padding: 10px 20px;
        background: rgba(0, 0, 0, 0.6);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 380px) {
    #instruction-panel ul {
        grid-template-columns: 1fr; /* 超小屏幕单列 */
    }
}
