/* Tokens */
:root {
  --cream: #F8F1EA;
  --rose: #E8C9C4;
  --rose-soft: #F3E1DC;
  --brown: #6B5348;
  --wine: #8C3B4A;
  --wine-deep: #74303D;
  --white: #FFFDFB;

  --shadow-soft: 0 10px 30px rgba(107, 83, 72, .14);
  --shadow-lift: 0 14px 36px rgba(140, 59, 74, .22);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-hand: 'Caveat', 'DM Sans', cursive;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--brown);
  background:
    radial-gradient(120% 70% at 50% 0%, #FBF6F1 0%, transparent 60%),
    radial-gradient(90% 60% at 50% 100%, var(--rose-soft) 0%, transparent 70%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}

/* Lazos decorativos a los lados (solo con espacio de sobra) */
.bows { display: none; }
@media (min-width: 760px) {
  .bows { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 0; }
  .bows span { position: absolute; font-size: 44px; opacity: .14; filter: saturate(.6); }
  .bows span:nth-child(1) { top: 14%; left: 12%; transform: rotate(-14deg); }
  .bows span:nth-child(2) { top: 62%; left: 18%; transform: rotate(10deg); font-size: 30px; }
  .bows span:nth-child(3) { top: 24%; right: 15%; transform: rotate(12deg); font-size: 32px; }
  .bows span:nth-child(4) { top: 72%; right: 11%; transform: rotate(-8deg); }
}

/* Columna tipo móvil */
.phone {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 16px max(18px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
@media (min-width: 540px) {
  body { display: flex; align-items: center; justify-content: center; padding: 24px 0; }
  .phone {
    min-height: 0;
    height: min(100dvh - 48px, 860px);
    padding-top: 0;
    border-radius: 30px;
    background: rgba(248, 241, 234, .72);
    box-shadow: 0 30px 80px rgba(107, 83, 72, .16), 0 0 0 1px rgba(232, 201, 196, .7);
    overflow: hidden;
  }
}

/* Cabecera de chat */
.chat-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -16px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: rgba(248, 241, 234, .9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rose);
}
.avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--cream), 0 0 0 3.5px var(--wine);
}
.who { min-width: 0; }
.name {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: var(--brown);
}
.bow { display: inline-block; transform-origin: 50% 60%; }
.status {
  font-size: .76rem;
  line-height: 1.3;
  color: var(--brown);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Foto */
.photo {
  position: relative;
  flex: 1 1 0;
  display: flex;
  min-height: 220px;
  border-radius: 22px;
  overflow: hidden;
  background: var(--rose-soft);
  box-shadow: var(--shadow-soft);
}
.photo img {
  display: block;
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  object-position: center 30%;
}
.tag {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 2px 12px 4px;
  border-radius: 999px;
  background: rgba(255, 253, 251, .9);
  font-family: var(--font-hand);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--wine-deep);
  transform: rotate(-2deg);
}

/* Banner de oferta */
.offer {
  padding: 11px 14px;
  border-radius: 16px;
  background: var(--rose-soft);
  border: 1px dashed var(--rose);
  text-align: center;
}
.offer[hidden] { display: none; }
.offer-text {
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--wine-deep);
}
.countdown {
  margin-top: 4px;
  font-size: .8rem;
  color: var(--brown);
}
.countdown time {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--wine-deep);
}

/* Firma: barra de "Responder" — el elemento que más llama la atención */
.reply {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 7px 7px 7px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, #9A4253 0%, var(--wine) 55%, var(--wine-deep) 100%);
  box-shadow: 0 16px 34px rgba(140, 59, 74, .38), inset 0 1px 0 rgba(255, 255, 255, .18);
  color: var(--cream);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .16s var(--ease-out), box-shadow .2s ease;
}
/* Halo que "late" alrededor del botón */
.reply::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 2px solid rgba(140, 59, 74, .45);
  opacity: 0;
  pointer-events: none;
}
.reply:hover { box-shadow: 0 20px 40px rgba(140, 59, 74, .46), inset 0 1px 0 rgba(255, 255, 255, .18); }
.reply:active { transform: scale(.97); }
.reply:focus-visible { outline: 3px solid var(--wine-deep); outline-offset: 5px; }
.reply-field {
  flex: 1;
  font-size: 1.14rem;
  font-weight: 600;
  letter-spacing: -.005em;
}
.send {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--wine);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.send svg { transition: transform .45s var(--ease-out), opacity .45s ease; }
.reply.is-sending .send svg { animation: none; transform: translate(14px, -14px) scale(.6); opacity: 0; }

/* Entrada orquestada: cabecera → foto → oferta → responder */
@media (prefers-reduced-motion: no-preference) {
  .chat-head, .photo, .offer, .reply { animation: rise .6s var(--ease-out) both; }
  .photo { animation-delay: .08s; }
  .offer { animation-delay: .16s; }
  .reply { animation-delay: .24s; }
  .bow { animation: wiggle 1.1s ease-in-out .8s 1; }
  .reply::before { animation: halo 2.4s ease-out 1s infinite; }
  .send svg { animation: nudge 2.4s ease-in-out 1s infinite; }
}
@keyframes halo {
  0% { opacity: .9; transform: scale(.96); }
  70%, 100% { opacity: 0; transform: scale(1.06, 1.2); }
}
@keyframes nudge {
  0%, 60%, 100% { transform: none; }
  30% { transform: translate(3px, -3px); }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  60% { transform: rotate(9deg); }
}
