/* 画像拡大アニメーション用 */
.overlay-fade-image.is-zoom-anim {
  transition: all 0.3s cubic-bezier(.4, 0, .2, 1);
  transform: scale(1.1);
  /* opacity: 0; */
}

/* アニメーション後は元に戻す（クラス削除でOK） */
.overlay-fade-image {
  transition: all 0.3s cubic-bezier(.4, 0, .2, 1);
  transform: scale(1);
  /* opacity: 1; */
}

/* 黒幕フェード用オーバーレイ（カスタマイズ可） */
.overlay-fade {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  opacity: 1;
  z-index: 99999;
  pointer-events: auto;
}

body.is-page-transitioning>*:not(.overlay-fade):not(.overlay-voice-text) {
  visibility: hidden !important;
  opacity: 0 !important;
}

body.is-page-transitioning>.overlay-fade {
  visibility: visible !important;
  opacity: 1 !important;
}

body.is-page-transitioning>.overlay-voice-text {
  visibility: visible !important;
  opacity: 1 !important;
}

.overlay-fade::before {
  content: "";
  position: absolute;
  background-image: url("../img/rogo.webp");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 800px;
  height: auto;
  aspect-ratio: 642 / 200;
  max-width: 90vw;
  max-height: 90vh;
  opacity: 0.06;
  z-index: 0;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: opacity 0.4s ease-in-out;
}

/* 音声再生許可ダイアログでトップページ時にロゴを強調表示 */
.overlay-fade.is-logo-visible::before {
  opacity: 1;
}

.overlay-fade-visual {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 1200px;
  height: 1200px;
  aspect-ratio: 1 / 1;
  display: block;
  z-index: 10;
  max-width: 75vw;
  max-height: 75vh;
}

.overlay-fade .overlay-fade-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  z-index: 2;
}

/* member-cpt専用 */
.overlay-fade-mask {
  display: none;
}

