/* =============================================
 * THE GOLDEN JOURNAL - 未来遺跡風ビジュアル（構造演出対応）
 * ============================================= */

body.golden-journal {
  background: radial-gradient(ellipse at top, #111 0%, #000 100%);
  font-family: 'Helvetica Neue', sans-serif;
  color: #eee;
  padding: 4rem 1rem;
  max-width: 800px;
  margin: auto;
  position: relative;
  overflow-x: hidden;
}

.golden-journal-content {
  position: relative;
  z-index: 10;
}

h1.golden-journal-title {
  font-size: 2rem;
  text-align: center;
  margin-bottom: 2rem;
  color: gold;
}

.golden-description {
  text-align: center;
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.frame-container {
  position: relative;
  padding: 0 1rem;
  max-width: 800px;
  margin: auto;
  z-index: 10;
}

.logo-layer {
  position: relative;
  height: 350px;
  margin-top: 1rem;
  margin-bottom: -2rem;
  z-index: -1;
  pointer-events: none;
}

/* 背景回転ロゴ */
#tgj-logo-bg {
  position: fixed;
  top: 275px;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.08;
  z-index: 9;
  width: 350px;
  animation: rotateLogo 60s linear infinite;
  filter: blur(1px);
  pointer-events: none;
}

@keyframes rotateLogo {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 固定ロゴ（前景） */
#tgj-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 300px;
  pointer-events: none;
}

/* 残響ロゴ（ぶわっと） */
#tgj-logo-intro {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  animation: introEchoZoom 3s ease-out forwards;
}

@keyframes introEchoZoom {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0px);
  }
  40% {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(1.2);
    filter: blur(1.5px);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
    filter: blur(4px);
  }
}

/* === 弱演出（2個一致）ロゴフラッシュ＋暗転 === */
#tgj-logo.flash img {
  animation: logoFlash 1s ease-in-out;
}
@keyframes logoFlash {
  0% { filter: brightness(2) contrast(1.5); }
  50% { filter: brightness(0.2) contrast(0.5); }
  100% { filter: brightness(1) contrast(1); }
}

#journal-frame {
  position: relative;
  /* コーナー画像をフレーム外にはみ出させるため可視に */
  overflow: visible;
  max-width: 680px;
  margin: 0 auto;
  border: 5px solid rgba(255,215,0,0.3);
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.2);
  z-index: 1;
}

.corner-frame {
  position: absolute;
  width: 64px;
  height: 64px;
  background: url('/wp-content/uploads/images/corner.png') no-repeat center center / contain;
  opacity: 1;
  /* レーザーや縦線よりも確実に前面に */
  z-index: 1000;
  pointer-events: none;
}

.corner-tl { top: -15px; left: -15px; transform: scale(1,1); }
.corner-tr { top: -15px; right: -15px; transform: scale(-1,1); }
.corner-bl { bottom: -15px; left: -15px; transform: scale(1,-1); }
.corner-br { bottom: -15px; right: -15px; transform: scale(-1,-1); }

#journal-frame.expand {
  display: block;
  animation: laserGlow 3s ease infinite;
}
@keyframes laserGlow {
  0%,100% { box-shadow: 0 0 6px rgba(255,215,0,0.2); }
  50% { box-shadow: 0 0 15px rgba(255,215,0,0.4); }
}

/* コメントカード */
.sns-card {
  max-width: 650px;
  position: relative;
  background: rgba(0,0,0,0.65);
  border: 2px solid gold;
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(255,215,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 10;
  padding: 1.5rem;
  margin: 0 auto 2rem;
  opacity: 0;
  transition: opacity 1s ease, transform 1s ease;
  transform: translateY(20px);
  animation: glowLoop 4s ease-in-out infinite;
}
@keyframes glowLoop {
  0%,100% { box-shadow: 0 0 12px rgba(255,215,0,0.3); }
  50% { box-shadow: 0 0 24px rgba(255,215,0,0.6); }
}

.sns-card.glow-1 { box-shadow: 0 0 10px rgba(255,215,0,0.2); }
.sns-card.glow-2 { box-shadow: 0 0 15px rgba(255,215,0,0.3); }
.sns-card.glow-3 { box-shadow: 0 0 20px rgba(255,215,0,0.4); }
.sns-card.glow-4 { box-shadow: 0 0 30px rgba(255,215,0,0.5); }
.sns-card.glow-5 { box-shadow: 0 0 40px rgba(255,215,0,0.6); border-color: gold; }

.sns-card .corner-glow {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.8;
  filter: blur(6px);
  animation: glowPulse 2.8s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}
@keyframes glowPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 1; }
}

.sns-icon { font-size: 1.6rem; margin-right: 0.5em; color: #ffd700; text-shadow: 0 0 6px rgba(255,215,0,0.8); }
.resonance-container.fade-in .sns-card { opacity: 1; transform: translateY(0); }

/* レーザーは枠の中で終わらせる：高さとtopを揃える */
#journal-frame .circuit-line-vertical {
  position: absolute;
  width: 2px;
  height: 120px;           /* ← 100px から上げる */
  top: -120px;             /* ← 高さと同じ負値にして上からスタート */
  background: linear-gradient(to bottom, transparent, cyan, transparent);
  opacity: 0.6;
  animation: verticalFlashLine 1.5s linear forwards;
  z-index: 2;
  pointer-events: none;
}

