/* =========================================================================
   ZX-123 赛博工坊 — 样式表
   色板：冷青（电流）+ 电紫（结构）+ 品红（事件，只给上架/报错）
   字体：Silkscreen（拉丁显示）+ Fusion Pixel 12px（全站中文）
   网格：所有字号取 12 的倍数，像素字保持锐利
   ========================================================================= */

/* ---------- 字体 ---------- */
@font-face {
  font-family: "Silkscreen";
  src: url("/assets/fonts/silkscreen-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Silkscreen";
  src: url("/assets/fonts/silkscreen-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FusionPixel";
  src: url("/assets/fonts/fusion-pixel-12px.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- 令牌 ---------- */
:root {
  --ink0: #06070b;
  --ink1: #0a0d15;
  --ink2: #0e131f;
  --line: #1b2233;
  --line2: #2a3450;
  --paper: #dfe6f2;
  --dim: #6d7891;
  --dim2: #49546c;
  --cyan: #3fe3ec;
  --cyan-deep: #0f3d42;
  --violet: #a57bff;
  --violet-deep: #2c2350;
  --hot: #ff4d8d;

  --rail: 96px;
  --pad: 48px;
  --maxw: 1180px;

  --f-pix: "FusionPixel", "Silkscreen", ui-monospace, "Courier New", monospace;
  --f-display: "Silkscreen", "FusionPixel", ui-monospace, monospace;

  --t-hero: 72px;
  --t-h2: 36px;
  --t-h3: 24px;
  --t-body: 24px;
  --t-meta: 12px;
  --t-micro: 10px;

  color-scheme: dark;
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink0);
  color: var(--paper);
  font: 400 var(--t-body)/1.75 var(--f-pix);
  letter-spacing: 0.01em;
  -webkit-font-smoothing: none;
  font-smooth: never;
  overflow-x: hidden;
}

body.is-booting { overflow: hidden; }

h1, h2, h3, p, figure, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, canvas, svg { display: block; max-width: 100%; }

::selection { background: var(--cyan); color: var(--ink0); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

/* 细扫描线：整页一层，极轻 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, 0.22) 2px 3px
  );
  opacity: 0.5;
  mix-blend-mode: multiply;
}

/* 暗角 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 89;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.55) 100%);
}

.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 8px 12px;
  background: var(--cyan);
  color: var(--ink0);
  font: 700 12px/1 var(--f-display);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- 通用零件 ---------- */
.meta {
  font: 400 var(--t-meta)/1.7 var(--f-pix);
  color: var(--dim);
  letter-spacing: 0.04em;
}
.latin {
  font-family: var(--f-display);
  font-size: var(--t-meta);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sep {
  display: inline-block;
  width: 1px;
  height: 8px;
  margin: 0 10px;
  vertical-align: middle;
  background: var(--line2);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border: 1px solid var(--line2);
  font: 400 var(--t-meta)/1.6 var(--f-pix);
  color: var(--dim);
  white-space: nowrap;
}
.tag--cyan { color: var(--cyan); border-color: var(--cyan-deep); }

.led {
  width: 6px;
  height: 6px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  flex: none;
}
.led--off { background: var(--dim2); box-shadow: none; }
.led--hot { background: var(--hot); box-shadow: 0 0 8px var(--hot); }
.led--pulse { animation: led 2.4s steps(2, end) infinite; }
@keyframes led {
  0%, 62% { opacity: 1; }
  63%, 100% { opacity: 0.35; }
}

/* 面板：凹槽 + 细双线，代替圆角卡片 */
.panel {
  position: relative;
  background: var(--ink1);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), inset 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
}
.panel__head h3 {
  font: 400 var(--t-meta)/1.3 var(--f-pix);
  letter-spacing: 0.12em;
  color: var(--paper);
}
.panel__head .meta { margin-left: auto; }

/* 螺丝：面板四角 */
.screws::before,
.screws::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 7px 7px, var(--line2) 0 2px, transparent 2px),
    radial-gradient(circle at calc(100% - 7px) 7px, var(--line2) 0 2px, transparent 2px),
    radial-gradient(circle at 7px calc(100% - 7px), var(--line2) 0 2px, transparent 2px),
    radial-gradient(circle at calc(100% - 7px) calc(100% - 7px), var(--line2) 0 2px, transparent 2px);
}
.screws::after { display: none; }

/* 按钮：工位按键 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--line2);
  background: var(--ink2);
  color: var(--paper);
  font: 400 var(--t-meta)/1 var(--f-pix);
  letter-spacing: 0.08em;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.6);
  transition: background 0.16s steps(2), color 0.16s steps(2), border-color 0.16s steps(2), transform 0.1s;
}
.btn:hover { border-color: var(--cyan); color: var(--cyan); }
.btn:active { transform: translate(2px, 2px); box-shadow: none; }
.btn--primary {
  background: var(--cyan);
  border-color: var(--cyan);
  color: var(--ink0);
  font-weight: 700;
}
.btn--primary:hover { background: #7bf0f6; border-color: #7bf0f6; color: var(--ink0); }
.btn__key {
  padding: 1px 5px;
  border: 1px solid currentColor;
  font: 400 var(--t-micro)/1.4 var(--f-display);
  opacity: 0.7;
}

/* =========================================================================
   外壳：左轨配电柜 + 台面
   ========================================================================= */
.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--ink1), var(--ink0));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
  gap: 18px;
  z-index: 20;
}

