/* AI 效果图 — 移动端 */
.ar-viewport {
  position: relative;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ar-header {
  position: relative;
  z-index: 20;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 10px 0 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ar-header-main {
  flex: 1;
  min-width: 0;
}

.ar-header-back {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.ar-header-title {
  flex: 1;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.ar-header-meta {
  font-size: 11px;
  color: #94a3b8;
}

.ar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ar-preview-panel {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8edf3;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow: visible;
  flex-shrink: 0;
}

.ar-main-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #0f172a;
  border-radius: 16px 16px 0 0;
  /* 明确高度，避免 aspect-ratio + max-height 导致容器有宽无高、图片留白 */
  height: min(calc((var(--shell-w, 390px) - 24px) * 1.25), 52vh, 400px);
}

.ar-main-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: opacity 0.2s ease;
}

.ar-main-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  margin: 0;
  padding: 28px 12px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.72));
  pointer-events: none;
}

.ar-gen-record {
  padding: 10px 12px 12px;
  background: #f8fafc;
  border-top: 1px solid #eef2f6;
}

.ar-gen-record-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ar-gen-record-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ar-gen-select-all {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  user-select: none;
}

.ar-gen-select-all input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.ar-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #e2e8f0;
}

.ar-share-bar-count {
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

.ar-share-bar-btn {
  flex: 1;
  max-width: 200px;
  min-height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}

.ar-share-bar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.ar-share-bar-btn.is-dim {
  opacity: 0.55;
}

.ar-share-bar-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.ar-gen-record-title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.ar-gen-share-hint {
  margin: 0 0 8px;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.4;
}

.ar-gen-share-hint strong {
  color: #64748b;
  font-weight: 600;
}

.ar-gen-record-meta {
  font-size: 11px;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.ar-gen-record-list {
  display: flex;
  gap: 8px;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.ar-gen-record-list::-webkit-scrollbar {
  display: none;
}

.ar-version-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #93c5fd;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  min-height: 36px;
  border-radius: 10px;
  text-decoration: none;
  max-width: 46%;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.18);
  -webkit-tap-highlight-color: transparent;
}

.ar-version-link > .fa-clock-rotate-left {
  font-size: 13px;
  flex-shrink: 0;
}

.ar-version-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 5.5em;
}

.ar-version-link-chevron {
  font-size: 10px;
  flex-shrink: 0;
  opacity: 0.85;
}

.ar-version-link:active {
  background: #dbeafe;
  transform: scale(0.98);
}

