/* ══════════════════════════════════════════════
   剧情编辑器样式 · 沿用同一套浅蓝紫纸感
   ══════════════════════════════════════════════ */
.ed{
  position:fixed;inset:0;z-index:200;
  display:flex;flex-direction:column;
  font-family:"Cormorant Garamond","Songti SC",Georgia,serif;
  color:#2b3350;
  background:
    radial-gradient(900px 500px at 50% -10%, #fff 0%, #f4f7fd 40%, #e9eef9 72%, #e2e9f7 100%);
  transform:translateY(100%);
  transition:transform .42s cubic-bezier(.22,.61,.36,1);
  will-change:transform;
}
.ed.on{transform:none}
body.editing{overflow:hidden}

/* ── 顶栏 ── */
.ed-bar{
  flex:0 0 auto;
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:calc(env(safe-area-inset-top) + 12px) 14px 12px;
  background:rgba(255,255,255,.78);
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
  border-bottom:1px solid rgba(92,110,158,.16);
}
.ed-btn{
  appearance:none;cursor:pointer;
  font-family:inherit;font-size:13px;letter-spacing:.04em;
  padding:7px 13px;border-radius:9px;
  background:rgba(255,255,255,.9);
  border:1px solid rgba(92,110,158,.28);
  color:#4d5776;
  transition:transform .18s, background .18s, color .18s, border-color .18s;
  white-space:nowrap;
}
.ed-btn:hover{background:#fff;color:#2b3350;border-color:rgba(92,110,158,.45)}
.ed-btn:active{transform:scale(.97)}
.ed-btn.primary{
  background:linear-gradient(180deg,#fff,#e9edf9);
  color:#2b3350;font-weight:500;
  box-shadow:0 10px 22px -18px rgba(46,62,110,.9);
}
.ed-sel{
  font-family:inherit;font-size:13px;
  padding:7px 10px;border-radius:9px;
  background:#fff;border:1px solid rgba(92,110,158,.28);color:#2b3350;
  max-width:180px;
}
.ed-actions{display:flex;gap:6px;flex-wrap:wrap}
.ed-save{
  margin-left:auto;font-size:11px;letter-spacing:.1em;color:#98a1bc;font-style:italic;
}

/* ── 主体 ── */
.ed-main{flex:1;min-height:0;display:flex}

/* ── 节点列表 ── */
.ed-nodes{
  flex:0 0 218px;width:218px;
  display:flex;flex-direction:column;min-height:0;
  border-right:1px solid rgba(92,110,158,.16);
  background:rgba(255,255,255,.42);
}
.ed-nodes-head{
  display:flex;justify-content:space-between;
  padding:12px 14px 8px;
  font-size:10.5px;letter-spacing:.2em;color:#98a1bc;
}
.ed-nodes ul{
  list-style:none;margin:0;padding:0 8px 8px;
  overflow-y:auto;flex:1;min-height:0;
}
.ed-node{
  display:flex;align-items:center;gap:8px;
  padding:9px 10px;margin-bottom:4px;border-radius:10px;
  cursor:pointer;font-size:13.5px;
  border:1px solid transparent;
  transition:background .18s, border-color .18s;
}
.ed-node:hover{background:rgba(255,255,255,.75)}
.ed-node.on{
  background:#fff;border-color:rgba(139,124,182,.5);
  box-shadow:0 10px 20px -18px rgba(46,62,110,.9);
}
.ed-node-no{font-family:Georgia,serif;font-style:italic;font-size:11px;color:#b6a4d5;width:18px}
.ed-node-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ed-node-meta{font-size:10px;color:#a3abc5;font-style:italic}
.ed-addnode{
  margin:8px;padding:10px;border-radius:10px;cursor:pointer;
  font-family:inherit;font-size:13px;color:#5d6788;
  background:rgba(255,255,255,.7);
  border:1px dashed rgba(92,110,158,.4);
}
.ed-addnode:hover{background:#fff;color:#2b3350}

/* ── 面板 ── */
.ed-panel{
  flex:1;min-width:0;overflow-y:auto;
  padding:16px 16px calc(env(safe-area-inset-bottom) + 40px);
}
.ed-panel > *{max-width:820px;margin-left:auto;margin-right:auto}
.ed-empty{
  padding:26px 18px;text-align:center;color:#98a1bc;font-size:13px;
  border:1px dashed rgba(92,110,158,.28);border-radius:12px;
}
.ed-empty.sm{padding:12px;font-size:12px}

.ed-nodehead{
  display:flex;align-items:flex-end;gap:12px;flex-wrap:wrap;
  padding-bottom:12px;margin-bottom:14px;
  border-bottom:1px dashed rgba(92,110,158,.24);
}
.ed-lab{display:flex;flex-direction:column;gap:4px;font-size:11px;letter-spacing:.14em;color:#98a1bc}
.ed-tip{font-size:11px;color:#a3abc5;font-style:italic;padding-bottom:8px}

/* 步骤卡 */
.ed-step{
  border-radius:14px;margin-bottom:12px;
  background:rgba(255,255,255,.82);
  border:1px solid rgba(92,110,158,.2);
  box-shadow:0 14px 26px -26px rgba(46,62,110,.9);
  overflow:hidden;
}
.ed-step.is-end{border-color:rgba(182,164,213,.6)}
.ed-step-top{
  display:flex;align-items:center;justify-content:space-between;
  padding:7px 10px 7px 12px;
  background:rgba(240,243,251,.7);
  border-bottom:1px solid rgba(92,110,158,.12);
}
.ed-type{
  font-size:11px;letter-spacing:.16em;color:#6c7799;
  padding:2px 8px;border-radius:999px;
  background:rgba(255,255,255,.9);border:1px solid rgba(92,110,158,.2);
}
.ed-type.t-ask{color:#7d6aa8;border-color:rgba(125,106,168,.35)}
.ed-type.t-input{color:#5f7fa8;border-color:rgba(95,127,168,.35)}
.ed-type.t-card{color:#8a6f8f;border-color:rgba(138,111,143,.35)}
.ed-type.t-end{color:#a06b7d;border-color:rgba(160,107,125,.35)}
.ed-tools{display:flex;gap:4px}
.ed-mini,.ed-x{
  appearance:none;cursor:pointer;
  width:26px;height:26px;border-radius:7px;
  display:grid;place-items:center;
  font-family:inherit;font-size:12px;line-height:1;
  background:rgba(255,255,255,.9);
  border:1px solid rgba(92,110,158,.24);color:#6c7799;
  transition:background .16s,color .16s;
}
.ed-mini:hover,.ed-x:hover{background:#fff;color:#2b3350}
.ed-x:hover{color:#b0607a;border-color:rgba(176,96,122,.45)}

/* 「建回复节点」这类文字按钮：宽度跟着字走，不能压成竖排 */
.ed-build{
  flex:0 0 auto;white-space:nowrap;
  padding:7px 11px;border-radius:8px;cursor:pointer;
  font-family:inherit;font-size:12px;letter-spacing:.02em;color:#6c7799;
  background:rgba(255,255,255,.92);
  border:1px solid rgba(92,110,158,.26);
  transition:background .16s,color .16s;
}
.ed-build:hover{background:#fff;color:#2b3350}
.ed-build:active{transform:scale(.97)}
.ed-fields{padding:11px 12px 12px;display:flex;flex-direction:column;gap:8px}

/* 输入控件 */
.ed-input{
  width:100%;font-family:inherit;font-size:13.5px;color:#2b3350;
  padding:8px 10px;border-radius:9px;
  background:#fff;border:1px solid rgba(92,110,158,.24);
  outline:none;transition:border-color .18s, box-shadow .18s;
  min-width:0;
}
.ed-input:focus{border-color:rgba(139,124,182,.7);box-shadow:0 0 0 3px rgba(182,164,213,.16)}
.ed-ta{resize:vertical;line-height:1.7}
.ed-num{max-width:110px}
.ed-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.ed-row .ed-input{flex:1;min-width:90px}
.ed-unit{font-size:11.5px;letter-spacing:.08em;color:#98a1bc;white-space:nowrap}
.ed-grid{display:flex;flex-direction:column;gap:7px}

/* 选项 */
.ed-opts{display:flex;flex-direction:column;gap:8px;margin-top:4px}
.ed-opt{
  display:flex;gap:8px;align-items:flex-start;
  padding:9px;border-radius:11px;
  background:rgba(246,248,253,.9);
  border:1px solid rgba(92,110,158,.16);
}
.ed-opt-no{
  flex:0 0 auto;width:22px;height:22px;border-radius:50%;
  display:grid;place-items:center;
  font-family:Georgia,serif;font-style:italic;font-size:12px;color:#9a86c4;
  background:#fff;border:1px solid rgba(154,134,196,.4);
}
.ed-opt-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:6px}
.ed-opts .ed-input{font-size:13px;padding:7px 9px}
.ed-add2{
  align-self:flex-start;margin-top:4px;
  padding:6px 12px;border-radius:8px;cursor:pointer;
  font-family:inherit;font-size:12.5px;color:#6c7799;
  background:rgba(255,255,255,.7);border:1px dashed rgba(92,110,158,.4);
}
.ed-add2:hover{background:#fff;color:#2b3350}

.ed-rules{display:flex;flex-direction:column;gap:7px}
.ed-rule{flex-wrap:nowrap}
.ed-rule .ed-input{font-size:12.5px}

/* 时光轴条目 */
.ed-tl{display:flex;flex-direction:column;gap:7px;margin-top:2px}
.ed-tl-item{
  padding:8px;border-radius:10px;
  background:rgba(246,248,253,.92);
  border:1px solid rgba(92,110,158,.16);
  display:flex;flex-direction:column;gap:6px;
}
.ed-tl-item .ed-input{font-size:12.5px;padding:7px 9px}

/* 底部加按钮 */
.ed-addrow{
  display:flex;gap:7px;flex-wrap:wrap;
  padding:12px 0 0;
}
.ed-chip{
  padding:8px 13px;border-radius:9px;cursor:pointer;
  font-family:inherit;font-size:12.5px;color:#5d6788;
  background:rgba(255,255,255,.85);
  border:1px solid rgba(92,110,158,.26);
  transition:background .16s, color .16s, transform .16s;
}
.ed-chip:hover{background:#fff;color:#2b3350}
.ed-chip:active{transform:scale(.97)}

/* ── 手机 ── */
@media (max-width:760px){
  .ed-bar{gap:7px;padding:calc(env(safe-area-inset-top) + 10px) 10px 10px}
  .ed-btn{font-size:12px;padding:6px 10px}
  .ed-sel{max-width:120px;font-size:12px;padding:6px 8px}
  .ed-save{display:none}
  .ed-main{flex-direction:column}
  .ed-nodes{
    flex:0 0 auto;width:auto;max-height:30vh;
    border-right:0;border-bottom:1px solid rgba(92,110,158,.16);
  }
  .ed-nodes ul{
    display:flex;gap:6px;overflow-x:auto;overflow-y:hidden;
    padding:0 10px 10px;scrollbar-width:none;
  }
  .ed-nodes ul::-webkit-scrollbar{display:none}
  .ed-node{
    flex:0 0 auto;margin-bottom:0;padding:8px 11px;
    border:1px solid rgba(92,110,158,.2);background:rgba(255,255,255,.7);
  }
  .ed-node-no{display:none}
  .ed-node-meta{margin-left:6px}
  .ed-panel{padding:12px 12px calc(env(safe-area-inset-bottom) + 60px)}
  .ed-nodehead{flex-direction:column;align-items:stretch}
  .ed-tip{padding-bottom:0}
  .ed-opt{flex-wrap:wrap}
  .ed-opt-main{width:100%}
  .ed-rule{flex-wrap:wrap}
  .ed-rule .ed-input{flex:1 1 100%}
}
