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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 16px rgba(0,0,0,.1);
  padding: 36px;
  width: 100%;
  max-width: 720px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 28px;
  color: #111;
}

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 6px;
}

input[type="url"], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: .95rem;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 10px;
  font-family: inherit;
}

input[type="url"]:focus, textarea:focus {
  border-color: #4f7ef8;
}

textarea {
  resize: vertical;
  min-height: 80px;
  margin-bottom: 18px;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.url-col {
  display: flex;
  flex-direction: column;
}

.url-col input[type="url"] {
  margin-bottom: 10px;
}

.url-preview {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: contain;
  border: 1px solid #eee;
  border-radius: 6px;
  margin-bottom: 16px;
  background: #fafafa;
}

button {
  width: 100%;
  padding: 12px;
  background: #4f7ef8;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}

button:hover:not(:disabled) { background: #3a6ae0; }
button:disabled { background: #9ab4f8; cursor: not-allowed; }

.status {
  margin-top: 24px;
  text-align: center;
  font-size: .9rem;
  color: #666;
  min-height: 24px;
}

.status.error { color: #d93025; }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #ccc;
  border-top-color: #4f7ef8;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

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

.result {
  margin-top: 24px;
  text-align: center;
  display: none;
}

.result img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid #eee;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}

.result-actions a {
  font-size: .85rem;
  color: #4f7ef8;
  text-decoration: none;
}

.result-actions a:hover { text-decoration: underline; }

#regenerateBtn {
  width: auto;
  padding: 8px 18px;
  background: #fff;
  color: #4f7ef8;
  border: 1.5px solid #4f7ef8;
  font-size: .9rem;
}

#regenerateBtn:hover:not(:disabled) {
  background: #f0f4ff;
}

@media (max-width: 600px) {
  body {
    align-items: flex-start;
    padding: 16px;
  }

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

  h1 {
    font-size: 1.2rem;
    margin-bottom: 20px;
  }

  .url-row {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 0;
  }

  .url-col input[type="url"] {
    margin-bottom: 8px;
  }

  .url-preview {
    margin-bottom: 18px;
  }
}
