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

body {
  font-family: system-ui, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  color: #1a1a1a;
}

h1 { font-size: 1.6rem; margin-bottom: 0.25rem; }
p.subtitle { color: #666; margin-bottom: 2rem; font-size: 0.95rem; }

.workspace {
  width: 100%;
  max-width: 1160px;
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 560px);
  justify-content: center;
  gap: 2rem;
  align-items: start;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.upload-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.upload-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #555;
  margin-bottom: 0.5rem;
}

.preview-area {
  width: 100%;
  aspect-ratio: 3/4;
  border: 2px dashed #d0d0d0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  background: #fafafa;
  transition: border-color 0.2s;
}
.preview-area:hover { border-color: #888; }
.preview-area img { width: 100%; height: 100%; object-fit: cover; display: none; }
.preview-area span { font-size: 0.85rem; color: #aaa; pointer-events: none; }

input[type="file"] { display: none; }

button[type="submit"] {
  width: 100%;
  padding: 0.75rem;
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
button[type="submit"]:hover:not(:disabled) { background: #333; }
button[type="submit"]:disabled { background: #999; cursor: not-allowed; }

#status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: #555;
  text-align: center;
  min-height: 1.4em;
}

#result-section {
  width: 100%;
  display: none;
}
#result-section h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
#result-img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

#error-msg {
  color: #c0392b;
  background: #fdecea;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: none;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 560px);
  }

  #result-section {
    margin-top: 2rem;
  }
}
