:root {
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --amazon-blue: #146eb4;
  --amazon-orange: #ff9900;
  --surface: #ffffff;
  --bg: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 10px;
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hero-sec {
  max-width: 1080px;
  margin: 1.5rem auto 1rem auto;
  padding: 0 1.25rem;
  text-align: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  padding: 3px 12px;
  border-radius: 20px;
  margin-bottom: 0.6rem;
  border: 1px solid #fde68a;
}
.hero-title {
  font-size: 1.95rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.4rem;
  color: #0f172a;
}
.hero-sub {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 720px;
  margin: 0 auto;
}

.container {
  max-width: 1080px;
  margin: 0 auto 3rem auto;
  padding: 0 1.25rem;
}
.main-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 3rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: all 0.2s ease;
  position: relative;
}
.dropzone:hover, .dropzone.dragover {
  border-color: #f59e0b;
  background: #fffbeb;
}
.dropzone-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem auto;
  color: #f59e0b;
  display: block;
}
.dropzone-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.35rem;
}
.dropzone-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
}
/* AI Scan Sweep Showcase (Ultra-lightweight GPU CSS) */
.ai-scan-stage {
  position: relative;
  width: 100% !important;
  max-width: 480px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  user-select: none;
  background: #ffffff;
  cursor: pointer;
}
.ai-scan-stage.is-draggable,
.ba-slider-stage.is-draggable,
#baSliderContainer.is-draggable,
.ba-slider-stage.finished-mode,
#baSliderContainer.finished-mode {
  cursor: grab !important;
}
.ai-scan-stage.is-dragging,
.ba-slider-stage.is-dragging,
#baSliderContainer.is-dragging {
  cursor: grabbing !important;
}

.stage-control-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
}
.stage-ctrl-btn {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: all 0.15s ease;
  padding: 0;
}
.stage-ctrl-btn:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}
.stage-ctrl-btn:active {
  transform: translateY(0);
}

/* Layer 1: Pure white compliant 1:1 result underneath */
.ai-scan-clean-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #ffffff;
}
.ai-scan-clean-layer canvas, .ai-scan-clean-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Layer 2: Raw studio photo on top, swept away by the beam */
.ai-scan-text-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  animation: aiWhiteWipe 5.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: clip-path, opacity;
}
.ai-scan-text-layer canvas, .ai-scan-text-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Layer 3: The AI Sweeping Glowing Light Beam (Amazon Warm Gold Aura) */
.ai-scan-beam {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 3.5px;
  background: #ffffff;
  z-index: 5;
  pointer-events: none;
  animation: aiWhiteBeamSweep 5.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  will-change: left, opacity;
  box-shadow: 
    0 0 10px 2px #fbbf24,
    0 0 24px 6px rgba(245, 158, 11, 0.9),
    0 0 48px 12px rgba(217, 119, 6, 0.6);
}

.ai-scan-beam-glow {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 100%;
  width: 90px;
  background: linear-gradient(to left, rgba(245, 158, 11, 0.4), rgba(251, 191, 36, 0.15), transparent);
  pointer-events: none;
}

/* AI Status Badge */
.ai-scan-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  z-index: 10;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(10px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.ai-scan-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
  animation: aiDotPulse 1.5s ease-in-out infinite;
}
@keyframes aiDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

