:root {
  color-scheme: light;
  --bg: #fff7fb;
  --panel: #ffffff;
  --pink: #f6a9c9;
  --pink-strong: #e76fa6;
  --lavender: #b9a7f5;
  --mint: #9bdcc4;
  --text: #362334;
  --muted: #8b7086;
  --ai: #f8eefc;
  --user: #e86da3;
  --line: #f3ddeb;
  --shadow: 0 24px 80px rgba(159, 92, 130, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(246, 169, 201, 0.45), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(185, 167, 245, 0.35), transparent 30rem),
    var(--bg);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100dvh;
  width: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
}

.onboarding-card,
.chat-card {
  width: min(940px, 100%);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.onboarding-card {
  min-height: min(720px, calc(100vh - 48px));
  padding: 24px;
}

.onboarding-head,
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.onboarding-head {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.45rem;
  line-height: 1.1;
}

h2 {
  margin-top: 24px;
  font-size: 1.6rem;
}

p {
  color: var(--muted);
  font-size: 0.95rem;
}

.setup-copy {
  max-width: 620px;
  margin-top: 8px;
  line-height: 1.55;
}

.soft-pill {
  padding: 8px 12px;
  border-radius: 999px;
  color: #965677;
  background: #fff1f8;
  border: 1px solid #f1d4e4;
  font-size: 0.85rem;
  white-space: nowrap;
}

.choice-grid,
.persona-grid {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.choice-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.persona-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.choice-card,
.persona-card {
  min-width: 0;
  min-height: 210px;
  padding: 18px;
  border: 1px solid #efd5e4;
  border-radius: 20px;
  color: var(--text);
  background: rgba(255, 250, 253, 0.94);
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.persona-card {
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: clamp(340px, 38vw, 390px) 1fr;
}

.choice-card:hover,
.persona-card:hover {
  transform: translateY(-2px);
  border-color: var(--pink-strong);
  box-shadow: 0 16px 34px rgba(231, 111, 166, 0.16);
}

.choice-card strong,
.persona-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.1rem;
}

.persona-preview {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #f8eef6;
  border-bottom: 1px solid #efd5e4;
}

.persona-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(180deg, transparent, rgba(35, 19, 31, 0.3));
  pointer-events: none;
}

.persona-preview-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.03);
  animation: personaPreviewFade calc(var(--slide-count) * 3.2s) infinite ease-in-out;
  animation-delay: calc(var(--slide-index) * 3.2s);
}

.persona-preview-img:first-child {
  opacity: 1;
}

.persona-preview-img:only-child {
  animation: none;
  opacity: 1;
  transform: scale(1);
}

.persona-card:hover .persona-preview-img {
  transform: scale(1.06);
}

.persona-preview-fallback {
  display: grid;
  place-items: center;
}

.persona-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

@keyframes personaPreviewFade {
  0%,
  8% {
    opacity: 0;
  }

  14%,
  34% {
    opacity: 1;
  }

  42%,
  100% {
    opacity: 0;
  }
}

.persona-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.age-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #8d476a;
  background: #fff1f8;
  border: 1px solid #f1d4e4;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.choice-card small,
.persona-card small,
.persona-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.9rem;
  font-style: normal;
}

.persona-summary {
  margin-top: 10px;
  color: #5d4058;
  font-size: 0.92rem;
  line-height: 1.48;
  min-height: 4.1em;
}

.choice-icon,
.kpop-avatar {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: white;
  font-weight: 900;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.9) 0 9%, transparent 10%),
    linear-gradient(135deg, var(--pink-strong), var(--lavender) 58%, var(--mint));
  box-shadow: 0 12px 28px rgba(231, 111, 166, 0.22);
}

.image-avatar {
  padding: 0;
  background: #f8eef6;
}

.image-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.persona-card .vibe-pill {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #9b5075;
  background: #fff1f8;
  font-size: 0.78rem;
}

.text-button {
  margin-top: 20px;
  padding: 0;
  border: 0;
  color: #9b5075;
  background: transparent;
}

.intro-form {
  max-width: 680px;
}

.intro-form label {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  color: #62465b;
  font-weight: 700;
}

.intro-form input {
  width: 100%;
  border: 1px solid #ecd5e4;
  border-radius: 15px;
  padding: 13px 14px;
  color: var(--text);
  background: #fff9fd;
  outline: none;
  font-weight: 500;
}

.intro-form input:focus {
  border-color: var(--pink-strong);
  box-shadow: 0 0 0 4px rgba(231, 111, 166, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: 0.55fr 1fr;
  gap: 12px;
}

.primary-wide {
  width: 100%;
  margin-top: 20px;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink-strong), var(--lavender));
}

