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

:root {
  --p1:        #4f46e5;
  --p2:        #7c3aed;
  --p-soft:    #eef2ff;
  --p-border:  rgba(99,102,241,.2);

  --bg:        #ffffff;
  --surface:   #ffffff;
  --muted:     #fafafa;

  --ink:       #09090b;
  --ink-2:     #52525b;
  --ink-3:     #a1a1aa;

  --line:      #e4e4e7;
  --line-2:    #f4f4f5;

  --sh-xs: 0 1px 2px rgba(0,0,0,.04);
  --sh-sm: 0 2px 8px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --sh-md: 0 8px 24px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.04);
  --sh-lg: 0 20px 40px rgba(0,0,0,.08), 0 6px 12px rgba(0,0,0,.04);
  --sh-glow: 0 0 0 4px rgba(99,102,241,.12), 0 8px 24px rgba(79,70,229,.25);

  --r:    16px;
  --r-sm: 10px;
  --r-xs: 7px;
}

html { scroll-behavior: smooth; }

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

/* Dot-grid texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, #d4d4d8 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}

/* Soft glow behind the generator */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 600px;
  background:
    radial-gradient(ellipse 60% 50% at 30% 40%, rgba(99,102,241,.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 50% at 70% 40%, rgba(124,58,237,.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

header, main, footer { position: relative; z-index: 1; }

/* ── Header ─────────────────────────────────────── */
header {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 24px;
}

.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.logo svg { width: 28px; height: 28px; flex-shrink: 0; }

nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color .15s;
}
nav a:hover { color: var(--ink); }

/* ── Ad placements ──────────────────────────────── */
.ad-label {
  display: block;
  font-size: 9px;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.ad-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 16px;
  text-align: center;
}
.ad-strip-inline { margin: 20px 0 0; }
.ad-section {
  margin: 52px auto;
  text-align: center;
  max-width: 1120px;
  padding: 0 24px;
}

/* ── Main ────────────────────────────────────────── */
main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 100px;
}

/* ── Generator grid ─────────────────────────────── */
.generator-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px;
  align-items: stretch;
}

/* ── Card shell ─────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r);
  overflow: hidden;
  transition: box-shadow .25s;
}

/* Input card — gradient border */
#input-card {
  border: 1.5px solid transparent;
  background-clip: padding-box;
  box-shadow: var(--sh-md);
  position: relative;
}
#input-card::before {
  content: '';
  position: absolute;
  inset: -1.5px;
  border-radius: calc(var(--r) + 1.5px);
  background: linear-gradient(160deg, rgba(99,102,241,.6) 0%, rgba(124,58,237,.3) 40%, rgba(228,228,231,.5) 100%);
  z-index: -1;
}

/* Result card — flex column so ad fills remaining height */
#result-card {
  border: 1px solid var(--line);
  box-shadow: var(--sh-sm);
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
#result-card:hover { box-shadow: var(--sh-md); }

/* ── Card hero header ───────────────────────────── */
.card-hero {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--line-2);
  background: linear-gradient(160deg, #fafaff 0%, #fff 60%);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  color: white;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.card-hero h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--ink) 40%, var(--p1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 5px;
}

.card-hero p {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 400;
}

/* ── Type tabs ──────────────────────────────────── */
.type-tabs {
  display: flex;
  padding: 8px 12px;
  gap: 3px;
  background: var(--muted);
  border-bottom: 1px solid var(--line);
}

.type-tab {
  flex: 1;
  padding: 7px 4px;
  border: none;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  transition: all .18s;
  white-space: nowrap;
}
.type-tab:hover { color: var(--ink); background: rgba(0,0,0,.04); }
.type-tab.active {
  background: var(--surface);
  color: var(--p1);
  font-weight: 700;
  box-shadow: var(--sh-xs), 0 0 0 1px var(--line);
}

/* ── Form ───────────────────────────────────────── */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.form-body { padding: 18px 20px; }

.field { margin-bottom: 13px; }

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
  letter-spacing: -.01em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--ink-3); }
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: #a1a1aa; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--p1);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
  background: #fdfdff;
}
.field textarea { resize: vertical; min-height: 78px; }
.field select {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23a1a1aa'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  padding-right: 34px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.divider {
  height: 1px;
  background: var(--line-2);
  margin: 13px 0;
}

