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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  min-height: 100vh;
}

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

h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.subtitle {
  color: #6e6e73;
  margin-bottom: 32px;
}

/* Upload */
.upload-area {
  border: 2px dashed #d2d2d7;
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.upload-area:hover { border-color: #0071e3; }
.upload-area.drag-over { border-color: #0071e3; background: #f0f6ff; }

.upload-placeholder {
  text-align: center;
  color: #6e6e73;
  padding: 40px;
}
.upload-placeholder svg { margin-bottom: 12px; opacity: 0.5; }
.upload-placeholder p { font-size: 1rem; margin-bottom: 6px; }
.upload-placeholder span { font-size: 0.8rem; }

.preview-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  display: block;
}

/* Options */
.options {
  margin: 28px 0;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
}
.options h3 { font-size: 1rem; margin-bottom: 16px; color: #1d1d1f; }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1.5px solid #d2d2d7;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.checkbox-item:has(input:checked) {
  border-color: #0071e3;
  background: #f0f6ff;
  color: #0071e3;
}
.checkbox-item input { width: 16px; height: 16px; accent-color: #0071e3; }
.checkbox-item span { font-size: 0.9rem; }

.sliders { display: flex; flex-direction: column; gap: 16px; }

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slider-row label { font-size: 0.85rem; color: #6e6e73; }
.slider-row input[type=range] { width: 100%; accent-color: #0071e3; }

/* Simulate button */
.btn-simulate {
  width: 100%;
  padding: 16px;
  background: #0071e3;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-simulate:hover:not(:disabled) { background: #0077ed; }
.btn-simulate:disabled { background: #b0c4de; cursor: not-allowed; }

/* Loading */
.loading {
  text-align: center;
  margin-top: 32px;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #d2d2d7;
  border-top-color: #0071e3;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: #6e6e73; line-height: 1.6; }

/* Result */
.result-area {
  margin-top: 36px;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
}
.result-area h3 { margin-bottom: 20px; }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.compare-item p {
  font-size: 0.8rem;
  color: #6e6e73;
  margin-bottom: 8px;
  text-align: center;
}
.compare-item img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.btn-download {
  display: block;
  text-align: center;
  padding: 12px;
  border: 1.5px solid #0071e3;
  color: #0071e3;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.9rem;
  transition: all 0.15s;
}
.btn-download:hover { background: #f0f6ff; }

/* Error */
.error {
  margin-top: 20px;
  background: #fff0f0;
  border: 1px solid #ffb3b3;
  border-radius: 10px;
  padding: 14px 18px;
  color: #c00;
  font-size: 0.9rem;
}

.hidden { display: none !important; }

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