.rail__id {
  writing-mode: vertical-rl;
  font: 700 var(--t-meta)/1 var(--f-display);
  letter-spacing: 0.22em;
  color: var(--paper);
}
.rail__sub {
  writing-mode: vertical-rl;
  font: 400 var(--t-micro)/1 var(--f-pix);
  letter-spacing: 0.3em;
  color: var(--dim2);
}
.rail__bus {
  position: relative;
  flex: 1;
  width: 2px;
  background: linear-gradient(
    to bottom,
    var(--cyan) 0 var(--progress, 0%),
    var(--line2) var(--progress, 0%) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}
.rail__bus::after {
  content: "";
  position: absolute;
  left: -3px;
  top: calc(var(--progress, 0%) - 4px);
  width: 8px;
  height: 8px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}
.rail__bus::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 11px,
    var(--ink0) 11px 12px
  );
}
.rail__rivets {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.rail__rivet {
  position: relative;
  width: 10px;
  height: 10px;
  border: 1px solid var(--line2);
  background: var(--ink1);
  transition: border-color 0.2s, background 0.2s;
}
.rail__rivet:hover,
.rail__rivet[aria-current="true"] {
  border-color: var(--cyan);
  background: var(--cyan-deep);
}
.rail__rivet span {
  position: absolute;
  left: 18px;
  top: -2px;
  font: 400 var(--t-micro)/1.4 var(--f-pix);
  letter-spacing: 0.2em;
  color: var(--dim);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.2s, transform 0.2s;
}
.rail__rivet:hover span,
.rail__rivet:focus-visible span { opacity: 1; transform: none; }
.rail__foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font: 400 var(--t-micro)/1.5 var(--f-display);
  color: var(--dim2);
  letter-spacing: 0.08em;
}

.main {
  min-width: 0;
  padding: 0 var(--pad);
  position: relative;
}
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* =========================================================================
   首屏：铭牌
   ========================================================================= */
.plate {
  min-height: calc(100vh - 0px);
  display: flex;
  flex-direction: column;
  padding-top: 20px;
  position: relative;
}
.plate::before {
  content: "";
  position: absolute;
  inset: 0 calc(var(--pad) * -1);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  mask-image: radial-gradient(90% 70% at 30% 20%, #000 0%, transparent 78%);
  pointer-events: none;
}

.plate__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font: 400 var(--t-meta)/1 var(--f-pix);
  color: var(--dim);
  flex-wrap: wrap;
}
.plate__bar .latin { color: var(--paper); }
.plate__bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.plate__sync { font-family: var(--f-display); font-size: var(--t-meta); letter-spacing: 0.08em; color: var(--dim); }
.ghost-btn {
  border: 1px solid var(--line2);
  padding: 5px 8px;
  font: 400 var(--t-meta)/1 var(--f-pix);
  color: var(--dim);
  letter-spacing: 0.06em;
  transition: color 0.16s, border-color 0.16s;
}
.ghost-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.ghost-btn[aria-pressed="true"] { color: var(--cyan); border-color: var(--cyan-deep); }

.plate__body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 56px;
  align-items: center;
  flex: 1;
  padding: 56px 0 40px;
}

.plate__title {
  font: 400 var(--t-hero)/1.16 var(--f-pix);
  letter-spacing: 0.03em;
  color: var(--paper);
  position: relative;
  display: inline-block;
  text-shadow: 4px 4px 0 rgba(165, 123, 255, 0.24);
}
/* 钢印缺口：一道横切槽，工坊字模的味道 */
.plate__title::after {
  content: "";
  position: absolute;
  left: -6%;
  right: -6%;
  top: 56%;
  height: 2px;
  background: var(--ink0);
  box-shadow: 0 1px 0 rgba(63, 227, 236, 0.28);
  pointer-events: none;
}
.plate__kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
  font: 400 var(--t-meta)/1 var(--f-display);
  letter-spacing: 0.24em;
  color: var(--cyan);
}
.plate__kicker i { display: block; width: 34px; height: 1px; background: var(--cyan); }
.plate__lead {
  margin-top: 26px;
  max-width: 18.5em;
  color: var(--paper);
  font-size: var(--t-body);
  line-height: 1.9;
  opacity: 0.92;
}
.plate__lead b { font-weight: 400; color: var(--cyan); }
.plate__actions {
  display: flex;
  gap: 12px;
  margin-top: 34px;
  flex-wrap: wrap;
}

