* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8fafc;
  color: #1e293b;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0f172a;
}

.subtitle {
  margin-top: 6px;
  color: #64748b;
  font-size: 1rem;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e2e8f0;
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
}

.tab.active {
  color: #0f172a;
  border-bottom-color: #3b82f6;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-group {
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: #334155;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.radio-card {
  position: relative;
  cursor: pointer;
}

.radio-card input {
  position: absolute;
  opacity: 0;
}

.radio-card span {
  display: block;
  padding: 12px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  text-align: center;
  font-weight: 500;
  background: white;
  transition: all 0.15s;
  font-size: 0.95rem;
}

.radio-card input:checked + span {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}

.generate-btn {
  width: 100%;
  padding: 14px 20px;
  background: #0f172a;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.generate-btn:hover:not(:disabled) {
  background: #1e293b;
}

.generate-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-section {
  margin-top: 32px;
  padding: 24px;
  background: white;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.result-section.hidden {
  display: none;
}

.image-container {
  text-align: center;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

.image-container img {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.loading {
  color: #64748b;
  font-weight: 500;
}

.error {
  color: #dc2626;
  background: #fef2f2;
  padding: 12px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.prompt-details {
  margin-top: 20px;
}

.prompt-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #475569;
}

.prompt-output {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 10px;
  max-height: 300px;
  overflow-y: auto;
}

.image-preview {
  margin-top: 10px;
  max-width: 180px;
}

.image-preview img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.image-preview.hidden {
  display: none;
}

.tip {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.45;
}

.load-btn {
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.load-btn:hover:not(:disabled) {
  background: #eef2f7;
  border-color: #94a3b8;
}

.load-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.download-btn {
  display: inline-block;
  margin-top: 14px;
  padding: 10px 18px;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.download-btn:hover {
  background: #1e293b;
}

footer {
  margin-top: 50px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  header h1 {
    font-size: 1.7rem;
  }
  .container {
    padding: 24px 16px;
  }
}