.chat-card {
  height: min(820px, calc(100vh - 48px));
  min-height: 560px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  max-width: 100%;
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.brand-text {
  min-width: 0;
  flex: 1;
}

.brand-text h1 {
  font-size: 1.1rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-text p {
  font-size: 0.8rem;
  margin: 2px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: white;
  font-weight: 800;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95) 0 8%, transparent 9%),
    linear-gradient(135deg, var(--pink-strong), var(--lavender));
  box-shadow: 0 10px 28px rgba(231, 111, 166, 0.28);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.ghost-button {
  border: 1px solid #efd5e4;
  background: #fff8fc;
  color: #9b5075;
  border-radius: 999px;
  padding: 10px 14px;
  white-space: nowrap;
}

.messages {
  overflow-y: auto;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.empty-state {
  margin: auto;
  max-width: 360px;
  text-align: center;
  color: var(--muted);
  line-height: 1.55;
}

.message-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.message-row.user {
  justify-content: flex-end;
}

.message-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(78%, 640px);
  min-width: 0;
}

.message-row.user .message-content {
  align-items: flex-end;
}

.message-time {
  font-size: 0.75rem;
  color: #bbb;
  margin-top: 4px;
  padding: 0 4px;
  cursor: help;
}

.message-row.user .message-time {
  color: rgba(255, 255, 255, 0.6);
}

.date-separator {
  text-align: center;
  color: #bbb;
  font-size: 0.85rem;
  margin: 16px 0 12px 0;
  padding: 0 20px;
  position: relative;
}

.date-separator::before,
.date-separator::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30%;
  height: 1px;
  background: #e0d5e0;
}

.date-separator::before {
  left: 0;
}

.date-separator::after {
  right: 0;
}

.bubble {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 12px 15px;
  border-radius: 20px;
  line-height: 1.48;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
  box-shadow: 0 8px 24px rgba(132, 88, 116, 0.09);
}

.compact-bubble {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  max-width: 100%;
}

.message-row.assistant .bubble {
  border-bottom-left-radius: 7px;
  background: var(--ai);
  color: #433044;
}

.chat-image-bubble {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-radius: 18px;
  border-bottom-left-radius: 7px;
  overflow: hidden;
  background: #f5edf3;
  box-shadow: 0 10px 28px rgba(132, 88, 116, 0.16);
  cursor: pointer;
}

.chat-image-bubble img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-image-bubble-missing {
  display: grid;
  place-items: center;
  padding: 18px;
  color: #9b5075;
  font-weight: 700;
  text-align: center;
  cursor: default;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 58px;
  min-height: 42px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ad7ea4;
  opacity: 0.35;
  animation: typingPulse 1.15s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes typingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.message-row.user .bubble {
  border-bottom-right-radius: 7px;
  background: linear-gradient(135deg, var(--user), #bd8ff0);
  color: white;
}

.mini-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--pink), var(--lavender));
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.9);
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 20px;
  overflow: hidden;
}

.skeleton-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  animation: fadeIn 0.5s ease-in-out;
}

.skeleton-avatar {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.skeleton-bubble {
  height: 42px;
  width: 45%;
  border-radius: 16px;
  background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Memory Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
}

.modal.hidden {
  display: none;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-content {
  background: white;
  border-radius: 28px 28px 0 0;
  max-height: 70vh;
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #efd5e4;
  background: #fff8fc;
  color: #9b5075;
  font-size: 1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.close-btn:hover {
  background: #fff1f8;
  border-color: var(--pink-strong);
}

.memories-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.memory-item {
  padding: 12px;
  background: #f8eefc;
  border-radius: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.memory-item-key {
  font-weight: 600;
  font-size: 0.9rem;
  color: #9b5075;
  min-width: 80px;
}

.memory-item-value {
  flex: 1;
  color: #333;
  font-size: 0.9rem;
  word-break: break-word;
}

.memory-delete-btn {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
}

.memory-delete-btn:hover {
  color: var(--pink-strong);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
}

.modal-footer .ghost-button {
  flex: 1;
}

.modal-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.images-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.image-card {
  border-radius: 12px;
  overflow: hidden;
  background: #f8eefc;
  cursor: pointer;
  transition: all 0.2s;
  aspect-ratio: 3 / 4;
  position: relative;
}

.image-card:hover {
  transform: scale(1.02);
  box-shadow: 0 8px 24px rgba(159, 92, 130, 0.2);
}

.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-card-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f6a9c9, #b9a7f5);
  color: white;
  font-size: 2rem;
}

.images-grid.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-template-columns: none;
}

.images-empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
}

.images-empty-state p {
  margin: 12px 0;
}

.composer input {
  width: 100%;
  min-width: 0;
  border: 1px solid #ecd5e4;
  border-radius: 999px;
  padding: 14px 17px;
  color: var(--text);
  background: #fff9fd;
  outline: none;
  font-size: 1rem;
}

.composer input:focus {
  border-color: var(--pink-strong);
  box-shadow: 0 0 0 4px rgba(231, 111, 166, 0.16);
}

.composer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #efd5e4;
  background: #fff8fc;
  color: #9b5075;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s;
  flex: 0 0 40px;
}

