/* PixelRule · 图纸上的度量 */

:root {
  --paper: #f3f1ec;
  --paper-lift: #faf9f5;
  --paper-sink: #e9e6df;
  --ink: #1b1a18;
  --ink-2: #56524a;
  --ink-3: #8b8579;
  --hairline: rgba(27, 26, 24, 0.11);
  --hairline-soft: rgba(27, 26, 24, 0.07);
  --accent: #0a62f6;
  --accent-deep: #0848b8;
  --accent-wash: rgba(10, 98, 246, 0.09);
  --mark: #d6402d;
  --mark-wash: rgba(214, 64, 45, 0.12);
  --ok: #1c7a52;
  --ok-wash: rgba(28, 122, 82, 0.12);
  --panel: rgba(252, 251, 247, 0.74);
  --panel-strong: rgba(252, 251, 247, 0.93);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    "Courier New", monospace;
  --r-panel: 14px;
  --r-ctl: 10px;
  --work-left: 88px;
  --work-right: 332px;
  --shadow: 0 1px 1.5px rgba(27, 26, 24, 0.05), 0 14px 30px -14px rgba(27, 26, 24, 0.3);
  --shadow-lift: 0 1px 2px rgba(27, 26, 24, 0.06), 0 22px 44px -18px rgba(27, 26, 24, 0.34);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* 图纸：两层网格 + 极轻的纸面受光 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, rgba(27, 26, 24, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(27, 26, 24, 0.045) 1px, transparent 1px),
    linear-gradient(to right, rgba(27, 26, 24, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(27, 26, 24, 0.07) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
  background-position: -1px -1px;
  opacity: 1;
  transition: opacity 0.5s var(--ease);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% -10%, rgba(255, 255, 255, 0.62), transparent 62%);
}

body[data-has-image="true"]::before {
  opacity: 0.32;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  box-shadow: 0 1px 0 rgba(27, 26, 24, 0.05);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 骨架 ---------- */

.app {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}

body[data-tool="pan"] .scene {
  cursor: grab;
}
body[data-tool="pan"].is-grabbing .scene {
  cursor: grabbing;
}
body[data-tool="select"] .scene {
  cursor: default;
}
body.is-space .scene {
  cursor: grab;
}
body.is-space.is-grabbing .scene {
  cursor: grabbing;
}
body[data-mode="calibrate"] .scene {
  cursor: crosshair;
}

.panel {
  background: var(--panel);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow);
}

@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .panel {
    background: var(--panel-strong);
  }
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 10px 0 14px;
  z-index: 30;
  animation: rise 0.5s var(--ease) both;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
  user-select: none;
}

.brand-icon {
  width: 22px;
  height: 22px;
  color: var(--mark);
  stroke-width: 1.7;
}

.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.brand-name em {
  font-family: var(--mono);
  font-size: 9px;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  text-transform: uppercase;
}

