.workbench {
  min-height: calc(100svh - 224px - env(safe-area-inset-top));
  max-width: 960px;
  margin: auto;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

/* ---------- 资源库 Dock ---------- */
.library-dock {
  position: relative;
  z-index: 5;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-radius: 28px;
  background: var(--glass-bg);
  box-shadow: var(--glass-edge), var(--highlight), var(--shadow);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: dock-in 0.7s var(--ease) both;
}
@keyframes dock-in {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
}
.dock-item {
  position: relative;
}
.dock-button {
  position: relative;
  width: 100%;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 4px 10px;
  border-radius: 20px;
  border-color: transparent;
  background: transparent;
  font-size: 11.5px;
  font-weight: 560;
  color: var(--muted);
  white-space: normal;
}
.dock-button:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}
.dock-button:active:not(:disabled) {
  transform: scale(0.94);
}
.dock-button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--edge), var(--highlight), var(--shadow-sm);
}
.dock-button[data-site] {
  /* 让按钮自身拿到对应资源库的主题色 */
  color: var(--muted);
}
.library-icon {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: var(--site);
  background: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: var(--highlight), var(--shadow-sm);
  transition:
    transform 0.4s var(--ease),
    box-shadow 0.3s var(--ease),
    border-color 0.3s,
    filter 0.3s,
    opacity 0.3s;
}
.library-icon > svg {
  width: 22px;
  height: 22px;
}
.library-logo {
  width: 30px;
  height: 30px;
  background: center / contain no-repeat;
  transition:
    filter 0.3s,
    opacity 0.3s;
}
.dock-button:hover .library-icon {
  transform: translateY(-2px);
}
.dock-button[aria-pressed="true"] .library-icon {
  background: var(--site-soft, var(--surface));
  border-color: var(--site);
  box-shadow:
    0 0 0 3px var(--site-soft, var(--surface-3)),
    0 8px 18px -8px var(--site);
}
.library-name {
  line-height: 1.3;
  text-align: center;
}
.lock-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.lock-badge svg {
  width: 11px;
  height: 11px;
  stroke-width: 2.2;
}
.dock-button[aria-disabled="true"] {
  color: var(--faint);
  cursor: help;
}
.dock-button[aria-disabled="true"] .library-icon {
  color: #9a9a9e;
  background: var(--surface-2);
  box-shadow: none;
}
.dock-button[aria-disabled="true"] .library-icon > svg,
.dock-button[aria-disabled="true"] .library-logo {
  filter: grayscale(1);
  opacity: 0.4;
}
.dock-button[aria-disabled="true"]:hover {
  background: transparent;
  color: var(--muted);
}
.dock-button[aria-disabled="true"]:hover .library-icon {
  transform: none;
}
.dock-tooltip {
  position: absolute;
  z-index: 10;
  left: calc(100% + 16px);
  top: 50%;
  width: 220px;
  padding: 10px 14px;
  border-radius: 14px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  line-height: 1.6;
  opacity: 0;
  visibility: hidden;
  transform: translate(-6px, -50%) scale(0.97);
  transform-origin: left center;
  transition:
    opacity 0.2s,
    transform 0.35s var(--ease),
    visibility 0.2s;
  pointer-events: none;
}
.dock-tooltip::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 2px;
  background: var(--ink);
  transform: rotate(45deg);
}
.dock-item:hover .dock-tooltip,
.dock-item:focus-within .dock-tooltip {
  visibility: visible;
  opacity: 1;
  transform: translate(0, -50%);
}

/* ---------- 输入区：资源库与说明 / 链接输入 / 确认，三个独立模块 ---------- */
.input-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.input-panel > form {
  min-width: 0;
}
.wb-card {
  min-width: 0;
  padding: 22px 24px;
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow), var(--highlight);
  animation: rise-in 0.6s var(--ease) both;
}
.input-panel > :nth-child(2) .wb-card:first-child {
  animation-delay: 0.05s;
}
.wb-confirm {
  animation-delay: 0.1s;
}
.workbench-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.workbench-heading .eyebrow {
  margin-bottom: 2px;
}
.workbench-heading > div {
  min-width: 0;
}
.workbench-heading h1 {
  white-space: nowrap;
}
#grant-balance {
  flex: none;
  gap: 6px;
  white-space: nowrap;
}
#grant-balance small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}
.workbench-heading h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 26px;
}
.workbench-heading h1:where([data-site]:not([data-site=""]))::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--site);
  box-shadow: 0 0 0 5px var(--site-soft);
}
/* 购买说明 / 确认须知：与结算明细同一套嵌入式浅底块；
   后台设置的颜色（--note，默认琥珀色）只用于标签、圆点和极淡的底色 */
