.container {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.glitch-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.base-image {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  z-index: 1;
}

.glitch-layer {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 2;
}

.glitch-layer.active {
  animation: glitch 0.3s infinite;
}

.glitch-layer.red.active {
  opacity: 0.2;
  mix-blend-mode: overlay;
}

.glitch-layer.blue.active {
  opacity: 0.2;
  mix-blend-mode: overlay;
}

.glitch-layer.black.active {
  opacity: 0.2;
  mix-blend-mode: overlay;
}

.glitch-layer.red {
  animation-delay: 0s;
}

.glitch-layer.blue {
  animation-delay: 0.1s;
}

.glitch-layer.black {
  animation-delay: 0.2s;
}

@keyframes glitch {
  0% {
    transform: translate(0);
    opacity: 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
  10% {
    transform: translate(-5px, 3px);
    opacity: 0.8;
    clip-path: polygon(5% 0, 100% 2%, 95% 100%, 0 98%);
  }
  20% {
    transform: translate(4px, -4px);
    opacity: 0.6;
    clip-path: polygon(0 15%, 95% 0, 100% 85%, 5% 100%);
  }
  30% {
    transform: translate(-6px, -3px);
    opacity: 0.9;
    clip-path: polygon(10% 5%, 100% 10%, 90% 95%, 0 90%);
  }
  40% {
    transform: translate(5px, 5px);
    opacity: 0.7;
    clip-path: polygon(0 10%, 90% 0, 100% 90%, 10% 100%);
  }
  50% {
    transform: translate(-4px, 3px);
    opacity: 0.8;
    clip-path: polygon(15% 0, 100% 15%, 85% 100%, 0 85%);
  }
  60% {
    transform: translate(6px, -5px);
    opacity: 0.6;
    clip-path: polygon(5% 15%, 95% 5%, 100% 85%, 0 95%);
  }
  70% {
    transform: translate(-5px, -4px);
    opacity: 0.9;
    clip-path: polygon(10% 0, 100% 5%, 90% 100%, 0 95%);
  }
  80% {
    transform: translate(4px, 6px);
    opacity: 0.7;
    clip-path: polygon(0 5%, 95% 0, 100% 95%, 5% 100%);
  }
  90% {
    transform: translate(-6px, 4px);
    opacity: 0.8;
    clip-path: polygon(15% 10%, 100% 0, 85% 90%, 0 100%);
  }
  100% {
    transform: translate(0);
    opacity: 0;
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }
}

.statement {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  z-index: 10;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
  line-height: 1.4;
  max-width: 80%;
  margin-top: 2rem;
}

.statement.visible {
  animation: fadeInUp 1s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(30px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0);
  }
}

.glitch-text {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  color: #ff0000;
  font-size: 3rem;
  font-weight: bold;
  text-align: center;
  opacity: 0;
  z-index: 5;
  text-shadow: 2px 2px 0px #00ffff, -2px -2px 0px #ffff00;
  animation: textGlitch 0.1s infinite;
}

.glitch-text.visible {
  opacity: 1;
}

@keyframes textGlitch {
  0% {
    transform: translateX(-50%) translate(0);
  }
  20% {
    transform: translateX(-50%) translate(-2px, 2px);
  }
  40% {
    transform: translateX(-50%) translate(2px, -2px);
  }
  60% {
    transform: translateX(-50%) translate(-2px, -2px);
  }
  80% {
    transform: translateX(-50%) translate(2px, 2px);
  }
  100% {
    transform: translateX(-50%) translate(0);
  }
}

.subtitle {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 1.2rem;
  font-weight: 300;
  text-align: center;
  opacity: 0;
  z-index: 8;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.subtitle.visible {
  animation: fadeInUp 1s ease forwards;
}

/* mnHdr用のグリッチ効果 */
.mnHdr {
  position: relative;
  overflow: hidden;
}

/* スマホ用のmnHdr高さ調整 */
@media screen and (max-width: 670px) {
  .mnHdr {
    min-height: 100vh;
  }
}

.mnHdr-glitch-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.mnHdr-glitch-container img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  z-index: 1;
  object-position: top;
}

/* PC用画像の表示制御 */
@media screen and (min-width: 671px) {
  .mnHdr-glitch-container img[src*='@sp'] {
    display: none;
  }
}

/* SP用画像の表示制御 */
@media screen and (max-width: 670px) {
  .mnHdr-glitch-container img[src*='@pc'] {
    display: none;
  }
}

.mnHdr-glitch-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: overlay;
  opacity: 0;
  z-index: 2;
}

.mnHdr-glitch-layer.red {
  animation-delay: 0s;
}

.mnHdr-glitch-layer.blue {
  animation-delay: 0.1s;
}

.mnHdr-glitch-layer.black {
  animation-delay: 0.2s;
}

.mnHdr-glitch-layer.active {
  animation: mnHdrGlitch 0.3s infinite;
}

.mnHdr-glitch-layer.red.active {
  opacity: 0.8;
  mix-blend-mode: overlay;
}

.mnHdr-glitch-layer.blue.active {
  opacity: 0.8;
  mix-blend-mode: overlay;
}

.mnHdr-glitch-layer.black.active {
  opacity: 0.6;
  mix-blend-mode: overlay;
}

@keyframes mnHdrGlitch {
  0% {
    transform: translate(0);
    opacity: 0;
  }
  10% {
    transform: translate(-2px, 2px);
    opacity: 0.8;
  }
  20% {
    transform: translate(2px, -2px);
    opacity: 0.6;
  }
  30% {
    transform: translate(-2px, -2px);
    opacity: 0.9;
  }
  40% {
    transform: translate(2px, 2px);
    opacity: 0.7;
  }
  50% {
    transform: translate(-2px, 2px);
    opacity: 0.8;
  }
  60% {
    transform: translate(2px, -2px);
    opacity: 0.6;
  }
  70% {
    transform: translate(-2px, -2px);
    opacity: 0.9;
  }
  80% {
    transform: translate(2px, 2px);
    opacity: 0.7;
  }
  90% {
    transform: translate(-2px, 2px);
    opacity: 0.8;
  }
  100% {
    transform: translate(0);
    opacity: 0;
  }
}

/* mnHdr-glitch-message用のスタイル */
.mnHdr-glitch-message {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.mnHdr-glitch-message.visible {
  opacity: 1;
}

.mnHdr-glitch-message img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
  max-width: 77.375em;
  width: 100%;
}

/* スマホ用の画像サイズ調整 */
@media screen and (max-width: 670px) {
  .mnHdr-glitch-message img {
    max-width: 100%;
    height: auto;
    max-height: 100vh;
    object-fit: contain;
  }
}

.mnHdr-glitch-message.show-text img {
  opacity: 1;
}