.steps {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.step:hover {
  background: rgba(27, 26, 24, 0.05);
  color: var(--ink-2);
}

.step-n {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(27, 26, 24, 0.08);
  color: var(--ink-2);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.step.is-active {
  background: var(--ink);
  color: #fbfaf7;
}

.step.is-active .step-n {
  background: rgba(255, 255, 255, 0.18);
  color: #fbfaf7;
}

.step.is-done .step-n {
  background: var(--ok);
  color: #fff;
}

.step-track {
  width: 16px;
  height: 1px;
  background: var(--hairline);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.topbar-actions > .icon-btn,
.topbar-actions > .menu-wrap {
  flex: none;
}

.seg {
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 9px;
  background: rgba(27, 26, 24, 0.055);
  gap: 1px;
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg button {
  flex: none;
  height: 24px;
  min-width: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.seg button:hover {
  color: var(--ink);
}

.seg button.is-on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(27, 26, 24, 0.12), 0 0 0 0.5px rgba(27, 26, 24, 0.06);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.icon-btn:hover {
  background: rgba(27, 26, 24, 0.06);
  color: var(--ink);
}

.icon-btn:active {
  background: rgba(27, 26, 24, 0.1);
}

.icon-btn:disabled {
  color: rgba(139, 133, 121, 0.5);
  cursor: not-allowed;
  background: transparent;
}

.txt-btn {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
}

/* ---------- 弹出菜单 ---------- */

.menu-wrap {
  position: relative;
}

.popover {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  width: 214px;
  padding: 5px;
  border-radius: 12px;
  background: var(--panel-strong);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lift);
  z-index: 40;
  transform-origin: top right;
  animation: pop 0.22s var(--ease) both;
}

.popover-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--hairline-soft);
}

.popover button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 33px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.popover button .icon {
  width: 16px;
  height: 16px;
  color: var(--ink-3);
}

.popover button:hover {
  background: var(--accent-wash);
  color: var(--accent-deep);
}

.popover button:hover .icon {
  color: var(--accent);
}

/* ---------- 工具竖排 ---------- */

.rail {
  position: absolute;
  left: 14px;
  top: 82px;
  width: 62px;
  max-height: calc(100vh - 148px);
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 25;
  scrollbar-width: none;
  animation: rise 0.55s 0.06s var(--ease) both;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail-sep {
  height: 1px;
  margin: 5px 8px;
  background: var(--hairline-soft);
}

.tool {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}

.tool-util {
  height: 38px;
  font-size: 9.5px;
}

.tool-util .icon {
  width: 16px;
  height: 16px;
}

.tool.is-on {
  background: rgba(27, 26, 24, 0.07);
  color: var(--ink);
}

.tool .icon {
  width: 19px;
  height: 19px;
  stroke-width: 1.55;
}

.tool:hover {
  background: rgba(27, 26, 24, 0.055);
  color: var(--ink);
}

.tool:active {
  transform: scale(0.96);
}

.tool.is-active {
  background: var(--ink);
  color: #fbfaf7;
  box-shadow: 0 6px 14px -8px rgba(27, 26, 24, 0.55);
}

.tool:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  background: transparent;
  color: var(--ink-2);
}

/* ---------- 右栏 ---------- */

.inspector {
  position: absolute;
  right: 14px;
  top: 82px;
  bottom: 66px;
  width: 318px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 2px;
  z-index: 25;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 26, 24, 0.18) transparent;
}

.inspector::-webkit-scrollbar {
  width: 6px;
}

.inspector::-webkit-scrollbar-thumb {
  background: rgba(27, 26, 24, 0.16);
  border-radius: 99px;
}

.inspector-head {
  display: none;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 6px 0 14px;
  border-radius: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 3;
}

.grip {
  width: 30px;
  height: 4px;
  border-radius: 99px;
  background: rgba(27, 26, 24, 0.16);
}

.inspector-title {
  font-size: 12px;
  font-weight: 620;
  color: var(--ink-2);
}

.inspector-head .icon-btn {
  margin-left: auto;
  width: 30px;
  height: 30px;
}

.card {
  padding: 13px 14px 14px;
  animation: rise 0.5s var(--ease) both;
}

.card:nth-child(1) {
  animation-delay: 0.1s;
}
.card:nth-child(2) {
  animation-delay: 0.15s;
}
.card:nth-child(3) {
  animation-delay: 0.2s;
}

.card-list {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-head h2 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.card-head .badge,
.card-head .count {
  margin-left: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(27, 26, 24, 0.07);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge.is-ok {
  background: var(--ok-wash);
  color: var(--ok);
}

.badge.is-mark {
  background: var(--mark-wash);
  color: var(--mark);
}

.badge-quiet {
  background: transparent;
  color: var(--ink-3);
  font-family: var(--mono);
  font-weight: 500;
}

.count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(27, 26, 24, 0.06);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
}

.copy {
  margin: 0 0 12px;
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--ink-2);
  text-wrap: pretty;
}

.copy b {
  color: var(--ink);
  font-weight: 600;
}

.micro {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-3);
  text-wrap: pretty;
}

/* 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 33px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease),
    transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.btn:active {
  transform: scale(0.985);
}

.btn .icon {
  width: 15px;
  height: 15px;
}

.btn-primary {
  width: 100%;
  background: var(--ink);
  color: #fbfaf7;
  box-shadow: 0 6px 16px -10px rgba(27, 26, 24, 0.8);
}

.btn-primary:hover {
  background: #000;
}

.btn-quiet {
  border-color: var(--hairline);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink-2);
}

.btn-quiet:hover {
  background: #fff;
  color: var(--ink);
}

.btn-danger:hover {
  color: var(--mark);
  border-color: rgba(214, 64, 45, 0.3);
  background: var(--mark-wash);
}

.row-actions {
  display: flex;
  gap: 7px;
  margin-top: 11px;
}

.row-actions .btn {
  flex: 1;
  height: 31px;
  font-size: 12px;
}

/* 定标读数 */

