html {
  scroll-behavior: smooth;
}

/* 全体リセット */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", sans-serif;
  line-height: 1.6;
  background-color: transparent;
  transition: background-color 0.3s ease;
  position: relative;
}

/* ダークモード時の背景色 */
body.dark-mode {
  background-color: rgba(26, 26, 46, 0.8);
}

/* 動く背景 */
.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
}

.video-background video {
  min-width: 100%;
  min-height: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  object-fit: cover;
}

/* ダークモード時は動画を暗くする */
body.dark-mode .video-background::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
}

/* ===== ヘッダー ===== */
.site-header {
  background-color: rgb(0, 96, 170);
  color: #fff;
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.logo img {
  height: 40px;
}

/* ===== ロゴアニメーション ===== */
.logo-svg, .logo-svg-animation {
  width: 120px;
  height: 40px;
}

/* パスのラインアニメーション */
.logo-path {
  stroke-dasharray: 2000;
  stroke-dashoffset: 2000;
  /* animation-delayを削除し、JavaScriptから制御 */
  animation: drawLogoColorShift 3.0s ease-in-out forwards;
  animation-play-state: paused; /* 初期状態は一時停止 */
}

/* ロゴアニメーション開始クラス追加時に再生 */
body:not(.logo-loaded) .logo-path {
  animation-play-state: paused;
}

/* ラインを描いてマゼンタ→シアン→白 */
@keyframes drawLogoColorShift {
  0% {
    stroke-dashoffset: 2000;
    fill: transparent;
  }
  50% {
    stroke-dashoffset: 0;
    fill: transparent;
  }
  75% {
    fill: #0077ff; /* シアン */
    fill-opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    fill: #ffffff; /* 白 */
    fill-opacity: 1;
  }
}

/* 2回目以降はアニメーションなし */
body.logo-loaded .logo-path {
  animation: none;
  stroke-dashoffset: 0;
  fill: #ffffff;
  fill-opacity: 1;
}

/* ==== ダークモード切り替えボタン ==== */
.theme-toggle {
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid #fff;
  color: #fff;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  margin-left: auto;
  margin-right: 15px;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* ナビ(PC版) */
.nav ul {
  display: flex;
  list-style: none;
}

.nav ul li {
  margin-left: 20px;
}

.nav ul li a {
  color: #f7f7f7;
  text-decoration: none;
  font-weight: bold;
  transition: opacity 0.3s;
  position: relative;
  display: inline-block;
}

/* アニメーション付き下線 */
.nav ul li a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #fff;
  transition: width 0.3s ease, left 0.3s ease;
}

.nav ul li a:hover::after {
  width: 100%;
  left: 0;
}

/* ===== ハンバーガーボタン ===== */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 25px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
}

.hamburger span {
  display: block;
  height: 3px;
  background: #ffffff;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* 開閉時のアニメーション */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translateY(7px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translateY(-7px);
}

/* ===== 目次（TOC） ===== */
.toc {
  background: rgba(240, 248, 255, 0.9);
  border-left: 5px solid rgb(0, 96, 170);
  padding: 15px 20px;
  margin: 20px 0 30px;
  border-radius: 6px;
}

.toc h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: rgb(0, 96, 170);
}

.toc ul {
  list-style: none;
  padding-left: 0;
}

.toc ul li {
  margin: 8px 0;
}

.toc ul li a {
  text-decoration: none;
  color: #333;
  font-weight: bold;
  transition: color 0.3s, transform 0.2s;
}

.toc ul li a:hover {
  color: rgb(0, 96, 170);
  transform: translateX(4px);
}

/* ダークモード対応 */
body.dark-mode .toc {
  background: rgba(60, 60, 80, 0.9);
  border-left: 5px solid #4fc3ff;
}

body.dark-mode .toc h2 {
  color: #4fc3ff;
}

body.dark-mode .toc ul li a {
  color: #e0e0e0;
}

