/* ===================================================
   LINE 風の吹き出しの会話
   数値は記事・CodePen と同じ。変えたのは色だけ（6 色に）。
   1つずつ、番号のところからコピーして使えます。
   =================================================== */

/* ---------- 見本の箱（マスに収めるための指定。コピーしなくても同じ形になります） ---------- */
.items { grid-template-columns: 1fr; }
.items > li { justify-content: flex-start; }
/* 04 を 1 つだけ見るとき：下へスクロールして出てくるのを見られるように、上をあける */
.is-only .items > li:has(.chat_view) { padding-top: 90vh; }
.is-only .items > li:has(.chat_view) .item-name::after { content: "（下へスクロールすると出てきます）"; }

/* ---------- 01 シンプル版 ---------- */
.chat_simple {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 1024px;
  margin: 50px auto;
  padding: 0 10px;
}
.chat_simple .onebox {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.chat_simple .onebox:nth-child(even) {
  flex-direction: row-reverse;
  margin-top: 20px;
}
.chat_simple .onebox .imgArea {
  width: 16%;
  position: relative;
}
.chat_simple .onebox .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: 0;
}
.chat_simple .onebox:nth-child(odd) .imgArea img {
  left: 0;
  padding-right: 30px;
}
.chat_simple .onebox:nth-child(even) .imgArea img {
  right: 0;
  padding-left: 30px;
}
.chat_simple .onebox .fukiArea {
  width: 63%;
}
.chat_simple .onebox .fukidasi {
  width: 100%;
  position: relative;
  padding: 25px;
  background-color: #f3efe6;
  font-size: 18px;
  color: #2b2a27;
  border-radius: 12px;
  box-sizing: border-box;
}
.chat_simple .onebox .fukidasi::before {
  content: '';
  position: absolute;
  display: block;
  top: 22px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 15px 30px 15px 0;
  border-color: transparent #f3efe6 transparent transparent;
}
.chat_simple .onebox:nth-child(odd) .fukidasi::before {
  left: -20px;
}
.chat_simple .onebox:nth-child(even) .fukidasi {
  background-color: #e8dc6a;
}
.chat_simple .onebox:nth-child(even) .fukidasi::before {
  right: -20px;
  border-color: transparent #e8dc6a transparent transparent;
  transform: rotate(180deg);
}
@media screen and (max-width: 1024px) {
  .chat_simple .onebox .imgArea img {
    max-width: 70%;
  }
  .chat_simple .onebox .fukidasi {
    padding: 15px;
    font-size: 14px;
  }
  .chat_simple .onebox .fukidasi::before {
    top: 8px;
  }
}
@media screen and (max-width: 420px) {
  .chat_simple {
    margin: 30px auto;
  }
  .chat_simple .onebox:nth-child(even) {
    margin-top: 15px;
  }
  .chat_simple .onebox .imgArea {
    width: 20%;
  }
  .chat_simple .onebox .fukidasi {
    padding: 10px 15px;
    font-size: 12px;
  }
}