.scale-box {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--r-ctl);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--hairline-soft);
  margin-bottom: 11px;
}

.scale-key {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.scale-val {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--mark);
  font-variant-numeric: tabular-nums;
}

.field {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.field-input {
  position: relative;
  display: block;
}

.field-input input {
  width: 100%;
  height: 33px;
  padding: 0 34px 0 10px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease), background 0.18s var(--ease);
}

.field-input input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(10, 98, 246, 0.14);
}

.field-input em {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  pointer-events: none;
}

.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* 读数卡 */

.read-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.read-name {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.read-name:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--hairline-soft);
}

.read-name:focus {
  outline: none;
  background: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 98, 246, 0.14);
}

.read-type {
  flex: none;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.read-rows {
  display: grid;
  gap: 1px;
  border-radius: var(--r-ctl);
  overflow: hidden;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
}

.read-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.66);
}

.read-row.is-primary {
  background: #fff;
}

.read-row dt {
  font-size: 11.5px;
  color: var(--ink-3);
  font-weight: 550;
}

.read-row dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.read-row.is-primary dd {
  font-size: 14px;
  color: var(--mark);
}

.read-empty {
  margin: 0;
  padding: 14px 2px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-3);
  text-wrap: pretty;
}

/* 结果列表 */

.mlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.mlist-empty {
  margin: 2px 0 0;
}

.mrow {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 5px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.mrow:hover {
  background: rgba(27, 26, 24, 0.045);
}

.mrow.is-active {
  background: var(--accent-wash);
  box-shadow: inset 0 0 0 1px rgba(10, 98, 246, 0.24);
}

.mrow.is-hidden {
  opacity: 0.44;
}

.mrow-idx {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 5px;
  background: var(--mark-wash);
  color: var(--mark);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.mrow.is-active .mrow-idx {
  background: var(--accent);
  color: #fff;
}

.mrow-main {
  min-width: 0;
}

.mrow-name {
  display: block;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrow-val {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mark);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrow.is-active .mrow-val {
  color: var(--accent-deep);
}

.mrow-tools {
  display: flex;
  gap: 1px;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.mrow:hover .mrow-tools,
.mrow.is-active .mrow-tools,
.mrow:focus-within .mrow-tools {
  opacity: 1;
}

.mini-btn {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}

.mini-btn .icon {
  width: 14px;
  height: 14px;
}

.mini-btn:hover {
  background: rgba(27, 26, 24, 0.08);
  color: var(--ink);
}

.mini-btn.is-danger:hover {
  background: var(--mark-wash);
  color: var(--mark);
}

/* ---------- 缩放簇 ---------- */

.zoomer {
  position: absolute;
  right: 344px;
  bottom: 66px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  gap: 1px;
  z-index: 24;
  animation: rise 0.5s 0.12s var(--ease) both;
}

.zoomer .icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

/* ---------- 状态条 ---------- */

.statusbar {
  position: absolute;
  left: 90px;
  right: 344px;
  bottom: 14px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  z-index: 24;
  animation: rise 0.5s 0.16s var(--ease) both;
}

.sb-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-pos {
  min-width: 148px;
  color: var(--ink);
  font-weight: 600;
}

.sb-sep {
  width: 1px;
  height: 13px;
  background: var(--hairline);
  flex: none;
}

.sb-grow {
  flex: 1;
}

.sb-hint {
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ---------- 空态投放区 ---------- */

.dropzone {
  position: absolute;
  left: calc((100% - var(--work-right) + var(--work-left)) / 2);
  top: calc(50% - 6px);
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - var(--work-left) - var(--work-right) - 28px));
  padding: 40px 34px 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  z-index: 12;
  animation: riseCentered 0.6s 0.12s var(--ease) both;
}

.dropzone::before {
  content: "";
  position: absolute;
  inset: -12% -6%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(243, 241, 236, 0.97), rgba(243, 241, 236, 0.55) 58%, rgba(243, 241, 236, 0));
  z-index: -1;
}

.dropzone.is-over .dz-corners i {
  border-color: var(--accent);
}

.dropzone.is-over .dz-icon {
  color: var(--accent);
}

.dz-corners {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.dz-corners i {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 1.5px solid rgba(27, 26, 24, 0.28);
  transition: border-color 0.2s var(--ease);
}

.dz-corners i:nth-child(1) {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
  border-top-left-radius: 3px;
}
.dz-corners i:nth-child(2) {
  top: 0;
  right: 0;
  border-left: 0;
  border-bottom: 0;
  border-top-right-radius: 3px;
}
.dz-corners i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-right: 0;
  border-top: 0;
  border-bottom-left-radius: 3px;
}
.dz-corners i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-left: 0;
  border-top: 0;
  border-bottom-right-radius: 3px;
}

.dz-icon {
  width: 30px;
  height: 30px;
  color: var(--ink-3);
  stroke-width: 1.4;
  transition: color 0.2s var(--ease);
}

.dz-title {
  margin: 14px 0 0;
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.dz-sub {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.dz-sub kbd {
  vertical-align: 1px;
}

.dz-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

.dz-actions .btn {
  height: 35px;
  padding: 0 16px;
}

.dz-actions .btn-primary {
  width: auto;
}

.dz-flow {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin: 26px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--hairline-soft);
  width: 100%;
  text-align: left;
}

.dz-flow li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.dz-flow b {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: rgba(27, 26, 24, 0.08);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-2);
  flex: none;
}

.dz-foot {
  margin: 14px 0 0;
  font-size: 11px;
  color: var(--ink-3);
}

/* ---------- 移动端面板按钮 ---------- */

.panel-btn {
  display: none;
  position: absolute;
  right: 10px;
  bottom: calc(114px + env(safe-area-inset-bottom));
  height: 34px;
  padding: 0 13px 0 10px;
  gap: 6px;
  align-items: center;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  z-index: 28;
}

.panel-btn .icon {
  width: 15px;
  height: 15px;
}

/* ---------- 帮助 ---------- */

.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(27, 26, 24, 0.22);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: fade 0.2s var(--ease) both;
}

