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

body {
  font-family: Arial, sans-serif;
  background: #ffffff;
  color: #202123;
  height: 100vh;
  overflow: hidden;
}

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}


/* =========================
   HEADER
========================= */

.header {
  height: 60px;
  min-height: 60px;
  flex-shrink: 0;

  border-bottom: 1px solid #e5e5e5;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 14px;

  background: #ffffff;

  position: relative;
  z-index: 10;
}

.title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.logo {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #f1f1f1;
  border-radius: 50%;

  font-size: 21px;
}

.title h1 {
  font-size: 17px;
}

.title small {
  color: #777;
  font-size: 11px;
}

.icon-btn {
  border: none;
  background: transparent;

  font-size: 21px;

  width: 40px;
  height: 40px;

  border-radius: 10px;

  cursor: pointer;
}

.icon-btn:active {
  background: #eeeeee;
}


/* =========================
   CHAT
========================= */

.chat {
  flex: 1;
  min-height: 0;

  overflow-y: auto;

  padding: 30px 12px 180px;

  scroll-behavior: smooth;

  position: relative;
  z-index: 1;
}


/* Welcome */

.welcome {
  min-height: 70vh;

  display: flex;
  flex-direction: column;

  justify-content: center;
  align-items: center;

  text-align: center;
}

.welcome-logo {
  font-size: 48px;

  width: 80px;
  height: 80px;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #f3f3f3;

  border-radius: 50%;

  margin-bottom: 20px;
}

.welcome h2 {
  font-size: 25px;
  margin-bottom: 8px;
}

.welcome p {
  color: #777;
  font-size: 14px;
}


/* =========================
   MESSAGES
========================= */

.message {
  display: flex;

  gap: 10px;

  width: 100%;
  max-width: 850px;

  margin: 0 auto 20px;

  line-height: 1.55;

  font-size: 15px;

  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.message > span {
  flex-shrink: 0;

  width: 32px;
  height: 32px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;

  background: #f1f1f1;
}

.message > div {
  padding-top: 5px;

  min-width: 0;

  white-space: normal;
}


/* User */

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

.message.user > span {
  order: 2;
}

.message.user > div {
  background: #f1f1f1;

  padding: 10px 14px;

  border-radius: 16px;

  max-width: 80%;

  white-space: pre-wrap;
}


/* AI */

.message.ai > div {
  max-width: calc(100% - 45px);
}


/* =========================
   AI TEXT FORMATTING
========================= */

.message.ai strong {
  font-weight: 700;
}

.message.ai h2,
.message.ai h3 {
  margin: 8px 0;
  line-height: 1.3;
}

.message.ai h2 {
  font-size: 19px;
}

.message.ai h3 {
  font-size: 17px;
}


/* =========================
   INPUT AREA
========================= */

.input-area {
  position: fixed;

  bottom: 0;
  left: 0;
  right: 0;

  z-index: 20;

  background: #ffffff;

  padding: 10px 12px 12px;

  border-top: 1px solid #eeeeee;
}

.input-box {
  max-width: 850px;

  margin: auto;

  display: flex;
  align-items: flex-end;

  gap: 8px;

  border: 1px solid #d9d9d9;

  border-radius: 24px;

  padding: 7px 8px 7px 14px;

  background: #ffffff;

  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

textarea {
  flex: 1;

  border: none;
  outline: none;

  resize: none;

  font-family: inherit;
  font-size: 15px;

  line-height: 22px;

  max-height: 100px;

  padding: 6px 0;

  background: transparent;
}

.send-btn {
  width: 38px;
  height: 38px;

  border: none;

  border-radius: 50%;

  background: #222;
  color: white;

  font-size: 18px;

  cursor: pointer;

  flex-shrink: 0;
}

.send-btn:active {
  transform: scale(0.92);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.disclaimer {
  text-align: center;

  font-size: 10px;

  color: #888;

  margin-top: 7px;
}


/* =========================
   SCROLLBAR
========================= */

.chat::-webkit-scrollbar {
  width: 5px;
}

.chat::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 10px;
}


/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

  .header {
    height: 56px;
    min-height: 56px;
  }

  .chat {
    padding: 25px 10px 175px;
  }

  .message {
    font-size: 14px;

    margin-bottom: 17px;

    gap: 8px;
  }

  .message > span {
    width: 30px;
    height: 30px;
  }

  .message.ai > div {
    max-width: calc(100% - 38px);
  }

  .message.user > div {
    max-width: 78%;
  }

  .welcome h2 {
    font-size: 22px;
  }

  .welcome-logo {
    width: 70px;
    height: 70px;
    font-size: 40px;
  }

  .input-area {
    padding: 8px 8px 10px;
  }

  .input-box {
    padding-left: 13px;
  }

  textarea {
    font-size: 14px;
  }
}