/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f9fafb;
  color: #111827;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }

/* ===== NAVIGATION ===== */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}
.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.nav-brand .back-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-brand .back-link:hover { color: #2563eb; }
.back-icon { width: 18px; height: 18px; }
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.logo-icon {
  width: 32px; height: 32px;
  background: #2563eb;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.logo-icon svg { width: 20px; height: 20px; color: #fff; }
.logo-text { font-size: 1.25rem; font-weight: 800; color: #111827; }
.nav-links { display: none; }
.nav-links a {
  color: #4b5563;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.5rem 0;
  transition: color 0.2s;
}
.nav-links a:hover { color: #2563eb; }
.mobile-menu-btn {
  display: flex;
  background: none; border: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  color: #4b5563;
}
.mobile-menu-btn:hover { background: #f3f4f6; }
.mobile-menu-btn svg { width: 24px; height: 24px; }
.mobile-menu {
  background: #fff;
  border-top: 1px solid #f3f4f6;
  padding: 0.75rem 1rem;
}
.mobile-menu a {
  display: block;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  color: #4b5563;
  font-weight: 500;
  font-size: 0.9375rem;
}
.mobile-menu a:hover { background: #f9fafb; color: #2563eb; }
.hidden { display: none !important; }

@media (min-width: 768px) {
  .nav-links { display: flex; gap: 2rem; }
  .mobile-menu-btn { display: none; }
  .mobile-menu { display: none !important; }
}

/* ===== HERO ===== */
.hero {
  padding: 3rem 1rem 2rem;
  text-align: center;
}
.hero-content { max-width: 768px; margin: 0 auto; }
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.125rem;
  color: #6b7280;
  max-width: 640px;
  margin: 0 auto;
}
@media (min-width: 640px) {
  .hero h1 { font-size: 3.5rem; }
}

/* ===== GENERATOR ===== */
.generator-section { padding: 0 1rem 3rem; }
.generator-card {
  max-width: 896px;
  margin: 0 auto;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08), 0 4px 12px -4px rgba(0,0,0,0.04);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}
.generator-grid { display: grid; }
@media (min-width: 768px) {
  .generator-grid { grid-template-columns: 1fr 1fr; }
}

/* Controls Panel */
.controls-panel {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
@media (min-width: 640px) { .controls-panel { padding: 2rem; } }

.input-group label,
.color-group label,
.size-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}
.input-group textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.75rem;
  font-size: 1rem;
  color: #111827;
  outline: none;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group textarea:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.color-picker-wrap input[type="color"] {
  width: 48px; height: 48px;
  border-radius: 0.5rem;
  cursor: pointer;
  border: none;
  padding: 0;
  -webkit-appearance: none;
}
.color-picker-wrap input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-picker-wrap input[type="color"]::-webkit-color-swatch { border: none; border-radius: 0.5rem; }
.color-picker-wrap span {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 0.875rem;
  color: #6b7280;
}

.size-group input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 9999px;
  background: #e5e7eb;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
  margin-top: 0.25rem;
}
.size-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}
.size-group input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  border: none;
}
.size-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}
.size-labels span:nth-child(2) {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: #4b5563;
}

.generate-btn {
  width: 100%;
  background: #2563eb;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.875rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(37,99,235,0.3);
  transition: all 0.2s;
}
.generate-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.35);
}
.generate-btn:active {
  transform: translateY(0);
}
.generate-btn svg { width: 20px; height: 20px; }

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* Preview Panel */
.preview-panel {
  background: #f9fafb;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-top: 1px solid #f3f4f6;
}
@media (min-width: 768px) {
  .preview-panel {
    border-top: none;
    border-left: 1px solid #f3f4f6;
  }
}
@media (min-width: 640px) { .preview-panel { padding: 2rem; } }

