:root {
  --primary: #0f172a;
  --accent: #c5a059;
  --bg-base: #faf9f6;
  --problem-red: #7f1d1d;
}

body {
  font-family: "Noto Sans JP", sans-serif;
  background-color: var(--bg-base);
  color: var(--primary);
  scroll-behavior: smooth;
  overflow-x: hidden;
}

.font-serif {
  font-family: "Noto Serif JP", serif;
}

/* Texture Noise overlay */
.bg-noise {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
}

/* Reveal transition logic */
.reveal {
  opacity: 0;
  transform: translateY(100px);
  transition: all 1.8s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Main title gold luster - Adjusted for sharper contrast */
.gold-shine {
  background: linear-gradient(135deg, #ebdcb2 0%, #c5a059 50%, #8a6d3b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.5));
}

/* Shine animation for buttons/text */
@keyframes shine {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
.animate-shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent,
    rgba(255, 255, 255, 0.5),
    transparent
  );
  transform: skewX(-25deg);
  animation: shine 4s infinite;
}

/* Spin slow for diagram decoration */
@keyframes spin-slow {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
.animate-spin-slow {
  animation: spin-slow 20s linear infinite;
}

/* Custom shadows for high-fidelity UI */
.shadow-4xl {
  box-shadow: 0 60px 180px -30px rgba(0, 0, 0, 0.8);
}
.shadow-5xl {
  box-shadow: 0 80px 250px -50px rgba(0, 0, 0, 0.25);
}

/* Writing Mode */
.writing-vertical-rl {
  writing-mode: vertical-rl;
}

/* Horizontal Float for play icon */
@keyframes float-x {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(12px);
  }
}
.animate-float-x {
  animation: float-x 4s ease-in-out infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: #020617;
}
::-webkit-scrollbar-thumb {
  background: #c5a059;
}

/* Global Typography adjustments for high-fidelity */
h2 {
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.bg-grid-pattern {
  background-image: radial-gradient(circle, #0f172a 1px, transparent 1px);
  background-size: 10px 10px;
}

/* 鼓動と発光のアニメーション（緊急・強調版） */
@keyframes heartbeat-urgent {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(197, 160, 89, 0);
    border-color: rgba(197, 160, 89, 0.5);
  }
  15% {
    /* 1回目の鼓動：急拡大＆強く光る */
    transform: scale(1.08);
    border-color: rgba(197, 160, 89, 1);
    box-shadow:
      0 0 25px 5px rgba(197, 160, 89, 0.8),
      inset 0 0 15px rgba(197, 160, 89, 0.3);
  }
  30% {
    /* 一瞬収縮 */
    transform: scale(1);
    box-shadow: 0 0 5px 0 rgba(197, 160, 89, 0.3);
  }
  45% {
    /* 2回目の鼓動：さらに強く光る */
    transform: scale(1.08);
    border-color: rgba(197, 160, 89, 1);
    box-shadow:
      0 0 35px 10px rgba(197, 160, 89, 0.9),
      inset 0 0 20px rgba(197, 160, 89, 0.5);
  }
  100% {
    /* 休止 */
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(197, 160, 89, 0);
    border-color: rgba(197, 160, 89, 0.5);
  }
}

.animate-heartbeat-gold {
  /* 2秒間隔で繰り返す（ドクン・ドクン……ドクン・ドクン……） */
  animation: heartbeat-urgent 2s ease-in-out infinite;
  will-change: transform, box-shadow, border-color;
  /* 背景が黒でも光が目立つように少し明るい背景色を透過で乗せる */
  background-color: rgba(2, 6, 23, 0.9);
}
