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

:root {
  --bg: #0a0a0f;
  --surface: #13131a;
  --surface-hover: #1a1a24;
  --border: #2a2a3a;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
  --radius-sm: 8px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Navigation ─── */
.navbar {
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(10, 10, 15, 0.8);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-light {
  font-weight: 400;
  color: var(--text-muted);
}

.nav-badge {
  background: var(--primary-glow);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* ─── Hero ─── */
.hero {
  text-align: center;
  padding: 3rem 1.5rem 2rem;
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.gradient-text {
  background: linear-gradient(135deg, #6366f1, #a78bfa, #6366f1);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 4s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.subtitle {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0.75rem auto 0;
  font-size: 1.05rem;
}

/* ─── Container ─── */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

/* ─── Form Card ─── */
.generator-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ─── Generate Button ─── */
#generate-btn {
  width: 100%;
  padding: 0.85rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#generate-btn:hover { opacity: 0.9; }
#generate-btn:active { transform: scale(0.98); }
#generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-spinner { display: inline-flex; align-items: center; gap: 0.4rem; }
.hidden { display: none !important; }

.animate-spin {
  animation: spin 1s linear infinite;
}

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

/* ─── Result Section ─── */
.result-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  margin-bottom: 1rem;
}

.result-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.result-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-badge {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-description-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.meta-description-box strong {
  color: var(--text);
}

.content-preview {
  line-height: 1.8;
  font-size: 0.95rem;
}

.content-preview h2 { font-size: 1.25rem; margin: 1.5rem 0 0.75rem; color: var(--text); }
.content-preview h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; color: var(--text); }
.content-preview p { margin-bottom: 0.85rem; color: #c8c8d8; }
.content-preview ul, .content-preview ol { margin: 0 0 0.85rem 1.5rem; color: #c8c8d8; }
.content-preview li { margin-bottom: 0.3rem; }
.content-preview strong { color: var(--text); }

.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.btn-secondary {
  padding: 0.55rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--primary);
  background: var(--surface-hover);
}

/* ─── Error ─── */
.error-section {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  animation: fadeIn 0.4s ease;
}

.error-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
#error-message { color: var(--error); font-size: 0.9rem; }

/* ─── Footer ─── */
.footer {
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.75rem; }
  .form-row { grid-template-columns: 1fr; }
  .result-actions { flex-direction: column; }
  .btn-secondary { width: 100%; text-align: center; }
}