/* --- MagicMaker 核心 UI 樣式 --- */

/* 1. 編輯模式下的基礎位移：防止工具列遮住網頁頂部內容 */
body.editing-mode {
    padding-top: 130px !important;
}

/* 2. 編輯器面板：強制固定在最頂層 */
#editor-panel {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    background: #2c2c2c;
    color: white;
    z-index: 2147483647; /* 最高的 z-index，確保不被任何元件遮擋 */
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    border-bottom: 2px solid #fbc02d;
    box-sizing: border-box;
    /* 避免手機上被系統手勢干擾 */
    touch-action: none; 
}

/* 3. 工具列按鈕排版 */
.toolbar-ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 4px 0;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.toolbar-ul button {
    padding: 8px 14px;
    background: #444;
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    transition: background 0.2s, transform 0.1s;
    -webkit-appearance: none;
}

.toolbar-ul button:hover {
    background: #666;
}

.toolbar-ul button:active {
    transform: scale(0.95);
}

.toolbar-ul button.active {
    background: #fbc02d;
    color: #000;
    font-weight: bold;
}

/* 4. 程式碼彈出視窗：全螢幕遮罩 */
#code-modal {
    display: none;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2147483647;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* 5. 程式碼顯示區域 */
#code-display {
    width: 90%;
    height: 75%;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    border: 1px solid #444;
    border-radius: 8px;
    resize: none;
    outline: none;
}

/* 6. 針對特殊元件的編輯狀態樣式 */
.st-editable-media {
    cursor: pointer;
    transition: outline 0.2s;
}

.editing-mode .st-editable-media:hover {
    outline: 3px solid #fbc02d;
}

/* 7. 行動端適配：當寬度太窄時縮小按鈕間距 */
@media (max-width: 600px) {
    .toolbar-ul {
        gap: 4px;
    }
    .toolbar-ul button {
        padding: 6px 10px;
        font-size: 12px;
    }
    body.editing-mode {
        padding-top: 140px !important; /* 手機上按鈕擠成多行，預留更多空間 */
    }
}

