/* 栈追踪可视化组件 —— 供任何讲「读异常栈」的课复用 */

/* 用绝对定位而非 grid-row: 1/-1 —— 后者在隐式行里只跨一行，帧数一多轴就撑不满 */
.stack {
  position: relative;
  margin-top: 18px;
  padding-left: 92px;
}

/* 左侧方向轴 */
.stack .axis {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: 80px;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px 10px 0;
  border-right: 2px dashed var(--line);
  text-align: right;
}

.stack .axis span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.35;
}

.stack .axis .up {
  color: var(--red);
}

.stack .axis .down {
  color: var(--blue);
}

/* 每一层栈帧 */
.frame {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: white;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.frame:first-of-type {
  border-radius: 0 12px 0 0;
}

.frame:last-of-type {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 12px 0;
}

/* 栈顶 = 真正爆炸的地方 */
.frame.boom {
  border-color: #e0a9a4;
  background: #fdeeed;
  font-weight: 700;
}

/* 你自己的代码（非 JDK / 非框架） */
.frame.ours {
  border-left: 5px solid var(--green);
  background: var(--green-soft);
}

.frame .tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 20px;
  color: white;
  background: var(--muted);
  font-family: Inter, "PingFang SC", system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

.frame.boom .tag {
  background: var(--red);
}

.frame.ours .tag {
  background: var(--green);
}

/* 影响面三问 */
.asks {
  display: grid;
  gap: 12px;
  margin-top: 6px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ask {
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--amber);
  border-radius: 12px;
  background: white;
}

.ask .n {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ask h4 {
  margin: 6px 0 8px;
  font-size: 1rem;
}

.ask p {
  margin: 0;
  color: #3e4955;
  font-size: 0.9rem;
}

/* 判定结论条 */
.verdict {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
}

.verdict.safe {
  border: 1px solid #b9ddc8;
  background: var(--green-soft);
}

.verdict.danger {
  border: 1px solid #e0a9a4;
  background: #fdeeed;
}

.verdict .mark {
  flex: 0 0 auto;
  font-size: 1.7rem;
}

@media (max-width: 700px) {
  .stack {
    padding-left: 54px;
  }

  .stack .axis {
    width: 46px;
    padding-right: 8px;
  }

  .stack .axis span {
    font-size: 0.68rem;
  }

  .asks {
    grid-template-columns: 1fr;
  }
}

@media print {
  .frame, .ask, .verdict {
    break-inside: avoid;
  }
}
