/* リセットCSS */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: Arial, sans-serif;
  background: transparent;
  overflow-x: hidden; /* 横スクロールバーを非表示にして画面外の円を隠す */
}

/* メッセージボックスセクション用の特別なオーバーフロー設定 */
body:has(.message-box-section) {
  overflow-x: visible;
}

/* または、より確実な方法として */
.message-box-section-wrapper {
  overflow: visible !important;
}

.main-wrapper {
  width: 100%;
  min-height: 100vh;
  display: block;
}

.slideshow-container {
  width: 100vw;
  max-width: 1400px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  padding: 0 60px;
  box-sizing: border-box;
  z-index: 1; /* 基本的なレイヤー位置を設定 */
}

/* 大きなタブレット・小さなデスクトップ向け（1200px以下） */
@media (max-width: 1200px) and (min-width: 1025px) {
  .slideshow-text-overlay p {
    font-size: 26px !important;
    line-height: 145% !important;
    letter-spacing: 0.18em !important;
  }
}

/* タブレット向けの中間ブレークポイント（1024px以下） */
@media (max-width: 1024px) and (min-width: 901px) {
  .slideshow-container {
    width: 100vw;
    max-width: none;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 50px;
  }

  .slide img {
    max-height: 480px;
  }

  /* first-text-section のタブレット調整 */
  .first-text-section {
    margin-top: 60px; /* PC版122pxの約49% - 縮小調整 */
  }

  /* タブレット版 fourth-text-section の調整 */
  .fourth-text-section {
    margin-top: 140px; /* 縮小調整 */
  }

  .fourth-text-content {
    width: calc(100% - 60px) !important;
    max-width: 700px !important;
    min-width: 580px !important; /* 最小幅を580pxに設定 */
    height: auto !important;
    padding: 50px 40px !important; /* 上下50px、左右40px */
    flex-direction: row !important;
    gap: 35px !important; /* 文章と画像の間のギャップ */
    align-items: flex-start !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .fourth-text-block {
    flex: 1 !important; /* 残りのスペースをすべて使用 */
    min-width: 300px !important; /* 最小幅を確保 */
    height: auto !important;
    max-width: none !important;
    flex-shrink: 1 !important;
    box-sizing: border-box !important;
  }

  .fourth-text-block p {
    font-size: 14px !important;
    line-height: 32px !important;
    margin: 0 0 12px 0 !important;
  }

  .fourth-text-image-block {
    width: 200px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .fourth-text-ceo-image {
    width: 200px !important;
    height: 236px !important;
    margin-bottom: 18px !important;
  }

  .fourth-text-company-title {
    font-size: 11px;
    line-height: 11px;
  }

  .fourth-text-ceo-name {
    font-size: 13px;
    line-height: 13px;
    margin-top: -2px;
  }

  /* テキストセクションのタブレット対応 */
  .first-text-section p {
    font-size: 18px !important;
    line-height: 36px !important;
  }

  .second-text-section {
    margin-top: 115px !important; /* 縮小調整 */
  }

  .second-text-block p {
    font-size: 12.5px !important;
    line-height: 25px !important;
  }

  .third-text-section {
    margin-top: 138px !important; /* 115px × 1.2 = 138px - 比率調整 */
  }

  .third-text-logo-text {
    font-size: 12.5px !important;
    line-height: 25px !important;
  }

  .third-text-block p {
    font-size: 12.5px !important;
    line-height: 25px !important;
  }

  /* タブレット中間サイズ用のスライドショーテキスト */
  .slideshow-text-overlay p {
    font-size: 22px !important;
    line-height: 140% !important;
    letter-spacing: 0.15em !important;
  }
}

/* 小さなタブレット向け（900px以下） */
@media (max-width: 900px) and (min-width: 769px) {
  .slideshow-text-overlay p {
    font-size: 21px !important;
    line-height: 135% !important;
    letter-spacing: 0.12em !important;
  }

  /* 901px-769px間のfourth-text-section調整 */
  .fourth-text-section {
    margin-top: 120px; /* さらに縮小調整 */
  }

  .fourth-text-content {
    width: calc(100% - 80px) !important;
    max-width: 680px !important;
    min-width: 560px !important; /* 最小幅を560pxに設定 */
    height: auto !important;
    padding: 55px 30px !important; /* 上下55px、左右45px */
    flex-direction: row !important;
    gap: 40px !important; /* 文章と画像の間のギャップ */
    align-items: flex-start !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .fourth-text-block {
    flex: 1 !important; /* 残りのスペースをすべて使用 */
    min-width: 320px !important; /* 最小幅を確保 */
    height: auto !important;
    max-width: none !important;
    flex-shrink: 1 !important;
  }

  .fourth-text-block p {
    font-size: 15px !important;
    line-height: 30px !important;
    margin: 0 0 10px 0 !important;
  }

  .fourth-text-image-block {
    width: 220px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
  }

  .fourth-text-ceo-image {
    width: 220px !important;
    height: 259px !important;
    margin-bottom: 20px !important;
  }

  .fourth-text-company-title {
    font-size: 12px;
    line-height: 12px;
    margin: 0;
    padding: 0;
  }

  .fourth-text-ceo-name {
    font-size: 14px;
    line-height: 14px;
    margin-top: -2px;
    margin: 0;
    padding: 0;
  }
}

.content-section {
  width: 100%;
  margin-top: 0; /* first-text-sectionで個別に管理 */
  background: transparent;
}

.slider {
  position: relative;
  width: 100%;
  z-index: 1;
}

.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
}

.slide:first-child {
  position: relative;
}

.slide.active {
  opacity: 1;
}

.slide img {
  width: 100%;
  height: auto;
  max-height: 600px;
  display: block;
  border-radius: 20px;
  object-fit: cover;
}

/* コンテンツラッパー */
.content-wrapper {
  position: relative;
  text-align: center;
  z-index: 5;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* 第1テキストセクション */
.first-text-section {
  margin-top: 122px; /* slideshow→first: 122px */
}

.first-text-section p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 24px;
  line-height: 50px;
  letter-spacing: 0.2em;
  text-align: center;
  color: black;
}

/* 第2テキストセクション */
.second-text-section {
  margin-top: 122px; /* first→second: 122px */
}

.second-text-content {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
}

.second-text-block {
  text-align: center;
  width: 100%;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

.second-text-block p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 40px;
  letter-spacing: 0.2em;
  text-align: center;
  color: black;
}

/* 第3テキストセクション */
.third-text-section {
  margin-top: 237px; /* second→third: 237px */
}

.third-text-content {
  position: relative;
  width: 100vw;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.third-text-logo-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 60px;
  z-index: 3;
}

.third-text-logo-text {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 40px;
  letter-spacing: 0.2em; /* 20% */
  text-align: center;
  color: black;
  margin: 0;
}

.third-text-logo {
  width: 219px;
  height: auto;
  margin: 0;
}

.third-text-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.third-text-block {
  text-align: center;
  width: 100%;
  padding: 0 20px;
  z-index: 2;
  position: relative;
}

.third-text-block p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 40px;
  letter-spacing: 0.2em;
  text-align: center;
  color: black;
  margin: 0.5rem 0;
}

.third-text-circle {
  width: 457px;
  height: 457px;
  border-radius: 50%;
  background-color: rgba(104, 175, 6, 0.2);
  position: absolute;
  left: calc(-114px); /* 457px / 4 = 約114px を左に移動して1/4を画面外に */
  top: 60%; /* third-text-blockの位置に合わせて調整 */
  transform: translateY(-50%);
  z-index: 1;
}

.second-text-circle {
  width: 457px;
  height: 457px;
  border-radius: 50%;
  background-color: rgba(240, 209, 41, 0.2);
  position: absolute;
  right: calc(-152px); /* 457px / 3 = 約152px を右に移動して1/3を画面外に */
  top: 20px; /* 固定位置に調整 */
  z-index: 1;
}

/* 第4テキストセクション: 0から作り直し */
.fourth-text-section {
  margin-top: 244px; /* third→fourth: 244px */
  position: relative;
  z-index: 5; /* カルーセルより後ろに配置 */
}

.fourth-text-content {
  /* 全体のコンテナ: 灰色背景と余白を含む */
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  background: #f5f5f5;
  border-radius: 20px;
  padding: 60px 80px; /* 上下60px、左右80px */
  box-sizing: border-box; /* paddingとborderを幅に含める */

  /* 内部コンテンツのレイアウト */
  display: flex;
  align-items: flex-start; /* 上揃え */
  justify-content: flex-start;
  gap: 80px; /* 文章と画像の間のギャップ */

  /* サイズ計算: コンテンツ幅を適切に設定 */
  width: calc(100vw - 20vw);
  min-width: 640px; /* 最小幅を640pxに設定 */
  max-width: 1200px; /* 最大幅を1200pxに縮小 */
  height: auto; /* 高さを自動調整に変更 */

  /* 背景を超えないように内部要素を制限 */
  overflow: hidden;
}

/* 文章エリア */
.fourth-text-block {
  flex: 1; /* 残りのスペースをすべて使用 */
  min-width: 400px; /* 最小幅を確保 */
  height: 440px;
  flex-shrink: 1; /* 縮小を許可 */
  box-sizing: border-box; /* paddingとborderを幅に含める */
}

.fourth-text-block p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.2em; /* 20% */
  text-align: left;
  color: black;
  margin: 0; /* 段落間の適切な余白 */
}