/* 仪表读数：不是统计卡片，是刻度条 */
.readout {
  margin-top: 40px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.readout__cell {
  padding: 12px 14px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.readout__cell + .readout__cell {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}
.readout__k {
  font: 400 var(--t-micro)/1.4 var(--f-pix);
  letter-spacing: 0.2em;
  color: var(--dim2);
}
.readout__v {
  font: 400 var(--t-h3)/1 var(--f-pix);
  color: var(--paper);
}
.readout__v small { font-size: var(--t-meta); color: var(--dim); margin-left: 4px; }

/* 示波器 */
.scope { position: relative; }
.scope__canvas { width: 100%; height: 210px; display: block; }
.scope__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.scope__chan {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 400 var(--t-micro)/1.4 var(--f-pix);
  color: var(--dim);
  letter-spacing: 0.04em;
}
.scope__chan i {
  width: 10px;
  height: 2px;
  background: var(--c, var(--cyan));
  box-shadow: 0 0 6px var(--c, var(--cyan));
}
.plate__scroll {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 0 26px;
  font: 400 var(--t-micro)/1 var(--f-pix);
  letter-spacing: 0.24em;
  color: var(--dim2);
}
.plate__scroll span {
  width: 1px;
  height: 26px;
  background: linear-gradient(to bottom, var(--cyan), transparent);
  animation: drop 1.8s steps(6, end) infinite;
}
@keyframes drop {
  0% { transform: scaleY(0.2); opacity: 0.2; }
  60%, 100% { transform: scaleY(1); opacity: 1; }
}

/* =========================================================================
   区块
   ========================================================================= */
.section { padding: 96px 0 24px; scroll-margin-top: 24px; }
.section + .section { border-top: 1px solid var(--line); }

.shead {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line2);
  margin-bottom: 28px;
}
.shead__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.shead h2 {
  font: 400 var(--t-h2)/1.1 var(--f-pix);
  letter-spacing: 0.02em;
}
.shead__note {
  margin-top: 12px;
  color: var(--dim);
  font-size: var(--t-meta);
  max-width: 58ch;
  line-height: 1.9;
}

/* 筛选 */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.chip {
  padding: 5px 10px;
  border: 1px solid var(--line);
  color: var(--dim);
  font: 400 var(--t-meta)/1 var(--f-pix);
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.chip:hover { color: var(--paper); border-color: var(--line2); }
.chip[aria-pressed="true"] {
  color: var(--ink0);
  background: var(--cyan);
  border-color: var(--cyan);
}
.chip__n { opacity: 0.6; margin-left: 6px; }

/* ---------- 图纸卡 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px 16px;
  background: var(--ink1);
  border: 1px solid var(--line);
  text-align: left;
  overflow: hidden;
  transition: border-color 0.18s, background 0.18s;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
  mask-image: radial-gradient(80% 80% at 100% 0%, #000, transparent 70%);
  pointer-events: none;
}
.card::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line2);
  transition: background 0.18s, box-shadow 0.18s;
}
.card:hover { border-color: var(--line2); background: var(--ink2); }
.card:hover::after { background: var(--cyan); box-shadow: 0 0 14px var(--cyan); }

.card__top {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 var(--t-micro)/1 var(--f-display);
  letter-spacing: 0.14em;
  color: var(--dim2);
}
.card__repo { color: var(--dim); letter-spacing: 0; font-family: var(--f-display); font-size: var(--t-micro); }
.card__top .card__repo { margin-left: auto; text-transform: none; }
.card__title {
  font: 400 var(--t-h3)/1.3 var(--f-pix);
  color: var(--paper);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.card__kind { font-size: var(--t-meta); color: var(--cyan); font-style: normal; }
.card__sub {
  font-size: var(--t-meta);
  line-height: 1.8;
  color: var(--dim);
}
.card__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font: 400 var(--t-meta)/1 var(--f-pix);
  color: var(--dim2);
  flex-wrap: wrap;
}
.card__foot b { font-weight: 400; color: var(--dim); }
.card__upd {
  color: var(--cyan);
  padding: 1px 5px;
  border: 1px solid var(--cyan-deep);
  font-size: var(--t-micro);
}
.card__open {
  margin-left: auto;
  color: var(--dim2);
  letter-spacing: 0.16em;
  font-family: var(--f-display);
  font-size: var(--t-micro);
  transition: color 0.18s;
}
.card:hover .card__open { color: var(--cyan); }

/* 迷你走线：五个层节点 */
.mini {
  display: flex;
  align-items: center;
  gap: 0;
  height: 26px;
  margin: 4px 0 2px;
}
.mini__node {
  position: relative;
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line2);
  font: 400 11px/1 var(--f-pix);
  color: var(--dim);
  background: var(--ink0);
  transition: border-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.mini__node--hot { color: var(--hot); border-color: rgba(255, 77, 141, 0.4); }
.mini__wire {
  flex: 1;
  height: 1px;
  background: var(--line2);
  position: relative;
}
.mini__wire::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cyan);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s steps(8, end);
}
.card:hover .mini__wire::after { transform: scaleX(1); }
.card:hover .mini__node { border-color: var(--cyan); color: var(--cyan); }
.card:hover .mini__node--hot { border-color: var(--hot); color: var(--hot); }
.mini__node[data-tip]:hover::before {
  content: attr(data-tip);
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 6px;
  background: var(--ink0);
  border: 1px solid var(--line2);
  color: var(--paper);
  font-size: var(--t-micro);
  white-space: nowrap;
  z-index: 2;
}

