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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #222;
  --border: #333;
  --text: #f0f0f0;
  --text-muted: #777;
  --accent: #9b59b6;
  --accent-hover: #8e44ad;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max: 960px;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Nav ---- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 32px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(15,15,15,0.9);
  backdrop-filter: blur(8px); z-index: 10;
}
.nav-logo { font-size: 16px; font-weight: 700; color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---- Buttons ---- */
.btn-primary, .btn-secondary {
  display: inline-block; padding: 10px 20px;
  border-radius: 6px; font-size: 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface); text-decoration: none; }
.btn-sm { background: var(--accent); color: #fff; padding: 6px 14px; border-radius: 5px; font-size: 13px; }
.btn-sm:hover { background: var(--accent-hover); text-decoration: none; color: #fff; }

/* ---- Hero ---- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: 80px 32px 60px;
  text-align: center;
}
.hero-badge {
  display: inline-block; padding: 4px 14px;
  background: rgba(155,89,182,0.15); border: 1px solid rgba(155,89,182,0.3);
  border-radius: 100px; font-size: 13px; color: var(--accent);
  margin-bottom: 24px;
}
.hero h1 { font-size: 52px; font-weight: 800; line-height: 1.1; margin-bottom: 20px; letter-spacing: -1px; }
.hero-sub { font-size: 18px; color: var(--text-muted); margin-bottom: 32px; max-width: 520px; margin-left: auto; margin-right: auto; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.hero-sub-note { font-size: 12px; color: var(--text-muted); }

/* ---- How it works ---- */
.how { background: var(--surface); padding: 60px 32px; text-align: center; }
.how h2 { font-size: 32px; font-weight: 700; margin-bottom: 40px; }
.steps {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 32px; max-width: var(--max); margin: 0 auto;
}
.step { padding: 24px; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { color: var(--text-muted); font-size: 14px; }

/* ---- Features ---- */
.features { padding: 60px 32px; max-width: var(--max); margin: 0 auto; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 24px; }
.feature-card {
  padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.feature-icon { font-size: 28px; margin-bottom: 12px; }
.feature-card h3 { font-size: 15px; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--text-muted); }

/* ---- Pricing ---- */
.pricing { padding: 60px 32px; text-align: center; background: var(--surface); }
.pricing h2 { font-size: 32px; font-weight: 700; margin-bottom: 12px; }
.pricing-sub { color: var(--text-muted); margin-bottom: 40px; }
.pricing-grid { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; max-width: 600px; margin: 0 auto 48px; }
.plan-card {
  position: relative;
  flex: 1; min-width: 220px; max-width: 260px;
  padding: 28px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; text-align: left; display: flex; flex-direction: column; gap: 16px;
}
.plan-card.featured { border-color: var(--accent); }
.plan-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 12px; border-radius: 100px;
}
.plan-card h3 { font-size: 18px; }
.price { font-size: 36px; font-weight: 800; }
.price span { font-size: 16px; font-weight: 400; color: var(--text-muted); }
.plan-card ul { list-style: none; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.plan-card ul li { font-size: 13px; color: var(--text-muted); padding-left: 16px; position: relative; }
.plan-card ul li::before { content: '✓'; position: absolute; left: 0; color: var(--accent); }

.token-packs { max-width: 560px; margin: 0 auto; text-align: left; }
.token-packs h3 { font-size: 20px; margin-bottom: 8px; }
.token-packs > p { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.pack-table { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pack-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
  padding: 10px 16px; font-size: 14px;
}
.pack-row.header { background: var(--surface); font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.pack-row:not(.header) { border-top: 1px solid var(--border); }
.pack-row:not(.header):hover { background: rgba(155,89,182,0.05); }

/* ---- Recraft credit ---- */
.recraft-credit { padding: 40px 32px; text-align: center; }
.recraft-inner { max-width: 480px; margin: 0 auto; }
.recraft-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.recraft-link { display: block; font-size: 24px; font-weight: 700; color: var(--text); margin: 8px 0; }
.recraft-inner p { font-size: 13px; color: var(--text-muted); }

/* ---- Footer ---- */
.footer {
  padding: 24px 32px; border-top: 1px solid var(--border);
  display: flex; gap: 24px; align-items: center; font-size: 13px; color: var(--text-muted);
}
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* ---- Auth forms ---- */
.auth-page {
  max-width: 400px; margin: 60px auto; padding: 0 24px;
}
.auth-page h1 { font-size: 28px; margin-bottom: 8px; }
.auth-page .sub { color: var(--text-muted); margin-bottom: 32px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.auth-form input {
  width: 100%; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px;
}
.auth-form input:focus { outline: none; border-color: var(--accent); }
.auth-form .btn-primary { padding: 11px; font-size: 14px; border: none; }
.error-banner { padding: 10px 12px; background: rgba(231,76,60,0.1); border: 1px solid rgba(231,76,60,0.3); border-radius: 6px; font-size: 13px; color: #e74c3c; }
.success-banner { padding: 10px 12px; background: rgba(39,174,96,0.1); border: 1px solid rgba(39,174,96,0.3); border-radius: 6px; font-size: 13px; color: #27ae60; }
.auth-switch { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 8px; }

/* ---- Dashboard ---- */
.dash-page { max-width: 800px; margin: 0 auto; padding: 40px 32px; }
.dash-header { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.dash-header h1 { font-size: 24px; flex: 1; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 40px; }
.dash-stat {
  padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px;
}
.dash-stat-value { font-size: 32px; font-weight: 700; }
.dash-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.dash-section { margin-bottom: 32px; }
.dash-section h2 { font-size: 18px; margin-bottom: 16px; }
.dash-generations { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.gen-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; cursor: pointer;
}
.gen-card:hover { border-color: var(--accent); }
.gen-thumb { width: 100%; aspect-ratio: 1; background: #fff; object-fit: contain; display: block; }
.gen-meta { padding: 8px; font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loading { color: var(--text-muted); }

@media (max-width: 640px) {
  .hero h1 { font-size: 36px; }
  .nav { padding: 14px 16px; }
  .hero, .features, .dash-page { padding-left: 16px; padding-right: 16px; }
}