/* Color pickers */
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.color-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  position: relative;
  user-select: none;
}
.color-field:hover { border-color: #a1a1aa; }
.color-field:focus-within {
  border-color: var(--p1);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.color-field input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.color-preview {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.1);
  flex-shrink: 0;
  box-shadow: var(--sh-xs);
  transition: transform .15s;
}
.color-field:hover .color-preview { transform: scale(1.15); }

/* Size buttons */
.size-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }

.size-btn {
  padding: 8px 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.size-btn:hover { border-color: #a1a1aa; color: var(--ink); }
.size-btn.active {
  border-color: var(--p1);
  color: var(--p1);
  background: var(--p-soft);
}

/* ── Generate button ────────────────────────────── */
@keyframes shimmer {
  0%   { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(260%) skewX(-12deg); }
}

.btn-generate {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--p1) 0%, var(--p2) 100%);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 6px;
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .2s;
  letter-spacing: -.01em;
}
/* Top sheen */
.btn-generate::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: rgba(255,255,255,.12);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  pointer-events: none;
}
/* Shimmer streak */
.btn-generate::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 35%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28), transparent);
  transform: translateX(-100%) skewX(-12deg);
}
.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79,70,229,.45), 0 2px 6px rgba(79,70,229,.25);
}
.btn-generate:hover::after { animation: shimmer .7s ease; }
.btn-generate:active { transform: translateY(0); box-shadow: none; }

/* ── QR result card ─────────────────────────────── */
.qr-empty {
  padding: 44px 22px;
  text-align: center;
}

.qr-empty-frame {
  width: 150px; height: 150px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  background: linear-gradient(145deg, var(--muted), #fff);
  transition: border-color .4s;
}
.qr-empty-frame:hover { border-color: #a1a1aa; }

.qr-empty p {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

/* QR output */
.qr-result { padding: 22px; text-align: center; }

#qr-output {
  display: inline-block;
  background: white;
  padding: 13px;
  border-radius: 13px;
  border: 1px solid var(--line);
  box-shadow: var(--sh-md);
  margin-bottom: 16px;
  transition: box-shadow .25s;
}
#qr-output:hover { box-shadow: var(--sh-glow); }
#qr-output img    { display: none; }
#qr-output canvas { display: block; border-radius: 3px; }

.qr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.btn-action {
  padding: 9px 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .15s;
  text-decoration: none;
}

.btn-download {
  background: linear-gradient(135deg, var(--p1), var(--p2));
  color: white;
  border: none;
  position: relative;
  overflow: hidden;
}
.btn-download::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: rgba(255,255,255,.1);
  pointer-events: none;
}
.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79,70,229,.4);
}

.btn-copy {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-copy:hover { border-color: #a1a1aa; background: var(--muted); }

/* Ad fills the remaining vertical space in the result card */
.result-ad {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-top: 1px solid var(--line-2);
  background: var(--muted);
  min-height: 180px;
}


/* ── Features ───────────────────────────────────── */
.section-title { text-align: center; margin-bottom: 40px; }

.section-title h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.04em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--ink) 30%, var(--p1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.section-title p { color: var(--ink-2); font-size: 15px; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.feature-card:hover {
  box-shadow: var(--sh-lg);
  transform: translateY(-4px);
  border-color: var(--p-border);
}

.feature-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--p-soft), #f0eeff);
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 13px;
  color: var(--p1);
  border: 1px solid var(--p-border);
}
.feature-card h3 { font-size: 14.5px; font-weight: 700; margin-bottom: 5px; letter-spacing: -.02em; }
.feature-card p  { font-size: 13px; color: var(--ink-2); line-height: 1.55; }

/* ── Footer ─────────────────────────────────────── */
footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  text-align: center;
  padding: 26px 24px;
  font-size: 13.5px;
  color: var(--ink-2);
}
footer a { color: var(--p1); text-decoration: none; font-weight: 500; }
footer a:hover { text-decoration: underline; }

/* ── Field errors ───────────────────────────────── */
.field-error { color: #ef4444; font-size: 11.5px; margin-top: 4px; display: block; }

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 800px) {
  .generator-grid { grid-template-columns: 1fr; }
  nav { gap: 16px; }
}

@media (max-width: 480px) {
  .type-tab { font-size: 11.5px; padding: 6px 3px; }
  .qr-actions { grid-template-columns: 1fr; }
  main { padding: 18px 16px 80px; }
  .card-hero h1 { font-size: 24px; }
}