.fourth-text-block p:last-child {
  margin-bottom: 0;
}

/* 画像エリア */
.fourth-text-image-block {
  width: 250px;
  flex-shrink: 0; /* サイズ固定 */
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box; /* paddingとborderを幅に含める */
}

.fourth-text-ceo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fourth-text-ceo-image {
  width: 250px;
  height: 295px;
  border-radius: 20px;
  object-fit: cover;
  margin-bottom: 22px; /* 画像と名前の間の余白 */
  opacity: 1;
}

.fourth-text-ceo-info {
  text-align: center;
  width: 100%;
  /* 余白を完全に制御 */
  line-height: 0;
}

.fourth-text-company-title {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 400;
  font-size: 12px;
  line-height: 12px; /* フォントサイズと同じに設定 */
  letter-spacing: 0.1em;
  text-align: center;
  color: black;
  margin: 0;
  padding: 0;
  display: block;
}

.fourth-text-ceo-name {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 14px; /* フォントサイズと同じに設定 */
  letter-spacing: 0.1em;
  text-align: center;
  color: black;
  margin: 0;
  padding: 0;
  display: block;
  margin-top: -2px; /* 上の要素との間隔を狭める */
}

.fourth-text-ceo-name-bold {
  font-weight: 700; /* 名前部分のみ太字 */
}

