/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a2e;
  background: #faf9f6;
  line-height: 1.6;
  min-height: 100vh;
}

/* === Nav === */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: #fff;
  border-bottom: 1px solid #e8e5df; position: sticky; top: 0; z-index: 100;
}
.nav-logo { font-weight: 700; font-size: 1.1rem; color: #1a1a2e; text-decoration: none; }
.nav-cta {
  background: #6366f1; color: #fff; padding: 8px 20px; border-radius: 999px;
  text-decoration: none; font-weight: 600; font-size: .9rem; white-space: nowrap;
}
.nav-cta:hover { background: #4f46e5; }

/* === Hero === */
.hero {
  text-align: center; padding: 48px 20px 36px; max-width: 800px; margin: 0 auto;
}
.hero h1 { font-size: 2.4rem; font-weight: 800; line-height: 1.2; margin-bottom: 12px; }
.hero-sub { font-size: 1.15rem; color: #555; max-width: 640px; margin: 0 auto 20px; }
.hero-sub strong { color: #6366f1; }
.hero-trust {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 16px;
  margin-bottom: 28px;
}
.hero-trust span {
  background: #eef2ff; color: #4338ca; padding: 6px 14px; border-radius: 999px;
  font-size: .85rem; font-weight: 500;
}
.hero-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta-primary, .cta-secondary {
  padding: 14px 32px; border-radius: 12px; font-weight: 700; font-size: 1.05rem;
  text-decoration: none; transition: transform .15s;
}
.cta-primary { background: #6366f1; color: #fff; }
.cta-primary:hover { background: #4f46e5; transform: translateY(-1px); }
.cta-secondary { background: #eef2ff; color: #4338ca; }
.cta-secondary:hover { background: #e0e7ff; transform: translateY(-1px); }

/* Hero Examples */
.hero-examples { margin-top: 32px; }
.examples-label { font-size: .9rem; color: #888; margin-bottom: 12px; }
.example-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.example-card {
  border-radius: 8px; overflow: hidden; cursor: pointer; border: 2px solid transparent;
  transition: border-color .2s; width: 140px;
}
.example-card:hover { border-color: #6366f1; }
.example-card canvas { display: block; width: 100%; height: auto; background: #fff; }

/* === Generator Container === */
.generator {
  max-width: 720px; margin: 0 auto 48px; padding: 0 16px;
}

/* === Tabs === */
.tab-bar { display: flex; gap: 0; margin-bottom: 24px; border-radius: 12px; overflow: hidden; border: 1px solid #e0dcd5; }
.tab {
  flex: 1; padding: 14px 16px; border: none; background: #fff; cursor: pointer;
  font-size: .95rem; font-weight: 600; color: #888; transition: all .15s;
}
.tab.active { background: #6366f1; color: #fff; }
.tab:hover:not(.active) { background: #f5f3ee; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* === Upload Zone === */
.upload-zone {
  border: 2px dashed #c4bfb6; border-radius: 16px; padding: 36px 20px;
  text-align: center; cursor: pointer; transition: border-color .2s;
  background: #fff; margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: #6366f1; background: #f8f7ff; }
.upload-icon { font-size: 2.2rem; margin-bottom: 8px; }
.upload-link { color: #6366f1; cursor: pointer; text-decoration: underline; }
.upload-hint { font-size: .82rem; color: #999; margin-top: 6px; }

/* === Demo Photos === */
.demo-photos { margin-bottom: 20px; }
.demo-photos p { font-size: .9rem; color: #666; margin-bottom: 8px; }
.demo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.demo-thumb {
  width: 80px; height: 80px; border-radius: 8px; cursor: pointer; border: 2px solid transparent;
  overflow: hidden; transition: border-color .2s;
}
.demo-thumb:hover { border-color: #6366f1; }
.demo-thumb canvas, .demo-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* === Style / Complexity Selector === */
.style-selector, .complexity-selector { margin-bottom: 20px; }
.style-selector p, .complexity-selector p { font-size: .9rem; color: #666; margin-bottom: 8px; }
.style-options, .complexity-options { display: flex; gap: 8px; flex-wrap: wrap; }
.style-btn, .complexity-btn {
  flex: 1; min-width: 100px; padding: 12px 10px; border: 2px solid #e0dcd5;
  border-radius: 10px; background: #fff; cursor: pointer; font-size: .85rem;
  font-weight: 600; color: #555; transition: all .15s; text-align: center;
}
.style-btn:hover, .complexity-btn:hover { border-color: #a5b4fc; }
.style-btn.selected, .complexity-btn.selected { border-color: #6366f1; background: #eef2ff; color: #4338ca; }
.style-btn small, .complexity-btn small { display: block; font-weight: 400; font-size: .75rem; color: #999; margin-top: 2px; }

/* === Generate Button === */
.generate-btn {
  display: block; width: 100%; padding: 16px; border: none; border-radius: 12px;
  background: #6366f1; color: #fff; font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: background .2s; margin-bottom: 24px;
}
.generate-btn:hover:not(:disabled) { background: #4f46e5; }
.generate-btn:disabled { background: #c7c3b6; cursor: not-allowed; }

/* === Result Area === */
.result-area { margin-top: 24px; padding: 20px; background: #fff; border-radius: 16px; border: 1px solid #e8e5df; }
.result-preview { text-align: center; margin-bottom: 16px; }
.result-preview canvas { max-width: 100%; height: auto; border: 1px solid #e0dcd5; border-radius: 8px; background: #fff; }
.download-options { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-bottom: 12px; }
.dl-btn {
  padding: 10px 20px; border: 2px solid #6366f1; border-radius: 10px;
  background: #fff; color: #6366f1; font-weight: 600; cursor: pointer;
  font-size: .88rem; transition: all .15s;
}
.dl-btn:hover { background: #6366f1; color: #fff; }
.share-row { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.pinterest-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 10px; background: #fff;
  border: 2px solid #E60023; color: #E60023; font-weight: 600;
  text-decoration: none; font-size: .88rem;
}
.pinterest-btn:hover { background: #ffe6e6; }
.create-another {
  padding: 8px 18px; border: 2px solid #e0dcd5; border-radius: 10px;
  background: #fff; color: #555; font-weight: 600; cursor: pointer; font-size: .88rem;
}
.create-another:hover { background: #f5f3ee; }

/* === Errors === */
.error-msg {
  background: #fef2f2; color: #dc2626; padding: 12px 16px; border-radius: 10px;
  margin-top: 12px; font-size: .9rem; border: 1px solid #fecaca;
}
.no-match-msg {
  background: #fffbeb; color: #92400e; padding: 12px 16px; border-radius: 10px;
  margin-top: 12px; font-size: .9rem; border: 1px solid #fde68a; text-align: center;
}
.no-match-msg a { color: #6366f1; font-weight: 600; }

/* === Text Tab === */
.text-input {
  width: 100%; padding: 14px 16px; border: 2px solid #e0dcd5; border-radius: 12px;
  font-size: 1rem; margin-bottom: 20px; transition: border-color .2s;
  background: #fff;
}
.text-input:focus { outline: none; border-color: #6366f1; }
.tag-cloud { margin-bottom: 20px; }
.tag-cloud p { font-size: .9rem; color: #666; margin-bottom: 8px; }
.tag {
  display: inline-block; padding: 6px 14px; margin: 4px; border-radius: 999px;
  background: #eef2ff; color: #4338ca; font-size: .85rem; cursor: pointer;
  transition: background .15s; user-select: none;
}
.tag:hover { background: #e0e7ff; }

/* === Gallery === */
.gallery { max-width: 860px; margin: 0 auto 48px; padding: 0 16px; }
.gallery h2 { font-size: 1.7rem; text-align: center; margin-bottom: 8px; }
.gallery>p { text-align: center; color: #666; margin-bottom: 24px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.gallery-card {
  background: #fff; border-radius: 12px; overflow: hidden;
  border: 1px solid #e8e5df; transition: box-shadow .2s;
}
.gallery-card:hover { box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.gallery-card canvas, .gallery-card img { display: block; width: 100%; height: auto; }
.gallery-card-body { padding: 12px; }
.gallery-card-body p { font-size: .85rem; color: #555; margin-bottom: 8px; }
.gallery-card-body a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px; background: #eef2ff;
  color: #4338ca; text-decoration: none; font-size: .82rem; font-weight: 600; margin-right: 6px;
}
.gallery-card-body a:hover { background: #e0e7ff; }

/* === FAQ === */
.faq { max-width: 720px; margin: 0 auto 48px; padding: 0 16px; }
.faq h2 { font-size: 1.7rem; text-align: center; margin-bottom: 24px; }
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item {
  background: #fff; border: 1px solid #e8e5df; border-radius: 12px;
  padding: 0; overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px; font-weight: 600; cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: #6366f1; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 20px 16px; color: #555; font-size: .92rem; }

/* === Footer === */
.footer {
  text-align: center; padding: 32px 20px; background: #1a1a2e; color: #ccc;
  margin-top: 48px;
}
.footer-main { margin-bottom: 16px; }
.footer-main strong { color: #fff; }
.footer-links { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }
.footer-links a { color: #a5b4fc; text-decoration: none; }
.footer-links a:hover { color: #c7d2fe; }
.footer-small { font-size: .78rem; color: #777; }

/* === Skeleton / Loading === */
.generating-overlay {
  position: fixed; inset: 0; background: rgba(250,249,246,.85); z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.spinner {
  width: 48px; height: 48px; border: 4px solid #e0dcd5;
  border-top-color: #6366f1; border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.generating-overlay p { margin-top: 16px; font-weight: 600; color: #4338ca; }

/* === Print Styles === */
@media print {
  body { background: #fff; }
  .nav, .hero, .tab-bar, .upload-zone, .demo-photos, .style-selector,
  .generate-btn, .download-options, .share-row, .gallery, .faq, .footer { display: none !important; }
  .result-preview canvas { max-width: 100%; height: auto; border: none; }
  .result-area { border: none; padding: 0; }
}

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .hero-sub { font-size: 1rem; }
  .hero-trust { flex-direction: column; align-items: center; }
  .cta-primary, .cta-secondary { width: 100%; text-align: center; }
  .tab { font-size: .82rem; padding: 12px 8px; }
  .style-options { flex-wrap: wrap; }
  .style-btn { min-width: 44%; flex-basis: 44%; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .download-options { flex-direction: column; }
  .dl-btn { width: 100%; }
}
@media (max-width: 375px) {
  .hero h1 { font-size: 1.5rem; }
  .tab { font-size: .75rem; padding: 10px 6px; }
  .style-btn { min-width: 44%; flex-basis: 44%; font-size: .78rem; }
  .generate-btn { font-size: 1rem; padding: 14px; }
}