body.dark-mode .toc ul li a:hover {
  color: #4fc3ff;
}

/* ===== スクロールボタン ===== */
.scroll-buttons {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.scroll-btn {
  width: 55px;
  height: 55px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  padding: 0;
}

.scroll-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-btn:hover {
  transform: translateY(-3px) scale(1.08);
  filter: drop-shadow(0 6px 12px rgba(0, 96, 170, 0.4));
}

.scroll-btn:active {
  transform: translateY(-1px) scale(1.02);
}

.scroll-btn svg {
  width: 100%;
  height: 100%;
  display: block;
}

.scroll-btn .Arrow_up,
.scroll-btn .Arrow_down {
  fill: rgb(0, 96, 170);
  stroke: #ffffff;
  stroke-width: 5px;
  transition: fill 0.3s ease;
}

.scroll-btn:hover .Arrow_up,
.scroll-btn:hover .Arrow_down {
  fill: rgb(0, 128, 226);
}

.scroll-btn .arrow-icon {
  fill: #ffffff;
  stroke: #3f3f49;
  stroke-width: 10px;
  transition: fill 0.3s ease;
}

/* ダークモード対応 */
body.dark-mode .scroll-btn .Arrow_up,
body.dark-mode .scroll-btn .Arrow_down {
  fill: rgb(0, 130, 196);
}

body.dark-mode .scroll-btn:hover .Arrow_up,
body.dark-mode .scroll-btn:hover .Arrow_down {
  fill: rgb(0, 150, 224);
}

body.dark-mode .scroll-btn:hover {
  filter: drop-shadow(0 6px 12px rgba(79, 195, 255, 0.4));
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .scroll-buttons {
    bottom: 20px;
    right: 20px;
    gap: 10px;
  }

  .scroll-btn {
    width: 48px;
    height: 48px;
  }
}

/* ===== プログレスバー ===== */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0, 96, 170);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: transform 0.5s ease-out; /* cubic-bezierを削除してシンプルに */
}

.progress-container.slide-up {
  transform: translateY(-100%);
}

.progress-wrapper {
  text-align: center;
}

.progress-bar {
  width: 400px;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 0 20px rgba(0, 150, 255, 0.3);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0066ff, #00ccff, #9933ff);
  background-size: 200% 100%;
  border-radius: 50px;
  transition: width 0.1s ease;
  animation: gradientShift 2s ease infinite;
  position: relative;
  z-index: 2;
}

