:root {
  --primary: #8b5cf6;
  --primary-2: #ec4899;
  --bg-1: #0e0b1f;
  --bg-2: #170f2e;
  --surface: rgba(255, 255, 255, 0.055);
  --surface-strong: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --text: #f5f3ff;
  --text-muted: rgba(245, 243, 255, 0.62);
  --success: #34d399;
  --warning: #fbbf24;
  --danger: #fb7185;
  --radius: 22px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--bg-1); }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 0%, var(--bg-2), var(--bg-1) 60%);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

h1, h2, .logo-text {
  font-family: "Space Grotesk", "Plus Jakarta Sans", sans-serif;
}

/* ---------- animated background blobs ---------- */
.blobs {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.45;
  animation: float 16s ease-in-out infinite;
}

.blob-a {
  width: 340px;
  height: 340px;
  top: -80px;
  left: -60px;
  background: var(--primary);
  animation-delay: 0s;
}

.blob-b {
  width: 380px;
  height: 380px;
  top: 30%;
  right: -120px;
  background: var(--primary-2);
  animation-delay: -5s;
}

.blob-c {
  width: 300px;
  height: 300px;
  bottom: -100px;
  left: 20%;
  background: #06b6d4;
  animation-delay: -10s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(40px, 30px) scale(1.08); }
  66% { transform: translate(-30px, -20px) scale(0.95); }
}

@media (prefers-reduced-motion: reduce) {
  .blob { animation: none; }
}

/* ---------- layout ---------- */
.app {
  position: relative;
  z-index: 1;
  max-width: 1020px;
  margin: 0 auto;
  padding: 40px 20px 56px;
}

.app-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.logo-badge {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4);
}

.logo-text {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.grad-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-2) 60%, #06b6d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-title {
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.15;
  font-weight: 700;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.tagline {
  color: var(--text-muted);
  margin: 0 auto;
  font-size: 15px;
  max-width: 420px;
}

.badge-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.pill-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(10px);
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 24px 22px 28px;
}

.panel h2 {
  margin: 0 0 18px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- photo upload ---------- */
.photo-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.photo-circle {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
}
.photo-circle:hover { transform: scale(1.05) rotate(-2deg); }

.photo-circle > img,
.photo-circle > span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.photo-circle img {
  object-fit: cover;
  background: var(--bg-2);
}

#photoPlaceholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  color: #fff;
}

.photo-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}
.link-btn:hover { color: var(--danger); }

/* ---------- vibe picker ---------- */
.vibe-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.vibe-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.vibe-swatches {
  display: flex;
  gap: 8px;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--sw);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.swatch:hover { transform: scale(1.15); }
.swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--sw);
}

/* ---------- form fields ---------- */
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-width: 0;
}

.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.optional { font-weight: 400; opacity: 0.7; }

.field input {
  width: 100%;
  min-width: 0;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: inherit;
  background: rgba(0, 0, 0, 0.18);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.field input::placeholder { color: rgba(245, 243, 255, 0.32); }

.field input:focus {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.18);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin: 6px 0 16px;
  cursor: pointer;
}

.checkbox-row input {
  margin-top: 3px;
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

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

.qr-size-meter { margin-bottom: 20px; }

.meter-track {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--success);
  transition: width 0.2s ease, background 0.2s ease;
}

#meterLabel {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ---------- buttons ---------- */
.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 18px;
  font-size: 15.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
  box-shadow: 0 10px 28px rgba(139, 92, 246, 0.38);
}
.primary-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-btn:active { transform: scale(0.97); }

.secondary-btn {
  background: var(--surface-strong);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  flex: 1;
  min-width: 130px;
  transition: background 0.15s ease, transform 0.12s ease;
}
.secondary-btn:hover { background: rgba(255, 255, 255, 0.16); transform: translateY(-1px); }
.secondary-btn:active { transform: scale(0.97); }

/* ---------- QR stage ---------- */
.qr-stage {
  position: relative;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px dashed var(--border);
  border-radius: 18px;
  padding: 20px;
  overflow: hidden;
}

.qr-placeholder {
  text-align: center;
  color: var(--text-muted);
}
.placeholder-emoji {
  font-size: 40px;
  margin-bottom: 10px;
  filter: grayscale(0.2);
}
.qr-placeholder p { margin: 0; font-size: 13px; max-width: 220px; }

#qrcode {
  display: none;
  padding: 14px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#qrcode.visible { display: block; }
#qrcode img, #qrcode canvas {
  display: block;
  width: 200px !important;
  height: 200px !important;
  border-radius: 6px;
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.7); }
  to { opacity: 1; transform: scale(1); }
}

.qr-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.confetti-piece {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0.95;
  animation: confetti-burst 0.9s ease-out forwards;
}

@keyframes confetti-burst {
  from {
    transform: translate(-50%, -50%) rotate(0deg) translateY(0);
    opacity: 1;
  }
  to {
    transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) translateY(40px);
    opacity: 0;
  }
}

/* ---------- card preview ---------- */
.card-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
}

.card-preview-photo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)) center/cover no-repeat;
  flex-shrink: 0;
}

.card-preview-info {
  display: flex;
  flex-direction: column;
  font-size: 12.5px;
  color: var(--text-muted);
  gap: 1px;
  overflow: hidden;
}
.card-preview-info strong {
  font-size: 14.5px;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}
.card-preview-info span:empty { display: none; }

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

.app-footer {
  text-align: center;
  margin-top: 34px;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- profile page ---------- */
.profile-wrap {
  display: flex;
  justify-content: center;
  padding-top: 10px;
}

.profile-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 36px 28px 30px;
}

.profile-photo {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  margin: 0 auto 18px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Space Grotesk", sans-serif;
  font-size: 34px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35);
  border: 3px solid rgba(255, 255, 255, 0.15);
}

.profile-name {
  font-size: 24px;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.profile-org {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 22px;
}

.quick-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 18px;
  font-size: 11.5px;
  font-weight: 700;
  min-width: 78px;
  transition: transform 0.12s ease, background 0.15s ease;
}
.quick-action:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.16); }
.qa-emoji { font-size: 20px; }

.save-btn { margin-bottom: 10px; }

.share-link-btn {
  width: 100%;
  margin-bottom: 6px;
}

.empty-state {
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 48px 28px;
}
.empty-state h2 {
  margin: 6px 0 8px;
  font-size: 19px;
}
.empty-state p {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0 0 22px;
}
