/* ==============
  version: MjAyNS0wNi0zMCAyMjo0OTozOS4yOTM3NzgrMDk6MDA=
  ============== */

* {
  padding: 0;
  margin: 0;
}

body {
  display: flex;
  width: 100vw;
  height: 100vh;
}

section {
  width: 50vw;
  height: 100vh;
}

.left {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'M PLUS 1p', sans-serif;
  font-style: normal;
  text-shadow: 0 4px 4px rgb(0 0 0 / 25%);
  background-color: rgb(0 0 0 / 60%);
  background-image: var(--left-background-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  background-blend-mode: darken;
}

.right {
  display: flex;
  flex-direction: column;
  background-color: #f6f7fb;
}

/* Botのプロフィール */

.profile {
  width: 100%;
  text-align: center;
}

.profile img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
}

.profile h1 {
  margin-top: 16px;
  font-size: 30px;
  font-family: "DotGothic16", sans-serif;
  font-weight: 400;
  font-style: normal;
  color: #ffffff;
}

.profile p {
  display: inline-block;
  max-width: 80%;
  margin-top: 40px;
  font-size: 18px;
  font-family: 'M PLUS 1p', sans-serif;
  font-style: normal;
  font-weight: 500;
  color: #ffffff;
  text-align: center;
  letter-spacing: 0.1em;
}

/* ヘッダー */

.header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100;
  height: 60px;
  min-height: 60px;
  background: #fcba03;
  box-shadow: 0 10px 10px -5px rgb(0 0 0 / 15%);
}

.header img {
  width: 35px;
  height: 35px;
  margin-right: 14px;
  object-fit: cover;
  border-radius: 50%;
}

.header h1 {
  font-size: 22px;
  font-family: 'M PLUS 1p', sans-serif;
  font-style: normal;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1px;
}

/* メッセージ */

#messages {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 10px;
  padding: 24px;
  overflow-y: scroll;
}

.message {
  position: relative;
  display: inline-block;
  width: auto;
  border-radius: 8px;
}

.message.text {
  max-width: 80%;
  padding: 5px 10px;
  font-size: 15px;
}

.message.text p {
  font-optical-sizing: auto;
  white-space: pre-wrap;
}

.message.user {
  max-width: 60%;
  margin: 0 0 10px auto;
  font-size:   17px;
  font-family: "Zen Maru Gothic", sans-serif;
  font-weight: 700;
  font-style: normal;
  color: #000000;
  background-color: #c7c16b;
}

.message.user::before {
  position: absolute;
  bottom: 0;
  left: -30px;
  font-size: 12px;
  color: rgb(0 0 0 / 30%);
  content: '既読';
}

.message.assistant {
  max-width: 60%;
  margin: 0 auto 10px 0;
  margin-left: 55px;
  background-color: #F9EFC8;
}

.message.assistant::before {
  position: absolute;
  top: 0;
  left: -55px;
  display: inline-block;
  width: 40px;
  height: 40px;
  content: '';
  background: var(--message-assistant-before-background);
  background-size: contain;
  border-radius: 50%;
}

/* メッセージ送信フォーム(textarea) */

.message-box {
  box-sizing: border-box;
  width: 100%;
  padding: 18px 24px;
}

.message-area {
  display: flex;
  align-items: center;
  height: auto;
  min-height: 36px;
  padding: 0 16px;
  background-color: #F7F5BC;
  border-radius: 25px;
  box-shadow: 0 10px 10px -5px rgb(0 0 0 / 20%);
}

.message-input-container {
  display: flex;
  flex: 1;
  align-items: center;
}

.message-wrapper {
  position: relative;
  width: 100%;
}

#messageInput {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  height: 30px;
  max-height: 120px;
  padding: 2px 0;
  margin: 0;
  overflow-y: hidden;
  font-size: 15px;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.5;
  resize: none;
  background: transparent;
  border: none;
  transition: height 0.2s ease;
}

#dummyHeight {
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  box-sizing: border-box;
  height: auto;
  padding: 0;
  overflow: hidden;
  font-size: 15px;
  font-family: 'Noto Sans JP', sans-serif;
  line-height: 1.5;
  white-space: pre-wrap;
  visibility: hidden;
}

#messageInput:focus {
  outline: none;
}

#messageInput::placeholder {
  color: rgb(0 0 0 / 30%);
}

/* メッセージ送信フォーム(送信ボタン) */