.sheet {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px));
  max-height: min(78vh, 700px);
  z-index: 51;
  display: flex;
  flex-direction: column;
  padding: 16px 18px 18px;
  background: var(--panel-strong);
  animation: sheetIn 0.3s var(--ease) both;
}

.sheet .card-head {
  margin-bottom: 4px;
}

.sheet .card-head .icon-btn {
  margin-left: auto;
}

.sheet .card-head h2 {
  font-size: 14px;
}

.sheet-body {
  overflow-y: auto;
  padding-right: 4px;
}

.sheet-body h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}

.help-steps {
  margin: 0;
  padding-left: 19px;
  font-size: 12.5px;
  line-height: 1.68;
  color: var(--ink-2);
}

.help-steps li + li {
  margin-top: 5px;
}

.help-steps b {
  color: var(--ink);
}

.help-grid,
.help-keys {
  margin: 0;
  display: grid;
  gap: 1px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--hairline-soft);
  border: 1px solid var(--hairline-soft);
}

.help-grid > div,
.help-keys > div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.7);
}

.help-grid dt,
.help-keys dt {
  flex: none;
  width: 78px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.help-keys dt {
  display: flex;
  gap: 4px;
  width: 172px;
  flex-wrap: wrap;
}

.help-grid dd,
.help-keys dd {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

/* ---------- toast ---------- */

.toast {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translate(-50%, 6px);
  z-index: 60;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(27, 26, 24, 0.93);
  color: #fbfaf7;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 10px 26px -12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.22s var(--ease), transform 0.28s var(--ease);
  max-width: min(88vw, 460px);
  text-align: center;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 动效 ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseCentered {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 9px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-3px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ---------- 响应式 ---------- */

@media (max-width: 1180px) {
  :root {
    --work-right: 300px;
  }
  .inspector {
    width: 286px;
  }
  .zoomer {
    right: 312px;
  }
  .statusbar {
    right: 312px;
  }
}

@media (max-width: 980px) {
  .brand-name {
    display: none;
  }
  .statusbar {
    left: 90px;
  }
  .sb-hint {
    display: none;
  }
}

@media (max-width: 860px) {
  :root {
    --work-left: 10px;
    --work-right: 10px;
  }

  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    height: 48px;
    padding: 0 8px 0 10px;
    gap: 10px;
  }

  .brand-icon {
    width: 20px;
    height: 20px;
  }

  .steps {
    gap: 3px;
  }

  .step {
    height: 28px;
    padding: 0 9px 0 7px;
    font-size: 12px;
  }

  .step-track {
    width: 8px;
  }

  .seg button {
    min-width: 26px;
    padding: 0 4px;
    font-size: 10.5px;
  }

  .rail {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: calc(52px + env(safe-area-inset-bottom));
    width: auto;
    max-height: none;
    flex-direction: row;
    gap: 2px;
    padding: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    justify-content: flex-start;
  }

  .tool-util {
    height: 46px;
    font-size: 10px;
  }

  .tool-util .icon {
    width: 18px;
    height: 18px;
  }

  .rail::-webkit-scrollbar {
    display: none;
  }

  .rail-sep {
    width: 1px;
    height: 28px;
    margin: 0 4px;
    flex: none;
  }

  .tool {
    width: 54px;
    height: 46px;
    flex: none;
    font-size: 10px;
  }

  .tool .icon {
    width: 18px;
    height: 18px;
  }

  .inspector {
    position: absolute;
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 8px;
    width: auto;
    max-height: 64vh;
    z-index: 45;
    padding: 0;
    transform: translateY(calc(100% + 24px));
    opacity: 0;
    pointer-events: none;
    transition: transform 0.34s var(--ease), opacity 0.24s var(--ease);
    overflow-y: auto;
  }

  .inspector.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .inspector-head {
    display: flex;
  }

  .card {
    background: var(--panel-strong);
  }

  .panel-btn {
    display: flex;
  }

  .zoomer {
    left: 8px;
    right: auto;
    bottom: calc(114px + env(safe-area-inset-bottom));
    flex-direction: row;
    z-index: 27;
  }

  .statusbar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 34px;
    padding: 0 10px;
    font-size: 10px;
    gap: 7px;
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(34px + env(safe-area-inset-bottom));
  }

  .sb-pos {
    min-width: 0;
  }

  .sb-hint {
    display: none;
  }

  .dropzone {
    width: min(420px, calc(100% - 24px));
    padding: 32px 18px 26px;
    top: calc(50% - 22px);
  }

  .dz-title {
    font-size: 19px;
  }

  .dz-icon {
    width: 26px;
    height: 26px;
  }

  .toast {
    bottom: auto;
    top: calc(66px + env(safe-area-inset-top));
    transform: translate(-50%, -6px);
  }

  .toast.is-on {
    transform: translate(-50%, 0);
  }

  .popover {
    width: 200px;
  }

  .sheet {
    left: 8px;
    right: 8px;
    top: auto;
    bottom: 8px;
    width: auto;
    max-height: 82vh;
    transform: none;
    animation: sheetUp 0.3s var(--ease) both;
  }

  .help-keys dt {
    width: 148px;
  }

  .help-grid dt {
    width: 56px;
  }
}

@keyframes sheetUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 7px;
    padding: 0 6px 0 8px;
  }
  .steps {
    gap: 2px;
  }
  .step {
    padding: 0 10px;
    font-size: 11.5px;
  }
  .step-n {
    display: none;
  }
  .step-track {
    width: 6px;
  }
  .topbar-actions {
    gap: 2px;
  }
  .seg button {
    min-width: 23px;
    padding: 0 3px;
    font-size: 10px;
  }
  .icon-btn {
    width: 29px;
    height: 30px;
  }
  .brand {
    display: none;
  }
  .statusbar .sb-item:nth-of-type(2),
  .statusbar .sb-sep:nth-of-type(2) {
    display: none;
  }
}

@media (max-width: 400px) {
  .topbar {
    gap: 5px;
  }
  .step {
    padding: 0 8px;
    font-size: 11px;
  }
  .step-track {
    width: 3px;
  }
  .seg button {
    min-width: 21px;
    padding: 0 2px;
    font-size: 9.5px;
  }
  .icon-btn {
    width: 27px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}