.buy-notes,
.consent-note {
  --note: #c2700c;
  --notes-bg: color-mix(in srgb, var(--note) 6%, rgba(22, 22, 24, 0.035));
  background: var(--notes-bg);
  color: var(--ink-2);
}
.buy-notes {
  position: relative;
  /* 间距只按说明框本身算；顶部页签向上伸进标题行右侧的空白，不额外撑开 */
  margin-top: 16px;
  padding: 14px 18px 16px;
  border-radius: var(--r-tile);
  font-size: 12.5px;
  line-height: 1.7;
}
/* 说明标题：说明框右上角长出来的标签页（文件夹页签）——与说明框同一底色、右边与说明框齐平，
   左侧用内凹圆角过渡；文字前的小圆点与说明条目的圆点一致。占用标题行右下方的空白。 */
.buy-notes:has(.notes-tab) {
  border-top-right-radius: 0;
}
.notes-tab {
  --tab-r: 10px;
  position: absolute;
  right: 0;
  bottom: 100%;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 18px 3px 16px;
  border-radius: 13px 13px 0 0;
  background: var(--notes-bg);
  color: var(--note);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  line-height: 1.5;
  white-space: nowrap;
}
/* 领取模式右上角的剩余次数靠上，给页签让出位置 */
.workbench-heading:has(+ .buy-notes .notes-tab) #grant-balance {
  align-self: flex-start;
}
.notes-tab::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--note);
}
/* 左侧内凹圆角：用与说明框相同的底色画出 1/4 圆的外侧 */
.notes-tab::after {
  content: "";
  position: absolute;
  left: calc(-1 * var(--tab-r));
  bottom: 0;
  width: var(--tab-r);
  height: var(--tab-r);
  background: radial-gradient(circle at 0 0, transparent var(--tab-r), var(--notes-bg) calc(var(--tab-r) + 0.5px));
  pointer-events: none;
}
/* 结算页"确认须知"的小标签 */
.notes-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--note) 14%, #fff);
  color: var(--note);
  font-size: 12px;
  font-weight: 650;
}
.notes-tag svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}
.notes-rules {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.notes-rules li {
  position: relative;
  padding-left: 14px;
}
.notes-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.68em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--note);
}
/* 链接输入 */
.url-box {
  display: grid;
  gap: 12px;
}
.url-box > .inline-error {
  margin: 0;
}
.url-box:disabled .wb-card {
  opacity: 0.6;
}
.wb-input {
  padding: 16px 16px 16px;
}
.wb-input-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin: 0 4px 10px;
}
.wb-input-head label {
  margin: 0;
  font-size: 14px;
  font-weight: 640;
  color: var(--ink);
}
.wb-input-head label span {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 450;
  color: var(--muted);
}
.wb-input-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.wb-input-head .small {
  padding: 5px 10px;
  color: var(--muted);
}
/* 底色与聚焦描边画在外层 .url-editor 上：输入框必须保持透明，
   否则会挡住下面用来标红错误链接的高亮层（此时输入框文字本身是透明的） */
