* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans TC", sans-serif;
  background: #0f0f13;
  color: #e0e0e0;
  min-height: 100vh;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 40px;
}

h1 {
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.subtitle {
  color: #888;
  font-size: 0.95rem;
}

/* Upload Area */
.upload-area {
  border: 2px dashed #333;
  border-radius: 16px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #16161d;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: #a78bfa;
  background: #1a1a2e;
}

.upload-icon {
  color: #555;
  margin-bottom: 16px;
  transition: color 0.3s;
}

.upload-area:hover .upload-icon {
  color: #a78bfa;
}

.upload-text {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 8px;
}

.upload-hint {
  font-size: 0.85rem;
  color: #666;
}

/* Processing */
.processing-section {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #222;
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

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

#progress-text {
  color: #aaa;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: #222;
  border-radius: 3px;
  margin: 0 auto;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a78bfa, #60a5fa);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Result */
.result-section {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .comparison {
    grid-template-columns: 1fr;
  }
}

.image-panel h3 {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 10px;
  font-weight: 500;
}

.image-wrapper {
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a24;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.image-wrapper img {
  max-width: 100%;
  max-height: 450px;
  display: block;
  object-fit: contain;
}

.checkerboard {
  background-image:
    linear-gradient(45deg, #1e1e2a 25%, transparent 25%),
    linear-gradient(-45deg, #1e1e2a 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1e1e2a 75%),
    linear-gradient(-45deg, transparent 75%, #1e1e2a 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #141420;
}

/* Actions */
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, #a78bfa, #7c5ce0);
  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3);
}

.btn-secondary {
  background: #222230;
  color: #ccc;
}

.btn-secondary:hover {
  background: #2a2a3a;
}

/* Error */
.error-section {
  text-align: center;
  padding: 40px 20px;
}

.error-section p {
  color: #f87171;
  margin-bottom: 16px;
}

/* Utility */
.hidden {
  display: none !important;
}