.ar-header-version .ar-version-strip-wrap {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  width: min(280px, calc(100vw - 24px));
  margin-top: 0;
  padding: 8px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.ar-version-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.ar-version-strip::-webkit-scrollbar {
  display: none;
}

.ar-version-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.ar-version-chip img {
  width: 56px;
  height: 42px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: #e2e8f0;
}

.ar-version-chip span {
  font-size: 10px;
  color: #64748b;
  max-width: 64px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ar-version-chip.active {
  border-color: var(--primary);
}

.ar-version-chip.active span {
  color: var(--primary);
  font-weight: 600;
}

.ar-scheme-products {
  padding: 10px 12px 12px;
  background: #fff;
  border-top: 1px solid #eef2f6;
  flex-shrink: 0;
}

.ar-scheme-products-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ar-scheme-products-title {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.ar-scheme-products-meta {
  font-size: 11px;
  color: #94a3b8;
}

.ar-product-section + .ar-product-section {
  margin-top: 10px;
}

.ar-product-section-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.ar-scheme-product-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ar-scheme-product-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  background: #f8fafc;
}

.ar-scheme-product-remove {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.ar-scheme-product-remove:active {
  background: #fef2f2;
  border-color: #fecaca;
  color: #ef4444;
}

.ar-scheme-product-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.ar-scheme-product-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 16px;
}

.ar-scheme-product-body {
  flex: 1;
  min-width: 0;
}

.ar-scheme-product-name {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ar-scheme-product-meta {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

.ar-scheme-product-empty {
  list-style: none;
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: #64748b;
  text-align: left;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  line-height: 1.45;
}

.ar-scheme-product-list:not(:empty) {
  min-height: 44px;
}

.ar-gen-hint {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.45;
  margin: 0;
  padding: 0 4px 4px;
}

.ar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ar-result-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #e2e8f0;
  border: 2px solid transparent;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ar-result-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.ar-result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ar-result-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  padding: 3px 8px;
  border-radius: 999px;
}

.ar-result-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
}

.ar-result-card.selected .ar-result-check {
  display: flex;
}

.ar-hist-item {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  aspect-ratio: 3 / 4;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid transparent;
  background: #e2e8f0;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  padding: 0;
}

.ar-hist-item::after {
  content: attr(data-index);
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: rgba(15, 23, 42, 0.45);
  padding: 2px 5px;
  border-radius: 4px;
  pointer-events: none;
}

.ar-hist-item.active {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
  transform: translateY(-2px);
}

.ar-hist-item.is-share-picked {
  border-color: #22c55e;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.35);
}

.ar-hist-pick-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  z-index: 3;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ar-hist-item .ar-hist-pick {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid #fff;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 10px;
  pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ar-hist-item.is-share-picked .ar-hist-pick {
  background: #22c55e;
  border-color: #fff;
  color: #fff;
}

.ar-hist-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ar-toolbar {
  flex-shrink: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom, 0));
  display: flex;
  justify-content: space-around;
  gap: 4px;
}

.ar-bottom-bar {
  position: relative;
  flex-shrink: 0;
  z-index: 25;
}

.ar-tool-btn {
  flex: 1;
  max-width: 72px;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 10px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  border-radius: 10px;
  cursor: pointer;
}

.ar-tool-btn i {
  font-size: 18px;
}

.ar-tool-btn.active,
.ar-tool-btn:active {
  color: var(--primary);
  background: #eff6ff;
}

.ar-tool-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* —— 手机内弹层（非整页 fixed） —— */
.ar-phone-layer [hidden] {
  display: none !important;
}

.ar-phone-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.ar-phone-layer.is-active,
.ar-phone-layer:has(.ar-sheet-backdrop.show),
.ar-phone-layer:has(.ar-modify-sheet.show),
.ar-phone-layer:has(.ar-download-sheet.show),
.ar-phone-layer:has(.ar-custom-product-sheet.show),
.ar-phone-layer:has(.cust-drawer-layer.is-open),
.ar-phone-layer:has(.ar-erase-overlay:not([hidden])),
.ar-phone-layer:has(.ar-preview-overlay:not([hidden])),
.ar-phone-layer:has(.ar-compare-overlay:not([hidden])) {
  pointer-events: auto;
}

.ar-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.ar-sheet-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.ar-modify-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.12);
  pointer-events: auto;
  visibility: hidden;
}

.ar-modify-sheet.show {
  transform: translateY(0);
  visibility: visible;
}

/* AI 修改流程第二步：手机内全屏白底页 */
.ar-modify-sheet.is-flow-step {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: none;
  height: 100%;
  border-radius: 0;
  z-index: 11;
  box-shadow: none;
  transform: none;
  opacity: 0;
  transition: opacity 0.22s ease, visibility 0.22s;
}

.ar-modify-sheet.is-flow-step.show {
  transform: none;
  opacity: 1;
}

.ar-modify-sheet.is-under-custom-sheet {
  pointer-events: none;
}

.ar-modify-sheet.is-flow-step .ar-modify-footer-actions .ar-btn-cancel {
  display: none;
}

.ar-modify-sheet.is-flow-step .ar-modify-footer-actions .ar-btn-ai {
  flex: 1;
  width: 100%;
}

.ar-modify-sheet.is-flow-step .ar-flow-preview {
  padding: 0 14px 12px;
}

.ar-modify-sheet.is-flow-step .ar-flow-preview-frame {
  min-height: 96px;
  max-height: 200px;
}

.ar-modify-sheet.is-flow-step #modifyHeadClassic {
  display: none !important;
}

.ar-modify-sheet.is-flow-step .ar-sheet-handle {
  display: none !important;
}

.ar-modify-sheet.is-flow-step .ar-modify-head--flow {
  padding: 8px 12px 10px;
  border-bottom: 1px solid #e8edf3;
  background: #fff;
}

.ar-modify-head--flow {
  align-items: center;
  padding: 6px 12px 10px;
  gap: 6px;
}