/* ---------- 02 三角の部分をちょっと曲げる ---------- */
.chat_curve {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 1024px;
  margin: 50px auto;
  padding: 0 10px;
}
.chat_curve .onebox {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.chat_curve .onebox:nth-child(even) {
  flex-direction: row-reverse;
  margin-top: 20px;
}
.chat_curve .onebox .imgArea {
  width: 16%;
  position: relative;
}
.chat_curve .onebox:nth-child(odd) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: 0;
  padding-right: 30px;
}
.chat_curve .onebox:nth-child(even) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: auto;
  right: 0;
  padding-left: 30px;
}
.chat_curve .onebox .fukiArea {
  width: 63%;
}
.chat_curve .onebox .fukidasi {
  width: 100%;
  position: relative;
  padding: 25px;
  background-color: #f3efe6;
  font-size: 18px;
  color: #2b2a27;
  border-radius: 12px;
  box-sizing: border-box;
}
.chat_curve .onebox .fukidasi::before {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 22px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_curve .onebox .fukidasi::after {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 40px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_curve .onebox:nth-child(odd) .fukidasi::before {
  left: -15px;
  border-left: 25px solid #f3efe6;
  border-top: 25px solid transparent;
}
/* 白い半円（背景と同じ色にする） */
.chat_curve .onebox:nth-child(odd) .fukidasi::after {
  left: -25px;
  border-left: 25px solid #ffffff;
  border-top: 25px solid transparent;
}
.chat_curve .onebox:nth-child(even) .fukidasi {
  background-color: #e8dc6a;
}
.chat_curve .onebox:nth-child(even) .fukidasi::before {
  left: auto;
  right: -15px;
  border-left: 25px solid transparent;
  border-top: 25px solid #e8dc6a;
}
.chat_curve .onebox:nth-child(even) .fukidasi::after {
  left: auto;
  right: -25px;
  border-left: 25px solid transparent;
  border-top: 25px solid #ffffff;
}
@media screen and (max-width: 1024px) {
  .chat_curve .onebox:nth-child(odd) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_curve .onebox:nth-child(even) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_curve .onebox .fukidasi {
    padding: 15px;
    font-size: 14px;
  }
  .chat_curve .onebox .fukidasi::before {
    top: 8px;
  }
  .chat_curve .onebox .fukidasi::after {
    top: 20px;
  }
}
@media screen and (max-width: 420px) {
  .chat_curve {
    margin: 30px auto;
  }
  .chat_curve .onebox:nth-child(even) {
    margin-top: 15px;
  }
  .chat_curve .onebox .imgArea {
    width: 20%;
  }
  .chat_curve .onebox .fukidasi {
    padding: 10px 15px;
    font-size: 12px;
  }
}

/* ---------- 03 曲げて、動きもつける ---------- */
.chat_move {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 1024px;
  margin: 50px auto;
  padding: 0 10px;
}
.chat_move .onebox {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.chat_move .onebox:nth-child(even) {
  flex-direction: row-reverse;
  margin-top: 20px;
}
.chat_move .onebox .imgArea {
  width: 16%;
  position: relative;
}
.chat_move .onebox:nth-child(odd) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: 0;
  padding-right: 30px;
}
.chat_move .onebox:nth-child(even) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: auto;
  right: 0;
  padding-left: 30px;
}
.chat_move .onebox .fukiArea {
  width: 63%;
}
.chat_move .onebox .fukidasi {
  width: 100%;
  position: relative;
  padding: 25px;
  background-color: #f3efe6;
  font-size: 18px;
  color: #2b2a27;
  border-radius: 12px;
  box-sizing: border-box;
}
.chat_move .onebox .fukidasi::before {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 22px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_move .onebox .fukidasi::after {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 40px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_move .onebox:nth-child(odd) .fukidasi::before {
  left: -15px;
  border-left: 25px solid #f3efe6;
  border-top: 25px solid transparent;
}
/* 白い半円（背景と同じ色にする） */
.chat_move .onebox:nth-child(odd) .fukidasi::after {
  left: -25px;
  border-left: 25px solid #ffffff;
  border-top: 25px solid transparent;
}
.chat_move .onebox:nth-child(even) .fukidasi {
  background-color: #e8dc6a;
}
.chat_move .onebox:nth-child(even) .fukidasi::before {
  left: auto;
  right: -15px;
  border-left: 25px solid transparent;
  border-top: 25px solid #e8dc6a;
}
.chat_move .onebox:nth-child(even) .fukidasi::after {
  left: auto;
  right: -25px;
  border-left: 25px solid transparent;
  border-top: 25px solid #ffffff;
}
@media screen and (max-width: 1024px) {
  .chat_move .onebox:nth-child(odd) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_move .onebox:nth-child(even) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_move .onebox .fukidasi {
    padding: 15px;
    font-size: 14px;
  }
  .chat_move .onebox .fukidasi::before {
    top: 8px;
  }
  .chat_move .onebox .fukidasi::after {
    top: 20px;
  }
}
@media screen and (max-width: 420px) {
  .chat_move {
    margin: 30px auto;
  }
  .chat_move .onebox:nth-child(even) {
    margin-top: 15px;
  }
  .chat_move .onebox .imgArea {
    width: 20%;
  }
  .chat_move .onebox .fukidasi {
    padding: 10px 15px;
    font-size: 12px;
  }
}

/* 出てくる前の横のずれで、画面が横にスクロールしないように */
.chat_move {
  overflow-x: clip;
}

/* 動き：画面に入ったら is-show がついて、横からふわっと出る */
.RightToLeft {
  opacity: 0;
  transform: translateX(50px);
  transition: .6s;
}
.RightToLeft.is-show {
  opacity: 1;
  transform: translateX(0);
}
.LeftToRight {
  opacity: 0;
  transform: translateX(-50px);
  transition: .6s;
}
.LeftToRight.is-show {
  opacity: 1;
  transform: translateX(0);
}
.delay_a {
  transition-delay: .2s;
}
.delay_b {
  transition-delay: .4s;
}
.delay_c {
  transition-delay: .6s;
}
.delay_d {
  transition-delay: .8s;
}
.delay_e {
  transition-delay: 1.0s;
}

/* 動きを減らす設定のとき */
@media (prefers-reduced-motion: reduce) {
  .RightToLeft, .LeftToRight { opacity: 1; transform: none; transition: none; }
}

/* ---------- 04 いまの書き方：CSS だけで動きをつける ---------- */
.chat_view {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  max-width: 1024px;
  margin: 50px auto;
  padding: 0 10px;
}
.chat_view .onebox {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.chat_view .onebox:nth-child(even) {
  flex-direction: row-reverse;
  margin-top: 20px;
}
.chat_view .onebox .imgArea {
  width: 16%;
  position: relative;
}
.chat_view .onebox:nth-child(odd) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: 0;
  padding-right: 30px;
}
.chat_view .onebox:nth-child(even) .imgArea img {
  width: 100%;
  max-width: 130px;
  box-sizing: content-box;  /* padding の 30px を幅の外に（border-box だと画像が小さくなる） */
  position: absolute;
  top: -20px;
  left: auto;
  right: 0;
  padding-left: 30px;
}
.chat_view .onebox .fukiArea {
  width: 63%;
}
.chat_view .onebox .fukidasi {
  width: 100%;
  position: relative;
  padding: 25px;
  background-color: #f3efe6;
  font-size: 18px;
  color: #2b2a27;
  border-radius: 12px;
  box-sizing: border-box;
}
.chat_view .onebox .fukidasi::before {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 22px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_view .onebox .fukidasi::after {
  content: '';
  position: absolute;
  display: block;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: rotate(45deg);
  top: 40px;
  border-right: 25px solid transparent;
  border-bottom: 25px solid transparent;
}
.chat_view .onebox:nth-child(odd) .fukidasi::before {
  left: -15px;
  border-left: 25px solid #f3efe6;
  border-top: 25px solid transparent;
}
/* 白い半円（背景と同じ色にする） */
.chat_view .onebox:nth-child(odd) .fukidasi::after {
  left: -25px;
  border-left: 25px solid #ffffff;
  border-top: 25px solid transparent;
}
.chat_view .onebox:nth-child(even) .fukidasi {
  background-color: #e8dc6a;
}
.chat_view .onebox:nth-child(even) .fukidasi::before {
  left: auto;
  right: -15px;
  border-left: 25px solid transparent;
  border-top: 25px solid #e8dc6a;
}
.chat_view .onebox:nth-child(even) .fukidasi::after {
  left: auto;
  right: -25px;
  border-left: 25px solid transparent;
  border-top: 25px solid #ffffff;
}
@media screen and (max-width: 1024px) {
  .chat_view .onebox:nth-child(odd) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_view .onebox:nth-child(even) .imgArea img {
    max-width: 70%;
    top: 0;
  }
  .chat_view .onebox .fukidasi {
    padding: 15px;
    font-size: 14px;
  }
  .chat_view .onebox .fukidasi::before {
    top: 8px;
  }
  .chat_view .onebox .fukidasi::after {
    top: 20px;
  }
}
@media screen and (max-width: 420px) {
  .chat_view {
    margin: 30px auto;
  }
  .chat_view .onebox:nth-child(even) {
    margin-top: 15px;
  }
  .chat_view .onebox .imgArea {
    width: 20%;
  }
  .chat_view .onebox .fukidasi {
    padding: 10px 15px;
    font-size: 12px;
  }
}

/* いまの書き方：JS なしで、画面に入るときに横から出す（animation-timeline: view()） */
@supports (animation-timeline: view()) {
  .chat_view .onebox {
    animation: chat_in linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 80%;
  }
  .chat_view .onebox:nth-child(odd) {
    --chat-from: -50px;
  }
  .chat_view .onebox:nth-child(even) {
    --chat-from: 50px;
  }
}
@keyframes chat_in {
  from {
    opacity: 0;
    translate: var(--chat-from) 0;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
/* 出てくる前の横のずれで、画面が横にスクロールしないように */
.chat_view {
  overflow-x: clip;
}

/* 動きを減らす設定のとき */
@media (prefers-reduced-motion: reduce) {
  .chat_view .onebox { animation: none; }
}
