/*--- ローディング画面 ---*/
.loading-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  height: 100svh;
  background-color: rgb(255 255 255 / 0.8);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
}
.loading-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #000;
  opacity: 0.1;
  animation: loading-dot 1s infinite ease-in-out;
}
.loading-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.loading-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes loading-dot {
  0% {
    opacity: 0.1;
    scale: 1;
  }
  50% {
    opacity: 0.2;
    scale: 1.5;
  }
}

/*--- 利用規約モーダル ---*/
.terms-area {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100svh;
  background-color: rgb(0 0 0 / 0.7);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
}

.terms-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: calc(100% - 32px);
  max-width: 500px;
  height: 90%;
  max-height: 700px;
  padding: 20px;
  border-radius: 24px;
  background-color: #fff;
  animation: fadeIn 0.3s ease-out;
}

.terms-title {
  font-size: calc(20 * var(--scale-rem));
  font-weight: bold;
  line-height: 1.6;
  text-align: center;
}

.terms-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  height: calc(100% - 48px);
}

.terms-detail {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border: 1px solid #ccc;
  border-radius: 16px;
  overflow: scroll;
}
.terms-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.terms-item-title {
  font-size: calc(16 * var(--scale-rem));
  font-weight: bold;
  line-height: 1.6;
}
.terms-item-text {
  font-size: calc(14 * var(--scale-rem));
  line-height: 1.6;
}
.terms-item-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 1rem;
  font-size: calc(14 * var(--scale-rem));
  line-height: 1.6;
}

.terms-checkbox {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}
.terms-checkbox input {
  width: 24px;
  height: 24px;
  border: 1px solid #ccc;
  appearance: none;
  position: relative;
}
.terms-checkbox input:checked {
  border-color: #009ab9;
}
.terms-checkbox input:checked::after {
  content: '';
  display: block;
  width: 14px;
  height: 8px;
  border: solid #009ab9;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
  transform-origin: center center;
  position: absolute;
  top: 21%;
  left: 19%;
}

.terms-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  height: 60px;
  border: none;
  border-radius: 9999px;
  background-image: linear-gradient(102deg, #13b7db, #009ab9 73%);
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}
.terms-btn:disabled {
  background-color: #ccc;
  background-image: none;
  cursor: normal;
}

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

/*--- header ---*/
header {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  height: 72px;
  padding: 16px;
  background-image: linear-gradient(to bottom, #fff 65%, transparent 100%);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
}
.header-deco {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.header-title {
  font-size: calc(18 * var(--scale-rem));
  font-weight: bold;
}

/*--- 初期画面 ---*/
.intro-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-inline: 16px;
}

/* chara-block  */
.chara-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}
.chara-img {
  width: 206px;
  margin: 0 auto;
}
.chara-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 500px;
  margin-top: -90px;
  padding: 30px 20px;
  border-radius: 24px;
  border: 1px solid #fff;
  background-color: rgb(255 255 255 / 0.01);
  backdrop-filter: blur(24px);
  color: #fff;
}
.chara-name {
  font-weight: bold;
  line-height: 1;
  text-align: center;
}
.chara-name span {
  display: block;
  margin-top: 5px;
  font-size: calc(36 * var(--scale-rem));
  font-weight: bold;
}
.chara-description {
  line-height: 2;
  letter-spacing: 0;
}

/* intro-block */
.intro-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
}
.intro-text {
  color: #fff;
  font-size: calc(20 * var(--scale-rem));
  font-weight: bold;
  line-height: 1.6;
  text-align: center;
}
.intro-arrow {
  width: 30px;
  height: 30px;
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(10px);
  }
  100% {
    transform: translateY(0);
  }
}

/*--- チャット画面 ---*/
.chat-area {
  flex-grow: 1;
  width: 100%;
  max-width: 1200px;
  max-height: calc(100% - var(--input-area-height));
  margin: 0 auto;
}
.chat-scroll-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
  padding-inline: 16px;
  padding-bottom: 20px;
  overflow: scroll;
}
.chat-block {
  display: flex;
  flex-direction: row-reverse;
  align-items: flex-start;
  gap: 16px;
  animation: fadeIn 0.2s ease-out;
}
.chat-block._ai {
  flex-direction: row;
}
.chat-icon {
  flex-shrink: 0;
  width: 40px;
}
.chat-text {
  padding: 19px;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 24px;
  border-top-right-radius: 0;
  background-color: rgb(0, 0, 0, 0.14);
  color: #fff;
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: normal;
  line-break: strict;
}
._ai .chat-text {
  border-color: #fff;
  border-top-right-radius: 24px;
  border-top-left-radius: 0;
  background-color: rgb(255, 255, 255, 0.8);
  color: #000;
}
.chat-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

/*--- 入力エリア ---*/
.input-area {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: 16px;
  filter: drop-shadow(0 -10px 20px rgb(70 120 140 / 0.8));
  cursor: text;
}
.input-area._chat {
  position: sticky;
  bottom: 0;
}
.input-block {
  height: fit-content;
  min-height: 64px;
  padding-block: 19px;
  padding-left: 16px;
  padding-right: 70px;
  border-radius: 32px;
  background-color: #fff;
  position: relative;
}
.textarea {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-height: calc(3em * 1.6);
  border: none;
  overflow-y: auto;
  -webkit-appearance: none;
  appearance: none;
  resize: none;
  line-height: 1.6;
}
.textarea::placeholder {
  opacity: 1;
  color: #ccc;
}
.textarea:focus {
  outline: none;
}
.textarea:-webkit-autofill,
.textarea:-webkit-autofill:hover,
.textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: #111;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
}
.send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background-color: #ddd;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  position: absolute;
  bottom: 4px;
  right: 4px;
}
.send-btn._active {
  background-color: transparent;
  background-image: linear-gradient(135deg, #13b7d8 0, #009ab9 73%);
}
.send-btn img {
  width: 30px;
}

.notice-text {
  color: #fff;
  font-size: calc(14 * var(--scale-rem));
  line-height: 1.6;
}
.notice-text a {
  color: #fff;
  text-decoration: underline;
}

.error-text {
  color: #fff;
  font-size: calc(14 * var(--scale-rem));
  font-weight: bold;
  line-height: 1.6;
}
