/* ============================================================
   styles-shapes.css — 形状系统（shapes.html / workshop.html）专用
   复用 styles.css 的令牌：--bg --bg-soft --paper --ink --text
   --text-dim --accent --accent-bright --mono --sans
   ============================================================ */

/* ---------- 顶部：页面级导航 ---------- */
.topnav .nav-pages a {
  color: var(--text-dim); text-decoration: none; margin-left: 18px; font-size: 14px;
}
.topnav .nav-pages a:hover { color: var(--accent-bright); }
.topnav .nav-pages a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---------- 页内分节导航 ---------- */
.subnav {
  position: sticky; top: 47px; z-index: 9;
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 10px 28px;
  background: rgba(12, 12, 16, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #1c1c26;
}
.subnav a {
  font-size: 12.5px; color: var(--text-dim); text-decoration: none;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid transparent; white-space: nowrap;
}
.subnav a:hover { color: var(--text); background: var(--bg-soft); border-color: #2a2a38; }
.subnav .sep { color: #33333f; font-size: 11px; }

/* ---------- 版块：单列（形状页信息密度高，不适合左右分栏） ---------- */
.sec-single {
  display: block; max-width: 1100px; margin: 0 auto;
  padding: 68px 28px; border-top: 1px solid #1c1c26;
}
.sec-single:first-of-type { border-top: 0; }
.sec-single > p { max-width: 74ch; }

/* 结论条 */
.keynote {
  border-left: 3px solid var(--accent);
  background: linear-gradient(90deg, rgba(46, 107, 255, 0.14), rgba(46, 107, 255, 0));
  padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 20px 0;
  color: var(--text-dim); max-width: 80ch;
}
.keynote b { color: var(--text); }
.keynote.warn {
  border-left-color: #ff7a8a;
  background: linear-gradient(90deg, rgba(255, 122, 138, 0.14), rgba(255, 122, 138, 0));
}
.keynote.ok {
  border-left-color: #3ddc97;
  background: linear-gradient(90deg, rgba(61, 220, 151, 0.13), rgba(61, 220, 151, 0));
}

/* ---------- 形状卡片（深墨轮廓画在浅色纸面上，和 bot 渲染同一套底） ---------- */
.shape-grid { display: grid; gap: 12px; margin-top: 16px; }
.shape-grid.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.shape-grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shape-cell {
  background: var(--paper); border-radius: 13px; padding: 8px 6px 6px;
  text-align: center; position: relative; color: var(--ink);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}
.shape-cell svg { display: block; width: 100%; height: 104px; }
.shape-cell .ink { fill: var(--ink); }
.shape-cell .nm {
  font-family: var(--mono); font-size: 11.5px; color: #3a3a48; margin-top: 2px;
}
.shape-cell .tag {
  position: absolute; top: 6px; right: 7px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; line-height: 1;
  padding: 3px 6px; border-radius: 999px; background: var(--ink); color: #fff;
}
.shape-cell .tag.cv { background: #1f7a52; }
.shape-cell .tag.cc { background: #a2541f; }

/* 分组容器 */
.shape-group {
  border: 1px solid #23232f; border-radius: 16px; padding: 16px 18px; margin-top: 16px;
  background: var(--bg-soft);
}
.shape-group .gh {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 4px;
}
.kind {
  font-family: var(--mono); font-size: 12.5px; font-weight: 700; line-height: 1;
  padding: 5px 11px; border-radius: 999px; background: #1e2735; color: #7fb3ff;
}
.kind.cc { color: #7ee0c0; }
.shape-group .gsub { font-size: 12.5px; color: var(--text-dim); }
.shape-group .gsub b { color: #ffb454; }

/* ---------- 流水线 ---------- */
.pipeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin: 22px 0 0; }
.pipe-stage {
  position: relative; background: var(--bg-soft); border: 1px solid #23232f;
  border-radius: 12px; padding: 13px 12px; cursor: pointer; transition: 0.16s;
}
.pipe-stage:hover { border-color: #3a3a4a; transform: translateY(-2px); }
.pipe-stage[aria-pressed="true"] { border-color: var(--accent); background: #17203a; }
.pipe-stage:not(:last-child)::after {
  content: "→"; position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  color: #4a4a5c; font-size: 15px; font-weight: 700;
}
.pipe-stage .pn { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: #7ee0c0; }
.pipe-stage .pl { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; line-height: 1.45; }

/* ---------- 实验室 ---------- */
.lab {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px;
  background: var(--bg-soft); border: 1px solid #23232f; border-radius: 16px;
  padding: 18px; margin-top: 18px;
}
.lab-stage,
.lab-stage-main {
  background: var(--paper); border-radius: 12px; min-height: 360px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.lab-stage svg,
.lab-stage-main svg { display: block; width: 100%; height: 360px; }
.lab-eq {
  margin-top: 14px; font-family: var(--mono); font-size: 12.5px;
  background: #0e0e14; border: 1px solid #23232f; border-radius: 9px;
  padding: 11px 13px; color: #9fc4ff; overflow-x: auto; white-space: pre;
}
.pick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pick button {
  font-family: var(--mono); font-size: 12px; padding: 6px 10px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid #23232f; color: var(--text-dim); cursor: pointer;
}
.pick button:hover { color: var(--text); }
.pick button[aria-pressed="true"] { background: #17203a; border-color: var(--accent); color: #fff; }

/* 窄屏控件行 */
.ctl { margin-bottom: 12px; }
.ctl label {
  display: flex; justify-content: space-between; font-size: 12.5px;
  color: var(--text-dim); margin-bottom: 5px; gap: 10px;
}
.ctl label b { color: var(--text); font-family: var(--mono); }
.ctl input[type="range"] { width: 100%; accent-color: var(--accent); }

/* ---------- 对账（并排两图） ---------- */
.recon { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.recon-card {
  background: var(--bg-soft); border: 1px solid #23232f; border-radius: 14px; padding: 12px;
}
.recon-card h4 { font-size: 13px; color: var(--text); margin-bottom: 9px; }
.recon-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recon-pair .lab-stage { min-height: 140px; }
.recon-pair .lab-stage svg { height: 140px; }
.recon-cap {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  font-size: 11px; color: var(--text-dim); margin-top: 7px; text-align: center;
}
.recon-cap small { display: block; color: #55556a; }

/* ---------- 开关 ---------- */
.toggle { display: inline-flex; background: var(--bg-soft); border: 1px solid #23232f;
  border-radius: 10px; padding: 3px; gap: 3px; }
.toggle button {
  font-family: var(--sans); font-size: 13px; padding: 7px 14px; border: 0; border-radius: 8px;
  background: none; color: var(--text-dim); cursor: pointer;
}
.toggle button[aria-pressed="true"] { background: #17203a; color: #fff; }

/* ---------- 环形线框 ---------- */
.rings { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 18px; }
.rings .lab-stage { min-height: 300px; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 14px; }
.tbl th, .tbl td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid #23232f; vertical-align: top;
}
.tbl thead th { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.tbl td.m { font-family: var(--mono); font-size: 12px; color: #a9d5ff; }
.tbl td.gen { font-family: var(--mono); font-size: 12px; color: #c3b6ff; }
.tbl td.dim { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.tbl tbody tr:hover td { background: #14141c; }
.tbl .pill {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 700;
  line-height: 1; padding: 4px 10px; border-radius: 999px; background: #1f7a52; color: #fff;
}
.tbl .pill.cc { background: #a2541f; }
.tbl .pill.opt { background: #243044; color: #9fb0c9; }

/* ---------- 配方步骤 ---------- */
.steps { display: grid; gap: 12px; margin-top: 20px; }
.step { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 16px;
  background: var(--bg-soft); border: 1px solid #23232f; border-radius: 14px; padding: 16px 18px; }
.step .num {
  width: 46px; height: 46px; border-radius: 12px; background: #17203a; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 17px; font-weight: 700;
}
.step h4 { font-size: 14.5px; color: var(--text); margin-bottom: 5px; }
.step p { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.step pre { margin: 8px 0 0; }

/* ---------- 决策树 ---------- */
.tree { display: grid; gap: 12px; margin-top: 20px; }
.tq { background: var(--bg-soft); border: 1px solid #23232f; border-radius: 14px; padding: 16px 18px; }
.tq .qt { font-weight: 600; color: var(--text); margin-bottom: 11px; }
.tq .qt span { font-family: var(--mono); font-size: 12px; color: var(--accent-bright); margin-right: 8px; }
.branches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.br { border-radius: 10px; padding: 12px 14px; font-size: 13.5px; color: var(--text-dim); }
.br .v { font-weight: 700; margin-bottom: 4px; color: var(--text); }
.br.no { background: rgba(255, 122, 138, 0.08); border: 1px solid rgba(255, 122, 138, 0.3); }
.br.no .v { color: #ff7a8a; }
.br.yes { background: rgba(61, 220, 151, 0.07); border: 1px solid rgba(61, 220, 151, 0.28); }
.br.yes .v { color: #3ddc97; }
.br.alt { background: rgba(46, 107, 255, 0.08); border: 1px solid rgba(46, 107, 255, 0.3); }
.br.alt .v { color: var(--accent-bright); }

/* ---------- 工作台 ---------- */
.wb { display: grid; grid-template-columns: minmax(0, 1fr) 500px; gap: 18px;
  background: var(--bg-soft); border: 1px solid #23232f; border-radius: 16px;
  padding: 18px; margin-top: 18px; }
.wb-canvas {
  background: var(--paper); border-radius: 12px; position: relative; overflow: hidden;
}
.wb-canvas svg { display: block; width: 100%; height: 430px; touch-action: none; }
.wb-hint { position: absolute; left: 12px; top: 10px; font-size: 11.5px; color: #6b6b80; }
.wb-verdict {
  display: flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 11px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 600;
}
.wb-verdict.ok { background: rgba(61, 220, 151, 0.1); border: 1px solid rgba(61, 220, 151, 0.35); color: #3ddc97; }
.wb-verdict.bad { background: rgba(255, 122, 138, 0.1); border: 1px solid rgba(255, 122, 138, 0.35); color: #ff7a8a; }
.wb-verdict small { font-weight: 400; color: var(--text-dim); }
.wb-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; align-items: center; }
.wb-tools button {
  font-family: var(--mono); font-size: 12px; padding: 7px 11px; border-radius: 8px;
  background: var(--bg-soft); border: 1px solid #23232f; color: var(--text-dim); cursor: pointer;
}
.wb-tools button:hover { color: var(--text); }
.wb-tools button[aria-pressed="true"] { background: #17203a; border-color: var(--accent); color: #fff; }
.wb-tools label { font-size: 12.5px; color: var(--text-dim); display: inline-flex;
  align-items: center; gap: 7px; }

.code-out { max-height: 560px; overflow: auto; padding-right: 4px; }
.code-blk { margin-bottom: 12px; }
.code-blk .ch { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.code-blk .ch span { font-family: var(--mono); font-size: 12px; color: var(--accent-bright); font-weight: 600; }
.code-blk .ch button {
  font-family: var(--sans); font-size: 11px; padding: 4px 9px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid #23232f; color: var(--text-dim); cursor: pointer;
}
.code-blk .ch button:hover { color: #fff; border-color: var(--accent); }
.code-blk pre { margin: 0; max-height: 240px; font-size: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .wb { grid-template-columns: 1fr; }
  .recon { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .subnav { position: static; padding: 10px 20px; }
  .pipeline { grid-template-columns: 1fr 1fr; }
  .pipe-stage::after { display: none; }
  .shape-grid.c5, .shape-grid.c4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lab, .rings { grid-template-columns: 1fr; }
  .branches { grid-template-columns: 1fr; }
  .sec-single { padding: 52px 20px; }
  .topnav { flex-wrap: wrap; gap: 8px; }
  .topnav .nav-pages a { margin-left: 0; margin-right: 14px; }
}