/* 固定テキストオーバーレイ - シンプルで効率的なアプローチ */
.slideshow-text-overlay {
  position: absolute;
  top: 50%;
  left: 111px;
  transform: translateY(-50%);
  z-index: 100;
  pointer-events: none;
}
.slideshow-text-overlay p {
  /* テキストスタイルを直接divに適用 */
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 28px !important;
  line-height: 150% !important;
  letter-spacing: 0.2em !important;
  color: #ffffff;
  text-align: left;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* インジケーター */
.indicators {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 20;
}

.indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
}

.indicator.active {
  background: white;
  transform: scale(1.2);
}

.indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

/* レスポンシブデザイン - 小型タブレット・スマートフォン */
@media (max-width: 768px) and (min-width: 481px) {
  .slideshow-container {
    width: 100vw;
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 40px;
    box-sizing: border-box;
  }

  .slide img {
    max-height: 360px;
  }

  .slideshow-text-overlay {
    left: 60px !important;
  }

  .slideshow-text-overlay p {
    font-size: 20px !important;
    line-height: 130% !important;
    letter-spacing: 0.1em !important;
  }

  .content-section {
    width: 100%;
    margin: 0;
    padding: 48px 0 40px 0;
  }

  /* first-text-section の小型タブレット調整 */
  .first-text-section {
    margin-top: 50px; /* PC版122pxの約41% - 縮小調整 */
  }

  .first-text-section p {
    font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
      sans-serif;
    font-weight: 700;
    font-style: normal;
    font-size: 20px;
    line-height: 42px;
    letter-spacing: 0.2em;
    text-align: center;
    color: black;
  }

  .second-text-content {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
  }

  .second-text-block {
    padding: 0 15px;
    position: relative;
  }

  .second-text-block p {
    font-size: 14px;
    line-height: 32px;
    color: black;
  }

  .third-text-section {
    margin-top: 138px; /* 115px × 1.2 = 138px - 比率調整 */
  }

  .third-text-content {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .third-text-logo-section {
    margin-bottom: 40px;
  }

  .third-text-logo-text {
    font-size: 14px;
    line-height: 32px;
  }

  .third-text-logo {
    width: 180px;
  }

  .third-text-container {
    max-width: 600px;
  }

  .third-text-block {
    padding: 0 15px;
  }

  .third-text-block p {
    font-size: 14px;
    line-height: 32px;
    color: black;
  }

  .third-text-circle {
    width: 300px;
    height: 300px;
    left: -75px; /* 300px / 4 = 75px を左に移動 */
    top: 70%;
  }

  .second-text-circle {
    width: 300px;
    height: 300px;
    right: -100px; /* 300px / 3 = 100px を右に移動 */
  }

  .fourth-text-section {
    margin-top: 150px; /* 縮小調整 */
  }

  .fourth-text-content {
    width: calc(100% - 40px);
    max-width: 650px;
    min-width: 320px; /* 最小幅を320pxに設定 */
    height: auto;
    padding: 45px 35px; /* 上下45px、左右35px */
    flex-direction: column-reverse;
    gap: 35px; /* 文章と画像の間のギャップ */
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
  }

  .fourth-text-block {
    width: 100%;
    height: auto;
    max-width: 500px;
    min-width: 240px; /* 最小幅を240pxに設定 */
    box-sizing: border-box;
  }

  .fourth-text-block p {
    font-size: 14px;
    line-height: 32px;
    margin: 0 0 12px 0;
  }

  .fourth-text-image-block {
    width: auto;
    align-items: center;
    box-sizing: border-box;
  }

  .fourth-text-ceo-image {
    width: 180px; /* 幅を180pxに縮小 */
    height: 212px; /* 高さを212pxに縮小（アスペクト比維持） */
    margin-bottom: 18px;
  }

  .fourth-text-company-title {
    font-size: 11px;
    line-height: 11px;
    margin: 0;
    padding: 0;
  }

  .fourth-text-ceo-name {
    font-size: 13px;
    line-height: 13px;
    margin: -2px 0 0 0;
    padding: 0;
  }

  .indicators {
    bottom: 25px;
  }

  .indicator {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 545px) {
  .slideshow-container {
    width: 100vw;
    max-width: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    padding: 0 20px;
    box-sizing: border-box;
  }

  .slide img {
    max-height: 300px;
  }

  .slideshow-text-overlay {
    left: 30px !important;
  }
  .slideshow-text-overlay p {
    font-size: 16px !important;
    line-height: 120% !important;
    letter-spacing: 0.05em !important;
    padding-right: 10px !important;
  }

  .content-section {
    width: 100%;
    margin: 0;
    padding: 20px 0 30px 0;
  }

  /* first-text-section のスマートフォン調整 */
  .first-text-section {
    margin-top: 25px; /* PC版122pxの約20% - 縮小調整 */
  }

  .first-text-section p {
    font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
      sans-serif;
    font-weight: 700;
    font-style: normal;
    font-size: 12px;
    line-height: 24px;
    letter-spacing: 0.2em;
    text-align: center;
    color: black;
    margin: 0.3rem 0;
  }

  .second-text-content {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
  }

  .second-text-block {
    padding: 0 10px;
    position: relative;
  }

  .second-text-block p {
    font-size: 9px;
    line-height: 18px;
    margin: 0.2rem 0;
    color: black;
  }

  .second-text-section {
    margin-top: 40px; /* 縮小調整 */
  }

  .third-text-section {
    margin-top: 48px; /* 40px × 1.2 = 48px - 比率調整 */
  }

  .third-text-content {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .third-text-logo-section {
    margin-bottom: 30px;
  }

  .third-text-logo-text {
    font-size: 9px;
    line-height: 18px;
  }

  .third-text-logo {
    width: 150px;
  }

  .third-text-container {
    max-width: 400px;
  }

  .third-text-block {
    padding: 0 10px;
  }

  .third-text-block p {
    font-size: 9px;
    line-height: 18px;
    margin: 0.2rem 0;
    color: black;
  }

  .third-text-circle {
    width: 200px;
    height: 200px;
    left: -50px; /* 200px / 4 = 50px を左に移動 */
    top: 70%;
  }

  .second-text-circle {
    width: 200px;
    height: 200px;
    right: -67px; /* 200px / 3 = 約67px を右に移動 */
  }

  .fourth-text-section {
    margin-top: 100px; /* 縮小調整 */
  }

  .fourth-text-content {
    width: calc(100% - 20px);
    max-width: 360px;
    min-width: 280px; /* 最小幅を280pxに設定 */
    height: auto;
    padding: 35px 18px; /* 上下35px、左右18px */
    flex-direction: column-reverse;
    gap: 25px; /* 文章と画像の間のギャップ */
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
  }

  .fourth-text-block {
    width: 100%;
    height: auto;
    max-width: 320px; /* 最大幅を320pxに設定 */
    min-width: 220px; /* 最小幅を220pxに設定 */
    box-sizing: border-box;
  }

  .fourth-text-block p {
    font-size: 12px;
    margin: 0 0 10px 0;
  }

  .fourth-text-image-block {
    width: auto;
    align-items: center;
    box-sizing: border-box;
  }

  .fourth-text-ceo-image {
    width: 150px;
    height: 177px;
    margin-bottom: 15px;
  }

  .fourth-text-company-title {
    font-size: 10px;
    line-height: 10px;
    margin: 0;
    padding: 0;
  }

  .fourth-text-ceo-name {
    font-size: 12px;
    line-height: 12px;
    margin: -1px 0 0 0;
    padding: 0;
  }

  .indicators {
    bottom: 20px;
    gap: 8px;
  }

  .indicator {
    width: 8px;
    height: 8px;
  }
}

/* カルーセルセクション */
.carousel-section {
  margin-top: 244px; /* fourth→carousel: 244px */
  margin-bottom: 0;
  position: relative;
  z-index: 10; /* 他のセクションより前面に表示 */
}

.carousel-container {
  width: 100vw; /* PC版では画面全体幅を使用 */
  position: relative;
  left: 50%;
  transform: translateX(-50%); /* 中央配置 */
  padding: 0;
  z-index: 11; /* カルーセルセクションよりさらに前面 */
  overflow: hidden; /* はみ出し部分を隠す */
}

.carousel-wrapper {
  overflow: hidden;
  width: 100%;
}

.carousel-track {
  display: flex;
  animation: carouselFlow 20s linear infinite;
  position: relative;
  z-index: 12; /* 最前面に表示 */
}

.carousel-item {
  flex: 0 0 auto; /* 固定サイズ */
  margin-right: 30px; /* 余白を減らしてより多くの画像を表示 */
}

.carousel-image {
  height: 280px; /* より小さな固定高さ、幅は自動調整 */
  width: auto; /* アスペクト比を維持して自動調整 */
  min-width: 200px; /* 最小幅を設定して極端に細くならないよう調整 */
  object-fit: contain; /* 画像全体を表示し、画質劣化を防ぐ */
  display: block;
}

/* 左から右に流れるアニメーション */
@keyframes carouselFlow {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(var(--carousel-translate, -1600px));
  }
}

/* デフォルト（デスクトップ）のCSS変数 */
.carousel-track {
  --carousel-translate: -1400px; /* マージン減少に合わせて調整 */
}

/* ホバー時にアニメーション一時停止 */
.carousel-track:hover {
  animation-play-state: paused;
}

/* カルーセルのレスポンシブデザイン */
@media (max-width: 768px) {
  .carousel-section {
    margin-top: 80px;
  }

  .carousel-container {
    width: 100vw; /* タブレット版でもvwを使用 */
    left: 50%;
    transform: translateX(-50%);
  }

  .carousel-image {
    height: 220px; /* タブレット向けの高さ */
    width: auto; /* アスペクト比を維持 */
    min-width: 160px; /* タブレット向けの最小幅 */
  }

  .carousel-item {
    margin-right: 20px; /* タブレット向けのマージン */
  }

  /* タブレット向けのアニメーション調整 */
  .carousel-track {
    --carousel-translate: -1200px; /* マージン減少に合わせて調整 */
  }
}

@media (max-width: 545px) {
  .carousel-section {
    margin-top: 60px;
  }

  .carousel-container {
    width: 100%; /* スマホ版では%を使用して安定性を確保 */
    left: 0;
    transform: none; /* transformを無効化 */
    margin: 0 auto; /* 中央揃え */
  }

  .carousel-image {
    height: 200px; /* スマートフォン向けの高さを大きくして画質改善 */
    width: auto; /* アスペクト比を維持 */
    min-width: 140px; /* スマートフォン向けの最小幅 */
  }

  .carousel-item {
    margin-right: 15px; /* スマートフォン向けのマージン */
  }

  /* スマートフォン向けのアニメーション調整 */
  .carousel-track {
    --carousel-translate: -900px; /* マージン減少に合わせて調整 */
  }
}

/* 第5テキストセクションのスタイル */
.fifth-text-section {
  margin-top: 207px; /* carousel→fifth: 207px */
  margin-bottom: 100px;
  text-align: center;
}

.fifth-text-title {
  margin-bottom: 48px;
}

.fifth-text-title h2 {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 24px;
  line-height: 50px;
  letter-spacing: 0.2em; /* 20% */
  text-align: center;
  color: black;
  margin: 0;
}

.fifth-text-content-desktop {
  display: block;
  text-align: center;
}

.fifth-text-content-mobile {
  display: none;
}

.fifth-text-content-desktop p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 40px;
  letter-spacing: 0.2em; /* 20% */
  text-align: center;
  color: black;
  margin: 0;
}

/* レスポンシブデザイン対応 */
@media (max-width: 768px) and (min-width: 481px) {
  .fifth-text-section {
    margin-top: 80px;
    margin-bottom: 80px;
    padding: 0 15px;
  }

  .fifth-text-title {
    margin-bottom: 24px;
  }

  .fifth-text-title h2 {
    font-size: 18px;
    line-height: 38px;
  }

  .fifth-text-content-mobile {
    display: block;
    text-align: center;
    padding: 0 10px;
  }

  .fifth-text-content-desktop {
    display: none;
  }

  .fifth-text-content-mobile p {
    font-size: 14px;
    line-height: 32px;
    text-align: justify; /* 両端揃え */
    text-justify: inter-character; /* 日本語の文字間隔調整 */
    margin: 0;
    padding: 0 5px;
    width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 545px) {
  .fifth-text-section {
    margin-top: 60px;
    margin-bottom: 60px;
    padding: 0 10px;
  }

  .fifth-text-title {
    margin-bottom: 20px;
  }

  .fifth-text-title h2 {
    font-size: 16px;
    line-height: 34px;
  }

  .fifth-text-content-mobile {
    display: block;
    text-align: center;
    padding: 0 5px;
  }

  .fifth-text-content-desktop {
    display: none;
  }

  .fifth-text-content-mobile p {
    font-size: 12px;
    line-height: 28px;
    text-align: justify; /* 両端揃え */
    text-justify: inter-character; /* 日本語の文字間隔調整 */
    margin: 0 auto;
    padding: 0 10px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* メッセージボックスセクションのスタイル */
.message-box-section {
  margin-top: 0px; /* fifth→messagebox: 0px (余白はfifth-text-sectionのmargin-bottomで確保) */
  margin-bottom: 80px; /* 画像の下半分用の余白 */
  width: 100vw;
  height: auto;
  min-height: calc(590px + 80px); /* ボックス高さ + 画像はみ出し分 */
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  overflow-x: auto; /* 横スクロール対応 */
  overflow-y: visible !important; /* 画像が見えるように強制 */
  z-index: 1000; /* 他の要素より前面に */
  /* スクロールバーを非表示 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.message-box-section::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.message-box-container {
  display: flex;
  gap: 56px;
  width: fit-content; /* コンテンツ幅に調整 */
  padding-left: calc(50vw - 217px); /* 最初のボックスを中央に配置 (434px/2 = 217px) */
  padding-right: calc(50vw - 217px); /* 最後のボックスも中央で止まるように */
}

.message-box {
  width: 434px;
  min-height: 590px; /* 最小高さのみ指定 */
  border-radius: 10px;
  background: #fcf6d4;
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  position: relative;
  flex-shrink: 0; /* 横並び時にサイズを固定 */
}

.message-box-title {
  margin-bottom: 24px;
}

.message-box-title h2 {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 24px;
  line-height: 50px;
  letter-spacing: 0.2em; /* 20% */
  text-align: left;
  color: black;
  margin: 0;
}

.message-box-divider {
  width: 100%;
  height: 1px;
  background-color: black;
  margin-bottom: 24px;
}

.message-box-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
}

.message-box-content p {
  font-family: "Noto Sans CJK JP", "Hiragino Sans", "ヒラギノ角ゴシック", "Yu Gothic", "Meiryo",
    sans-serif;
  font-weight: 500;
  font-style: normal;
  font-size: 16px;
  line-height: 28px;
  letter-spacing: 0.2em; /* 20% */
  text-align: left;
  color: black;
  margin: 0 0 12px 0;
}

.message-box-content p:last-child {
  margin-bottom: 0;
}

.message-box-image {
  position: absolute;
  width: 160px;
  height: 160px;
  object-fit: cover;
  right: 30px;
  bottom: -80px; /* 下半分がmessage-box外に出るように */
  z-index: 1001; /* セクションより前面に */
  pointer-events: none; /* クリックイベントを無効化 */
  overflow: visible !important; /* 画像のオーバーフローを強制表示 */
}

/* レスポンシブデザイン対応 */
@media (max-width: 768px) {
  .message-box-section {
    margin-top: 0px; /* タブレット版での余白調整 (余白はfifth-text-sectionで確保) */
    margin-bottom: 80px; /* 画像の下半分用の余白 */
    width: 100vw;
    height: auto;
    min-height: calc(500px + 80px); /* ボックス高さ + 画像はみ出し分 */
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    overflow-x: auto;
    overflow-y: visible !important; /* 画像が見えるように強制 */
    z-index: 1000; /* 他の要素より前面に */
    /* スクロールバーを非表示 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .message-box-section::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  .message-box-container {
    gap: 40px;
    width: fit-content; /* コンテンツ幅に調整 */
    padding-left: calc(50vw - 175px); /* 最初のボックスを中央に配置 (350px/2 = 175px) */
    padding-right: calc(50vw - 175px); /* 最後のボックスも中央で止まるように */
  }

  .message-box {
    width: 350px; /* タブレットでも固定幅を維持 */
    min-height: 500px; /* 最小高さのみ指定 */
    padding: 32px 24px;
    position: relative;
    flex-shrink: 0;
  }

  .message-box-title {
    margin-bottom: 20px;
  }

  .message-box-title h2 {
    font-size: 20px;
    line-height: 42px;
    text-align: left;
  }

  .message-box-divider {
    margin-bottom: 20px;
  }

  .message-box-content p {
    font-size: 14px;
    line-height: 24px;
    margin: 0 0 10px 0;
    text-align: left;
  }

  .message-box-image {
    width: 160px;
    height: 160px;
    right: 30px;
    bottom: -80px;
  }
}

@media (max-width: 545px) {
  .message-box-section {
    margin-top: 0px; /* スマートフォン版での余白調整 (余白はfifth-text-sectionで確保) */
    margin-bottom: 80px; /* 画像の下半分用の余白 */
    width: 100vw;
    height: auto;
    min-height: calc(450px + 80px); /* ボックス高さ + 画像はみ出し分 */
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    overflow-x: auto;
    overflow-y: visible !important; /* 画像が見えるように強制 */
    z-index: 1000; /* 他の要素より前面に */
    /* スクロールバーを非表示 */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
  }

  .message-box-section::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }

  .message-box-container {
    gap: 30px;
    width: fit-content; /* コンテンツ幅に調整 */
    padding-left: calc(50vw - 150px); /* 最初のボックスを中央に配置 (300px/2 = 150px) */
    padding-right: calc(50vw - 150px); /* 最後のボックスも中央で止まるように */
  }

  .message-box {
    width: 300px; /* スマートフォンでも固定幅を維持 */
    min-height: 450px; /* 最小高さのみ指定 */
    padding: 28px 20px;
    position: relative;
    flex-shrink: 0;
  }

  .message-box-title {
    margin-bottom: 18px;
  }

  .message-box-title h2 {
    font-size: 18px;
    line-height: 38px;
    text-align: left;
  }

  .message-box-divider {
    margin-bottom: 18px;
  }

  .message-box-content p {
    font-size: 12px;
    line-height: 22px;
    margin: 0 0 8px 0;
    text-align: left;
  }

  .message-box-image {
    width: 160px;
    height: 160px;
    right: 30px;
    bottom: -80px;
  }
}

/* 購入ボタンセクションのスタイル */
.purchase-button-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 100px; /* messagebox→purchase-button: 100px */
  width: 100%;
  position: relative;
}

.purchase-button-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 247px;
  height: 68px;
  border: 6px solid #55ab01;
  border-radius: 50px;
  background-color: transparent;
  text-decoration: none !important;
  text-decoration-line: none !important;
  text-underline-offset: unset !important;
  transition: all 0.3s ease;
  z-index: 2;
  position: relative;
  background-color: white;

  /* タイポグラフィ */
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  font-size: 20px;
  line-height: 36px;
  letter-spacing: 0.2em;
  color: #000000;
  text-align: center;
}

