/* ==========================================================================
   各章节自己的版式（总览 / 点积 / 矩阵乘法 / 综合 / 总结）
   ========================================================================== */

a.inl {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 总览：流水线自上而下 ---------- */
.pipe.is-down,
.pipe.is-down .pipe-group {
  flex-direction: column;
}
.optags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 14px;
}
.optag {
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 700;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
}
.optag:hover {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}

/* 并排对比的两条等式（⊙ 与矩阵乘法、AB 与 BA）：两条之间留足间距，别读成一条 */
.mx-eq.cmp {
  gap: 20px 56px;
}
@media (max-width: 520px) {
  .mx-eq.cmp {
    gap: 22px 16px;
  }
}
/* 多头切片：头数多时，切出来的几个小矩阵在窄屏上要能折行，否则这一块会伸出屏幕 */
.headsplit .mx-eq > .piece {
  flex-wrap: wrap;
  max-width: 100%;
  row-gap: 12px;
}

/* 五个运算的卡片 */
.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.op-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-content: start;
  gap: 8px 12px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.op-card:hover {
  transform: translateY(-3px);
  border-color: var(--brand);
  box-shadow: var(--shadow-2);
  text-decoration: none;
}
.op-card-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}
.op-card-ico svg {
  width: 20px;
  height: 20px;
}
/* 标题和“第 N 章”永远上下两行：窄卡片里标题折行时，各张卡片才长得一致 */
.op-card-hd {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: center;
  gap: 0;
  font-size: 17px;
  line-height: 1.3;
}
.op-card-chap {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}
.op-card-mean {
  grid-column: 1 / -1;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--text-2);
}
.op-card-where {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}
.op-card-where b {
  color: var(--text-2);
}
/* 支持 subgrid 的浏览器里，同一排的卡片共用三条行轨道：标题、说明、虚线分隔都对齐 */
@supports (grid-template-rows: subgrid) {
  .ops-grid {
    row-gap: 8px;
  }
  .op-card {
    grid-row: span 3;
    grid-template-rows: subgrid;
    margin-bottom: 8px;
  }
}

.howto h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 6px;
}
.howto h4 svg {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

/* ---------- 带圆点的“读一读”列表 ---------- */
.read-list {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}
.read-list li {
  position: relative;
  padding: 8px 14px 8px 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.read-list li::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

/* ---------- ④ 随机手算题 ---------- */
.practice {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.practice > .btn {
  justify-self: start;
}
.practice .challenge {
  margin: 0;
}

/* ---------- ⑥ 综合 ---------- */
.step-uses {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
}
.step-uses svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}
.growth {
  display: grid;
  grid-template-columns: minmax(200px, 320px) auto minmax(0, 1fr);
  align-items: center;
  gap: 14px 26px;
  margin-bottom: 18px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.growth p {
  margin: 0;
}
.growth-viz {
  display: grid;
  place-items: center;
  min-height: 60px;
}
@media (max-width: 760px) {
  .growth {
    grid-template-columns: minmax(0, 1fr);
  }
  .growth-viz {
    justify-items: start;
  }
}

/* ---------- 总结 ---------- */
table.tbl.cheat td:first-child {
  white-space: normal;
  min-width: 7em;
}
table.tbl.cheat td {
  vertical-align: middle;
}
.mantras {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mantras li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}
.mantra-n {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
}
.mantras b {
  font-size: 17px;
}
.checklist {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.checklist li svg {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 3px;
  padding: 4px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good);
}