.overlay-fade-visual.is-member-cpt .overlay-fade-mask {
  display: block;
  background-color: var(--overlay-mask-color, #111);
  -webkit-mask-image: var(--overlay-mask-image);
  mask-image: var(--overlay-mask-image);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.overlay-loading {
  position: absolute;
  bottom: 40px;
  right: 40px;
  /* top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); */
  display: none;
  z-index: 20;
}

@media (max-width: 768px) {
  .overlay-loading {
    bottom: 20px;
    right: inherit;
    left: 50%;
    transform: translate(-50%, 0);
  }
}

/* デフォルトは横バー。円環はクラス切替で再利用できるよう残す */
.overlay-fade.is-loading-bar .overlay-loading--bar {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.overlay-fade.is-loading-ring .overlay-loading--ring {
  display: block;
}

.overlay-fade.is-loading-bar .overlay-loading--ring {
  display: none !important;
}

.overlay-fade.is-loading-ring .overlay-loading--bar {
  display: none !important;
}

.overlay-loading--ring {
  width: 200px;
  height: 200px;
  transform: translate(-50%, -50%) scale(1.4);
  filter: drop-shadow(0px 1px 4px rgba(0, 0, 0, 0.2));
  /* 円環の半径をCSS変数で管理（SVGのstroke-dasharrayと連動させるため） */
  --ring-radius: 77;
  opacity: 0.8;
}

.overlay-loading--bar {
  width: min(600px, calc(100vw - 48px));
}

@media (max-width: 768px) {
  .overlay-loading--bar {
    width: min(300px, calc(80vw));
  }
}

.overlay-loading-track {
  width: 100%;
  height: 34px;
  border-radius: 999px;
  border: 6px solid var(--color-main);
  position: relative;
  padding: 2px;
  /* 内側のバーと重ならないようにスペースを確保 */
}
@media (max-width: 768px) {
  .overlay-loading-track {
    height: 24px;
    border-width: 4px;
  }
}
.overlay-loading-bar {
  width: 0;
  height: 100%;
  background: var(--color-main);
  position: relative;
  border-radius: 999px;
}

.overlay-loading-chara {
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.overlay-loading-chara.c1 {
  width: 270px;
  height: 300px;
  background-image: url('../img/loading_furi.webp');
}

@media (max-width: 768px) {
  .overlay-loading-chara.c1 {
    width: calc(270px * 0.7);
    height: calc(200px * 0.7);
  }
}

.overlay-loading-chara.c2 {
  width: 197px;
  height: 280px;
  background-image: url('../img/loading_mera.webp');
}

.overlay-loading-chara.c3 {
  width: 280px;
  height: 240px;
  background-image: url('../img/loading_akubi.webp');
}

@media (max-width: 768px) {
  .overlay-loading-chara.c1 {
    width: calc(270px * 0.6);
    height: calc(200px * 0.6);
  }

  .overlay-loading-chara.c2 {
    width: calc(197px * 0.6);
    height: calc(280px* 0.6);
  }

  .overlay-loading-chara.c3 {
    width: calc(280px* 0.6);
    height: calc(240px* 0.6);
  }
}

/* .overlay-loading-chara {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  width: 62px;
  height: 62px;
  background-color: var(--color-main);
  -webkit-mask-image: url('../img/loading.webp');
  mask-image: url('../img/loading.webp');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
} */

/* SVG円環 */
.overlay-loading-ring {
  width: 100%;
  height: 100%;
  /* 0度（3時方向）から始まるので -90deg 回転して 12時スタートにする */
  transform: rotate(-90deg);
}

/* キャラアイコン（リング用の配置） */
.overlay-loading--ring .overlay-loading-chara {
  margin: 0px;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  transform: translate(-50%, -50%);
  background-color: #fff;
  mask-position: center;
  -webkit-mask-position: center;
}

.overlay-loading-ring-track {
  fill: none;
  stroke: rgba(0, 0, 0, 0.06);
  stroke-width: 8;
}

.overlay-loading-ring-progress {
  fill: none;
  stroke: #fff;
  stroke-width: 8;
  stroke-linecap: round;
  /* 円周 = 2 * π * r */
  stroke-dasharray: calc(2 * 3.1416 * var(--ring-radius));
  stroke-dashoffset: calc(2 * 3.1416 * var(--ring-radius));
  /* 0% の状態 */
}

/* 中央に重ねる ％ テキスト */
.overlay-loading-text {
  color: var(--color-main);
  font-size: 0.875rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.overlay-loading--ring .overlay-loading-text {
  font-size: 0.7rem;
  color: var(--color-text);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.overlay-loading--bar .overlay-loading-text {
  text-align: center;
  padding-top: 50px;
}

.overlay-fade.fadein-ready {
  opacity: 0;
  pointer-events: none;
}

/* voice_text表示用（member-cpt用） */
.overlay-voice-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Georgia', 'Noto Serif JP', 'ヒラギノ明朝', serif;
  font-size: 3rem;
  font-weight: bold;
  /* color: var(--color-text); */
  color: #fff;
  /* text-align: center; */
  max-width: 100vw;
  width: auto;
  z-index: 100000;
  pointer-events: none;
  line-height: 1.6;
  white-space: normal;
  word-wrap: break-word;
  display: none;

  filter: brightness(1.5) blur(0.5px);
  /* text-shadow:
      0 0 2px #fff,
      0 0 4px #0ff,
      0 0 8px #0ff,
      0 0 16px #0ff,
      0 0 32px #08f; */
  text-shadow:
    0 0 2px rgba(255, 255, 255, 1.0),
    0 0 5px rgba(255, 255, 255, 0.8),
    0 0 8px rgba(255, 255, 255, 0.5),
    0 0 16px rgba(255, 255, 255, 0.2);
  white-space: nowrap;
}

.overlay-voice-text.is-showing {
  display: block;
}

.overlay-voice-text.is-mask-mode {
  -webkit-mask-image: linear-gradient(to right, black 0%, black 100%);
  mask-image: linear-gradient(to right, black 0%, black 100%);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: left center;
  mask-position: left center;
}

.overlay-voice-text.is-char-mode {
  -webkit-mask-image: none;
  mask-image: none;
  text-align: center;
  white-space: normal;
  word-wrap: break-word;
  width: 80vw;
  max-width: 80vw;
}


.overlay-voice-text-char {
  display: inline-block;
  opacity: 0;
  transform: scale(1.7);
  transition: opacity 300ms ease-out, transform 280ms ease-out;
}

.overlay-voice-text-char.is-visible {
  opacity: 1;
  transform: scale(1);
}

.overlay-voice-text-char-fade {
  display: inline-block;
  opacity: 0;
  color: #000;
  transform: scale(1.5);
  transition: opacity 280ms ease-out, transform 250ms ease-out;
}

.overlay-voice-text-char-fade.is-visible {
  opacity: 1;
  color: #000;
  transform: scale(1);
}

.overlay-loading-label {
  text-transform: uppercase;
  /* letter-spacing: 0.5em; */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  font-size: 20px;
  font-weight: bold;
  margin-top: 15px;
  color: var(--color-main);
}

@media (max-width: 768px) {
  .overlay-loading-label {
    font-size: 12px;
    margin-top: 10px;
  }
}

.overlay-loading-label-char {
  display: inline-block;
  animation: piyoko 1.56s ease-in-out infinite;
  animation-delay: calc(var(--char-index, 0) * 0.08s);
}

@keyframes piyoko {

  0%,
  38.46%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }

  19.23% {
    transform: translateY(-12px);
    opacity: 0.8;
  }
}

@media (max-width: 768px) {
  @keyframes piyoko {

    0%,
    38.46%,
    100% {
      transform: translateY(0);
      opacity: 1;
    }

    19.23% {
      transform: translateY(-8px);
      opacity: 0.8;
    }
  }
}