.url-editor {
  position: relative;
  border-radius: 12px;
  background: var(--tile);
  transition:
    background 0.2s,
    box-shadow 0.25s var(--ease);
}
.url-editor:hover {
  background: var(--tile-hover);
}
.url-editor:focus-within {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1px rgba(22, 22, 24, 0.28),
    0 0 0 4px rgba(22, 22, 24, 0.05);
}
#urls,
#urls:hover,
#urls:focus {
  display: block;
  height: clamp(180px, calc(100svh - 640px), 420px);
  min-height: 160px;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  box-shadow: none;
  resize: none;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.9;
}
/* 提示文字比全局占位符略深，仍明显浅于正文 */
#urls::placeholder {
  color: #9a9994;
  /* workbench.js 按最长示例链接计算，保证每个链接完整一行 */
  font-size: var(--placeholder-size, inherit);
  white-space: pre;
}
.url-highlight {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--ink);
  visibility: hidden;
}
.url-editor.has-highlight .url-highlight { visibility: visible; }
.url-highlight .invalid-url { color: #c73535; }
#urls { position: relative; z-index: 1; overflow-wrap: break-word; }
.url-editor.has-highlight #urls { color: transparent; caret-color: var(--ink); }
.url-box:disabled #urls {
  opacity: 1;
}
/* 确认：左侧按链接数实时计算的价格，右侧按钮 */
.wb-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 12px 12px 20px;
}
.wb-price {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}
.wb-price-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 560;
  white-space: nowrap;
}
.wb-price-line strong {
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.wb-price-note {
  color: var(--muted);
  font-size: 12.5px;
}
/* 老金：额外付费提示跟在预估价后面，纯橙色文字、无底色；换行时与"预估价"左对齐 */
.wb-price-warn {
  color: #c2410c;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}
.wb-confirm .primary {
  flex: none;
  padding: 11px 22px;
  font-size: 14px;
}
/* 继续核对清单：与确认链接同一行、在它左边，用浅色次级按钮 */
.wb-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.wb-resume {
  display: inline-flex;
  align-items: center;
  padding: 11px 18px;
  border: 1px solid transparent; /* 与旁边按钮同高 */
  border-radius: 999px;
  background: var(--tile);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 560;
  line-height: 1.4;
  white-space: nowrap;
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.25s var(--ease);
}
.wb-resume:hover {
  background: var(--tile-hover);
  color: var(--ink);
}
.wb-resume:active {
  transform: scale(0.97);
}
.wb-resume[hidden] {
  display: none;
}
.url-meter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  background: var(--tile);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  transition:
    color 0.2s,
    background 0.2s;
}
.url-meter svg {
  width: 13px;
  height: 13px;
}
.url-meter,
#url-count {
  white-space: nowrap;
}
/* 超出数量：用柔和的琥珀色，不用红色报错，具体说明在下方提示卡片 */
.url-meter.is-over {
  color: #a8650e;
  background: #fbf0dc;
  font-weight: 600;
}
.url-meter.is-nudge {
  animation: meter-nudge 0.45s var(--ease);
}
@keyframes meter-nudge {
  25% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
  75% {
    transform: translateX(-2px);
  }
}
.library-warning {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: warning-in 0.45s var(--ease);
}
@keyframes warning-in {
  from {
    opacity: 0;
    transform: translate(-50%, 14px) scale(0.96);
  }
}
.library-warning svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}
.library-warning a {
  padding: 6px 14px;
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-weight: 600;
  white-space: nowrap;
}
#simulation-examples {
  margin-top: 16px;
}

