:root {
  --berry: #8f174d;
  --hot-pink: #e83e86;
  --rose: #f47cad;
  --blush: #fff0f6;
  --cream: #fffaf8;
  --ink: #43172b;
  --muted: #856474;
  --line: #f1cada;
  --white: #fff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(circle at 8% 16%, rgba(255, 168, 201, .23), transparent 25%),
    radial-gradient(circle at 91% 35%, rgba(232, 62, 134, .12), transparent 22%),
    linear-gradient(135deg, #fff8fa 0%, #fff0f6 52%, #fffaf8 100%);
  overflow-x: hidden;
}

button, select, textarea, input { font: inherit; }
button { cursor: pointer; }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 30px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--berry); font-family: "Playfair Display", serif; font-size: 23px; font-weight: 700; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: white; font-size: 16px; background: linear-gradient(145deg, var(--hot-pink), var(--berry)); box-shadow: 0 5px 15px rgba(143,23,77,.24); }
.help-button { border: 1px solid var(--line); background: rgba(255,255,255,.65); color: var(--berry); border-radius: 99px; padding: 10px 17px; font-weight: 600; transition: .2s; }
.help-button:hover { transform: translateY(-1px); border-color: var(--rose); background: white; }
.page-shell { width: min(100% - 32px, 820px); margin: 44px auto 60px; position: relative; z-index: 1; }
.intro { text-align: center; max-width: 700px; margin: 0 auto 34px; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; color: var(--hot-pink); font-size: 12px; font-weight: 700; letter-spacing: .18em; }
.eyebrow span { font-size: 15px; }
h1 { margin: 14px 0 15px; font-family: "Playfair Display", serif; font-size: clamp(42px, 7vw, 66px); line-height: .98; letter-spacing: -.035em; }
h1 em { color: var(--hot-pink); font-weight: 600; }
.intro > p { max-width: 540px; margin: 0 auto; color: var(--muted); line-height: 1.65; font-size: 16px; }
.builder-card { background: rgba(255,255,255,.91); border: 1px solid rgba(255,255,255,.95); border-radius: 28px; padding: 31px 38px 34px; box-shadow: 0 24px 80px rgba(121,31,70,.12), 0 3px 14px rgba(121,31,70,.05); backdrop-filter: blur(16px); }
.progress-wrap { margin-bottom: 32px; }
.progress-copy { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.progress-copy span:last-child { color: var(--hot-pink); }
.progress-track { height: 5px; border-radius: 9px; background: #f8e5ed; overflow: hidden; }
.progress-fill { width: 33.33%; height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--berry), var(--rose)); transition: width .4s ease; }
.form-step { display: none; animation: slideIn .35s ease; }
.form-step.active { display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.step-heading { display: flex; align-items: center; gap: 15px; }
.step-icon { display: grid; place-items: center; flex: 0 0 auto; width: 45px; height: 45px; border-radius: 15px; background: var(--blush); color: var(--hot-pink); font-size: 23px; }
.step-heading p, .mini-label { margin: 0 0 3px; color: var(--hot-pink); font-size: 10px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.step-heading h2 { margin: 0; font-family: "Playfair Display", serif; font-size: 25px; line-height: 1.2; }
.supporting { margin: 19px 0 21px; color: var(--muted); font-size: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 27px; }
.chip { border: 1px solid var(--line); border-radius: 99px; padding: 9px 15px; color: #684052; background: white; font-size: 13px; transition: .18s; }
.chip:hover { border-color: var(--rose); transform: translateY(-1px); }
.chip.selected { color: white; border-color: var(--hot-pink); background: linear-gradient(135deg, var(--hot-pink), #c72f71); box-shadow: 0 5px 14px rgba(232,62,134,.2); }
.chip.selected::before { content: "♥"; margin-right: 6px; font-size: 10px; }
.field-label, .field-grid label { display: block; color: #5f3046; font-size: 12px; font-weight: 700; }
.field-label span { color: #ad8d9b; font-weight: 400; }
textarea, select, input { width: 100%; border: 1px solid #eed5df; background: #fffbfc; border-radius: 13px; color: var(--ink); outline: none; transition: .2s; }
textarea { min-height: 95px; resize: vertical; padding: 14px; margin-top: 8px; line-height: 1.5; font-size: 13px; }
textarea:focus, select:focus, input:focus { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(244,124,173,.12); background: white; }
textarea::placeholder { color: #bca4ae; }
.char-count { margin-top: -24px; padding-right: 10px; text-align: right; position: relative; color: #b69ba7; font-size: 10px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin-bottom: 22px; }
select { height: 46px; padding: 0 12px; margin-top: 7px; appearance: none; background-image: linear-gradient(45deg,transparent 50%,#b06b89 50%),linear-gradient(135deg,#b06b89 50%,transparent 50%); background-position: calc(100% - 17px) 19px,calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.field-grid input { height: 46px; padding: 0 12px; margin-top: 7px; }
.wide-input { height: 46px; padding: 0 13px; margin: 8px 0 20px; }
.privacy-note { display: flex; gap: 12px; align-items: flex-start; margin-top: 25px; padding: 14px 16px; border-radius: 14px; background: var(--blush); color: var(--muted); font-size: 12px; line-height: 1.5; }
.privacy-note span { color: var(--hot-pink); font-size: 19px; }
.privacy-note p { margin: 0; }
.privacy-note strong { color: var(--berry); }
.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; padding-top: 25px; border-top: 1px solid #f5e6ec; }
.next-button, .generate-button { border: 0; border-radius: 99px; color: white; background: linear-gradient(135deg, var(--hot-pink), var(--berry)); font-weight: 700; box-shadow: 0 8px 18px rgba(196,44,110,.23); transition: .2s; }
.next-button { padding: 12px 22px; margin-left: auto; }
.next-button span { padding-left: 8px; }
.next-button:hover, .generate-button:hover { transform: translateY(-2px); box-shadow: 0 11px 24px rgba(196,44,110,.28); }
.back-button { border: 0; background: transparent; color: var(--muted); font-weight: 600; padding: 10px 0; }
.hidden { visibility: hidden; }
.result-card { display: grid; grid-template-columns: 225px 1fr; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: linear-gradient(145deg,#fff,#fff7fa); }
.portrait-wrap { min-height: 285px; position: relative; background: var(--blush); }
.portrait-wrap img { width: 100%; height: 100%; display: block; object-fit: cover; }
.portrait-loader { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 9px; color: var(--berry); text-align: center; background: linear-gradient(145deg,#fff0f6,#fbd6e5); }
.portrait-loader.visible { display: grid; }
.portrait-loader span { font-size: 32px; animation: pulse 1s ease-in-out infinite; }
.portrait-loader p { margin: 0; font-size: 12px; font-weight: 700; line-height: 1.5; }
@keyframes pulse { 50% { transform: scale(1.25); opacity: .55; } }
.match-badge { position: absolute; left: 14px; bottom: 14px; padding: 7px 11px; border-radius: 99px; color: var(--berry); background: rgba(255,255,255,.87); backdrop-filter: blur(7px); font-size: 10px; font-weight: 700; }
.result-content { padding: 27px 25px; }
.result-content h3 { margin: 3px 0 13px; font-family: "Playfair Display", serif; font-size: 27px; }
.result-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.result-chips span { padding: 5px 9px; border-radius: 99px; color: var(--berry); background: var(--blush); font-size: 10px; font-weight: 600; }
.result-content > p:not(.mini-label) { color: var(--muted); line-height: 1.6; font-size: 13px; }
.generate-button { margin-top: 7px; padding: 11px 15px; font-size: 11px; }
.chat-button { width: 100%; margin-top: 9px; padding: 10px 12px; border: 1px solid var(--rose); border-radius: 99px; color: var(--berry); background: white; font-size: 11px; font-weight: 700; }
.chat-button:disabled { opacity: .45; cursor: not-allowed; }
.api-error { min-height: 0; margin: 8px 0 0 !important; color: #b22555 !important; font-size: 10px !important; }
.generate-button.loading span { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ai-note { margin: 12px 0 0; color: #ac8998; text-align: center; font-size: 10px; }
.footer-note { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 27px 0; text-align: center; color: #9a7183; font-size: 11px; }
.footer-note span { color: var(--hot-pink); font-size: 16px; }
.ambient-heart { position: fixed; z-index: 0; color: rgba(232,62,134,.09); font-family: serif; pointer-events: none; transform: rotate(-12deg); }
.heart-one { left: 4%; top: 28%; font-size: 74px; }
.heart-two { right: 5%; top: 14%; font-size: 42px; transform: rotate(18deg); }
.heart-three { right: 7%; bottom: 13%; font-size: 95px; transform: rotate(9deg); }
dialog { max-width: 430px; width: calc(100% - 32px); padding: 38px; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 25px 80px rgba(73,16,42,.25); text-align: center; }
dialog::backdrop { background: rgba(67,23,43,.35); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; right: 14px; top: 10px; border: 0; background: transparent; color: var(--muted); font-size: 25px; }
.dialog-heart { margin: auto; width: 48px; height: 48px; display: grid; place-items: center; color: white; border-radius: 50%; background: var(--hot-pink); }
dialog h2 { font-family: "Playfair Display",serif; }
dialog p { color: var(--muted); line-height: 1.65; font-size: 14px; }
.chat-dialog { width: min(100% - 24px, 520px); max-width: 520px; height: min(720px, calc(100vh - 30px)); padding: 0; overflow: hidden; text-align: left; }
.chat-header { display: flex; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid #f4dde6; }
.chat-header img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; }
.chat-header h2 { margin: 0; font-family: "Playfair Display",serif; font-size: 20px; }
.chat-header p { margin: 2px 0 0; font-size: 10px; }
.chat-header p span { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #42b77b; }
.chat-header .dialog-close { top: 18px; }
.chat-disclosure { padding: 8px 14px; color: #94687a; background: var(--blush); text-align: center; font-size: 10px; }
.messages { height: calc(100% - 150px); overflow-y: auto; padding: 22px 18px; background: #fffafc; }
.message { max-width: 79%; margin-bottom: 11px; padding: 10px 13px; border-radius: 16px 16px 16px 4px; color: #654254; background: white; box-shadow: 0 3px 12px rgba(104,36,66,.07); font-size: 13px; line-height: 1.5; }
.message.user { margin-left: auto; border-radius: 16px 16px 4px 16px; color: white; background: linear-gradient(135deg,var(--hot-pink),var(--berry)); }
.message.typing { color: #b38096; }
.chat-form { display: flex; gap: 8px; padding: 13px; border-top: 1px solid #f4dde6; background: white; }
.chat-form input { height: 44px; padding: 0 14px; }
.chat-form button { flex: 0 0 44px; border: 0; border-radius: 50%; color: white; background: var(--hot-pink); }

@media (max-width: 650px) {
  .topbar { padding: 0 18px; height: 68px; }
  .help-button { font-size: 11px; padding: 8px 11px; }
  .page-shell { margin-top: 28px; }
  .builder-card { padding: 24px 20px 27px; border-radius: 22px; }
  .step-heading { align-items: flex-start; }
  .step-heading h2 { font-size: 21px; }
  .field-grid { grid-template-columns: 1fr; gap: 13px; }
  .result-card { grid-template-columns: 1fr; }
  .portrait-wrap { height: 330px; }
}