/* NEW 印章 */
.stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 2px 7px;
  border: 2px solid var(--hot);
  color: var(--hot);
  font: 700 var(--t-micro)/1.5 var(--f-display);
  letter-spacing: 0.18em;
  transform: rotate(-7deg);
  background: rgba(255, 77, 141, 0.07);
  animation: stampIn 0.4s steps(3, end) both;
  z-index: 1;
}
@keyframes stampIn {
  from { transform: rotate(-7deg) scale(1.6); opacity: 0; }
  to { transform: rotate(-7deg) scale(1); opacity: 1; }
}

/* 空态 */
.empty {
  padding: 48px 0 56px;
  text-align: center;
  color: var(--dim);
  font-size: var(--t-meta);
  line-height: 2;
  border: 1px dashed var(--line2);
}
.empty b { color: var(--paper); font-weight: 400; }

/* ---------- 工具架 ---------- */
.rack {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.6fr);
  gap: 18px;
  align-items: start;
}
.pegboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tool {
  background: var(--ink1);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.16s;
}
.tool:hover { background: var(--ink2); }
.tool__pin {
  width: 5px;
  height: 5px;
  background: var(--line2);
  box-shadow: 0 0 0 3px rgba(42, 52, 80, 0.35);
  flex: none;
}
.tool:hover .tool__pin { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.tool__name { font-size: var(--t-meta); color: var(--paper); }
.tool__bar {
  flex: 1;
  height: 3px;
  background: #151b28;
  position: relative;
  min-width: 30px;
  box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.6);
}
.tool__bar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 10%);
  background: var(--violet);
  opacity: 0.75;
}
.tool__n { font: 400 var(--t-micro)/1 var(--f-display); color: var(--dim2); }

.note-card { padding: 20px; }
.note-card h3 { font: 400 var(--t-h3)/1.4 var(--f-pix); margin-bottom: 14px; }
.note-card p { font-size: var(--t-meta); line-height: 2; color: var(--dim); }
.note-card p + p { margin-top: 12px; }
.note-card strong { font-weight: 400; color: var(--paper); }
.contact-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.contact-list a {
  background: var(--ink1);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-meta);
  color: var(--dim);
  transition: color 0.16s, background 0.16s;
}
.contact-list a:hover { color: var(--cyan); background: var(--ink2); }
.contact-list a span:last-child { margin-left: auto; font-family: var(--f-display); font-size: var(--t-micro); letter-spacing: 0.1em; color: var(--dim2); }

/* 页脚 */
.foot {
  margin-top: 96px;
  padding: 22px 0 40px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font: 400 var(--t-micro)/1.6 var(--f-pix);
  color: var(--dim2);
  letter-spacing: 0.06em;
}
.foot__end { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.foot a:hover { color: var(--cyan); }

/* =========================================================================
   工程图抽屉
   ========================================================================= */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #05060a;
  background-image: radial-gradient(120% 80% at 50% 0%, rgba(63, 227, 236, 0.045), transparent 60%);
}
.drawer[data-open="true"] { display: grid; animation: fadeIn 0.18s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.drawer__dwg { font: 700 var(--t-meta)/1 var(--f-display); letter-spacing: 0.16em; color: var(--cyan); }
.drawer__title { font: 400 var(--t-h3)/1.2 var(--f-pix); }
.drawer__acts { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line2);
  color: var(--dim);
  font: 400 14px/1 var(--f-display);
  transition: color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); }