/* ---------- 底部操作条 ---------- */
.stage-actions {
  position: sticky;
  bottom: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
  padding: 12px 12px 12px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--glass-edge), var(--highlight), var(--shadow-lg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  animation: rise-in 0.6s var(--ease) 0.2s both;
}
.stage-actions .primary {
  padding: 12px 24px;
}
.stage-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 11px 20px;
  border: 1px solid rgba(22, 22, 24, 0.1);
  border-radius: 999px;
  background: var(--card-bg);
  box-shadow:
    var(--highlight),
    0 1px 2px rgba(22, 22, 24, 0.05);
  font-weight: 560;
  white-space: nowrap;
  transition:
    background 0.2s,
    border-color 0.2s,
    transform 0.25s var(--ease);
}
.secondary-button:hover {
  background: var(--surface);
  border-color: rgba(22, 22, 24, 0.16);
}
.secondary-button:active {
  transform: scale(0.97);
}
.secondary-button svg {
  width: 16px;
  height: 16px;
}
.stage-total {
  margin-right: 8px;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stage-total:not(:empty)::before {
  content: "合计";
  margin-right: 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

/* ---------- 结算 / 额外付费 / 付款（同一张卡片） ---------- */
.checkout-panel {
  max-width: 500px;
  margin: 40px auto;
  padding: 32px;
  border-radius: var(--r-panel);
  box-shadow: var(--edge), var(--highlight), var(--shadow-lg);
}
.checkout-panel h1 {
  margin: 18px 0 20px;
  font-size: 28px;
}
.checkout-panel .eyebrow {
  margin: 18px 0 0;
}
.checkout-panel .eyebrow + h1 {
  margin-top: 4px;
}
.checkout-panel .resource-card {
  margin: 0 0 4px;
  background: var(--tile);
  box-shadow: none;
  border-color: transparent;
  animation: none;
}
.checkout-panel .resource-card:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}
/* 每个资源库一块嵌入式明细 */
.quote-lines {
  display: grid;
  gap: 10px;
}
.quote-group {
  padding: 16px 18px;
  border-radius: var(--r-tile);
  background: var(--tile);
}
.quote-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  font-size: 15px;
}
.quote-line strong {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.quote-line strong::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--site);
  box-shadow: 0 0 0 4px var(--site-soft, var(--surface-3));
}
.quote-line span {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.quote-meta {
  margin: 4px 0 0 18px;
  color: var(--muted);
  font-size: 12.5px;
}
.quote-rows {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(22, 22, 24, 0.1);
}
.quote-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--ink-2);
  font-size: 12.5px;
}
.quote-row span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.quote-row span:last-child {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 560;
}
.quote-row.is-item {
  padding-left: 12px;
  color: var(--muted);
}
.quote-row.is-item span:first-child::before {
  content: "· ";
}
.quote-row.is-credit {
  color: var(--ok);
}
/* 合计：与明细同一套浅底块，标签与金额垂直居中 */
.total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
  padding: 16px 20px;
  border-radius: var(--r-tile);
  background: var(--tile);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 560;
}
.total strong {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
/* 支付方式：点击选择 */
.pay-methods {
  margin-top: 20px;
}
.pay-methods legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 560;
  color: var(--ink-2);
}
.pay-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
}
[data-pay="alipay"] {
  --pay: #1677ff;
  --pay-soft: rgba(22, 119, 255, 0.1);
}
[data-pay="wxpay"] {
  --pay: #07c160;
  --pay-soft: rgba(7, 193, 96, 0.1);
}
.pay-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  background: var(--tile);
  box-shadow: inset 0 0 0 1px transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.2s,
    box-shadow 0.25s var(--ease),
    transform 0.25s var(--ease);
}
.pay-option:hover {
  background: var(--tile-hover);
}
.pay-option:active {
  transform: scale(0.98);
}
.pay-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.pay-option .pay-icon {
  width: 30px;
  height: 30px;
}
.pay-name {
  white-space: nowrap;
}
.pay-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: auto;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--faint);
  color: #fff;
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
.pay-check svg {
  width: 12px;
  height: 12px;
  stroke-width: 3;
  opacity: 0;
  transform: scale(0.5);
  transition:
    opacity 0.2s,
    transform 0.3s var(--ease);
}
.pay-option:has(input:checked) {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1.5px var(--pay),
    0 0 0 4px var(--pay-soft),
    0 10px 22px -14px var(--pay);
}
.pay-option:has(input:checked) .pay-check {
  background: var(--pay);
  box-shadow: none;
}
.pay-option:has(input:checked) .pay-check svg {
  opacity: 1;
  transform: none;
}
.pay-option:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
/* 确认须知：不需要勾选，与购买说明同一样式 */
.consent-note {
  margin-top: 20px;
  padding: 12px 16px 14px;
  border-radius: var(--r-tile);
  font-size: 12.5px;
  line-height: 1.7;
}
.consent-note p {
  margin: 8px 0 0;
}
/* 额外付费资源 */
.extra-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}
.extra-actions > button {
  flex: 1;
  padding: 13px 18px;
}
/* 付款页：渠道、金额、二维码居中 */
.payment-panel {
  text-align: center;
}
.payment-panel .back-link {
  float: left;
}
.payment-panel h1 {
  clear: both;
  padding-top: 18px;
  margin: 0 0 16px;
}
.pay-summary {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.pay-channel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  background: var(--pay-soft, var(--tile));
  color: var(--pay, var(--ink-2));
  font-size: 13px;
  font-weight: 620;
}
.pay-channel:empty {
  display: none;
}
.pay-channel .pay-icon {
  width: 22px;
  height: 22px;
}
.pay-summary strong {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.pay-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--ink-2);
  font-size: 13px;
}
.pay-state::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warn);
}
.pay-state[data-tone="wait"]::before {
  animation: pulse 1.6s ease-in-out infinite;
}
.pay-state[data-tone="ok"]::before {
  background: var(--ok);
}
.pay-state[data-tone="bad"]::before {
  background: var(--bad);
}
.pay-state:empty {
  display: none;
}
/* 二维码放在白色相框里，四周留白方便扫码 */
.payment-qr {
  display: block;
  width: min(240px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 20px auto 4px;
  padding: 14px;
  border-radius: var(--r-card);
  background: #fff;
  box-shadow: var(--edge), 0 14px 32px -18px rgba(22, 22, 24, 0.35);
}
.payment-panel .wide {
  justify-content: center;
}
.payment-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}
.payment-tools svg {
  width: 14px;
  height: 14px;
}
.payment-panel .caption {
  margin-top: 14px;
}
.payment-items {
  margin: 0 0 16px;
  color: var(--ink-2);
  font-size: 13px;
  text-align: left;
}
.payment-items summary {
  cursor: pointer;
  line-height: 1.6;
}
.payment-items ul {
  max-height: 160px;
  overflow-y: auto;
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .workbench {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    /* 底部给悬浮的资源库栏留位置：用内边距而不是外边距——body 有 min-height 时，
       最后一个元素的下外边距会被吞掉，页面滚不到底，确认按钮会被资源库栏挡住 */
    min-height: calc(100svh - 98px - env(safe-area-inset-top));
    margin: 0 auto;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }
  .input-panel {
    gap: 10px;
  }
  .wb-card {
    padding: 18px 16px;
    border-radius: 18px;
  }
  .workbench-heading h1 {
    font-size: 22px;
  }
  /* 有余额时数量与余额上下两行，靠右对齐 */
  .workbench-heading:has(#grant-balance small) + .buy-notes {
    margin-top: 22px;
  }
  #grant-balance:has(small) {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    padding-block: 5px;
    border-radius: 14px;
    line-height: 1.35;
  }
  .buy-notes {
    margin-top: 12px;
    padding: 12px 14px 14px;
  }
  .wb-input {
    padding: 14px 12px 12px;
  }
  .library-dock {
    position: fixed;
    z-index: 30;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    justify-content: space-around;
    gap: 2px;
    width: min(calc(100% - 24px), 440px);
    padding: 6px;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: var(--shadow-lg);
    animation-name: dock-up;
  }
  @keyframes dock-up {
    from {
      opacity: 0;
      transform: translate(-50%, 24px);
    }
  }
  .dock-item {
    flex: 1;
    min-width: 0;
  }
  .dock-button {
    padding: 8px 2px 6px;
    gap: 4px;
    font-size: 10.5px;
    border-radius: 20px;
  }
  .library-icon {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }
  .library-logo {
    width: 25px;
    height: 25px;
  }
  .library-icon > svg {
    width: 19px;
    height: 19px;
  }
  .dock-tooltip {
    display: none;
  }
  .library-warning {
    bottom: calc(112px + env(safe-area-inset-bottom));
    border-radius: 18px;
    padding: 10px 10px 10px 14px;
    font-size: 12.5px;
  }
  body.keyboard-open .library-dock,
  body.keyboard-open .library-warning {
    visibility: hidden;
    pointer-events: none;
  }
  #urls,
  #urls:hover,
  #urls:focus {
    font-size: 15px;
    height: 200px;
    min-height: 160px;
    padding: 12px 14px;
  }
  .url-excess {
    display: none;
  }
  .wb-confirm {
    padding: 10px 10px 10px 14px;
  }
  .wb-price-line strong {
    font-size: 19px;
  }
  .wb-price-warn {
    font-size: 12px;
  }
  .wb-confirm .primary {
    padding: 10px 18px;
  }
  /* 价格与两个按钮放不下时，按钮整体换到下一行靠右 */
  .wb-confirm {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .wb-actions {
    gap: 6px;
  }
  .wb-resume {
    padding: 10px 14px;
  }
  #cart-view,
  #review-view {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .stage-actions {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    margin: 0;
    gap: 10px;
    padding: 10px 10px 10px 16px;
    border-radius: 24px;
  }
  .stage-total {
    margin-right: 0;
    font-size: 18px;
  }
  .stage-total:not(:empty)::before {
    display: none;
  }
  .stage-buttons {
    gap: 8px;
  }
  .stage-actions .primary,
  .secondary-button {
    padding: 11px 16px;
    font-size: 14px;
  }
  .secondary-button svg {
    width: 15px;
    height: 15px;
  }
  .checkout-panel {
    margin: 16px auto;
    padding: 24px 18px;
    border-radius: 28px;
  }
  .checkout-panel h1 {
    font-size: 24px;
  }
  .quote-group {
    padding: 14px 16px;
  }
  .total {
    padding: 14px 16px;
  }
  .total strong {
    font-size: 26px;
  }
  .pay-options {
    gap: 8px;
  }
  .pay-option {
    gap: 9px;
    padding: 13px 12px;
    font-size: 14px;
  }
  .pay-option .pay-icon {
    width: 26px;
    height: 26px;
  }
}
/* 取消付款是次要操作，弱化显示 */
.payment-tools .quiet {
  color: var(--muted);
  font-weight: 500;
}
.payment-tools .quiet:hover {
  color: var(--bad);
  background: var(--bad-bg);
}

