/* 锦囊引擎 Demo · 可口可乐红白黑配色 */
:root {
  --ko-red: #F40009;
  --ko-red-d: #B8070F;
  --ko-red-l: #FFF1F1;
  --ink: #0B0B0B;
  --ink-2: #2B2B2B;
  --muted: #6E6E73;
  --line: #E4E4E7;
  --line-2: #F0F0F1;
  --paper: #FFFFFF;
  --paper-2: #FAFAFA;
  --paper-3: #F4F4F5;
  --ok: #147A3B;
  --ok-l: #EDF8F1;
  --amber: #A85B00;
  --amber-l: #FFF7E8;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --radius: 12px;
  --gap-stage: 16px;   /* 剧情卡片之间、主展示区三卡之间 —— 同一套间距 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }
/* 顶栏是 sticky 的，给可滚动目标留出让位，避免被顶栏盖住 */
button, .panel, section, details, .stage > aside { scroll-margin-top: 78px; }
/* 任何带 hidden 属性的元素都必须真的不显示 —— 否则元素自己的 display:flex 会盖过它 */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper-2);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
a { color: var(--ko-red-d); }
code, .mono { font-family: var(--mono); font-size: .92em; }

/* ---------------- 顶栏 ---------------- */
header.top {
  position: sticky; top: 0; z-index: 60;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 22px;
  display: flex; align-items: center; gap: 18px;
  height: 62px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand img { height: 26px; display: block; }
.brand .sep { width: 1px; height: 22px; background: var(--line); }
.brand .name { font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand .name em { font-style: normal; color: var(--ko-red); }
nav.tabs { display: flex; gap: 4px; margin-left: 8px; }
nav.tabs button {
  font: inherit; font-weight: 600; color: var(--muted);
  background: transparent; border: 0; border-radius: 9px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, color .15s;
}
nav.tabs button:hover { background: var(--paper-3); color: var(--ink); }
nav.tabs button.active { background: var(--ko-red); color: #fff; }
.spacer { flex: 1; }
.badge-demo {
  font-size: 11.5px; font-weight: 700; color: var(--ko-red-d);
  background: var(--ko-red-l); border: 1px solid #FFD9D9;
  border-radius: 999px; padding: 4px 10px; letter-spacing: .02em;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; border-radius: 999px;
  padding: 3px 9px; border: 1px solid var(--line);
  background: var(--paper-3); color: var(--muted); white-space: nowrap;
}
.chip.red { background: var(--ko-red-l); border-color: #FFD9D9; color: var(--ko-red-d); }
.chip.ok { background: var(--ok-l); border-color: #CFE9DA; color: var(--ok); }
.chip.amber { background: var(--amber-l); border-color: #F2DCB4; color: var(--amber); }
.chip.bad { background: #FDECEC; border-color: #F7C9C9; color: var(--ko-red-d); }

/* ---------------- 页面骨架 ---------------- */
main { padding: 22px; max-width: 1640px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: fade .22s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.panel-h {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-2);
}
.panel-h h3 { font-size: 14.5px; }
.panel-h .spacer { flex: 1; }
.panel-b { padding: 16px; }
.lead { color: var(--muted); font-size: 13px; margin: 0; }
.hint { font-size: 12.5px; color: var(--muted); }

button.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 9px; padding: 8px 14px;
  transition: all .15s;
}
button.btn:hover:not(:disabled) { border-color: var(--ink); }
button.btn:disabled { opacity: .45; cursor: not-allowed; }
button.btn.primary { background: var(--ko-red); border-color: var(--ko-red); color: #fff; }
button.btn.primary:hover:not(:disabled) { background: var(--ko-red-d); border-color: var(--ko-red-d); }
button.btn.ghost { background: transparent; }
button.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

select, input[type=text] {
  font: inherit; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 10px; background: var(--paper); color: var(--ink); max-width: 100%;
}
label.field { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }

/* ---------------- View 1 · 演示主线 ---------------- */
/* 结构：剧情控制卡片（横排三张纸卡片）→ 主展示区（剧情漫画｜手机｜PC端后台信息展示区）
   主展示区三张卡片等高（都等于 --phone-h），行内间距与剧情卡片间距同为 --gap-stage */

/* ---- 剧情控制卡片 ---- */
.plot-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap-stage); margin-bottom: var(--gap-stage); }
.plot-card {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 10px 22px -14px rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: 9px;
  transition: box-shadow .18s, border-color .18s, transform .18s;
}
/* 纸卡片的折角 */
.plot-card::after {
  content: ""; position: absolute; top: 0; right: 0; width: 22px; height: 22px;
  background: linear-gradient(225deg, var(--paper-3) 0 46%, transparent 46%);
  border-radius: 0 12px 0 0; border-left: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
}
.plot-card:hover { border-color: #C9C9CE; transform: translateY(-1px); }
/* 选中态：当前正在展示的那一幕（与"是否已执行"互相独立） */
.plot-card.sel { border-color: var(--ko-red); box-shadow: 0 0 0 2px var(--ko-red-l), 0 10px 22px -14px rgba(244, 0, 9, .45); }
.plot-card.sel .plot-no { background: var(--ko-red); color: #fff; }
.plot-card.done::after { background: linear-gradient(225deg, #EAF6EF 0 46%, transparent 46%); }
.plot-top { display: flex; align-items: center; gap: 9px; }
.plot-top .sp { flex: 1; }
.plot-flag { font-size: 11px; font-weight: 700; white-space: nowrap; }
.plot-flag.busy { color: var(--amber); }
.plot-flag.done { color: var(--ok); }
.plot-no {
  width: 24px; height: 24px; border-radius: 7px; flex: none; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-3); color: var(--muted);
}
.plot-title { font-size: 14px; font-weight: 700; }
.plot-desc { font-size: 12.5px; color: var(--muted); line-height: 1.55; min-height: 40px; }
.plot-act { margin-top: auto; }
.plot-act .btn { width: 100%; }

/* ---- 主展示区 ---- */
.stage-main { display: grid; grid-template-columns: minmax(0, 1fr) 390px minmax(0, 1.06fr); gap: var(--gap-stage); align-items: start; }
.phone-wrap { display: flex; flex-direction: column; align-items: center; gap: 0; }
.phone-scale { transform-origin: top center; }

/* 三卡等高：剧情漫画 / PC端后台展示区 都钉到 --phone-h，与虚拟手机屏同高 */
.comic-panel, .backstage { height: var(--phone-h, 600px); display: flex; flex-direction: column; overflow: hidden; }
.comic-panel > .panel-h, .backstage > .panel-h { flex: none; flex-wrap: wrap; row-gap: 7px; }
.comic-panel > .panel-h h3, .backstage > .panel-h h3 { white-space: nowrap; }
.comic-panel > .panel-h .chip, .backstage > .panel-h .chip { white-space: nowrap; }

/* 剧情漫画 —— 竖版幕图高度适应、左右留白，不裁切画面 */
.comic-body {
  flex: 1; min-height: 0; height: auto;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); padding: 10px;
}
.comic-body img { max-height: 100%; max-width: 100%; width: auto; height: auto; display: block; border-radius: 8px; }

/* PC端 · 后台信息展示区 —— 面积扩大、字体加大 */
.backstage .panel-b { flex: 1; min-height: 0; max-height: none; overflow-y: auto; font-size: 13.5px; }
.backstage table.tbl { font-size: 13px; }
.backstage table.tbl th, .backstage table.tbl td { padding: 8px 10px; }
.backstage .mini-tbl { font-size: 13px; }
.backstage .mini-tbl td { padding: 6px 8px; }
.backstage .kv { font-size: 13.5px; }
.backstage .kv .k { width: 134px; }
.backstage .rel-list { font-size: 13px; }
.backstage .rel-list li { padding: 6px 0; }
.backstage .trace li { font-size: 13.5px; padding: 9px 0 9px 16px; }
.backstage .steps .lb { font-size: 13.5px; }
.backstage .kicker { font-size: 12.5px; }
.backstage .quote-box { font-size: 13.5px; }
.backstage .scroll-y { max-height: 300px; }

.phone {
  width: 390px; height: 844px; background: #0B0B0B;
  border-radius: 46px; padding: 11px; position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .12);
  flex: none;
}
.phone::after {
  content: ""; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%);
  width: 118px; height: 4px; border-radius: 4px; background: #3A3A3A;
}
.notch {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 118px; height: 26px; background: #0B0B0B;
  border-radius: 0 0 15px 15px; z-index: 5;
}
.screen {
  width: 100%; height: 100%; border-radius: 36px; overflow: hidden;
  background: var(--paper); display: flex; flex-direction: column; position: relative;
}
.statusbar {
  height: 40px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; font-size: 12.5px; font-weight: 700; color: var(--ink); flex: none;
}
.statusbar .right { display: flex; gap: 5px; align-items: center; }
.sig { display: inline-block; width: 15px; height: 10px; background:
  linear-gradient(90deg, var(--ink) 20%, transparent 20%, transparent 30%, var(--ink) 30%, var(--ink) 50%, transparent 50%, transparent 60%, var(--ink) 60%, var(--ink) 80%, transparent 80%);
  border-radius: 1px; }
.batt { width: 22px; height: 11px; border: 1.4px solid var(--ink); border-radius: 3px; position: relative; }
.batt::after { content: ""; position: absolute; inset: 1.5px; width: 62%; background: var(--ink); border-radius: 1px; }

.appbar {
  flex: none; padding: 8px 16px 12px; display: flex; align-items: center; gap: 9px;
  border-bottom: 1px solid var(--line-2); background: var(--paper);
}
.appbar img { height: 18px; }
.appbar .t { font-weight: 800; font-size: 15.5px; letter-spacing: -.02em; }
.appbar .who { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 600; }

.feed { flex: 1; overflow-y: auto; padding: 12px 13px 16px; background: var(--paper-2); }
.feed::-webkit-scrollbar { width: 6px; }
.feed::-webkit-scrollbar-thumb { background: #D6D6DA; border-radius: 3px; }

.phone-tabbar {
  flex: none; height: 54px; border-top: 1px solid var(--line-2);
  display: flex; align-items: center; background: var(--paper);
}
.phone-tabbar div {
  flex: 1; text-align: center; font-size: 10.5px; font-weight: 700; color: #B4B4B8;
}
.phone-tabbar div.on { color: var(--ko-red); }
.phone-tabbar div i { display: block; font-size: 15px; font-style: normal; line-height: 1.2; }

/* 手机内的消息卡 */
.msg { margin-bottom: 11px; animation: pop .3s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }
.msg .meta { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; padding-left: 3px; }

.push {
  background: var(--paper); border: 1px solid var(--line); border-radius: 13px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.push.tone-warning { border-color: #F6DCAE; }
.push.tone-success { border-color: #BFDCCB; }
.push-head {
  display: flex; align-items: center; gap: 7px; padding: 9px 12px;
  border-bottom: 1px solid var(--line-2); background: var(--paper-3);
}
.push-head .ico { font-size: 14px; }
.push-head .ttl { font-size: 11px; font-weight: 800; letter-spacing: .03em; color: var(--muted); }
.push-head .spacer { flex: 1; }
.push-body { padding: 11px 12px 12px; }
.push-body h4 { font-size: 14px; line-height: 1.45; margin-bottom: 8px; }
.push-body ul { margin: 0 0 10px; padding: 0; list-style: none; }
.push-body li {
  font-size: 12.5px; color: var(--ink-2); padding: 5px 0 5px 12px;
  position: relative; border-top: 1px dashed var(--line-2);
}
.push-body li:first-child { border-top: 0; }
.push-body li::before {
  content: ""; position: absolute; left: 1px; top: 12px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--ko-red);
}
.push-body li b { color: var(--ink); }
.boundary-line {
  font-size: 12px; font-weight: 700; border-radius: 8px; padding: 7px 10px;
  margin-bottom: 7px;
}
.boundary-line.stop { background: var(--amber-l); color: var(--amber); border: 1px solid #F2DCB4; }
.boundary-line.go { background: var(--ok-l); color: var(--ok); border: 1px solid #CFE9DA; }
.boundary-note { font-size: 11.5px; color: var(--muted); line-height: 1.55; }

/* 锦囊卡里的「可以照读的话术」 */
.script-block { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; }
.script-block .sb-label {
  display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--ko-red-d); margin-bottom: 6px;
}
.script-block .sb-text {
  font-size: 12.5px; line-height: 1.85; color: var(--ink-2);
  white-space: pre-wrap; max-height: 296px; overflow-y: auto; padding-right: 4px;
}
.script-block .sb-text::-webkit-scrollbar { width: 5px; }
.script-block .sb-text::-webkit-scrollbar-thumb { background: #D6D6DA; border-radius: 3px; }
.script-block .sb-text .num { background: #FFF1F1; color: var(--ko-red-d); font-weight: 700; border-radius: 4px; padding: 0 3px; }

.upload-card { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; padding: 12px; }
.wave { display: flex; align-items: flex-end; gap: 2px; height: 24px; margin: 8px 0; }
.wave i { flex: 1; background: var(--ko-red); border-radius: 2px; opacity: .28; }
.bar { height: 5px; border-radius: 3px; background: var(--paper-3); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ko-red); width: 0; transition: width .3s linear; }

.pipe { list-style: none; margin: 9px 0 0; padding: 0; }
.pipe li {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  padding: 5px 0; color: #B4B4B8; transition: color .25s;
}
.pipe li .dot {
  width: 15px; height: 15px; border-radius: 50%; border: 1.5px solid var(--line);
  flex: none; display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: #fff;
}
.pipe li.done { color: var(--ink); }
.pipe li.done .dot { background: var(--ko-red); border-color: var(--ko-red); }

.crystal-card {
  background: linear-gradient(135deg, #0B0B0B 0%, #232326 100%); color: #fff;
  border-radius: 13px; padding: 13px;
}
.crystal-card .k { font-size: 10.5px; letter-spacing: .1em; color: #FF8A8A; font-weight: 800; }
.crystal-card h4 { font-size: 15px; margin: 5px 0 7px; }
.crystal-card .p { font-size: 12px; color: #D6D6DA; line-height: 1.6; }
.crystal-card .tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.crystal-card .tags span {
  font-size: 10.5px; border: 1px solid #4A4A4E; border-radius: 999px; padding: 2px 8px; color: #D6D6DA;
}

/* ---------------- View 2 · 本体地图 ---------------- */
.map-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.map-canvas { position: relative; background: var(--paper); border-radius: var(--radius); overflow: hidden; }
.map-canvas svg { display: block; width: 100%; height: auto; }
.node-box { cursor: pointer; }
.node-box rect { transition: all .16s; }
.node-box:hover rect { stroke: var(--ko-red); stroke-width: 2; }
.node-box.sel rect { stroke: var(--ko-red); stroke-width: 2.5; }
.node-box.dim { opacity: .16; }
.edge { transition: all .16s; }
.edge.hi { stroke: var(--ko-red) !important; stroke-width: 1.9 !important; opacity: 1 !important; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.map-legend span { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.kv { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.kv li { display: flex; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line-2); }
.kv li:first-child { border-top: 0; }
.kv .k { color: var(--muted); width: 118px; flex: none; }
.kv .v { font-weight: 600; word-break: break-all; }
.rel-list { list-style: none; margin: 9px 0 0; padding: 0; font-size: 12px; }
.rel-list li { padding: 5px 0; border-top: 1px solid var(--line-2); color: var(--muted); }
.rel-list li b { color: var(--ink); font-weight: 600; }

/* 关系图例（HTML 渲染，不随 SVG 缩放） */
.rel-legend { border-top: 1px solid var(--line); background: var(--paper); }
.rel-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 6px; padding: 4px 16px 16px;
}
.rel-item {
  display: flex; align-items: center; gap: 8px; font: inherit; font-size: 12.5px;
  text-align: left; cursor: pointer; padding: 7px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--paper); transition: all .14s; min-width: 0;
}
.rel-item:hover { border-color: var(--ink); }
.rel-item.sel { border-color: var(--ko-red); background: var(--ko-red-l); }
.rel-item i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.rel-item b { font-weight: 700; white-space: nowrap; }
.rel-item .rt { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.rel-item .rn { font-size: 11px; font-weight: 700; color: var(--ko-red-d); white-space: nowrap; }
.rel-item.zero .rn { color: #B4B4B8; font-weight: 600; }

/* ---------------- View 3 · 能力边界 ---------------- */
.boundary-stack { display: grid; gap: 0; }
.bnd {
  border: 1.5px solid var(--line); border-radius: 14px; padding: 15px 17px; background: var(--paper);
}
.bnd.off { border-style: dashed; border-color: #D9D9DE; background: #FCFCFD; }
.bnd.on { border-color: var(--ko-red); background: var(--ko-red-l); }
.bnd h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.bnd .sub { font-size: 12px; color: var(--muted); margin-bottom: 11px; }
.bnd ul { margin: 0; padding: 0; list-style: none; }
.bnd li { font-size: 13px; padding: 4px 0 4px 17px; position: relative; color: var(--ink-2); }
.bnd li::before { content: "·"; position: absolute; left: 5px; color: var(--ko-red); font-weight: 800; }
.bnd .stop-line {
  margin-top: 11px; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 13px;
  background: var(--paper-3); color: var(--amber); border: 1px dashed #E0C79A;
}
.bnd .go-line {
  margin-top: 11px; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 13px;
  background: #fff; color: var(--ok); border: 1px solid #BFDCCB;
}
.expander { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 9px 0; }
.expander .ln { flex: 1; height: 1px; background: var(--line); }
.expander .tag {
  font-size: 12px; font-weight: 800; color: #fff; background: var(--ko-red);
  border-radius: 999px; padding: 5px 14px; white-space: nowrap;
}

.boom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 4px; }
.boom-card { border-radius: 14px; padding: 17px; border: 2px solid; }
.boom-card.bad { border-color: #F1C3C3; background: #FFF6F6; }
.boom-card.good { border-color: #B7DCC6; background: #F4FBF7; }
.boom-card .lbl { font-size: 11.5px; font-weight: 800; letter-spacing: .06em; }
.boom-card.bad .lbl { color: var(--ko-red-d); }
.boom-card.good .lbl { color: var(--ok); }
.boom-card .big { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; margin: 4px 0 2px; }
.boom-card.bad .big { color: var(--ko-red); }
.boom-card.good .big { color: var(--ok); }
.boom-card .note { font-size: 12.5px; color: var(--ink-2); }
.versus { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--muted); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th, table.tbl td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line-2); }
table.tbl th { font-size: 11.5px; color: var(--muted); font-weight: 700; background: var(--paper-3); position: sticky; top: 0; }
table.tbl tr.edge td { background: #FFFBF0; }
table.tbl tr:hover td { background: var(--paper-3); }
.scroll-y { max-height: 340px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }

.trace { list-style: none; margin: 0; padding: 0; }
.trace li {
  font-size: 13px; padding: 8px 0 8px 15px; position: relative;
  border-top: 1px solid var(--line-2); color: var(--ink-2);
}
.trace li:first-child { border-top: 0; }
.trace li::before { content: "▸"; position: absolute; left: 0; color: var(--ko-red); }

/* ---------------- View 4 · 规则引擎 ---------------- */
.engine-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line-2);
}
.steps li:first-child { border-top: 0; }
.steps .mark {
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; color: #fff; background: var(--ok);
  margin-top: 2px;
}
.steps li.no .mark { background: var(--ko-red); }
.steps li.crit .mark { background: #6E6E73; }
.steps .lb { font-size: 13px; font-weight: 600; }
.steps .ex { font-family: var(--mono); font-size: 12.5px; margin-top: 3px; }
.steps .ex .op { color: var(--muted); }
.steps li.no .ex { color: var(--ko-red-d); }
.steps .note { font-size: 11.5px; color: var(--muted); }

.ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.ab-col { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.ab-col.off { border-color: #DCDCE0; }
.ab-col.on { border-color: var(--ko-red); }
.ab-h { padding: 11px 14px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 8px; }
.ab-col.off .ab-h { background: var(--paper-3); }
.ab-col.on .ab-h { background: var(--ko-red-l); }
.ab-h h4 { font-size: 13.5px; }
.ab-b { padding: 14px; }
.answer { font-size: 13.5px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.answer .num { background: #FFF1F1; color: var(--ko-red-d); font-weight: 700; border-radius: 4px; padding: 0 3px; }
.mini-tbl { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.mini-tbl td { padding: 5px 7px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.mini-tbl td.v { font-weight: 700; white-space: nowrap; color: var(--ko-red-d); }
.mini-tbl td.e { font-family: var(--mono); color: var(--muted); font-size: 11.5px; }

details.raw { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
details.raw > summary {
  cursor: pointer; padding: 9px 13px; font-size: 12.5px; font-weight: 700;
  background: var(--paper-3); color: var(--ink-2); list-style: none;
}
details.raw > summary::marker, details.raw > summary::-webkit-details-marker { display: none; }
details.raw > summary::after { content: " ▾"; color: var(--muted); }
details.raw[open] > summary::after { content: " ▴"; }
details.raw pre {
  margin: 0; padding: 13px; background: #0B0B0B; color: #E8E8EA;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  max-height: 440px; overflow: auto; white-space: pre;
}

/* ---------------- 理由链抽屉 ---------------- */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(11, 11, 11, .42);
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 80;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 94vw);
  background: var(--paper); z-index: 90; transform: translateX(102%);
  transition: transform .26s cubic-bezier(.3, .8, .3, 1);
  display: flex; flex-direction: column; box-shadow: -14px 0 40px rgba(0, 0, 0, .16);
}
.drawer.open { transform: none; }
.drawer-h {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex: none;
}
.drawer-h h3 { font-size: 15px; }
.drawer-b { padding: 18px; overflow-y: auto; flex: 1; }
.chain { list-style: none; margin: 0; padding: 0; position: relative; }
.chain::before {
  content: ""; position: absolute; left: 17px; top: 12px; bottom: 12px;
  width: 2px; background: var(--line);
}
.chain > li { position: relative; padding: 0 0 16px 48px; }
.chain .node {
  position: absolute; left: 8px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--line); z-index: 1;
}
.chain .layer-tag {
  font-size: 10.5px; font-weight: 800; letter-spacing: .08em; color: var(--muted);
  text-transform: uppercase; display: block; margin-bottom: 3px;
}
.chain .layer-body { background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; }
.chain .concl { background: var(--ko-red); color: #fff; border-radius: 11px; padding: 13px 15px; }
.chain .concl .layer-tag { color: #FFC9C9; }
.chain .concl .t { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.chain .fact {
  font-size: 13px; padding: 7px 0; border-top: 1px dashed var(--line); cursor: pointer;
  display: flex; gap: 9px; align-items: flex-start;
}
.chain .fact:first-of-type { border-top: 0; }
.chain .fact:hover { color: var(--ko-red-d); }
.chain .fact .src { font-size: 11.5px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.chain .fact .ftag { font-size: 11px; font-weight: 800; flex: none; }
.quote-box {
  margin-top: 8px; background: #FFFBF0; border: 1px solid #F0E0BE; border-left: 3px solid var(--amber);
  border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); animation: fade .2s;
}
.quote-box .loc { display: block; font-size: 11.5px; color: var(--muted); margin-top: 5px; font-family: var(--mono); }
.proof { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }

/* ---------------- 浮层与提示 ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: 10px; opacity: 0; pointer-events: none;
  transition: all .22s; z-index: 200; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.kicker {
  font-size: 11.5px; font-weight: 800; letter-spacing: .07em; color: var(--ko-red);
  text-transform: uppercase; margin-bottom: 5px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stack { display: grid; gap: 18px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 14px; }
.spin {
  width: 13px; height: 13px; border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: sp .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
@keyframes sp { to { transform: rotate(360deg); } }
.ok-txt { color: var(--ok); font-weight: 700; }
.bad-txt { color: var(--ko-red-d); font-weight: 700; }

@media (max-width: 1360px) {
  /* 更窄时才放弃三列：剧情漫画与手机并排，后台展示区落到第二行通栏 */
  .stage-main { grid-template-columns: minmax(0, 1fr) 390px; }
  .stage-main > .backstage { grid-column: 1 / -1; }
  .stage-main > .backstage { height: auto; }
  .backstage .panel-b { max-height: 60vh; }
}
@media (max-width: 1180px) {
  .plot-row { grid-template-columns: 1fr; }
  .stage-main, .map-grid, .engine-grid, .ab-grid, .boom, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stage-main > .backstage { grid-column: auto; }
  /* 窄屏取消等高，让内容自然撑开 */
  .comic-panel, .backstage { height: auto; }
  .comic-body { min-height: 0; }
  .comic-body img { max-height: 70vh; }
  header.top { height: auto; flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  main { padding: 14px; }
}

/* ================================================================== *
 * ⑤ 战略校准 —— 新增类名统一 .st- 前缀，不改动上面任何现有规则
 * ================================================================== */
.st-h1 { font-size: 22px; letter-spacing: -.02em; margin-bottom: 4px; }
.st-kpis { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 14px; }
.st-kpi {
  flex: 1; min-width: 118px; background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px;
}
.st-kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.st-kpi span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.st-kpi.bad { background: var(--ko-red-l); border-color: #FFD9D9; }
.st-kpi.bad b { color: var(--ko-red); }

.st-hypo { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.st-hypo-row { display: flex; gap: 12px; padding: 11px 14px; font-size: 13.5px; align-items: baseline; }
.st-hypo-row + .st-hypo-row { border-top: 1px solid var(--line-2); }
.st-hypo-row.bad { background: var(--ko-red-l); }
.st-hypo-tag { flex: none; width: 76px; font-size: 11.5px; font-weight: 800; letter-spacing: .05em; color: var(--muted); }
.st-hypo-row.bad .st-hypo-tag { color: var(--ko-red-d); }

.st-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
/* 两列等高：面板撑满整格、面板正文再撑满面板 */
.st-grid2 > .panel { display: flex; flex-direction: column; }
.st-grid2 > .panel > .panel-b { flex: 1; }
/* 打脸对比的右侧插槽：占位框与揭示卡共用同一格，揭示时原地替换 */
.st-slot { display: flex; flex-direction: column; }
.st-slot > .st-face { flex: 1; }

/* 交叉表：内容少也要撑满整格，结论条钉在底部 */
#st-cohorts { display: flex; flex-direction: column; }
#st-cohorts table.tbl { margin-bottom: 12px; }
#st-cohorts .st-callout { margin-top: auto; }

/* 交叉表 */
.st-row { cursor: pointer; }
.st-cohort td { vertical-align: top; }
.st-callout {
  margin-top: 12px; border-radius: 10px; padding: 11px 14px; font-size: 13px;
  background: var(--amber-l); border: 1px solid #F2DCB4; color: var(--ink-2);
  display: flex; flex-direction: column; gap: 4px;
}
.st-callout b { color: var(--amber); }
.st-callout.amber { background: #FCFCFD; border-color: var(--line); }
.st-callout.amber b { color: var(--ink); }

/* 异议分布（纯 CSS 横条，不引任何图表库） */
.st-obj { padding: 9px 0; border-top: 1px solid var(--line-2); }
.st-obj:first-child { border-top: 0; padding-top: 0; }
.st-obj-top { display: flex; align-items: center; gap: 9px; }
.st-obj-label { font-size: 13.5px; font-weight: 700; flex: 1; min-width: 0; }
.st-obj-count {
  font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: var(--ko-red-l); color: var(--ko-red-d); border: 1px solid #FFD9D9;
  border-radius: 999px; padding: 2px 9px; transition: all .15s;
}
.st-obj-count:hover { background: var(--ko-red); color: #fff; border-color: var(--ko-red); }
.st-obj-rate { font-size: 12.5px; font-weight: 700; color: var(--muted); width: 46px; text-align: right; flex: none; }
.st-bar { height: 9px; border-radius: 5px; background: var(--paper-3); margin: 7px 0 5px; overflow: hidden; }
.st-bar > i { display: block; height: 100%; background: var(--ko-red); border-radius: 5px; }
.st-obj-sub { font-size: 11.5px; color: var(--muted); }

/* 机制 */
.st-finding { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.st-finding-sub { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 4px; }
.st-chain { margin: 0; padding-left: 20px; font-size: 13.5px; }
.st-chain li { padding: 4px 0; }

/* 押金政策 */
.st-pol { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.st-pol.rival { border-color: #BFDCCB; background: #F7FCF9; }
.st-pol-big { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 8px; color: var(--ko-red); }
.st-pol.rival .st-pol-big { color: var(--ok); }
.st-pol-big span { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 3px; }

/* 打脸对比 */
.st-face { border-radius: 14px; overflow: hidden; border: 1.5px solid; display: flex; flex-direction: column; }
.st-face.off { border-style: dashed; border-color: #D9D9DE; background: #FCFCFD; }
.st-face.on { border-color: var(--ko-red); background: var(--ko-red-l); animation: fade .3s ease-out; }
/* 未揭示时的占位：只占版面，不泄露「有本体」的任何内容 */
.st-face.blank {
  border-style: dashed; border-color: var(--line); background: var(--paper-2);
  display: flex; align-items: center; justify-content: center; min-height: 260px;
}
.st-blank-hint { font-size: 13px; color: #B4B4B8; font-weight: 600; }
.st-face-h { padding: 11px 15px; font-size: 14px; font-weight: 800; border-bottom: 1px solid var(--line-2); }
.st-face.off .st-face-h { background: var(--paper-3); color: var(--muted); }
.st-face.on .st-face-h { background: #fff; color: var(--ko-red-d); }
.st-face-b { padding: 15px; font-size: 13.5px; line-height: 1.8; flex: 1; }
.st-face-b p { margin: 0 0 10px; }
.st-rx { border-radius: 9px; padding: 10px 13px; font-weight: 700; font-size: 13.5px; margin: 12px 0 9px; }
.st-rx.bad { background: var(--paper-3); color: var(--amber); border: 1px dashed #E0C79A; }
.st-rx.good { background: #fff; color: var(--ok); border: 1px solid #BFDCCB; }
.st-flaw { font-size: 12.5px; color: var(--muted); }
.st-flaw.ok { color: var(--ok); font-weight: 600; }
.st-nums { margin: 12px 0; }
.st-num-row { display: flex; gap: 10px; flex-wrap: wrap; }
.st-num { flex: 1; min-width: 128px; background: #fff; border: 1px solid #BFDCCB; border-radius: 10px; padding: 9px 12px; }
.st-num b { display: block; font-size: 24px; font-weight: 800; color: var(--ok); letter-spacing: -.03em; }
.st-num span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.st-crosscheck { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 14px; font-size: 13.5px; line-height: 1.8; }
.st-crosscheck p { margin: 0 0 9px; }
.st-crosscheck .kicker { margin-bottom: 8px; }

/* 纠偏建议 */
.st-rec { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; }
.st-rec + .st-rec { margin-top: 10px; }
.st-rec-h { display: flex; align-items: center; gap: 9px; font-size: 14px; margin-bottom: 8px; }
.st-rec-b { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.st-k { display: inline-block; width: 40px; font-size: 11.5px; font-weight: 800; color: var(--muted); letter-spacing: .05em; vertical-align: 1px; }
.st-crossref { margin-top: 4px; font-size: 12.5px; color: var(--amber); }

/* 抽屉里的门店列表 */
.st-list-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.st-stores td { vertical-align: top; }
.st-api-row { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 1180px) {
  .st-grid2 { grid-template-columns: 1fr; }
}