.drawer__stage {
  overflow: auto;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: safe center;
  row-gap: 24px;
}
.drawer__wrap {
  width: 100%;
  max-width: 1114px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
@media (max-width: 900px) {
  .drawer__stage { place-items: start center; padding: 16px 12px; }
}
.drawer__svg { width: 100%; max-width: 1180px; height: auto; }
.drawer__svg .flow-node:hover { cursor: pointer; }
.drawer__svg .flow-node rect { transition: stroke 0.15s, fill 0.15s; }
.drawer__svg .flow-node:hover rect { stroke: var(--cyan); fill: #121a28; }
.drawer__svg .flow-node.is-active rect { stroke: var(--cyan); fill: #12202e; }

.drawer__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  font: 400 var(--t-micro)/1.6 var(--f-pix);
  color: var(--dim2);
  min-height: 48px;
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 8px; height: 8px; border: 1px solid currentColor; }
.legend .l-why { color: var(--violet); }
.legend .l-constraint { color: var(--hot); }
.legend .l-arch { color: var(--cyan); }
.legend .l-impl { color: #7fa6d8; }
.legend .l-result { color: #4ce0a5; }

/* 选中节点时，页脚变成工序说明条 */
.drawer__note {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  width: 100%;
}
.drawer__note[hidden] { display: none; }
.drawer__note .n-layer {
  font: 400 var(--t-micro)/1.4 var(--f-display);
  letter-spacing: 0.16em;
  color: var(--cyan);
}
.drawer__note b { font-weight: 400; font-size: var(--t-meta); color: var(--paper); }
.drawer__note .n-text { font-size: var(--t-meta); line-height: 1.8; color: var(--dim); }

/* 图纸标题栏 */
.sheet {
  width: 100%;
  max-width: 1114px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.sheet__main { background: var(--ink1); padding: 16px 18px; }
.sheet__k {
  font: 400 var(--t-micro)/1.6 var(--f-display);
  letter-spacing: 0.18em;
  color: var(--dim2);
  margin-bottom: 8px;
}
.sheet__desc { font-size: var(--t-meta); line-height: 1.9; color: var(--dim); max-width: 62ch; }
.sheet__spec {
  background: var(--ink1);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
}
.sheet__spec dt {
  font: 400 var(--t-micro)/1.4 var(--f-pix);
  letter-spacing: 0.14em;
  color: var(--dim2);
}
.sheet__spec dd { margin: 3px 0 0; font-size: var(--t-meta); color: var(--paper); }
.sheet__langs { grid-column: 1 / -1; }
.sheet__langs dd { display: flex; flex-wrap: wrap; gap: 12px; }
.sheet__lang { display: inline-flex; gap: 6px; font-size: var(--t-micro); color: var(--dim); }
.sheet__lang b { font-weight: 400; color: var(--paper); }

@media (max-width: 900px) {
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet__spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =========================================================================
   命令面板
   ========================================================================= */
.palette {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  justify-content: center;
  padding-top: 12vh;
  background: rgba(3, 4, 7, 0.72);
}
.palette[data-open="true"] { display: flex; animation: fadeIn 0.12s ease-out; }
.palette__box {
  width: min(640px, calc(100vw - 32px));
  max-height: 62vh;
  display: flex;
  flex-direction: column;
  background: var(--ink1);
  border: 1px solid var(--line2);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7);
}
.palette__input {
  width: 100%;
  padding: 14px 16px;
  background: var(--ink0);
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--paper);
  font: 400 var(--t-meta)/1.6 var(--f-pix);
  letter-spacing: 0.04em;
  outline: none;
}
.palette__input::placeholder { color: var(--dim2); }
.palette__list { overflow: auto; padding: 6px; }
.palette__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  font-size: var(--t-meta);
  color: var(--dim);
  border: 1px solid transparent;
}
.palette__item b { font-weight: 400; color: var(--paper); }
.palette__item small { margin-left: auto; font-family: var(--f-display); font-size: var(--t-micro); letter-spacing: 0.1em; color: var(--dim2); }
.palette__item.is-sel { background: var(--ink2); border-color: var(--line2); color: var(--paper); }
.palette__item.is-sel small { color: var(--cyan); }
.palette__empty { padding: 18px; color: var(--dim2); font-size: var(--t-meta); }
.palette__hint {
  display: flex;
  gap: 16px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font: 400 var(--t-micro)/1.6 var(--f-pix);
  color: var(--dim2);
}

/* =========================================================================
   上架提示
   ========================================================================= */
.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 85;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ink1);
  border: 1px solid var(--line2);
  border-left: 2px solid var(--hot);
  font: 400 var(--t-meta)/1.5 var(--f-pix);
  color: var(--paper);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  animation: toastIn 0.3s steps(4, end);
  max-width: 320px;
}
.toast small { display: block; color: var(--dim); font-size: var(--t-micro); }
@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* =========================================================================
   进场动画：工坊开机（4 秒）
   ========================================================================= */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink0);
  overflow: hidden;
  display: grid;
  place-items: center;
  will-change: transform, opacity;
}
.intro[hidden] { display: none; }
.intro.is-out { transform: translateY(-100%); transition: transform 0.42s cubic-bezier(0.7, 0, 0.3, 1); }
.intro.is-off { display: none; }

