/* =========================================================
   饰品换新计算（v30）
   复用：calculator-box / section-title / result-* / total-result / up-prog / up-reset
   本文件：A/B 饰品卡（下拉 / 等级 / 词条）、交换按钮、材料明细表、回本等级
   ========================================================= */

.acr-calc {
  --acr-h: 44px;          /* 输入控件统一高度 */
  --acr-k: 52px;          /* 左侧标签列宽 */
  --acr-gap: 20px;        /* 卡内行距 */
  --acr-sec: 40px;        /* 区块间距 */
}
.acr-calc.is-loading .acr-pair, .acr-calc.is-loading .acr-mats, .acr-calc.is-loading .result-section { opacity: .4; pointer-events: none; }
.acr-calc input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.acr-calc input[type=number]::-webkit-outer-spin-button, .acr-calc input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.acr-calc .is-muted { color: var(--ink-3) !important; font-weight: 500; }

/* 无系数时整块隐藏（只保留顶部提示） */
.acr-calc .coefficient-section.is-hidden { display: none; }
.acr-calc .coefficient-section { margin-bottom: var(--acr-sec); }
.acr-calc .warning-message { margin-bottom: var(--acr-sec); }

/* 区块间距 */
.acr-calc .acr-sec + .acr-sec { margin-top: var(--acr-sec); }
.acr-calc .section-title { margin-bottom: 20px; }
.acr-calc .input-section .section-title.acr-title { margin-top: 0; flex-wrap: wrap; row-gap: 6px; }
.acr-calc .section-title .up-sub { margin-left: 2px; }
.acr-title .acr-reset { margin: 0 0 0 auto; min-height: 38px; padding: 0 16px; font-size: 13.5px; }
.acr-load-err { margin: 0 0 16px; color: var(--accent-ink); font-weight: 500; }

/* ===== A / B 两张卡 ===== */
.acr-pair { display: grid; grid-template-columns: minmax(0, 1fr) 72px minmax(0, 1fr); align-items: stretch; }
.acr-card {
  --acr-c: var(--navy);
  display: flex; flex-direction: column; min-width: 0;
  padding: 28px 30px 30px; border-radius: 20px; background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 12px 32px rgba(10, 22, 33, .04);
}
.acr-card.is-b { --acr-c: var(--accent); }