.purchase-button-link:hover {
  background-color: #55ab01;
  color: #ffffff;
  text-decoration: none !important;
  text-decoration-line: none !important;
}

.purchase-button-link:link,
.purchase-button-link:visited,
.purchase-button-link:active {
  text-decoration: none !important;
  text-decoration-line: none !important;
}

/* MeTIMEロゴのスタイル */
.purchase-button-logo {
  width: 339px;
  height: 99px;
  opacity: 1;
  z-index: 1;
  position: relative;
  margin-bottom: -20px; /* ボタンと20px重なるように調整 */
}

/* 購入ボタンのレスポンシブデザイン */
/* タブレット用（769px～1024px） */
@media (min-width: 769px) and (max-width: 1024px) {
  .purchase-button-section {
    margin-top: 50px;
  }

  .purchase-button-link {
    width: 230px;
    height: 62px;
    font-size: 19px;
    line-height: 34px;
    letter-spacing: 0.18em;
  }

  .purchase-button-logo {
    width: 295px;
    height: 86px;
    margin-bottom: -18px;
  }
}

/* タブレット用（481px～768px） */
@media (min-width: 481px) and (max-width: 768px) {
  .purchase-button-section {
    margin-top: 50px;
  }

  .purchase-button-link {
    width: 210px;
    height: 58px;
    font-size: 17px;
    line-height: 30px;
    letter-spacing: 0.15em;
  }

  .purchase-button-logo {
    width: 270px;
    height: 79px;
    margin-bottom: -16px;
  }
}

/* スマートフォン用（361px～480px） */
@media (min-width: 361px) and (max-width: 545px) {
  .purchase-button-section {
    margin-top: 50px;
  }

  .purchase-button-link {
    width: 190px;
    height: 54px;
    font-size: 15px;
    line-height: 28px;
    letter-spacing: 0.12em;
    border-width: 4px;
  }

  .purchase-button-logo {
    width: 240px;
    height: 70px;
    margin-bottom: -15px;
  }
}

/* 小さなスマートフォン用（～360px） */
@media (max-width: 360px) {
  .purchase-button-section {
    margin-top: 50px;
  }

  .purchase-button-link {
    width: 170px;
    height: 50px;
    font-size: 14px;
    line-height: 26px;
    letter-spacing: 0.1em;
    border-width: 3px;
  }

  .purchase-button-logo {
    width: 210px;
    height: 61px;
    margin-bottom: -14px;
  }
}