@keyframes verticalFlashLine {
  0%   { top: -120px; opacity: 0.4; }
  100% { top: calc(100% - 120px); opacity: 0; }  /* ← 枠の底ピッタリで止める */
}

/* ルーレットサイズ調整 */
#miracle-icons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem;
  margin-bottom: 2rem;
  border: 4px double gold;
  border-radius: 12px;
  background: radial-gradient(circle at center, #111 0%, #000 80%);
  box-shadow: 0 0 20px rgba(255,215,0,0.4), inset 0 0 10px rgba(255,215,0,0.2);
  max-width: 320px;
  margin: auto;
  position: relative;
}
.miracle-icon { font-size: 1.8rem; transition: transform 0.3s ease, text-shadow 0.3s ease; text-shadow: 0 0 4px rgba(255,215,0,0.5); }
.miracle-icon.glow { transform: scale(1.3); text-shadow: 0 0 12px rgba(255,215,0,0.9); }

/* scatter演出（3個一致） */
body.soul-scatter { background: linear-gradient(135deg, #1b001b, #000); animation: chaosBackground 6s infinite alternate; font-family: 'Papyrus','Comic Sans MS',cursive; color: #0ff; text-shadow: 0 0 5px #f0f,0 0 10px #0ff; }
@keyframes chaosBackground { 0% { filter: hue-rotate(0deg) contrast(1);} 50% { filter: hue-rotate(180deg) contrast(1.5);} 100% { filter: hue-rotate(360deg) contrast(1);} }

/* === scatter演出（3個一致） === */
body.soul-scatter {
  background: linear-gradient(135deg, #1b001b, #000);
  animation: chaosBackground 6s infinite alternate;
  font-family: 'Papyrus', 'Comic Sans MS', cursive;
  color: #0ff;
  text-shadow: 0 0 5px #f0f, 0 0 10px #0ff;
}
@keyframes chaosBackground {
  0% { filter: hue-rotate(0deg) contrast(1); }
  50% { filter: hue-rotate(180deg) contrast(1.5); }
  100% { filter: hue-rotate(360deg) contrast(1); }
}

/* === Rupture演出（4個一致） === */
.rupture-img {
  width: 80%;
  max-width: 600px;
  animation: shake 0.5s ease-in-out 2;
}
.rupture-message {
  color: #ff4444;
  font-size: 1.6rem;
  margin-top: 2rem;
  text-shadow: 0 0 10px #ff0000;
  animation: flickerDark 1.5s infinite alternate;
}

.rupture-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 1008;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
@keyframes shake {
  0%,100% { transform: translate(0,0); }
  20% { transform: translate(-5px,5px); }
  40% { transform: translate(5px,-5px); }
  60% { transform: translate(-5px,-5px); }
  80% { transform: translate(5px,5px); }
}

/* === Invert演出（白世界＋黒フレーム介入） === */
.invert-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: #fff;
  z-index: 1008;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  animation: fadeInWhite 0.5s ease forwards;
}
.white-frame {
  border: 4px solid #fff;
  padding: 1rem 2rem;
  background: rgba(255,255,255,0.85);
  text-align: center;
  color: #222;
  font-size: 1.5rem;
  margin-bottom: 2rem;
}
.black-frame {
  display: none;
  border: 3px solid #000;
  padding: 1rem 2rem;
  background: rgba(0,0,0,0.85);
  color: #f33;
  font-size: 1.4rem;
}
@keyframes fadeInWhite {
  0% { opacity: 0; } 100% { opacity: 1; }
}
@keyframes flickerDark {
  0% { opacity: 1; } 50% { opacity: 0.6; } 100% { opacity: 1; }
}

.dark-text { animation: flickerDark 1.5s infinite alternate; }


/* === Apex演出（5個一致） === */
body.soul-apex #journal-frame {
  border-color: #fff;
  box-shadow: 0 0 50px rgba(255,255,255,0.9);
  animation: apexPulse 2s ease-in-out infinite;
}

.apex-text {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 1rem;
  text-shadow: 0 0 10px #fff;
}

#event-layer.apex {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(255,255,255,0.85);
  z-index: 1009;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeInWhite 0.5s ease forwards;
}
.apex-container {
  text-align: center;
  padding: 2rem;
  border: 4px solid #fff;
  background: rgba(0,0,0,0.6);
  box-shadow: 0 0 20px rgba(255,255,255,0.8);
  border-radius: 16px;
  animation: apexPulse 2s ease-in-out infinite;
}
@keyframes apexPulse {
  0%,100% { box-shadow: 0 0 20px rgba(255,255,255,0.6); }
  50% { box-shadow: 0 0 80px rgba(255,255,255,1); }
}
.big-resonance-btn {
  background: linear-gradient(270deg, red,orange,yellow,green,cyan,blue,violet);
  background-size: 400% 400%;
  color: #fff;
  padding: 1rem 2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  animation: rainbowShift 5s linear infinite;
}
@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* === 隠しデバッグパネル === */
#golden-debug-toggle {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 40px; height: 40px;
  cursor: pointer;
  z-index: 100000;
}
#tgj-debug-panel {
  position: fixed;
  bottom: 70px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  background: rgba(0,0,0,0.85);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  z-index: 99999;
}
#tgj-debug-panel.tgj-hidden {
  display: none !important;
}