.acr-card-head { display: flex; align-items: center; gap: 16px; min-height: 48px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
/* 圆形饰品徽标：A 深色 / B 橙色底，内放饰品图标 */
.acr-tag {
  display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  background: radial-gradient(120% 120% at 30% 20%, #1d3347 0%, var(--navy) 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 4px 12px rgba(10, 22, 33, .14);
}
.acr-card.is-b .acr-tag { background: radial-gradient(120% 120% at 30% 20%, #ff9a5f 0%, var(--accent) 72%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18), 0 4px 12px rgba(242, 102, 43, .24); }
.acr-tag img { display: block; width: 32px; height: 32px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.acr-card-ttl { min-width: 0; flex: 1 1 auto; }
.acr-card-ttl h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; line-height: 24px; color: var(--ink); }
.acr-card-pow { text-align: right; min-width: 0; flex: 0 1 auto; }
.acr-card-pow span { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 16px; }
.acr-card-pow b { display: block; margin-top: 4px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 24px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }

.acr-card-body { display: grid; gap: 24px; }
.acr-pickrow { display: grid; gap: 24px; min-width: 0; }
.acr-row { display: grid; grid-template-columns: var(--acr-k) minmax(0, 1fr); gap: 16px; align-items: start; min-width: 0; }
.acr-k { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); line-height: var(--acr-h); white-space: nowrap; }
/* 词条标签与第一行输入框对齐（表头 20px + 间距 10px） */
.acr-row-ent .acr-k { margin-top: 30px; }

/* 饰品：自定义下拉（按钮 + 弹出列表） */
.acr-dd { position: relative; min-width: 0; }
.acr-dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: var(--acr-h); padding: 0 14px 0 16px;
  font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--ink); text-align: left;
  background: var(--white); border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.acr-dd-btn:hover { border-color: #b3bac2; }
.acr-dd-btn:focus-visible, .acr-dd.is-open .acr-dd-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 102, 43, .14); }
.acr-dd-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acr-dd-car { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.acr-dd.is-open .acr-dd-car { transform: rotate(180deg); }
.acr-dd-list {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; min-width: max(100%, 248px);
  display: grid; grid-template-rows: repeat(5, 40px); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0 4px;
  margin: 0; padding: 6px; list-style: none; outline: none;
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 16px 40px rgba(10, 22, 33, .14), 0 2px 6px rgba(10, 22, 33, .06);
  animation: acr-pop .14s ease-out;
}
.acr-dd-list[hidden] { display: none; }
.acr-dd.is-up .acr-dd-list { top: auto; bottom: calc(100% + 8px); }
@keyframes acr-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.acr-dd-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border-radius: 8px;
  font-size: 15px; font-weight: 500; line-height: 40px; color: var(--ink-2); cursor: pointer; white-space: nowrap; user-select: none;
}
.acr-dd-opt.is-active { background: var(--paper); color: var(--ink); }
.acr-dd-opt.is-on { font-weight: 600; color: var(--acr-c); }
.acr-card:not(.is-b) .acr-dd-opt.is-on { color: var(--ink); }
.acr-dd-ck { flex: 0 0 16px; width: 16px; height: 16px; fill: none; stroke: var(--acr-c); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.acr-dd-opt.is-on .acr-dd-ck { visibility: visible; }

/* 等级：[− 30 +]  [满级 30] */
.acr-lv { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
.acr-step { display: grid; grid-template-columns: var(--acr-h) 72px var(--acr-h); height: var(--acr-h); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--white); overflow: hidden; }
.acr-step button {
  display: grid; place-items: center; padding: 0; border: 0; background: var(--white); cursor: pointer;
  font-family: var(--font-body); font-size: 20px; font-weight: 500; line-height: 1; color: var(--ink);
  transition: background .2s, color .2s;
}
.acr-step button:hover:not(:disabled) { background: var(--paper); }
.acr-step button:active:not(:disabled) { background: #e9ebee; }
.acr-step button:disabled { color: #b4bcc5; background: #f4f5f7; cursor: not-allowed; }
.acr-step input {
  width: 100%; min-width: 0; height: 100%; padding: 0; text-align: center;
  font-family: var(--font-body); font-size: 17px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums;
  background: var(--white); border: 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 0; outline: none;
}
.acr-step:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 102, 43, .14); }
.acr-maxbtn {
  height: var(--acr-h); padding: 0 16px; white-space: nowrap;
  font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--ink);
  background: var(--white); border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer;
  transition: background .2s, border-color .2s;
}
.acr-maxbtn:hover:not(:disabled) { background: var(--paper); }
.acr-maxbtn:disabled { color: #9aa3ad; background: #f4f5f7; border-color: var(--line); cursor: default; }
.acr-step button:focus-visible, .acr-maxbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* 词条：表头 + 3 行 */
.acr-ents { display: grid; gap: 10px; min-width: 0; }
.acr-ent { display: grid; grid-template-columns: 104px minmax(0, 1fr) 112px; gap: 12px; align-items: center; min-width: 0; }
.acr-ent-h { height: 20px; font-size: 12.5px; color: var(--ink-3); line-height: 20px; }
.acr-ent-h span:last-child, .acr-epow { text-align: right; }
.acr-ent > span { min-width: 0; }
.acr-sel { position: relative; display: block; }
.acr-sel::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 6px; height: 6px; margin-top: -5px; pointer-events: none;
  border-right: 1.6px solid var(--ink-3); border-bottom: 1.6px solid var(--ink-3); transform: rotate(45deg);
}
.acr-sel select, .acr-num {
  width: 100%; min-width: 0; height: var(--acr-h);
  font-family: var(--font-body); font-size: 15px; font-weight: 500; color: var(--ink);
  background: var(--white); border: 1px solid var(--line-strong); border-radius: 12px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.acr-sel select { -webkit-appearance: none; appearance: none; padding: 0 30px 0 14px; cursor: pointer; }
.acr-num { padding: 0 14px; text-align: right; font-variant-numeric: tabular-nums; }
.acr-num::placeholder { color: #a0a9b3; font-weight: 400; }
.acr-sel select:hover, .acr-num:hover { border-color: #b3bac2; }
.acr-sel select:focus, .acr-num:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(242, 102, 43, .14); }
.acr-epow { font-size: 14.5px; font-weight: 500; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.acr-extra { min-width: 0; margin: 0; padding: 10px 0 0; border: 0; border-top: 1px solid var(--line); }
.acr-extra legend { padding: 0 10px 0 0; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.acr-extra-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.acr-extra-grid label { display: grid; min-width: 0; gap: 4px; font-size: 12.5px; color: var(--ink-2); }

/* 交换按钮：卡片之间垂直居中 */
.acr-swap-wrap { display: grid; place-items: center; position: relative; z-index: 1; }
.acr-swap {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: var(--ink); background: var(--white); border: 1px solid var(--line-strong); cursor: pointer;
  box-shadow: 0 6px 16px rgba(10, 22, 33, .08);
  transition: background .25s, color .25s, border-color .25s;
}
.acr-swap .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.acr-swap:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.acr-swap.is-spin .i { animation: acr-spin .5s var(--ease-out); }
@keyframes acr-spin { from { transform: rotate(-180deg); } to { transform: none; } }

/* 缺系数提示：一行文字 + 右侧「去计算」，垂直居中 */
.acr-calc .warning-message.pc-warn { align-items: center; flex-wrap: nowrap; gap: 12px; padding: 12px 12px 12px 16px; }
.acr-calc .warning-message.pc-warn .ico { margin-top: 0; }
.acr-calc .pc-warn-text { flex: 1 1 auto; min-width: 0; line-height: 1.5; }
.acr-calc .pc-go { margin-left: 0; }

/* ===== 材料明细（对应 Excel：A 分 / B 总 / 需） ===== */
.acr-mat-wrap { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--white); }
.acr-mat-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; }
.acr-mat-table th, .acr-mat-table td { padding: 18px 28px; text-align: right; vertical-align: middle; border-bottom: 1px solid var(--line); white-space: nowrap; }
.acr-mat-table thead th { padding-top: 16px; padding-bottom: 16px; background: var(--paper); font-size: 13.5px; font-weight: 600; color: var(--ink-2); line-height: 1.35; }
.acr-mat-table thead th small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
.acr-mat-table th:first-child { text-align: left; width: 22%; }
.acr-mat-table tbody th { font-size: 15px; font-weight: 600; color: var(--ink); }
.acr-mat-table tbody th small { margin-left: 8px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.acr-mat-table td { font-size: 16px; font-weight: 500; color: var(--ink); }
.acr-mat-table td.is-need { font-weight: 600; }
.acr-mat-table .is-need { background: #fff8f3; }
.acr-mat-table thead th.is-need { background: #fff1e7; color: var(--accent-ink); }
.acr-mat-table thead th.is-need small { color: #c98a6a; }
.acr-mat-table tfoot th, .acr-mat-table tfoot td { border-bottom: 0; border-top: 1px solid var(--line-strong); }
.acr-mat-table tfoot th { font-size: 15px; font-weight: 600; color: var(--ink); }
.acr-mat-table tfoot td { font-size: 15px; }
.acr-mat-table td.is-neg { color: var(--accent-ink); }
.acr-mat-table td.is-pos { color: #1f8a4c; }
.acr-dot { display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; vertical-align: middle; transform: translateY(-1px); }
.acr-dot.is-g { background: #2c9a5a; }
.acr-dot.is-p { background: #8a4fd3; }
.acr-dot.is-f { background: #d39a1c; }
.acr-neg { margin-top: 12px; color: var(--accent-ink); }

/* ===== 计算结果 ===== */
.acr-calc .result-section { margin-top: var(--acr-sec); }
.acr-calc .total-result { margin: 0 0 20px; padding: 28px 32px; }
.acr-calc .total-value.is-neg { color: var(--accent-soft); }
.acr-calc .total-value.is-muted { color: #8796a5 !important; }
.acr-calc .acr-path { margin-top: 8px; color: #c3d0dc; font-size: 14px; }
.acr-calc .result-value.is-neg { color: var(--accent-ink); }
.acr-calc .result-item { padding: 22px 24px; }
.acr-wan-tip { margin-top: 12px; }
.acr-wan-tip:empty { display: none; }

.acr-be { margin-top: 20px; padding: 22px 24px; border-radius: 16px; }
.acr-be-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.acr-be-k { font-size: 15px; font-weight: 600; color: var(--ink); }
.acr-be-k small { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.acr-be-lv { font-size: 24px; font-weight: 600; letter-spacing: -.03em; color: var(--accent-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.acr-be-detail { margin-top: 16px; }
.acr-be-detail[hidden] { display: none; }
.acr-be.is-fail .acr-be-lv { font-size: 18px; color: #d93a1d; }
.acr-be.is-fail .up-prog-bar i { background: linear-gradient(90deg, #9fb0bf, #c3d0dc); }

/* ===== 响应式 ===== */
@media (max-width: 1240px) and (min-width: 1101px) {
  .acr-card { padding: 26px 24px 28px; }
  .acr-ent { grid-template-columns: 96px minmax(0, 1fr) 104px; }
}
@media (max-width: 1100px) {
  .acr-pair { grid-template-columns: minmax(0, 1fr); }
  .acr-swap-wrap { height: 72px; }
  .acr-swap .i { transform: rotate(90deg); }
  .acr-swap.is-spin .i { animation: acr-spin-v .5s var(--ease-out); }
  @keyframes acr-spin-v { from { transform: rotate(-90deg); } to { transform: rotate(90deg); } }
}
@media (max-width: 640px) {
  /* 手机：外层计算框不再套一层边框和内边距，把宽度留给 A/B 卡 */
  .calculator-box.acr-calc { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .acr-calc { --acr-sec: 40px; }
  .acr-calc .section-title { margin-bottom: 16px; }
  .acr-title .acr-reset { order: 2; min-height: 36px; padding: 0 14px; font-size: 13px; }
  .acr-calc .acr-title .up-sub, .acr-mats .section-title .up-sub { order: 3; flex: 1 0 100%; margin-left: 20px; }
  .acr-mats .section-title { flex-wrap: wrap; row-gap: 4px; }

  /* 手机：每张卡 = 头部一行 + 下拉/等级一行 + 词条 */
  .acr-calc { --acr-h: 40px; }
  .acr-card { padding: 16px; border-radius: 16px; }
  .acr-card-head { gap: 12px; min-height: 40px; padding-bottom: 12px; margin-bottom: 12px; }
  .acr-tag { flex-basis: 40px; width: 40px; height: 40px; }
  .acr-tag img { width: 26px; height: 26px; }
  .acr-card-ttl h2 { font-size: 16px; }
  .acr-card-pow { display: flex; align-items: baseline; gap: 8px; }
  .acr-card-pow span { font-size: 12px; }
  .acr-card-pow b { margin-top: 0; font-size: 18px; }
  .acr-card-body { gap: 12px; }
  .acr-pickrow { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .acr-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .acr-f-item .acr-k, .acr-f-lv .acr-k, .acr-row-ent > .acr-k { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .acr-lv .acr-maxbtn { display: none; }
  .acr-step { grid-template-columns: var(--acr-h) 48px var(--acr-h); }
  .acr-step input { font-size: 16px; }
  .acr-dd-btn { font-size: 16px; padding: 0 12px 0 14px; }
  .acr-dd-list { min-width: 248px; }
  .acr-ents { gap: 8px; }
  .acr-ent-h { height: 16px; line-height: 16px; font-size: 12px; }
  .acr-ent { grid-template-columns: 80px minmax(0, 1fr) 88px; gap: 8px; }
  .acr-sel select, .acr-num { font-size: 16px; } /* 16px 避免 iOS 聚焦放大 */
  .acr-sel select { padding: 0 26px 0 12px; }
  .acr-sel::after { right: 12px; }
  .acr-num { padding: 0 12px; }
  .acr-epow { font-size: 13.5px; }
  .acr-swap-wrap { height: 56px; }
  .acr-swap { width: 40px; height: 40px; }
  .acr-calc .warning-message.pc-warn { align-items: center; flex-wrap: nowrap; font-size: 14px; }

  .acr-mat-wrap { border-radius: 16px; }
  .acr-mat-table th, .acr-mat-table td { padding: 16px 6px; font-size: 14px; }
  .acr-mat-table th:first-child { width: 48px; padding-left: 14px; }
  .acr-mat-table thead th:last-child { width: 33%; }
  .acr-mat-table th:last-child, .acr-mat-table td:last-child { padding-right: 14px; }
  .acr-mat-table thead th { padding-top: 14px; padding-bottom: 14px; font-size: 12.5px; }
  .acr-mat-table thead th small { font-size: 11px; }
  .acr-mat-table thead th:first-child { font-size: 0; }
  .acr-th-p { display: none; } /* 手机：表头只写「分解返还 / 累计消耗」，下方小字已标明饰品 */
  .acr-mat-table tbody th { font-size: 14.5px; }
  .acr-mat-table tbody th small { display: none; }
  .acr-mat-table tfoot th { font-size: 13.5px; }
  .acr-mat-table tfoot td { font-size: 13px; letter-spacing: -.01em; }
  .acr-dot { margin-right: 6px; }

  .acr-calc .total-result { padding: 24px; }
  .acr-calc .result-item { padding: 16px 0; }
  .acr-be { padding: 20px; }
  .acr-be-lv { font-size: 21px; }
}
@media (max-width: 360px) {
  .acr-ent { grid-template-columns: 76px minmax(0, 1fr) 80px; gap: 8px; }
  .acr-mat-table th, .acr-mat-table td { padding-left: 6px; padding-right: 6px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .acr-swap.is-spin .i { animation: none; }
  .acr-dd-btn, .acr-dd-car, .acr-swap, .acr-step button, .acr-maxbtn { transition: none; }
  .acr-dd-list { animation: none; }
}