.intro__scan {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(63, 227, 236, 0.05) 0 1px,
    transparent 1px 3px
  );
  opacity: 0;
  transition: opacity 0.5s steps(3, end);
}
.intro[data-phase="1"] .intro__scan,
.intro[data-phase="2"] .intro__scan,
.intro[data-phase="3"] .intro__scan { opacity: 1; }

.intro__crt {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%) scaleX(0.02) scaleY(0.004);
  width: 92vw;
  height: 62vh;
  background: linear-gradient(180deg, rgba(63, 227, 236, 0.1), rgba(165, 123, 255, 0.08));
  box-shadow: 0 0 60px rgba(63, 227, 236, 0.35), inset 0 0 0 1px rgba(63, 227, 236, 0.5);
  opacity: 0;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}
.intro[data-phase="1"] .intro__crt { transform: translate(-50%, -50%) scaleX(1) scaleY(0.004); opacity: 1; }
.intro[data-phase="2"] .intro__crt,
.intro[data-phase="3"] .intro__crt { transform: translate(-50%, -50%) scaleX(1) scaleY(1); opacity: 0.5; }
.intro[data-phase="4"] .intro__crt,
.intro[data-phase="5"] .intro__crt { opacity: 0.16; }

.intro__plate {
  position: relative;
  z-index: 4;
  padding: 26px 40px;
  border: 2px solid var(--cyan);
  background: rgba(6, 7, 11, 0.92);
  text-align: center;
  opacity: 0;
  transform: scale(1.5);
  box-shadow: 0 0 0 1px rgba(63, 227, 236, 0.25), 8px 8px 0 rgba(165, 123, 255, 0.25);
}
.intro[data-phase="2"] .intro__plate,
.intro[data-phase="3"] .intro__plate,
.intro[data-phase="4"] .intro__plate,
.intro[data-phase="5"] .intro__plate {
  opacity: 1;
  transform: scale(1);
  transition: transform 0.22s cubic-bezier(0.2, 1.6, 0.3, 1), opacity 0.12s;
}
.intro__id {
  display: block;
  font: 700 54px/1 var(--f-display);
  letter-spacing: 0.08em;
  color: var(--paper);
}
.intro__cn {
  display: block;
  margin-top: 14px;
  font: 400 36px/1 var(--f-pix);
  letter-spacing: 0.42em;
  color: var(--cyan);
  text-indent: 0.42em;
}
.intro__rivet {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--cyan);
  opacity: 0;
  transition: opacity 0.28s steps(2, end);
}
.intro[data-phase="3"] .intro__rivet,
.intro[data-phase="4"] .intro__rivet,
.intro[data-phase="5"] .intro__rivet { opacity: 1; }
.intro__rivet:nth-child(1) { top: 6px; left: 6px; }
.intro__rivet:nth-child(2) { top: 6px; right: 6px; }
.intro__rivet:nth-child(3) { bottom: 6px; left: 6px; }
.intro__rivet:nth-child(4) { bottom: 6px; right: 6px; }

