/*
 * Profile 解析顺序实验页的页内专用样式。共用部分在 study-lab-shell.css。
 */

.order-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 6px;
  padding: 0 6px 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.order-move {
  min-width: 26px;
  min-height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--brand);
  background: transparent;
  cursor: pointer;
  font-weight: 750;
}

.order-move:disabled { opacity: 0.35; cursor: not-allowed; }
.order-move:hover:not(:disabled) { border-color: var(--brand); }

.bundle-check {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.bundle-check:has(input:checked) { border-color: var(--deny); color: var(--deny-ink); }

.matrix-scroll {
  overflow-x: auto;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-strong) 62%, transparent);
}

.write-matrix {
  border-collapse: separate;
  /* 2px 表面间隙，相邻填充不相接。 */
  border-spacing: 2px;
  font-size: 0.84rem;
}

.write-matrix caption { padding: 0 0 12px; }

.write-matrix th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: none;
  white-space: nowrap;
}

.write-matrix tbody th {
  padding-right: 14px;
  color: var(--ink);
  font-size: 0.82rem;
}

.write-matrix td {
  width: 1%;
  padding: 8px 14px;
  border-bottom: 0;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 1rem;
  text-align: center;
}

/* 三档写入状态各有独立字形（● ○ 空白），颜色只是第二线索。 */
.write-matrix td[data-mark="final"] {
  color: var(--brand);
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, transparent);
}

.write-matrix td[data-mark="overridden"] {
  color: var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
}

.write-matrix td[data-mark="untouched"] { background: none; }

/*
 * 标记是内联 SVG，描边取 currentColor，所以配色跟着上面两条规则走，不引入第二套颜色。
 *
 * 不给单元格用 flex 或 grid：那会把 `td` 从表格布局里拿出来，整列宽度就不再对齐。
 * 居中交给表格自己的 text-align / vertical-align，图标按 inline-block 对到中线——
 * 默认的基线对齐会把替换元素压低几像素，一整列看起来就是歪的。
 */
.write-matrix td[data-mark="final"],
.write-matrix td[data-mark="overridden"] {
  text-align: center;
  vertical-align: middle;
}

.write-matrix td .icon {
  display: inline-block;
  vertical-align: middle;
}

.write-matrix td[data-mark="not-applied"] {
  color: var(--deny-ink);
  background: var(--deny-soft);
}

.write-matrix tbody tr[data-kind="overlay"] th { color: var(--signal-ink); }
.write-matrix tbody tr[data-applied="false"] th { color: var(--deny-ink); }

tbody tr[data-state="unset"] td { opacity: 0.62; }
tbody tr[data-state="failed"] td { color: var(--deny-ink); }

@media (forced-colors: active) {
  .matrix-scroll, .order-chip, .bundle-check { border: 1px solid CanvasText; }
  .write-matrix td[data-mark="final"] { box-shadow: inset 0 0 0 1px CanvasText; }
}

/* 装配舞台：左列步骤卡、右列配置键；高亮时只留被选中步骤的线。 */
.stage-scroll { overflow-x: auto; }
#profile-stage { max-width: 100%; height: auto; display: block; }
.pl-card-box {
  fill: var(--surface-raised);
  stroke: var(--line-strong);
  stroke-width: 1.2;
}
.pl-card { cursor: pointer; outline: none; }
.pl-card:focus-visible .pl-card-box { stroke: var(--brand); stroke-width: 2; }
.pl-card.is-failed .pl-card-box { stroke: var(--signal); stroke-width: 1.6; }
.pl-card-title { font-size: 13px; font-weight: 600; fill: var(--ink); }
.pl-card-sub { font-size: 10.5px; fill: var(--ink-soft); }
.pl-line { fill: none; stroke-width: 2; transition: opacity .15s ease; }
.pl-ghost {
  fill: none; stroke: var(--line-strong); stroke-width: 1.4;
  stroke-dasharray: 4 4; opacity: .55; transition: opacity .15s ease;
}
#profile-stage.is-highlighting .pl-line,
#profile-stage.is-highlighting .pl-ghost { opacity: .1; }
#profile-stage.is-highlighting .pl-line.is-hot { opacity: 1; stroke-width: 3; }
#profile-stage.is-highlighting .pl-ghost.is-hot { opacity: .8; }
.pl-key-box {
  fill: var(--surface-raised);
  stroke: var(--line-strong); stroke-width: 1;
}
.pl-key-box.is-unset { stroke-dasharray: 3 3; opacity: .75; }
.pl-key-name { font-size: 12px; font-weight: 600; fill: var(--ink); }
.pl-key-value { font-size: 11px; fill: var(--ink-soft); }

/* 逐步回放：未应用到的步骤与连线淡出；当前步描边提示。 */
.pl-card.is-future { opacity: 0.3; }
.pl-card.is-current .pl-card-box { stroke-width: 2.5; }
.pl-line.is-future, .pl-ghost.is-future { opacity: 0.08; }
.pl-key-box.is-unset { opacity: 0.55; }
