/* gotrendy Beauty Advisor — „light luxury” editorial, mobile-first. */
:root {
  --ivory: #fbf7f4;
  --paper: #ffffff;
  --blush: #f4e6e2;
  --blush-deep: #e9cfc8;
  --ink: #1d1a1a;
  --ink-soft: #5d5552;
  --ink-faint: #9a908c;
  --red: #c8102e;
  --red-deep: #9e0b23;
  --gold: #b8913f;
  --line: #ebe1dc;

  --serif: "Bodoni 72", "Didot", "Bodoni Moda", Georgia, serif;
  --sans: "Avenir Next", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", sans-serif;

  --text-sm: 0.8125rem;
  --text-base: clamp(0.95rem, 0.9rem + 0.25vw, 1.0625rem);
  --text-hero: clamp(2.1rem, 1.4rem + 3.5vw, 3.2rem);

  --radius-bubble: 22px;
  --radius-card: 16px;
  --shadow-card: 0 1px 0 rgba(29, 26, 26, 0.04), 0 8px 24px -12px rgba(110, 40, 40, 0.25);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 150ms;
  --normal: 320ms;
  --maxw: 760px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ivory);
  color: var(--ink);
  font: 400 var(--text-base)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; width: 100%; height: 100dvh; max-width: var(--maxw); margin: 0 auto; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: color-mix(in srgb, var(--ivory) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.wordmark { font-weight: 600; letter-spacing: 0.32em; font-size: 0.95rem; padding-left: 0.32em; }
.wordmark span { color: var(--red); }
.wordmark.small { font-size: 0.8rem; }
.subtitle { font-family: var(--serif); font-style: italic; font-size: 0.85rem; color: var(--ink-soft); margin-top: 2px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink);
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--blush); }
.icon-btn:active { transform: scale(0.94); }