#submitButton {
  flex-shrink: 0;
  align-self: self-end;
  width: 30px;
  height: 30px;
  margin: 12px 16px;
  cursor: pointer;
  background-color: #85BE43;
  border: none;
  border-radius: 50%;
}

#submitButton:disabled {
  opacity: 0.5;
}

#submitButton:hover {
  background-color: color-mix(in srgb, #437C00 80%, #000000);
}

#submitButton .button-icon {
  font-size: 12px;
  color: #ffffff;
}

/* Botからのメッセージを待機する際に表示するスピナー */

.spinner {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 15px;
}

.spinner > div {
  display: inline-block;
  width: 10px;
  height: 10px;
  background-color: #333;
  border-radius: 100%;
  animation: sk-bouncedelay 1.8s infinite ease-in-out both;
  animation: sk-bouncedelay 1.8s infinite ease-in-out both;
}

.spinner .bounce1 {
  animation-delay: -0.32s;
  animation-delay: -0.32s;
}

.spinner .bounce2 {
  animation-delay: -0.16s;
  animation-delay: -0.16s;
}

/* markdown対応 */

/* 共通の文字色とベース設定 */
.message.assistant.text,
.message.assistant.text h1,
.message.assistant.text h2,
.message.assistant.text h3,
.message.assistant.text h4,
.message.assistant.text p,
.message.assistant.text li,
.message.assistant.text ul,
.message.assistant.text ol,
.message.assistant.text blockquote,
.message.assistant.text code,
.message.assistant.text strong,
.message.assistant.text em,
.message.assistant.text a {
  font-size: 17px;
  font-family: "Shippori Mincho", serif;
  font-weight: 400;
  font-style: normal;
  line-height: 1.6;
  color: #000000;
  word-break: break-word;
}

/* 見出し系 */
.message.assistant.text h1 {
  margin: 1.2em 0 0.8em;
  font-size: 1.5rem;
  font-weight: bold;
}

.message.assistant.text h2 {
  margin: 1em 0 0.6em;
  font-size: 1.3rem;
  font-weight: bold;
}

.message.assistant.text h3 {
  margin: 0.8em 0 0.4em;
  font-size: 1.1rem;
  font-weight: bold;
}

.message.assistant.text h4 {
  margin: 0.6em 0 0.3em;
  font-size: 1rem;
  font-weight: bold;
}

/* 段落 */
.message.assistant.text p {
  margin: 0.5em 0;
}

/* 箇条書き */
.message.assistant.text ul,
.message.assistant.text ol {
  padding-left: 1.5em;
  margin: 0.5em 0 1em;
  list-style-position: inside;
}

.message.assistant.text li {
  padding-left: 0.25em;
  margin-bottom: 0.4em;
}

/* 引用 */
.message.assistant.text blockquote {
  padding-left: 1em;
  margin: 1em 0;
  font-style: italic;
  color: #000000;
  border-left: 3px solid #ccc;
}

/* コード */
.message.assistant.text code {
  padding: 0.2em 0.4em;
  font-size: 0.9em;
  font-family: 'Menlo', 'Courier New', monospace;
  background-color: #f5f5f5;
  border-radius: 3px;
}

/* 複数行コード */
.message.assistant.text pre code {
  display: block;
  padding: 1em;
  overflow-x: auto;
  background: #f5f5f5;
  border-radius: 4px;
}

/* 強調 */
.message.assistant.text strong {
  font-weight: 700;
}

/* 斜体 */
.message.assistant.text em {
  font-style: italic;
}

/* リンク（黒文字＋下線） */
.message.assistant.text a {
  color: #000000;
  text-decoration: underline;
}

@keyframes sk-bouncedelay {
  0%,
  80%,
  100% {
    transform: scale(0);
  }

  40% {
    transform: scale(1);
  }
}

@keyframes sk-bouncedelay {
  0%,
  80%,
  100% {
    transform: scale(0);
    transform: scale(0);
  }

  40% {
    transform: scale(1);
    transform: scale(1);
  }
}

@media screen and (width <= 768px) {
  body {
    height: 100svh; /* ← 必要に応じてbodyにも指定（flex親だから） */
    overflow: hidden;
  }

  html,
  body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .left {
    display: none;
  }

  .right {
    width: 100vw;
    height: 100svh;
  }

  #messages {
    padding: 24px 12px;
  }

  section {
    width: 100vw;
    height: 100svh;
  }

  #messageInput {
    font-size: 16px;
  }

  .message.text {
    font-size: 16px;
  }
}