@keyframes aiWhiteWipe {
  0%, 15% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
  45% {
    clip-path: inset(0 0 0 100%);
    opacity: 1;
  }
  75% {
    clip-path: inset(0 0 0 100%);
    opacity: 1;
  }
  85% {
    clip-path: inset(0 0 0 100%);
    opacity: 0;
  }
  90% {
    clip-path: inset(0 0 0 0);
    opacity: 0;
  }
  96%, 100% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

@keyframes aiWhiteBeamSweep {
  0%, 14% {
    left: 0%;
    opacity: 0;
  }
  15% {
    left: 0%;
    opacity: 1;
  }
  45% {
    left: 100%;
    opacity: 1;
  }
  48%, 100% {
    left: 100%;
    opacity: 0;
  }
}
.canvas-floating-upload {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  user-select: none;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  width: auto;
  max-width: 90%;
}
.btn-cutout-minimal {
  position: relative;
  overflow: hidden;
  padding: 9px 24px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-cutout-minimal:hover {
  background: #f8fafc;
  border-color: #f59e0b;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}
.btn-cutout-minimal:active {
  transform: translateY(0);
}
.btn-upload-svg {
  width: 16px;
  height: 16px;
  stroke: #f59e0b;
  flex-shrink: 0;
}
.upload-specs-hint {
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 3px 12px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.03em;
}

/* Audit Result Workspace */
.audit-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Sleek Unified Action Bar */
.audit-action-bar {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.35rem;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  gap: 1rem;
}
.audit-bar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}
.score-badge-circle {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 900;
  background: #ecfdf5;
  border: 2.5px solid #10b981;
  color: #047857;
  flex-shrink: 0;
}
.score-badge-circle.warn {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}
.score-badge-circle.fail {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}
.audit-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}
.audit-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.audit-title-row h3 {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
}
.compliance-tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}
.compliance-tag.pass {
  background: #d1fae5;
  color: #047857;
}
.compliance-tag.warn {
  background: #fef3c7;
  color: #b45309;
}
.compliance-tag.fail {
  background: #fee2e2;
  color: #b91c1c;
}
.audit-meta p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.4;
}

.audit-bar-actions {
  display: grid;
  grid-template-columns: 1.15fr 1.4fr auto;
  gap: 10px;
  width: 100%;
  padding-top: 0.85rem;
  border-top: 1px solid #f1f5f9;
}
@media (max-width: 768px) {
  .audit-bar-actions {
    grid-template-columns: 1fr;
  }
}
.btn-primary-action {
  background: #0f172a;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-width: 0;
}
.btn-primary-action:hover {
  background: #1e293b;
  transform: translateY(-1px);
}
.btn-export-action {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
  transition: all 0.15s ease;
  white-space: nowrap;
  min-width: 0;
}
.btn-export-action:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
}
.btn-secondary-action {
  background: #f8fafc;
  color: #475569;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-secondary-action:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* 5 Dimensions Sleek Capsules Strip */
.audit-capsules-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
@media (max-width: 900px) {
  .audit-capsules-strip {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
}
.capsule-pill {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  min-height: 56px;
  min-width: 0;
  overflow: hidden;
  transition: all 0.18s ease;
}
.capsule-pill.pass {
  border-color: #a7f3d0;
  background: #f0fdf4;
}
.capsule-pill.warn {
  border-color: #fde68a;
  background: #fffdf5;
}
.capsule-pill.fail {
  border-color: #fecaca;
  background: #fff5f5;
}
.capsule-pill .capsule-icon {
  display: none;
}
.capsule-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.capsule-pill.pass .capsule-label { color: #065f46; }
.capsule-pill.warn .capsule-label { color: #92400e; }
.capsule-pill.fail .capsule-label { color: #991b1b; }

.capsule-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.capsule-pill.pass .capsule-val { color: #047857; }
.capsule-pill.warn .capsule-val { color: #b45309; }
.capsule-pill.fail .capsule-val { color: #b91c1c; }

/* Comparison Stage */
.preview-stage-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 768px) {
  .preview-stage-row {
    grid-template-columns: 1fr;
  }
}
.preview-stage-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.preview-stage-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.75rem;
}
.canvas-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.03);
}
.canvas-wrap canvas, .canvas-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* Action Bottom Bar */
.action-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}
.btn-primary-action {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  border: none;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.8rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4);
}
.btn-secondary-action {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.75rem 1.4rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-secondary-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

/* In-Canvas Processing Overlay (工作状态完整覆盖在画布正上方) */
.canvas-processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: rgba(15, 23, 42, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 1.5rem;
  text-align: center;
  border-radius: inherit;
  pointer-events: auto;
  user-select: none;
}

.processing-spinner {
  width: 46px;
  height: 46px;
  border: 3.5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: amzSpinnerSpin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes amzSpinnerSpin {
  to { transform: rotate(360deg); }
}

.processing-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.processing-tip {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  max-width: 320px;
  line-height: 1.45;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