/* ---- chat ---- */
.chat { min-width: 0; overflow-y: auto; padding: 8px 16px 24px; scroll-behavior: smooth; overscroll-behavior: contain; }
.welcome { padding: 9vh 4px 12px; }
.eyebrow { margin: 0; font-size: var(--text-sm); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.welcome h1 { font: 400 var(--text-hero)/1.02 var(--serif); margin: 10px 0 12px; letter-spacing: -0.01em; }
.lede { color: var(--ink-soft); margin: 0 0 26px; max-width: 34ch; }
.starters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.starter {
  text-align: left; padding: 14px 14px 13px; border-radius: var(--radius-card);
  background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 2px;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.starter b { font-family: var(--serif); font-weight: 400; font-size: 1.05rem; }
.starter span { color: var(--ink-faint); font-size: var(--text-sm); }
.starter:hover { border-color: var(--blush-deep); transform: translateY(-2px); }
.starter:nth-child(4) { background: linear-gradient(135deg, #2a1416, #5b1420); color: #fff; border-color: transparent; }
.starter:nth-child(4) span { color: #e8c7c4; }

.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; flex-direction: column; gap: 10px; animation: rise var(--normal) var(--ease) both; }
.msg.user { align-items: flex-end; }
.bubble { max-width: 86%; padding: 11px 15px; border-radius: var(--radius-bubble); white-space: pre-wrap; word-wrap: break-word; }
.msg.user .bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
.msg.user .photo { width: 140px; height: 140px; object-fit: cover; border-radius: 18px; border: 3px solid var(--paper); box-shadow: var(--shadow-card); }
.msg.bot .bubble { max-width: 100%; padding: 2px 2px; white-space: normal; }
.msg.bot .bubble p { margin: 0 0 0.7em; }
.msg.bot .bubble p:last-child { margin-bottom: 0; }
.msg.bot .bubble ul { margin: 0 0 0.7em; padding-left: 1.1em; }
.msg.bot .bubble li { margin: 0.15em 0; }
.msg.bot .bubble li::marker { color: var(--red); }
.msg.bot .bubble strong { font-weight: 600; }
.msg.error .bubble { color: var(--red-deep); }

.experts { display: flex; gap: 6px; flex-wrap: wrap; }
.expert {
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px 3px; border-radius: 999px; background: var(--blush); color: var(--red-deep);
}
.expert.skincare { background: #e8efe6; color: #3f5e3a; }
.expert.colorimetry { background: #f3ead8; color: #7a5a1c; }

.typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blush-deep); animation: blink 1.2s infinite var(--ease); }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }

/* ---- product cards ---- */
.products { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 4px 16px 10px; }
.products::-webkit-scrollbar { display: none; }
.product {
  flex: 0 0 min(64%, 220px); scroll-snap-align: start;
  background: var(--paper); border-radius: var(--radius-card); border: 1px solid var(--line);
  box-shadow: var(--shadow-card); overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  transition: transform var(--fast) var(--ease);
}
.product:hover { transform: translateY(-3px); }
.product .media { aspect-ratio: 1; background: #f6f1ee; display: grid; place-items: center; }
.product img { width: 100%; height: 100%; object-fit: contain; }
.product .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product .brand-name { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.product .title { font-size: 0.88rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product .price { margin-top: auto; display: flex; align-items: baseline; gap: 8px; }
.product .now { font-weight: 600; color: var(--red); }
.product .was { font-size: var(--text-sm); color: var(--ink-faint); text-decoration: line-through; }
.product .cta { margin-top: 8px; font-size: var(--text-sm); color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; }
.products-note { font-size: 0.75rem; color: var(--ink-faint); margin: -4px 0 0; }

/* ---- AI Visual Beauty Tutor ---- */
.guide { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-card); overflow: hidden; }
.guide-head { padding: 16px 18px 4px; }
.guide-head .zone-label { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.guide-head h3 { font: 400 1.35rem/1.15 var(--serif); margin: 4px 0 0; }
.guide-figure { margin: 0; padding: 4px 6px 0; background: radial-gradient(120% 80% at 50% 30%, #fff 0%, var(--ivory) 100%); }
.face-art { display: block; width: 100%; height: auto; stroke: none; stroke-width: 1; fill: none; }
.face-art .fa-line { fill-opacity: 1; stroke: #9a7466; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.face-art .fa-line.face { stroke: #c79a88; stroke-width: 1.4; }
.face-art .fa-part { fill: none; stroke: #c9a48a; stroke-width: 1.4; stroke-linecap: round; opacity: 0.8; }
.face-art path.fa-line:not([fill]) { fill: none; }
.face-art .fa-line.soft { stroke-opacity: 0.45; stroke-width: 1.3; }
.face-art .fa-lid { fill: none; stroke: #241815; stroke-width: 2.6; stroke-linecap: round; }
.face-art .fa-lash { fill: none; stroke: #241815; stroke-width: 1.6; stroke-linecap: round; }
.face-art .fa-strands path { fill: none; stroke: #3f2a21; stroke-opacity: 0.16; stroke-width: 1.4; }
.face-art .fa-zone { opacity: 0.78; mix-blend-mode: multiply; animation: zone-in 700ms var(--ease) both; }
.face-art .fa-zone.on-top { opacity: 0.9; mix-blend-mode: normal; }
.face-art .fa-zone.light { opacity: 1; mix-blend-mode: normal; filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.9)); }
.face-art .fa-zone.wash { opacity: 0.35; }
.face-art .fa-leader { fill: none; stroke: #1d1a1a; stroke-width: 1.3; stroke-dasharray: 3 4; opacity: 0.75; }
.face-art .fa-anchor { fill: #1d1a1a; }
.face-art .fa-swatch { stroke: #1d1a1a; stroke-width: 1.6; }
.face-art .fa-badge { fill: var(--red); }
.face-art .fa-badge-num { fill: #fff; font: 600 12px var(--sans); }
.face-art .fa-label { fill: var(--ink); font: 500 15px var(--sans); }
.face-art .fa-callout { animation: zone-in 500ms var(--ease) both; animation-delay: calc(var(--i, 0) * 140ms + 200ms); }
.face-art .fa-arrow { fill: none; stroke: #1d1a1a; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 80; stroke-dashoffset: 80; animation: draw 900ms var(--ease) 600ms forwards; }
.face-art .fa-dot { fill: #1d1a1a; transform-box: fill-box; transform-origin: center; animation: tap 1.4s var(--ease) infinite; }
.guide ol { list-style: none; counter-reset: step; margin: 0; padding: 4px 16px 14px; }
.guide li { counter-increment: step; display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.guide li::before { content: counter(step); font: 400 1.35rem/1.1 var(--serif); color: var(--red); }
.step-name { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.95rem; }
.step-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(29, 26, 26, 0.35); flex: none; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.meta { display: inline-flex; align-items: center; gap: 5px; font-size: 0.75rem; padding: 3px 9px; border-radius: 999px; background: var(--ivory); border: 1px solid var(--line); color: var(--ink-soft); }
.meta-ico { color: var(--red); font-size: 0.7rem; }
.step-text { margin: 2px 0 0; font-size: 0.92rem; color: var(--ink); }

/* ---- quick replies ---- */
.quick { display: flex; flex-direction: column; gap: 8px; }
.quick-q { font-family: var(--serif); font-style: italic; color: var(--ink-soft); margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--ink); background: transparent; border-radius: 999px; padding: 8px 14px;
  font-size: 0.9rem; transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.chip:hover { background: var(--ink); color: #fff; }
.chip[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.chip:disabled { opacity: 0.4; cursor: default; }
.chips-send { align-self: flex-start; }

/* ---- composer ---- */
.composer {
  padding: 8px 12px max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--ivory) 70%, transparent);
}
.composer-row {
  display: flex; align-items: flex-end; gap: 6px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 28px; padding: 5px 5px 5px 6px; box-shadow: var(--shadow-card);
  transition: border-color var(--fast) var(--ease);
}
.composer-row:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.12), var(--shadow-card); }
textarea:focus-visible { outline: none; }
textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; padding: 9px 4px; max-height: 140px; line-height: 1.4; }
.send { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--red); color: #fff; display: grid; place-items: center; transition: background var(--fast) var(--ease), transform var(--fast) var(--ease); }
.send:hover:not(:disabled) { background: var(--red-deep); }
.send:active:not(:disabled) { transform: scale(0.94); }
.send:disabled { background: var(--blush-deep); cursor: default; }
.photo-btn { cursor: pointer; color: var(--ink-soft); }
.attach-preview { position: relative; width: 72px; margin: 0 0 8px 8px; }
.attach-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 14px; border: 2px solid var(--paper); box-shadow: var(--shadow-card); }
.attach-preview .remove { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; line-height: 1; }
.fineprint { text-align: center; font-size: 0.7rem; color: var(--ink-faint); margin: 6px 0 0; }
.fineprint a { color: inherit; }

/* ---- drawer ---- */
.scrim { position: fixed; inset: 0; background: rgba(29, 26, 26, 0.35); z-index: 9; animation: fade var(--normal) var(--ease); }
.drawer {
  position: fixed; inset: 0 auto 0 0; width: min(84vw, 340px); z-index: 10; overflow-y: auto;
  background: var(--paper); padding: max(12px, env(safe-area-inset-top)) 16px 24px;
  box-shadow: 20px 0 40px -20px rgba(29, 26, 26, 0.35);
  animation: slide var(--normal) var(--ease);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-new { width: 100%; margin: 12px 0 18px; padding: 11px; border-radius: 14px; border: 1px dashed var(--blush-deep); background: var(--ivory); }
.drawer-title { font: 400 1.05rem var(--serif); margin: 18px 0 8px; }
.history { list-style: none; margin: 0; padding: 0; }
.history button { width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 8px; border-radius: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history button:hover, .history button[aria-current="true"] { background: var(--blush); }
.history .empty { color: var(--ink-faint); font-size: var(--text-sm); padding: 6px 8px; }
.switch { display: flex; gap: 10px; align-items: center; font-size: 0.92rem; }
.switch input { width: 20px; height: 20px; accent-color: var(--red); }
.profile-fields { margin: 12px 0; font-size: var(--text-sm); }
.profile-fields dt { color: var(--ink-faint); margin-top: 6px; }
.profile-fields dd { margin: 0; }
.danger { margin-top: 18px; border: 0; background: transparent; color: var(--red-deep); text-decoration: underline; padding: 0; font-size: var(--text-sm); }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes zone-in { from { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes tap { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.6); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(-100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (min-width: 768px) {
  .chat { padding: 16px 28px 32px; }
  .starters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .bubble { max-width: 74%; }
  .product { flex-basis: 200px; }
}
