* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: #263b3a; font: 16px/1.5 "Microsoft YaHei", "Noto Sans SC", "PingFang SC", Arial, sans-serif; }
:root { --ink: #263b3a; --accent: #0079ba; --accent-strong: #0b2c5c; }
.equilibrium-demo {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0;
  border: 1px solid #d8dfd9;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  margin: 20px 0;
}

.equilibrium-controls {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 10px;
  background: #f8fbfa;
  border-right: 1px solid #d8dfd9;
}

.equilibrium-dir-btn {
  display: block;
  width: 100%;
  padding: 12px 10px;
  border: 1px solid #d8dfd9;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 140ms ease;
}

.equilibrium-dir-btn + .equilibrium-dir-btn {
  margin-top: 8px;
}

.equilibrium-dir-btn:hover {
  border-color: var(--accent);
  background: #edf6f2;
}

.equilibrium-dir-btn.is-active {
  border-color: var(--accent-strong);
  background: var(--accent);
  color: #fff;
}

.equilibrium-canvas {
  overflow-x: auto;
  border-bottom: 1px solid #dfe7e2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
}

.equilibrium-svg {
  display: block;
  width: 100%;
  max-width: 760px;
  min-width: 520px;
  height: auto;
  margin: 0 auto;
}

/* 方向层默认隐藏 */
.eq-layer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.equilibrium-demo[data-direction="x"] .eq-layer-x,
.equilibrium-demo[data-direction="y"] .eq-layer-y,
.equilibrium-demo[data-direction="z"] .eq-layer-z,
.equilibrium-demo[data-direction="AA"] .eq-layer-AA,
.equilibrium-demo[data-direction="BB"] .eq-layer-BB,
.equilibrium-demo[data-direction="CC"] .eq-layer-CC {
  opacity: 1;
  pointer-events: all;
}

/* 箭头样式：绿色为坐标正向，蓝色为坐标反向 */
.eq-vector-positive,
.eq-vector-negative,
.eq-vector-body {
  fill: none;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.eq-vector-positive {
  stroke: #1f7a68;
}

.eq-vector-negative {
  stroke: #2367b1;
}

.eq-vector-body {
  stroke: #c58b2b;
  stroke-dasharray: 6 4;
}

.eq-axis-line {
  fill: none;
  stroke: #1d2621;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.eq-moment-axis {
  fill: none;
  stroke: #456c91;
  stroke-width: 2.5;
  stroke-dasharray: 8 6;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---- 第 2 章公式自动编号 - 由 MathJax \begin{equation} 原生处理 ---- */
.eq-ch2-num {
  margin: 1.2em 0;
}

.eq-axis-label {
  pointer-events: none;
  overflow: visible;
}

.eq-axis-label > div {
  color: #1d2621;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

/* 公式标签 */
.eq-math-label {
  pointer-events: none;
  overflow: visible;
}

.eq-math-label > div {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 58px;
  min-height: 28px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  filter: drop-shadow(0 2px 3px rgba(31, 53, 45, 0.14));
}

.eq-label-positive > div,
.eq-label-positive mjx-container {
  color: #1f7a68 !important;
}

.eq-label-negative > div,
.eq-label-negative mjx-container {
  color: #2367b1 !important;
}

.eq-label-body > div,
.eq-label-body mjx-container {
  color: #a46d19 !important;
}

.equilibrium-hint {
  grid-column: 1 / -1;
  margin: 0;
  padding: 12px 18px;
  background: #f9fbf9;
  border-top: 1px solid #d8dfd9;
  font-size: 14px;
  color: #4a5c52;
  text-align: center;
}

.equilibrium-hint mjx-container {
  font-size: inherit;
}

.equilibrium-hint .eq-positive-text,
.equilibrium-hint .eq-negative-text {
  font-weight: 700;
}

.equilibrium-hint .eq-positive-text,
.equilibrium-hint .eq-positive-text mjx-container {
  color: #1f7a68 !important;
}

.equilibrium-hint .eq-negative-text,
.equilibrium-hint .eq-negative-text mjx-container {
  color: #2367b1 !important;
}

/* ---------- 2.4 柯西四面体面元互动图 ---------- */

body > :first-child { margin: 0 auto; max-width: 100%; padding: 22px; border: 1px solid #d9e2eb; border-radius: 6px; }
.equilibrium-controls, .cauchy-face-controls { background: #f5f8fa; }
button { font-family: inherit; }
button.is-active { background: #0079ba; border-color: #0079ba; color: #fff; }
.equilibrium-svg, .cauchy-tetrahedron-svg { min-width: 0; }
.equilibrium-canvas, .cauchy-svg-panel { min-width: 0; background: #fff; border: 0; }
mjx-container > svg { overflow: visible; }
@media (max-width: 680px) {
 body > :first-child { padding: 14px; grid-template-columns: 1fr; }
 .equilibrium-controls, .cauchy-face-controls { flex-direction: row; padding: 8px; gap: 8px; border-right: 0; }
 .equilibrium-dir-btn + .equilibrium-dir-btn { margin-top: 0; }
 .equilibrium-dir-btn, .cauchy-face-btn { flex: 1; padding: 10px 4px; }
}


.stress-face-base { stroke: rgba(233, 35, 35, 0.88); stroke-width: 6; stroke-linejoin: round; }

.stress-face-front-base { fill: rgba(255, 255, 255, 0.94); }

.stress-face-top-base { fill: rgba(255, 250, 250, 0.9); }

.stress-face-right-base { fill: rgba(255, 218, 218, 0.82); }

.stress-edge { stroke: rgb(240, 24, 24); stroke-width: 6; stroke-linecap: round; }

.stress-component-demo[data-active-face="front"] .stress-face-front-base, .stress-component-demo[data-active-face="top"] .stress-face-top-base, .stress-component-demo[data-active-face="right"] .stress-face-right-base { filter: drop-shadow(rgba(31, 53, 45, 0.16) 0px 10px 14px); stroke: rgb(217, 150, 44); }
.stress-hidden-edge { fill: none; stroke: #f01818; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 18 18; opacity: .75; }