.preview-box {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid #e5e7eb;
  padding: 1.5rem;
}
.placeholder {
  width: 256px; height: 256px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  text-align: center;
}
.placeholder svg {
  width: 64px; height: 64px;
  margin-bottom: 0.75rem;
  opacity: 0.5;
}
.placeholder p { font-size: 0.875rem; }

#qrCanvas {
  max-width: 100%;
  display: block;
}

.download-btn {
  width: 100%;
  max-width: 320px;
  margin-top: 1.5rem;
  background: #1f2937;
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.75rem;
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
}
.download-btn:hover:not(:disabled) { background: #111827; }
.download-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}
.download-btn svg { width: 20px; height: 20px; }

/* ===== ADS ===== */
.ad-section { padding: 0 1rem 2rem; }
.ad-box {
  max-width: 896px;
  margin: 0 auto;
  height: 96px;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #d1d5db;
  background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 10px, #e5e7eb 10px, #e5e7eb 20px);
}
@media (min-width: 640px) { .ad-box { height: 128px; } }
.ad-box span {
  font-size: 0.875rem;
  font-weight: 500;
  color: #9ca3af;
}

/* ===== HOW IT WORKS ===== */
.how-it-works { background: #fff; padding: 4rem 1rem; }
.section-container { max-width: 1152px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.75rem;
}
.section-header p {
  color: #6b7280;
  max-width: 640px;
  margin: 0 auto;
}

.steps-grid {
  display: grid;
  gap: 2rem;
}
@media (min-width: 768px) {
  .steps-grid { grid-template-columns: repeat(3, 1fr); }
}
.step-card {
  text-align: center;
  padding: 1.5rem;
  border-radius: 1rem;
  transition: background 0.3s;
}
.step-card:hover { background: #f9fafb; }
.step-icon {
  width: 56px; height: 56px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}
.step-icon svg { width: 28px; height: 28px; }
.step-icon.blue { background: #dbeafe; color: #2563eb; }
.step-icon.green { background: #dcfce7; color: #16a34a; }
.step-icon.purple { background: #f3e8ff; color: #9333ea; }
.step-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.5rem;
}
.step-card p {
  font-size: 0.875rem;
  color: #6b7280;
  line-height: 1.625;
}

/* ===== FAQ ===== */
.faq-section { background: #f9fafb; padding: 4rem 1rem; }
.faq-list { display: flex; flex-direction: column; gap: 1rem; }
.faq-item {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  cursor: pointer;
  list-style: none;
  transition: background 0.2s;
}
.faq-item summary:hover { background: #f9fafb; }
.faq-item summary span {
  font-weight: 600;
  color: #111827;
  font-size: 0.9375rem;
  padding-right: 1rem;
}
.faq-item summary .chevron {
  width: 20px; height: 20px;
  color: #9ca3af;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.faq-item[open] summary .chevron { transform: rotate(180deg); }
.faq-answer {
  padding: 0 1.25rem 1.25rem;
  color: #6b7280;
  font-size: 0.875rem;
  line-height: 1.625;
}

/* ===== FOOTER ===== */
.footer { background: #111827; color: #d1d5db; padding: 3rem 1rem; }
.footer-container { max-width: 1152px; margin: 0 auto; }
.footer-grid {
  display: grid;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.footer-desc {
  font-size: 0.875rem;
  color: #9ca3af;
  line-height: 1.625;
  max-width: 384px;
}
.footer-desc a { color: #60a5fa; transition: color 0.2s; }
.footer-desc a:hover { color: #93c5fd; }
.footer-links h4 {
  color: #fff;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: 0.9375rem;
}
.footer-links ul { display: flex; flex-direction: column; gap: 0.5rem; }
.footer-links a {
  font-size: 0.875rem;
  color: #9ca3af;
  transition: color 0.2s;
}
.footer-links a:hover { color: #fff; }
.footer-bottom {
  border-top: 1px solid #1f2937;
  padding-top: 2rem;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
}
.footer-bottom a { color: #9ca3af; transition: color 0.2s; }
.footer-bottom a:hover { color: #d1d5db; }