/* 卷帘：六道横帘 */
.intro__shutter {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  pointer-events: none;
}
.intro__shutter i {
  background: linear-gradient(180deg, #0b0f18, #07090f);
  border-bottom: 1px solid #131a26;
  transform: translateY(0);
  transition: transform 0.52s cubic-bezier(0.6, 0, 0.2, 1);
}
.intro[data-phase="3"] .intro__shutter i,
.intro[data-phase="4"] .intro__shutter i,
.intro[data-phase="5"] .intro__shutter i { transform: translateY(-105vh); }
.intro__shutter i:nth-child(1) { transition-delay: 0.02s; }
.intro__shutter i:nth-child(2) { transition-delay: 0.07s; }
.intro__shutter i:nth-child(3) { transition-delay: 0.12s; }
.intro__shutter i:nth-child(4) { transition-delay: 0.17s; }
.intro__shutter i:nth-child(5) { transition-delay: 0.22s; }
.intro__shutter i:nth-child(6) { transition-delay: 0.27s; }

/* 自检日志 */
.intro__boot {
  position: absolute;
  left: max(24px, 6vw);
  bottom: max(56px, 8vh);
  z-index: 5;
  font: 400 var(--t-meta)/2 var(--f-pix);
  color: var(--dim);
  opacity: 0;
  transition: opacity 0.3s;
  min-height: 96px;
}
.intro[data-phase="4"] .intro__boot,
.intro[data-phase="5"] .intro__boot { opacity: 1; }
.intro__boot p { white-space: pre; }
.intro__boot b { color: var(--cyan); font-weight: 400; }
.intro__bar {
  display: flex;
  gap: 3px;
  margin-top: 10px;
}
.intro__bar i {
  width: 12px;
  height: 6px;
  background: var(--line);
}
.intro__bar i.on { background: var(--cyan); box-shadow: 0 0 8px rgba(63, 227, 236, 0.6); }
.intro__hint {
  position: absolute;
  right: max(24px, 6vw);
  top: max(22px, 3.4vh);
  z-index: 5;
  padding: 6px 10px;
  border: 1px solid var(--line2);
  background: rgba(6, 7, 11, 0.8);
  font: 400 var(--t-micro)/1.4 var(--f-pix);
  letter-spacing: 0.14em;
  color: var(--dim);
  opacity: 0;
  animation: hintIn 0.6s 1.2s both, hintBlink 2.4s 1.8s steps(2, end) infinite;
}
@keyframes hintIn { to { opacity: 1; } }
@keyframes hintBlink { 0%, 58% { opacity: 1; } 59%, 100% { opacity: 0.42; } }
.intro__line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  transform: scaleX(0);
  z-index: 3;
}
.intro[data-phase="1"] .intro__line { transform: scaleX(1); transition: transform 0.4s ease-out; }
.intro[data-phase="2"] .intro__line { opacity: 0.3; }
.intro[data-phase="3"] .intro__line,
.intro[data-phase="4"] .intro__line,
.intro[data-phase="5"] .intro__line { opacity: 0; }

.intro__count {
  font: 700 120px/1 var(--f-display);
  color: rgba(63, 227, 236, 0.12);
  position: absolute;
  right: 4vw;
  bottom: 4vh;
  z-index: 2;
  letter-spacing: 0.04em;
}

