/* chat.css — auto-split from styles.css */
/* ===== MESSAGES / CHAT ===== */
.messages-shell {
  width: min(640px, 100%);
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  max-height: min(42vh, 320px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(224, 192, 138, 0.15);
  background: rgba(0, 0, 0, 0.18);
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.messages-shell::-webkit-scrollbar { width: 5px; }
.messages-shell::-webkit-scrollbar-thumb {
  background: rgba(224, 192, 138, 0.35);
  border-radius: 4px;
}
.msg {
  display: flex;
  flex-direction: column;
  max-width: 92%;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.msg.show {
  opacity: 1;
  transform: none;
}
.msg.from-her {
  align-self: flex-start;
  align-items: flex-start;
}
.msg.from-him {
  align-self: flex-end;
  align-items: flex-end;
}
.msg-meta {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
  font-weight: 600;
  opacity: 0.9;
}
.msg-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 1.02rem;
  line-height: 1.65;
  color: #f5efe3;
  position: relative;
}
.msg.from-her .msg-bubble {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(224, 192, 138, 0.22);
  border-bottom-left-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}
.msg.from-him .msg-bubble {
  background: linear-gradient(145deg, rgba(224, 192, 138, 0.18), rgba(224, 192, 138, 0.08));
  border: 1px solid rgba(224, 192, 138, 0.35);
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18), 0 0 24px rgba(224, 192, 138, 0.06);
}
.msg-time {
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 5px;
  opacity: 0.75;
}
.messages-hint {
  text-align: center;
}


.message-composer {
  width: min(640px, 100%);
  margin-top: 28px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(224, 192, 138, 0.28);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2);
  text-align: left;
}
.composer-who {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.who-btn {
  flex: 1;
  border: 1px solid rgba(224, 192, 138, 0.25);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: 0.2s var(--ease);
  margin-top: 0;
  box-shadow: none;
}
.who-btn:hover {
  border-color: rgba(224, 192, 138, 0.45);
  color: var(--text);
  transform: none;
  box-shadow: none;
}
.who-btn.active {
  background: linear-gradient(135deg, rgba(224, 192, 138, 0.25), rgba(224, 192, 138, 0.12));
  border-color: rgba(224, 192, 138, 0.5);
  color: #fffaf0;
  box-shadow: 0 0 20px rgba(224, 192, 138, 0.12);
}
.composer-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(224, 192, 138, 0.25);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.2);
  color: #f5efe3;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.composer-input::placeholder { color: rgba(255, 255, 255, 0.35); }
.composer-input:focus {
  border-color: rgba(224, 192, 138, 0.5);
  box-shadow: 0 0 0 3px rgba(224, 192, 138, 0.1);
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.composer-status {
  font-size: 0.78rem;
  color: var(--muted);
}
.composer-send {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  margin-top: 0;
  color: #1a1610;
  cursor: pointer;
  background: linear-gradient(135deg, #d4af77, #b8954f);
  box-shadow: 0 8px 24px rgba(201, 168, 108, 0.22);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 0.2s, box-shadow 0.2s;
}
.composer-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(201, 168, 108, 0.3);
}
.composer-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.messages-hint {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 18px;
}
.msg-delete {
  border: 0;
  background: transparent;
  color: rgba(201, 168, 108, 0.35);
  font-size: 0.75rem;
  cursor: pointer;
  margin-top: 4px;
  padding: 2px 6px;
  transition: color 0.2s;
}
.msg-delete:hover { color: rgba(232, 180, 150, 0.8); }

@media (max-width: 700px) {
  .message-composer { padding: 16px; }
  .composer-actions { flex-direction: column; align-items: stretch; }
  .composer-send { width: 100%; }
}


/* ===== MOOD METER ===== */
.mood-grid {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
}
.mood-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 100px;
  padding: 16px 10px;
  margin: 0;
  border: 1px solid rgba(224, 192, 138, 0.22);
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s, background 0.25s;
  font-family: inherit;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.mood-btn:hover {
  transform: translateY(-3px);
  border-color: rgba(224, 192, 138, 0.45);
  box-shadow: 0 12px 32px rgba(0,0,0,0.2), 0 0 20px rgba(224, 192, 138, 0.08);
}
.mood-btn.active {
  border-color: rgba(224, 192, 138, 0.55);
  background: linear-gradient(155deg, rgba(224, 192, 138, 0.18), rgba(224, 192, 138, 0.06));
  box-shadow: 0 12px 36px rgba(196, 146, 58, 0.18);
}
.mood-emoji {
  font-size: 1.6rem;
  line-height: 1;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.2));
}
.mood-label {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: #f0e8d8;
}
.mood-reply {
  width: min(520px, 100%);
  margin-top: 24px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  border: 1px solid rgba(224, 192, 138, 0.28);
  background: linear-gradient(155deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03));
  box-shadow: 0 16px 40px rgba(0,0,0,0.2), 0 0 40px rgba(224, 192, 138, 0.06);
  text-align: left;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}