.ar-modify-head--flow h2 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
  margin: 0;
  flex: none;
}

.ar-modify-head-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ar-modify-back {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
  min-width: 56px;
  cursor: pointer;
  font-family: inherit;
}

.ar-modify-back i {
  font-size: 11px;
}

.ar-modify-head--flow .ar-modify-close {
  flex-shrink: 0;
}

/* —— AI 修改流程：步骤指示 —— */
.ar-flow-bar-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.ar-flow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1.2;
}

.ar-flow-step {
  font-weight: 500;
  white-space: nowrap;
}

.ar-flow-step.is-active {
  font-weight: 600;
}

.ar-flow-step-line {
  width: 14px;
  height: 1px;
  flex-shrink: 0;
}

.ar-flow-steps--dark .ar-flow-step {
  color: rgba(255, 255, 255, 0.42);
}

.ar-flow-steps--dark .ar-flow-step.is-active {
  color: #60a5fa;
}

.ar-flow-steps--dark .ar-flow-step-line {
  background: rgba(255, 255, 255, 0.22);
}

.ar-flow-steps--light .ar-flow-step {
  color: #94a3b8;
}

.ar-flow-steps--light .ar-flow-step.is-active {
  color: var(--primary);
}

.ar-flow-steps--light .ar-flow-step-line {
  background: #e2e8f0;
}

.ar-flow-preview {
  flex-shrink: 0;
  padding: 0 14px 10px;
  border-bottom: 1px solid #f1f5f9;
  background: #fff;
}

.ar-flow-preview-frame {
  position: relative;
  display: block;
  width: 100%;
  min-height: 72px;
  padding: 0;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  border: 1px solid #e8edf3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  font: inherit;
  color: inherit;
}

.ar-flow-preview-frame:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ar-flow-preview-frame:active {
  opacity: 0.92;
}

.ar-flow-preview-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ar-flow-preview-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}

.ar-flow-preview-caption {
  margin: 6px 0 0;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
}

.ar-erase-overlay.is-flow-hidden {
  visibility: hidden;
  pointer-events: none;
}

.ar-download-sheet {
  visibility: hidden;
}

.ar-download-sheet.show {
  visibility: visible;
}

.ar-sheet-handle {
  width: 36px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin: 8px auto 4px;
  flex-shrink: 0;
}

.ar-modify-head {
  flex-shrink: 0;
  padding: 4px 14px 10px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ar-modify-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.ar-modify-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
}

