* { box-sizing: border-box; }

img, video {
  max-width: 100%;
}

:root {
  color-scheme: light;
  --primary: #10b981;
  --primary-hover: #059669;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  transition: opacity 0s;
}

body.loading { opacity: 0; }

::selection {
  background: var(--primary);
  color: #fff;
}

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.sticky { position: sticky; }
.inset-0 { inset: 0; }
.inset-4 { inset: 1rem; }
.top-0 { top: 0; }
.top-3 { top: 0.75rem; }
.top-20 { top: 5rem; }
.right-3 { right: 0.75rem; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.left-3 { left: 0.75rem; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }
.z-\[60\] { z-index: 60; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-4 { margin-top: 1rem; }
.mt-auto { margin-top: auto; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.-ml-5 { margin-left: -1.25rem; }
.block { display: block; }
.flex { display: flex; }
.hidden { display: none; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-6 { height: 1.5rem; }
.h-7 { height: 1.75rem; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-56 { height: 14rem; }
.h-auto { height: auto; }
.h-full { height: 100%; }
.min-h-\[1\.25rem\] { min-height: 1.25rem; }
.min-h-\[400px\] { min-height: 400px; }
.min-h-screen { min-height: 100vh; }
.w-3\.5 { width: 0.875rem; }
.w-4 { width: 1rem; }
.w-6 { width: 1.5rem; }
.w-7 { width: 1.75rem; }
.w-9 { width: 2.25rem; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-\[50\%\] { width: 50%; }
.w-auto { width: auto; }
.w-fit { width: fit-content; }
.w-full { width: 100%; }
.max-h-\[65vh\] { max-height: 65vh; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-full { max-width: 100%; }
.max-w-none { max-width: none; }
.flex-1 { flex: 1 1 0%; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.cursor-col-resize { cursor: col-resize; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-2\.5 > :not([hidden]) ~ :not([hidden]) { margin-top: 0.625rem; }
.overflow-hidden { overflow: hidden; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.border { border: 1px solid; }
.border-2 { border: 2px solid; }
.border-b { border-bottom: 1px solid; }
.border-b-2 { border-bottom: 2px solid; }
.border-r-\[1\.5px\] { border-right: 1.5px solid; }
.border-dashed { border-style: dashed; }
.border-white { border-color: #fff; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-primary { border-color: var(--primary); }
.bg-white { background-color: #fff; }
.bg-white\/80 { background-color: rgba(255, 255, 255, 0.8); }
.bg-white\/90 { background-color: rgba(255, 255, 255, 0.9); }
.bg-white\/95 { background-color: rgba(255, 255, 255, 0.95); }
.bg-gray-50\/50 { background-color: rgba(249, 250, 251, 0.5); }
.bg-gray-50\/80 { background-color: rgba(249, 250, 251, 0.8); }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-900 { background-color: #111827; }
.bg-emerald-600 { background-color: #059669; }
.bg-primary { background-color: var(--primary); }
[class*="bg-[url("] {
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgZmlsbD0iI2Y5ZmRmZCI+PHJlY3Qgd2lkdGg9IjEwIiBoZWlnaHQ9IjEwIiBmaWxsPSIjZjJmMmYyIi8+PHJlY3QgeD0iMTAiIHk9IjEwIiB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIGZpbGw9IiNmMmYyZjIiLz48L3N2Zz4=");
}
.p-5 { padding: 1.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.pt-12 { padding-top: 3rem; }
.pb-8 { padding-bottom: 2rem; }
.pb-12 { padding-bottom: 3rem; }
.text-center { text-align: center; }
.font-mono { font-family: Consolas, "SFMono-Regular", monospace; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.tracking-tight { letter-spacing: -0.025em; }
.text-white { color: #fff; }
.text-emerald-100 { color: #d1fae5; }
.text-emerald-500 { color: #10b981; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-primary { color: var(--primary); }
.text-warning { color: #b45309; }
.underline { text-decoration-line: underline; }
.underline-offset-2 { text-underline-offset: 2px; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-\[0_1px_3px_rgba\(0\,0\,0\,0\.2\)\] { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.shadow-\[1px_0_4px_rgba\(0\,0\,0\,0\.15\)\] { box-shadow: 1px 0 4px rgba(0, 0, 0, 0.15); }
.box-content { box-sizing: content-box; }
.backdrop-blur { backdrop-filter: blur(8px); }
.backdrop-blur-sm { backdrop-filter: blur(4px); }
.backdrop-blur-md { backdrop-filter: blur(12px); }
.transition-all { transition-property: all; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; }
.transition-opacity { transition-property: opacity; }
.transition-transform { transition-property: transform; }
.transition-all,
.transition-colors,
.transition-opacity,
.transition-transform {
  transition-duration: 150ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
.duration-100 { transition-duration: 100ms; }
.duration-200 { transition-duration: 200ms; }
.object-contain { object-fit: contain; }
.object-right-bottom { object-position: right bottom; }
.pointer-events-none { pointer-events: none; }
.hover\:bg-black:hover { background-color: #000; }
.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-primary-hover:hover { background-color: var(--primary-hover); }
.hover\:text-black:hover { color: #000; }
.hover\:text-primary:hover,
.hover\:text-primary-hover:hover { color: var(--primary-hover); }
.hover\:text-white:hover { color: #fff; }
.active\:scale-\[0\.98\]:active { transform: scale(0.98); }
.group:hover .group-hover\:border-gray-300 { border-color: #d1d5db; }
.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:scale-105 { transform: scale(1.05); }
.group:hover .group-hover\:text-gray-700 { color: #374151; }
.animate-spin { animation: spin 1s linear infinite; }

.batch-list {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
}

.batch-card {
  display: grid;
  grid-template-columns: minmax(320px, 42%) minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 156px;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  background: #fff;
}

.batch-comparison {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  min-width: 0;
}

.batch-pane {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 132px;
  border-radius: 0.5rem;
  background: #f9fafb;
  overflow: hidden;
}

.batch-pane-label {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  padding: 0.125rem 0.375rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.9);
  color: #374151;
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1rem;
}

.batch-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.batch-main {
  min-width: 0;
  text-align: left;
}

.batch-title {
  margin: 0 0 0.375rem;
  overflow: hidden;
  color: #111827;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-status {
  color: #6b7280;
  font-size: 0.75rem;
  line-height: 1rem;
}

.batch-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.batch-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  transition: transform 100ms, background-color 150ms;
}

.batch-button:active { transform: scale(0.98); }

.batch-button.primary {
  background: var(--primary);
  color: #fff;
}

.batch-button.secondary {
  background: #111827;
  color: #fff;
}

.batch-button svg {
  width: 1rem;
  height: 1rem;
}

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

@media (min-width: 640px) {
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}

@media (min-width: 768px) {
  .md\:inline-block { display: inline-block; }
  .md\:flex-row { flex-direction: row; }
  .md\:w-64 { width: 16rem; }
  .md\:text-base { font-size: 1rem; line-height: 1.5rem; }
  .md\:text-xl { font-size: 1.25rem; line-height: 1.75rem; }
  .md\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
}

@media (max-width: 767px) {
  .batch-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .batch-pane {
    height: 116px;
  }

  .batch-actions {
    justify-content: flex-end;
  }
}

@media (min-width: 1024px) {
  .lg\:w-72 { width: 18rem; }
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
}

/* DevCart Themes */
html.theme-midnight body {
  background-color: #000000 !important;
  color: #f1f5f9 !important;
}
html.theme-midnight .glass-panel,
html.theme-midnight .glass-nav {
  background: rgba(10, 10, 10, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}
html.theme-midnight #uploadArea {
  background-color: rgba(12, 16, 22, 0.8) !important;
}

/* Pristine High-Contrast Light Mode */
html.theme-light body {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}
html.theme-light .glass-panel {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(203, 213, 225, 0.9) !important;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.06), 0 4px 12px -2px rgba(0, 0, 0, 0.03) !important;
}
html.theme-light .glass-nav {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom-color: rgba(203, 213, 225, 0.8) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
}
html.theme-light #uploadArea {
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
html.theme-light #uploadArea:hover {
  background-color: #ffffff !important;
  border-color: #059669 !important;
}

/* Preserve White Text inside Dark/Colored Buttons & Badges */
html.theme-light .bg-brand-600,
html.theme-light .bg-brand-500,
html.theme-light .bg-brand-700,
html.theme-light .bg-gray-800,
html.theme-light .bg-gray-900,
html.theme-light .bg-black,
html.theme-light button.bg-brand-600,
html.theme-light a.bg-brand-600,
html.theme-light .badge-white {
  color: #ffffff !important;
}
html.theme-light .bg-brand-600 .text-white,
html.theme-light .bg-brand-500 .text-white,
html.theme-light .bg-gray-800 .text-white,
html.theme-light .bg-gray-900 .text-white,
html.theme-light .bg-black .text-white,
html.theme-light button .text-white,
html.theme-light a.bg-brand-600 span,
html.theme-light a.bg-brand-600 svg {
  color: #ffffff !important;
  fill: currentColor;
}

/* Light Mode Text Contrast Rules for Headings & Body */
html.theme-light h1,
html.theme-light h2,
html.theme-light h3,
html.theme-light h4,
html.theme-light h5,
html.theme-light h6,
html.theme-light .text-white:not(button *):not(a.bg-brand-600 *):not(.bg-brand-600 *):not(.bg-gray-800 *):not(.bg-gray-900 *):not(.bg-black *) {
  color: #0f172a !important;
}

html.theme-light .text-gray-400,
html.theme-light .text-gray-300,
html.theme-light .text-gray-200 {
  color: #334155 !important;
}

html.theme-light .text-gray-500 {
  color: #64748b !important;
}

/* High Contrast Emerald for Accents & Icons in Light Mode */
html.theme-light .text-brand-400 {
  color: #047857 !important;
}
html.theme-light .text-brand-300 {
  color: #065f46 !important;
}
html.theme-light .bg-brand-500\/10 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #047857 !important;
}
html.theme-light .bg-brand-500\/10 svg {
  color: #047857 !important;
  stroke: #047857 !important;
}

html.theme-light .gradient-text {
  background: linear-gradient(135deg, #059669 0%, #047857 50%, #2563eb 100%) !important;
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

html.theme-light .bg-darkpanel,
html.theme-light .bg-darkcard,
html.theme-light .bg-darkbg {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
}

html.theme-light .border-gray-800,
html.theme-light .border-gray-700 {
  border-color: #cbd5e1 !important;
}

html.theme-light table thead {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html.theme-light table tbody tr {
  border-bottom-color: #e2e8f0 !important;
}
html.theme-light table td {
  color: #334155 !important;
}

html.theme-light #privacyModal .glass-panel,
html.theme-light #aboutModal .glass-panel {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.theme-light footer {
  background-color: #f1f5f9 !important;
  border-top-color: #e2e8f0 !important;
}

html.theme-light .toast-notice {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15) !important;
}

/* High-Precision Interactive Animations */
@keyframes scanline {
  0% { transform: translateY(-100%); opacity: 0; }
  20% { opacity: 0.9; }
  80% { opacity: 0.9; }
  100% { transform: translateY(500px); opacity: 0; }
}

.scanline-active {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, #34d399, #10b981, transparent);
  box-shadow: 0 0 16px #10b981, 0 0 32px #34d399;
  animation: scanline 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
  z-index: 35;
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 25px -5px rgba(16, 185, 129, 0.3); }
  50% { box-shadow: 0 0 45px 0px rgba(16, 185, 129, 0.65); }
}

.pulse-glow {
  animation: pulseGlow 2.5s ease-in-out infinite;
}

@keyframes fadeInScale {
  0% { opacity: 0; transform: scale(0.97); }
  100% { opacity: 1; transform: scale(1); }
}

.fade-in-scale {
  animation: fadeInScale 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #111827;
  color: #ffffff;
  padding: 0.875rem 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(16, 185, 129, 0.4);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(16, 185, 129, 0.3);
  font-size: 0.875rem;
  font-weight: 600;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