.progress-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes pulse {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

.progress-text {
  margin-top: 20px;
  font-size: 2rem;
  font-weight: bold;
  color: #00ccff;
  text-shadow: 0 0 20px rgba(0, 204, 255, 0.5);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .progress-bar {
    width: 80%;
    max-width: 300px;
  }
  
  .progress-text {
    font-size: 1.5rem;
  }
}

/* ===== メイン ===== */
.site-main {
  display: flex;
  justify-content: center;
  padding: 20px;
  min-height: calc(100vh - 250px);
  gap: 7px;
  max-width: 1250px; /* 全体の最大幅を設定 */
  margin: 0 auto; /* 中央配置 */
  width: 100%; /* 画面幅いっぱいまで使用 */
}

.main-wrapper {
  flex: 2;
  min-width: 250px;
  background: linear-gradient(
    180deg,
    rgba(42, 247, 247, 0.7),
    rgba(213, 45, 255, 0.7),
    rgba(252, 54, 226, 0.7),
    rgba(42, 247, 247, 0.7)
  );
  background-size: 100% 300%;
  animation: gradientFlow 45s ease-in-out infinite;
  padding: 7px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

@keyframes gradientFlow {
  0% {background-position: 0% 0%;}
  50% {background-position: 0% 100%;}
  100% {background-position: 0% 0%;}
}

.content {
  padding: 20px;
  background-color: rgba(255, 255, 255, 0.98);
  border-radius: 8px;
  transition: background-color 0.3s ease, color 0.3s ease;
  height: 100%;
}

body.dark-mode .content {
  background-color: rgba(51, 51, 68, 0.98);
  color: #e0e0e0;
}

body.dark-mode .content h2 {
  color: #ffffff;
}

body.dark-mode .content hr {
  border-color: #555566;
}

.img-container {
  display: flex;
  align-items: center;
  gap: 3px;
}

.img120 img {
  width: 120%;
}

.img100 img {
  width: 100%;
}

.img80 img {
  width: 80%;
}

.img70 img {
  width: 70%;
}

.img60 img {
  width: 60%;
}

.img50 img {
  width: 50%;
}

.img40 img {
  width: 40%;
}

.img20 img {
  width: 20%;
}

/* サイドバーラッパー */
.sidebar-wrapper {
  flex: 1;
  min-width: 250px;
  align-self: flex-start;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
}

/* サイドバーコンテンツ */
.sidebar {
  padding: 15px;
  background-color: rgb(221, 221, 221);
  border-radius: 8px;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-y: auto;
  max-height: calc(100vh - 100px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body.dark-mode .sidebar {
  background-color: rgb(68, 68, 85);
  color: #e0e0e0;
}

body.dark-mode .sidebar h2 {
  color: #ffffff;
}

/* サイドバーのスクロールバーをカスタマイズ */
.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 96, 170, 0.5);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 96, 170, 0.7);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb {
  background: rgba(79, 195, 255, 0.5);
}

body.dark-mode .sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 195, 255, 0.7);
}

a[target="_blank"]::after {
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  content: "\f08e";  /* 別の外部リンクアイコン */
  margin-left: 5px;
  font-size: 0.75em;
}


/* ===== フッター ===== */
.site-footer {
  background-color: rgb(0, 96, 170);
  color: #fff;
  text-align: center;
  padding: 20px;
}

.footer-nav ul {
  list-style: none;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav ul li {
  margin: 0 10px;
}

.footer-nav ul li a {
  color: #f7f7f7;
  text-decoration: none;
  font-weight: bold;
  transition: opacity 0.3s;
  position: relative;
  display: inline-block;
}

.footer-nav ul li a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #fff;
  transition: width 0.3s ease, left 0.3s ease;
}

.footer-nav ul li a:hover::after {
  width: 100%;
  left: 0;
}

.copy {
  font-size: 0.9em;
  color: #fff;
}

/* ===== スクロールアニメーション ===== */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ゲームアイテムごとに遅延を追加 */
.game-item {
  margin-bottom: 30px;
}

.game-item:nth-child(even) {
  transition-delay: 0.1s;
}

.game-item:nth-child(odd) {
  transition-delay: 0.2s;
}

/* ===== レスポンシブ対応 ===== */
@media (max-width: 768px) {

  .header-inner {
    flex-direction: row;
    align-items: center;
  }

  .theme-toggle {
    padding: 6px 12px;
    font-size: 1rem;
    margin-right: 10px;
  }

  /* ハンバーガー表示 */
  .hamburger {
    display: flex;
  }

  /* ナビはデフォルト非表示 */
  .nav {
    display: none;
    width: 100%;
    background: rgb(0, 96, 170);
    margin-top: 10px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
  }

  .nav ul {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 20px;
  }

  .nav ul li {
    margin: 10px 0;
    width: 100%;
  }

  .nav ul li a {
    display: block;
    padding: 10px 0;
  }

  /* ハンバーガーONで表示 */
  .nav.active {
    display: block;
  }

  .main-wrapper {
    flex-direction: column;
  }

  .content {
    margin-right: 0;
    margin-bottom: 20px;
  }

  .site-main {
    flex-direction: column;
    gap: 20px;
  }

  .content-wrapper {
    margin-bottom: 0;
  }

  .sidebar-wrapper {
    position: static;
    max-height: none;
    min-width: 100%;
  }

  .sidebar {
    max-height: none;
  }
}