:root {
  --color-bg-light: #ececec;
  --color-bg-dark: #050508;
  --color-text-light: #333;
  --color-text-dark: #e0e0e0;
  --color-accent: #b71c1c;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  background-color: var(--color-bg-light);
  transition: background-color 2s ease;
}

html.is-mystery-mode {
  background-color: var(--color-bg-dark);
}

body {
  font-family: "Shippori Mincho", serif;
  background-color: transparent;
  /* htmlの背景を透かして見せる */
  color: var(--color-text-light);
  transition: color 2s ease;
  /* スマホのスクロール検知バグを防ぐため overflow-x: hidden; は削除 */
}

body.is-mystery-mode {
  color: var(--color-text-dark);
}
.container {
  width: 90%;
  max-width: 1000px;
  margin: 0 auto;
}
.noise-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: url('../images/noise.png') center/cover;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: screen;
}
.noise-overlay.is-active {
  animation: flashNoise 0.1s steps(3) forwards;
}
@keyframes flashNoise {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
  }
}
/* Hero */
.hero-section {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: #000;
  top: -80px;
}
.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.6;
}
.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.2) brightness(0.8);
}
.hero-copy-container {
  position: absolute;
  top: 15%;
  right: 15%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  height: auto;
  max-height: 75vh;
}
.hero-text {
  color: #fff;
  white-space: nowrap;
  font-size: min(4.5vh, 3rem);
  letter-spacing: 0.4em;
  animation: subtleGlitch 2s infinite linear;
}
/* 文字が変わる瞬間だけ激しく動くアニメーションを適用 */
.hero-text.is-glitching {
  animation: strongGlitch 0.2s infinite linear;
}

/* 常にかかり続ける微細な色収差と揺れ */
@keyframes subtleGlitch {
  0%   { text-shadow: 1px 0 0 rgba(255,0,0,0.6), -1px 0 0 rgba(0,255,255,0.6); transform: translate(0, 0); }
  25%  { text-shadow: -1px 1px 0 rgba(255,0,0,0.4), 2px -2px 0 rgba(0,255,255,0.4); transform: translate(-2px, 1px); }
  50%  { text-shadow: 2px -1px 0 rgba(255,0,0,0.5), -3px 2px 0 rgba(0,255,255,0.5); transform: translate(1px, -1px); }
  75%  { text-shadow: -1px -1px 0 rgba(255,0,0,0.6), 2px 2px 0 rgba(0,255,255,0.6); transform: translate(-1px, -2px); }
  100% { text-shadow: 1px 0 0 rgba(255,0,0,0.6), -1px 0 0 rgba(0,255,255,0.6); transform: translate(0, 0); }
}

/* 文字変化時の大きな色収差と揺れ */
@keyframes strongGlitch {
  0%   { text-shadow: 4px 0 0 rgba(255,0,0,0.9), -4px 0 0 rgba(0,255,255,0.9); transform: translate(-2px, 1px); }
  20%  { text-shadow: -4px 2px 0 rgba(255,0,0,0.9), 4px -2px 0 rgba(0,255,255,0.9); transform: translate(2px, -1px); }
  40%  { text-shadow: 5px -2px 0 rgba(255,0,0,0.9), -5px 2px 0 rgba(0,255,255,0.9); transform: translate(-1px, 2px); }
  60%  { text-shadow: -5px -2px 0 rgba(255,0,0,0.9), 5px 2px 0 rgba(0,255,255,0.9); transform: translate(1px, -2px); }
  80%  { text-shadow: 3px 1px 0 rgba(255,0,0,0.9), -3px -1px 0 rgba(0,255,255,0.9); transform: translate(-2px, -1px); }
  100% { text-shadow: 4px 0 0 rgba(255,0,0,0.9), -4px 0 0 rgba(0,255,255,0.9); transform: translate(2px, 1px); }
}

.scroll-indicator {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-align: center;
}
.scroll-indicator .line {
  width: 1px;
  height: 40px;
  background-color: #fff;
  margin: 10px auto 0;
  animation: scrollLine 2s infinite;
}
@keyframes scrollLine {
  0% {
    transform: scaleY(0);
    transform-origin: top;
  }
  50% {
    transform: scaleY(1);
    transform-origin: top;
  }
  50.1% {
    transform: scaleY(1);
    transform-origin: bottom;
  }
  100% {
    transform: scaleY(0);
    transform-origin: bottom;
  }
}
/* 導入テキスト（ブラーフェードイン） */
.intro-section {
  padding: 15rem 0;
  text-align: center;
  font-size: 1.5rem;
  line-height: 2.5;
  letter-spacing: 0.1em;
}
.fade-text {
  opacity: 0;
  filter: blur(12px);
  transform: translateY(20px);
  transition: opacity 1.5s ease, filter 1.5s ease, transform 1.5s ease;
  margin-bottom: 2rem;
}
.fade-text.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0);
}
/* 街劇（可読性向上とルビ） */
.boundary-section {
  padding: 10rem 0;
  text-align: center;
}
.glitch-title {
  font-size: 3.5rem;
  margin-bottom: 4rem;
  position: relative;
  display: inline-block;
}
.glitch-title ruby {
  ruby-align: center;
}
.glitch-title rt {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--color-accent);
  transform: translateY(-5px); 
  display: block;
}
.glitch-title::before, .glitch-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0.4; /* 透明度を下げて可読性確保 */
}
.glitch-title::before {
  left: 1px;
  text-shadow: -1px 0 red;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
  animation: glitch-anim 4s infinite linear alternate-reverse;
}
.glitch-title::after {
  left: -1px;
  text-shadow: -1px 0 blue;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
  animation: glitch-anim 3.5s infinite linear alternate-reverse;
}
@keyframes glitch-anim {
  0% {
    transform: translate(0);
  }
  20% {
    transform: translate(-2px, 0);
  }
  40% {
    transform: translate(2px, 0);
  }
  60% {
    transform: translate(-2px, 0);
  }
  80% {
    transform: translate(2px, 0);
  }
  100% {
    transform: translate(0);
  }
}
.boundary-text-wrap {
  line-height: 2;
  letter-spacing: 0.1em;
  /* 常にゆっくりと揺れ続けるアニメーション */
  animation: eerieSway 4s ease-in-out infinite alternate;
  font-size: 1.3rem;
}

