* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  background: radial-gradient(circle at top right, #efe7ff 0%, #f6f7fb 36%, #eef3ff 100%);
  color: #111827;
}

.page {
  min-height: 100dvh;
  padding: 32px 18px 48px;
}

.shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

.hero {
  margin-bottom: 18px;
}

.hero h1 {
  margin: 12px 0 8px;
  font-size: clamp(28px, 4.8vw, 40px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #d8d4ff;
  color: #5b47ca;
  background: #f7f5ff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
}

.badge-icon {
  font-size: 15px;
}

.desc {
  margin: 0;
  color: #4b5563;
  line-height: 1.7;
}

.card {
  background: #ffffff;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(31, 41, 55, 0.08);
  border: 1px solid #eef1f6;
}

.upload-card {
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 20px;
}

.section-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: #f2f5ff;
  font-size: 18px;
}

.upload-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #1f2937;
}

#images {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border-radius: 16px;
  border: 1.5px dashed #cdd5e7;
  background: linear-gradient(180deg, #fbfcff 0%, #f6f8ff 100%);
  min-height: 150px;
  text-align: center;
  cursor: pointer;
  padding: 16px;
  transition: all 0.2s ease;
}

.dropzone:hover {
  border-color: #95a6ff;
  background: linear-gradient(180deg, #f8f9ff 0%, #f1f4ff 100%);
}

.dropzone-icon {
  font-size: 24px;
}

.dropzone-title {
  font-weight: 700;
  color: #1f2937;
}

.dropzone-subtitle {
  color: #6b7280;
  font-size: 13px;
}

.meta-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tip {
  margin: 0;
  color: #6b7280;
  font-size: 13px;
}

.safe-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid #d8e3ff;
  background: #f5f9ff;
  padding: 5px 10px;
  font-size: 12px;
  color: #2563eb;
  font-weight: 600;
}

.preview-panel {
  margin-top: 14px;
}

.preview-title {
  margin: 0 0 8px 0;
  font-size: 13px;
  color: #4b5563;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}

.preview-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dde4f6;
  background: #f8faff;
  aspect-ratio: 1 / 1;
}

.preview-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  box-shadow: none;
}

.preview-remove:hover {
  transform: none;
  box-shadow: none;
  background: #ef4444;
}

.progress-panel {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid #dce5ff;
  border-radius: 12px;
  background: #f7faff;
}

.progress-text-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #334155;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8ff;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb 0%, #6d4dff 100%);
  transition: width 0.2s ease;
}

button {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #3569ff 0%, #5d44ff 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(53, 105, 255, 0.34);
}

button:disabled {
  background: #9aa8d7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.result {
  margin-top: 0;
}

.result-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hidden {
  display: none;
}

.block {
  margin: 0;
  border: 1px solid #edf0f5;
  border-radius: 14px;
  padding: 14px;
  background: #fcfdff;
}

.block-wide {
  grid-column: 1 / -1;
}

.block-title {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #3f4b68;
  display: flex;
  align-items: center;
  gap: 8px;
}

.block-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #eef3ff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.block-content {
  margin: 0;
  color: #1f2937;
  line-height: 1.55;
  font-size: 14px;
  word-break: break-word;
}

pre.block-content {
  background: #f4f7ff;
  border-radius: 10px;
  padding: 10px;
  overflow-x: auto;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.chip {
  border: 1px solid #d5dcf4;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  color: #2b3857;
  background: #f5f8ff;
}

.actions {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.secondary {
  margin-top: 0;
  max-width: 180px;
  background: #1f2937;
}

.error {
  grid-column: 1 / -1;
  color: #b42318;
  font-size: 14px;
  margin: 0;
  border: 1px solid #fbd2d2;
  border-radius: 12px;
  background: #fff5f5;
  padding: 11px 12px;
}

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

@media (max-width: 640px) {
  .page {
    padding: 18px 12px 32px;
  }

  .card {
    border-radius: 16px;
    padding: 16px;
  }

  .hero h1 {
    font-size: 26px;
  }
}
