/* 事件编辑器样式（桌面优先，移动端纵向堆叠） */
body { background: var(--bg); }

.editor-app { max-width: 1180px; margin: 0 auto; min-height: 100vh; padding: 16px 20px 60px; }

.editor-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.editor-brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.editor-hint { font-size: 11px; color: var(--muted); }
.editor-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.editor-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    align-items: start;
}

/* ============ 左侧列表 ============ */
.editor-sidebar {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px;
    position: sticky; top: 12px;
    max-height: calc(100vh - 120px);
    display: flex; flex-direction: column;
}
.cat-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cat-tab {
    padding: 6px 11px; border-radius: 999px; cursor: pointer;
    background: transparent; border: 1px solid var(--line-strong);
    color: var(--muted); font-size: 12px; font-weight: 700; font-family: inherit;
}
.cat-tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.cat-tab .count { opacity: 0.65; margin-left: 4px; font-weight: 600; }

.event-search {
    width: 100%; margin-bottom: 10px; padding: 9px 12px;
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: 10px; color: var(--text); font-size: 13px; outline: none;
    font-family: inherit;
}
.event-search:focus { border-color: var(--accent-dim); }

.event-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.event-row {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 9px 11px; border-radius: 10px; cursor: pointer; text-align: left;
    background: var(--panel-2); border: 1px solid var(--line);
    color: var(--text); font-family: inherit;
}
.event-row:hover { border-color: var(--accent-dim); }
.event-row.on { border-color: var(--accent); background: var(--accent-soft); }
.event-row.deleted { opacity: .58; border-style: dashed; }
.event-row.deleted .ev-name { text-decoration: line-through; }
.event-row .ev-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-row .ev-cat { font-size: 10px; color: var(--muted); flex-shrink: 0; }
.event-row .ev-edited { color: var(--gold); font-size: 10px; flex-shrink: 0; }
.event-row .ev-disabled { color: var(--danger); font-size: 10px; flex-shrink: 0; }
.deleted-event-note { border-color: rgba(223, 110, 103, .35); }

/* ============ 右侧编辑区 ============ */
.editor-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor-pane {
    background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 16px;
}
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.pane-head h2 { font-size: 15px; font-weight: 800; margin: 0; }
.dirty-badge { font-size: 11px; font-weight: 700; color: var(--warn); }

.edit-form { display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 200px); overflow-y: auto; padding-right: 4px; }

.ef-section { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--panel-2); }
.ef-section h4 { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 10px; letter-spacing: 1px; }
.ef-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ef-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ef-field.full { grid-column: 1 / -1; }
.ef-field label { font-size: 11px; color: var(--muted); }
.ef-field input, .ef-field select, .ef-field textarea {
    background: var(--panel); border: 1px solid var(--line-strong);
    border-radius: 9px; padding: 8px 10px; color: var(--text);
    font-size: 13px; font-family: inherit; outline: none; width: 100%;
}
.ef-field input:focus, .ef-field select:focus, .ef-field textarea:focus { border-color: var(--accent-dim); }
.ef-field textarea { resize: vertical; min-height: 56px; line-height: 1.6; }
.field-help { color: var(--muted); font-size: 10px; line-height: 1.5; }
.switch-field { flex-direction: row !important; align-items: center; gap: 8px !important; cursor: pointer; }
.switch-field input { width: auto; accent-color: var(--accent); }

.choice-editor {
    border: 1px solid var(--line-strong); border-radius: 14px;
    padding: 12px; background: var(--panel);
    display: flex; flex-direction: column; gap: 10px;
}
.choice-editor .choice-head { display: flex; align-items: center; gap: 8px; }
.choice-editor .choice-head input { flex: 1; }
.choice-remove { color: var(--danger); background: transparent; border: 1px solid rgba(223, 110, 103, 0.4); }

.effect-row { display: flex; gap: 6px; align-items: center; }
.effect-row select { flex: 1.3; min-width: 0; }
.effect-row input { flex: 1; min-width: 0; }
.effect-row textarea { flex: 2; min-width: 0; resize: vertical; min-height: 40px; }
.effect-row .btn { padding: 8px 10px; font-size: 12px; }

.btn-add { align-self: flex-start; padding: 7px 12px; font-size: 12px; }
.btn-danger-ghost.btn-sm { padding: 7px 10px; font-size: 12px; }

.preview-wrap { max-height: calc(100vh - 200px); overflow-y: auto; padding-right: 4px; }
.preview-outcome {
    margin-top: 14px; padding: 12px; border-radius: 12px;
    background: var(--panel-2); border: 1px solid var(--line);
    font-size: 12px; line-height: 1.7; color: var(--muted);
}
.preview-outcome .ok { color: var(--accent); }
.preview-outcome .bad { color: var(--danger); }

.achievement-editor-layout .editor-sidebar { padding-top: 14px; }
.achievement-editor-preview { opacity: 1; min-height: 190px; display: flex; flex-direction: column; }
.achievement-editor-preview .ach-desc { flex: 1; font-size: 12px; }
.achievement-preview-meta {
    display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px;
    color: var(--muted); font-size: 11px;
}
.achievement-preview-note { margin-top: 12px; line-height: 1.7; }

.toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
    background: var(--panel-3); color: var(--text);
    border: 1px solid var(--accent); border-radius: 999px;
    padding: 10px 20px; font-size: 13px; font-weight: 700; z-index: 400;
    box-shadow: var(--shadow-panel);
}

@media (max-width: 900px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-sidebar { position: static; max-height: none; }
    .event-list { max-height: 280px; }
    .editor-main { grid-template-columns: 1fr; }
}