.ar-modify-body {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4px 14px 12px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.ar-modify-section {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.ar-modify-section--hero {
  padding-top: 8px;
}

.ar-modify-section--last {
  border-bottom: none;
  padding-bottom: 4px;
}

.ar-tag-row--dense {
  margin-bottom: 10px;
}

.ar-modify-section--hero .ar-modify-textarea {
  min-height: 100px;
}

.ar-ai-style-panel {
  margin-top: 10px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #e8edf3;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.ar-ai-style-seg {
  margin-bottom: 14px;
}

.ar-ai-style-head {
  margin-bottom: 12px;
}

.ar-ai-style-scroll {
  margin: 0 -2px;
}

.ar-ai-style-custom .style-custom-hint {
  margin: 0 0 12px;
}

.ar-ai-style-ref-panel {
  min-height: 112px;
}

.ar-ai-style-ref-panel .style-ref-empty i {
  color: #94a3b8;
}

.ar-ai-style-actions {
  margin-top: 12px;
}

.ar-style-card-tabs button {
  height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.ar-style-card-tabs button.is-active {
  background: #fff;
  color: #111827;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.ar-style-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 10px;
}

.ar-style-card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.ar-style-card-more {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
}

.ar-style-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ar-style-card-item {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.ar-style-card-thumb {
  display: block;
  height: 70px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  border: 2px solid transparent;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.ar-style-card-item.is-active .ar-style-card-thumb {
  border-color: #2563eb;
}

.ar-style-card-name {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}

.ar-style-card-thumb--modern { background-image: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(15,23,42,0.08)), url('../assets/styles/light-luxury.jpg'); }
.ar-style-card-thumb--american { background-image: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(15,23,42,0.1)), linear-gradient(135deg, #d9e7f5 0%, #f7f1e7 100%); }
.ar-style-card-thumb--japan { background-image: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(15,23,42,0.1)), linear-gradient(135deg, #f5efe4 0%, #d9cbb8 100%); }
.ar-style-card-thumb--newchinese { background-image: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(15,23,42,0.1)), linear-gradient(135deg, #f1e8de 0%, #c9b39d 100%); }

.ar-ref-block--compact {
  margin-top: 0;
}

/* AI 修改 · 与选品配置联动的空间卡片 */
.ar-modify-zone-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.ar-mz-card {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  overflow: hidden;
}

.ar-mz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.ar-mz-title {
  margin: 0;
  padding-left: 8px;
  border-left: 3px solid var(--primary);
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.ar-mz-add {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ar-mz-body {
  padding: 10px 12px 12px;
  min-height: 44px;
}

.ar-mz-empty {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
  padding: 8px 0;
}

.ar-mz-picked-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ar-mz-picked-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #334155;
}

.ar-mz-picked-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}

.ar-mz-picked-thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
}

.ar-mz-picked-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ar-mz-picked-price {
  flex-shrink: 0;
  font-weight: 700;
  color: #dc2626;
  font-size: 11px;
}

.ar-mz-picked-row--cat .ar-mz-cat-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f0fdfa;
  color: #0d9488;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ar-modify-label {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  letter-spacing: 0.02em;
}

.ar-modify-optional {
  font-weight: 500;
  color: #94a3b8;
  font-size: 11px;
}

.ar-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.ar-tag {
  flex: 0 0 auto;
  white-space: nowrap;
  margin: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ar-tag.active {
  background: #eff6ff;
  color: var(--primary);
  border-color: #93c5fd;
  font-weight: 600;
}

.ar-modify-textarea {
  width: 100%;
  min-height: 80px;
  max-height: 140px;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  resize: vertical;
  font-family: inherit;
  margin: 0;
  line-height: 1.5;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
}

.ar-modify-textarea::placeholder {
  color: #94a3b8;
}

.ar-modify-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ar-ref-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  background: #f8fafc;
}

.ar-ref-block.has-image {
  background: #fff;
}

.ar-ref-list-wrap {
  min-height: 72px;
}

.ar-ref-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 72px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #94a3b8;
  font-size: 12px;
}

.ar-ref-empty i {
  font-size: 20px;
  line-height: 1;
}

.ar-ref-empty[hidden] {
  display: none !important;
}

.ar-ref-list {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ar-ref-list::-webkit-scrollbar {
  display: none;
}

.ar-ref-list[hidden] {
  display: none !important;
}

.ar-ref-item {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #e2e8f0;
}

.ar-ref-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ar-ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

.ar-ref-remove:active {
  background: rgba(15, 23, 42, 0.75);
}

.ar-ref-actions {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.ar-ref-actions--row {
  flex-direction: row;
  gap: 8px;
}

.ar-ref-actions--row .ar-ref-btn {
  flex: 1;
  min-width: 0;
}

.ar-ref-btn {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  min-height: 40px;
  transition: background 0.15s, border-color 0.15s;
}

.ar-ref-btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ar-seg-mini {
  display: flex;
  padding: 3px;
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 10px;
}

.ar-seg-mini button {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 12px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #64748b;
  font-family: inherit;
  cursor: pointer;
  min-height: 36px;
}

.ar-seg-mini button.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.ar-picked-list,
.ar-product-pick {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ar-picked-pick {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.ar-picked-pick:active {
  background: #f8fafc;
  border-color: #94a3b8;
}

.ar-picked-pick-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 18px;
  flex-shrink: 0;
}

.ar-picked-pick-body {
  flex: 1;
  min-width: 0;
}

.ar-picked-pick-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.35;
}

.ar-picked-pick-meta {
  margin-top: 3px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.3;
}

.ar-picked-pick-chevron {
  flex-shrink: 0;
  font-size: 12px;
  color: #cbd5e1;
}

.ar-picked-add-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 4px 0 0;
  margin: 0;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
}

.ar-picked-add-link i {
  font-size: 12px;
}

.ar-picked-add-link:active {
  opacity: 0.7;
}

.ar-picked-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ar-picked-item img,
.ar-picked-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.ar-picked-thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: #94a3b8;
  font-size: 18px;
}

.ar-picked-item-body {
  flex: 1;
  min-width: 0;
}

.ar-picked-item-name {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ar-picked-item-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.3;
}

.ar-picked-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.ar-picked-remove:active {
  background: #e2e8f0;
  color: #334155;
}

.ar-picked-item--pattern {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.ar-picked-item--pattern .ar-picked-item-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.ar-picked-item--pattern .ar-picked-item-body {
  flex: 1;
  min-width: 0;
}

.ar-picked-pattern-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ar-picked-pattern-strip::-webkit-scrollbar {
  display: none;
}

.ar-picked-pattern-cell {
  position: relative;
  flex: 0 0 56px;
  width: 56px;
}

.ar-picked-pattern-cell img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  border: 1px solid #e8edf3;
  background: #f1f5f9;
}

.ar-picked-pattern-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 1;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.ar-modify-footer {
  flex-shrink: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0));
  border-top: 1px solid #e8edf3;
  background: #fafbfc;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
}

.ar-modify-footer-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.ar-ratio-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.ar-ratio-select {
  flex: 1;
  min-width: 0;
  padding: 8px 32px 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  min-height: 40px;
  color: #0f172a;
}

.ar-modify-footer-actions {
  display: flex;
  gap: 10px;
}

.ar-modify-footer-actions .ar-btn-cancel {
  flex: 0.85;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  font-family: inherit;
  min-height: 46px;
}

.ar-modify-footer-actions .ar-btn-ai {
  flex: 1.15;
  padding: 11px 14px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  min-height: 46px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.ar-modify-footer .ar-btn-ai:disabled {
  opacity: 0.5;
}

/* 手机内二级页：统一顶栏 */
.ar-mobile-bar {
  flex-shrink: 0;
  min-height: 48px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.ar-mobile-bar--dark {
  background: rgba(15, 23, 42, 0.92);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.ar-mobile-bar--dark .ar-bar-title {
  color: #fff;
}

.ar-bar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  min-width: 0;
}

.ar-bar-spacer {
  width: 40px;
  flex-shrink: 0;
}

.ar-bar-btn {
  border: none;
  background: #f1f5f9;
  color: #475569;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  min-height: 40px;
  flex-shrink: 0;
}

.ar-mobile-bar--dark .ar-bar-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ar-bar-btn--icon {
  width: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ar-bar-btn--primary {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.ar-mobile-bar--dark .ar-bar-btn--primary {
  background: var(--primary);
  color: #fff;
}

/* 清除画笔（手机内全屏） */
.ar-phone-layer .ar-erase-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #0f172a;
  display: flex;
  flex-direction: column;
}

.ar-erase-overlay[hidden] {
  display: none !important;
}

/* AI 修改流程 · 圈选页浅色主题 */
.ar-erase-overlay.is-modify-flow {
  background: #f8fafc;
}

.ar-erase-overlay.is-modify-flow .ar-erase-canvas-wrap {
  background: #f1f5f9;
}

.ar-erase-overlay.is-modify-flow .ar-mobile-bar {
  background: #fff;
  border-bottom-color: #e8edf3;
}

.ar-erase-overlay.is-modify-flow .ar-bar-title {
  color: #0f172a;
}

.ar-erase-overlay.is-modify-flow .ar-bar-btn {
  background: #f1f5f9;
  color: #475569;
}

.ar-erase-overlay.is-modify-flow .ar-bar-btn--primary {
  background: var(--primary);
  color: #fff;
}

.ar-erase-overlay.is-modify-flow .ar-erase-footer {
  background: #fff;
  border-top: 1px solid #e8edf3;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.05);
}

.ar-erase-overlay.is-modify-flow .ar-erase-history-btn {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
}

.ar-erase-overlay.is-modify-flow .ar-erase-history-btn:disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.ar-erase-overlay.is-modify-flow .ar-erase-history-btn--reset {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.ar-erase-overlay.is-modify-flow .ar-erase-footer-label {
  color: #64748b;
}

.ar-erase-overlay.is-modify-flow .ar-erase-color {
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.ar-erase-overlay.is-modify-flow .ar-erase-color.active {
  border-color: var(--primary);
}

.ar-erase-overlay.is-modify-flow .ar-erase-color.active::after {
  border-color: rgba(37, 99, 235, 0.45);
}

.ar-erase-overlay.is-modify-flow .ar-erase-color[data-color="#ffffff"] {
  border-color: #cbd5e1;
}

.ar-erase-overlay.is-modify-flow .ar-erase-color[data-color="#ffffff"].active {
  border-color: var(--primary);
}

.ar-erase-overlay.is-modify-flow .ar-erase-color[data-color="#ffffff"].active::after {
  border-color: rgba(37, 99, 235, 0.35);
}

.ar-erase-overlay.is-modify-flow .ar-erase-color:focus-visible {
  outline-color: rgba(37, 99, 235, 0.45);
}

.ar-erase-overlay.is-modify-flow .ar-erase-tool-row input[type="range"] {
  accent-color: var(--primary);
}

.ar-erase-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: none;
}

.ar-erase-canvas-wrap img {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.ar-erase-canvas-wrap canvas {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.ar-erase-footer {
  flex-shrink: 0;
  padding: 12px 16px 18px;
  background: rgba(0, 0, 0, 0.55);
}

.ar-erase-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ar-erase-history-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ar-erase-history-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.ar-erase-history-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.ar-erase-history-btn:not(:disabled):active {
  transform: scale(0.98);
}

.ar-erase-history-btn--reset {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(239, 68, 68, 0.14);
}

.ar-erase-history-btn i {
  font-size: 14px;
}

.ar-erase-tool-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ar-erase-footer-label {
  font-size: 13px;
  color: #e2e8f0;
  flex: 0 0 56px;
  flex-shrink: 0;
}

.ar-erase-colors {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.ar-erase-colors::-webkit-scrollbar {
  display: none;
}

.ar-erase-color {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: var(--swatch, #ef4444);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.ar-erase-color::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid transparent;
  pointer-events: none;
  box-sizing: border-box;
}

.ar-erase-color.active {
  border-color: rgba(255, 255, 255, 0.95);
}

.ar-erase-color.active::after {
  border-color: rgba(255, 255, 255, 0.55);
}

.ar-erase-color[data-color="#ffffff"].active {
  border-color: rgba(15, 23, 42, 0.55);
}

.ar-erase-color[data-color="#ffffff"].active::after {
  border-color: rgba(255, 255, 255, 0.85);
}

.ar-erase-color:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

.ar-erase-tool-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

/* 全屏预览（手机内） */
.ar-phone-layer .ar-preview-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #000;
  display: flex;
  flex-direction: column;
}

.ar-phone-layer .ar-preview-overlay.is-elevated {
  z-index: 20;
}

.ar-preview-overlay[hidden] {
  display: none !important;
}



.ar-preview-stage {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}

.ar-preview-composite {
  position: relative;
  flex-shrink: 0;
  transform-origin: center center;
  transition: transform 0.05s linear;
  user-select: none;
}

.ar-preview-composite canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ar-preview-stage img {
  max-width: none;
  max-height: none;
  transform-origin: center center;
  transition: transform 0.05s linear;
  user-select: none;
  -webkit-user-drag: none;
}

.ar-preview-stage img[hidden] {
  display: none !important;
}

.ar-preview-footer {
  flex-shrink: 0;
  padding: 12px 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(0, 0, 0, 0.45);
}

.ar-zoom-hint {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.75);
}

.ar-zoom-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

/* 下载（手机内底部 sheet） */
.ar-phone-layer .ar-download-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 16px 14px 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  pointer-events: auto;
}

.ar-download-sheet.show {
  transform: translateY(0);
}

.ar-sheet-heading {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
  text-align: center;
  color: #0f172a;
}

.ar-sheet-cancel {
  width: 100%;
  margin-top: 4px;
  padding: 14px;
  border: none;
  background: #f1f5f9;
  border-radius: 12px;
  font-size: 15px;
  color: #64748b;
  font-family: inherit;
  cursor: pointer;
  min-height: 48px;
}

.ar-download-sheet .ar-download-opt span {
  flex: 1;
}

.ar-download-opt {
  width: 100%;
  padding: 14px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ar-download-opt i {
  color: var(--primary);
  width: 24px;
  text-align: center;
}

/* 自定义上传产品（手机内底部抽屉） */
.ar-phone-layer .ar-custom-product-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 22;
  max-height: 92%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  visibility: hidden;
}

.ar-custom-product-sheet.show {
  transform: translateY(0);
  visibility: visible;
}

.ar-phone-layer #customProductBackdrop {
  z-index: 21;
}

.ar-custom-sheet-head {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px 10px;
}

.ar-custom-sheet-head-text {
  min-width: 0;
}

.ar-custom-sheet-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.ar-custom-sheet-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.ar-custom-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  flex-shrink: 0;
}

.ar-custom-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px 12px;
}

.ar-custom-field--photos {
  margin-bottom: 14px;
}

.ar-custom-photo-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ar-custom-photo-wrap:not(.has-photos) {
  justify-content: center;
}

.ar-custom-photo-list {
  list-style: none;
  margin: 0;
  padding: 2px 0;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}

.ar-custom-photo-list::-webkit-scrollbar {
  display: none;
}

.ar-custom-photo-list[hidden] {
  display: none !important;
}

.ar-custom-photo-item {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #e2e8f0;
}

.ar-custom-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ar-custom-photo-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
}

.ar-custom-photo-remove:active {
  background: rgba(15, 23, 42, 0.75);
}

.ar-custom-photo-add {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: #94a3b8;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.ar-custom-photo-wrap.has-photos .ar-custom-photo-add {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 10px;
  font-size: 20px;
}

.ar-custom-photo-add:active {
  background: #f1f5f9;
}

.ar-custom-field {
  margin-bottom: 12px;
}

.ar-custom-field--last {
  margin-bottom: 4px;
}

.ar-custom-label {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.ar-custom-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ar-custom-tag {
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  line-height: 1.2;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.ar-custom-tag.active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.ar-custom-select-wrap {
  position: relative;
}

.ar-custom-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 11px 36px 11px 12px;
  font-size: 14px;
  color: #0f172a;
  font-family: inherit;
  min-height: 44px;
}

.ar-custom-select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #94a3b8;
  pointer-events: none;
}

.ar-custom-input,
.ar-custom-textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  padding: 11px 12px;
  font-size: 14px;
  color: #0f172a;
  font-family: inherit;
  box-sizing: border-box;
}

.ar-custom-input {
  min-height: 44px;
}

.ar-custom-textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

.ar-custom-input::placeholder,
.ar-custom-textarea::placeholder {
  color: #94a3b8;
}

.ar-custom-dim-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ar-custom-dim {
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

.ar-custom-sheet-foot {
  flex-shrink: 0;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f1f5f9;
  background: #fff;
}

.ar-custom-sheet-foot .ar-btn-ai,
.ar-custom-submit {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
  -webkit-appearance: none;
  appearance: none;
}

.ar-custom-sheet-foot .ar-btn-ai:active,
.ar-custom-submit:active {
  opacity: 0.92;
}

/* 自定义上传 · polished（AI 结果 / 扩图等 ar-phone-layer） */
.ar-phone-layer .ar-custom-product-sheet--polished {
  max-height: 94%;
  background: #f8fafc;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -1px 0 rgba(15, 23, 42, 0.06),
    0 -24px 64px rgba(15, 23, 42, 0.12);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-sheet-handle {
  width: 40px;
  height: 5px;
  margin-top: 10px;
  background: #cbd5e1;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-head {
  padding: 4px 16px 14px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-head h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.15s ease, transform 0.12s ease;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close:active {
  transform: scale(0.96);
  background: #f1f5f9;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-body {
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-block {
  background: #fff;
  border-radius: 16px;
  border: 1px solid #e8edf3;
  padding: 14px 14px 4px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.04);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-block .ar-custom-field {
  margin-bottom: 14px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-block .ar-custom-field--last {
  margin-bottom: 10px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-label {
  margin-bottom: 4px;
  color: #1e293b;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap:not(.has-photos) {
  justify-content: stretch;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add {
  flex: 1;
  width: 100%;
  max-width: none;
  height: 104px;
  flex-direction: column;
  gap: 8px;
  border: 1.5px dashed #93c5fd;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
  color: #2563eb;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add-text {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  flex-direction: row;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add-text {
  display: none;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-wrap.has-photos .ar-custom-photo-add-icon {
  width: 100%;
  height: 100%;
  border: none;
  box-shadow: none;
  background: transparent;
  font-size: 20px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add:active {
  transform: scale(0.98);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag {
  border-radius: 10px;
  padding: 8px 12px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.28);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag:active {
  transform: scale(0.97);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-select,
.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-input,
.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-textarea {
  border-radius: 12px;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-select:focus,
.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-input:focus,
.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-row {
  gap: 10px;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-cell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim-cap {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  letter-spacing: 0.04em;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-dim {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-foot {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: none;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0) 0%, #f8fafc 24%, #f8fafc 100%);
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit {
  min-height: 50px;
  border-radius: 14px;
  font-size: 16px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
}

.ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit:active {
  transform: scale(0.98);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-tag,
  .ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-submit,
  .ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-sheet-close,
  .ar-phone-layer .ar-custom-product-sheet--polished .ar-custom-photo-add {
    transition: none;
  }
}

/* 版本对比（手机内） */
.ar-phone-layer .ar-compare-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ar-compare-overlay[hidden] {
  display: none !important;
}

.ar-compare-top {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.ar-compare-pickers-row {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.ar-compare-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  color: #64748b;
}

.ar-compare-pick select {
  width: 100%;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-family: inherit;
  background: #f8fafc;
  min-height: 44px;
}

.ar-compare-footer {
  flex-shrink: 0;
  padding: 10px 14px 14px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}

.ar-compare-mode-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.ar-compare-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 52px;
  padding: 6px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  color: #64748b;
  font-size: 10px;
  font-family: inherit;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.12s ease,
    color 0.12s ease,
    border-color 0.12s ease;
}

.ar-compare-mode-btn i {
  font-size: 15px;
  line-height: 1;
}

.ar-compare-mode-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.ar-compare-mode-btn.active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #2563eb;
  font-weight: 600;
}

.ar-compare-mode-btn:active {
  transform: scale(0.97);
}

.ar-compare-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 4px;
  overflow: hidden;
}

.ar-compare-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.ar-compare-stage.is-compare-drag {
  cursor: ew-resize;
}

.ar-compare-stage.is-compare-dragging {
  cursor: grabbing;
}

.ar-compare-stage.is-compare-drag .ar-compare-divider::after {
  box-shadow: 0 2px 14px rgba(37, 99, 235, 0.45);
  border-color: rgba(37, 99, 235, 0.35);
}

.ar-compare-img {
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  object-position: center center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ar-compare-clip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
  z-index: 2;
}

.ar-compare-clip .ar-compare-img {
  max-width: none;
}

.ar-compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.2), 0 0 12px rgba(0, 0, 0, 0.35);
  z-index: 3;
  pointer-events: none;
}

.ar-compare-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(15, 23, 42, 0.12);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.ar-compare-badge {
  position: absolute;
  top: 10px;
  z-index: 4;
  max-width: calc(50% - 20px);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ar-compare-badge--left {
  left: 10px;
}

.ar-compare-badge--right {
  right: 10px;
}

.ar-compare-view {
  position: absolute;
  inset: 0;
}

.ar-compare-view[hidden] {
  display: none !important;
}

.ar-compare-view--side {
  display: block;
  padding: 0;
  background: #0f172a;
  overflow: hidden;
}

.ar-compare-swipe-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.ar-compare-swipe-track {
  display: flex;
  width: 200%;
  height: 100%;
  transform: translateX(0);
  transition: transform 0.28s ease;
  will-change: transform;
}

.ar-compare-swipe-slide {
  flex: 0 0 50%;
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
}

.ar-compare-swipe-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ar-compare-swipe-dots {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 6;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: auto;
}

.ar-compare-swipe-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.ar-compare-swipe-dot.is-active {
  width: 18px;
  background: #fff;
}

.ar-compare-stage.is-compare-swipe {
  cursor: grab;
}

.ar-compare-stage.is-compare-swipe:active {
  cursor: grabbing;
}
