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

:root {
  --bg: #FFF0F7;
  --surface: #ffffff;
  --border: #F9A8C9;
  --accent: #FF3EA5;
  --accent-2: #E91E8C;
  --text: #3D0026;
  --text-muted: #B05080;
  --user-bg: #FF3EA5;
  --radius: 18px;
  --font: 'DM Sans', system-ui, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #FFF0F7 0%, #FFE4F0 100%);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
}

/* ── Header ── */
header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 22px 24px 18px;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(255, 62, 165, 0.3);
}

.logo {
  font-family: 'Pacifico', cursive;
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #ffffff;
  text-shadow: 1px 2px 0 rgba(0,0,0,0.12);
}

#reset-btn {
  position: absolute;
  right: 24px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#reset-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ── Messages ── */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.msg {
  max-width: 80%;
  padding: 11px 16px;
  border-radius: var(--radius);
  animation: fadein 0.18s ease;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--user-bg);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(255, 62, 165, 0.25);
}

.msg.bot {
  align-self: flex-start;
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(240, 100, 160, 0.1);
}

/* ── Typing indicator ── */
.typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-bottom-left-radius: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite;
}

.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; }
  40% { opacity: 1; }
}

/* ── Footer ── */
footer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 20px 24px;
  background: #FFD6EA;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

#input {
  flex: 1;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  padding: 14px 20px;
  resize: none;
  outline: none;
  min-height: 52px;
  max-height: 180px;
  overflow-y: auto;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 62, 165, 0.15);
}

#input::placeholder {
  color: #D499B9;
}

#send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 3px 10px rgba(255, 62, 165, 0.4);
}

#send-btn:hover {
  background: var(--accent-2);
  transform: scale(1.05);
}

#send-btn:disabled {
  opacity: 0.35;
  cursor: default;
  transform: none;
}