/* 揺らぎのキーフレーム */
@keyframes eerieSway {
  0% { transform: translate(0, 0) }
  33% { transform: translate(-2px, 1px) }
  66% { transform: translate(2px, -1px)}
  100% { transform: translate(-1px, 2px) }
}
.glitch-text {
  opacity: 0;
  filter: blur(5px);
  transform: translateX(-10px);
  transition: all 0.8s ease;
}
.glitch-text.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateX(0);
}
/* 登場人物へのフォーカス（洗練された演出） */
.characters-section {
  padding: 10rem 0;
}
.char-container {
  display: flex;
  flex-direction: column;
  gap: 8rem;
}
.char-item {
  display: flex;
  align-items: center;
  gap: 4rem;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.5s ease, transform 1.5s ease;
}
.char-item:nth-child(even) {
  flex-direction: row-reverse;
}
.char-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.char-img-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border-radius: 4px;
}
/* 周囲を暗く落とすヴィネット効果 */
.char-img-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, transparent 40%, rgba(0, 0, 0, 0.8) 150%);
  pointer-events: none;
  transition: background 0.5s ease;
}
/* 初期状態はモノクロで少し引いた状態 */
.char-img-wrap img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  display: block;
  transform: scale(1);
  filter: grayscale(80%) contrast(1.1) brightness(0.6);
  transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.8s ease;
}
/* ホバー時にゆっくり迫り、色が戻るシネマティックな動き */
.char-img-wrap:hover img {
  transform: scale(1.08);
  filter: grayscale(0%) contrast(1.2) brightness(1);
}
.char-img-wrap:hover::after {
  background: radial-gradient(circle, transparent 50%, rgba(0, 0, 0, 0.6) 150%);
}
.char-info {
  flex: 1;
  opacity: 0.7;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.char-item:hover .char-info {
  opacity: 1;
  transform: translateX(5px);
}
.char-item:nth-child(even):hover .char-info {
  transform: translateX(-5px);
}
.char-info h3 {
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
  color: #fff;
  letter-spacing: 0.1em;
  display: flex;
  flex-direction: column;
}
.char-info h3 span {
  font-size: 0.9rem;
  color: var(--color-accent);
  margin-top: 0.5rem;
  letter-spacing: 0.2em;
}
.char-info p {
  line-height: 2;
  letter-spacing: 0.05em;
  color: #ccc;
}
/* 疑似体験のピーク */
.scroll-jack-section {
  height: 400vh;
  position: relative;
}
.scroll-jack-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 85%, transparent 100%);
}

.scroll-jack-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../images/alley-depth.jpg') center/cover;
  /* 初期状態は暗く、強いブラーがかかっている */
  filter: brightness(0.3) contrast(1.2) blur(15px);
  transform: scale(1.2);
  transform-origin: center center;
  will-change: transform, filter;
}
.scroll-jack-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
}
.walk-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: 500;
  color: #fff;
  letter-spacing: 0.2em;
  opacity: 0;
  text-shadow:
      0 2px 4px rgba(0, 0, 0, 0.9),
      0 8px 16px rgba(0, 0, 0, 0.9),
      0 0 30px rgba(0, 0, 0, 1),
      0 0 50px rgba(0, 0, 0, 0.8);
  will-change: opacity, transform;
}
.walk-text.final-step {
/*  color: var(--color-accent);*/
  font-size: 3rem;
}
/* コールトゥアクション */
.cta-section {
  padding: 15rem 0 10rem;
  text-align: center;
  background: radial-gradient(circle at center, #111 0%, #000 100%);
}
.cta-text {
  font-size: 1.5rem;
  line-height: 2;
  letter-spacing: 0.1em;
  margin-bottom: 4rem;
  color: #fff;
}
.btn-pulse {
  display: inline-block;
  padding: 20px 60px;
  background-color: transparent;
  border: 1px solid rgba(183, 28, 28, 0.6);
  color: #fff;
  font-size: 1.2rem;
  letter-spacing: 0.2em;
  text-decoration: none;
  border-radius: 4px;
  animation: heartbeat 2s infinite;
  transition: background-color 0.3s;
}
.btn-pulse:hover {
  background-color: rgba(183, 28, 28, 0.2);
}
@keyframes heartbeat {
  0% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(183, 28, 28, 0.2);
  }
  15% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(183, 28, 28, 0.8);
  }
  30% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(183, 28, 28, 0.2);
  }
  45% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(183, 28, 28, 0.8);
  }
  60% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(183, 28, 28, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 10px rgba(183, 28, 28, 0.2);
  }
}
@media (max-width: 768px) {
  .hero-copy-container {
    top: 10%;
    right: 10%;
  }
  .hero-text {
    font-size: min(4.5vh, 3rem);
      letter-spacing: 0.3em;
  }
  .char-item, .char-item:nth-child(even) {
    flex-direction: column;
    gap: 2rem;
  }
  .char-img-wrap {
    width: 100%;
  }
  .walk-text {
    font-size: 1.5rem;
  }
  .walk-text.final-step {
    font-size: 1.8rem;
  }
}