/* SP-Allreduce 深度报告专属样式：4×4 环面调度动画板。
   .board / .controls / .btn / .step-desc / .legend 基础样式来自 css/report.css。 */

.spa-stage { min-height: 380px; }
.spa-wrap { position: relative; }

.spa-grid {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  grid-auto-rows: 56px;
  gap: 6px;
  justify-content: center;
  padding: 36px 8px 10px;
}
.spa-cell {
  position: relative; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; color: var(--text-muted); transition: background .3s, border-color .3s;
}
.spa-cell .spa-ctxt { position: absolute; left: 4px; bottom: 2px; font-size: 0.6rem; color: #aab3bd; line-height: 1; }
.spa-cell .spa-depth { position: absolute; right: 4px; top: 2px; font-size: 0.6rem; color: #9aa6b0; font-weight: 600; line-height: 1; }
.spa-cell .spa-star { position: absolute; left: 5px; top: 1px; color: #f39c12; font-size: 0.8rem; line-height: 1; }
.spa-cell.s-root { border: 2px solid var(--accent); background: #f0faf4; color: var(--accent); font-weight: 700; }
.spa-cell.s-send { border-color: #f39c12; animation: spaPulse 1s ease-in-out infinite; }
.spa-cell.s-recv { background: #eaf2f8; border: 2px solid #3498db; color: #2471a3; font-weight: 700; }
.spa-cell.s-done { background: #eafaf1; border-color: #82e0aa; color: var(--success); font-weight: 700; }
.spa-cell.s-fam { border-style: dashed; background: #fcfdfe; }
.spa-check { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--success); font-weight: 700; font-size: 0.95rem; }
.spa-sum { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--accent); font-weight: 800; font-size: 1.15rem; }
@keyframes spaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243,156,18,0); }
  50% { box-shadow: 0 0 0 5px rgba(243,156,18,.4); }
}

/* 箭头覆盖层 */
.spa-ov { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
.spa-arrow { position: absolute; }
.spa-arrow.h { height: 3px; margin-top: -1.5px; }
.spa-arrow.h::after, .spa-arrow.h::before,
.spa-arrow.v::after, .spa-arrow.v::before { content: ''; position: absolute; width: 0; height: 0; }
.spa-arrow.h::after { right: -1px; top: -5px; border: 6.5px solid transparent; border-left-width: 8px; border-right-width: 0; }
.spa-arrow.h.inv::before { left: -1px; top: -5px; border: 6.5px solid transparent; border-right-width: 8px; border-left-width: 0; }
.spa-arrow.v { width: 3px; margin-left: -1.5px; }
.spa-arrow.v::after { bottom: -1px; left: -5px; border: 6.5px solid transparent; border-top-width: 8px; border-bottom-width: 0; }
.spa-arrow.v.inv::before { top: -1px; left: -5px; border: 6.5px solid transparent; border-bottom-width: 8px; border-top-width: 0; }
.spa-arrow.ar { background: #e67e22; }
.spa-arrow.ar::after { border-left-color: #e67e22; }
.spa-arrow.ar.inv::before { border-right-color: #e67e22; }
.spa-arrow.ar.v::after { border-top-color: #e67e22; }
.spa-arrow.ar.v.inv::before { border-bottom-color: #e67e22; }
.spa-arrow.ab { background: #00897b; }
.spa-arrow.ab::after { border-left-color: #00897b; }
.spa-arrow.ab.inv::before { border-right-color: #00897b; }
.spa-arrow.ab.v::after { border-top-color: #00897b; }
.spa-arrow.ab.v.inv::before { border-bottom-color: #00897b; }
.spa-wrapmark { position: absolute; font-size: 0.74rem; color: #e67e22; font-weight: 700; z-index: 21; }

/* 对称全景：四棵基树的出边（小三角） */
.spa-dir { position: absolute; }
.spa-dir.n { top: 1px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-bottom: 8px solid var(--dirc); border-top-width: 0; }
.spa-dir.s { bottom: 1px; left: 50%; margin-left: -5px; border: 5px solid transparent; border-top: 8px solid var(--dirc); border-bottom-width: 0; }
.spa-dir.e { right: 1px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-left: 8px solid var(--dirc); border-right-width: 0; }
.spa-dir.w { left: 1px; top: 50%; margin-top: -5px; border: 5px solid transparent; border-right: 8px solid var(--dirc); border-left-width: 0; }
.spa-dir.c0 { --dirc: #e67e22; }
.spa-dir.c1 { --dirc: #2980b9; }
.spa-dir.c2 { --dirc: #27ae60; }
.spa-dir.c3 { --dirc: #8e44ad; }

/* 负载推演面板 */
.spa-load {
  margin: 12px 6px 4px; background: #f4f6f7;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; font-size: 0.83rem; line-height: 1.75;
}
.spa-load b { color: var(--primary); }

/* 图例色块 */
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin: 0 4px 0 12px; vertical-align: -1px; }
.lg:first-child { margin-left: 0; }
.l1 { background: #e67e22; }
.l2 { background: #3498db; }
.l3 { background: #27ae60; }
.l4 { background: var(--accent); }
.l5 { background: #8e44ad; }
