/* ========== 第5课 · 进阶：完整专家系统架构 + 三种推理方式 ========== */
.esa { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; margin-top: 20px; padding-top: 16px; border-top: 2px dashed #cfe6e1; }
.esa-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.esa-badge { font-family: var(--font-serif); font-weight: 900; color: var(--acc); font-size: 16px; }
.esa-tag { font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--acc), var(--acc2)); border-radius: 20px; padding: 3px 12px; }
.esa-tip { font-size: 13px; color: var(--ink3); line-height: 1.8; margin-bottom: 12px; background: #f2fbf9; border: 1px dashed #9fd9cf; border-radius: 12px; padding: 8px 12px; }
.esa-sub { font-size: 11.5px; font-weight: 700; color: #7b86a8; margin: 8px 0 6px; }

/* ---- ① 架构图 ---- */
.esa-map { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.esa-lines { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; overflow: visible; pointer-events: none; }
.esa-lines line { stroke: #a3c5be; stroke-width: 2.2; transition: stroke .25s; }
.esa-lines line.on { stroke: var(--acc); stroke-width: 3.4; stroke-dasharray: 7 9; animation: esaFlow .9s linear infinite; }
@keyframes esaFlow { to { stroke-dashoffset: -28; } }
.esa-node { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 70px; background: #fff; border: 1.5px solid #dde5ec; border-radius: 13px; padding: 8px 6px; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 800; color: #26304f; text-align: center; transition: all .2s; }
.esa-node em { font-size: 21px; font-style: normal; line-height: 1.1; }
.esa-node span { font-size: 10.5px; font-weight: 600; color: #818cab; }
.esa-node:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--acc) 40%, #fff); }
.esa-node.on { border-color: var(--acc); background: linear-gradient(135deg, #eefaf8, #fff); box-shadow: 0 9px 18px -13px rgba(14, 147, 132, .95); }
.esa-node.on em { transform: scale(1.12); }
.esa-node.core { background: #f5fcfb; }
.esa-node.pad { visibility: hidden; }
.esa-info { margin-top: 11px; background: #f7fcfb; border: 1.5px solid #d7ece8; border-radius: 12px; padding: 10px 13px; }
.esa-info h4 { font-size: 14px; color: var(--acc); margin-bottom: 5px; }
.esa-info p { font-size: 12.5px; color: #57617e; line-height: 1.8; }
.esa-info .esa-key { margin-top: 7px; font-size: 12px; color: #0b7d70; background: #fff; border: 1px dashed #b7e0d8; border-radius: 9px; padding: 6px 10px; line-height: 1.7; }

/* ---- ② 实验区通用 ---- */
.esa-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.esa-tab { font-family: inherit; font-size: 12.5px; font-weight: 800; color: #4a5670; background: #fff; border: 1.5px solid #d9e2ea; border-radius: 30px; padding: 7px 14px; cursor: pointer; transition: all .18s; }
.esa-tab:hover { border-color: color-mix(in srgb, var(--acc) 40%, #fff); }
.esa-tab.on { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; border-color: transparent; box-shadow: 0 7px 14px -11px rgba(14, 147, 132, .95); }
.esa-lab { display: none; }
.esa-lab.on { display: block; }
.esa-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }
.esa-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.esa-panel { background: #fff; border: 1px solid var(--rule); border-radius: 14px; padding: 11px 13px; box-shadow: 0 2px 8px -5px rgba(0, 0, 0, .06); }
.esa-ptitle { font-size: 13px; font-weight: 800; color: var(--ink2); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.esa-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.esa-btn { font-family: inherit; font-size: 12.5px; font-weight: 700; border-radius: 30px; padding: 7px 14px; cursor: pointer; border: 1.5px solid transparent; transition: all .15s; }
.esa-btn:disabled { opacity: .45; cursor: default; }
.esa-btn.primary { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; }
.esa-btn.warn { background: linear-gradient(135deg, #d98f34, #efc069); color: #fff; }
.esa-btn.ghost { background: #fff; border-color: #ccd4e6; color: var(--ink3); }
.esa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.esa-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; color: #3f4a68; background: #f5f8fc; border: 1.5px solid #e1e8f1; border-radius: 20px; padding: 4px 11px; }
.esa-chip.mid { color: #0b7d70; background: #eefaf8; border-color: #a9e0d7; }
.esa-chip.goal { color: #8a5a00; background: #fff7e4; border-color: #f0d39a; }
.esa-chip.click { cursor: pointer; }
.esa-chip.click:hover { transform: translateY(-1px); border-color: var(--acc); }
.esa-chip.on { background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; border-color: transparent; }
.esa-chip.new { animation: esaPop .45s ease; }
@keyframes esaPop { from { transform: scale(.62); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- 规则表 ---- */
.esa-rules { display: flex; flex-direction: column; gap: 6px; max-height: 268px; overflow-y: auto; }
.esa-rule { display: flex; align-items: flex-start; gap: 8px; background: #f7f9fd; border: 1.5px solid #e4e9f3; border-radius: 11px; padding: 6px 9px; transition: all .25s; }
.esa-rule.ok { background: #eafaf6; border-color: #7fd8c4; }
.esa-rule.no { background: #f8f5f5; border-color: #e8dede; opacity: .6; }
.esa-rule .esa-rid { flex: 0 0 32px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; font-size: 10.5px; font-weight: 900; }
.esa-rule .esa-rb { flex: 1; min-width: 0; }
.esa-rule .esa-rb p { font-size: 11px; color: #6a7290; line-height: 1.6; }
.esa-rule .esa-st { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: #8a93b8; }
.esa-rule.ok .esa-st { color: #0b9c7c; }
.esa-rule.no .esa-st { color: #b0a7a7; }

/* ---- 深色日志 ---- */
.esa-log { background: #101828; border-radius: 12px; padding: 10px 12px; max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; }
.esa-line { font-size: 12.5px; line-height: 1.65; color: #cdd6e8; }
.esa-line.ok { color: #7ee2c4; }
.esa-line.no { color: #f2a9a9; }
.esa-line.warn { color: #ffd76a; }
.esa-line.hi { color: #8fd0ff; }
.esa-line b { font-weight: 800; }

/* ---- 推理链（解释机制） ---- */
.esa-chain { display: flex; flex-direction: column; gap: 7px; }
.esa-lv { position: relative; padding-left: 26px; }
.esa-lv:before { content: ''; position: absolute; left: 9px; top: 17px; bottom: -8px; width: 2px; background: #cfece6; }
.esa-lv:last-child:before { display: none; }
.esa-lv > i { position: absolute; left: 2px; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; font-size: 9.5px; font-weight: 900; font-style: normal; display: flex; align-items: center; justify-content: center; }
.esa-lv b { font-size: 12.5px; color: #26304f; }
.esa-lv p { font-size: 11px; color: #6a7290; line-height: 1.6; }

/* ---- 反向链 ---- */
.esa-stack { display: flex; flex-direction: column; gap: 5px; }
.esa-stk { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; background: #f7f9fd; border: 1.5px solid #e4e9f3; border-radius: 10px; padding: 5px 9px; color: #3f4a68; }
.esa-stk.ok { background: #eafaf6; border-color: #7fd8c4; color: #0b7d60; }
.esa-stk.no { background: #fdeeee; border-color: #f0b4b4; color: #b83a2c; }
.esa-stk.q { background: #eef4ff; border-color: #b9cdf5; color: #2c4f9e; }
.esa-stk .esa-goal { font-size: 10px; font-weight: 800; color: #8a5a00; background: #fff3d6; border-radius: 6px; padding: 1px 6px; }
.esa-q { background: #eef4ff; border: 1.5px solid #b9cdf5; border-radius: 12px; padding: 10px 12px; }
.esa-q b { font-size: 13.5px; color: #26407a; }
.esa-q p { font-size: 11.5px; color: #4a5a83; line-height: 1.7; margin-top: 3px; }
.esa-q .esa-btns { margin-top: 9px; }

/* ---- 冲突消解 ---- */
.esa-conf { display: flex; flex-direction: column; gap: 7px; }
.esa-cf { display: flex; align-items: center; gap: 9px; background: #f7f9fd; border: 1.5px solid #e4e9f3; border-radius: 11px; padding: 8px 10px; transition: all .3s; }
.esa-cf.win { background: #eafaf6; border-color: var(--acc); box-shadow: 0 9px 18px -15px rgba(14, 147, 132, 1); }
.esa-cf.drop { opacity: .42; filter: grayscale(.45); }
.esa-cf .esa-cfi { flex: 0 0 32px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; background: linear-gradient(135deg, var(--acc), var(--acc2)); color: #fff; font-size: 11px; font-weight: 900; }
.esa-cf .esa-cfb { flex: 1; min-width: 0; }
.esa-cf .esa-cfb b { font-size: 12.5px; color: #26304f; }
.esa-cf .esa-cfb p { font-size: 11px; color: #6a7290; line-height: 1.6; }
.esa-cf .esa-cfm { flex: 0 0 auto; font-size: 10.5px; font-weight: 800; color: #5b6b93; background: #fff; border: 1px solid #e2e8f2; border-radius: 8px; padding: 3px 7px; text-align: center; line-height: 1.45; }
.esa-cf .esa-cfw { flex: 0 0 auto; font-size: 11px; font-weight: 800; color: #b0641f; }
.esa-formula { margin-top: 9px; font-size: 12px; color: #26407a; background: #f2f6ff; border: 1px dashed #b9cdf5; border-radius: 10px; padding: 8px 11px; line-height: 1.9; }
.esa-formula b { color: #0b7d70; }
@media (max-width: 780px) {
  .esa-grid2 { grid-template-columns: 1fr; }
  .esa-map { gap: 8px; }
  .esa-node { font-size: 11px; padding: 6px 4px; min-height: 62px; }
  .esa-node em { font-size: 17px; }
}