.composer-icon-btn:hover {
  background: #fff1f8;
  border-color: var(--pink-strong);
  transform: scale(1.05);
}

.composer-icon-btn:active {
  transform: scale(0.95);
}

.composer-icon-btn[data-recording="true"] {
  background: var(--pink-strong);
  border-color: var(--pink-strong);
  color: white;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.primary-btn {
  border: 0;
  min-height: 46px;
  border-radius: 16px;
  padding: 0 22px;
  font-weight: 800;
  color: white;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 38%),
    linear-gradient(135deg, var(--pink-strong), #c08bf1);
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(231, 111, 166, 0.26);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.primary-btn:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: 0 12px 28px rgba(231, 111, 166, 0.32);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 6px 16px rgba(231, 111, 166, 0.22);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 760px) {
  html,
  body {
    background: #fff7fb;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell {
    padding: 0;
    min-height: 100dvh;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .onboarding-card,
  .chat-card {
    min-height: 100dvh;
    height: 100dvh;
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: none;
    border: 0;
  }

  .onboarding-card {
    overflow-y: auto;
    padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.96);
  }

  .choice-grid.two,
  .persona-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .persona-card {
    min-height: auto;
    padding: 0;
    grid-template-rows: minmax(260px, 46dvh) auto;
  }

  .persona-preview {
    aspect-ratio: auto;
  }

  .persona-card-body {
    padding: 14px 16px 16px;
  }

  .persona-summary {
    font-size: 0.9rem;
    min-height: 0;
  }

  .age-badge {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 0.78rem;
  }

  .chat-header {
    align-items: center;
    padding: calc(12px + env(safe-area-inset-top)) 12px 12px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .brand {
    flex: 1;
    gap: 10px;
    min-width: 0;
  }

  .brand-text h1 {
    font-size: 0.95rem;
  }

  .brand-text p {
    font-size: 0.7rem;
  }

  .header-actions {
    width: 92px;
    flex: 0 0 92px;
    display: grid;
    grid-template-columns: repeat(2, 40px);
    justify-content: end;
    gap: 6px;
  }

  .header-actions .ghost-button {
    width: 40px;
    min-width: 0;
    height: 34px;
    padding: 0;
    font-size: 0.75rem;
    display: inline-grid;
    place-items: center;
    overflow: hidden;
    text-overflow: clip;
  }

  .avatar {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    font-size: 1rem;
  }

  .mini-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    font-size: 0.7rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 1.35rem;
    margin-top: 16px;
  }

  p {
    font-size: 0.84rem;
  }

  .messages {
    padding: 12px 10px 14px;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
  }

  .message-content {
    max-width: 84%;
  }

  .message-row.assistant .message-content {
    max-width: 82%;
  }

  .bubble {
    max-width: 100%;
    padding: 11px 13px;
    font-size: 0.95rem;
  }

  .composer {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
    gap: 8px;
    background: rgba(255, 255, 255, 0.96);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .composer input {
    padding: 12px 14px;
    font-size: 16px;
    border-radius: 20px;
  }

  .composer-actions {
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
  }

  .composer-icon-btn {
    width: 36px;
    height: 36px;
  }

  .primary-btn {
    min-width: 58px;
    min-height: 42px;
    border-radius: 14px;
    padding: 0 14px;
    font-size: 0.9rem;
  }

  .compact-bubble {
    max-width: 100%;
    white-space: pre-wrap;
    overflow-wrap: break-word;
  }

  .modal-content {
    border-radius: 24px 24px 0 0;
    max-height: 80dvh;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .memories-list {
    padding: 12px 16px;
  }

  .memory-item {
    padding: 10px;
    margin-bottom: 8px;
  }
}

@media (max-width: 380px) {
  .chat-header {
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-text p {
    display: none;
  }

  .avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .header-actions {
    width: 84px;
    flex-basis: 84px;
    grid-template-columns: repeat(2, 38px);
    gap: 5px;
  }

  .header-actions .ghost-button {
    width: 38px;
    height: 32px;
    font-size: 0.7rem;
  }

  .messages {
    padding-left: 8px;
    padding-right: 8px;
  }

  .message-content {
    max-width: 86%;
  }

  .message-row.assistant .message-content {
    max-width: 84%;
  }

  .composer {
    padding-left: 8px;
    padding-right: 8px;
    gap: 6px;
  }

  .composer-icon-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .primary-btn {
    min-width: 52px;
    padding: 0 11px;
  }
}