.mood-reply.show {
  opacity: 1;
  transform: none;
}
.mood-reply-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
}
.mood-reply-text {
  margin: 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.05rem, 3.2vw, 1.25rem);
  line-height: 1.65;
  color: #f5efe3;
}

@media (max-width: 700px) {
  .mood-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .mood-btn { min-height: 88px; padding: 14px 8px; }
}

/* visual polish: slightly stronger glass on cards */
.update-card, .daily-card, .memory-card, .future-card {
  border-color: rgba(224, 192, 138, 0.28);
}


/* ===== VISUAL: paper, envelopes, mood, footer, chat ===== */

/* 1 — paper grain on letters */
.letter-paper,
#modalContent.letter-paper,
#modalContent.modal-paper {
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E"),
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(232, 204, 150, 0.14), transparent 50%),
    linear-gradient(165deg, rgba(52, 46, 38, 0.98), rgba(24, 20, 16, 0.99)) !important;
  background-blend-mode: soft-light, normal, normal;
}

/* 2 — envelopes alive */
.envelope {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.3s,
    box-shadow 0.3s !important;
  border-color: rgba(224, 192, 138, 0.32) !important;
}
.envelope::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(232, 204, 150, 0.12);
}
.envelope:hover {
  transform: translateY(-5px) !important;
  border-color: rgba(232, 204, 150, 0.55) !important;
  box-shadow:
    0 18px 40px rgba(0,0,0,0.28),
    0 0 28px rgba(224, 192, 138, 0.12) !important;
}
.envelope:active {
  transform: translateY(-2px) !important;
}

/* 4 — mood active glow */
.mood-btn.active {
  border-color: rgba(232, 204, 150, 0.65) !important;
  background:
    radial-gradient(circle at 50% 30%, rgba(232, 204, 150, 0.22), transparent 55%),
    linear-gradient(155deg, rgba(224, 192, 138, 0.2), rgba(224, 192, 138, 0.06)) !important;
  box-shadow:
    0 0 0 1px rgba(232, 204, 150, 0.25),
    0 12px 32px rgba(0,0,0,0.25),
    0 0 28px rgba(232, 204, 150, 0.2) !important;
}
.mood-btn.active .mood-emoji {
  filter: drop-shadow(0 0 10px rgba(232, 204, 150, 0.55));
  transform: scale(1.08);
}
.mood-btn.active .mood-label {
  color: #fffaf0;
}

/* 5 — footer as story close */
.site-footer {
  padding: 56px 20px 110px !important;
  border-top: none !important;
  background:
    linear-gradient(180deg, transparent, rgba(0,0,0,0.22) 40%, rgba(0,0,0,0.35)) !important;
}
.footer-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
}
.footer-line {
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(224, 192, 138, 0.55), transparent);
}
.footer-heart {
  color: var(--gold);
  font-size: 0.95rem;
  opacity: 0.85;
  font-family: Georgia, serif;
}
.footer-note {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.95rem !important;
  color: #e0d4c0 !important;
  margin-top: 16px !important;
}
.footer-close {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* 6 — chat bubbles clearer */
.msg.from-her .msg-bubble {
  background: linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05)) !important;
  border: 1px solid rgba(224, 192, 138, 0.28) !important;
  border-bottom-left-radius: 6px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}
.msg.from-him .msg-bubble {
  background: linear-gradient(145deg, rgba(232, 204, 150, 0.28), rgba(196, 146, 58, 0.12)) !important;
  border: 1px solid rgba(232, 204, 150, 0.45) !important;
  border-bottom-right-radius: 6px !important;
  box-shadow: 0 8px 24px rgba(196, 146, 58, 0.12);
  color: #fffaf0 !important;
}
.msg.from-her .msg-meta {
  color: #c9bda8;
}
.msg.from-him .msg-meta {
  color: var(--gold);
  text-align: right;
}

@media (max-width: 700px) {
  .envelope:hover {
    transform: none !important;
  }
  .mood-btn.active {
    box-shadow: 0 8px 24px rgba(0,0,0,0.2), 0 0 16px rgba(232, 204, 150, 0.12) !important;
  }
}