/* 铭牌落位时溅出的焊花 */
.intro__sparks {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  width: 0;
  height: 0;
  pointer-events: none;
}
.intro__sparks i {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  opacity: 0;
}
.intro[data-phase="2"] .intro__sparks i,
.intro[data-phase="3"] .intro__sparks i,
.intro[data-phase="4"] .intro__sparks i {
  animation: spark 760ms steps(8, end) both;
}
@keyframes spark {
  0% { opacity: 1; transform: translate(0, 0); }
  60% { opacity: 0.9; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}
.intro__sparks i:nth-child(1) { --dx: -150px; --dy: -54px; animation-delay: 20ms; }
.intro__sparks i:nth-child(2) { --dx: -96px; --dy: -84px; animation-delay: 60ms; }
.intro__sparks i:nth-child(3) { --dx: -172px; --dy: 22px; animation-delay: 0ms; }
.intro__sparks i:nth-child(4) { --dx: -58px; --dy: 68px; animation-delay: 90ms; }
.intro__sparks i:nth-child(5) { --dx: 132px; --dy: -62px; animation-delay: 40ms; }
.intro__sparks i:nth-child(6) { --dx: 168px; --dy: 30px; animation-delay: 10ms; }
.intro__sparks i:nth-child(7) { --dx: 74px; --dy: 78px; animation-delay: 70ms; }
.intro__sparks i:nth-child(8) { --dx: 24px; --dy: -96px; animation-delay: 110ms; }

/* 铭牌下方的一行状态字 */
.intro__online {
  display: block;
  margin-top: 14px;
  font: 400 var(--t-micro)/1 var(--f-display);
  letter-spacing: 0.3em;
  color: var(--cyan);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.24s, transform 0.24s;
}
.intro[data-phase="4"] .intro__online,
.intro[data-phase="5"] .intro__online { opacity: 0.85; transform: none; }

/* =========================================================================
   响应式
   ========================================================================= */
@media (max-width: 1080px) {
  :root { --pad: 28px; --t-hero: 48px; --t-body: 18px; }
  .plate__body { grid-template-columns: minmax(0, 1fr); gap: 32px; padding: 36px 0 24px; }
  .scope { order: 2; }
  .rack { grid-template-columns: minmax(0, 1fr); }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout__cell:nth-child(3) { border-left: 0; padding-left: 0; }
  .readout__cell:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky;
    top: 0;
    height: auto;
    flex-direction: row;
    padding: 10px 16px;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .rail__id, .rail__sub { writing-mode: horizontal-tb; }
  .rail__sub { display: none; }
  .rail__bus { display: none; }
  .rail__rivets { flex-direction: row; margin-left: auto; gap: 14px; }
  .rail__rivet span { display: none; }
  .rail__foot { flex-direction: row; gap: 8px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .pegboard { grid-template-columns: minmax(0, 1fr); }
  .shead__note { margin-top: 8px; }
  .drawer__head { padding: 12px 16px; }
  .drawer__stage { padding: 12px; }
  .detail { bottom: 12px; }
  .plate { min-height: auto; }
}

@media (max-width: 520px) {
  :root { --pad: 16px; --t-hero: 36px; --t-h2: 24px; --t-h3: 18px; --t-body: 18px; }
  .intro__id { font-size: 32px; }
  .intro__cn { font-size: 24px; }
  .intro__count { font-size: 64px; }
  .intro__boot { font-size: 10px; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope__canvas { height: 150px; }
  .plate__lead { max-width: none; }
}

/* ---------- 减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .intro { transition: opacity 0.2s; }
  .intro.is-out { transform: none; opacity: 0; }
  .rail__bus::after, .plate__scroll span { animation: none; }
  .card:hover .mini__wire::after { transform: scaleX(1); }
}

/* =========================================================================
   工程图（flow.js 渲染）
   ========================================================================= */
.flow {
  position: relative;
  margin: 0 auto;
}
.flow__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.flow__nodes {
  position: relative;
}
.flow-edge {
  fill: none;
  stroke: rgba(63, 227, 236, 0.3);
  stroke-width: 1;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.42s steps(8, end);
}
.flow.is-on .flow-edge { stroke-dashoffset: 0; }
.flow-edge--skip { stroke: rgba(165, 123, 255, 0.34); }
.flow-pad { fill: rgba(63, 227, 236, 0.55); }

.flow-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px 8px 15px;
  background: var(--ink1);
  border: 1px solid var(--line2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.26s, transform 0.26s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.flow.is-on .flow-node { opacity: 1; transform: none; }
.flow-node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--c, var(--cyan));
}
.flow-node:hover { border-color: var(--c, var(--cyan)); background: var(--ink2); }
.flow-node.is-active {
  border-color: var(--cyan);
  background: #101924;
  box-shadow: 0 0 0 1px rgba(63, 227, 236, 0.22), 0 0 28px rgba(63, 227, 236, 0.1);
}
.fn__glyph {
  position: absolute;
  right: 8px;
  top: 6px;
  font: 400 10px/1 var(--f-pix);
  color: var(--c, var(--cyan));
  opacity: 0.85;
}
.fn__title {
  font: 400 12px/1.45 var(--f-pix);
  color: var(--paper);
  padding-right: 18px;
}
.fn__detail {
  font: 400 12px/1.55 var(--f-pix);
  color: var(--dim);
  overflow: hidden;
}
.flow-lane {
  position: absolute;
  left: 10px;
  font: 400 10px/1 var(--f-pix);
  letter-spacing: 0.18em;
  color: var(--dim2);
}
.flow__empty {
  border: 1px dashed var(--line2);
  padding: 40px 28px;
  text-align: center;
  font-size: var(--t-meta);
  line-height: 2;
  color: var(--dim);
}
.flow__empty b {
  display: block;
  margin-bottom: 8px;
  font: 400 var(--t-h3)/1.4 var(--f-pix);
  color: var(--paper);
}

.drawer__stage { position: relative; }

/* 迷你走线里的空态 */
.mini--empty {
  height: 26px;
  align-items: center;
  font: 400 var(--t-micro)/1 var(--f-pix);
  letter-spacing: 0.14em;
  color: var(--dim2);
  border: 1px dashed var(--line);
  padding: 0 10px;
  width: fit-content;
}

/* =========================================================================
   进场：工坊内部
   ========================================================================= */
.intro__room {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(63, 227, 236, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 227, 236, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0;
  transition: opacity 0.7s ease-out;
  mask-image: radial-gradient(70% 60% at 50% 48%, #000 10%, transparent 82%);
}
.intro[data-phase="3"] .intro__room,
.intro[data-phase="4"] .intro__room,
.intro[data-phase="5"] .intro__room { opacity: 1; }

.intro__room::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  background: linear-gradient(to top, rgba(63, 227, 236, 0.08), transparent);
}