/* ---------- 滑动选中底色（slider.js）：资源库选择、支付方式 ---------- */
/* ---------- 资源库 Dock 精修 ----------
   像系统的分段控件：磨砂浅灰轨道 + 一块白色浮起的选中底（滑动切换），不用色条、描边和光圈；
   图标是无边框的白色圆角块，未选中的略微降低饱和度，选中的恢复原色并带一点主题色投影。 */
.library-dock {
  background: rgba(244, 243, 239, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 18px 40px -24px rgba(22, 22, 24, 0.35);
}
.library-dock .slide-pill {
  background: #fff;
  box-shadow:
    0 0 0 0.5px rgba(22, 22, 24, 0.06),
    0 1px 2px rgba(22, 22, 24, 0.06),
    0 12px 26px -14px rgba(22, 22, 24, 0.32);
}
.dock-button:hover {
  background: transparent;
}
.library-icon {
  border: 0;
  background: #fff;
  box-shadow:
    0 0 0 0.5px rgba(22, 22, 24, 0.08),
    0 2px 6px -2px rgba(22, 22, 24, 0.12);
}
.dock-button .library-logo,
.dock-button .library-icon > svg {
  filter: saturate(0.5);
  opacity: 0.78;
}
.dock-button:hover .library-logo,
.dock-button:hover .library-icon > svg {
  filter: saturate(0.85);
  opacity: 0.95;
}
.dock-button[aria-pressed="true"] .library-logo,
.dock-button[aria-pressed="true"] .library-icon > svg {
  filter: none;
  opacity: 1;
}
.dock-button[aria-pressed="true"] .library-icon {
  background: #fff;
  box-shadow:
    0 0 0 0.5px rgba(22, 22, 24, 0.06),
    0 8px 16px -8px color-mix(in srgb, var(--site, #161618) 70%, transparent);
  transform: scale(1.04);
}
.dock-button .library-name {
  transition:
    color 0.3s,
    font-weight 0.3s;
}
.dock-button[aria-pressed="true"] .library-name {
  color: var(--ink);
  font-weight: 650;
}
@media (max-width: 720px) {
  .library-dock {
    background: rgba(244, 243, 239, 0.8);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.75),
      0 20px 44px -18px rgba(22, 22, 24, 0.4);
  }
}
.library-dock.has-slider .dock-button[aria-pressed="true"] {
  background: transparent;
  box-shadow: none;
}
.pay-options .slide-pill {
  background: var(--surface);
  box-shadow:
    inset 0 0 0 1.5px var(--pay),
    0 0 0 4px var(--pay-soft),
    0 10px 22px -14px var(--pay);
}
.pay-options.has-slider .pay-option:has(input:checked) {
  background: transparent;
  box-shadow: none;
}
/* 清单页：核对中的链接先用与资源卡片同样大小的占位卡片排好，核对好一个就原位换成结果 */
#query-network {
  margin: 0 0 14px;
}
#query-network:empty {
  display: none;
}
.preview-library .lookup-action {
  margin-left: auto;
  padding: 5px 10px;
}
.preview-library .lookup-action + .group-clear {
  margin-left: 0;
}
/* 清单卡片顶部一行与带删除按钮的卡片同高：占位卡片、未能加入的卡片没有删除按钮，也不会矮一截 */
#cart-items .card-top {
  min-height: 28px;
}
.resource-card.is-checking h3 {
  width: 62%;
  border-radius: 8px;
  color: transparent;
  background: linear-gradient(90deg, var(--tile) 25%, var(--tile-hover) 50%, var(--tile) 75%) 0 0 / 200% 100%;
  animation: skeleton 1.8s ease-in-out infinite;
}
.resource-card.is-checking .card-meta {
  color: var(--muted);
}
/* 原位换成结果：卡片底板保持不动（不透明度不变，不会整张闪一下），只让里面的内容柔和浮现 */
.resource-grid > .resource-card.is-swap {
  animation: none;
}
.resource-card.is-swap > * {
  animation: swap-in 0.55s var(--ease) both;
}
.resource-card.is-swap > :nth-child(2) {
  animation-delay: 0.05s;
}
.resource-card.is-swap > :nth-child(n + 3) {
  animation-delay: 0.1s;
}
@keyframes swap-in {
  from {
    opacity: 0;
    transform: translateY(4px);
    filter: blur(3px);
  }
}
@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}
