/* --- 基本レイアウト --- */
.topsection {
  position: relative;
  width: 100%;
  overflow: hidden;
  z-index: 1;
  /* aspect-ratioは画面幅に合わせてmedia queryで制御 */
}

.tstextbox {
  width: 100%;
  height: 100%;
  display: block;
  aspect-ratio: 3 / 2;
  z-index: 1500;
  color: rgba(0,0,0,0.1); /* 必要に応じ調整 */
  padding: 0;
  pointer-events: none; /* テキストはホバー無効 */
  position: absolute;
  top: 0; left: 0;
}
.tstextbox ul {
  width:100%;
  height: 100%;
  display: block;
  aspect-ratio: 3 / 2;
  position: relative;
  list-style: none;
  padding: 0;
  margin: 0;
}
.tstextbox ul li {
  width:100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  aspect-ratio: 3 / 2;
  letter-spacing: -0.1em;
  font-family: var(--font-en);
  line-height: 0.8em;
  margin:0 0 0 0;
  padding:0 0 0 0;
  text-align: center;
  position: absolute;
  bottom: -0.1em;
  left: 0;
  opacity: 0;
  animation-name: fade;
  animation-duration: var(--total-duration, 27s); /* JSで制御 */
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}
@keyframes fade {
  0% { opacity: 0; }
  7.4% { opacity: 1; }   /* フェードイン */
  25.9% { opacity: 1; }  /* 表示維持 */
  33.3% { opacity: 0; }  /* フェードアウト */
  100% { opacity: 0; }
}

.tstextbox ul li:nth-child(1) {
font-size: 30vw;
}
.tstextbox ul li:nth-child(2) {
font-size: 28vw;
}
.tstextbox ul li:nth-child(3) {
font-size: 23vw;
}

/* --- 動画背景 --- */
.video-background {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.video-background iframe {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  width: 177.78%; /* 16:9 の横長基準 */
  height: 100%;
  aspect-ratio: auto;
  object-fit: cover;
  border: 0;
}

/* --- ランダムボックス群 --- */
.tsboxcov {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
  z-index: 1000;
  pointer-events: none; /* ホバー無効 */
}

.tsboxcov .tsbcvs {
  background-color: #fff;
  opacity: 1;
  transition: opacity 0.1s;
  flex-shrink: 0;
  /* 正方形化はwidthとheightを同じにしつつflexベースで調整 */
}

/* --- レスポンシブ --- */

/* 1025px以上: aspect 3/2, 8列×5行 */
@media screen and (min-width: 1025px) {
  .topsection {
    aspect-ratio: 3 / 2;
  }
  .tsboxcov .tsbcvs {
    width: 12.5%;  /* 100% ÷ 8列 */
    height: calc((100% / 5)); /* 5行で割る */
  }
}

/* 769px〜1024px: aspect 3/2, 10列×4行 */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .topsection {
    aspect-ratio: 3 / 2;
  }
  .tsboxcov .tsbcvs {
    width: 20%;    /* 100% ÷ 10列 */
    height: calc((100% / 4)); /* 4行 */
  }
}

/* 768px以下: aspect 9/16, 5列×8行 */
@media screen and (max-width: 768px) {
  .topsection {
    aspect-ratio: 9 / 16;
  }
  .tsboxcov .tsbcvs {
    width: 20%;    /* 100% ÷ 5列 */
    height: calc((100% / 8)); /* 8行 */
  }

  /* 動画iframe 縦長9:16に調整 */
  .video-background iframe {
    width: auto !important;
    height: 350% !important;
    aspect-ratio: 9 / 16;
    object-fit: cover;
  }
}
